java.lang.Object
org.gjt.sp.jedit.bsh.Parser
- All Implemented Interfaces:
ParserConstants
,ParserTreeConstants
This is the BeanShell parser. It is used internally by the Interpreter
class (which is probably what you are looking for). The parser knows
only how to parse the structure of the language, it does not understand
names, commands, etc.
You can use the Parser from the command line to do basic structural
validation of BeanShell files without actually executing them. e.g.
java bsh.Parser [ -p ] file [ file ] [ ... ]
The -p option causes the abstract syntax to be printed.
From code you'd use the Parser like this:
Parser parser = new Parser(in);
while( !(eof=parser.Line()) ) {
SimpleNode node = parser.popNode();
// use the node, etc. (See bsh.BSH* classes)
}
-
Field Summary
Modifier and TypeFieldDescriptionprotected org.gjt.sp.jedit.bsh.JJTParserState
boolean
Fields inherited from interface org.gjt.sp.jedit.bsh.ParserConstants
_DEFAULT, ABSTRACT, ANDASSIGN, ANDASSIGNX, ASSIGN, BANG, BIT_AND, BIT_ANDX, BIT_OR, BIT_ORX, BOOL_AND, BOOL_ANDX, BOOL_OR, BOOL_ORX, BOOLEAN, BREAK, BYTE, CASE, CATCH, CHAR, CHARACTER_LITERAL, CLASS, COLON, COMMA, CONST, CONTINUE, DECIMAL_LITERAL, DECR, DEFAULT, DIGIT, DO, DOT, DOUBLE, ELSE, ENUM, EOF, EQ, EXPONENT, EXTENDS, FALSE, FINAL, FINALLY, FLOAT, FLOATING_POINT_LITERAL, FOR, FORMAL_COMMENT, GE, GEX, GOTO, GT, GTX, HASH_BANG_COMMENT, HEX_LITERAL, HOOK, IDENTIFIER, IF, IMPLEMENTS, IMPORT, INCR, INSTANCEOF, INT, INTEGER_LITERAL, INTERFACE, LBRACE, LBRACKET, LE, LETTER, LEX, LONG, LPAREN, LSHIFT, LSHIFTASSIGN, LSHIFTASSIGNX, LSHIFTX, LT, LTX, MINUS, MINUSASSIGN, MOD, MODASSIGN, MULTI_LINE_COMMENT, NATIVE, NE, NEW, NONPRINTABLE, NULL, OCTAL_LITERAL, ORASSIGN, ORASSIGNX, PACKAGE, PLUS, PLUSASSIGN, PRIVATE, PROTECTED, PUBLIC, RBRACE, RBRACKET, RETURN, RPAREN, RSIGNEDSHIFT, RSIGNEDSHIFTASSIGN, RSIGNEDSHIFTASSIGNX, RSIGNEDSHIFTX, RUNSIGNEDSHIFT, RUNSIGNEDSHIFTASSIGN, RUNSIGNEDSHIFTASSIGNX, RUNSIGNEDSHIFTX, SEMICOLON, SHORT, SINGLE_LINE_COMMENT, SLASH, SLASHASSIGN, STAR, STARASSIGN, STATIC, STRICTFP, STRING_LITERAL, SWITCH, SYNCHRONIZED, THROW, THROWS, TILDE, tokenImage, TRANSIENT, TRUE, TRY, VOID, VOLATILE, WHILE, XOR, XORASSIGN
Fields inherited from interface org.gjt.sp.jedit.bsh.ParserTreeConstants
JJTALLOCATIONEXPRESSION, JJTAMBIGUOUSNAME, JJTARGUMENTS, JJTARRAYDIMENSIONS, JJTARRAYINITIALIZER, JJTASSIGNMENT, JJTBINARYEXPRESSION, JJTBLOCK, JJTCASTEXPRESSION, JJTCLASSDECLARATION, JJTENHANCEDFORSTATEMENT, JJTFORMALCOMMENT, JJTFORMALPARAMETER, JJTFORMALPARAMETERS, JJTFORSTATEMENT, JJTIFSTATEMENT, JJTIMPORTDECLARATION, JJTLITERAL, JJTMETHODDECLARATION, JJTMETHODINVOCATION, jjtNodeName, JJTPACKAGEDECLARATION, JJTPRIMARYEXPRESSION, JJTPRIMARYSUFFIX, JJTPRIMITIVETYPE, JJTRETURNSTATEMENT, JJTRETURNTYPE, JJTSTATEMENTEXPRESSIONLIST, JJTSWITCHLABEL, JJTSWITCHSTATEMENT, JJTTERNARYEXPRESSION, JJTTHROWSTATEMENT, JJTTRYSTATEMENT, JJTTYPE, JJTTYPEDVARIABLEDECLARATION, JJTUNARYEXPRESSION, JJTVARIABLEDECLARATOR, JJTVOID, JJTWHILESTATEMENT
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal void
final void
final void
final void
final void
final void
final void
final void
final void
final int
final void
Block()
final void
final boolean
final void
final void
final void
final void
final void
final void
final void
final void
final void
final void
final void
final void
final void
final void
final void
final void
final void
ForInit()
final void
final void
final void
final void
final void
final Token
final Token
getToken
(int index) final void
final void
final void
final void
final void
final boolean
Line()
final void
Literal()
static void
final void
final void
final Modifiers
Modifiers
(int context, boolean lookahead) THE JAVA LANGUAGE GRAMMAR STARTS HERE *final void
final int
NameList()
final void
final void
org.gjt.sp.jedit.bsh.SimpleNode
popNode()
final void
final void
final void
final void
final void
final void
final void
void
ReInit
(InputStream stream) void
void
final void
final void
final void
void
setRetainComments
(boolean b) final void
final void
final void
final void
final void
final void
final void
final void
final void
final void
Type()
final void
Declared a typed variable.final void
final void
final void
final void
final void
final void
-
Field Details
-
jjtree
protected org.gjt.sp.jedit.bsh.JJTParserState jjtree -
token_source
-
token
-
jj_nt
-
lookingAhead
public boolean lookingAhead
-
-
Constructor Details
-
Parser
-
Parser
-
Parser
-
-
Method Details
-
setRetainComments
public void setRetainComments(boolean b) -
popNode
public org.gjt.sp.jedit.bsh.SimpleNode popNode() -
main
- Throws:
IOException
ParseException
-
Line
- Throws:
ParseException
-
Modifiers
THE JAVA LANGUAGE GRAMMAR STARTS HERE *- Throws:
ParseException
-
ClassDeclaration
- Throws:
ParseException
-
MethodDeclaration
- Throws:
ParseException
-
PackageDeclaration
- Throws:
ParseException
-
ImportDeclaration
- Throws:
ParseException
-
VariableDeclarator
- Throws:
ParseException
-
VariableInitializer
- Throws:
ParseException
-
ArrayInitializer
- Throws:
ParseException
-
FormalParameters
- Throws:
ParseException
-
FormalParameter
- Throws:
ParseException
-
Type
- Throws:
ParseException
-
ReturnType
- Throws:
ParseException
-
PrimitiveType
- Throws:
ParseException
-
AmbiguousName
- Throws:
ParseException
-
NameList
- Throws:
ParseException
-
Expression
- Throws:
ParseException
-
Assignment
- Throws:
ParseException
-
AssignmentOperator
- Throws:
ParseException
-
ConditionalExpression
- Throws:
ParseException
-
ConditionalOrExpression
- Throws:
ParseException
-
ConditionalAndExpression
- Throws:
ParseException
-
InclusiveOrExpression
- Throws:
ParseException
-
ExclusiveOrExpression
- Throws:
ParseException
-
AndExpression
- Throws:
ParseException
-
EqualityExpression
- Throws:
ParseException
-
InstanceOfExpression
- Throws:
ParseException
-
RelationalExpression
- Throws:
ParseException
-
ShiftExpression
- Throws:
ParseException
-
AdditiveExpression
- Throws:
ParseException
-
MultiplicativeExpression
- Throws:
ParseException
-
UnaryExpression
- Throws:
ParseException
-
PreIncrementExpression
- Throws:
ParseException
-
PreDecrementExpression
- Throws:
ParseException
-
UnaryExpressionNotPlusMinus
- Throws:
ParseException
-
CastLookahead
- Throws:
ParseException
-
PostfixExpression
- Throws:
ParseException
-
CastExpression
- Throws:
ParseException
-
PrimaryExpression
- Throws:
ParseException
-
MethodInvocation
- Throws:
ParseException
-
PrimaryPrefix
- Throws:
ParseException
-
PrimarySuffix
- Throws:
ParseException
-
Literal
- Throws:
ParseException
-
BooleanLiteral
- Throws:
ParseException
-
NullLiteral
- Throws:
ParseException
-
VoidLiteral
- Throws:
ParseException
-
Arguments
- Throws:
ParseException
-
ArgumentList
- Throws:
ParseException
-
AllocationExpression
- Throws:
ParseException
-
ArrayDimensions
- Throws:
ParseException
-
Statement
- Throws:
ParseException
-
LabeledStatement
- Throws:
ParseException
-
Block
- Throws:
ParseException
-
BlockStatement
- Throws:
ParseException
-
FormalComment
- Throws:
ParseException
-
EmptyStatement
- Throws:
ParseException
-
StatementExpression
- Throws:
ParseException
-
SwitchStatement
- Throws:
ParseException
-
SwitchLabel
- Throws:
ParseException
-
IfStatement
- Throws:
ParseException
-
WhileStatement
- Throws:
ParseException
-
DoStatement
- Throws:
ParseException
-
ForStatement
- Throws:
ParseException
-
EnhancedForStatement
- Throws:
ParseException
-
ForInit
- Throws:
ParseException
-
TypedVariableDeclaration
Declared a typed variable. Untyped variables are not declared per-se but are handled by the part of the grammar that deals with assignments.- Throws:
ParseException
-
StatementExpressionList
- Throws:
ParseException
-
ForUpdate
- Throws:
ParseException
-
BreakStatement
- Throws:
ParseException
-
ContinueStatement
- Throws:
ParseException
-
ReturnStatement
- Throws:
ParseException
-
SynchronizedStatement
- Throws:
ParseException
-
ThrowStatement
- Throws:
ParseException
-
TryStatement
- Throws:
ParseException
-
ReInit
-
ReInit
-
ReInit
-
getNextToken
-
getToken
-
generateParseException
-
enable_tracing
public final void enable_tracing() -
disable_tracing
public final void disable_tracing()
-