public abstract class OBaseParser extends Object
Modifier and Type | Field and Description |
---|---|
String |
parserText |
String |
parserTextUpperCase |
Constructor and Description |
---|
OBaseParser() |
Modifier and Type | Method and Description |
---|---|
int |
getLastWordLength() |
String |
getSyntax() |
static void |
getWordStatic(CharSequence iText,
int iBeginIndex,
String iSeparatorChars,
StringBuilder ioBuffer) |
static int |
nextWord(String iText,
String iTextUpperCase,
int ioCurrentPosition,
StringBuilder ioWord,
boolean iForceUpperCase) |
static int |
nextWord(String iText,
String iTextUpperCase,
int ioCurrentPosition,
StringBuilder ioWord,
boolean iForceUpperCase,
String iSeparatorChars) |
protected String |
parseOptionalWord(boolean iUpperCase,
String... iWords)
Parses the next word.
|
char |
parserGetCurrentChar()
Returns the current character in the current stream position
|
int |
parserGetCurrentPosition()
Returns the current stream position.
|
char |
parserGetLastSeparator()
Returns the last separator encountered, otherwise returns a blank (' ').
|
String |
parserGetLastWord()
Returns the last parsed word.
|
int |
parserGetPreviousPosition()
Returns the stream position before last parsing.
|
protected int |
parserGoBack()
Goes back to the previous position.
|
boolean |
parserIsEnded()
Tells if the parsing has reached the end of the content.
|
protected boolean |
parserMoveCurrentPosition(int iOffset)
Moves the current stream position forward or backward of iOffset characters
|
protected int |
parserNextChars(boolean iUpperCase,
boolean iMandatory,
String... iCandidateWords)
Parses the next sequence of chars.
|
protected String |
parserNextWord(boolean iForceUpperCase)
Parses the next word.
|
protected String |
parserNextWord(boolean iForceUpperCase,
String iSeparatorChars)
Parses the next word.
|
protected String |
parserNextWord(boolean iForceUpperCase,
String iSeparatorChars,
boolean preserveEscapes) |
protected boolean |
parserOptionalKeyword(String... iWords)
Parses optional keywords between the iWords.
|
protected String |
parserOptionalWord(boolean iUpperCase)
Parses the next word.
|
protected void |
parserRequiredKeyword(String... iWords)
Parses the next word.
|
protected String |
parserRequiredWord(boolean iUpperCase)
Parses the next word.
|
protected String |
parserRequiredWord(boolean iUpperCase,
String iCustomMessage)
Parses the next word.
|
protected String |
parserRequiredWord(boolean iUpperCase,
String iCustomMessage,
String iSeparators)
Parses the next word.
|
protected boolean |
parserSetCurrentPosition(int iPosition)
Overwrites the current stream position.
|
protected void |
parserSetEndOfText()
Sets the end of text as position
|
void |
parserSetLastSeparator(char iSeparator)
Overwrites the last separator.
|
protected boolean |
parserSkipWhiteSpaces()
Skips not valid characters like spaces and line feeds.
|
protected abstract void |
throwSyntaxErrorException(String iText)
Throws a syntax error exception.
|
public String parserText
public String parserTextUpperCase
public static int nextWord(String iText, String iTextUpperCase, int ioCurrentPosition, StringBuilder ioWord, boolean iForceUpperCase)
public static int nextWord(String iText, String iTextUpperCase, int ioCurrentPosition, StringBuilder ioWord, boolean iForceUpperCase, String iSeparatorChars)
public static void getWordStatic(CharSequence iText, int iBeginIndex, String iSeparatorChars, StringBuilder ioBuffer)
iText
- Text where to searchiBeginIndex
- Begin indexiSeparatorChars
- Separators as a String of multiple charactersioBuffer
- StringBuilder object with the word foundpublic String getSyntax()
public char parserGetLastSeparator()
public void parserSetLastSeparator(char iSeparator)
public int parserGetPreviousPosition()
public boolean parserIsEnded()
public int parserGetCurrentPosition()
public char parserGetCurrentChar()
public String parserGetLastWord()
public int getLastWordLength()
protected abstract void throwSyntaxErrorException(String iText)
iText
- Text about the problem.protected String parserOptionalWord(boolean iUpperCase)
iUpperCase
- True if must return UPPERCASE, otherwise falseprotected String parseOptionalWord(boolean iUpperCase, String... iWords)
iUpperCase
- True if must return UPPERCASE, otherwise falseprotected int parserGoBack()
protected String parserRequiredWord(boolean iUpperCase)
iUpperCase
- True if must return UPPERCASE, otherwise falseprotected String parserRequiredWord(boolean iUpperCase, String iCustomMessage)
iUpperCase
- True if must return UPPERCASE, otherwise falseiCustomMessage
- Custom message to include in case of SyntaxError exceptionprotected String parserRequiredWord(boolean iUpperCase, String iCustomMessage, String iSeparators)
iUpperCase
- True if must return UPPERCASE, otherwise falseiCustomMessage
- Custom message to include in case of SyntaxError exceptioniSeparators
- Separator charactersprotected void parserRequiredKeyword(String... iWords)
iWords
- Array of expected keywordsprotected int parserNextChars(boolean iUpperCase, boolean iMandatory, String... iCandidateWords)
protected boolean parserOptionalKeyword(String... iWords)
iWords
- Optional words to match as keyword. If at least one is passed, then the check is
madeprotected boolean parserSkipWhiteSpaces()
protected boolean parserSetCurrentPosition(int iPosition)
iPosition
- New positionprotected void parserSetEndOfText()
protected boolean parserMoveCurrentPosition(int iOffset)
iOffset
- Number of characters to move. Negative numbers means backwardsprotected String parserNextWord(boolean iForceUpperCase)
iForceUpperCase
- True if must return UPPERCASE, otherwise falseprotected String parserNextWord(boolean iForceUpperCase, String iSeparatorChars)
iForceUpperCase
- True if must return UPPERCASE, otherwise falseiSeparatorChars
- Copyright © 2009–2020 OrientDB. All rights reserved.