## org.codehaus.groovy.antlr
Class AntlrParserPlugin

    java.lang.Object
      org.codehaus.groovy.syntax.ASTHelper
          org.codehaus.groovy.antlr.AntlrParserPlugin

All Implemented Interfaces:
  GroovyTokenTypes, ParserPlugin

    public class AntlrParserPlugin

extends ASTHelper
implements ParserPlugin, GroovyTokenTypes

A parser plugin which adapts the JSR Antlr Parser to the Groovy runtime

Version:
  $Revision: 11961 $
Author:
  James Strachan

Field Summary

Fields inherited from class org.codehaus.groovy.syntax.ASTHelper
`imports, output, resolutions, staticDotImports, staticImports`

Fields inherited from interface org.codehaus.groovy.antlr.parser.GroovyTokenTypes

`ABSTRACT, ANNOTATION, ANNOTATION_ARRAY_INIT, ANNOTATION_DEF, ANNOTATION_FIELD_DEF, ANNOTATION_MEMBER_VALUE_PAIR, ANNOTATIONS, ARRAY_DECLARATOR, ASSIGN, AT, BAND, BAND_ASSIGN, BIG_SUFFIX, BLOCK, BNOT, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, CASE_GROUP, CLASS_DEF, CLOSABLE_BLOCK, CLOSABLE_BLOCK_OP, CLOSURE_LIST, COLON, COMMA, COMPARE_TO, CTOR_CALL, CTOR_IDENT, DEC, DIGIT, DIV, DIV_ASSIGN, DOLLAR, DOT, DYNAMIC_MEMBER, ELIST, ELVIS_OPERATOR, EMPTY_STAT, ENUM_CONSTANT_DEF, ENUM_DEF, EOF, EQUAL, ESC, EXPONENT, EXPR, EXTENDS_CLAUSE, FINAL, FLOAT_SUFFIX, FOR_CONDITION, FOR_EACH_CLAUSE, FOR_IN_ITERABLE, FOR_INIT, FOR_ITERATOR, GE, GT, HEX_DIGIT, IDENT, IMPLEMENTS_CLAUSE, IMPLICIT_PARAMETERS, IMPORT, INC, INDEX_OP, INSTANCE_INIT, INTERFACE_DEF, LABELED_ARG, LABELED_STAT, LAND, LBRACK, LCURLY, LE, LETTER, LIST_CONSTRUCTOR, LITERAL_as, LITERAL_assert, LITERAL_boolean, LITERAL_break, LITERAL_byte, LITERAL_case, LITERAL_catch, LITERAL_char, LITERAL_class, LITERAL_continue, LITERAL_def, LITERAL_default, LITERAL_double, LITERAL_else, LITERAL_enum, LITERAL_extends, LITERAL_false, LITERAL_finally, LITERAL_float, LITERAL_for, LITERAL_if, LITERAL_implements, LITERAL_import, LITERAL_in, 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_super, LITERAL_switch, LITERAL_synchronized, LITERAL_this, LITERAL_threadsafe, LITERAL_throw, LITERAL_throws, LITERAL_transient, LITERAL_true, LITERAL_try, LITERAL_void, LITERAL_volatile, LITERAL_while, LNOT, LOR, LPAREN, LT, MAP_CONSTRUCTOR, MEMBER_POINTER, METHOD_CALL, METHOD_DEF, MINUS, MINUS_ASSIGN, ML_COMMENT, MOD, MOD_ASSIGN, MODIFIERS, NLS, NOT_EQUAL, NULL_TREE_LOOKAHEAD, NUM_BIG_DECIMAL, NUM_BIG_INT, NUM_DOUBLE, NUM_FLOAT, NUM_INT, NUM_LONG, OBJBLOCK, ONE_NL, OPTIONAL_DOT, PACKAGE_DEF, PARAMETER_DEF, PARAMETERS, PLUS, PLUS_ASSIGN, POST_DEC, POST_INC, QUESTION, RANGE_EXCLUSIVE, RANGE_INCLUSIVE, RBRACK, RCURLY, REGEX_FIND, REGEX_MATCH, REGEXP_CTOR_END, REGEXP_LITERAL, REGEXP_SYMBOL, RPAREN, SELECT_SLOT, SEMI, SH_COMMENT, SL, SL_ASSIGN, SL_COMMENT, SLIST, SPREAD_ARG, SPREAD_DOT, SPREAD_MAP_ARG, SR, SR_ASSIGN, STAR, STAR_ASSIGN, STAR_STAR, STAR_STAR_ASSIGN, STATIC_IMPORT, STATIC_INIT, STRICTFP, STRING_CH, STRING_CONSTRUCTOR, STRING_CTOR_END, STRING_CTOR_MIDDLE, STRING_CTOR_START, STRING_LITERAL, STRING_NL, SUPER_CTOR_CALL, TRIPLE_DOT, TYPE, TYPE_ARGUMENT, TYPE_ARGUMENTS, TYPE_LOWER_BOUNDS, TYPE_PARAMETER, TYPE_PARAMETERS, TYPE_UPPER_BOUNDS, TYPECAST, UNARY_MINUS, UNARY_PLUS, UNUSED_CONST, UNUSED_DO, UNUSED_GOTO, VARIABLE_DEF, VARIABLE_PARAMETER_DEF, VOCAB, WILDCARD_TYPE, WS`

