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.IOException
ParseException
public final boolean Line() throws ParseException
ParseException
public final Modifiers Modifiers(int context, boolean lookahead) throws ParseException
ParseException
public final void ClassDeclaration() throws ParseException
ParseException
public final void MethodDeclaration() throws ParseException
ParseException
public final void PackageDeclaration() throws ParseException
ParseException
public final void ImportDeclaration() throws ParseException
ParseException
public final void VariableDeclarator() throws ParseException
ParseException
public final void VariableInitializer() throws ParseException
ParseException
public final void ArrayInitializer() throws ParseException
ParseException
public final void FormalParameters() throws ParseException
ParseException
public final void FormalParameter() throws ParseException
ParseException
public final void Type() throws ParseException
ParseException
public final void ReturnType() throws ParseException
ParseException
public final void PrimitiveType() throws ParseException
ParseException
public final void AmbiguousName() throws ParseException
ParseException
public final int NameList() throws ParseException
ParseException
public final void Expression() throws ParseException
ParseException
public final void Assignment() throws ParseException
ParseException
public final int AssignmentOperator() throws ParseException
ParseException
public final void ConditionalExpression() throws ParseException
ParseException
public final void ConditionalOrExpression() throws ParseException
ParseException
public final void ConditionalAndExpression() throws ParseException
ParseException
public final void InclusiveOrExpression() throws ParseException
ParseException
public final void ExclusiveOrExpression() throws ParseException
ParseException
public final void AndExpression() throws ParseException
ParseException
public final void EqualityExpression() throws ParseException
ParseException
public final void InstanceOfExpression() throws ParseException
ParseException
public final void RelationalExpression() throws ParseException
ParseException
public final void ShiftExpression() throws ParseException
ParseException
public final void AdditiveExpression() throws ParseException
ParseException
public final void MultiplicativeExpression() throws ParseException
ParseException
public final void UnaryExpression() throws ParseException
ParseException
public final void PreIncrementExpression() throws ParseException
ParseException
public final void PreDecrementExpression() throws ParseException
ParseException
public final void UnaryExpressionNotPlusMinus() throws ParseException
ParseException
public final void CastLookahead() throws ParseException
ParseException
public final void PostfixExpression() throws ParseException
ParseException
public final void CastExpression() throws ParseException
ParseException
public final void PrimaryExpression() throws ParseException
ParseException
public final void MethodInvocation() throws ParseException
ParseException
public final void PrimaryPrefix() throws ParseException
ParseException
public final void PrimarySuffix() throws ParseException
ParseException
public final void Literal() throws ParseException
ParseException
public final boolean BooleanLiteral() throws ParseException
ParseException
public final void NullLiteral() throws ParseException
ParseException
public final void VoidLiteral() throws ParseException
ParseException
public final void Arguments() throws ParseException
ParseException
public final void ArgumentList() throws ParseException
ParseException
public final void AllocationExpression() throws ParseException
ParseException
public final void ArrayDimensions() throws ParseException
ParseException
public final void Statement() throws ParseException
ParseException
public final void LabeledStatement() throws ParseException
ParseException
public final void Block() throws ParseException
ParseException
public final void BlockStatement() throws ParseException
ParseException
public final void FormalComment() throws ParseException
ParseException
public final void EmptyStatement() throws ParseException
ParseException
public final void StatementExpression() throws ParseException
ParseException
public final void SwitchStatement() throws ParseException
ParseException
public final void SwitchLabel() throws ParseException
ParseException
public final void IfStatement() throws ParseException
ParseException
public final void WhileStatement() throws ParseException
ParseException
public final void DoStatement() throws ParseException
ParseException
public final void ForStatement() throws ParseException
ParseException
public final void EnhancedForStatement() throws ParseException
ParseException
public final void ForInit() throws ParseException
ParseException
public final void TypedVariableDeclaration() throws ParseException
ParseException
public final void StatementExpressionList() throws ParseException
ParseException
public final void ForUpdate() throws ParseException
ParseException
public final void BreakStatement() throws ParseException
ParseException
public final void ContinueStatement() throws ParseException
ParseException
public final void ReturnStatement() throws ParseException
ParseException
public final void SynchronizedStatement() throws ParseException
ParseException
public final void ThrowStatement() throws ParseException
ParseException
public final void TryStatement() throws ParseException
ParseException
public 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()