public abstract class AbstractBashLexer extends Object
| Constructor and Description |
|---|
AbstractBashLexer() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
backToPreviousState()
Goes back to the previous state of the lexer.
|
protected void |
decOpenParenthesisCount()
Decrements the open parenthesis counter
|
protected void |
enterHereStringContent()
Notifies that the lexer is entering a here-string content
|
protected void |
goToState(int newState)
Goes to the given state and stores the previous state on the stack of states.
|
protected HeredocLexingState |
heredocState()
Returns the
HeredocLexingState object used by the lexer to deal with here-docs |
protected void |
incOpenParenthesisCount()
Increments the open parenthesis counter
|
boolean |
isBash4()
Tells if the lexer is applying the Bash 4 syntax to analyze the code
|
protected boolean |
isEmptyConditionalCommand()
Tells if an empty conditional command (
[ ]) was met or not |
protected boolean |
isInCaseBody()
Tells if the lexer is currently in a case statement
|
protected boolean |
isInHereStringContent()
Tells if the lexer is currently analyzing a in-here string
|
protected boolean |
isInState(int state)
Tells if the current lexical state is the passed state (possibly nesting/parent stated)
|
protected boolean |
isParamExpansionHash()
Tells if the lexer is currently considering a parameter expansion based on
# (e.g. |
protected boolean |
isParamExpansionOther()
Tells if the current token is a parameter expansion marker other than
# (e.g. |
protected boolean |
isParamExpansionWord()
Tells if the current lexer token is a parameter expansion word
|
protected void |
leaveHereStringContent()
Sets the in-here string state to
false |
protected int |
openParenthesisCount()
Returns the open parenthesis counter, i.e.
|
protected void |
popStates(int lastStateToPop)
Pops the passed state from the stack of nested states.
|
protected void |
setEmptyConditionalCommand(boolean emptyConditionalCommand)
Sets the flag that tracks empty conditional commands
|
protected void |
setInCaseBody(boolean inCaseBody)
Sets the flag that tells if the lexer is in a case statement
|
protected void |
setParamExpansionHash(boolean paramExpansionHash)
Sets the flag that tracks parameter expansion based on
# |
protected void |
setParamExpansionOther(boolean paramExpansionOther)
Sets the flag that tracks parameter expansion marker other than
# |
protected void |
setParamExpansionWord(boolean paramExpansionWord)
Sets the flag that tracks parameter expansion words
|
protected StringLexingstate |
stringParsingState()
Returns the
StringLexingState object used by the lexer to deal with strings |
protected Token |
token(TokenType type)
Create and return a
Token of given type. |
protected Token |
token(TokenType type,
int start,
int length)
Create and return a Token of given type from start with length
offset is added to start
|
protected abstract void |
yybegin(int newState)
Enters a new lexical state.
|
protected abstract int |
yychar()
Returns the char number from beginning of input stream.
|
protected abstract char |
yycharat(int pos)
Returns the character at position pos from the
matched text.
|
protected abstract int |
yycolumn()
Returns the column number from beginning of the line (starting from 0).
|
protected abstract int |
yylength()
Returns the length of the matched text region.
|
protected abstract Token |
yylex()
This is called to return the next Token from the input
Reader |
protected abstract int |
yyline()
Returns the start line number from beginning of input stream (starting from 0).
|
protected abstract void |
yyreset(Reader reader)
This will be called to reset the the lexer.
|
protected abstract int |
yystate()
Returns the current lexical state
|
protected abstract String |
yytext()
Returns the text matched by the current regular expression.
|
protected Token token(TokenType type, int start, int length)
type - the token typestart - the offset at which the token startslength - the token lengthToken built from the passed parametersprotected Token token(TokenType type)
Token of given type. The start offset is obtained from
yychar(), the length from yylength(),
the line number from yyline() and the column number from
yycolumn().type - the token typeToken of the given typeprotected abstract void yyreset(Reader reader)
reader - a reader to the content to be analyzedprotected abstract Token yylex() throws IOException
ReaderIOException - if the input reader cannot be readprotected abstract char yycharat(int pos)
yytext().charAt(pos), but faster.pos - the position of the character to fetch.
A value from 0 to yylength()-1.protected abstract int yylength()
protected abstract String yytext()
protected abstract int yychar()
protected abstract int yyline()
protected abstract int yycolumn()
protected abstract void yybegin(int newState)
newState - the new nexical stateprotected abstract int yystate()
protected boolean isInHereStringContent()
true if the lexer is analyzing a in-here string, false if notprotected void leaveHereStringContent()
falseprotected void backToPreviousState()
YYINITIAL, the initial state, is chosen.protected boolean isInState(int state)
state - a lexical state to testtrue if the passed state is in the current lexical state stack, false if notprotected HeredocLexingState heredocState()
HeredocLexingState object used by the lexer to deal with here-docsHeredocLexingState object used by the lexer to deal with here-docsprotected void goToState(int newState)
$(( 1+ $(echo 3) )).newState - the new state to go toprotected StringLexingstate stringParsingState()
StringLexingState object used by the lexer to deal with stringsStringLexingState object used by the lexer to deal with stringsprotected boolean isEmptyConditionalCommand()
[ ]) was met or nottrue if an empty conditional command ([ ]) was met, false if notprotected void setEmptyConditionalCommand(boolean emptyConditionalCommand)
emptyConditionalCommand - the value for the empty conditional command flagprotected void decOpenParenthesisCount()
protected void incOpenParenthesisCount()
protected int openParenthesisCount()
protected void enterHereStringContent()
protected boolean isParamExpansionHash()
# (e.g. ${parameter##word})true if the lexer is currently analyzing parameter expansion with # or not (false)protected void setParamExpansionHash(boolean paramExpansionHash)
#paramExpansionHash - the new value for the flagprotected boolean isParamExpansionWord()
true if the current token is a parameter expansion word, false if notprotected void setParamExpansionWord(boolean paramExpansionWord)
paramExpansionWord - the new value for the flagprotected boolean isParamExpansionOther()
# (e.g. %)true if the current token is a parameter expansion other that a word, false if notprotected void setParamExpansionOther(boolean paramExpansionOther)
#paramExpansionOther - the new value for the flagprotected void popStates(int lastStateToPop)
lastStateToPop - the state to be poppedpublic boolean isBash4()
true if the lexer is usgin the Bash 4 grammar, false if notprotected boolean isInCaseBody()
true if the lexer is in a case statement, false if notprotected void setInCaseBody(boolean inCaseBody)
inCaseBody - the new value for the flagCopyright © 2018–2019. All rights reserved.