Constructor Summary
`AntlrParserPlugin()`

Method Summary
`protected boolean` `addArgumentExpression(AST node, List expressionList)`
`protected AnnotationNode` `annotation(AST annotationNode)`
`protected Expression` `arguments(AST elist)`
`protected List` `arraySizeExpression(AST node)`
`protected Expression` `asExpression(AST node)`
`protected void` `assertNodeType(int type, AST node)`
`protected Statement` `assertStatement(AST assertNode)`
`protected void` `assertTypeNotNull(ClassNode type, AST rightNode)`
`protected Expression` `binaryExpression(int type, AST node)`
`protected Expression` `blockExpression(AST node)`
`protected BooleanExpression` `booleanExpression(AST node)`
`protected Statement` `breakStatement(AST node)`
`ModuleNode` `buildAST(SourceUnit sourceUnit, ClassLoader classLoader, Reduction cst)`
`protected ClassNode` `buildName(AST node)` Extracts an identifier from the Antlr AST and then performs a name resolution to see if the given name is a type from imports, aliases or newly created classes
`protected Statement` `caseStatements(AST node, List cases)`
`protected Expression` `castExpression(AST castNode)`
`protected CatchStatement` `catchStatement(AST catchNode)`
`protected void` `classDef(AST classDef)`
`protected ClosureExpression` `closureExpression(AST node)`
`protected void` `configureAST(ASTNode node, AST ast)`
`protected Expression` `constructorCallExpression(AST node)`
`protected void` `constructorDef(AST constructorDef)`
`protected Statement` `continueStatement(AST node)`
`protected void` `convertGroovy(AST node)` Converts the Antlr AST to the Groovy AST
`protected ConstantExpression` `decimalExpression(AST node)`
`protected Expression` `declarationExpression(AST variableDef)`
`protected Expression` `dotExpression(AST node)`
`protected void` `dump(AST node)`
`protected void` `dumpTree(AST ast)`
`protected Expression` `dynamicMemberExpression(AST dynamicMemberNode)`
`protected void` `enumConstantDef(AST node)`
`protected void` `enumDef(AST enumNode)`
`protected Expression` `expression(AST node)`
`protected Expression` `expression(AST node, boolean convertToConstant)`
`protected Expression` `expressionList(AST node)`
`protected Expression` `expressionSwitch(AST node)`
`protected void` `fieldDef(AST fieldDef)`
`protected Statement` `forStatement(AST forNode)`
`protected String` `getFirstChildText(AST node)`
`protected Expression` `gstring(AST gstringNode)`
`protected boolean` `hasVisibility(int modifiers)` Returns true if the modifiers flags contain a visibility modifier
`protected String` `identifier(AST node)` Extracts an identifier from the Antlr AST
`protected Statement` `ifStatement(AST ifNode)`
`protected void` `importDef(AST importNode)`
`protected Expression` `indexExpression(AST indexNode)`
`protected Expression` `instanceofExpression(AST node)`
`protected ConstantExpression` `integerExpression(AST node)`
`protected void` `interfaceDef(AST classDef)`
`protected ClassNode[]` `interfaces(AST node)`
`protected boolean` `isPrimitiveTypeLiteral(AST node)`
`static boolean` `isType(int typeCode, AST node)`
`protected String` `label(AST labelNode)`
`protected Statement` `labelledStatement(AST labelNode)`
`protected Expression` `listExpression(AST listNode)`
`protected GenericsType[]` `makeGenericsType(AST rootNode)`
`protected static Token` `makeToken(int typeCode, AST node)`
`protected ClassNode` `makeType(AST typeNode)`
`protected ClassNode` `makeTypeWithArguments(AST rootNode)`
`protected MapEntryExpression` `mapEntryExpression(AST node)`
`protected Expression` `mapExpression(AST mapNode)` Typically only used for map constructors I think?
`protected Statement` `methodCall(AST code)`
`protected Expression` `methodCallExpression(AST methodCallNode)`
`protected void` `methodDef(AST methodDef)`
`protected Expression` `methodPointerExpression(AST node)`
`protected int` `modifiers(AST modifierNode, List annotations, int defaultModifiers)`
`protected void` `notImplementedYet(AST node)`
`protected void` `objectBlock(AST objectBlock)`
`protected void` `objectInit(AST init)`
`protected void` `packageDef(AST packageDef)`
`protected Parameter` `parameter(AST paramNode)`
`protected Parameter[]` `parameters(AST parametersNode)`
`Reduction` `parseCST(SourceUnit sourceUnit, Reader reader)`
`protected Expression` `postfixExpression(AST node, int token)`
`protected Expression` `prefixExpression(AST node, int token)`
`static String` `qualifiedName(AST qualifiedNameNode)`
`protected Expression` `rangeExpression(AST rangeNode, boolean inclusive)`
`protected Statement` `returnStatement(AST node)`
`protected boolean` `setAccessTrue(AST node, boolean access)`
`protected int` `setModifierBit(AST node, int answer, int bit)`
`protected Expression` `specialConstructorCallExpression(AST methodCallNode, ClassNode special)`
`protected Expression` `spreadExpression(AST node)`
`protected Expression` `spreadMapExpression(AST node)`
`protected Statement` `statement(AST node)`
`protected Statement` `statementList(AST code)`
`protected Statement` `statementListNoChild(AST node)`
`protected void` `staticInit(AST staticInit)`
`protected Statement` `switchStatement(AST switchNode)`
`protected Statement` `synchronizedStatement(AST syncNode)`
`protected Expression` `ternaryExpression(AST ternaryNode)`
`protected void` `throwsList(AST node, List list)`
`protected Statement` `throwStatement(AST node)`
`protected Statement` `tryStatement(AST tryStatementNode)`
`protected ClassNode` `type(AST typeNode)`
`protected Expression` `unaryMinusExpression(AST unaryMinusExpr)`
`protected Expression` `unaryPlusExpression(AST unaryPlusExpr)`
`protected void` `unknownAST(AST node)`
`protected Statement` `variableDef(AST variableDef)`
`protected Expression` `variableExpression(AST node)`
`protected Statement` `whileStatement(AST whileNode)`

