public class AbstractParser extends Object implements Parser, Serializable
Modifier and Type | Field and Description |
---|---|
static HashMap<String,Object> |
CLASS_LITERALS |
protected boolean |
compileMode |
protected Object |
ctx |
protected int |
cursor |
protected boolean |
debugSymbols |
protected ExecutionStack |
dStack |
protected int |
end |
protected char[] |
expr |
protected int |
fields |
protected static int |
GET |
protected static int |
GET_OR_CREATE |
protected boolean |
greedy |
protected int |
lastLineStart |
protected ASTNode |
lastNode |
protected boolean |
lastWasComment |
protected boolean |
lastWasIdentifier |
protected boolean |
lastWasLineLabel |
protected int |
length |
static int |
LEVEL_0_PROPERTY_ONLY |
static int |
LEVEL_1_BASIC_LANG |
static int |
LEVEL_2_MULTI_STATEMENT |
static int |
LEVEL_3_ITERATION |
static int |
LEVEL_4_ASSIGNMENT |
static int |
LEVEL_5_CONTROL_FLOW |
protected int |
line |
protected int |
literalOnly |
static HashMap<String,Object> |
LITERALS |
protected static int |
OP_CONTINUE |
protected static int |
OP_OVERFLOW |
protected static int |
OP_RESET_FRAME |
protected static int |
OP_TERMINATE |
static HashMap<String,Integer> |
OPERATORS |
protected ParserContext |
pCtx |
protected static int |
REMOVE |
protected static int |
SET |
protected ExecutionStack |
splitAccumulator |
protected int |
st |
protected int |
start |
protected ExecutionStack |
stk |
protected VariableResolverFactory |
variableFactory |
Modifier | Constructor and Description |
---|---|
protected |
AbstractParser() |
protected |
AbstractParser(ParserContext pCtx) |
Modifier and Type | Method and Description |
---|---|
protected void |
addFatalError(String message) |
protected void |
addFatalError(String message,
int start) |
protected int |
arithmeticFunctionReduction(int operator)
Reduce the current operations on the stack.
|
protected void |
captureIdentifier()
Capture to the end of the current identifier under the cursor.
|
protected void |
captureToEOS()
Capture from the current cursor position, to the end of the statement.
|
protected void |
captureToEOSorEOL()
From the current cursor position, capture to the end of statement, or the end of line, whichever comes first.
|
protected void |
captureToEOT()
From the current cursor position, capture to the end of the current token.
|
protected void |
captureToNextTokenJunction()
From the current cursor position, capture to the end of the next token junction.
|
protected void |
expectEOS()
The parser should find a statement ending condition when this is called, otherwise everything should blow up.
|
void |
expectNextChar_IW(char c)
Expect the next specified character or fail
|
int |
getCursor() |
char[] |
getExpression() |
ASTNode |
handleSubstatement(Substatement stmt) |
protected ASTNode |
handleUnion(ASTNode node)
Handle a union between a closed statement and a residual property chain.
|
protected boolean |
ifThenElseBlockContinues()
Checking from the current cursor position, check to see if the if-then-else block continues.
|
int |
incNextNonBlank()
Increment one cursor position, and move cursor to next non-blank part.
|
protected static boolean |
isArithmeticOperator(int operator) |
protected boolean |
isNextIdentifier()
Checks to see if the next part of the statement is an identifier part.
|
protected boolean |
isNextIdentifierOrLiteral()
Returns true if the next is an identifier or literal.
|
protected boolean |
isStatementNotManuallyTerminated()
NOTE: This method assumes that the current position of the cursor is at the end of a logical statement, to
begin with.
|
protected boolean |
lastNonWhite(char c) |
static HashMap<String,Integer> |
loadLanguageFeaturesByLevel(int languageLevel) |
protected char |
lookAhead()
Return the next character (delta 1 of cursor position).
|
protected char |
lookAhead(int range)
Return the character, forward of the currrent cursor position based on the specified range delta.
|
protected char |
lookBehind()
Return the last character (delta -1 of cursor position).
|
protected char |
lookToLast()
Return the previous non-whitespace character.
|
int |
nextNonBlank()
Move to next cursor position from current cursor position.
|
protected ASTNode |
nextToken()
Retrieve the next token in the expression.
|
protected ASTNode |
nextTokenSkipSymbols() |
protected void |
reduce()
This method is called when we reach the point where we must subEval a trinary operation in the expression.
|
protected void |
setExpression(char[] expression)
Set and finesse the expression, trimming an leading or proceeding whitespace.
|
protected void |
setExpression(String expression)
Set and finesse the expression, trimming an leading or proceeding whitespace.
|
static void |
setLanguageLevel(int level) |
static void |
setupParser()
This method is internally called by the static initializer for AbstractParser in order to setup the parser.
|
protected void |
skipWhitespace()
If the cursor is currently pointing to whitespace, move the cursor forward to the first non-whitespace
character, but account for carriage returns in the script (updates parser field: line).
|
protected boolean |
tokenContinues()
Checking from the current cursor position, check to see if we're inside a contiguous identifier.
|
protected int |
trimLeft(int pos)
From the specified cursor position, trim out any whitespace between the current position and the end of the
last non-whitespace character.
|
protected int |
trimRight(int pos)
From the specified cursor position, trim out any whitespace between the current position and beginning of the
first non-whitespace character.
|
protected void |
trimWhitespace()
From the current cursor position, trim backward over any whitespace to the first non-whitespace character.
|
protected char[] expr
protected int cursor
protected int start
protected int length
protected int end
protected int st
protected int fields
protected static final int OP_OVERFLOW
protected static final int OP_TERMINATE
protected static final int OP_RESET_FRAME
protected static final int OP_CONTINUE
protected boolean greedy
protected boolean lastWasIdentifier
protected boolean lastWasLineLabel
protected boolean lastWasComment
protected boolean compileMode
protected int literalOnly
protected int lastLineStart
protected int line
protected ASTNode lastNode
protected ExecutionStack stk
protected ExecutionStack splitAccumulator
protected ParserContext pCtx
protected ExecutionStack dStack
protected Object ctx
protected VariableResolverFactory variableFactory
protected boolean debugSymbols
protected static final int SET
protected static final int REMOVE
protected static final int GET
protected static final int GET_OR_CREATE
public static final int LEVEL_5_CONTROL_FLOW
public static final int LEVEL_4_ASSIGNMENT
public static final int LEVEL_3_ITERATION
public static final int LEVEL_2_MULTI_STATEMENT
public static final int LEVEL_1_BASIC_LANG
public static final int LEVEL_0_PROPERTY_ONLY
protected AbstractParser()
protected AbstractParser(ParserContext pCtx)
public static void setupParser()
protected ASTNode nextTokenSkipSymbols()
protected ASTNode nextToken()
public ASTNode handleSubstatement(Substatement stmt)
protected ASTNode handleUnion(ASTNode node)
node
- an ast nodeprotected boolean ifThenElseBlockContinues()
protected boolean tokenContinues()
protected void expectEOS()
protected boolean isNextIdentifier()
protected void captureToEOS()
protected void captureToEOSorEOL()
protected void captureIdentifier()
protected void captureToEOT()
protected boolean lastNonWhite(char c)
protected int trimLeft(int pos)
pos
- - current positionprotected int trimRight(int pos)
pos
- -protected void skipWhitespace()
protected void captureToNextTokenJunction()
protected void trimWhitespace()
protected void setExpression(String expression)
expression
- the expressionprotected void setExpression(char[] expression)
expression
- the expressionprotected char lookToLast()
protected char lookBehind()
protected char lookAhead()
protected char lookAhead(int range)
range
- -protected boolean isNextIdentifierOrLiteral()
public int incNextNonBlank()
public int nextNonBlank()
public void expectNextChar_IW(char c)
c
- characterprotected boolean isStatementNotManuallyTerminated()
protected void addFatalError(String message)
protected void addFatalError(String message, int start)
public static void setLanguageLevel(int level)
public static HashMap<String,Integer> loadLanguageFeaturesByLevel(int languageLevel)
protected static boolean isArithmeticOperator(int operator)
protected int arithmeticFunctionReduction(int operator)
operator
- the operatorprotected void reduce()
public char[] getExpression()
getExpression
in interface Parser
Copyright © 2001–2021 JBoss by Red Hat. All rights reserved.