at.dms.kjc
Class KjcParser
java.lang.Object
|
+--antlr.Parser
|
+--antlr.LLkParser
|
+--at.dms.kjc.KjcParser
- All Implemented Interfaces:
- KjcTokenTypes
- public class KjcParser
- extends antlr.LLkParser
- implements KjcTokenTypes
Fields inherited from class antlr.LLkParser |
k |
Fields inherited from class antlr.Parser |
astFactory, inputState, returnAST, tokenNames, traceDepth |
Fields inherited from interface at.dms.kjc.KjcTokenTypes |
ASSIGN, BAND, BAND_ASSIGN, BNOT, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, CHARACTER_LITERAL, COLON, COMMA, DEC, DOT, EOF, EQUAL, GE, GT, IDENT, INC, INTEGER_LITERAL, LAND, LBRACK, LCURLY, LE, LITERAL_abstract, LITERAL_boolean, LITERAL_break, LITERAL_byte, LITERAL_case, LITERAL_catch, LITERAL_char, LITERAL_class, LITERAL_const, LITERAL_continue, LITERAL_default, LITERAL_do, LITERAL_double, LITERAL_else, LITERAL_extends, LITERAL_false, LITERAL_final, LITERAL_finally, LITERAL_float, LITERAL_for, LITERAL_goto, LITERAL_if, LITERAL_implements, LITERAL_import, LITERAL_instanceof, LITERAL_int, LITERAL_interface, LITERAL_long, LITERAL_native, LITERAL_new, LITERAL_null, LITERAL_package, LITERAL_private, LITERAL_protected, LITERAL_public, LITERAL_return, LITERAL_short, LITERAL_static, LITERAL_strictfp, LITERAL_super, LITERAL_switch, LITERAL_synchronized, LITERAL_this, LITERAL_throw, LITERAL_throws, LITERAL_transient, LITERAL_true, LITERAL_try, LITERAL_void, LITERAL_volatile, LITERAL_while, LNOT, LOR, LPAREN, LT, MINUS, MINUS_ASSIGN, NOT_EQUAL, NULL_TREE_LOOKAHEAD, PERCENT, PERCENT_ASSIGN, PLUS, PLUS_ASSIGN, QUESTION, RBRACK, RCURLY, REAL_LITERAL, RPAREN, SEMI, SL, SL_ASSIGN, SLASH, SLASH_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN, STRING_LITERAL |
Methods inherited from class antlr.LLkParser |
consume, LA, LT, traceIn, traceOut |
Methods inherited from class antlr.Parser |
addMessageListener, addParserListener, addParserMatchListener, addParserTokenListener, addSemanticPredicateListener, addSyntacticPredicateListener, addTraceListener, consumeUntil, consumeUntil, defaultDebuggingSetup, getAST, getASTFactory, getFilename, getInputState, getTokenName, getTokenNames, isDebugMode, mark, match, match, matchNot, panic, removeMessageListener, removeParserListener, removeParserMatchListener, removeParserTokenListener, removeSemanticPredicateListener, removeSyntacticPredicateListener, removeTraceListener, reportError, reportError, reportWarning, rewind, setASTFactory, setASTNodeClass, setASTNodeType, setDebugMode, setFilename, setIgnoreInvalidDebugCalls, setInputState, setTokenBuffer, traceIndent |
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
_tokenNames
public static final java.lang.String[] _tokenNames
_tokenSet_0
public static final antlr.collections.impl.BitSet _tokenSet_0
_tokenSet_1
public static final antlr.collections.impl.BitSet _tokenSet_1
_tokenSet_2
public static final antlr.collections.impl.BitSet _tokenSet_2
_tokenSet_3
public static final antlr.collections.impl.BitSet _tokenSet_3
_tokenSet_4
public static final antlr.collections.impl.BitSet _tokenSet_4
_tokenSet_5
public static final antlr.collections.impl.BitSet _tokenSet_5
_tokenSet_6
public static final antlr.collections.impl.BitSet _tokenSet_6
_tokenSet_7
public static final antlr.collections.impl.BitSet _tokenSet_7
_tokenSet_8
public static final antlr.collections.impl.BitSet _tokenSet_8
_tokenSet_9
public static final antlr.collections.impl.BitSet _tokenSet_9
_tokenSet_10
public static final antlr.collections.impl.BitSet _tokenSet_10
_tokenSet_11
public static final antlr.collections.impl.BitSet _tokenSet_11
_tokenSet_12
public static final antlr.collections.impl.BitSet _tokenSet_12
_tokenSet_13
public static final antlr.collections.impl.BitSet _tokenSet_13
_tokenSet_14
public static final antlr.collections.impl.BitSet _tokenSet_14
_tokenSet_15
public static final antlr.collections.impl.BitSet _tokenSet_15
_tokenSet_16
public static final antlr.collections.impl.BitSet _tokenSet_16
_tokenSet_17
public static final antlr.collections.impl.BitSet _tokenSet_17
_tokenSet_18
public static final antlr.collections.impl.BitSet _tokenSet_18
KjcParser
public KjcParser(Compiler compiler,
KjcScanner scanner)
KjcParser
protected KjcParser(antlr.TokenBuffer tokenBuf,
int k)
KjcParser
public KjcParser(antlr.TokenBuffer tokenBuf)
KjcParser
protected KjcParser(antlr.TokenStream lexer,
int k)
KjcParser
public KjcParser(antlr.TokenStream lexer)
KjcParser
public KjcParser(antlr.ParserSharedInputState state)
getCompiler
public Compiler getCompiler()
- Returns the compiler driver which invoked the parser.
getBuffer
public final InputBuffer getBuffer()
- Returns the input buffer.
buildTokenReference
protected final TokenReference buildTokenReference()
- Returns a reference to the current position in the source file.
getStatementComment
protected final JavaStyleComment[] getStatementComment()
getJavadocComment
protected final JavadocComment getJavadocComment()
getComment
protected java.util.List getComment()
reportTrouble
protected final void reportTrouble(PositionedError trouble)
- Reports that an error has been detected in the lexical analyser.
The handling is delegated to the compiler driver.
- Parameters:
error
- The error to report.
beautifyParseError
public PositionedError beautifyParseError(antlr.RecognitionException e)
- Generate an human readable error message.
jCompilationUnit
public final JCompilationUnit jCompilationUnit()
throws antlr.RecognitionException,
antlr.TokenStreamException
jPackageDefinition
public final JPackageName jPackageDefinition()
throws antlr.RecognitionException,
antlr.TokenStreamException
jImportDefinition
public final void jImportDefinition(CParseCompilationUnitContext cunit)
throws antlr.RecognitionException,
antlr.TokenStreamException
jTypeDefinition
public final void jTypeDefinition(CParseCompilationUnitContext context)
throws antlr.RecognitionException,
antlr.TokenStreamException
jIdentifier
public final java.lang.String jIdentifier()
throws antlr.RecognitionException,
antlr.TokenStreamException
jModifiers
public final int jModifiers()
throws antlr.RecognitionException,
antlr.TokenStreamException
jClassDefinition
public final JClassDeclaration jClassDefinition(int mods)
throws antlr.RecognitionException,
antlr.TokenStreamException
jInterfaceDefinition
public final JInterfaceDeclaration jInterfaceDefinition(int mods)
throws antlr.RecognitionException,
antlr.TokenStreamException
jDeclaration
public final JVariableDeclarationStatement jDeclaration()
throws antlr.RecognitionException,
antlr.TokenStreamException
- A declaration is the creation of a reference or primitive-type variable
Create a separate Type/Var tree for each var in the var list.
jTypeSpec
public final CType jTypeSpec()
throws antlr.RecognitionException,
antlr.TokenStreamException
jVariableDefinitions
public final JVariableDefinition[] jVariableDefinitions(int mods,
CType type)
throws antlr.RecognitionException,
antlr.TokenStreamException
jModifier
public final int jModifier()
throws antlr.RecognitionException,
antlr.TokenStreamException
jClassTypeSpec
public final CClassType jClassTypeSpec()
throws antlr.RecognitionException,
antlr.TokenStreamException
jBuiltInTypeSpec
public final CType jBuiltInTypeSpec()
throws antlr.RecognitionException,
antlr.TokenStreamException
jBuiltInType
public final CType jBuiltInType()
throws antlr.RecognitionException,
antlr.TokenStreamException
jType
public final CType jType()
throws antlr.RecognitionException,
antlr.TokenStreamException
jSuperClassClause
public final java.lang.String jSuperClassClause()
throws antlr.RecognitionException,
antlr.TokenStreamException
jImplementsClause
public final CClassType[] jImplementsClause()
throws antlr.RecognitionException,
antlr.TokenStreamException
jClassBlock
public final void jClassBlock(CParseClassContext context)
throws antlr.RecognitionException,
antlr.TokenStreamException
jInterfaceExtends
public final CClassType[] jInterfaceExtends()
throws antlr.RecognitionException,
antlr.TokenStreamException
jMember
public final void jMember(CParseClassContext context)
throws antlr.RecognitionException,
antlr.TokenStreamException
jNameList
public final CClassType[] jNameList()
throws antlr.RecognitionException,
antlr.TokenStreamException
jParameterDeclarationList
public final JFormalParameter[] jParameterDeclarationList(int desc)
throws antlr.RecognitionException,
antlr.TokenStreamException
jThrowsClause
public final CClassType[] jThrowsClause()
throws antlr.RecognitionException,
antlr.TokenStreamException
jCompoundStatement
public final JStatement[] jCompoundStatement()
throws antlr.RecognitionException,
antlr.TokenStreamException
jVariableDeclarator
public final JVariableDefinition jVariableDeclarator(int mods,
CType type)
throws antlr.RecognitionException,
antlr.TokenStreamException
- Declaration of a variable. This can be a class/instance variable,
or a local variable in a method.
It can also include possible initialization.
jVarInitializer
public final JExpression jVarInitializer()
throws antlr.RecognitionException,
antlr.TokenStreamException
jInitializer
public final JExpression jInitializer()
throws antlr.RecognitionException,
antlr.TokenStreamException
jArrayInitializer
public final JArrayInitializer jArrayInitializer()
throws antlr.RecognitionException,
antlr.TokenStreamException
jInitializers
public final java.util.List jInitializers(java.util.List expressions)
throws antlr.RecognitionException,
antlr.TokenStreamException
jExpression
public final JExpression jExpression()
throws antlr.RecognitionException,
antlr.TokenStreamException
jParameterDeclaration
public final JFormalParameter jParameterDeclaration(int desc)
throws antlr.RecognitionException,
antlr.TokenStreamException
jStatement
public final JStatement jStatement()
throws antlr.RecognitionException,
antlr.TokenStreamException
jLabeledStatement
public final JLabeledStatement jLabeledStatement()
throws antlr.RecognitionException,
antlr.TokenStreamException
jIfStatement
public final JIfStatement jIfStatement()
throws antlr.RecognitionException,
antlr.TokenStreamException
jForStatement
public final JForStatement jForStatement()
throws antlr.RecognitionException,
antlr.TokenStreamException
jWhileStatement
public final JWhileStatement jWhileStatement()
throws antlr.RecognitionException,
antlr.TokenStreamException
jDoStatement
public final JDoStatement jDoStatement()
throws antlr.RecognitionException,
antlr.TokenStreamException
jBreakStatement
public final JBreakStatement jBreakStatement()
throws antlr.RecognitionException,
antlr.TokenStreamException
jContinueStatement
public final JContinueStatement jContinueStatement()
throws antlr.RecognitionException,
antlr.TokenStreamException
jReturnStatement
public final JReturnStatement jReturnStatement()
throws antlr.RecognitionException,
antlr.TokenStreamException
jSwitchStatement
public final JSwitchStatement jSwitchStatement()
throws antlr.RecognitionException,
antlr.TokenStreamException
jTryBlock
public final JStatement jTryBlock()
throws antlr.RecognitionException,
antlr.TokenStreamException
jThrowStatement
public final JThrowStatement jThrowStatement()
throws antlr.RecognitionException,
antlr.TokenStreamException
jSynchronizedStatement
public final JSynchronizedStatement jSynchronizedStatement()
throws antlr.RecognitionException,
antlr.TokenStreamException
jCasesGroup
public final JSwitchGroup jCasesGroup()
throws antlr.RecognitionException,
antlr.TokenStreamException
jACase
public final JSwitchLabel jACase()
throws antlr.RecognitionException,
antlr.TokenStreamException
jForInit
public final JStatement jForInit()
throws antlr.RecognitionException,
antlr.TokenStreamException
jForCond
public final JExpression jForCond()
throws antlr.RecognitionException,
antlr.TokenStreamException
jForIter
public final JExpressionListStatement jForIter()
throws antlr.RecognitionException,
antlr.TokenStreamException
jExpressionList
public final JExpression[] jExpressionList()
throws antlr.RecognitionException,
antlr.TokenStreamException
jCatchHandler
public final JCatchClause jCatchHandler()
throws antlr.RecognitionException,
antlr.TokenStreamException
jAssignmentExpression
public final JExpression jAssignmentExpression()
throws antlr.RecognitionException,
antlr.TokenStreamException
jConditionalExpression
public final JExpression jConditionalExpression()
throws antlr.RecognitionException,
antlr.TokenStreamException
jLogicalOrExpression
public final JExpression jLogicalOrExpression()
throws antlr.RecognitionException,
antlr.TokenStreamException
jLogicalAndExpression
public final JExpression jLogicalAndExpression()
throws antlr.RecognitionException,
antlr.TokenStreamException
jInclusiveOrExpression
public final JExpression jInclusiveOrExpression()
throws antlr.RecognitionException,
antlr.TokenStreamException
jExclusiveOrExpression
public final JExpression jExclusiveOrExpression()
throws antlr.RecognitionException,
antlr.TokenStreamException
jAndExpression
public final JExpression jAndExpression()
throws antlr.RecognitionException,
antlr.TokenStreamException
jEqualityExpression
public final JExpression jEqualityExpression()
throws antlr.RecognitionException,
antlr.TokenStreamException
jRelationalExpression
public final JExpression jRelationalExpression()
throws antlr.RecognitionException,
antlr.TokenStreamException
jShiftExpression
public final JExpression jShiftExpression()
throws antlr.RecognitionException,
antlr.TokenStreamException
jAdditiveExpression
public final JExpression jAdditiveExpression()
throws antlr.RecognitionException,
antlr.TokenStreamException
jMultiplicativeExpression
public final JExpression jMultiplicativeExpression()
throws antlr.RecognitionException,
antlr.TokenStreamException
jUnaryExpression
public final JExpression jUnaryExpression()
throws antlr.RecognitionException,
antlr.TokenStreamException
jUnaryExpressionNotPlusMinus
public final JExpression jUnaryExpressionNotPlusMinus()
throws antlr.RecognitionException,
antlr.TokenStreamException
jPostfixExpression
public final JExpression jPostfixExpression()
throws antlr.RecognitionException,
antlr.TokenStreamException
jPrimaryExpression
public final JExpression jPrimaryExpression()
throws antlr.RecognitionException,
antlr.TokenStreamException
jQualifiedNewExpression
public final JExpression jQualifiedNewExpression(JExpression expr)
throws antlr.RecognitionException,
antlr.TokenStreamException
jArgList
public final JExpression[] jArgList()
throws antlr.RecognitionException,
antlr.TokenStreamException
jNewExpression
public final JExpression jNewExpression()
throws antlr.RecognitionException,
antlr.TokenStreamException
- object instantiation.
Trees are built as illustrated by the following input/tree pairs:
new T()
new
|
T -- ELIST
|
arg1 -- arg2 -- .. -- argn
new int[]
new
|
int -- ARRAY_DECLARATOR
new int[] {1,2}
new
|
int -- ARRAY_DECLARATOR -- ARRAY_INIT
|
EXPR -- EXPR
| |
1 2
new int[3]
new
|
int -- ARRAY_DECLARATOR
|
EXPR
|
3
new int[1][2]
new
|
int -- ARRAY_DECLARATOR
|
ARRAY_DECLARATOR -- EXPR
| |
EXPR 1
|
2
jConstant
public final JExpression jConstant()
throws antlr.RecognitionException,
antlr.TokenStreamException
jNewArrayDeclarator
public final JExpression[] jNewArrayDeclarator()
throws antlr.RecognitionException,
antlr.TokenStreamException
jReservedKeyword
public final int jReservedKeyword()
throws antlr.RecognitionException,
antlr.TokenStreamException