Methods inherited from class org.codehaus.groovy.syntax.ASTHelper
`addNewClassName, dot, dot, getClassLoader, getController, getPackageName, importClass, importPackageWithStar, makeModule, setClassLoader, setController, setPackageName, staticImportClassWithStar, staticImportMethodOrField`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### AntlrParserPlugin

    public AntlrParserPlugin()

Method Detail

### parseCST

    public Reduction parseCST(SourceUnit sourceUnit,
                              Reader reader)
                       throws CompilationFailedException

  Specified by:
    `parseCST` in interface `ParserPlugin`
  Throws:
    `CompilationFailedException`

### buildAST

    public ModuleNode buildAST(SourceUnit sourceUnit,
                               ClassLoader classLoader,
                               Reduction cst)
                        throws ParserException

  Specified by:
    `buildAST` in interface `ParserPlugin`
  Throws:
    `ParserException`

### convertGroovy

    protected void convertGroovy(AST node)

  Converts the Antlr AST to the Groovy AST

### packageDef

    protected void packageDef(AST packageDef)

### importDef

    protected void importDef(AST importNode)

### interfaceDef

    protected void interfaceDef(AST classDef)

### classDef

    protected void classDef(AST classDef)

### objectBlock

    protected void objectBlock(AST objectBlock)

