|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mvel2.compiler.AbstractParser
public class AbstractParser
This is the core parser that the subparsers extend.
| Field Summary | |
|---|---|
protected java.lang.Object |
ctx
|
protected int |
cursor
|
protected boolean |
debugSymbols
|
protected ExecutionStack |
dStack
|
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 boolean |
literalOnly
|
static java.util.HashMap<java.lang.String,java.lang.Object> |
LITERALS
|
protected static int |
OP_CONTINUE
|
protected static int |
OP_OVERFLOW
|
protected static int |
OP_RESET_FRAME
|
protected static int |
OP_TERMINATE
|
static java.util.HashMap<java.lang.String,java.lang.Integer> |
OPERATORS
|
protected static java.lang.ThreadLocal<ParserContext> |
parserContext
|
protected ParserContext |
pCtx
|
protected static int |
REMOVE
|
protected static int |
SET
|
protected ExecutionStack |
splitAccumulator
|
protected int |
start
|
protected ExecutionStack |
stk
|
protected VariableResolverFactory |
variableFactory
|
| Constructor Summary | |
|---|---|
AbstractParser()
|
|
| Method Summary | |
|---|---|
protected void |
addFatalError(java.lang.String message)
|
protected void |
addFatalError(java.lang.String message,
int row,
int cols)
|
protected void |
addWarning(java.lang.String message)
|
protected int |
arithmeticFunctionReduction(int operator)
|
protected void |
captureIdentifier()
|
protected void |
captureToEOL()
From the current cursor position, capture to the end of the line. |
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. |
static ParserContext |
contextControl(int operation,
ParserContext pCtx,
AbstractParser parser)
|
protected void |
expectEOS()
|
void |
expectNextChar_IW(char c)
|
protected static java.lang.String |
getCurrentSourceFileName()
|
static ParserContext |
getCurrentThreadParserContext()
|
protected ParserContext |
getParserContext()
|
ASTNode |
handleSubstatement(Substatement stmt)
|
protected ASTNode |
handleUnion(ASTNode node)
|
protected boolean |
ifThenElseBlockContinues()
Checking from the current cursor position, check to see if the if-then-else block continues. |
int |
incNextNonBlank()
|
protected static boolean |
isArithmeticOperator(int operator)
|
boolean |
isDebugSymbols()
|
protected boolean |
isNextIdentifier()
|
protected boolean |
isNextIdentifierOrLiteral()
|
static boolean |
isNotValidNameorLabel(java.lang.String name)
Check if the specfied string represents a valid name of label. |
static boolean |
isReservedWord(java.lang.String name)
Check if the specified string is a reserved word in the parser. |
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 java.util.HashMap<java.lang.String,java.lang.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. |
void |
newContext()
Create a new ParserContext in the current thread. |
void |
newContext(ParserContext pCtx)
Create a new ParserContext in the current thread, using the one specified. |
int |
nextNonBlank()
|
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. |
void |
removeContext()
Remove the current ParserContext from the thread. |
static void |
resetParserContext()
Remove the current parser context from the thread. |
static void |
setCurrentThreadParserContext(ParserContext pCtx)
|
void |
setDebugSymbols(boolean debugSymbols)
|
protected void |
setExpression(char[] expression)
|
protected void |
setExpression(java.lang.String expression)
|
static void |
setLanguageLevel(int level)
|
protected int |
skipCommentBlock()
|
protected void |
skipWhitespace()
If the cursor is currently pointing to whitespace, move the cursor forward to the first non-whitespace character. |
protected void |
skipWhitespaceWithLineAccounting()
If the cursor is currently pointing to whitespace, move the cursor forward to the first non-whitespace character, but account for carraige 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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected char[] expr
protected int cursor
protected int start
protected int length
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 literalOnly
protected boolean debugSymbols
protected int lastLineStart
protected int line
protected ASTNode lastNode
public static final java.util.HashMap<java.lang.String,java.lang.Object> LITERALS
public static final java.util.HashMap<java.lang.String,java.lang.Integer> OPERATORS
protected ExecutionStack stk
protected ExecutionStack splitAccumulator
protected static java.lang.ThreadLocal<ParserContext> parserContext
protected ParserContext pCtx
protected ExecutionStack dStack
protected java.lang.Object ctx
protected VariableResolverFactory variableFactory
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
| Constructor Detail |
|---|
public AbstractParser()
| Method Detail |
|---|
protected ASTNode nextTokenSkipSymbols()
protected ASTNode nextToken()
public ASTNode handleSubstatement(Substatement stmt)
protected ASTNode handleUnion(ASTNode node)
protected boolean ifThenElseBlockContinues()
protected int skipCommentBlock()
protected boolean tokenContinues()
protected void expectEOS()
protected boolean isNextIdentifier()
protected void captureToEOS()
protected void captureToEOSorEOL()
protected void captureToEOL()
protected void captureIdentifier()
protected void captureToEOT()
protected boolean lastNonWhite(char c)
protected int trimLeft(int pos)
pos - - current position
protected int trimRight(int pos)
pos - -
protected void skipWhitespace()
protected void skipWhitespaceWithLineAccounting()
protected void captureToNextTokenJunction()
protected void trimWhitespace()
public static boolean isReservedWord(java.lang.String name)
name -
public static boolean isNotValidNameorLabel(java.lang.String name)
name -
protected void setExpression(java.lang.String expression)
protected void setExpression(char[] expression)
protected 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)
protected boolean isStatementNotManuallyTerminated()
protected ParserContext getParserContext()
public static ParserContext getCurrentThreadParserContext()
public static void setCurrentThreadParserContext(ParserContext pCtx)
public void newContext()
public void newContext(ParserContext pCtx)
pCtx - public void removeContext()
public static ParserContext contextControl(int operation,
ParserContext pCtx,
AbstractParser parser)
public boolean isDebugSymbols()
public void setDebugSymbols(boolean debugSymbols)
protected static java.lang.String getCurrentSourceFileName()
protected void addFatalError(java.lang.String message)
protected void addFatalError(java.lang.String message,
int row,
int cols)
protected void addWarning(java.lang.String message)
public static void setLanguageLevel(int level)
public static java.util.HashMap<java.lang.String,java.lang.Integer> loadLanguageFeaturesByLevel(int languageLevel)
public static void resetParserContext()
protected static boolean isArithmeticOperator(int operator)
protected int arithmeticFunctionReduction(int operator)
protected void reduce()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||