public class Parser extends java.lang.Object implements ParserTreeConstants, ParserConstants
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)
}
| Modifier and Type | Field and Description |
|---|---|
Token |
jj_nt |
protected org.gjt.sp.jedit.bsh.JJTParserState |
jjtree |
boolean |
lookingAhead |
Token |
token |
ParserTokenManager |
token_source |
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_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| Constructor and Description |
|---|
Parser(java.io.InputStream stream) |
Parser(ParserTokenManager tm) |
Parser(java.io.Reader stream) |
protected org.gjt.sp.jedit.bsh.JJTParserState jjtree
public ParserTokenManager token_source
public Token token
public Token jj_nt
public boolean lookingAhead
public Parser(java.io.InputStream stream)
public Parser(java.io.Reader stream)
public Parser(ParserTokenManager tm)
public void setRetainComments(boolean b)
public org.gjt.sp.jedit.bsh.SimpleNode popNode()
public static void main(java.lang.String[] args)
throws java.io.IOException,
ParseException
java.io.IOExceptionParseExceptionpublic final boolean Line()
throws ParseException
ParseExceptionpublic final Modifiers Modifiers(int context, boolean lookahead) throws ParseException
ParseExceptionpublic final void ClassDeclaration()
throws ParseException
ParseExceptionpublic final void MethodDeclaration()
throws ParseException
ParseExceptionpublic final void PackageDeclaration()
throws ParseException
ParseExceptionpublic final void ImportDeclaration()
throws ParseException
ParseExceptionpublic final void VariableDeclarator()
throws ParseException
ParseExceptionpublic final void VariableInitializer()
throws ParseException
ParseExceptionpublic final void ArrayInitializer()
throws ParseException
ParseExceptionpublic final void FormalParameters()
throws ParseException
ParseExceptionpublic final void FormalParameter()
throws ParseException
ParseExceptionpublic final void Type()
throws ParseException
ParseExceptionpublic final void ReturnType()
throws ParseException
ParseExceptionpublic final void PrimitiveType()
throws ParseException
ParseExceptionpublic final void AmbiguousName()
throws ParseException
ParseExceptionpublic final int NameList()
throws ParseException
ParseExceptionpublic final void Expression()
throws ParseException
ParseExceptionpublic final void Assignment()
throws ParseException
ParseExceptionpublic final int AssignmentOperator()
throws ParseException
ParseExceptionpublic final void ConditionalExpression()
throws ParseException
ParseExceptionpublic final void ConditionalOrExpression()
throws ParseException
ParseExceptionpublic final void ConditionalAndExpression()
throws ParseException
ParseExceptionpublic final void InclusiveOrExpression()
throws ParseException
ParseExceptionpublic final void ExclusiveOrExpression()
throws ParseException
ParseExceptionpublic final void AndExpression()
throws ParseException
ParseExceptionpublic final void EqualityExpression()
throws ParseException
ParseExceptionpublic final void InstanceOfExpression()
throws ParseException
ParseExceptionpublic final void RelationalExpression()
throws ParseException
ParseExceptionpublic final void ShiftExpression()
throws ParseException
ParseExceptionpublic final void AdditiveExpression()
throws ParseException
ParseExceptionpublic final void MultiplicativeExpression()
throws ParseException
ParseExceptionpublic final void UnaryExpression()
throws ParseException
ParseExceptionpublic final void PreIncrementExpression()
throws ParseException
ParseExceptionpublic final void PreDecrementExpression()
throws ParseException
ParseExceptionpublic final void UnaryExpressionNotPlusMinus()
throws ParseException
ParseExceptionpublic final void CastLookahead()
throws ParseException
ParseExceptionpublic final void PostfixExpression()
throws ParseException
ParseExceptionpublic final void CastExpression()
throws ParseException
ParseExceptionpublic final void PrimaryExpression()
throws ParseException
ParseExceptionpublic final void MethodInvocation()
throws ParseException
ParseExceptionpublic final void PrimaryPrefix()
throws ParseException
ParseExceptionpublic final void PrimarySuffix()
throws ParseException
ParseExceptionpublic final void Literal()
throws ParseException
ParseExceptionpublic final boolean BooleanLiteral()
throws ParseException
ParseExceptionpublic final void NullLiteral()
throws ParseException
ParseExceptionpublic final void VoidLiteral()
throws ParseException
ParseExceptionpublic final void Arguments()
throws ParseException
ParseExceptionpublic final void ArgumentList()
throws ParseException
ParseExceptionpublic final void AllocationExpression()
throws ParseException
ParseExceptionpublic final void ArrayDimensions()
throws ParseException
ParseExceptionpublic final void Statement()
throws ParseException
ParseExceptionpublic final void LabeledStatement()
throws ParseException
ParseExceptionpublic final void Block()
throws ParseException
ParseExceptionpublic final void BlockStatement()
throws ParseException
ParseExceptionpublic final void FormalComment()
throws ParseException
ParseExceptionpublic final void EmptyStatement()
throws ParseException
ParseExceptionpublic final void StatementExpression()
throws ParseException
ParseExceptionpublic final void SwitchStatement()
throws ParseException
ParseExceptionpublic final void SwitchLabel()
throws ParseException
ParseExceptionpublic final void IfStatement()
throws ParseException
ParseExceptionpublic final void WhileStatement()
throws ParseException
ParseExceptionpublic final void DoStatement()
throws ParseException
ParseExceptionpublic final void ForStatement()
throws ParseException
ParseExceptionpublic final void EnhancedForStatement()
throws ParseException
ParseExceptionpublic final void ForInit()
throws ParseException
ParseExceptionpublic final void TypedVariableDeclaration()
throws ParseException
ParseExceptionpublic final void StatementExpressionList()
throws ParseException
ParseExceptionpublic final void ForUpdate()
throws ParseException
ParseExceptionpublic final void BreakStatement()
throws ParseException
ParseExceptionpublic final void ContinueStatement()
throws ParseException
ParseExceptionpublic final void ReturnStatement()
throws ParseException
ParseExceptionpublic final void SynchronizedStatement()
throws ParseException
ParseExceptionpublic final void ThrowStatement()
throws ParseException
ParseExceptionpublic final void TryStatement()
throws ParseException
ParseExceptionpublic void ReInit(java.io.InputStream stream)
public void ReInit(java.io.Reader stream)
public void ReInit(ParserTokenManager tm)
public final Token getNextToken()
public final Token getToken(int index)
public ParseException generateParseException()
public final void enable_tracing()
public final void disable_tracing()