### enumDef

    protected void enumDef(AST enumNode)

### enumConstantDef

    protected void enumConstantDef(AST node)

### throwsList

    protected void throwsList(AST node,
                              List list)

### methodDef

    protected void methodDef(AST methodDef)

### staticInit

    protected void staticInit(AST staticInit)

### objectInit

    protected void objectInit(AST init)

### constructorDef

    protected void constructorDef(AST constructorDef)

### fieldDef

    protected void fieldDef(AST fieldDef)

### interfaces

    protected ClassNode[] interfaces(AST node)

### parameters

    protected Parameter[] parameters(AST parametersNode)

### parameter

    protected Parameter parameter(AST paramNode)

### modifiers

    protected int modifiers(AST modifierNode,
                            List annotations,
                            int defaultModifiers)

### setAccessTrue

    protected boolean setAccessTrue(AST node,
                                    boolean access)

### setModifierBit

    protected int setModifierBit(AST node,
                                 int answer,
                                 int bit)

### annotation

    protected AnnotationNode annotation(AST annotationNode)

### statement

    protected Statement statement(AST node)

### statementList

    protected Statement statementList(AST code)

### statementListNoChild

    protected Statement statementListNoChild(AST node)

### assertStatement

    protected Statement assertStatement(AST assertNode)

### breakStatement

    protected Statement breakStatement(AST node)

### continueStatement

    protected Statement continueStatement(AST node)

### forStatement

    protected Statement forStatement(AST forNode)

### ifStatement

    protected Statement ifStatement(AST ifNode)

### labelledStatement

    protected Statement labelledStatement(AST labelNode)

### methodCall

    protected Statement methodCall(AST code)

### declarationExpression

    protected Expression declarationExpression(AST variableDef)

### variableDef

    protected Statement variableDef(AST variableDef)

### returnStatement

    protected Statement returnStatement(AST node)

### switchStatement

    protected Statement switchStatement(AST switchNode)

### caseStatements

    protected Statement caseStatements(AST node,
                                       List cases)

### synchronizedStatement

    protected Statement synchronizedStatement(AST syncNode)

### throwStatement

    protected Statement throwStatement(AST node)

### tryStatement

    protected Statement tryStatement(AST tryStatementNode)

### catchStatement

    protected CatchStatement catchStatement(AST catchNode)

### whileStatement

    protected Statement whileStatement(AST whileNode)

### expression

    protected Expression expression(AST node)

### expression

    protected Expression expression(AST node,
                                    boolean convertToConstant)

### expressionSwitch

    protected Expression expressionSwitch(AST node)

### dynamicMemberExpression

    protected Expression dynamicMemberExpression(AST dynamicMemberNode)

### ternaryExpression

    protected Expression ternaryExpression(AST ternaryNode)

### variableExpression

    protected Expression variableExpression(AST node)

### rangeExpression

    protected Expression rangeExpression(AST rangeNode,
                                         boolean inclusive)

### spreadExpression

    protected Expression spreadExpression(AST node)

### spreadMapExpression

    protected Expression spreadMapExpression(AST node)

### methodPointerExpression

    protected Expression methodPointerExpression(AST node)

### listExpression

    protected Expression listExpression(AST listNode)

### mapExpression

    protected Expression mapExpression(AST mapNode)

  Typically only used for map constructors I think?

### mapEntryExpression

    protected MapEntryExpression mapEntryExpression(AST node)

### instanceofExpression

    protected Expression instanceofExpression(AST node)

### assertTypeNotNull

    protected void assertTypeNotNull(ClassNode type,
                                     AST rightNode)

### asExpression

    protected Expression asExpression(AST node)

### castExpression

    protected Expression castExpression(AST castNode)

### indexExpression

    protected Expression indexExpression(AST indexNode)

### binaryExpression

    protected Expression binaryExpression(int type,
                                          AST node)

### prefixExpression

    protected Expression prefixExpression(AST node,
                                          int token)

### postfixExpression

    protected Expression postfixExpression(AST node,
                                           int token)

### booleanExpression

    protected BooleanExpression booleanExpression(AST node)

### dotExpression

    protected Expression dotExpression(AST node)

### specialConstructorCallExpression

    protected Expression specialConstructorCallExpression(AST methodCallNode,
                                                          ClassNode special)

### methodCallExpression

    protected Expression methodCallExpression(AST methodCallNode)

### constructorCallExpression

    protected Expression constructorCallExpression(AST node)

### arraySizeExpression

    protected List arraySizeExpression(AST node)

### arguments

    protected Expression arguments(AST elist)

### addArgumentExpression

    protected boolean addArgumentExpression(AST node,
                                            List expressionList)

### expressionList

    protected Expression expressionList(AST node)

### closureExpression

    protected ClosureExpression closureExpression(AST node)

### blockExpression

    protected Expression blockExpression(AST node)

### unaryMinusExpression

    protected Expression unaryMinusExpression(AST unaryMinusExpr)

### unaryPlusExpression

    protected Expression unaryPlusExpression(AST unaryPlusExpr)

### decimalExpression

    protected ConstantExpression decimalExpression(AST node)

### integerExpression

    protected ConstantExpression integerExpression(AST node)

### gstring

    protected Expression gstring(AST gstringNode)

### type

    protected ClassNode type(AST typeNode)

### qualifiedName

    public static String qualifiedName(AST qualifiedNameNode)

### makeTypeWithArguments

    protected ClassNode makeTypeWithArguments(AST rootNode)

### makeGenericsType

    protected GenericsType[] makeGenericsType(AST rootNode)

### makeType

    protected ClassNode makeType(AST typeNode)

### buildName

    protected ClassNode buildName(AST node)

  Extracts an identifier from the Antlr AST and then performs a name resolution to see if the given name is a type from imports, aliases or newly created classes

### isPrimitiveTypeLiteral

    protected boolean isPrimitiveTypeLiteral(AST node)

### identifier

    protected String identifier(AST node)

  Extracts an identifier from the Antlr AST

### label

    protected String label(AST labelNode)

### hasVisibility

    protected boolean hasVisibility(int modifiers)

  Returns true if the modifiers flags contain a visibility modifier

### configureAST

    protected void configureAST(ASTNode node,
                                AST ast)

### makeToken

    protected static Token makeToken(int typeCode,
                                     AST node)

### getFirstChildText

    protected String getFirstChildText(AST node)

### isType

    public static boolean isType(int typeCode,
                                 AST node)

### assertNodeType

    protected void assertNodeType(int type,
                                  AST node)

### notImplementedYet

    protected void notImplementedYet(AST node)

### unknownAST

    protected void unknownAST(AST node)

### dumpTree

    protected void dumpTree(AST ast)

### dump

    protected void dump(AST node)

Copyright © 2003-2008 The Codehaus. All rights reserved.