text
stringlengths 30
1.67M
|
|---|
<s> package org . eclipse . jdt . groovy . search ; import java . util . ArrayList ; import java . util . List ; import org . codehaus . groovy . ast . ASTNode ; import org . codehaus . groovy . ast . Parameter ; import org . codehaus . groovy . ast . Variable ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . search . LocalVariableReferenceMatch ; import org . eclipse . jdt . core . search . SearchMatch ; import org . eclipse . jdt . core . search . SearchParticipant ; import org . eclipse . jdt . core . search . SearchRequestor ; import org . eclipse . jdt . internal . core . util . Util ; import org . eclipse . jface . text . IRegion ; import org . eclipse . jface . text . Region ; public class LocalVariableReferenceRequestor implements ITypeRequestor { private List < IRegion > references ; private SearchRequestor requestor ; private IJavaElement enclosingElement = null ; private boolean foundEnclosingElement = false ; private String variableName ; private int declStart ; private SearchParticipant participant ; public LocalVariableReferenceRequestor ( Variable variable , IJavaElement enclosingElement ) { this ( variable . getName ( ) , enclosingElement , null , null , - <NUM_LIT:1> ) ; } public LocalVariableReferenceRequestor ( String name , IJavaElement enclosingElement , SearchRequestor requestor , SearchParticipant participant , int declStart ) { references = new ArrayList < IRegion > ( ) ; this . enclosingElement = enclosingElement ; variableName = name ; this . declStart = declStart ; this . requestor = requestor ; this . participant = participant ; } public VisitStatus acceptASTNode ( ASTNode node , TypeLookupResult result , IJavaElement enclosingElement ) { if ( enclosingElement . equals ( this . enclosingElement ) ) { foundEnclosingElement = true ; if ( node instanceof Variable && ( ( Variable ) node ) . getName ( ) . equals ( variableName ) ) { IRegion realSourceLocation = getRealSourceLocation ( node ) ; references . add ( realSourceLocation ) ; if ( requestor != null && realSourceLocation . getOffset ( ) >= declStart ) { try { requestor . acceptSearchMatch ( new LocalVariableReferenceMatch ( enclosingElement , SearchMatch . A_ACCURATE , realSourceLocation . getOffset ( ) , realSourceLocation . getLength ( ) , true , true , false , participant , enclosingElement . getResource ( ) ) ) ; } catch ( CoreException e ) { Util . log ( e ) ; } } } } else { if ( foundEnclosingElement ) { return VisitStatus . STOP_VISIT ; } } return VisitStatus . CONTINUE ; } private IRegion getRealSourceLocation ( ASTNode node ) { if ( node instanceof Parameter ) { Parameter parameter = ( Parameter ) node ; return new Region ( parameter . getNameStart ( ) , parameter . getNameEnd ( ) - parameter . getNameStart ( ) ) ; } return new Region ( node . getStart ( ) , variableName . length ( ) ) ; } public List < IRegion > getReferences ( ) { return references ; } } </s>
|
<s> package org . eclipse . jdt . groovy . search ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IConfigurationElement ; import org . eclipse . core . runtime . IExtension ; import org . eclipse . core . runtime . IExtensionPoint ; import org . eclipse . core . runtime . Platform ; import org . eclipse . jdt . internal . core . util . Util ; public class TypeLookupRegistry { private static final String APPLIES_TO = "<STR_LIT>" ; private static final String NATURE = "<STR_LIT>" ; private static final String LOOKUP = "<STR_LIT>" ; private static final String TYPE_LOOKUP_EXTENSION = "<STR_LIT>" ; private final static TypeLookupRegistry DEFAULT = new TypeLookupRegistry ( ) ; static TypeLookupRegistry getRegistry ( ) { return DEFAULT ; } private Map < String , List < IConfigurationElement > > natureLookupMap = new HashMap < String , List < IConfigurationElement > > ( ) ; List < ITypeLookup > getLookupsFor ( IProject project ) throws CoreException { if ( ! project . exists ( ) ) { return new ArrayList < ITypeLookup > ( <NUM_LIT:3> ) ; } String [ ] natures = project . getDescription ( ) . getNatureIds ( ) ; List < ITypeLookup > lookups = new ArrayList < ITypeLookup > ( ) ; for ( String nature : natures ) { List < IConfigurationElement > configs = natureLookupMap . get ( nature ) ; if ( configs != null ) { for ( IConfigurationElement config : configs ) { try { lookups . add ( ( ITypeLookup ) config . createExecutableExtension ( LOOKUP ) ) ; } catch ( CoreException e ) { Util . log ( e , "<STR_LIT>" + config . getAttribute ( LOOKUP ) ) ; } } } } return lookups ; } private TypeLookupRegistry ( ) { initialize ( ) ; } private void initialize ( ) { IExtensionPoint extPoint = Platform . getExtensionRegistry ( ) . getExtensionPoint ( TYPE_LOOKUP_EXTENSION ) ; IExtension [ ] exts = extPoint . getExtensions ( ) ; for ( IExtension ext : exts ) { IConfigurationElement [ ] configs = ext . getConfigurationElements ( ) ; for ( IConfigurationElement config : configs ) { createLookup ( config ) ; } } } private void createLookup ( IConfigurationElement config ) { try { if ( config . getName ( ) . equals ( LOOKUP ) ) { if ( config . getAttribute ( LOOKUP ) != null ) { IConfigurationElement [ ] appliesTos = config . getChildren ( APPLIES_TO ) ; for ( IConfigurationElement appliesTo : appliesTos ) { String nature = appliesTo . getAttribute ( NATURE ) ; List < IConfigurationElement > elts ; if ( natureLookupMap . containsKey ( nature ) ) { elts = natureLookupMap . get ( nature ) ; } else { elts = new ArrayList < IConfigurationElement > ( <NUM_LIT:3> ) ; natureLookupMap . put ( nature , elts ) ; } elts . add ( config ) ; } } else { Util . log ( new RuntimeException ( ) , "<STR_LIT>" ) ; } } } catch ( Exception e ) { Util . log ( e , "<STR_LIT>" ) ; } } } </s>
|
<s> package org . eclipse . jdt . groovy . search ; import org . codehaus . groovy . ast . ASTNode ; import org . codehaus . groovy . ast . AnnotationNode ; import org . codehaus . groovy . ast . ClassNode ; import org . codehaus . groovy . ast . FieldNode ; import org . codehaus . groovy . ast . ImportNode ; import org . codehaus . groovy . ast . MethodNode ; import org . codehaus . groovy . ast . Parameter ; import org . codehaus . groovy . ast . expr . ConstantExpression ; import org . codehaus . groovy . ast . expr . Expression ; import org . codehaus . groovy . ast . expr . GStringExpression ; import org . codehaus . groovy . ast . expr . VariableExpression ; import org . codehaus . groovy . ast . stmt . BlockStatement ; import org . eclipse . jdt . groovy . search . TypeLookupResult . TypeConfidence ; public abstract class AbstractSimplifiedTypeLookup implements ITypeLookupExtension { public static class TypeAndDeclaration { public TypeAndDeclaration ( ClassNode type , ASTNode declaration ) { this . type = type ; this . declaration = declaration ; this . declaringType = null ; this . extraDoc = null ; this . confidence = null ; } public TypeAndDeclaration ( ClassNode type , ASTNode declaration , ClassNode declaringType ) { this . type = type ; this . declaration = declaration ; this . declaringType = declaringType ; this . extraDoc = null ; this . confidence = null ; } public TypeAndDeclaration ( ClassNode type , ASTNode declaration , ClassNode declaringType , String extraDoc ) { this . type = type ; this . declaration = declaration ; this . declaringType = declaringType ; this . extraDoc = extraDoc ; this . confidence = null ; } public TypeAndDeclaration ( ClassNode type , ASTNode declaration , ClassNode declaringType , String extraDoc , TypeConfidence confidence ) { this . type = type ; this . declaration = declaration ; this . declaringType = declaringType ; this . extraDoc = extraDoc ; this . confidence = confidence ; } protected final ClassNode type ; protected final ClassNode declaringType ; protected final ASTNode declaration ; protected final String extraDoc ; protected final TypeConfidence confidence ; } private boolean isStatic ; private Expression currentExpression ; protected boolean isStatic ( ) { return isStatic ; } protected Expression getCurrentExpression ( ) { return currentExpression ; } protected boolean isQuotedString ( ) { return currentExpression instanceof GStringExpression || currentExpression . getText ( ) . length ( ) != currentExpression . getLength ( ) ; } public final TypeLookupResult lookupType ( Expression node , VariableScope scope , ClassNode objectExpressionType ) { return lookupType ( node , scope , objectExpressionType , false ) ; } public final TypeLookupResult lookupType ( Expression node , VariableScope scope , ClassNode objectExpressionType , boolean isStaticObjectExpression ) { ClassNode declaringType ; if ( objectExpressionType != null ) { declaringType = objectExpressionType ; } else { declaringType = scope . getDelegateOrThis ( ) ; if ( declaringType == null ) { declaringType = scope . getEnclosingTypeDeclaration ( ) ; if ( declaringType == null ) { declaringType = VariableScope . OBJECT_CLASS_NODE ; } } } isStatic = isStaticObjectExpression ; currentExpression = node ; TypeAndDeclaration tAndD = null ; if ( node instanceof ConstantExpression || node instanceof GStringExpression || node instanceof VariableExpression ) { tAndD = lookupTypeAndDeclaration ( declaringType , node . getText ( ) , scope ) ; } if ( tAndD != null ) { return new TypeLookupResult ( tAndD . type , tAndD . declaringType == null ? declaringType : tAndD . declaringType , tAndD . declaration , tAndD . confidence == null ? confidence ( ) : tAndD . confidence , scope , tAndD . extraDoc ) ; } return null ; } protected TypeConfidence confidence ( ) { return TypeConfidence . LOOSELY_INFERRED ; } public final TypeLookupResult lookupType ( FieldNode node , VariableScope scope ) { return null ; } public final TypeLookupResult lookupType ( MethodNode node , VariableScope scope ) { return null ; } public final TypeLookupResult lookupType ( AnnotationNode node , VariableScope scope ) { return null ; } public final TypeLookupResult lookupType ( ImportNode node , VariableScope scope ) { return null ; } public final TypeLookupResult lookupType ( ClassNode node , VariableScope scope ) { return null ; } public final TypeLookupResult lookupType ( Parameter node , VariableScope scope ) { return null ; } public void lookupInBlock ( BlockStatement node , VariableScope scope ) { } protected abstract TypeAndDeclaration lookupTypeAndDeclaration ( ClassNode declaringType , String name , VariableScope scope ) ; } </s>
|
<s> package org . eclipse . jdt . groovy . search ; import org . codehaus . groovy . ast . ClassNode ; import org . codehaus . groovy . ast . expr . Expression ; import org . codehaus . groovy . ast . expr . PropertyExpression ; import org . codehaus . groovy . ast . stmt . BlockStatement ; public interface ITypeLookupExtension extends ITypeLookup { TypeLookupResult lookupType ( Expression node , VariableScope scope , ClassNode objectExpressionType , boolean isStaticObjectExpression ) ; void lookupInBlock ( BlockStatement node , VariableScope scope ) ; } </s>
|
<s> package org . eclipse . jdt . groovy . search ; import org . codehaus . groovy . ast . ModuleNode ; import org . codehaus . jdt . groovy . internal . compiler . ast . JDTResolver ; public interface ITypeResolver { void setResolverInformation ( ModuleNode module , JDTResolver resolver ) ; } </s>
|
<s> package org . eclipse . jdt . groovy . search ; import org . codehaus . groovy . ast . ASTNode ; import org . codehaus . groovy . ast . ClassNode ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . search . SearchMatch ; import org . eclipse . jdt . core . search . SearchParticipant ; import org . eclipse . jdt . core . search . SearchRequestor ; import org . eclipse . jdt . core . search . TypeDeclarationMatch ; import org . eclipse . jdt . internal . core . search . indexing . IIndexConstants ; import org . eclipse . jdt . internal . core . search . matching . TypeDeclarationPattern ; import org . eclipse . jdt . internal . core . util . Util ; public class TypeDeclarationSearchRequestor implements ITypeRequestor , IIndexConstants { private final char [ ] simpleNamePattern ; private final char typeSuffix ; private final SearchRequestor requestor ; private final SearchParticipant participant ; private TypeDeclarationPattern pattern ; public TypeDeclarationSearchRequestor ( TypeDeclarationPattern pattern , SearchRequestor requestor , SearchParticipant participant ) { this . pattern = pattern ; this . simpleNamePattern = pattern . simpleName ; this . typeSuffix = pattern . typeSuffix ; this . requestor = requestor ; this . participant = participant ; } public VisitStatus acceptASTNode ( ASTNode node , TypeLookupResult result , IJavaElement enclosingElement ) { if ( node instanceof ClassNode ) { ClassNode orig = ( ClassNode ) node ; ClassNode redirect = orig . redirect ( ) ; if ( redirect . getNameEnd ( ) > <NUM_LIT:0> && orig == redirect ) { if ( pattern . matchesName ( simpleNamePattern , orig . getNameWithoutPackage ( ) . toCharArray ( ) ) ) { boolean matchFound ; switch ( typeSuffix ) { case CLASS_SUFFIX : matchFound = isClass ( orig ) ; break ; case CLASS_AND_INTERFACE_SUFFIX : matchFound = orig . isInterface ( ) || isClass ( orig ) ; break ; case CLASS_AND_ENUM_SUFFIX : matchFound = orig . isInterface ( ) || orig . isEnum ( ) ; break ; case INTERFACE_SUFFIX : matchFound = orig . isInterface ( ) ; break ; case INTERFACE_AND_ANNOTATION_SUFFIX : matchFound = orig . isInterface ( ) || orig . isAnnotationDefinition ( ) ; break ; case ENUM_SUFFIX : matchFound = orig . isEnum ( ) ; break ; case ANNOTATION_TYPE_SUFFIX : matchFound = orig . isAnnotationDefinition ( ) ; break ; default : matchFound = true ; break ; } if ( matchFound ) { try { requestor . acceptSearchMatch ( new TypeDeclarationMatch ( enclosingElement , SearchMatch . A_ACCURATE , orig . getNameStart ( ) , orig . getNameEnd ( ) - orig . getNameStart ( ) + <NUM_LIT:1> , participant , enclosingElement . getResource ( ) ) ) ; } catch ( CoreException e ) { Util . log ( e , "<STR_LIT>" ) ; } } } } } return VisitStatus . CONTINUE ; } private boolean isClass ( ClassNode orig ) { return ! orig . isInterface ( ) && ! orig . isAnnotationDefinition ( ) && ! orig . isEnum ( ) ; } } </s>
|
<s> package org . eclipse . jdt . groovy . search ; import static org . eclipse . jdt . groovy . search . TypeLookupResult . TypeConfidence . EXACT ; import static org . eclipse . jdt . groovy . search . TypeLookupResult . TypeConfidence . INFERRED ; import static org . eclipse . jdt . groovy . search . TypeLookupResult . TypeConfidence . UNKNOWN ; import static org . eclipse . jdt . groovy . search . VariableScope . NO_GENERICS ; import java . util . ArrayList ; import java . util . LinkedHashSet ; import java . util . List ; import java . util . Set ; import org . codehaus . groovy . ast . ASTNode ; import org . codehaus . groovy . ast . AnnotatedNode ; import org . codehaus . groovy . ast . AnnotationNode ; import org . codehaus . groovy . ast . ClassHelper ; import org . codehaus . groovy . ast . ClassNode ; import org . codehaus . groovy . ast . DynamicVariable ; import org . codehaus . groovy . ast . FieldNode ; import org . codehaus . groovy . ast . GenericsType ; import org . codehaus . groovy . ast . ImportNode ; import org . codehaus . groovy . ast . MethodNode ; import org . codehaus . groovy . ast . Parameter ; import org . codehaus . groovy . ast . PropertyNode ; import org . codehaus . groovy . ast . Variable ; import org . codehaus . groovy . ast . expr . BitwiseNegationExpression ; import org . codehaus . groovy . ast . expr . BooleanExpression ; import org . codehaus . groovy . ast . expr . ClassExpression ; import org . codehaus . groovy . ast . expr . ConstantExpression ; import org . codehaus . groovy . ast . expr . ConstructorCallExpression ; import org . codehaus . groovy . ast . expr . Expression ; import org . codehaus . groovy . ast . expr . FieldExpression ; import org . codehaus . groovy . ast . expr . GStringExpression ; import org . codehaus . groovy . ast . expr . NotExpression ; import org . codehaus . groovy . ast . expr . StaticMethodCallExpression ; import org . codehaus . groovy . ast . expr . TupleExpression ; import org . codehaus . groovy . ast . expr . VariableExpression ; import org . codehaus . groovy . ast . stmt . BlockStatement ; import org . codehaus . jdt . groovy . model . GroovyCompilationUnit ; import org . eclipse . jdt . core . Flags ; import org . eclipse . jdt . groovy . search . TypeLookupResult . TypeConfidence ; import org . eclipse . jdt . groovy . search . VariableScope . VariableInfo ; import org . objectweb . asm . Opcodes ; public class SimpleTypeLookup implements ITypeLookupExtension { private GroovyCompilationUnit unit ; public void initialize ( GroovyCompilationUnit unit , VariableScope topLevelScope ) { this . unit = unit ; } public TypeLookupResult lookupType ( Expression node , VariableScope scope , ClassNode objectExpressionType ) { return lookupType ( node , scope , objectExpressionType , false ) ; } public TypeLookupResult lookupType ( Expression node , VariableScope scope , ClassNode objectExpressionType , boolean isStaticObjectExpression ) { TypeConfidence [ ] confidence = new TypeConfidence [ ] { EXACT } ; if ( ClassHelper . isPrimitiveType ( objectExpressionType ) ) { objectExpressionType = ClassHelper . getWrapper ( objectExpressionType ) ; } ClassNode declaringType = objectExpressionType != null ? objectExpressionType : findDeclaringType ( node , scope , confidence ) ; TypeLookupResult result = findType ( node , declaringType , scope , confidence [ <NUM_LIT:0> ] , isStaticObjectExpression || ( objectExpressionType == null && scope . isStatic ( ) ) , objectExpressionType == null ) ; return result ; } public TypeLookupResult lookupType ( FieldNode node , VariableScope scope ) { return new TypeLookupResult ( node . getType ( ) , node . getDeclaringClass ( ) , node , EXACT , scope ) ; } public TypeLookupResult lookupType ( MethodNode node , VariableScope scope ) { return new TypeLookupResult ( node . getReturnType ( ) , node . getDeclaringClass ( ) , node , EXACT , scope ) ; } public TypeLookupResult lookupType ( AnnotationNode node , VariableScope scope ) { ClassNode baseType = node . getClassNode ( ) ; return new TypeLookupResult ( baseType , baseType , baseType , EXACT , scope ) ; } public TypeLookupResult lookupType ( ImportNode node , VariableScope scope ) { ClassNode baseType = node . getType ( ) ; if ( baseType != null ) { return new TypeLookupResult ( baseType , baseType , baseType , EXACT , scope ) ; } else { return new TypeLookupResult ( VariableScope . OBJECT_CLASS_NODE , VariableScope . OBJECT_CLASS_NODE , VariableScope . OBJECT_CLASS_NODE , INFERRED , scope ) ; } } public TypeLookupResult lookupType ( ClassNode node , VariableScope scope ) { return new TypeLookupResult ( node , node , node , EXACT , scope ) ; } public TypeLookupResult lookupType ( Parameter node , VariableScope scope ) { VariableInfo info = scope . lookupNameInCurrentScope ( node . getName ( ) ) ; ClassNode type ; if ( info != null ) { type = info . type ; } else { type = node . getType ( ) ; } return new TypeLookupResult ( type , scope . getEnclosingTypeDeclaration ( ) , node , EXACT , scope ) ; } public void lookupInBlock ( BlockStatement node , VariableScope scope ) { } private ClassNode findDeclaringType ( Expression node , VariableScope scope , TypeConfidence [ ] confidence ) { if ( node instanceof ClassExpression || node instanceof ConstructorCallExpression ) { return node . getType ( ) ; } else if ( node instanceof FieldExpression ) { return ( ( FieldExpression ) node ) . getField ( ) . getDeclaringClass ( ) ; } else if ( node instanceof StaticMethodCallExpression ) { return ( ( StaticMethodCallExpression ) node ) . getOwnerType ( ) ; } else if ( node instanceof ConstantExpression ) { if ( scope . isMethodCall ( ) ) { return scope . getDelegateOrThis ( ) ; } } else if ( node instanceof VariableExpression ) { Variable var = ( ( VariableExpression ) node ) . getAccessedVariable ( ) ; if ( var instanceof DynamicVariable ) { ASTNode declaration = null ; ClassNode delegate = scope . getDelegate ( ) ; if ( delegate != null ) { declaration = findDeclaration ( var . getName ( ) , delegate , scope . getMethodCallNumberOfArguments ( ) ) ; } ClassNode thiz = scope . getThis ( ) ; if ( thiz == null ) { thiz = VariableScope . OBJECT_CLASS_NODE ; } if ( declaration == null ) { if ( thiz != null && ( delegate == null || ! thiz . equals ( delegate ) ) ) { declaration = findDeclaration ( var . getName ( ) , thiz , scope . getMethodCallNumberOfArguments ( ) ) ; } } ClassNode type ; if ( declaration == null ) { type = thiz ; } else { type = declaringTypeFromDeclaration ( declaration , var . getType ( ) ) ; } confidence [ <NUM_LIT:0> ] = TypeConfidence . findLessPrecise ( confidence [ <NUM_LIT:0> ] , INFERRED ) ; return type ; } else if ( var instanceof FieldNode ) { return ( ( FieldNode ) var ) . getDeclaringClass ( ) ; } else if ( var instanceof PropertyNode ) { return ( ( PropertyNode ) var ) . getDeclaringClass ( ) ; } else if ( scope . isThisOrSuper ( ( VariableExpression ) node ) ) { return scope . lookupName ( ( ( VariableExpression ) node ) . getName ( ) ) . declaringType ; } else { } } return VariableScope . OBJECT_CLASS_NODE ; } private TypeLookupResult findType ( Expression node , ClassNode declaringType , VariableScope scope , TypeConfidence confidence , boolean isStaticObjectExpression , boolean isPrimaryExpression ) { if ( node instanceof VariableExpression ) { return findTypeForVariable ( ( VariableExpression ) node , scope , confidence , declaringType ) ; } ClassNode nodeType = node . getType ( ) ; if ( ! isPrimaryExpression || scope . isMethodCall ( ) ) { if ( node instanceof ConstantExpression ) { return findTypeForNameWithKnownObjectExpression ( node . getText ( ) , nodeType , declaringType , scope , confidence , isStaticObjectExpression , isPrimaryExpression ) ; } } if ( node instanceof ConstantExpression ) { ConstantExpression constExpr = ( ConstantExpression ) node ; if ( constExpr . isTrueExpression ( ) || constExpr . isFalseExpression ( ) ) { return new TypeLookupResult ( VariableScope . BOOLEAN_CLASS_NODE , null , null , confidence , scope ) ; } else if ( constExpr . isNullExpression ( ) ) { return new TypeLookupResult ( VariableScope . VOID_CLASS_NODE , null , null , confidence , scope ) ; } else if ( constExpr . isEmptyStringExpression ( ) ) { return new TypeLookupResult ( VariableScope . STRING_CLASS_NODE , null , null , confidence , scope ) ; } else if ( ClassHelper . isNumberType ( nodeType ) || nodeType == ClassHelper . BigDecimal_TYPE || nodeType == ClassHelper . BigInteger_TYPE ) { return new TypeLookupResult ( nodeType , null , null , confidence , scope ) ; } else if ( nodeType . equals ( VariableScope . STRING_CLASS_NODE ) ) { return new TypeLookupResult ( nodeType , null , node , confidence , scope ) ; } else { return new TypeLookupResult ( nodeType , null , null , UNKNOWN , scope ) ; } } else if ( node instanceof BooleanExpression || node instanceof NotExpression ) { return new TypeLookupResult ( VariableScope . BOOLEAN_CLASS_NODE , null , null , confidence , scope ) ; } else if ( node instanceof GStringExpression ) { return new TypeLookupResult ( VariableScope . STRING_CLASS_NODE , null , null , confidence , scope ) ; } else if ( node instanceof BitwiseNegationExpression ) { ClassNode type = ( ( BitwiseNegationExpression ) node ) . getExpression ( ) . getType ( ) ; if ( type . getName ( ) . equals ( VariableScope . STRING_CLASS_NODE . getName ( ) ) ) { return new TypeLookupResult ( VariableScope . PATTERN_CLASS_NODE , null , null , confidence , scope ) ; } else { return new TypeLookupResult ( type , null , null , confidence , scope ) ; } } else if ( node instanceof ClassExpression ) { if ( nodeIsDotClassReference ( node ) ) { return new TypeLookupResult ( VariableScope . CLASS_CLASS_NODE , VariableScope . CLASS_CLASS_NODE , VariableScope . CLASS_CLASS_NODE , TypeConfidence . EXACT , scope ) ; } else { return new TypeLookupResult ( nodeType , declaringType , nodeType , confidence , scope ) ; } } else if ( node instanceof StaticMethodCallExpression ) { StaticMethodCallExpression expr = ( StaticMethodCallExpression ) node ; List < MethodNode > methods = expr . getOwnerType ( ) . getMethods ( expr . getMethod ( ) ) ; if ( methods . size ( ) > <NUM_LIT:0> ) { MethodNode method = methods . get ( <NUM_LIT:0> ) ; return new TypeLookupResult ( method . getReturnType ( ) , method . getDeclaringClass ( ) , method , confidence , scope ) ; } } if ( ! ( node instanceof ConstructorCallExpression ) && ! ( node instanceof TupleExpression ) && nodeType . equals ( VariableScope . OBJECT_CLASS_NODE ) ) { confidence = UNKNOWN ; } return new TypeLookupResult ( nodeType , declaringType , null , confidence , scope ) ; } private boolean nodeIsDotClassReference ( Expression node ) { int end = node . getEnd ( ) ; int start = node . getStart ( ) ; char [ ] contents = unit . getContents ( ) ; if ( contents . length >= end ) { char [ ] realText = new char [ end - start ] ; System . arraycopy ( contents , start , realText , <NUM_LIT:0> , end - start ) ; String realTextStr = String . valueOf ( realText ) . trim ( ) ; return realTextStr . endsWith ( "<STR_LIT:.class>" ) || realTextStr . endsWith ( "<STR_LIT>" ) ; } return false ; } private TypeLookupResult findTypeForNameWithKnownObjectExpression ( String name , ClassNode type , ClassNode declaringType , VariableScope scope , TypeConfidence confidence , boolean isStaticObjectExpression , boolean isPrimaryExpression ) { ClassNode realDeclaringType ; VariableInfo varInfo ; ASTNode declaration = findDeclaration ( name , declaringType , scope . getMethodCallNumberOfArguments ( ) ) ; if ( declaration == null && isPrimaryExpression ) { ClassNode thiz = scope . getThis ( ) ; if ( thiz != null && ! thiz . equals ( declaringType ) ) { declaration = findDeclaration ( name , thiz , scope . getMethodCallNumberOfArguments ( ) ) ; } } if ( declaration == null && isStaticObjectExpression ) { declaration = findDeclaration ( name , VariableScope . CLASS_CLASS_NODE , scope . getMethodCallNumberOfArguments ( ) ) ; } if ( declaration != null ) { type = typeFromDeclaration ( declaration , declaringType ) ; realDeclaringType = declaringTypeFromDeclaration ( declaration , declaringType ) ; } else if ( isPrimaryExpression && ( varInfo = scope . lookupName ( name ) ) != null ) { type = varInfo . type ; realDeclaringType = varInfo . declaringType ; declaration = findDeclaration ( name , realDeclaringType , scope . getMethodCallNumberOfArguments ( ) ) ; if ( declaration == null ) { declaration = varInfo . declaringType ; } } else if ( name . equals ( "<STR_LIT>" ) ) { realDeclaringType = VariableScope . CLOSURE_CLASS ; declaration = realDeclaringType . getMethods ( "<STR_LIT>" ) . get ( <NUM_LIT:0> ) ; } else { realDeclaringType = declaringType ; confidence = UNKNOWN ; } if ( declaration != null && ! realDeclaringType . equals ( VariableScope . CLASS_CLASS_NODE ) ) { if ( declaration instanceof FieldNode ) { if ( isStaticObjectExpression && ! ( ( FieldNode ) declaration ) . isStatic ( ) ) { confidence = UNKNOWN ; } } else if ( declaration instanceof PropertyNode ) { FieldNode underlyingField = ( ( PropertyNode ) declaration ) . getField ( ) ; if ( underlyingField != null ) { if ( isStaticObjectExpression && ! underlyingField . isStatic ( ) ) { confidence = UNKNOWN ; } } else if ( isStaticObjectExpression && ! ( ( PropertyNode ) declaration ) . isStatic ( ) ) { confidence = UNKNOWN ; } } else if ( declaration instanceof MethodNode ) { if ( isStaticObjectExpression && ! ( ( MethodNode ) declaration ) . isStatic ( ) ) { confidence = UNKNOWN ; } } } return new TypeLookupResult ( type , realDeclaringType , declaration , confidence , scope ) ; } private TypeLookupResult findTypeForVariable ( VariableExpression var , VariableScope scope , TypeConfidence confidence , ClassNode declaringType ) { ASTNode declaration = var ; Variable accessedVar = var . getAccessedVariable ( ) ; if ( accessedVar instanceof ASTNode ) { declaration = ( ASTNode ) accessedVar ; } VariableInfo info = scope . lookupName ( var . getName ( ) ) ; TypeConfidence origConfidence = confidence ; if ( accessedVar instanceof DynamicVariable ) { ASTNode maybeDeclaration = findDeclaration ( accessedVar . getName ( ) , getMorePreciseType ( declaringType , info ) , scope . getMethodCallNumberOfArguments ( ) ) ; if ( maybeDeclaration != null ) { declaration = maybeDeclaration ; declaringType = declaringTypeFromDeclaration ( declaration , info != null ? info . declaringType : VariableScope . OBJECT_CLASS_NODE ) ; } else { confidence = UNKNOWN ; } } ClassNode type ; if ( info != null ) { confidence = TypeConfidence . findLessPrecise ( origConfidence , INFERRED ) ; type = info . type ; declaringType = getMorePreciseType ( declaringType , info ) ; if ( scope . isThisOrSuper ( var ) ) { declaration = type ; } } else { if ( accessedVar instanceof DynamicVariable ) { type = typeFromDeclaration ( declaration , declaringType ) ; } else { type = var . getType ( ) ; } } return new TypeLookupResult ( type , declaringType , declaration , confidence , scope ) ; } private ClassNode getMorePreciseType ( ClassNode declaringType , VariableInfo info ) { ClassNode maybeDeclaringType = info != null ? info . declaringType : VariableScope . OBJECT_CLASS_NODE ; if ( maybeDeclaringType . equals ( VariableScope . OBJECT_CLASS_NODE ) && ! VariableScope . OBJECT_CLASS_NODE . equals ( declaringType ) ) { return declaringType ; } else { return maybeDeclaringType ; } } private ClassNode declaringTypeFromDeclaration ( ASTNode declaration , ClassNode resolvedTypeOfDeclaration ) { ClassNode typeOfDeclaration ; if ( declaration instanceof FieldNode ) { typeOfDeclaration = ( ( FieldNode ) declaration ) . getDeclaringClass ( ) ; } else if ( declaration instanceof MethodNode ) { typeOfDeclaration = ( ( MethodNode ) declaration ) . getDeclaringClass ( ) ; } else if ( declaration instanceof PropertyNode ) { typeOfDeclaration = ( ( PropertyNode ) declaration ) . getDeclaringClass ( ) ; } else { typeOfDeclaration = VariableScope . OBJECT_CLASS_NODE ; } if ( typeOfDeclaration . getName ( ) . equals ( resolvedTypeOfDeclaration . getName ( ) ) ) { return resolvedTypeOfDeclaration ; } else { return typeOfDeclaration ; } } private ClassNode typeFromDeclaration ( ASTNode declaration , ClassNode resolvedType ) { ClassNode typeOfDeclaration , declaringType = declaringTypeFromDeclaration ( declaration , resolvedType ) ; if ( declaration instanceof PropertyNode ) { FieldNode field = ( ( PropertyNode ) declaration ) . getField ( ) ; if ( field != null ) { declaration = field ; } } if ( declaration instanceof FieldNode ) { FieldNode fieldNode = ( FieldNode ) declaration ; typeOfDeclaration = fieldNode . getType ( ) ; if ( VariableScope . OBJECT_CLASS_NODE . equals ( typeOfDeclaration ) ) { if ( fieldNode . hasInitialExpression ( ) ) { typeOfDeclaration = fieldNode . getInitialExpression ( ) . getType ( ) ; } } } else if ( declaration instanceof MethodNode ) { typeOfDeclaration = ( ( MethodNode ) declaration ) . getReturnType ( ) ; } else if ( declaration instanceof Expression ) { typeOfDeclaration = ( ( Expression ) declaration ) . getType ( ) ; } else { typeOfDeclaration = VariableScope . OBJECT_CLASS_NODE ; } GenericsMapper mapper = GenericsMapper . gatherGenerics ( resolvedType , declaringType . redirect ( ) ) ; ClassNode resolvedTypeOfDeclaration = VariableScope . resolveTypeParameterization ( mapper , VariableScope . clone ( typeOfDeclaration ) ) ; return resolvedTypeOfDeclaration ; } protected GenericsType [ ] unresolvedGenericsForType ( ClassNode unresolvedType ) { ClassNode candidate = unresolvedType ; GenericsType [ ] gts = candidate . getGenericsTypes ( ) ; gts = gts == null ? NO_GENERICS : gts ; List < GenericsType > allGs = new ArrayList < GenericsType > ( <NUM_LIT:2> ) ; while ( candidate != null ) { gts = candidate . getGenericsTypes ( ) ; gts = gts == null ? NO_GENERICS : gts ; for ( GenericsType gt : gts ) { allGs . add ( gt ) ; } candidate = candidate . getSuperClass ( ) ; } return allGs . toArray ( NO_GENERICS ) ; } private ASTNode findDeclaration ( String name , ClassNode declaringType , int numOfArgs ) { if ( declaringType . isArray ( ) ) { if ( name . equals ( "<STR_LIT>" ) ) { return createLengthField ( declaringType ) ; } else { return findDeclaration ( name , VariableScope . OBJECT_CLASS_NODE , numOfArgs ) ; } } AnnotatedNode maybe = null ; if ( numOfArgs >= <NUM_LIT:0> ) { maybe = findMethodDeclaration ( name , declaringType , numOfArgs , true ) ; if ( maybe != null ) { return maybe ; } } LinkedHashSet < ClassNode > allClasses = new LinkedHashSet < ClassNode > ( ) ; VariableScope . createTypeHierarchy ( declaringType , allClasses , true ) ; maybe = findPropertyInClass ( name , allClasses ) ; if ( maybe != null ) { return maybe ; } maybe = declaringType . getField ( name ) ; if ( maybe != null ) { return maybe ; } FieldNode constantFromSuper = findConstantInClass ( name , allClasses ) ; if ( constantFromSuper != null ) { return constantFromSuper ; } if ( numOfArgs < <NUM_LIT:0> ) { maybe = findMethodDeclaration ( name , declaringType , numOfArgs , true ) ; if ( maybe != null ) { return maybe ; } } return null ; } private AnnotatedNode findMethodDeclaration ( String name , ClassNode declaringType , int numOfArgs , boolean checkSuperInterfaces ) { if ( checkSuperInterfaces && declaringType . isInterface ( ) ) { LinkedHashSet < ClassNode > allInterfaces = new LinkedHashSet < ClassNode > ( ) ; VariableScope . findAllInterfaces ( declaringType , allInterfaces , true ) ; for ( ClassNode interf : allInterfaces ) { AnnotatedNode candidate = findMethodDeclaration ( name , interf , numOfArgs , false ) ; if ( candidate != null ) { return candidate ; } } return null ; } List < MethodNode > maybeMethods = declaringType . getMethods ( name ) ; if ( maybeMethods != null && maybeMethods . size ( ) > <NUM_LIT:0> ) { if ( numOfArgs >= <NUM_LIT:0> ) { for ( MethodNode maybeMethod : maybeMethods ) { Parameter [ ] parameters = maybeMethod . getParameters ( ) ; if ( ( parameters != null && parameters . length == numOfArgs ) || ( parameters == null && numOfArgs == <NUM_LIT:0> ) ) { return maybeMethod . getOriginal ( ) ; } } } return maybeMethods . get ( <NUM_LIT:0> ) ; } if ( numOfArgs < <NUM_LIT:0> ) { return AccessorSupport . findAccessorMethodForPropertyName ( name , declaringType , false ) ; } else { return null ; } } private ASTNode createLengthField ( ClassNode declaringType ) { FieldNode lengthField = new FieldNode ( "<STR_LIT>" , Opcodes . ACC_PUBLIC , VariableScope . INTEGER_CLASS_NODE , declaringType , null ) ; lengthField . setType ( VariableScope . INTEGER_CLASS_NODE ) ; lengthField . setDeclaringClass ( declaringType ) ; return lengthField ; } private PropertyNode findPropertyInClass ( String name , Set < ClassNode > allClasses ) { for ( ClassNode clazz : allClasses ) { PropertyNode prop = clazz . getProperty ( name ) ; if ( prop != null ) { return prop ; } } return null ; } private FieldNode findConstantInClass ( String name , Set < ClassNode > allClasses ) { for ( ClassNode clazz : allClasses ) { FieldNode field = clazz . getField ( name ) ; if ( field != null && Flags . isFinal ( field . getModifiers ( ) ) && field . isStatic ( ) ) { return field ; } } return null ; } } </s>
|
<s> package org . eclipse . jdt . groovy . search ; import java . util . ArrayList ; import java . util . HashSet ; import java . util . List ; import java . util . Set ; import org . codehaus . groovy . ast . AnnotationNode ; import org . codehaus . groovy . ast . ClassNode ; import org . codehaus . groovy . ast . FieldNode ; import org . codehaus . groovy . ast . ImportNode ; import org . codehaus . groovy . ast . MethodNode ; import org . codehaus . groovy . ast . Parameter ; import org . codehaus . groovy . ast . expr . ConstantExpression ; import org . codehaus . groovy . ast . expr . Expression ; import org . codehaus . groovy . ast . expr . VariableExpression ; import org . codehaus . jdt . groovy . model . GroovyCompilationUnit ; import org . eclipse . jdt . groovy . search . TypeLookupResult . TypeConfidence ; public class CategoryTypeLookup implements ITypeLookup { public TypeLookupResult lookupType ( Expression node , VariableScope scope , ClassNode objectExpressionType ) { if ( node instanceof ConstantExpression || node instanceof VariableExpression ) { Set < ClassNode > categories = scope . getCategoryNames ( ) ; ClassNode currentType = objectExpressionType != null ? objectExpressionType : scope . getDelegateOrThis ( ) ; List < MethodNode > possibleMethods = new ArrayList < MethodNode > ( ) ; String text = node . getText ( ) ; if ( text . startsWith ( "<STR_LIT>" ) && text . endsWith ( "<STR_LIT:}>" ) ) { text = text . substring ( <NUM_LIT:2> , text . length ( ) - <NUM_LIT:1> ) ; } else if ( text . startsWith ( "<STR_LIT:$>" ) ) { text = text . substring ( <NUM_LIT:1> ) ; } String getterName = AccessorSupport . GETTER . createAccessorName ( text ) ; String setterName = AccessorSupport . SETTER . createAccessorName ( text ) ; for ( ClassNode category : categories ) { List < MethodNode > methods = category . getMethods ( text ) ; possibleMethods . addAll ( methods ) ; if ( getterName != null ) { methods = category . getMethods ( getterName ) ; for ( MethodNode method : methods ) { if ( method . isStatic ( ) && AccessorSupport . findAccessorKind ( method , true ) == AccessorSupport . GETTER ) { possibleMethods . add ( method ) ; } } } if ( setterName != null ) { methods = category . getMethods ( setterName ) ; for ( MethodNode method : methods ) { if ( method . isStatic ( ) && AccessorSupport . findAccessorKind ( method , true ) == AccessorSupport . SETTER ) { possibleMethods . add ( method ) ; } } } } for ( MethodNode methodNode : possibleMethods ) { Parameter [ ] params = methodNode . getParameters ( ) ; if ( params != null && params . length > <NUM_LIT:0> && isAssignableFrom ( VariableScope . maybeConvertFromPrimitive ( currentType ) , params [ <NUM_LIT:0> ] . getType ( ) ) ) { ClassNode declaringClass = methodNode . getDeclaringClass ( ) ; return new TypeLookupResult ( methodNode . getReturnType ( ) , declaringClass , methodNode , getConfidence ( declaringClass ) , scope ) ; } } } return null ; } private TypeConfidence getConfidence ( ClassNode declaringClass ) { return VariableScope . ALL_DEFAULT_CATEGORIES . contains ( declaringClass ) ? TypeConfidence . LOOSELY_INFERRED : TypeConfidence . INFERRED ; } private void findAllSupers ( ClassNode clazz , Set < String > allSupers ) { if ( ! allSupers . contains ( clazz . getName ( ) ) ) { allSupers . add ( clazz . getName ( ) ) ; if ( clazz . getSuperClass ( ) != null ) { findAllSupers ( clazz . getSuperClass ( ) , allSupers ) ; } if ( clazz . getInterfaces ( ) != null ) { for ( ClassNode superInterface : clazz . getInterfaces ( ) ) { findAllSupers ( superInterface , allSupers ) ; } } } } private boolean isAssignableFrom ( ClassNode from , ClassNode to ) { if ( from == null || to == null ) { return false ; } Set < String > allSupers = new HashSet < String > ( ) ; allSupers . add ( "<STR_LIT>" ) ; findAllSupers ( from , allSupers ) ; for ( String supr : allSupers ) { if ( to . getName ( ) . equals ( supr ) ) { return true ; } } return false ; } public TypeLookupResult lookupType ( FieldNode node , VariableScope scope ) { return null ; } public TypeLookupResult lookupType ( MethodNode node , VariableScope scope ) { return null ; } public TypeLookupResult lookupType ( AnnotationNode node , VariableScope scope ) { return null ; } public TypeLookupResult lookupType ( ImportNode node , VariableScope scope ) { return null ; } public TypeLookupResult lookupType ( ClassNode node , VariableScope scope ) { return null ; } public TypeLookupResult lookupType ( Parameter node , VariableScope scope ) { return null ; } public void initialize ( GroovyCompilationUnit unit , VariableScope topLevelScope ) { } } </s>
|
<s> package org . eclipse . jdt . groovy . core . util ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashSet ; import java . util . Iterator ; import java . util . List ; import org . eclipse . core . runtime . Platform ; import org . eclipse . core . runtime . content . IContentType ; import org . eclipse . core . runtime . content . IContentTypeManager ; import org . eclipse . jdt . internal . core . util . Util ; @ SuppressWarnings ( "<STR_LIT>" ) public class ContentTypeUtils { private ContentTypeUtils ( ) { } private static char [ ] [ ] GROOVY_LIKE_EXTENSIONS ; private static char [ ] [ ] JAVA_LIKE_BUT_NOT_GROOVY_LIKE_EXTENSIONS ; public static String GROOVY_SOURCE_CONTENT_TYPE = "<STR_LIT>" ; public static boolean isGroovyLikeFileName ( String name ) { if ( name == null ) return false ; return indexOfGroovyLikeExtension ( name ) != - <NUM_LIT:1> ; } public final static boolean isGroovyLikeFileName ( char [ ] fileName ) { if ( fileName == null ) return false ; int fileNameLength = fileName . length ; char [ ] [ ] javaLikeExtensions = getGroovyLikeExtensions ( ) ; extensions : for ( int i = <NUM_LIT:0> , length = javaLikeExtensions . length ; i < length ; i ++ ) { char [ ] extension = javaLikeExtensions [ i ] ; int extensionLength = extension . length ; int extensionStart = fileNameLength - extensionLength ; if ( extensionStart - <NUM_LIT:1> < <NUM_LIT:0> ) continue ; if ( fileName [ extensionStart - <NUM_LIT:1> ] != '<CHAR_LIT:.>' ) continue ; for ( int j = <NUM_LIT:0> ; j < extensionLength ; j ++ ) { if ( fileName [ extensionStart + j ] != extension [ j ] ) continue extensions ; } return true ; } return false ; } public static int indexOfGroovyLikeExtension ( String fileName ) { int fileNameLength = fileName . length ( ) ; char [ ] [ ] groovyLikeExtensions = getGroovyLikeExtensions ( ) ; extensions : for ( int i = <NUM_LIT:0> , length = groovyLikeExtensions . length ; i < length ; i ++ ) { char [ ] extension = groovyLikeExtensions [ i ] ; int extensionLength = extension . length ; int extensionStart = fileNameLength - extensionLength ; int dotIndex = extensionStart - <NUM_LIT:1> ; if ( dotIndex < <NUM_LIT:0> ) continue ; if ( fileName . charAt ( dotIndex ) != '<CHAR_LIT:.>' ) continue ; for ( int j = <NUM_LIT:0> ; j < extensionLength ; j ++ ) { if ( fileName . charAt ( extensionStart + j ) != extension [ j ] ) continue extensions ; } return dotIndex ; } return - <NUM_LIT:1> ; } public static char [ ] [ ] getGroovyLikeExtensions ( ) { if ( GROOVY_LIKE_EXTENSIONS == null ) { IContentTypeManager contentTypeManager = Platform . getContentTypeManager ( ) ; if ( contentTypeManager == null ) { GROOVY_LIKE_EXTENSIONS = new char [ ] [ ] { "<STR_LIT>" . toCharArray ( ) } ; return GROOVY_LIKE_EXTENSIONS ; } IContentType groovyContentType = contentTypeManager . getContentType ( GROOVY_SOURCE_CONTENT_TYPE ) ; HashSet < String > fileExtensions = new HashSet < String > ( ) ; IContentType [ ] contentTypes = Platform . getContentTypeManager ( ) . getAllContentTypes ( ) ; for ( int i = <NUM_LIT:0> , length = contentTypes . length ; i < length ; i ++ ) { if ( contentTypes [ i ] . isKindOf ( groovyContentType ) ) { String [ ] fileExtension = contentTypes [ i ] . getFileSpecs ( IContentType . FILE_EXTENSION_SPEC ) ; for ( int j = <NUM_LIT:0> , length2 = fileExtension . length ; j < length2 ; j ++ ) { fileExtensions . add ( fileExtension [ j ] ) ; } } } int length = fileExtensions . size ( ) ; char [ ] [ ] extensions = new char [ length ] [ ] ; extensions [ <NUM_LIT:0> ] = "<STR_LIT>" . toCharArray ( ) ; int index = <NUM_LIT:1> ; Iterator < String > iterator = fileExtensions . iterator ( ) ; while ( iterator . hasNext ( ) ) { String fileExtension = iterator . next ( ) ; if ( "<STR_LIT>" . equals ( fileExtension ) ) continue ; extensions [ index ++ ] = fileExtension . toCharArray ( ) ; } GROOVY_LIKE_EXTENSIONS = extensions ; } return GROOVY_LIKE_EXTENSIONS ; } public static boolean isJavaLikeButNotGroovyLikeExtension ( String fileName ) { if ( JAVA_LIKE_BUT_NOT_GROOVY_LIKE_EXTENSIONS == null ) { initJavaLikeButNotGroovyLikeExtensions ( ) ; } int fileNameLength = fileName . length ( ) ; extensions : for ( int i = <NUM_LIT:0> , length = JAVA_LIKE_BUT_NOT_GROOVY_LIKE_EXTENSIONS . length ; i < length ; i ++ ) { char [ ] extension = JAVA_LIKE_BUT_NOT_GROOVY_LIKE_EXTENSIONS [ i ] ; int extensionLength = extension . length ; int extensionStart = fileNameLength - extensionLength ; int dotIndex = extensionStart - <NUM_LIT:1> ; if ( dotIndex < <NUM_LIT:0> ) continue ; if ( fileName . charAt ( dotIndex ) != '<CHAR_LIT:.>' ) continue ; for ( int j = <NUM_LIT:0> ; j < extensionLength ; j ++ ) { if ( fileName . charAt ( extensionStart + j ) != extension [ j ] ) continue extensions ; } return true ; } return false ; } private static void initJavaLikeButNotGroovyLikeExtensions ( ) { char [ ] [ ] javaLikeExtensions = Util . getJavaLikeExtensions ( ) ; char [ ] [ ] groovyLikeExtensiosn = getGroovyLikeExtensions ( ) ; List < char [ ] > interestingExtensions = new ArrayList < char [ ] > ( ) ; for ( char [ ] javaLike : javaLikeExtensions ) { boolean found = false ; for ( char [ ] groovyLike : groovyLikeExtensiosn ) { if ( Arrays . equals ( javaLike , groovyLike ) ) { found = true ; break ; } } if ( ! found ) { interestingExtensions . add ( javaLike ) ; } } JAVA_LIKE_BUT_NOT_GROOVY_LIKE_EXTENSIONS = interestingExtensions . toArray ( new char [ interestingExtensions . size ( ) ] [ ] ) ; int javaIndex = <NUM_LIT:0> ; char [ ] javaArr = "<STR_LIT>" . toCharArray ( ) ; while ( javaIndex < JAVA_LIKE_BUT_NOT_GROOVY_LIKE_EXTENSIONS . length ) { if ( Arrays . equals ( javaArr , JAVA_LIKE_BUT_NOT_GROOVY_LIKE_EXTENSIONS [ javaIndex ] ) ) { break ; } javaIndex ++ ; } if ( javaIndex < JAVA_LIKE_BUT_NOT_GROOVY_LIKE_EXTENSIONS . length ) { JAVA_LIKE_BUT_NOT_GROOVY_LIKE_EXTENSIONS [ javaIndex ] = JAVA_LIKE_BUT_NOT_GROOVY_LIKE_EXTENSIONS [ <NUM_LIT:0> ] ; JAVA_LIKE_BUT_NOT_GROOVY_LIKE_EXTENSIONS [ <NUM_LIT:0> ] = javaArr ; } else { Util . log ( null , "<STR_LIT>" ) ; } } public static char [ ] [ ] getJavaButNotGroovyLikeExtensions ( ) { if ( JAVA_LIKE_BUT_NOT_GROOVY_LIKE_EXTENSIONS == null ) { initJavaLikeButNotGroovyLikeExtensions ( ) ; } return JAVA_LIKE_BUT_NOT_GROOVY_LIKE_EXTENSIONS ; } } </s>
|
<s> package org . eclipse . jdt . groovy . core . util ; import java . io . Reader ; import java . io . StringReader ; import org . codehaus . groovy . antlr . parser . GroovyLexer ; import org . eclipse . jface . text . BadLocationException ; import org . eclipse . jface . text . IDocument ; import antlr . Token ; import antlr . TokenStream ; import antlr . TokenStreamException ; public class GroovyScanner { private TokenStream stream ; private GroovyLexer lexer ; private boolean whiteSpaceIncluded ; public GroovyScanner ( Reader input ) { this ( input , false ) ; } public GroovyScanner ( Reader input , boolean whiteSpaceIncluded ) { init ( input , whiteSpaceIncluded ) ; } private void init ( Reader input , boolean whiteSpaceIncluded ) { this . whiteSpaceIncluded = whiteSpaceIncluded ; lexer = new GroovyLexer ( input ) ; lexer . setWhitespaceIncluded ( whiteSpaceIncluded ) ; this . stream = ( TokenStream ) lexer . plumb ( ) ; } public GroovyScanner ( String text ) { this ( new StringReader ( text ) , false ) ; } public Token nextToken ( ) throws TokenStreamException { return stream . nextToken ( ) ; } public void recover ( IDocument document ) throws BadLocationException { int line = lexer . getInputState ( ) . getLine ( ) ; int col = lexer . getInputState ( ) . getColumn ( ) ; int offset = getOffset ( document , line , col ) + <NUM_LIT:1> ; line = document . getLineOfOffset ( offset ) ; int lineStart = document . getLineOffset ( line ) ; line = line + <NUM_LIT:1> ; col = offset - lineStart + <NUM_LIT:1> ; String remainingInput = document . get ( offset , document . getLength ( ) - offset ) ; init ( new StringReader ( remainingInput ) , whiteSpaceIncluded ) ; lexer . setLine ( line ) ; lexer . setColumn ( col ) ; } public static int getOffset ( IDocument document , int line , int col ) throws BadLocationException { return document . getLineOffset ( line - <NUM_LIT:1> ) + col - <NUM_LIT:1> ; } } </s>
|
<s> package org . eclipse . jdt . groovy . core . util ; import java . util . ArrayList ; import java . util . List ; public class GroovyUtils { public static int [ ] getSourceLineSeparatorsIn ( char [ ] code ) { List < Integer > lineSeparatorsCollection = new ArrayList < Integer > ( ) ; for ( int i = <NUM_LIT:0> , max = code . length ; i < max ; i ++ ) { if ( code [ i ] == '<STR_LIT>' ) { if ( ( i + <NUM_LIT:1> ) < max && code [ i + <NUM_LIT:1> ] == '<STR_LIT:\n>' ) { lineSeparatorsCollection . add ( i + <NUM_LIT:1> ) ; i ++ ; } else { lineSeparatorsCollection . add ( i ) ; } } else if ( code [ i ] == '<STR_LIT:\n>' ) { lineSeparatorsCollection . add ( i ) ; } } int [ ] lineSepPositions = new int [ lineSeparatorsCollection . size ( ) ] ; for ( int i = <NUM_LIT:0> ; i < lineSeparatorsCollection . size ( ) ; i ++ ) { lineSepPositions [ i ] = lineSeparatorsCollection . get ( i ) ; } return lineSepPositions ; } } </s>
|
<s> package org . eclipse . jdt . groovy . core . util ; import java . util . List ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . runtime . preferences . IEclipsePreferences ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . groovy . core . Activator ; public class ScriptFolderSelector { public static enum FileKind { SOURCE , SCRIPT , SCRIPT_NO_COPY } private char [ ] [ ] scriptPatterns ; private boolean [ ] doCopy ; private final boolean enabled ; private IEclipsePreferences preferences ; public static boolean isEnabled ( IProject project ) { Activator activator = Activator . getDefault ( ) ; if ( activator != null ) { IEclipsePreferences preferences = activator . getProjectOrWorkspacePreferences ( project ) ; return activator . getBooleanPreference ( preferences , Activator . GROOVY_SCRIPT_FILTERS_ENABLED , false ) ; } else { return false ; } } public ScriptFolderSelector ( IProject project ) { Activator activator = Activator . getDefault ( ) ; if ( activator == null ) { this . enabled = false ; } else { preferences = activator . getProjectOrWorkspacePreferences ( project ) ; boolean isEnabled = activator . getBooleanPreference ( preferences , Activator . GROOVY_SCRIPT_FILTERS_ENABLED , false ) ; if ( ! isEnabled ) { this . enabled = false ; this . scriptPatterns = null ; } else { init ( activator . getListStringPreference ( preferences , Activator . GROOVY_SCRIPT_FILTERS , Activator . DEFAULT_GROOVY_SCRIPT_FILTER ) ) ; this . enabled = true ; } } } protected ScriptFolderSelector ( List < String > preferences , boolean isEnabled ) { this . enabled = isEnabled ; init ( preferences ) ; } private void init ( List < String > listStringPreference ) { if ( listStringPreference == null ) { scriptPatterns = CharOperation . NO_CHAR_CHAR ; doCopy = new boolean [ <NUM_LIT:0> ] ; } int size = listStringPreference . size ( ) ; if ( size % <NUM_LIT:2> == <NUM_LIT:0> ) { scriptPatterns = new char [ size / <NUM_LIT:2> ] [ ] ; doCopy = new boolean [ size / <NUM_LIT:2> ] ; } else { scriptPatterns = new char [ <NUM_LIT:1> + size / <NUM_LIT:2> ] [ ] ; doCopy = new boolean [ <NUM_LIT:1> + size / <NUM_LIT:2> ] ; } int count = <NUM_LIT:0> ; int index = <NUM_LIT:0> ; for ( String patternStr : listStringPreference ) { if ( count ++ % <NUM_LIT:2> == <NUM_LIT:0> ) { scriptPatterns [ index ] = patternStr . toCharArray ( ) ; } else { char [ ] pattern = patternStr . toCharArray ( ) ; doCopy [ index ++ ] = pattern . length > <NUM_LIT:0> && pattern [ <NUM_LIT:0> ] == '<CHAR_LIT>' ; } } } public FileKind getFileKind ( char [ ] filepath ) { if ( enabled ) { if ( filepath != null ) { for ( int i = <NUM_LIT:0> ; i < scriptPatterns . length ; i ++ ) { char [ ] pattern = scriptPatterns [ i ] ; if ( CharOperation . pathMatch ( pattern , filepath , true , '<CHAR_LIT:/>' ) ) { return doCopy [ i ] ? FileKind . SCRIPT : FileKind . SCRIPT_NO_COPY ; } } } } return FileKind . SOURCE ; } public FileKind getFileKind ( IResource file ) { if ( file == null || ! enabled ) { return FileKind . SOURCE ; } return getFileKind ( file . getProjectRelativePath ( ) . toPortableString ( ) . toCharArray ( ) ) ; } public boolean isScript ( char [ ] filepath ) { if ( filepath == null || ! enabled ) { return false ; } FileKind kind = getFileKind ( filepath ) ; return kind == FileKind . SCRIPT || kind == FileKind . SCRIPT_NO_COPY ; } public boolean isScript ( IResource file ) { if ( file == null || ! enabled ) { return false ; } return isScript ( file . getProjectRelativePath ( ) . toPortableString ( ) . toCharArray ( ) ) ; } } </s>
|
<s> package org . eclipse . jdt . groovy . core . util ; import java . lang . reflect . Constructor ; import java . lang . reflect . Field ; import java . lang . reflect . Method ; import java . util . HashMap ; import java . util . Map ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . core . runtime . Status ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . groovy . core . Activator ; import org . eclipse . jdt . internal . compiler . ast . Annotation ; import org . eclipse . jdt . internal . core . JavaElement ; import org . eclipse . jdt . internal . core . LocalVariable ; public class ReflectionUtils { private static final Class [ ] NO_TYPES = new Class [ <NUM_LIT:0> ] ; private static final Object [ ] NO_ARGS = new Object [ <NUM_LIT:0> ] ; private static Map < String , Field > fieldMap = new HashMap < String , Field > ( ) ; public static < T > Object getPrivateField ( Class < T > clazz , String fieldName , Object target ) { String key = clazz . getCanonicalName ( ) + fieldName ; Field field = fieldMap . get ( key ) ; try { if ( field == null ) { field = clazz . getDeclaredField ( fieldName ) ; field . setAccessible ( true ) ; fieldMap . put ( key , field ) ; } return field . get ( target ) ; } catch ( Exception e ) { Activator . getDefault ( ) . getLog ( ) . log ( new Status ( IStatus . ERROR , Activator . PLUGIN_ID , "<STR_LIT>" + fieldName + "<STR_LIT>" + clazz , e ) ) ; } return null ; } public static < T > void setPrivateField ( Class < T > clazz , String fieldName , Object target , Object newValue ) { String key = clazz . getCanonicalName ( ) + fieldName ; Field field = fieldMap . get ( key ) ; try { if ( field == null ) { field = clazz . getDeclaredField ( fieldName ) ; field . setAccessible ( true ) ; fieldMap . put ( key , field ) ; } field . set ( target , newValue ) ; } catch ( Exception e ) { Activator . getDefault ( ) . getLog ( ) . log ( new Status ( IStatus . ERROR , Activator . PLUGIN_ID , "<STR_LIT>" + fieldName + "<STR_LIT>" + clazz , e ) ) ; } } public static < T > Object executeNoArgPrivateMethod ( Class < T > clazz , String methodName , Object target ) { return executePrivateMethod ( clazz , methodName , NO_TYPES , target , NO_ARGS ) ; } public static < T > Object executePrivateMethod ( Class < T > clazz , String methodName , Class < ? > [ ] types , Object target , Object [ ] args ) { try { Method method = clazz . getDeclaredMethod ( methodName , types ) ; method . setAccessible ( true ) ; return method . invoke ( target , args ) ; } catch ( Exception e ) { Activator . getDefault ( ) . getLog ( ) . log ( new Status ( IStatus . ERROR , Activator . PLUGIN_ID , "<STR_LIT>" + methodName + "<STR_LIT>" + clazz , e ) ) ; return null ; } } public static < T > Object throwableExecutePrivateMethod ( Class < T > clazz , String methodName , Class < ? > [ ] types , Object target , Object [ ] args ) throws Exception { Method method = clazz . getDeclaredMethod ( methodName , types ) ; method . setAccessible ( true ) ; return method . invoke ( target , args ) ; } public static LocalVariable createLocalVariable ( IJavaElement parent , String varName , int start , String returnTypeSignature ) { LocalVariable localVariable ; try { Constructor < LocalVariable > cons = LocalVariable . class . getConstructor ( JavaElement . class , String . class , int . class , int . class , int . class , int . class , String . class , Annotation [ ] . class ) ; localVariable = cons . newInstance ( parent , varName , start , start + varName . length ( ) - <NUM_LIT:1> , start , start + varName . length ( ) - <NUM_LIT:1> , returnTypeSignature , new Annotation [ <NUM_LIT:0> ] ) ; return localVariable ; } catch ( Exception e ) { try { Constructor < LocalVariable > cons = LocalVariable . class . getConstructor ( JavaElement . class , String . class , int . class , int . class , int . class , int . class , String . class , Annotation [ ] . class , int . class , boolean . class ) ; localVariable = cons . newInstance ( parent , varName , start , start + varName . length ( ) - <NUM_LIT:1> , start , start + varName . length ( ) - <NUM_LIT:1> , returnTypeSignature , new Annotation [ <NUM_LIT:0> ] , <NUM_LIT:0> , false ) ; return localVariable ; } catch ( Exception e1 ) { Activator . getDefault ( ) . getLog ( ) . log ( new Status ( IStatus . ERROR , Activator . PLUGIN_ID , "<STR_LIT>" + varName + "<STR_LIT>" + parent . getHandleIdentifier ( ) , e ) ) ; return null ; } } } public static < T > T executePrivateConstructor ( Class < T > clazz , Class < ? extends Object > [ ] parameterTypes , Object [ ] args ) { try { Constructor < T > constructor = clazz . getDeclaredConstructor ( parameterTypes ) ; constructor . setAccessible ( true ) ; return constructor . newInstance ( args ) ; } catch ( Exception e ) { Activator . getDefault ( ) . getLog ( ) . log ( new Status ( IStatus . ERROR , Activator . PLUGIN_ID , "<STR_LIT>" + clazz . getName ( ) + "<STR_LIT>" + clazz , e ) ) ; return null ; } } } </s>
|
<s> package org . eclipse . jdt . groovy . core ; import java . util . Arrays ; import java . util . Iterator ; import java . util . List ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . resources . ProjectScope ; import org . eclipse . core . runtime . Plugin ; import org . eclipse . core . runtime . preferences . IEclipsePreferences ; import org . eclipse . core . runtime . preferences . IScopeContext ; import org . eclipse . core . runtime . preferences . InstanceScope ; import org . eclipse . jdt . internal . core . util . Util ; import org . osgi . framework . BundleContext ; import org . osgi . service . prefs . BackingStoreException ; public class Activator extends Plugin { public static final String PLUGIN_ID = "<STR_LIT>" ; private static Activator plugin ; private IEclipsePreferences instanceScope ; public static final String GROOVY_CHECK_FOR_COMPILER_MISMATCH = "<STR_LIT>" ; public static final String GROOVY_SCRIPT_FILTERS = "<STR_LIT>" ; public static final String GROOVY_SCRIPT_FILTERS_ENABLED = "<STR_LIT>" ; public static final String DEFAULT_GROOVY_SCRIPT_FILTER = "<STR_LIT>" ; public static final String USING_PROJECT_PROPERTIES = "<STR_LIT>" ; public static final String GROOVY_COMPILER_LEVEL = "<STR_LIT>" ; public void start ( BundleContext context ) throws Exception { super . start ( context ) ; plugin = this ; } public void stop ( BundleContext context ) throws Exception { plugin = null ; super . stop ( context ) ; } public static Activator getDefault ( ) { return plugin ; } public void setPreference ( IEclipsePreferences preferences , String key , List < String > vals ) { if ( preferences == null ) { preferences = getProjectOrWorkspacePreferences ( null ) ; } String concat ; if ( vals == null ) { concat = "<STR_LIT>" ; } else { StringBuilder sb = new StringBuilder ( ) ; for ( Iterator < String > valIter = vals . iterator ( ) ; valIter . hasNext ( ) ; ) { sb . append ( valIter . next ( ) ) ; if ( valIter . hasNext ( ) ) { sb . append ( "<STR_LIT:U+002C>" ) ; } } concat = sb . toString ( ) ; } preferences . put ( key , concat ) ; try { preferences . flush ( ) ; } catch ( BackingStoreException e ) { Util . log ( e ) ; } } public void setPreference ( IEclipsePreferences preferences , String key , String val ) { if ( val == null ) { val = "<STR_LIT>" ; } if ( preferences == null ) { preferences = getProjectOrWorkspacePreferences ( null ) ; } preferences . put ( key , val ) ; try { preferences . flush ( ) ; } catch ( BackingStoreException e ) { Util . log ( e ) ; } } public List < String > getListStringPreference ( IEclipsePreferences preferences , String key , String def ) { if ( preferences == null ) { preferences = getProjectOrWorkspacePreferences ( null ) ; } String result = preferences . get ( key , def ) ; if ( result == null ) { result = "<STR_LIT>" ; } String [ ] splits = result . split ( "<STR_LIT:U+002C>" ) ; return Arrays . asList ( splits ) ; } public String getStringPreference ( IEclipsePreferences preferences , String key , String def ) { if ( preferences == null ) { preferences = getProjectOrWorkspacePreferences ( null ) ; } return preferences . get ( key , def ) ; } public IEclipsePreferences getProjectOrWorkspacePreferences ( IProject project ) { IEclipsePreferences projectPreferences = getProjectScope ( project ) ; if ( projectPreferences != null && projectPreferences . getBoolean ( USING_PROJECT_PROPERTIES , false ) ) { return projectPreferences ; } else { if ( instanceScope == null ) { instanceScope = InstanceScope . INSTANCE . getNode ( Activator . PLUGIN_ID ) ; } return instanceScope ; } } private IEclipsePreferences getProjectScope ( IProject project ) { if ( project == null ) { return null ; } IScopeContext projectScope = new ProjectScope ( project ) ; return projectScope . getNode ( PLUGIN_ID ) ; } public String getGroovyCompilerLevel ( IProject project ) { IEclipsePreferences projectPreferences = getProjectScope ( project ) ; if ( projectPreferences != null ) { return projectPreferences . get ( GROOVY_COMPILER_LEVEL , null ) ; } else { return null ; } } public void setGroovyCompilerLevel ( IProject project , String level ) { IEclipsePreferences projectPreferences = getProjectScope ( project ) ; if ( projectPreferences != null ) { projectPreferences . put ( GROOVY_COMPILER_LEVEL , level ) ; try { projectPreferences . flush ( ) ; } catch ( BackingStoreException e ) { Util . log ( e ) ; } } } public boolean getBooleanPreference ( IEclipsePreferences preferences , String key , boolean def ) { if ( preferences == null ) { preferences = getProjectOrWorkspacePreferences ( null ) ; } return preferences . getBoolean ( key , def ) ; } } </s>
|
<s> package org . codehaus . groovy . internal . antlr . parser ; import org . codehaus . groovy . antlr . SourceInfo ; import antlr . Token ; public class GroovySourceToken extends Token implements SourceInfo { protected int line ; protected String text = "<STR_LIT>" ; protected int col ; protected int lineLast ; protected int colLast ; public GroovySourceToken ( int t ) { super ( t ) ; } public int getLine ( ) { return line ; } public String getText ( ) { return text ; } public void setLine ( int l ) { line = l ; } public void setText ( String s ) { text = s ; } public String toString ( ) { return "<STR_LIT>" + getText ( ) + "<STR_LIT>" + type + "<STR_LIT>" + "<STR_LIT>" + line + "<STR_LIT>" + col + "<STR_LIT>" + lineLast + "<STR_LIT>" + colLast + "<STR_LIT:]>" ; } public int getColumn ( ) { return col ; } public void setColumn ( int c ) { col = c ; } public int getLineLast ( ) { return lineLast ; } public void setLineLast ( int lineLast ) { this . lineLast = lineLast ; } public int getColumnLast ( ) { return colLast ; } public void setColumnLast ( int colLast ) { this . colLast = colLast ; } } </s>
|
<s> package org . codehaus . groovy . internal . antlr . parser ; import org . codehaus . groovy . antlr . * ; import java . util . * ; import java . io . InputStream ; import java . io . Reader ; import antlr . InputBuffer ; import antlr . LexerSharedInputState ; import antlr . CommonToken ; import org . codehaus . groovy . GroovyBugError ; import antlr . TokenStreamRecognitionException ; import org . codehaus . groovy . ast . Comment ; import java . io . InputStream ; import antlr . TokenStreamException ; import antlr . TokenStreamIOException ; import antlr . TokenStreamRecognitionException ; import antlr . CharStreamException ; import antlr . CharStreamIOException ; import antlr . ANTLRException ; import java . io . Reader ; import java . util . Hashtable ; import antlr . CharScanner ; import antlr . InputBuffer ; import antlr . ByteBuffer ; import antlr . CharBuffer ; import antlr . Token ; import antlr . CommonToken ; import antlr . RecognitionException ; import antlr . NoViableAltForCharException ; import antlr . MismatchedCharException ; import antlr . TokenStream ; import antlr . ANTLRHashString ; import antlr . LexerSharedInputState ; import antlr . collections . impl . BitSet ; import antlr . SemanticException ; public class GroovyLexer extends antlr . CharScanner implements GroovyTokenTypes , TokenStream { private boolean assertEnabled = true ; private boolean enumEnabled = true ; private boolean whitespaceIncluded = false ; public void enableAssert ( boolean shouldEnable ) { assertEnabled = shouldEnable ; } public boolean isAssertEnabled ( ) { return assertEnabled ; } public void enableEnum ( boolean shouldEnable ) { enumEnabled = shouldEnable ; } public boolean isEnumEnabled ( ) { return enumEnabled ; } public void setWhitespaceIncluded ( boolean z ) { whitespaceIncluded = z ; } public boolean isWhitespaceIncluded ( ) { return whitespaceIncluded ; } { setTabSize ( <NUM_LIT:1> ) ; } protected int parenLevel = <NUM_LIT:0> ; protected int suppressNewline = <NUM_LIT:0> ; protected static final int SCS_TYPE = <NUM_LIT:3> , SCS_VAL = <NUM_LIT:4> , SCS_LIT = <NUM_LIT:8> , SCS_LIMIT = <NUM_LIT:16> ; protected static final int SCS_SQ_TYPE = <NUM_LIT:0> , SCS_TQ_TYPE = <NUM_LIT:1> , SCS_RE_TYPE = <NUM_LIT:2> ; protected int stringCtorState = <NUM_LIT:0> ; protected ArrayList parenLevelStack = new ArrayList ( ) ; protected int lastSigTokenType = EOF ; public void setTokenObjectClass ( String name ) { } protected Token makeToken ( int t ) { GroovySourceToken tok = new GroovySourceToken ( t ) ; tok . setColumn ( inputState . getTokenStartColumn ( ) ) ; tok . setLine ( inputState . getTokenStartLine ( ) ) ; tok . setColumnLast ( inputState . getColumn ( ) ) ; tok . setLineLast ( inputState . getLine ( ) ) ; return tok ; } protected void pushParenLevel ( ) { parenLevelStack . add ( Integer . valueOf ( parenLevel * SCS_LIMIT + stringCtorState ) ) ; parenLevel = <NUM_LIT:0> ; stringCtorState = <NUM_LIT:0> ; } protected void popParenLevel ( ) { int npl = parenLevelStack . size ( ) ; if ( npl == <NUM_LIT:0> ) return ; int i = ( ( Integer ) parenLevelStack . remove ( -- npl ) ) . intValue ( ) ; parenLevel = i / SCS_LIMIT ; stringCtorState = i % SCS_LIMIT ; } protected void restartStringCtor ( boolean expectLiteral ) { if ( stringCtorState != <NUM_LIT:0> ) { stringCtorState = ( expectLiteral ? SCS_LIT : SCS_VAL ) + ( stringCtorState & SCS_TYPE ) ; } } protected boolean allowRegexpLiteral ( ) { return ! isExpressionEndingToken ( lastSigTokenType ) ; } protected static boolean isExpressionEndingToken ( int ttype ) { switch ( ttype ) { case INC : case DEC : case RPAREN : case RBRACK : case RCURLY : case STRING_LITERAL : case STRING_CTOR_END : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : case IDENT : case LITERAL_as : case LITERAL_assert : case LITERAL_boolean : case LITERAL_break : case LITERAL_byte : case LITERAL_case : case LITERAL_catch : case LITERAL_char : case LITERAL_class : case LITERAL_continue : case LITERAL_def : case LITERAL_default : case LITERAL_double : case LITERAL_else : case LITERAL_enum : case LITERAL_extends : case LITERAL_false : case LITERAL_finally : case LITERAL_float : case LITERAL_for : case LITERAL_if : case LITERAL_implements : case LITERAL_import : case LITERAL_in : case LITERAL_instanceof : case LITERAL_int : case LITERAL_interface : case LITERAL_long : case LITERAL_native : case LITERAL_new : case LITERAL_null : case LITERAL_package : case LITERAL_private : case LITERAL_protected : case LITERAL_public : case LITERAL_return : case LITERAL_short : case LITERAL_static : case LITERAL_super : case LITERAL_switch : case LITERAL_synchronized : case LITERAL_this : case LITERAL_threadsafe : case LITERAL_throw : case LITERAL_throws : case LITERAL_transient : case LITERAL_true : case LITERAL_try : case LITERAL_void : case LITERAL_volatile : case LITERAL_while : return true ; default : return false ; } } protected void newlineCheck ( boolean check ) throws RecognitionException { if ( check && suppressNewline > <NUM_LIT:0> ) { require ( suppressNewline == <NUM_LIT:0> , "<STR_LIT>" , "<STR_LIT>" ) ; suppressNewline = <NUM_LIT:0> ; } newline ( ) ; } protected boolean atValidDollarEscape ( ) throws CharStreamException { int k = <NUM_LIT:1> ; char lc = LA ( k ++ ) ; if ( lc != '<CHAR_LIT>' ) return false ; lc = LA ( k ++ ) ; if ( lc == '<CHAR_LIT>' ) lc = LA ( k ++ ) ; return ( lc == '<CHAR_LIT>' || ( lc != '<CHAR_LIT>' && Character . isJavaIdentifierStart ( lc ) ) ) ; } public TokenStream plumb ( ) { return new TokenStream ( ) { public Token nextToken ( ) throws TokenStreamException { if ( stringCtorState >= SCS_LIT ) { int quoteType = ( stringCtorState & SCS_TYPE ) ; stringCtorState = <NUM_LIT:0> ; resetText ( ) ; try { switch ( quoteType ) { case SCS_SQ_TYPE : mSTRING_CTOR_END ( true , false , false ) ; break ; case SCS_TQ_TYPE : mSTRING_CTOR_END ( true , false , true ) ; break ; case SCS_RE_TYPE : mREGEXP_CTOR_END ( true , false ) ; break ; default : throw new AssertionError ( false ) ; } lastSigTokenType = _returnToken . getType ( ) ; return _returnToken ; } catch ( RecognitionException e ) { throw new TokenStreamRecognitionException ( e ) ; } catch ( CharStreamException cse ) { if ( cse instanceof CharStreamIOException ) { throw new TokenStreamIOException ( ( ( CharStreamIOException ) cse ) . io ) ; } else { throw new TokenStreamException ( cse . getMessage ( ) ) ; } } } Token token = GroovyLexer . this . nextToken ( ) ; int lasttype = token . getType ( ) ; if ( whitespaceIncluded ) { switch ( lasttype ) { case WS : case ONE_NL : case SL_COMMENT : case ML_COMMENT : lasttype = lastSigTokenType ; } } lastSigTokenType = lasttype ; return token ; } } ; } public static boolean tracing = false ; public void traceIn ( String rname ) throws CharStreamException { if ( ! GroovyLexer . tracing ) return ; super . traceIn ( rname ) ; } public void traceOut ( String rname ) throws CharStreamException { if ( ! GroovyLexer . tracing ) return ; if ( _returnToken != null ) rname += tokenStringOf ( _returnToken ) ; super . traceOut ( rname ) ; } private static java . util . HashMap ttypes ; private static String tokenStringOf ( Token t ) { if ( ttypes == null ) { java . util . HashMap map = new java . util . HashMap ( ) ; java . lang . reflect . Field [ ] fields = GroovyTokenTypes . class . getDeclaredFields ( ) ; for ( int i = <NUM_LIT:0> ; i < fields . length ; i ++ ) { if ( fields [ i ] . getType ( ) != int . class ) continue ; try { map . put ( fields [ i ] . get ( null ) , fields [ i ] . getName ( ) ) ; } catch ( IllegalAccessException ee ) { } } ttypes = map ; } Integer tt = Integer . valueOf ( t . getType ( ) ) ; Object ttn = ttypes . get ( tt ) ; if ( ttn == null ) ttn = "<STR_LIT:<>" + tt + "<STR_LIT:>>" ; return "<STR_LIT:[>" + ttn + "<STR_LIT>" + t . getText ( ) + "<STR_LIT>" ; } protected GroovyRecognizer parser ; private void require ( boolean z , String problem , String solution ) throws SemanticException { if ( ! z ) parser . requireFailed ( problem , solution ) ; } public GroovyLexer ( InputStream in ) { this ( new ByteBuffer ( in ) ) ; } public GroovyLexer ( Reader in ) { this ( new CharBuffer ( in ) ) ; } public GroovyLexer ( InputBuffer ib ) { this ( new LexerSharedInputState ( ib ) ) ; } public GroovyLexer ( LexerSharedInputState state ) { super ( state ) ; caseSensitiveLiterals = true ; setCaseSensitive ( true ) ; literals = new Hashtable ( ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT:float>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT:null>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT:class>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT:double>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT:int>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT:boolean>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT:default>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT:false>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT:100> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT:true>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT:long>" , this ) , new Integer ( <NUM_LIT> ) ) ; } public Token nextToken ( ) throws TokenStreamException { Token theRetToken = null ; tryAgain : for ( ; ; ) { Token _token = null ; int _ttype = Token . INVALID_TYPE ; resetText ( ) ; try { try { switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT:(>' : { mLPAREN ( true ) ; theRetToken = _returnToken ; break ; } case '<CHAR_LIT:)>' : { mRPAREN ( true ) ; theRetToken = _returnToken ; break ; } case '<CHAR_LIT:[>' : { mLBRACK ( true ) ; theRetToken = _returnToken ; break ; } case '<CHAR_LIT:]>' : { mRBRACK ( true ) ; theRetToken = _returnToken ; break ; } case '<CHAR_LIT>' : { mLCURLY ( true ) ; theRetToken = _returnToken ; break ; } case '<CHAR_LIT:}>' : { mRCURLY ( true ) ; theRetToken = _returnToken ; break ; } case '<CHAR_LIT::>' : { mCOLON ( true ) ; theRetToken = _returnToken ; break ; } case '<CHAR_LIT:U+002C>' : { mCOMMA ( true ) ; theRetToken = _returnToken ; break ; } case '<CHAR_LIT>' : { mBNOT ( true ) ; theRetToken = _returnToken ; break ; } case '<CHAR_LIT:;>' : { mSEMI ( true ) ; theRetToken = _returnToken ; break ; } case '<STR_LIT:\t>' : case '<CHAR_LIT>' : case '<CHAR_LIT:U+0020>' : case '<STR_LIT:\\>' : { mWS ( true ) ; theRetToken = _returnToken ; break ; } case '<STR_LIT:\n>' : case '<STR_LIT>' : { mNLS ( true ) ; theRetToken = _returnToken ; break ; } case '<CHAR_LIT:">' : case '<STR_LIT>' : { mSTRING_LITERAL ( true ) ; theRetToken = _returnToken ; break ; } case '<CHAR_LIT:0>' : case '<CHAR_LIT:1>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT:9>' : { mNUM_INT ( true ) ; theRetToken = _returnToken ; break ; } case '<CHAR_LIT>' : { mAT ( true ) ; theRetToken = _returnToken ; break ; } default : if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:>>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:>>' ) && ( LA ( <NUM_LIT:3> ) == '<CHAR_LIT:>>' ) && ( LA ( <NUM_LIT:4> ) == '<CHAR_LIT:=>' ) ) { mBSR_ASSIGN ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:=>' ) && ( LA ( <NUM_LIT:3> ) == '<CHAR_LIT:>>' ) ) { mCOMPARE_TO ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:>>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:>>' ) && ( LA ( <NUM_LIT:3> ) == '<CHAR_LIT:=>' ) ) { mSR_ASSIGN ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:>>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:>>' ) && ( LA ( <NUM_LIT:3> ) == '<CHAR_LIT:>>' ) && ( true ) ) { mBSR ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:3> ) == '<CHAR_LIT:=>' ) ) { mSL_ASSIGN ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:.>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:.>' ) && ( LA ( <NUM_LIT:3> ) == '<CHAR_LIT>' ) ) { mRANGE_EXCLUSIVE ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:.>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:.>' ) && ( LA ( <NUM_LIT:3> ) == '<CHAR_LIT:.>' ) ) { mTRIPLE_DOT ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:=>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:=>' ) && ( LA ( <NUM_LIT:3> ) == '<CHAR_LIT>' ) ) { mREGEX_MATCH ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:3> ) == '<CHAR_LIT:=>' ) ) { mSTAR_STAR_ASSIGN ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:=>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:=>' ) && ( true ) ) { mEQUAL ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:=>' ) ) { mNOT_EQUAL ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:=>' ) ) { mPLUS_ASSIGN ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' ) ) { mINC ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:->' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:=>' ) ) { mMINUS_ASSIGN ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:->' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:->' ) ) { mDEC ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:=>' ) ) { mSTAR_ASSIGN ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:=>' ) ) { mMOD_ASSIGN ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:>>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:>>' ) && ( true ) ) { mSR ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:>>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:=>' ) ) { mGE ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' ) && ( true ) ) { mSL ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:=>' ) && ( true ) ) { mLE ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:=>' ) ) { mBXOR_ASSIGN ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:=>' ) ) { mBOR_ASSIGN ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' ) ) { mLOR ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:=>' ) ) { mBAND_ASSIGN ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' ) ) { mLAND ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:.>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:.>' ) && ( true ) ) { mRANGE_INCLUSIVE ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:.>' ) ) { mSPREAD_DOT ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:.>' ) ) { mOPTIONAL_DOT ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT::>' ) ) { mELVIS_OPERATOR ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:.>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' ) ) { mMEMBER_POINTER ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:=>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' ) ) { mREGEX_FIND ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' ) && ( true ) ) { mSTAR_STAR ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:->' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:>>' ) ) { mCLOSABLE_BLOCK_OP ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:/>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:/>' ) ) { mSL_COMMENT ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:/>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' ) ) { mML_COMMENT ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( true ) ) { mQUESTION ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:.>' ) && ( true ) ) { mDOT ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:=>' ) && ( true ) ) { mASSIGN ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( true ) ) { mLNOT ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( true ) ) { mPLUS ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:->' ) && ( true ) ) { mMINUS ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( true ) ) { mSTAR ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( true ) ) { mMOD ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:>>' ) && ( true ) ) { mGT ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( true ) ) { mLT ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( true ) ) { mBXOR ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( true ) ) { mBOR ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( true ) ) { mBAND ( true ) ; theRetToken = _returnToken ; } else if ( ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) ) && ( getLine ( ) == <NUM_LIT:1> && getColumn ( ) == <NUM_LIT:1> ) ) { mSH_COMMENT ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:/>' ) && ( true ) ) { mREGEXP_LITERAL ( true ) ; theRetToken = _returnToken ; } else if ( ( _tokenSet_0 . member ( LA ( <NUM_LIT:1> ) ) ) ) { mIDENT ( true ) ; theRetToken = _returnToken ; } else { if ( LA ( <NUM_LIT:1> ) == EOF_CHAR ) { uponEOF ( ) ; _returnToken = makeToken ( Token . EOF_TYPE ) ; } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } } if ( _returnToken == null ) continue tryAgain ; _ttype = _returnToken . getType ( ) ; _returnToken . setType ( _ttype ) ; return _returnToken ; } catch ( RecognitionException e ) { throw new TokenStreamRecognitionException ( e ) ; } } catch ( CharStreamException cse ) { if ( cse instanceof CharStreamIOException ) { throw new TokenStreamIOException ( ( ( CharStreamIOException ) cse ) . io ) ; } else { throw new TokenStreamException ( cse . getMessage ( ) ) ; } } } } public final void mQUESTION ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = QUESTION ; int _saveIndex ; match ( '<CHAR_LIT>' ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mLPAREN ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = LPAREN ; int _saveIndex ; match ( '<CHAR_LIT:(>' ) ; if ( inputState . guessing == <NUM_LIT:0> ) { ++ parenLevel ; } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mRPAREN ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = RPAREN ; int _saveIndex ; match ( '<CHAR_LIT:)>' ) ; if ( inputState . guessing == <NUM_LIT:0> ) { -- parenLevel ; } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mLBRACK ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = LBRACK ; int _saveIndex ; match ( '<CHAR_LIT:[>' ) ; if ( inputState . guessing == <NUM_LIT:0> ) { ++ parenLevel ; } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mRBRACK ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = RBRACK ; int _saveIndex ; match ( '<CHAR_LIT:]>' ) ; if ( inputState . guessing == <NUM_LIT:0> ) { -- parenLevel ; } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mLCURLY ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = LCURLY ; int _saveIndex ; match ( '<CHAR_LIT>' ) ; if ( inputState . guessing == <NUM_LIT:0> ) { pushParenLevel ( ) ; } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mRCURLY ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = RCURLY ; int _saveIndex ; match ( '<CHAR_LIT:}>' ) ; if ( inputState . guessing == <NUM_LIT:0> ) { popParenLevel ( ) ; if ( stringCtorState != <NUM_LIT:0> ) restartStringCtor ( true ) ; } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mCOLON ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = COLON ; int _saveIndex ; match ( '<CHAR_LIT::>' ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mCOMMA ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = COMMA ; int _saveIndex ; match ( '<CHAR_LIT:U+002C>' ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mDOT ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = DOT ; int _saveIndex ; match ( '<CHAR_LIT:.>' ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mASSIGN ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = ASSIGN ; int _saveIndex ; match ( '<CHAR_LIT:=>' ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mCOMPARE_TO ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = COMPARE_TO ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mEQUAL ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = EQUAL ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mLNOT ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = LNOT ; int _saveIndex ; match ( '<CHAR_LIT>' ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mBNOT ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = BNOT ; int _saveIndex ; match ( '<CHAR_LIT>' ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mNOT_EQUAL ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = NOT_EQUAL ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } protected final void mDIV ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = DIV ; int _saveIndex ; match ( '<CHAR_LIT:/>' ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } protected final void mDIV_ASSIGN ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = DIV_ASSIGN ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mPLUS ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = PLUS ; int _saveIndex ; match ( '<CHAR_LIT>' ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mPLUS_ASSIGN ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = PLUS_ASSIGN ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mINC ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = INC ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mMINUS ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = MINUS ; int _saveIndex ; match ( '<CHAR_LIT:->' ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mMINUS_ASSIGN ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = MINUS_ASSIGN ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mDEC ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = DEC ; int _saveIndex ; match ( "<STR_LIT:-->" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mSTAR ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = STAR ; int _saveIndex ; match ( '<CHAR_LIT>' ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mSTAR_ASSIGN ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = STAR_ASSIGN ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mMOD ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = MOD ; int _saveIndex ; match ( '<CHAR_LIT>' ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mMOD_ASSIGN ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = MOD_ASSIGN ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mSR ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = SR ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mSR_ASSIGN ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = SR_ASSIGN ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mBSR ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = BSR ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mBSR_ASSIGN ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = BSR_ASSIGN ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mGE ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = GE ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mGT ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = GT ; int _saveIndex ; match ( "<STR_LIT:>>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mSL ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = SL ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mSL_ASSIGN ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = SL_ASSIGN ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mLE ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = LE ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mLT ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = LT ; int _saveIndex ; match ( '<CHAR_LIT>' ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mBXOR ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = BXOR ; int _saveIndex ; match ( '<CHAR_LIT>' ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mBXOR_ASSIGN ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = BXOR_ASSIGN ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mBOR ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = BOR ; int _saveIndex ; match ( '<CHAR_LIT>' ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mBOR_ASSIGN ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = BOR_ASSIGN ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mLOR ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = LOR ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mBAND ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = BAND ; int _saveIndex ; match ( '<CHAR_LIT>' ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mBAND_ASSIGN ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = BAND_ASSIGN ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mLAND ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = LAND ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mSEMI ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = SEMI ; int _saveIndex ; match ( '<CHAR_LIT:;>' ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } protected final void mDOLLAR ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = DOLLAR ; int _saveIndex ; match ( '<CHAR_LIT>' ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mRANGE_INCLUSIVE ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = RANGE_INCLUSIVE ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mRANGE_EXCLUSIVE ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = RANGE_EXCLUSIVE ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mTRIPLE_DOT ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = TRIPLE_DOT ; int _saveIndex ; match ( "<STR_LIT:...>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mSPREAD_DOT ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = SPREAD_DOT ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mOPTIONAL_DOT ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = OPTIONAL_DOT ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mELVIS_OPERATOR ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = ELVIS_OPERATOR ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mMEMBER_POINTER ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = MEMBER_POINTER ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mREGEX_FIND ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = REGEX_FIND ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mREGEX_MATCH ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = REGEX_MATCH ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mSTAR_STAR ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = STAR_STAR ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mSTAR_STAR_ASSIGN ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = STAR_STAR_ASSIGN ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mCLOSABLE_BLOCK_OP ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = CLOSABLE_BLOCK_OP ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mWS ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = WS ; int _saveIndex ; { int _cnt603 = <NUM_LIT:0> ; _loop603 : do { if ( ( LA ( <NUM_LIT:1> ) == '<STR_LIT:\\>' ) && ( LA ( <NUM_LIT:2> ) == '<STR_LIT:\n>' || LA ( <NUM_LIT:2> ) == '<STR_LIT>' ) && ( true ) && ( true ) ) { match ( '<STR_LIT:\\>' ) ; mONE_NL ( false , false ) ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:U+0020>' ) && ( true ) && ( true ) && ( true ) ) { match ( '<CHAR_LIT:U+0020>' ) ; } else if ( ( LA ( <NUM_LIT:1> ) == '<STR_LIT:\t>' ) && ( true ) && ( true ) && ( true ) ) { match ( '<STR_LIT:\t>' ) ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( true ) && ( true ) && ( true ) ) { match ( '<STR_LIT>' ) ; } else { if ( _cnt603 >= <NUM_LIT:1> ) { break _loop603 ; } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } _cnt603 ++ ; } while ( true ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { if ( ! whitespaceIncluded ) _ttype = Token . SKIP ; } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } protected final void mONE_NL ( boolean _createToken , boolean check ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = ONE_NL ; int _saveIndex ; { if ( ( LA ( <NUM_LIT:1> ) == '<STR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<STR_LIT:\n>' ) && ( true ) && ( true ) ) { _saveIndex = text . length ( ) ; match ( "<STR_LIT>" ) ; text . setLength ( _saveIndex ) ; } else if ( ( LA ( <NUM_LIT:1> ) == '<STR_LIT>' ) && ( true ) && ( true ) && ( true ) ) { _saveIndex = text . length ( ) ; match ( '<STR_LIT>' ) ; text . setLength ( _saveIndex ) ; } else if ( ( LA ( <NUM_LIT:1> ) == '<STR_LIT:\n>' ) ) { _saveIndex = text . length ( ) ; match ( '<STR_LIT:\n>' ) ; text . setLength ( _saveIndex ) ; } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } if ( inputState . guessing == <NUM_LIT:0> ) { newlineCheck ( check ) ; } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } protected final void mONE_NL_KEEP ( boolean _createToken , boolean check ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = ONE_NL_KEEP ; int _saveIndex ; { if ( ( LA ( <NUM_LIT:1> ) == '<STR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<STR_LIT:\n>' ) && ( ( LA ( <NUM_LIT:3> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:3> ) <= '<STR_LIT>' ) ) && ( ( LA ( <NUM_LIT:4> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:4> ) <= '<STR_LIT>' ) ) ) { match ( "<STR_LIT>" ) ; } else if ( ( LA ( <NUM_LIT:1> ) == '<STR_LIT>' ) && ( ( LA ( <NUM_LIT:2> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:2> ) <= '<STR_LIT>' ) ) && ( ( LA ( <NUM_LIT:3> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:3> ) <= '<STR_LIT>' ) ) && ( true ) ) { match ( '<STR_LIT>' ) ; } else if ( ( LA ( <NUM_LIT:1> ) == '<STR_LIT:\n>' ) ) { match ( '<STR_LIT:\n>' ) ; } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } if ( inputState . guessing == <NUM_LIT:0> ) { newlineCheck ( check ) ; } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mNLS ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = NLS ; int _saveIndex ; mONE_NL ( false , true ) ; { if ( ( ( LA ( <NUM_LIT:1> ) == '<STR_LIT:\t>' || LA ( <NUM_LIT:1> ) == '<STR_LIT:\n>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:1> ) == '<STR_LIT>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT:U+0020>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT:/>' || LA ( <NUM_LIT:1> ) == '<STR_LIT:\\>' ) ) && ( ! whitespaceIncluded ) ) { { int _cnt611 = <NUM_LIT:0> ; _loop611 : do { switch ( LA ( <NUM_LIT:1> ) ) { case '<STR_LIT:\n>' : case '<STR_LIT>' : { mONE_NL ( false , true ) ; break ; } case '<STR_LIT:\t>' : case '<CHAR_LIT>' : case '<CHAR_LIT:U+0020>' : case '<STR_LIT:\\>' : { mWS ( false ) ; break ; } default : if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:/>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:/>' ) ) { mSL_COMMENT ( false ) ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:/>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' ) ) { mML_COMMENT ( false ) ; } else { if ( _cnt611 >= <NUM_LIT:1> ) { break _loop611 ; } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } } _cnt611 ++ ; } while ( true ) ; } } else { } } if ( inputState . guessing == <NUM_LIT:0> ) { if ( whitespaceIncluded ) { } else if ( parenLevel != <NUM_LIT:0> ) { _ttype = Token . SKIP ; } else { text . setLength ( _begin ) ; text . append ( "<STR_LIT>" ) ; } } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mSL_COMMENT ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = SL_COMMENT ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( inputState . guessing == <NUM_LIT:0> ) { parser . startComment ( inputState . getLine ( ) , inputState . getColumn ( ) - <NUM_LIT:2> ) ; } { _loop615 : do { if ( ( _tokenSet_1 . member ( LA ( <NUM_LIT:1> ) ) ) && ( true ) && ( true ) && ( true ) ) { { match ( _tokenSet_1 ) ; } } else { break _loop615 ; } } while ( true ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { parser . endComment ( <NUM_LIT:0> , inputState . getLine ( ) , inputState . getColumn ( ) , new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; if ( ! whitespaceIncluded ) _ttype = Token . SKIP ; } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mML_COMMENT ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = ML_COMMENT ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( inputState . guessing == <NUM_LIT:0> ) { parser . startComment ( inputState . getLine ( ) , inputState . getColumn ( ) - <NUM_LIT:2> ) ; } { _loop625 : do { boolean synPredMatched623 = false ; if ( ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( ( LA ( <NUM_LIT:2> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:2> ) <= '<STR_LIT>' ) ) && ( ( LA ( <NUM_LIT:3> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:3> ) <= '<STR_LIT>' ) ) && ( true ) ) ) { int _m623 = mark ( ) ; synPredMatched623 = true ; inputState . guessing ++ ; try { { match ( '<CHAR_LIT>' ) ; matchNot ( '<CHAR_LIT:/>' ) ; } } catch ( RecognitionException pe ) { synPredMatched623 = false ; } rewind ( _m623 ) ; inputState . guessing -- ; } if ( synPredMatched623 ) { match ( '<CHAR_LIT>' ) ; } else if ( ( LA ( <NUM_LIT:1> ) == '<STR_LIT:\n>' || LA ( <NUM_LIT:1> ) == '<STR_LIT>' ) ) { mONE_NL_KEEP ( false , true ) ; } else if ( ( _tokenSet_2 . member ( LA ( <NUM_LIT:1> ) ) ) ) { { match ( _tokenSet_2 ) ; } } else { break _loop625 ; } } while ( true ) ; } match ( "<STR_LIT>" ) ; if ( inputState . guessing == <NUM_LIT:0> ) { parser . endComment ( <NUM_LIT:1> , inputState . getLine ( ) , inputState . getColumn ( ) , new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; if ( ! whitespaceIncluded ) _ttype = Token . SKIP ; } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mSH_COMMENT ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = SH_COMMENT ; int _saveIndex ; if ( ! ( getLine ( ) == <NUM_LIT:1> && getColumn ( ) == <NUM_LIT:1> ) ) throw new SemanticException ( "<STR_LIT>" ) ; match ( "<STR_LIT>" ) ; { _loop619 : do { if ( ( _tokenSet_1 . member ( LA ( <NUM_LIT:1> ) ) ) ) { { match ( _tokenSet_1 ) ; } } else { break _loop619 ; } } while ( true ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { if ( ! whitespaceIncluded ) _ttype = Token . SKIP ; } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mSTRING_LITERAL ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = STRING_LITERAL ; int _saveIndex ; int tt = <NUM_LIT:0> ; boolean synPredMatched628 = false ; if ( ( ( LA ( <NUM_LIT:1> ) == '<STR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<STR_LIT>' ) && ( LA ( <NUM_LIT:3> ) == '<STR_LIT>' ) && ( ( LA ( <NUM_LIT:4> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:4> ) <= '<STR_LIT>' ) ) ) ) { int _m628 = mark ( ) ; synPredMatched628 = true ; inputState . guessing ++ ; try { { match ( "<STR_LIT>" ) ; } } catch ( RecognitionException pe ) { synPredMatched628 = false ; } rewind ( _m628 ) ; inputState . guessing -- ; } if ( synPredMatched628 ) { _saveIndex = text . length ( ) ; match ( "<STR_LIT>" ) ; text . setLength ( _saveIndex ) ; { _loop633 : do { switch ( LA ( <NUM_LIT:1> ) ) { case '<STR_LIT:\\>' : { mESC ( false ) ; break ; } case '<CHAR_LIT:">' : { match ( '<CHAR_LIT:">' ) ; break ; } case '<CHAR_LIT>' : { match ( '<CHAR_LIT>' ) ; break ; } case '<STR_LIT:\n>' : case '<STR_LIT>' : { mSTRING_NL ( false , true ) ; break ; } default : boolean synPredMatched632 = false ; if ( ( ( LA ( <NUM_LIT:1> ) == '<STR_LIT>' ) && ( ( LA ( <NUM_LIT:2> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:2> ) <= '<STR_LIT>' ) ) && ( ( LA ( <NUM_LIT:3> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:3> ) <= '<STR_LIT>' ) ) && ( ( LA ( <NUM_LIT:4> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:4> ) <= '<STR_LIT>' ) ) ) ) { int _m632 = mark ( ) ; synPredMatched632 = true ; inputState . guessing ++ ; try { { match ( '<STR_LIT>' ) ; { if ( ( _tokenSet_3 . member ( LA ( <NUM_LIT:1> ) ) ) ) { matchNot ( '<STR_LIT>' ) ; } else if ( ( LA ( <NUM_LIT:1> ) == '<STR_LIT>' ) ) { match ( '<STR_LIT>' ) ; matchNot ( '<STR_LIT>' ) ; } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } } } catch ( RecognitionException pe ) { synPredMatched632 = false ; } rewind ( _m632 ) ; inputState . guessing -- ; } if ( synPredMatched632 ) { match ( '<STR_LIT>' ) ; } else if ( ( _tokenSet_4 . member ( LA ( <NUM_LIT:1> ) ) ) ) { mSTRING_CH ( false ) ; } else { break _loop633 ; } } } while ( true ) ; } _saveIndex = text . length ( ) ; match ( "<STR_LIT>" ) ; text . setLength ( _saveIndex ) ; } else { boolean synPredMatched637 = false ; if ( ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:">' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:">' ) && ( LA ( <NUM_LIT:3> ) == '<CHAR_LIT:">' ) && ( ( LA ( <NUM_LIT:4> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:4> ) <= '<STR_LIT>' ) ) ) ) { int _m637 = mark ( ) ; synPredMatched637 = true ; inputState . guessing ++ ; try { { match ( "<STR_LIT>" ) ; } } catch ( RecognitionException pe ) { synPredMatched637 = false ; } rewind ( _m637 ) ; inputState . guessing -- ; } if ( synPredMatched637 ) { _saveIndex = text . length ( ) ; match ( "<STR_LIT>" ) ; text . setLength ( _saveIndex ) ; tt = mSTRING_CTOR_END ( false , true , true ) ; if ( inputState . guessing == <NUM_LIT:0> ) { _ttype = tt ; } } else if ( ( LA ( <NUM_LIT:1> ) == '<STR_LIT>' ) && ( _tokenSet_1 . member ( LA ( <NUM_LIT:2> ) ) ) && ( true ) && ( true ) ) { _saveIndex = text . length ( ) ; match ( '<STR_LIT>' ) ; text . setLength ( _saveIndex ) ; if ( inputState . guessing == <NUM_LIT:0> ) { ++ suppressNewline ; } { _loop635 : do { switch ( LA ( <NUM_LIT:1> ) ) { case '<STR_LIT:\\>' : { mESC ( false ) ; break ; } case '<CHAR_LIT:">' : { match ( '<CHAR_LIT:">' ) ; break ; } case '<CHAR_LIT>' : { match ( '<CHAR_LIT>' ) ; break ; } default : if ( ( _tokenSet_4 . member ( LA ( <NUM_LIT:1> ) ) ) ) { mSTRING_CH ( false ) ; } else { break _loop635 ; } } } while ( true ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { -- suppressNewline ; } _saveIndex = text . length ( ) ; match ( '<STR_LIT>' ) ; text . setLength ( _saveIndex ) ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:">' ) && ( ( LA ( <NUM_LIT:2> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:2> ) <= '<STR_LIT>' ) ) && ( true ) && ( true ) ) { _saveIndex = text . length ( ) ; match ( '<CHAR_LIT:">' ) ; text . setLength ( _saveIndex ) ; if ( inputState . guessing == <NUM_LIT:0> ) { ++ suppressNewline ; } tt = mSTRING_CTOR_END ( false , true , false ) ; if ( inputState . guessing == <NUM_LIT:0> ) { _ttype = tt ; } } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } protected final void mSTRING_CH ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = STRING_CH ; int _saveIndex ; { match ( _tokenSet_4 ) ; } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } protected final void mESC ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = ESC ; int _saveIndex ; if ( ( LA ( <NUM_LIT:1> ) == '<STR_LIT:\\>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:">' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:2> ) == '<STR_LIT>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT:0>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT:1>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:2> ) == '<STR_LIT:\\>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT:b>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' ) ) { _saveIndex = text . length ( ) ; match ( '<STR_LIT:\\>' ) ; text . setLength ( _saveIndex ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT>' : { match ( '<CHAR_LIT>' ) ; if ( inputState . guessing == <NUM_LIT:0> ) { text . setLength ( _begin ) ; text . append ( "<STR_LIT:n>" ) ; } break ; } case '<CHAR_LIT>' : { match ( '<CHAR_LIT>' ) ; if ( inputState . guessing == <NUM_LIT:0> ) { text . setLength ( _begin ) ; text . append ( "<STR_LIT:r>" ) ; } break ; } case '<CHAR_LIT>' : { match ( '<CHAR_LIT>' ) ; if ( inputState . guessing == <NUM_LIT:0> ) { text . setLength ( _begin ) ; text . append ( "<STR_LIT:t>" ) ; } break ; } case '<CHAR_LIT:b>' : { match ( '<CHAR_LIT:b>' ) ; if ( inputState . guessing == <NUM_LIT:0> ) { text . setLength ( _begin ) ; text . append ( "<STR_LIT>" ) ; } break ; } case '<CHAR_LIT>' : { match ( '<CHAR_LIT>' ) ; if ( inputState . guessing == <NUM_LIT:0> ) { text . setLength ( _begin ) ; text . append ( "<STR_LIT>" ) ; } break ; } case '<CHAR_LIT:">' : { match ( '<CHAR_LIT:">' ) ; break ; } case '<STR_LIT>' : { match ( '<STR_LIT>' ) ; break ; } case '<STR_LIT:\\>' : { match ( '<STR_LIT:\\>' ) ; break ; } case '<CHAR_LIT>' : { match ( '<CHAR_LIT>' ) ; break ; } case '<CHAR_LIT>' : { { int _cnt662 = <NUM_LIT:0> ; _loop662 : do { if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) ) { match ( '<CHAR_LIT>' ) ; } else { if ( _cnt662 >= <NUM_LIT:1> ) { break _loop662 ; } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } _cnt662 ++ ; } while ( true ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { text . setLength ( _begin ) ; text . append ( "<STR_LIT>" ) ; } mHEX_DIGIT ( false ) ; mHEX_DIGIT ( false ) ; mHEX_DIGIT ( false ) ; mHEX_DIGIT ( false ) ; if ( inputState . guessing == <NUM_LIT:0> ) { char ch = ( char ) Integer . parseInt ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) , <NUM_LIT:16> ) ; text . setLength ( _begin ) ; text . append ( ch ) ; } break ; } case '<CHAR_LIT:0>' : case '<CHAR_LIT:1>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : { matchRange ( '<CHAR_LIT:0>' , '<CHAR_LIT>' ) ; { if ( ( ( LA ( <NUM_LIT:1> ) >= '<CHAR_LIT:0>' && LA ( <NUM_LIT:1> ) <= '<CHAR_LIT>' ) ) && ( ( LA ( <NUM_LIT:2> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:2> ) <= '<STR_LIT>' ) ) && ( true ) && ( true ) ) { matchRange ( '<CHAR_LIT:0>' , '<CHAR_LIT>' ) ; { if ( ( ( LA ( <NUM_LIT:1> ) >= '<CHAR_LIT:0>' && LA ( <NUM_LIT:1> ) <= '<CHAR_LIT>' ) ) && ( ( LA ( <NUM_LIT:2> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:2> ) <= '<STR_LIT>' ) ) && ( true ) && ( true ) ) { matchRange ( '<CHAR_LIT:0>' , '<CHAR_LIT>' ) ; } else if ( ( ( LA ( <NUM_LIT:1> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:1> ) <= '<STR_LIT>' ) ) && ( true ) && ( true ) && ( true ) ) { } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } } else if ( ( ( LA ( <NUM_LIT:1> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:1> ) <= '<STR_LIT>' ) ) && ( true ) && ( true ) && ( true ) ) { } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } if ( inputState . guessing == <NUM_LIT:0> ) { char ch = ( char ) Integer . parseInt ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) , <NUM_LIT:8> ) ; text . setLength ( _begin ) ; text . append ( ch ) ; } break ; } case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : { matchRange ( '<CHAR_LIT>' , '<CHAR_LIT>' ) ; { if ( ( ( LA ( <NUM_LIT:1> ) >= '<CHAR_LIT:0>' && LA ( <NUM_LIT:1> ) <= '<CHAR_LIT>' ) ) && ( ( LA ( <NUM_LIT:2> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:2> ) <= '<STR_LIT>' ) ) && ( true ) && ( true ) ) { matchRange ( '<CHAR_LIT:0>' , '<CHAR_LIT>' ) ; } else if ( ( ( LA ( <NUM_LIT:1> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:1> ) <= '<STR_LIT>' ) ) && ( true ) && ( true ) && ( true ) ) { } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } if ( inputState . guessing == <NUM_LIT:0> ) { char ch = ( char ) Integer . parseInt ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) , <NUM_LIT:8> ) ; text . setLength ( _begin ) ; text . append ( ch ) ; } break ; } default : { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } } } else if ( ( LA ( <NUM_LIT:1> ) == '<STR_LIT:\\>' ) && ( LA ( <NUM_LIT:2> ) == '<STR_LIT:\n>' || LA ( <NUM_LIT:2> ) == '<STR_LIT>' ) ) { _saveIndex = text . length ( ) ; match ( '<STR_LIT:\\>' ) ; text . setLength ( _saveIndex ) ; _saveIndex = text . length ( ) ; mONE_NL ( false , false ) ; text . setLength ( _saveIndex ) ; } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } protected final void mSTRING_NL ( boolean _createToken , boolean allowNewline ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = STRING_NL ; int _saveIndex ; if ( inputState . guessing == <NUM_LIT:0> ) { if ( ! allowNewline ) throw new MismatchedCharException ( '<STR_LIT:\n>' , '<STR_LIT:\n>' , true , this ) ; } mONE_NL ( false , false ) ; if ( inputState . guessing == <NUM_LIT:0> ) { text . setLength ( _begin ) ; text . append ( '<STR_LIT:\n>' ) ; } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } protected final int mSTRING_CTOR_END ( boolean _createToken , boolean fromStart , boolean tripleQuote ) throws RecognitionException , CharStreamException , TokenStreamException { int tt = STRING_CTOR_END ; int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = STRING_CTOR_END ; int _saveIndex ; boolean dollarOK = false ; { _loop643 : do { switch ( LA ( <NUM_LIT:1> ) ) { case '<STR_LIT:\\>' : { mESC ( false ) ; break ; } case '<STR_LIT>' : { match ( '<STR_LIT>' ) ; break ; } case '<STR_LIT:\n>' : case '<STR_LIT>' : { mSTRING_NL ( false , tripleQuote ) ; break ; } default : boolean synPredMatched642 = false ; if ( ( ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:">' ) && ( ( LA ( <NUM_LIT:2> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:2> ) <= '<STR_LIT>' ) ) && ( true ) && ( true ) ) && ( tripleQuote ) ) ) { int _m642 = mark ( ) ; synPredMatched642 = true ; inputState . guessing ++ ; try { { match ( '<CHAR_LIT:">' ) ; { if ( ( _tokenSet_5 . member ( LA ( <NUM_LIT:1> ) ) ) ) { matchNot ( '<CHAR_LIT:">' ) ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:">' ) ) { match ( '<CHAR_LIT:">' ) ; matchNot ( '<CHAR_LIT:">' ) ; } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } } } catch ( RecognitionException pe ) { synPredMatched642 = false ; } rewind ( _m642 ) ; inputState . guessing -- ; } if ( synPredMatched642 ) { match ( '<CHAR_LIT:">' ) ; } else if ( ( _tokenSet_4 . member ( LA ( <NUM_LIT:1> ) ) ) ) { mSTRING_CH ( false ) ; } else { break _loop643 ; } } } while ( true ) ; } { switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT:">' : { { if ( ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:">' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:">' ) ) && ( tripleQuote ) ) { _saveIndex = text . length ( ) ; match ( "<STR_LIT>" ) ; text . setLength ( _saveIndex ) ; } else if ( ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:">' ) && ( true ) ) && ( ! tripleQuote ) ) { _saveIndex = text . length ( ) ; match ( "<STR_LIT:\">" ) ; text . setLength ( _saveIndex ) ; } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } if ( inputState . guessing == <NUM_LIT:0> ) { if ( fromStart ) tt = STRING_LITERAL ; if ( ! tripleQuote ) { -- suppressNewline ; } } break ; } case '<CHAR_LIT>' : { if ( inputState . guessing == <NUM_LIT:0> ) { dollarOK = atValidDollarEscape ( ) ; } _saveIndex = text . length ( ) ; match ( '<CHAR_LIT>' ) ; text . setLength ( _saveIndex ) ; if ( inputState . guessing == <NUM_LIT:0> ) { require ( dollarOK , "<STR_LIT>" , "<STR_LIT>" ) ; tt = ( fromStart ? STRING_CTOR_START : STRING_CTOR_MIDDLE ) ; stringCtorState = SCS_VAL + ( tripleQuote ? SCS_TQ_TYPE : SCS_SQ_TYPE ) ; } break ; } default : { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { _ttype = tt ; } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; return tt ; } public final void mREGEXP_LITERAL ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = REGEXP_LITERAL ; int _saveIndex ; int tt = <NUM_LIT:0> ; if ( ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:/>' ) && ( _tokenSet_6 . member ( LA ( <NUM_LIT:2> ) ) ) && ( true ) && ( true ) ) && ( allowRegexpLiteral ( ) ) ) { _saveIndex = text . length ( ) ; match ( '<CHAR_LIT:/>' ) ; text . setLength ( _saveIndex ) ; if ( inputState . guessing == <NUM_LIT:0> ) { ++ suppressNewline ; } { if ( ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( _tokenSet_2 . member ( LA ( <NUM_LIT:2> ) ) ) ) && ( ! atValidDollarEscape ( ) ) ) { match ( '<CHAR_LIT>' ) ; tt = mREGEXP_CTOR_END ( false , true ) ; } else if ( ( _tokenSet_7 . member ( LA ( <NUM_LIT:1> ) ) ) ) { mREGEXP_SYMBOL ( false ) ; tt = mREGEXP_CTOR_END ( false , true ) ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( true ) ) { _saveIndex = text . length ( ) ; match ( '<CHAR_LIT>' ) ; text . setLength ( _saveIndex ) ; if ( inputState . guessing == <NUM_LIT:0> ) { tt = STRING_CTOR_START ; stringCtorState = SCS_VAL + SCS_RE_TYPE ; } } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } if ( inputState . guessing == <NUM_LIT:0> ) { _ttype = tt ; } } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:/>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:=>' ) && ( true ) && ( true ) ) { mDIV_ASSIGN ( false ) ; if ( inputState . guessing == <NUM_LIT:0> ) { _ttype = DIV_ASSIGN ; } } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:/>' ) && ( true ) ) { mDIV ( false ) ; if ( inputState . guessing == <NUM_LIT:0> ) { _ttype = DIV ; } } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } protected final void mREGEXP_SYMBOL ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = REGEXP_SYMBOL ; int _saveIndex ; { if ( ( LA ( <NUM_LIT:1> ) == '<STR_LIT:\\>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:/>' ) && ( _tokenSet_1 . member ( LA ( <NUM_LIT:3> ) ) ) && ( true ) ) { match ( '<STR_LIT:\\>' ) ; match ( '<CHAR_LIT:/>' ) ; if ( inputState . guessing == <NUM_LIT:0> ) { text . setLength ( _begin ) ; text . append ( '<CHAR_LIT:/>' ) ; } } else if ( ( ( LA ( <NUM_LIT:1> ) == '<STR_LIT:\\>' ) && ( _tokenSet_1 . member ( LA ( <NUM_LIT:2> ) ) ) && ( true ) && ( true ) ) && ( LA ( <NUM_LIT:2> ) != '<CHAR_LIT:/>' && LA ( <NUM_LIT:2> ) != '<STR_LIT:\n>' && LA ( <NUM_LIT:2> ) != '<STR_LIT>' ) ) { match ( '<STR_LIT:\\>' ) ; } else if ( ( LA ( <NUM_LIT:1> ) == '<STR_LIT:\\>' ) && ( LA ( <NUM_LIT:2> ) == '<STR_LIT:\n>' || LA ( <NUM_LIT:2> ) == '<STR_LIT>' ) ) { _saveIndex = text . length ( ) ; match ( '<STR_LIT:\\>' ) ; text . setLength ( _saveIndex ) ; _saveIndex = text . length ( ) ; mONE_NL ( false , false ) ; text . setLength ( _saveIndex ) ; if ( inputState . guessing == <NUM_LIT:0> ) { text . setLength ( _begin ) ; text . append ( '<STR_LIT:\n>' ) ; } } else if ( ( _tokenSet_8 . member ( LA ( <NUM_LIT:1> ) ) ) ) { { match ( _tokenSet_8 ) ; } } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } { _loop658 : do { if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) ) { match ( '<CHAR_LIT>' ) ; } else { break _loop658 ; } } while ( true ) ; } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } protected final int mREGEXP_CTOR_END ( boolean _createToken , boolean fromStart ) throws RecognitionException , CharStreamException , TokenStreamException { int tt = STRING_CTOR_END ; int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = REGEXP_CTOR_END ; int _saveIndex ; { _loop652 : do { if ( ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( _tokenSet_2 . member ( LA ( <NUM_LIT:2> ) ) ) ) && ( ! atValidDollarEscape ( ) ) ) { match ( '<CHAR_LIT>' ) ; } else if ( ( _tokenSet_7 . member ( LA ( <NUM_LIT:1> ) ) ) ) { mREGEXP_SYMBOL ( false ) ; } else { break _loop652 ; } } while ( true ) ; } { switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT:/>' : { _saveIndex = text . length ( ) ; match ( '<CHAR_LIT:/>' ) ; text . setLength ( _saveIndex ) ; if ( inputState . guessing == <NUM_LIT:0> ) { if ( fromStart ) tt = STRING_LITERAL ; { -- suppressNewline ; } } break ; } case '<CHAR_LIT>' : { _saveIndex = text . length ( ) ; match ( '<CHAR_LIT>' ) ; text . setLength ( _saveIndex ) ; if ( inputState . guessing == <NUM_LIT:0> ) { tt = ( fromStart ? STRING_CTOR_START : STRING_CTOR_MIDDLE ) ; stringCtorState = SCS_VAL + SCS_RE_TYPE ; } break ; } default : { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { _ttype = tt ; } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; return tt ; } protected final void mHEX_DIGIT ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = HEX_DIGIT ; int _saveIndex ; { switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT:0>' : case '<CHAR_LIT:1>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT:9>' : { matchRange ( '<CHAR_LIT:0>' , '<CHAR_LIT:9>' ) ; break ; } case '<CHAR_LIT:A>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : { matchRange ( '<CHAR_LIT:A>' , '<CHAR_LIT>' ) ; break ; } case '<CHAR_LIT:a>' : case '<CHAR_LIT:b>' : case '<CHAR_LIT:c>' : case '<CHAR_LIT>' : case '<CHAR_LIT:e>' : case '<CHAR_LIT>' : { matchRange ( '<CHAR_LIT:a>' , '<CHAR_LIT>' ) ; break ; } default : { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } protected final void mVOCAB ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = VOCAB ; int _saveIndex ; matchRange ( '<STR_LIT>' , '<STR_LIT>' ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mIDENT ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = IDENT ; int _saveIndex ; { if ( ( ( _tokenSet_0 . member ( LA ( <NUM_LIT:1> ) ) ) && ( true ) && ( true ) && ( true ) ) && ( stringCtorState == <NUM_LIT:0> ) ) { { if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) ) { mDOLLAR ( false ) ; } else if ( ( _tokenSet_9 . member ( LA ( <NUM_LIT:1> ) ) ) ) { mLETTER ( false ) ; } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } { _loop674 : do { switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT:0>' : case '<CHAR_LIT:1>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT:9>' : { mDIGIT ( false ) ; break ; } case '<CHAR_LIT>' : { mDOLLAR ( false ) ; break ; } default : if ( ( _tokenSet_9 . member ( LA ( <NUM_LIT:1> ) ) ) ) { mLETTER ( false ) ; } else { break _loop674 ; } } } while ( true ) ; } } else if ( ( _tokenSet_9 . member ( LA ( <NUM_LIT:1> ) ) ) && ( true ) && ( true ) && ( true ) ) { mLETTER ( false ) ; { _loop676 : do { if ( ( _tokenSet_9 . member ( LA ( <NUM_LIT:1> ) ) ) ) { mLETTER ( false ) ; } else if ( ( ( LA ( <NUM_LIT:1> ) >= '<CHAR_LIT:0>' && LA ( <NUM_LIT:1> ) <= '<CHAR_LIT:9>' ) ) ) { mDIGIT ( false ) ; } else { break _loop676 ; } } while ( true ) ; } } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } if ( inputState . guessing == <NUM_LIT:0> ) { if ( stringCtorState != <NUM_LIT:0> ) { if ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:.>' && LA ( <NUM_LIT:2> ) != '<CHAR_LIT>' && Character . isJavaIdentifierStart ( LA ( <NUM_LIT:2> ) ) ) { restartStringCtor ( false ) ; } else { restartStringCtor ( true ) ; } } int ttype = testLiteralsTable ( IDENT ) ; if ( ( ttype == LITERAL_as || ttype == LITERAL_def || ttype == LITERAL_in ) && ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:.>' || lastSigTokenType == DOT || lastSigTokenType == LITERAL_package ) ) { ttype = IDENT ; } if ( ttype == LITERAL_static && LA ( <NUM_LIT:1> ) == '<CHAR_LIT:.>' ) { ttype = IDENT ; } _ttype = ttype ; if ( assertEnabled && "<STR_LIT>" . equals ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ) { _ttype = LITERAL_assert ; } if ( enumEnabled && "<STR_LIT>" . equals ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ) { _ttype = LITERAL_enum ; } } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } protected final void mLETTER ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = LETTER ; int _saveIndex ; switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT:a>' : case '<CHAR_LIT:b>' : case '<CHAR_LIT:c>' : case '<CHAR_LIT>' : case '<CHAR_LIT:e>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : { matchRange ( '<CHAR_LIT:a>' , '<CHAR_LIT>' ) ; break ; } case '<CHAR_LIT:A>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT:Z>' : { matchRange ( '<CHAR_LIT:A>' , '<CHAR_LIT:Z>' ) ; break ; } case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : { matchRange ( '<STR_LIT>' , '<STR_LIT>' ) ; break ; } case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : { matchRange ( '<STR_LIT>' , '<STR_LIT>' ) ; break ; } case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : { matchRange ( '<STR_LIT>' , '<STR_LIT>' ) ; break ; } case '<CHAR_LIT:_>' : { match ( '<CHAR_LIT:_>' ) ; break ; } default : if ( ( ( LA ( <NUM_LIT:1> ) >= '<STR_LIT>' && LA ( <NUM_LIT:1> ) <= '<STR_LIT>' ) ) ) { matchRange ( '<STR_LIT>' , '<STR_LIT>' ) ; } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } protected final void mDIGIT ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = DIGIT ; int _saveIndex ; matchRange ( '<CHAR_LIT:0>' , '<CHAR_LIT:9>' ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mNUM_INT ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = NUM_INT ; int _saveIndex ; Token f2 = null ; Token g2 = null ; Token f3 = null ; Token g3 = null ; Token f4 = null ; boolean isDecimal = false ; Token t = null ; { switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT:0>' : { match ( '<CHAR_LIT:0>' ) ; if ( inputState . guessing == <NUM_LIT:0> ) { isDecimal = true ; } { if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) ) { { switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT>' : { match ( '<CHAR_LIT>' ) ; break ; } case '<CHAR_LIT>' : { match ( '<CHAR_LIT>' ) ; break ; } default : { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { isDecimal = false ; } { int _cnt684 = <NUM_LIT:0> ; _loop684 : do { if ( ( _tokenSet_10 . member ( LA ( <NUM_LIT:1> ) ) ) && ( true ) && ( true ) && ( true ) ) { mHEX_DIGIT ( false ) ; } else { if ( _cnt684 >= <NUM_LIT:1> ) { break _loop684 ; } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } _cnt684 ++ ; } while ( true ) ; } } else { boolean synPredMatched690 = false ; if ( ( ( ( LA ( <NUM_LIT:1> ) >= '<CHAR_LIT:0>' && LA ( <NUM_LIT:1> ) <= '<CHAR_LIT:9>' ) ) && ( true ) && ( true ) && ( true ) ) ) { int _m690 = mark ( ) ; synPredMatched690 = true ; inputState . guessing ++ ; try { { { int _cnt687 = <NUM_LIT:0> ; _loop687 : do { if ( ( ( LA ( <NUM_LIT:1> ) >= '<CHAR_LIT:0>' && LA ( <NUM_LIT:1> ) <= '<CHAR_LIT:9>' ) ) ) { matchRange ( '<CHAR_LIT:0>' , '<CHAR_LIT:9>' ) ; } else { if ( _cnt687 >= <NUM_LIT:1> ) { break _loop687 ; } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } _cnt687 ++ ; } while ( true ) ; } { switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT:.>' : { match ( '<CHAR_LIT:.>' ) ; { matchRange ( '<CHAR_LIT:0>' , '<CHAR_LIT:9>' ) ; } break ; } case '<CHAR_LIT>' : case '<CHAR_LIT:e>' : { mEXPONENT ( false ) ; break ; } case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : { mFLOAT_SUFFIX ( false ) ; break ; } default : { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } } } } catch ( RecognitionException pe ) { synPredMatched690 = false ; } rewind ( _m690 ) ; inputState . guessing -- ; } if ( synPredMatched690 ) { { int _cnt692 = <NUM_LIT:0> ; _loop692 : do { if ( ( ( LA ( <NUM_LIT:1> ) >= '<CHAR_LIT:0>' && LA ( <NUM_LIT:1> ) <= '<CHAR_LIT:9>' ) ) ) { matchRange ( '<CHAR_LIT:0>' , '<CHAR_LIT:9>' ) ; } else { if ( _cnt692 >= <NUM_LIT:1> ) { break _loop692 ; } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } _cnt692 ++ ; } while ( true ) ; } } else if ( ( ( LA ( <NUM_LIT:1> ) >= '<CHAR_LIT:0>' && LA ( <NUM_LIT:1> ) <= '<CHAR_LIT>' ) ) && ( true ) && ( true ) && ( true ) ) { { int _cnt694 = <NUM_LIT:0> ; _loop694 : do { if ( ( ( LA ( <NUM_LIT:1> ) >= '<CHAR_LIT:0>' && LA ( <NUM_LIT:1> ) <= '<CHAR_LIT>' ) ) ) { matchRange ( '<CHAR_LIT:0>' , '<CHAR_LIT>' ) ; } else { if ( _cnt694 >= <NUM_LIT:1> ) { break _loop694 ; } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } _cnt694 ++ ; } while ( true ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { isDecimal = false ; } } else { } } } break ; } case '<CHAR_LIT:1>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT:9>' : { { matchRange ( '<CHAR_LIT:1>' , '<CHAR_LIT:9>' ) ; } { _loop697 : do { if ( ( ( LA ( <NUM_LIT:1> ) >= '<CHAR_LIT:0>' && LA ( <NUM_LIT:1> ) <= '<CHAR_LIT:9>' ) ) ) { matchRange ( '<CHAR_LIT:0>' , '<CHAR_LIT:9>' ) ; } else { break _loop697 ; } } while ( true ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { isDecimal = true ; } break ; } default : { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } } { switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT>' : case '<CHAR_LIT>' : { { switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT>' : { match ( '<CHAR_LIT>' ) ; break ; } case '<CHAR_LIT>' : { match ( '<CHAR_LIT>' ) ; break ; } default : { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { _ttype = NUM_LONG ; } break ; } case '<CHAR_LIT>' : case '<CHAR_LIT>' : { { switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT>' : { match ( '<CHAR_LIT>' ) ; break ; } case '<CHAR_LIT>' : { match ( '<CHAR_LIT>' ) ; break ; } default : { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { _ttype = NUM_INT ; } break ; } case '<CHAR_LIT>' : case '<CHAR_LIT>' : { mBIG_SUFFIX ( false ) ; if ( inputState . guessing == <NUM_LIT:0> ) { _ttype = NUM_BIG_INT ; } break ; } default : boolean synPredMatched703 = false ; if ( ( ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:.>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT:e>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) ) && ( isDecimal ) ) ) { int _m703 = mark ( ) ; synPredMatched703 = true ; inputState . guessing ++ ; try { { if ( ( _tokenSet_11 . member ( LA ( <NUM_LIT:1> ) ) ) ) { matchNot ( '<CHAR_LIT:.>' ) ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:.>' ) ) { match ( '<CHAR_LIT:.>' ) ; { matchRange ( '<CHAR_LIT:0>' , '<CHAR_LIT:9>' ) ; } } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } } catch ( RecognitionException pe ) { synPredMatched703 = false ; } rewind ( _m703 ) ; inputState . guessing -- ; } if ( synPredMatched703 ) { { switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT:.>' : { match ( '<CHAR_LIT:.>' ) ; { int _cnt706 = <NUM_LIT:0> ; _loop706 : do { if ( ( ( LA ( <NUM_LIT:1> ) >= '<CHAR_LIT:0>' && LA ( <NUM_LIT:1> ) <= '<CHAR_LIT:9>' ) ) ) { matchRange ( '<CHAR_LIT:0>' , '<CHAR_LIT:9>' ) ; } else { if ( _cnt706 >= <NUM_LIT:1> ) { break _loop706 ; } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } _cnt706 ++ ; } while ( true ) ; } { if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT:e>' ) ) { mEXPONENT ( false ) ; } else { } } { switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : { mFLOAT_SUFFIX ( true ) ; f2 = _returnToken ; if ( inputState . guessing == <NUM_LIT:0> ) { t = f2 ; } break ; } case '<CHAR_LIT>' : case '<CHAR_LIT>' : { mBIG_SUFFIX ( true ) ; g2 = _returnToken ; if ( inputState . guessing == <NUM_LIT:0> ) { t = g2 ; } break ; } default : { } } } break ; } case '<CHAR_LIT>' : case '<CHAR_LIT:e>' : { mEXPONENT ( false ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : { mFLOAT_SUFFIX ( true ) ; f3 = _returnToken ; if ( inputState . guessing == <NUM_LIT:0> ) { t = f3 ; } break ; } case '<CHAR_LIT>' : case '<CHAR_LIT>' : { mBIG_SUFFIX ( true ) ; g3 = _returnToken ; if ( inputState . guessing == <NUM_LIT:0> ) { t = g3 ; } break ; } default : { } } } break ; } case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : { mFLOAT_SUFFIX ( true ) ; f4 = _returnToken ; if ( inputState . guessing == <NUM_LIT:0> ) { t = f4 ; } break ; } default : { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { String txt = ( t == null ? "<STR_LIT>" : t . getText ( ) . toUpperCase ( ) ) ; if ( txt . indexOf ( '<CHAR_LIT>' ) >= <NUM_LIT:0> ) { _ttype = NUM_FLOAT ; } else if ( txt . indexOf ( '<CHAR_LIT>' ) >= <NUM_LIT:0> ) { _ttype = NUM_BIG_DECIMAL ; } else { _ttype = NUM_DOUBLE ; } } } else { } } } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } protected final void mEXPONENT ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = EXPONENT ; int _saveIndex ; { switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT:e>' : { match ( '<CHAR_LIT:e>' ) ; break ; } case '<CHAR_LIT>' : { match ( '<CHAR_LIT>' ) ; break ; } default : { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } } { switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT>' : { match ( '<CHAR_LIT>' ) ; break ; } case '<CHAR_LIT:->' : { match ( '<CHAR_LIT:->' ) ; break ; } case '<CHAR_LIT:0>' : case '<CHAR_LIT:1>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT:9>' : { break ; } default : { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } } { int _cnt715 = <NUM_LIT:0> ; _loop715 : do { if ( ( ( LA ( <NUM_LIT:1> ) >= '<CHAR_LIT:0>' && LA ( <NUM_LIT:1> ) <= '<CHAR_LIT:9>' ) ) ) { matchRange ( '<CHAR_LIT:0>' , '<CHAR_LIT:9>' ) ; } else { if ( _cnt715 >= <NUM_LIT:1> ) { break _loop715 ; } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } _cnt715 ++ ; } while ( true ) ; } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } protected final void mFLOAT_SUFFIX ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = FLOAT_SUFFIX ; int _saveIndex ; switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT>' : { match ( '<CHAR_LIT>' ) ; break ; } case '<CHAR_LIT>' : { match ( '<CHAR_LIT>' ) ; break ; } case '<CHAR_LIT>' : { match ( '<CHAR_LIT>' ) ; break ; } case '<CHAR_LIT>' : { match ( '<CHAR_LIT>' ) ; break ; } default : { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } protected final void mBIG_SUFFIX ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = BIG_SUFFIX ; int _saveIndex ; switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT>' : { match ( '<CHAR_LIT>' ) ; break ; } case '<CHAR_LIT>' : { match ( '<CHAR_LIT>' ) ; break ; } default : { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mAT ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = AT ; int _saveIndex ; match ( '<CHAR_LIT>' ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } private static final long [ ] mk_tokenSet_0 ( ) { long [ ] data = new long [ <NUM_LIT> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = - <NUM_LIT> ; for ( int i = <NUM_LIT:4> ; i <= <NUM_LIT> ; i ++ ) { data [ i ] = - <NUM_LIT:1L> ; } data [ <NUM_LIT> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_0 = new BitSet ( mk_tokenSet_0 ( ) ) ; private static final long [ ] mk_tokenSet_1 ( ) { long [ ] data = new long [ <NUM_LIT> ] ; data [ <NUM_LIT:0> ] = - <NUM_LIT> ; for ( int i = <NUM_LIT:1> ; i <= <NUM_LIT> ; i ++ ) { data [ i ] = - <NUM_LIT:1L> ; } data [ <NUM_LIT> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_1 = new BitSet ( mk_tokenSet_1 ( ) ) ; private static final long [ ] mk_tokenSet_2 ( ) { long [ ] data = new long [ <NUM_LIT> ] ; data [ <NUM_LIT:0> ] = - <NUM_LIT> ; for ( int i = <NUM_LIT:1> ; i <= <NUM_LIT> ; i ++ ) { data [ i ] = - <NUM_LIT:1L> ; } data [ <NUM_LIT> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_2 = new BitSet ( mk_tokenSet_2 ( ) ) ; private static final long [ ] mk_tokenSet_3 ( ) { long [ ] data = new long [ <NUM_LIT> ] ; data [ <NUM_LIT:0> ] = - <NUM_LIT> ; for ( int i = <NUM_LIT:1> ; i <= <NUM_LIT> ; i ++ ) { data [ i ] = - <NUM_LIT:1L> ; } return data ; } public static final BitSet _tokenSet_3 = new BitSet ( mk_tokenSet_3 ( ) ) ; private static final long [ ] mk_tokenSet_4 ( ) { long [ ] data = new long [ <NUM_LIT> ] ; data [ <NUM_LIT:0> ] = - <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; for ( int i = <NUM_LIT:2> ; i <= <NUM_LIT> ; i ++ ) { data [ i ] = - <NUM_LIT:1L> ; } data [ <NUM_LIT> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_4 = new BitSet ( mk_tokenSet_4 ( ) ) ; private static final long [ ] mk_tokenSet_5 ( ) { long [ ] data = new long [ <NUM_LIT> ] ; data [ <NUM_LIT:0> ] = - <NUM_LIT> ; for ( int i = <NUM_LIT:1> ; i <= <NUM_LIT> ; i ++ ) { data [ i ] = - <NUM_LIT:1L> ; } return data ; } public static final BitSet _tokenSet_5 = new BitSet ( mk_tokenSet_5 ( ) ) ; private static final long [ ] mk_tokenSet_6 ( ) { long [ ] data = new long [ <NUM_LIT> ] ; data [ <NUM_LIT:0> ] = - <NUM_LIT> ; for ( int i = <NUM_LIT:1> ; i <= <NUM_LIT> ; i ++ ) { data [ i ] = - <NUM_LIT:1L> ; } data [ <NUM_LIT> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_6 = new BitSet ( mk_tokenSet_6 ( ) ) ; private static final long [ ] mk_tokenSet_7 ( ) { long [ ] data = new long [ <NUM_LIT> ] ; data [ <NUM_LIT:0> ] = - <NUM_LIT> ; for ( int i = <NUM_LIT:1> ; i <= <NUM_LIT> ; i ++ ) { data [ i ] = - <NUM_LIT:1L> ; } data [ <NUM_LIT> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_7 = new BitSet ( mk_tokenSet_7 ( ) ) ; private static final long [ ] mk_tokenSet_8 ( ) { long [ ] data = new long [ <NUM_LIT> ] ; data [ <NUM_LIT:0> ] = - <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; for ( int i = <NUM_LIT:2> ; i <= <NUM_LIT> ; i ++ ) { data [ i ] = - <NUM_LIT:1L> ; } data [ <NUM_LIT> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_8 = new BitSet ( mk_tokenSet_8 ( ) ) ; private static final long [ ] mk_tokenSet_9 ( ) { long [ ] data = new long [ <NUM_LIT> ] ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = - <NUM_LIT> ; for ( int i = <NUM_LIT:4> ; i <= <NUM_LIT> ; i ++ ) { data [ i ] = - <NUM_LIT:1L> ; } data [ <NUM_LIT> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_9 = new BitSet ( mk_tokenSet_9 ( ) ) ; private static final long [ ] mk_tokenSet_10 ( ) { long [ ] data = new long [ <NUM_LIT> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_10 = new BitSet ( mk_tokenSet_10 ( ) ) ; private static final long [ ] mk_tokenSet_11 ( ) { long [ ] data = new long [ <NUM_LIT> ] ; data [ <NUM_LIT:0> ] = - <NUM_LIT> ; for ( int i = <NUM_LIT:1> ; i <= <NUM_LIT> ; i ++ ) { data [ i ] = - <NUM_LIT:1L> ; } return data ; } public static final BitSet _tokenSet_11 = new BitSet ( mk_tokenSet_11 ( ) ) ; } </s>
|
<s> package org . codehaus . groovy . internal . antlr . parser ; import org . codehaus . groovy . antlr . * ; import java . util . * ; import java . io . InputStream ; import java . io . Reader ; import antlr . InputBuffer ; import antlr . LexerSharedInputState ; import antlr . CommonToken ; import org . codehaus . groovy . GroovyBugError ; import antlr . TokenStreamRecognitionException ; import org . codehaus . groovy . ast . Comment ; public interface GroovyTokenTypes { int EOF = <NUM_LIT:1> ; int NULL_TREE_LOOKAHEAD = <NUM_LIT:3> ; int BLOCK = <NUM_LIT:4> ; int MODIFIERS = <NUM_LIT:5> ; int OBJBLOCK = <NUM_LIT:6> ; int SLIST = <NUM_LIT:7> ; int METHOD_DEF = <NUM_LIT:8> ; int VARIABLE_DEF = <NUM_LIT:9> ; int INSTANCE_INIT = <NUM_LIT:10> ; int STATIC_INIT = <NUM_LIT:11> ; int TYPE = <NUM_LIT:12> ; int CLASS_DEF = <NUM_LIT> ; int INTERFACE_DEF = <NUM_LIT> ; int PACKAGE_DEF = <NUM_LIT:15> ; int ARRAY_DECLARATOR = <NUM_LIT:16> ; int EXTENDS_CLAUSE = <NUM_LIT> ; int IMPLEMENTS_CLAUSE = <NUM_LIT> ; int PARAMETERS = <NUM_LIT> ; int PARAMETER_DEF = <NUM_LIT:20> ; int LABELED_STAT = <NUM_LIT> ; int TYPECAST = <NUM_LIT> ; int INDEX_OP = <NUM_LIT> ; int POST_INC = <NUM_LIT:24> ; int POST_DEC = <NUM_LIT> ; int METHOD_CALL = <NUM_LIT> ; int EXPR = <NUM_LIT> ; int IMPORT = <NUM_LIT> ; int UNARY_MINUS = <NUM_LIT> ; int UNARY_PLUS = <NUM_LIT:30> ; int CASE_GROUP = <NUM_LIT:31> ; int ELIST = <NUM_LIT:32> ; int FOR_INIT = <NUM_LIT> ; int FOR_CONDITION = <NUM_LIT> ; int FOR_ITERATOR = <NUM_LIT> ; int EMPTY_STAT = <NUM_LIT> ; int FINAL = <NUM_LIT> ; int ABSTRACT = <NUM_LIT> ; int UNUSED_GOTO = <NUM_LIT> ; int UNUSED_CONST = <NUM_LIT> ; int UNUSED_DO = <NUM_LIT> ; int STRICTFP = <NUM_LIT> ; int SUPER_CTOR_CALL = <NUM_LIT> ; int CTOR_CALL = <NUM_LIT> ; int CTOR_IDENT = <NUM_LIT> ; int VARIABLE_PARAMETER_DEF = <NUM_LIT> ; int STRING_CONSTRUCTOR = <NUM_LIT> ; int STRING_CTOR_MIDDLE = <NUM_LIT> ; int CLOSABLE_BLOCK = <NUM_LIT> ; int IMPLICIT_PARAMETERS = <NUM_LIT> ; int SELECT_SLOT = <NUM_LIT> ; int DYNAMIC_MEMBER = <NUM_LIT> ; int LABELED_ARG = <NUM_LIT> ; int SPREAD_ARG = <NUM_LIT> ; int SPREAD_MAP_ARG = <NUM_LIT> ; int LIST_CONSTRUCTOR = <NUM_LIT> ; int MAP_CONSTRUCTOR = <NUM_LIT> ; int FOR_IN_ITERABLE = <NUM_LIT> ; int STATIC_IMPORT = <NUM_LIT> ; int ENUM_DEF = <NUM_LIT> ; int ENUM_CONSTANT_DEF = <NUM_LIT> ; int FOR_EACH_CLAUSE = <NUM_LIT> ; int ANNOTATION_DEF = <NUM_LIT> ; int ANNOTATIONS = <NUM_LIT> ; int ANNOTATION = <NUM_LIT> ; int ANNOTATION_MEMBER_VALUE_PAIR = <NUM_LIT> ; int ANNOTATION_FIELD_DEF = <NUM_LIT> ; int ANNOTATION_ARRAY_INIT = <NUM_LIT> ; int TYPE_ARGUMENTS = <NUM_LIT> ; int TYPE_ARGUMENT = <NUM_LIT> ; int TYPE_PARAMETERS = <NUM_LIT> ; int TYPE_PARAMETER = <NUM_LIT> ; int WILDCARD_TYPE = <NUM_LIT> ; int TYPE_UPPER_BOUNDS = <NUM_LIT> ; int TYPE_LOWER_BOUNDS = <NUM_LIT> ; int CLOSURE_LIST = <NUM_LIT> ; int SH_COMMENT = <NUM_LIT> ; int LITERAL_package = <NUM_LIT> ; int LITERAL_import = <NUM_LIT> ; int LITERAL_static = <NUM_LIT> ; int LITERAL_def = <NUM_LIT> ; int LBRACK = <NUM_LIT> ; int RBRACK = <NUM_LIT> ; int IDENT = <NUM_LIT> ; int STRING_LITERAL = <NUM_LIT> ; int LT = <NUM_LIT> ; int DOT = <NUM_LIT> ; int LPAREN = <NUM_LIT> ; int LITERAL_class = <NUM_LIT> ; int LITERAL_interface = <NUM_LIT> ; int LITERAL_enum = <NUM_LIT> ; int AT = <NUM_LIT> ; int QUESTION = <NUM_LIT> ; int LITERAL_extends = <NUM_LIT> ; int LITERAL_super = <NUM_LIT> ; int COMMA = <NUM_LIT> ; int GT = <NUM_LIT> ; int SR = <NUM_LIT> ; int BSR = <NUM_LIT> ; int LITERAL_void = <NUM_LIT:100> ; int LITERAL_boolean = <NUM_LIT> ; int LITERAL_byte = <NUM_LIT> ; int LITERAL_char = <NUM_LIT> ; int LITERAL_short = <NUM_LIT> ; int LITERAL_int = <NUM_LIT> ; int LITERAL_float = <NUM_LIT> ; int LITERAL_long = <NUM_LIT> ; int LITERAL_double = <NUM_LIT> ; int STAR = <NUM_LIT> ; int LITERAL_as = <NUM_LIT> ; int LITERAL_private = <NUM_LIT> ; int LITERAL_public = <NUM_LIT> ; int LITERAL_protected = <NUM_LIT> ; int LITERAL_transient = <NUM_LIT> ; int LITERAL_native = <NUM_LIT> ; int LITERAL_threadsafe = <NUM_LIT> ; int LITERAL_synchronized = <NUM_LIT> ; int LITERAL_volatile = <NUM_LIT> ; int RPAREN = <NUM_LIT> ; int ASSIGN = <NUM_LIT> ; int BAND = <NUM_LIT> ; int LCURLY = <NUM_LIT> ; int RCURLY = <NUM_LIT> ; int SEMI = <NUM_LIT> ; int NLS = <NUM_LIT> ; int LITERAL_default = <NUM_LIT> ; int LITERAL_throws = <NUM_LIT> ; int LITERAL_implements = <NUM_LIT> ; int LITERAL_this = <NUM_LIT> ; int TRIPLE_DOT = <NUM_LIT> ; int CLOSABLE_BLOCK_OP = <NUM_LIT> ; int COLON = <NUM_LIT> ; int LITERAL_if = <NUM_LIT> ; int LITERAL_else = <NUM_LIT> ; int LITERAL_while = <NUM_LIT> ; int LITERAL_switch = <NUM_LIT> ; int LITERAL_for = <NUM_LIT> ; int LITERAL_in = <NUM_LIT> ; int LITERAL_return = <NUM_LIT> ; int LITERAL_break = <NUM_LIT> ; int LITERAL_continue = <NUM_LIT> ; int LITERAL_throw = <NUM_LIT> ; int LITERAL_assert = <NUM_LIT> ; int PLUS = <NUM_LIT> ; int MINUS = <NUM_LIT> ; int LITERAL_case = <NUM_LIT> ; int LITERAL_try = <NUM_LIT> ; int LITERAL_finally = <NUM_LIT> ; int LITERAL_catch = <NUM_LIT> ; int SPREAD_DOT = <NUM_LIT> ; int OPTIONAL_DOT = <NUM_LIT> ; int MEMBER_POINTER = <NUM_LIT> ; int LITERAL_false = <NUM_LIT> ; int LITERAL_instanceof = <NUM_LIT> ; int LITERAL_new = <NUM_LIT> ; int LITERAL_null = <NUM_LIT> ; int LITERAL_true = <NUM_LIT> ; int PLUS_ASSIGN = <NUM_LIT> ; int MINUS_ASSIGN = <NUM_LIT> ; int STAR_ASSIGN = <NUM_LIT> ; int DIV_ASSIGN = <NUM_LIT> ; int MOD_ASSIGN = <NUM_LIT> ; int SR_ASSIGN = <NUM_LIT> ; int BSR_ASSIGN = <NUM_LIT> ; int SL_ASSIGN = <NUM_LIT> ; int BAND_ASSIGN = <NUM_LIT> ; int BXOR_ASSIGN = <NUM_LIT> ; int BOR_ASSIGN = <NUM_LIT> ; int STAR_STAR_ASSIGN = <NUM_LIT> ; int ELVIS_OPERATOR = <NUM_LIT> ; int LOR = <NUM_LIT> ; int LAND = <NUM_LIT> ; int BOR = <NUM_LIT> ; int BXOR = <NUM_LIT> ; int REGEX_FIND = <NUM_LIT> ; int REGEX_MATCH = <NUM_LIT> ; int NOT_EQUAL = <NUM_LIT> ; int EQUAL = <NUM_LIT> ; int COMPARE_TO = <NUM_LIT> ; int LE = <NUM_LIT> ; int GE = <NUM_LIT> ; int SL = <NUM_LIT> ; int RANGE_INCLUSIVE = <NUM_LIT> ; int RANGE_EXCLUSIVE = <NUM_LIT> ; int INC = <NUM_LIT> ; int DIV = <NUM_LIT> ; int MOD = <NUM_LIT> ; int DEC = <NUM_LIT> ; int STAR_STAR = <NUM_LIT> ; int BNOT = <NUM_LIT> ; int LNOT = <NUM_LIT> ; int STRING_CTOR_START = <NUM_LIT> ; int STRING_CTOR_END = <NUM_LIT> ; int NUM_INT = <NUM_LIT> ; int NUM_FLOAT = <NUM_LIT> ; int NUM_LONG = <NUM_LIT> ; int NUM_DOUBLE = <NUM_LIT> ; int NUM_BIG_INT = <NUM_LIT> ; int NUM_BIG_DECIMAL = <NUM_LIT> ; int DOLLAR = <NUM_LIT> ; int WS = <NUM_LIT> ; int ONE_NL = <NUM_LIT> ; int ONE_NL_KEEP = <NUM_LIT> ; int SL_COMMENT = <NUM_LIT> ; int ML_COMMENT = <NUM_LIT> ; int STRING_CH = <NUM_LIT> ; int REGEXP_LITERAL = <NUM_LIT> ; int REGEXP_CTOR_END = <NUM_LIT> ; int REGEXP_SYMBOL = <NUM_LIT> ; int ESC = <NUM_LIT> ; int STRING_NL = <NUM_LIT> ; int HEX_DIGIT = <NUM_LIT> ; int VOCAB = <NUM_LIT> ; int LETTER = <NUM_LIT> ; int DIGIT = <NUM_LIT> ; int EXPONENT = <NUM_LIT> ; int FLOAT_SUFFIX = <NUM_LIT> ; int BIG_SUFFIX = <NUM_LIT> ; } </s>
|
<s> package org . codehaus . groovy . internal . antlr . parser ; import org . codehaus . groovy . antlr . * ; import java . util . * ; import java . io . InputStream ; import java . io . Reader ; import antlr . InputBuffer ; import antlr . LexerSharedInputState ; import antlr . CommonToken ; import org . codehaus . groovy . GroovyBugError ; import antlr . TokenStreamRecognitionException ; import org . codehaus . groovy . ast . Comment ; import antlr . TokenBuffer ; import antlr . TokenStreamException ; import antlr . TokenStreamIOException ; import antlr . ANTLRException ; import antlr . LLkParser ; import antlr . Token ; import antlr . TokenStream ; import antlr . RecognitionException ; import antlr . NoViableAltException ; import antlr . MismatchedTokenException ; import antlr . SemanticException ; import antlr . ParserSharedInputState ; import antlr . collections . impl . BitSet ; import antlr . collections . AST ; import java . util . Hashtable ; import antlr . ASTFactory ; import antlr . ASTPair ; import antlr . collections . impl . ASTArray ; public class GroovyRecognizer extends antlr . LLkParser implements GroovyTokenTypes { public static GroovyRecognizer make ( GroovyLexer lexer ) { GroovyRecognizer parser = new GroovyRecognizer ( lexer . plumb ( ) ) ; parser . lexer = lexer ; lexer . parser = parser ; parser . getASTFactory ( ) . setASTNodeClass ( GroovySourceAST . class ) ; parser . warningList = new ArrayList ( ) ; parser . errorList = new ArrayList ( ) ; return parser ; } public static GroovyRecognizer make ( InputStream in ) { return make ( new GroovyLexer ( in ) ) ; } public static GroovyRecognizer make ( Reader in ) { return make ( new GroovyLexer ( in ) ) ; } public static GroovyRecognizer make ( InputBuffer in ) { return make ( new GroovyLexer ( in ) ) ; } public static GroovyRecognizer make ( LexerSharedInputState in ) { return make ( new GroovyLexer ( in ) ) ; } private static GroovySourceAST dummyVariableToforceClassLoaderToFindASTClass = new GroovySourceAST ( ) ; List warningList ; public List getWarningList ( ) { return warningList ; } List errorList ; public List getErrorList ( ) { return errorList ; } List < Comment > comments = new ArrayList < Comment > ( ) ; public List < Comment > getComments ( ) { return comments ; } GroovyLexer lexer ; public GroovyLexer getLexer ( ) { return lexer ; } public void setFilename ( String f ) { super . setFilename ( f ) ; lexer . setFilename ( f ) ; } private SourceBuffer sourceBuffer ; public void setSourceBuffer ( SourceBuffer sourceBuffer ) { this . sourceBuffer = sourceBuffer ; } public AST create ( int type , String txt , AST first ) { AST t = astFactory . create ( type , txt ) ; if ( t != null && first != null ) { t . initialize ( first ) ; t . initialize ( type , txt ) ; } return t ; } private AST attachLast ( AST t , Object last ) { if ( ( t instanceof GroovySourceAST ) && ( last instanceof SourceInfo ) ) { SourceInfo lastInfo = ( SourceInfo ) last ; GroovySourceAST node = ( GroovySourceAST ) t ; node . setColumnLast ( lastInfo . getColumn ( ) ) ; node . setLineLast ( lastInfo . getLine ( ) ) ; } return t ; } public AST create ( int type , String txt , Token first , Token last ) { return attachLast ( create ( type , txt , astFactory . create ( first ) ) , last ) ; } public AST create ( int type , String txt , AST first , Token last ) { return attachLast ( create ( type , txt , first ) , last ) ; } public AST create ( int type , String txt , AST first , AST last ) { return attachLast ( create ( type , txt , first ) , last ) ; } private Stack < Integer > commentStartPositions = new Stack < Integer > ( ) ; public void startComment ( int line , int column ) { commentStartPositions . push ( ( line << <NUM_LIT:16> ) + column ) ; } public void endComment ( int type , int line , int column , String text ) { int lineAndColumn = commentStartPositions . pop ( ) ; int startLine = lineAndColumn > > > <NUM_LIT:16> ; int startColumn = lineAndColumn & <NUM_LIT> ; if ( type == <NUM_LIT:0> ) { Comment comment = Comment . makeSingleLineComment ( startLine , startColumn , line , column , text ) ; comments . add ( comment ) ; } else if ( type == <NUM_LIT:1> ) { Comment comment = Comment . makeMultiLineComment ( startLine , startColumn , line , column , text ) ; comments . add ( comment ) ; } } public Token cloneToken ( Token t ) { CommonToken clone = new CommonToken ( t . getType ( ) , t . getText ( ) ) ; clone . setLine ( t . getLine ( ) ) ; clone . setColumn ( t . getColumn ( ) ) ; return clone ; } public static boolean tracing = false ; public void traceIn ( String rname ) throws TokenStreamException { if ( ! GroovyRecognizer . tracing ) return ; super . traceIn ( rname ) ; } public void traceOut ( String rname ) throws TokenStreamException { if ( ! GroovyRecognizer . tracing ) return ; if ( returnAST != null ) rname += returnAST . toStringList ( ) ; super . traceOut ( rname ) ; } public void requireFailed ( String problem , String solution ) throws SemanticException { Token lt = null ; int lineNum = Token . badToken . getLine ( ) , colNum = Token . badToken . getColumn ( ) ; try { lt = LT ( <NUM_LIT:1> ) ; if ( lt != null ) { lineNum = lt . getLine ( ) ; colNum = lt . getColumn ( ) ; } } catch ( TokenStreamException ee ) { if ( ee instanceof TokenStreamRecognitionException ) { lineNum = ( ( TokenStreamRecognitionException ) ee ) . recog . getLine ( ) ; colNum = ( ( TokenStreamRecognitionException ) ee ) . recog . getColumn ( ) ; } } throw new SemanticException ( problem + "<STR_LIT>" + solution , getFilename ( ) , lineNum , colNum ) ; } public void addWarning ( String warning , String solution ) { Token lt = null ; try { lt = LT ( <NUM_LIT:1> ) ; } catch ( TokenStreamException ee ) { } if ( lt == null ) lt = Token . badToken ; Map row = new HashMap ( ) ; row . put ( "<STR_LIT>" , warning ) ; row . put ( "<STR_LIT>" , solution ) ; row . put ( "<STR_LIT>" , getFilename ( ) ) ; row . put ( "<STR_LIT>" , Integer . valueOf ( lt . getLine ( ) ) ) ; row . put ( "<STR_LIT>" , Integer . valueOf ( lt . getColumn ( ) ) ) ; warningList . add ( row ) ; } public void reportError ( String message ) { Token lt = null ; try { lt = LT ( <NUM_LIT:1> ) ; } catch ( TokenStreamException ee ) { } if ( lt == null ) lt = Token . badToken ; Map row = new HashMap ( ) ; row . put ( "<STR_LIT:error>" , message ) ; row . put ( "<STR_LIT>" , getFilename ( ) ) ; row . put ( "<STR_LIT>" , new Integer ( lt . getLine ( ) ) ) ; row . put ( "<STR_LIT>" , new Integer ( lt . getColumn ( ) ) ) ; errorList . add ( row ) ; } public void reportError ( String message , Token lt ) { Map row = new HashMap ( ) ; row . put ( "<STR_LIT:error>" , message ) ; row . put ( "<STR_LIT>" , getFilename ( ) ) ; row . put ( "<STR_LIT>" , new Integer ( lt . getLine ( ) ) ) ; row . put ( "<STR_LIT>" , new Integer ( lt . getColumn ( ) ) ) ; errorList . add ( row ) ; } public void reportError ( String message , AST lt ) { Map row = new HashMap ( ) ; row . put ( "<STR_LIT:error>" , message ) ; row . put ( "<STR_LIT>" , getFilename ( ) ) ; row . put ( "<STR_LIT>" , new Integer ( lt . getLine ( ) ) ) ; row . put ( "<STR_LIT>" , new Integer ( lt . getColumn ( ) ) ) ; errorList . add ( row ) ; } public void reportError ( RecognitionException e ) { Token lt = null ; try { lt = LT ( <NUM_LIT:1> ) ; } catch ( TokenStreamException ee ) { } if ( lt == null ) lt = Token . badToken ; Map row = new HashMap ( ) ; row . put ( "<STR_LIT:error>" , e . getMessage ( ) ) ; row . put ( "<STR_LIT>" , getFilename ( ) ) ; row . put ( "<STR_LIT>" , new Integer ( lt . getLine ( ) ) ) ; row . put ( "<STR_LIT>" , new Integer ( lt . getColumn ( ) ) ) ; errorList . add ( row ) ; } private void require ( boolean z , String problem , String solution ) throws SemanticException { if ( ! z ) requireFailed ( problem , solution ) ; } private boolean matchGenericTypeBrackets ( boolean z , String problem , String solution ) throws SemanticException { if ( ! z ) matchGenericTypeBracketsFailed ( problem , solution ) ; return z ; } public void matchGenericTypeBracketsFailed ( String problem , String solution ) throws SemanticException { Token lt = null ; int lineNum = Token . badToken . getLine ( ) , colNum = Token . badToken . getColumn ( ) ; try { lt = LT ( <NUM_LIT:1> ) ; if ( lt != null ) { lineNum = lt . getLine ( ) ; colNum = lt . getColumn ( ) ; } } catch ( TokenStreamException ee ) { if ( ee instanceof TokenStreamRecognitionException ) { lineNum = ( ( TokenStreamRecognitionException ) ee ) . recog . getLine ( ) ; colNum = ( ( TokenStreamRecognitionException ) ee ) . recog . getColumn ( ) ; } } throw new SemanticException ( problem + "<STR_LIT>" + solution , getFilename ( ) , lineNum , colNum ) ; } private boolean isUpperCase ( Token x ) { if ( x == null || x . getType ( ) != IDENT ) return false ; String xtext = x . getText ( ) ; return ( xtext . length ( ) > <NUM_LIT:0> && Character . isUpperCase ( xtext . charAt ( <NUM_LIT:0> ) ) ) ; } private AST currentClass = null ; private boolean isConstructorIdent ( Token x ) { if ( currentClass == null ) return false ; if ( currentClass . getType ( ) != IDENT ) return false ; String cname = currentClass . getText ( ) ; if ( x == null || x . getType ( ) != IDENT ) return false ; return cname . equals ( x . getText ( ) ) ; } private int sepToken = EOF ; private boolean argListHasLabels = false ; private AST lastPathExpression = null ; private final int LC_STMT = <NUM_LIT:1> , LC_INIT = <NUM_LIT:2> ; private int ltCounter = <NUM_LIT:0> ; private static final boolean ANTLR_LOOP_EXIT = false ; protected GroovyRecognizer ( TokenBuffer tokenBuf , int k ) { super ( tokenBuf , k ) ; tokenNames = _tokenNames ; buildTokenTypeASTClassMap ( ) ; astFactory = new ASTFactory ( getTokenTypeToASTClassMap ( ) ) ; } public GroovyRecognizer ( TokenBuffer tokenBuf ) { this ( tokenBuf , <NUM_LIT:2> ) ; } protected GroovyRecognizer ( TokenStream lexer , int k ) { super ( lexer , k ) ; tokenNames = _tokenNames ; buildTokenTypeASTClassMap ( ) ; astFactory = new ASTFactory ( getTokenTypeToASTClassMap ( ) ) ; } public GroovyRecognizer ( TokenStream lexer ) { this ( lexer , <NUM_LIT:2> ) ; } public GroovyRecognizer ( ParserSharedInputState state ) { super ( state , <NUM_LIT:2> ) ; tokenNames = _tokenNames ; buildTokenTypeASTClassMap ( ) ; astFactory = new ASTFactory ( getTokenTypeToASTClassMap ( ) ) ; } public final void compilationUnit ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST compilationUnit_AST = null ; { switch ( LA ( <NUM_LIT:1> ) ) { case SH_COMMENT : { match ( SH_COMMENT ) ; break ; } case EOF : case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_package : case LITERAL_import : case LITERAL_static : case LITERAL_def : case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : case SEMI : case NLS : case LITERAL_this : case LITERAL_if : case LITERAL_while : case LITERAL_switch : case LITERAL_for : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case PLUS : case MINUS : case LITERAL_try : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } nls ( ) ; { boolean synPredMatched5 = false ; if ( ( ( LA ( <NUM_LIT:1> ) == LITERAL_package || LA ( <NUM_LIT:1> ) == AT ) && ( _tokenSet_0 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m5 = mark ( ) ; synPredMatched5 = true ; inputState . guessing ++ ; try { { annotationsOpt ( ) ; match ( LITERAL_package ) ; } } catch ( RecognitionException pe ) { synPredMatched5 = false ; } rewind ( _m5 ) ; inputState . guessing -- ; } if ( synPredMatched5 ) { packageDefinition ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else if ( ( _tokenSet_1 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_2 . member ( LA ( <NUM_LIT:2> ) ) ) ) { { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_import : case LITERAL_static : case LITERAL_def : case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : case LITERAL_this : case LITERAL_if : case LITERAL_while : case LITERAL_switch : case LITERAL_for : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case PLUS : case MINUS : case LITERAL_try : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { statement ( EOF ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case EOF : case SEMI : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } { _loop9 : do { if ( ( LA ( <NUM_LIT:1> ) == SEMI || LA ( <NUM_LIT:1> ) == NLS ) ) { sep ( ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_import : case LITERAL_static : case LITERAL_def : case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : case LITERAL_this : case LITERAL_if : case LITERAL_while : case LITERAL_switch : case LITERAL_for : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case PLUS : case MINUS : case LITERAL_try : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { statement ( sepToken ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case EOF : case SEMI : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } } else { break _loop9 ; } } while ( true ) ; } match ( Token . EOF_TYPE ) ; compilationUnit_AST = ( AST ) currentAST . root ; returnAST = compilationUnit_AST ; } public final void nls ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST nls_AST = null ; { if ( ( LA ( <NUM_LIT:1> ) == NLS ) && ( _tokenSet_3 . member ( LA ( <NUM_LIT:2> ) ) ) ) { match ( NLS ) ; } else if ( ( _tokenSet_3 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_4 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = nls_AST ; } public final void annotationsOpt ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST annotationsOpt_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; { _loop89 : do { if ( ( LA ( <NUM_LIT:1> ) == AT ) ) { annotation ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; nls ( ) ; } else { break _loop89 ; } } while ( true ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { annotationsOpt_AST = ( AST ) currentAST . root ; annotationsOpt_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( ANNOTATIONS , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( annotationsOpt_AST ) ) ; currentAST . root = annotationsOpt_AST ; currentAST . child = annotationsOpt_AST != null && annotationsOpt_AST . getFirstChild ( ) != null ? annotationsOpt_AST . getFirstChild ( ) : annotationsOpt_AST ; currentAST . advanceChildToEnd ( ) ; } annotationsOpt_AST = ( AST ) currentAST . root ; returnAST = annotationsOpt_AST ; } public final void packageDefinition ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST packageDefinition_AST = null ; AST an_AST = null ; AST id_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; annotationsOpt ( ) ; an_AST = ( AST ) returnAST ; match ( LITERAL_package ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case IDENT : { identifier ( ) ; id_AST = ( AST ) returnAST ; break ; } case EOF : case SEMI : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { packageDefinition_AST = ( AST ) currentAST . root ; if ( id_AST == null ) { reportError ( "<STR_LIT>" , LT ( <NUM_LIT:0> ) ) ; } else { packageDefinition_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( PACKAGE_DEF , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( an_AST ) . add ( id_AST ) ) ; } currentAST . root = packageDefinition_AST ; currentAST . child = packageDefinition_AST != null && packageDefinition_AST . getFirstChild ( ) != null ? packageDefinition_AST . getFirstChild ( ) : packageDefinition_AST ; currentAST . advanceChildToEnd ( ) ; } packageDefinition_AST = ( AST ) currentAST . root ; returnAST = packageDefinition_AST ; } public final void statement ( int prevToken ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST statement_AST = null ; AST pfx_AST = null ; AST es_AST = null ; AST m_AST = null ; AST ale_AST = null ; AST ifCbs_AST = null ; AST elseCbs_AST = null ; AST while_sce_AST = null ; Token s = null ; AST s_AST = null ; AST while_cbs_AST = null ; AST switchSce_AST = null ; AST cg_AST = null ; AST synch_sce_AST = null ; AST synch_cs_AST = null ; boolean sce = false ; Token first = LT ( <NUM_LIT:1> ) ; AST casesGroup_AST = null ; switch ( LA ( <NUM_LIT:1> ) ) { case LITERAL_if : { match ( LITERAL_if ) ; match ( LPAREN ) ; assignmentLessExpression ( ) ; ale_AST = ( AST ) returnAST ; match ( RPAREN ) ; nlsWarn ( ) ; compatibleBodyStatement ( ) ; ifCbs_AST = ( AST ) returnAST ; { boolean synPredMatched281 = false ; if ( ( ( _tokenSet_5 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_6 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m281 = mark ( ) ; synPredMatched281 = true ; inputState . guessing ++ ; try { { { switch ( LA ( <NUM_LIT:1> ) ) { case SEMI : case NLS : { sep ( ) ; break ; } case LITERAL_else : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } match ( LITERAL_else ) ; } } catch ( RecognitionException pe ) { synPredMatched281 = false ; } rewind ( _m281 ) ; inputState . guessing -- ; } if ( synPredMatched281 ) { { switch ( LA ( <NUM_LIT:1> ) ) { case SEMI : case NLS : { sep ( ) ; break ; } case LITERAL_else : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } match ( LITERAL_else ) ; nlsWarn ( ) ; compatibleBodyStatement ( ) ; elseCbs_AST = ( AST ) returnAST ; } else if ( ( _tokenSet_7 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_8 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } if ( inputState . guessing == <NUM_LIT:0> ) { statement_AST = ( AST ) currentAST . root ; statement_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:4> ) ) . add ( create ( LITERAL_if , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( ale_AST ) . add ( ifCbs_AST ) . add ( elseCbs_AST ) ) ; currentAST . root = statement_AST ; currentAST . child = statement_AST != null && statement_AST . getFirstChild ( ) != null ? statement_AST . getFirstChild ( ) : statement_AST ; currentAST . advanceChildToEnd ( ) ; } statement_AST = ( AST ) currentAST . root ; break ; } case LITERAL_for : { forStatement ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; statement_AST = ( AST ) currentAST . root ; break ; } case LITERAL_while : { match ( LITERAL_while ) ; match ( LPAREN ) ; sce = strictContextExpression ( false ) ; while_sce_AST = ( AST ) returnAST ; match ( RPAREN ) ; nlsWarn ( ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case SEMI : { s = LT ( <NUM_LIT:1> ) ; s_AST = astFactory . create ( s ) ; match ( SEMI ) ; break ; } case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_import : case LITERAL_static : case LITERAL_def : case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : case LITERAL_this : case LITERAL_if : case LITERAL_while : case LITERAL_switch : case LITERAL_for : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case PLUS : case MINUS : case LITERAL_try : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { compatibleBodyStatement ( ) ; while_cbs_AST = ( AST ) returnAST ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { statement_AST = ( AST ) currentAST . root ; if ( s_AST != null ) statement_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( LITERAL_while , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( while_sce_AST ) . add ( s_AST ) ) ; else statement_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( LITERAL_while , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( while_sce_AST ) . add ( while_cbs_AST ) ) ; currentAST . root = statement_AST ; currentAST . child = statement_AST != null && statement_AST . getFirstChild ( ) != null ? statement_AST . getFirstChild ( ) : statement_AST ; currentAST . advanceChildToEnd ( ) ; } statement_AST = ( AST ) currentAST . root ; break ; } case LITERAL_import : { importStatement ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; statement_AST = ( AST ) currentAST . root ; break ; } case LITERAL_switch : { match ( LITERAL_switch ) ; match ( LPAREN ) ; sce = strictContextExpression ( false ) ; switchSce_AST = ( AST ) returnAST ; match ( RPAREN ) ; nlsWarn ( ) ; match ( LCURLY ) ; nls ( ) ; { _loop285 : do { if ( ( LA ( <NUM_LIT:1> ) == LITERAL_default || LA ( <NUM_LIT:1> ) == LITERAL_case ) ) { casesGroup ( ) ; cg_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { casesGroup_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( null ) . add ( casesGroup_AST ) . add ( cg_AST ) ) ; } } else { break _loop285 ; } } while ( true ) ; } match ( RCURLY ) ; if ( inputState . guessing == <NUM_LIT:0> ) { statement_AST = ( AST ) currentAST . root ; statement_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( LITERAL_switch , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( switchSce_AST ) . add ( casesGroup_AST ) ) ; currentAST . root = statement_AST ; currentAST . child = statement_AST != null && statement_AST . getFirstChild ( ) != null ? statement_AST . getFirstChild ( ) : statement_AST ; currentAST . advanceChildToEnd ( ) ; } statement_AST = ( AST ) currentAST . root ; break ; } case LITERAL_try : { tryBlock ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; statement_AST = ( AST ) currentAST . root ; break ; } case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : { branchStatement ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; statement_AST = ( AST ) currentAST . root ; break ; } default : boolean synPredMatched268 = false ; if ( ( ( _tokenSet_9 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_10 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m268 = mark ( ) ; synPredMatched268 = true ; inputState . guessing ++ ; try { { genericMethodStart ( ) ; } } catch ( RecognitionException pe ) { synPredMatched268 = false ; } rewind ( _m268 ) ; inputState . guessing -- ; } if ( synPredMatched268 ) { genericMethod ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; statement_AST = ( AST ) currentAST . root ; } else { boolean synPredMatched270 = false ; if ( ( ( _tokenSet_9 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_11 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m270 = mark ( ) ; synPredMatched270 = true ; inputState . guessing ++ ; try { { multipleAssignmentDeclarationStart ( ) ; } } catch ( RecognitionException pe ) { synPredMatched270 = false ; } rewind ( _m270 ) ; inputState . guessing -- ; } if ( synPredMatched270 ) { multipleAssignmentDeclaration ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; statement_AST = ( AST ) currentAST . root ; } else { boolean synPredMatched272 = false ; if ( ( ( _tokenSet_12 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_13 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m272 = mark ( ) ; synPredMatched272 = true ; inputState . guessing ++ ; try { { declarationStart ( ) ; } } catch ( RecognitionException pe ) { synPredMatched272 = false ; } rewind ( _m272 ) ; inputState . guessing -- ; } if ( synPredMatched272 ) { declaration ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; statement_AST = ( AST ) currentAST . root ; } else { boolean synPredMatched274 = false ; if ( ( ( LA ( <NUM_LIT:1> ) == IDENT ) && ( LA ( <NUM_LIT:2> ) == COLON ) ) ) { int _m274 = mark ( ) ; synPredMatched274 = true ; inputState . guessing ++ ; try { { match ( IDENT ) ; match ( COLON ) ; } } catch ( RecognitionException pe ) { synPredMatched274 = false ; } rewind ( _m274 ) ; inputState . guessing -- ; } if ( synPredMatched274 ) { statementLabelPrefix ( ) ; pfx_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { statement_AST = ( AST ) currentAST . root ; statement_AST = pfx_AST ; currentAST . root = statement_AST ; currentAST . child = statement_AST != null && statement_AST . getFirstChild ( ) != null ? statement_AST . getFirstChild ( ) : statement_AST ; currentAST . advanceChildToEnd ( ) ; } { boolean synPredMatched277 = false ; if ( ( ( LA ( <NUM_LIT:1> ) == LCURLY ) && ( _tokenSet_14 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m277 = mark ( ) ; synPredMatched277 = true ; inputState . guessing ++ ; try { { match ( LCURLY ) ; } } catch ( RecognitionException pe ) { synPredMatched277 = false ; } rewind ( _m277 ) ; inputState . guessing -- ; } if ( synPredMatched277 ) { openOrClosableBlock ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else if ( ( _tokenSet_15 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_2 . member ( LA ( <NUM_LIT:2> ) ) ) ) { statement ( COLON ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } statement_AST = ( AST ) currentAST . root ; } else if ( ( _tokenSet_16 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_2 . member ( LA ( <NUM_LIT:2> ) ) ) ) { expressionStatement ( prevToken ) ; es_AST = ( AST ) returnAST ; astFactory . addASTChild ( currentAST , returnAST ) ; statement_AST = ( AST ) currentAST . root ; } else if ( ( _tokenSet_17 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_18 . member ( LA ( <NUM_LIT:2> ) ) ) ) { modifiersOpt ( ) ; m_AST = ( AST ) returnAST ; typeDefinitionInternal ( m_AST ) ; astFactory . addASTChild ( currentAST , returnAST ) ; statement_AST = ( AST ) currentAST . root ; } else if ( ( LA ( <NUM_LIT:1> ) == LITERAL_synchronized ) && ( LA ( <NUM_LIT:2> ) == LPAREN ) ) { match ( LITERAL_synchronized ) ; match ( LPAREN ) ; sce = strictContextExpression ( false ) ; synch_sce_AST = ( AST ) returnAST ; match ( RPAREN ) ; nlsWarn ( ) ; compoundStatement ( ) ; synch_cs_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { statement_AST = ( AST ) currentAST . root ; statement_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( LITERAL_synchronized , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( synch_sce_AST ) . add ( synch_cs_AST ) ) ; currentAST . root = statement_AST ; currentAST . child = statement_AST != null && statement_AST . getFirstChild ( ) != null ? statement_AST . getFirstChild ( ) : statement_AST ; currentAST . advanceChildToEnd ( ) ; } statement_AST = ( AST ) currentAST . root ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } } } returnAST = statement_AST ; } public final void sep ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST sep_AST = null ; switch ( LA ( <NUM_LIT:1> ) ) { case SEMI : { match ( SEMI ) ; { _loop530 : do { if ( ( LA ( <NUM_LIT:1> ) == NLS ) && ( _tokenSet_19 . member ( LA ( <NUM_LIT:2> ) ) ) ) { match ( NLS ) ; } else { break _loop530 ; } } while ( true ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { sepToken = SEMI ; } break ; } case NLS : { match ( NLS ) ; if ( inputState . guessing == <NUM_LIT:0> ) { sepToken = NLS ; } { _loop534 : do { if ( ( LA ( <NUM_LIT:1> ) == SEMI ) && ( _tokenSet_19 . member ( LA ( <NUM_LIT:2> ) ) ) ) { match ( SEMI ) ; { _loop533 : do { if ( ( LA ( <NUM_LIT:1> ) == NLS ) && ( _tokenSet_19 . member ( LA ( <NUM_LIT:2> ) ) ) ) { match ( NLS ) ; } else { break _loop533 ; } } while ( true ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { sepToken = SEMI ; } } else { break _loop534 ; } } while ( true ) ; } break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = sep_AST ; } public final void snippetUnit ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST snippetUnit_AST = null ; nls ( ) ; blockBody ( EOF ) ; astFactory . addASTChild ( currentAST , returnAST ) ; snippetUnit_AST = ( AST ) currentAST . root ; returnAST = snippetUnit_AST ; } public final void blockBody ( int prevToken ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST blockBody_AST = null ; { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_import : case LITERAL_static : case LITERAL_def : case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : case LITERAL_this : case LITERAL_if : case LITERAL_while : case LITERAL_switch : case LITERAL_for : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case PLUS : case MINUS : case LITERAL_try : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { statement ( prevToken ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case EOF : case RCURLY : case SEMI : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } { _loop262 : do { if ( ( LA ( <NUM_LIT:1> ) == SEMI || LA ( <NUM_LIT:1> ) == NLS ) ) { sep ( ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_import : case LITERAL_static : case LITERAL_def : case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : case LITERAL_this : case LITERAL_if : case LITERAL_while : case LITERAL_switch : case LITERAL_for : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case PLUS : case MINUS : case LITERAL_try : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { statement ( sepToken ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case EOF : case RCURLY : case SEMI : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } } else { break _loop262 ; } } while ( true ) ; } blockBody_AST = ( AST ) currentAST . root ; returnAST = blockBody_AST ; } public final void identifier ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST identifier_AST = null ; Token i1 = null ; AST i1_AST = null ; Token d = null ; AST d_AST = null ; Token i2 = null ; AST i2_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; i1 = LT ( <NUM_LIT:1> ) ; i1_AST = astFactory . create ( i1 ) ; match ( IDENT ) ; { _loop72 : do { if ( ( LA ( <NUM_LIT:1> ) == DOT ) ) { d = LT ( <NUM_LIT:1> ) ; d_AST = astFactory . create ( d ) ; match ( DOT ) ; nls ( ) ; i2 = LT ( <NUM_LIT:1> ) ; i2_AST = astFactory . create ( i2 ) ; match ( IDENT ) ; if ( inputState . guessing == <NUM_LIT:0> ) { i1_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( DOT , "<STR_LIT:.>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( i1_AST ) . add ( i2_AST ) ) ; } } else { break _loop72 ; } } while ( true ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { identifier_AST = ( AST ) currentAST . root ; identifier_AST = i1_AST ; currentAST . root = identifier_AST ; currentAST . child = identifier_AST != null && identifier_AST . getFirstChild ( ) != null ? identifier_AST . getFirstChild ( ) : identifier_AST ; currentAST . advanceChildToEnd ( ) ; } identifier_AST = ( AST ) currentAST . root ; returnAST = identifier_AST ; } public final void importStatement ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST importStatement_AST = null ; AST is_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; boolean isStatic = false ; match ( LITERAL_import ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case LITERAL_static : { match ( LITERAL_static ) ; if ( inputState . guessing == <NUM_LIT:0> ) { isStatic = true ; } break ; } case IDENT : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } identifierStar ( ) ; is_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { importStatement_AST = ( AST ) currentAST . root ; if ( isStatic ) importStatement_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( STATIC_IMPORT , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( is_AST ) ) ; else importStatement_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( IMPORT , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( is_AST ) ) ; currentAST . root = importStatement_AST ; currentAST . child = importStatement_AST != null && importStatement_AST . getFirstChild ( ) != null ? importStatement_AST . getFirstChild ( ) : importStatement_AST ; currentAST . advanceChildToEnd ( ) ; } importStatement_AST = ( AST ) currentAST . root ; returnAST = importStatement_AST ; } public final void identifierStar ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST identifierStar_AST = null ; Token i1 = null ; AST i1_AST = null ; Token d1 = null ; AST d1_AST = null ; Token i2 = null ; AST i2_AST = null ; Token d2 = null ; AST d2_AST = null ; Token s = null ; AST s_AST = null ; Token alias = null ; AST alias_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; i1 = LT ( <NUM_LIT:1> ) ; i1_AST = astFactory . create ( i1 ) ; match ( IDENT ) ; { _loop75 : do { if ( ( LA ( <NUM_LIT:1> ) == DOT ) && ( LA ( <NUM_LIT:2> ) == IDENT || LA ( <NUM_LIT:2> ) == NLS ) ) { d1 = LT ( <NUM_LIT:1> ) ; d1_AST = astFactory . create ( d1 ) ; match ( DOT ) ; nls ( ) ; i2 = LT ( <NUM_LIT:1> ) ; i2_AST = astFactory . create ( i2 ) ; match ( IDENT ) ; if ( inputState . guessing == <NUM_LIT:0> ) { i1_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( DOT , "<STR_LIT:.>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( i1_AST ) . add ( i2_AST ) ) ; } } else { break _loop75 ; } } while ( true ) ; } { switch ( LA ( <NUM_LIT:1> ) ) { case DOT : { d2 = LT ( <NUM_LIT:1> ) ; d2_AST = astFactory . create ( d2 ) ; match ( DOT ) ; nls ( ) ; s = LT ( <NUM_LIT:1> ) ; s_AST = astFactory . create ( s ) ; match ( STAR ) ; if ( inputState . guessing == <NUM_LIT:0> ) { i1_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( DOT , "<STR_LIT:.>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( i1_AST ) . add ( s_AST ) ) ; } break ; } case LITERAL_as : { match ( LITERAL_as ) ; nls ( ) ; alias = LT ( <NUM_LIT:1> ) ; alias_AST = astFactory . create ( alias ) ; match ( IDENT ) ; if ( inputState . guessing == <NUM_LIT:0> ) { i1_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( LITERAL_as , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( i1_AST ) . add ( alias_AST ) ) ; } break ; } case EOF : case RCURLY : case SEMI : case NLS : case LITERAL_default : case LITERAL_else : case LITERAL_case : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { identifierStar_AST = ( AST ) currentAST . root ; identifierStar_AST = i1_AST ; currentAST . root = identifierStar_AST ; currentAST . child = identifierStar_AST != null && identifierStar_AST . getFirstChild ( ) != null ? identifierStar_AST . getFirstChild ( ) : identifierStar_AST ; currentAST . advanceChildToEnd ( ) ; } identifierStar_AST = ( AST ) currentAST . root ; returnAST = identifierStar_AST ; } protected final void typeDefinitionInternal ( AST mods ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST typeDefinitionInternal_AST = null ; AST cd_AST = null ; AST id_AST = null ; AST ed_AST = null ; AST ad_AST = null ; switch ( LA ( <NUM_LIT:1> ) ) { case LITERAL_class : { classDefinition ( mods ) ; cd_AST = ( AST ) returnAST ; astFactory . addASTChild ( currentAST , returnAST ) ; if ( inputState . guessing == <NUM_LIT:0> ) { typeDefinitionInternal_AST = ( AST ) currentAST . root ; typeDefinitionInternal_AST = cd_AST ; currentAST . root = typeDefinitionInternal_AST ; currentAST . child = typeDefinitionInternal_AST != null && typeDefinitionInternal_AST . getFirstChild ( ) != null ? typeDefinitionInternal_AST . getFirstChild ( ) : typeDefinitionInternal_AST ; currentAST . advanceChildToEnd ( ) ; } typeDefinitionInternal_AST = ( AST ) currentAST . root ; break ; } case LITERAL_interface : { interfaceDefinition ( mods ) ; id_AST = ( AST ) returnAST ; astFactory . addASTChild ( currentAST , returnAST ) ; if ( inputState . guessing == <NUM_LIT:0> ) { typeDefinitionInternal_AST = ( AST ) currentAST . root ; typeDefinitionInternal_AST = id_AST ; currentAST . root = typeDefinitionInternal_AST ; currentAST . child = typeDefinitionInternal_AST != null && typeDefinitionInternal_AST . getFirstChild ( ) != null ? typeDefinitionInternal_AST . getFirstChild ( ) : typeDefinitionInternal_AST ; currentAST . advanceChildToEnd ( ) ; } typeDefinitionInternal_AST = ( AST ) currentAST . root ; break ; } case LITERAL_enum : { enumDefinition ( mods ) ; ed_AST = ( AST ) returnAST ; astFactory . addASTChild ( currentAST , returnAST ) ; if ( inputState . guessing == <NUM_LIT:0> ) { typeDefinitionInternal_AST = ( AST ) currentAST . root ; typeDefinitionInternal_AST = ed_AST ; currentAST . root = typeDefinitionInternal_AST ; currentAST . child = typeDefinitionInternal_AST != null && typeDefinitionInternal_AST . getFirstChild ( ) != null ? typeDefinitionInternal_AST . getFirstChild ( ) : typeDefinitionInternal_AST ; currentAST . advanceChildToEnd ( ) ; } typeDefinitionInternal_AST = ( AST ) currentAST . root ; break ; } case AT : { annotationDefinition ( mods ) ; ad_AST = ( AST ) returnAST ; astFactory . addASTChild ( currentAST , returnAST ) ; if ( inputState . guessing == <NUM_LIT:0> ) { typeDefinitionInternal_AST = ( AST ) currentAST . root ; typeDefinitionInternal_AST = ad_AST ; currentAST . root = typeDefinitionInternal_AST ; currentAST . child = typeDefinitionInternal_AST != null && typeDefinitionInternal_AST . getFirstChild ( ) != null ? typeDefinitionInternal_AST . getFirstChild ( ) : typeDefinitionInternal_AST ; currentAST . advanceChildToEnd ( ) ; } typeDefinitionInternal_AST = ( AST ) currentAST . root ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = typeDefinitionInternal_AST ; } public final void classDefinition ( AST modifiers ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST classDefinition_AST = null ; AST tp_AST = null ; AST sc_AST = null ; AST ic_AST = null ; AST cb_AST = null ; Token first = cloneToken ( LT ( <NUM_LIT:1> ) ) ; AST prevCurrentClass = currentClass ; if ( modifiers != null ) { first . setLine ( modifiers . getLine ( ) ) ; first . setColumn ( modifiers . getColumn ( ) ) ; } match ( LITERAL_class ) ; AST tmp29_AST = null ; tmp29_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( IDENT ) ; nls ( ) ; if ( inputState . guessing == <NUM_LIT:0> ) { currentClass = tmp29_AST ; } { switch ( LA ( <NUM_LIT:1> ) ) { case LT : { typeParameters ( ) ; tp_AST = ( AST ) returnAST ; nls ( ) ; break ; } case LITERAL_extends : case LCURLY : case LITERAL_implements : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } superClassClause ( ) ; sc_AST = ( AST ) returnAST ; implementsClause ( ) ; ic_AST = ( AST ) returnAST ; classBlock ( ) ; cb_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { classDefinition_AST = ( AST ) currentAST . root ; classDefinition_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:7> ) ) . add ( create ( CLASS_DEF , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( modifiers ) . add ( tmp29_AST ) . add ( tp_AST ) . add ( sc_AST ) . add ( ic_AST ) . add ( cb_AST ) ) ; currentAST . root = classDefinition_AST ; currentAST . child = classDefinition_AST != null && classDefinition_AST . getFirstChild ( ) != null ? classDefinition_AST . getFirstChild ( ) : classDefinition_AST ; currentAST . advanceChildToEnd ( ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { currentClass = prevCurrentClass ; } returnAST = classDefinition_AST ; } public final void interfaceDefinition ( AST modifiers ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST interfaceDefinition_AST = null ; AST tp_AST = null ; AST ie_AST = null ; AST ib_AST = null ; Token first = cloneToken ( LT ( <NUM_LIT:1> ) ) ; if ( modifiers != null ) { first . setLine ( modifiers . getLine ( ) ) ; first . setColumn ( modifiers . getColumn ( ) ) ; } match ( LITERAL_interface ) ; AST tmp31_AST = null ; tmp31_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( IDENT ) ; nls ( ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case LT : { typeParameters ( ) ; tp_AST = ( AST ) returnAST ; nls ( ) ; break ; } case LITERAL_extends : case LCURLY : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } interfaceExtends ( ) ; ie_AST = ( AST ) returnAST ; interfaceBlock ( ) ; ib_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { interfaceDefinition_AST = ( AST ) currentAST . root ; interfaceDefinition_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:6> ) ) . add ( create ( INTERFACE_DEF , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( modifiers ) . add ( tmp31_AST ) . add ( tp_AST ) . add ( ie_AST ) . add ( ib_AST ) ) ; currentAST . root = interfaceDefinition_AST ; currentAST . child = interfaceDefinition_AST != null && interfaceDefinition_AST . getFirstChild ( ) != null ? interfaceDefinition_AST . getFirstChild ( ) : interfaceDefinition_AST ; currentAST . advanceChildToEnd ( ) ; } returnAST = interfaceDefinition_AST ; } public final void enumDefinition ( AST modifiers ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST enumDefinition_AST = null ; AST ic_AST = null ; AST eb_AST = null ; Token first = cloneToken ( LT ( <NUM_LIT:1> ) ) ; AST prevCurrentClass = currentClass ; if ( modifiers != null ) { first . setLine ( modifiers . getLine ( ) ) ; first . setColumn ( modifiers . getColumn ( ) ) ; } match ( LITERAL_enum ) ; AST tmp33_AST = null ; tmp33_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( IDENT ) ; if ( inputState . guessing == <NUM_LIT:0> ) { currentClass = tmp33_AST ; } nls ( ) ; implementsClause ( ) ; ic_AST = ( AST ) returnAST ; nls ( ) ; enumBlock ( ) ; eb_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { enumDefinition_AST = ( AST ) currentAST . root ; enumDefinition_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:5> ) ) . add ( create ( ENUM_DEF , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( modifiers ) . add ( tmp33_AST ) . add ( ic_AST ) . add ( eb_AST ) ) ; currentAST . root = enumDefinition_AST ; currentAST . child = enumDefinition_AST != null && enumDefinition_AST . getFirstChild ( ) != null ? enumDefinition_AST . getFirstChild ( ) : enumDefinition_AST ; currentAST . advanceChildToEnd ( ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { currentClass = prevCurrentClass ; } returnAST = enumDefinition_AST ; } public final void annotationDefinition ( AST modifiers ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST annotationDefinition_AST = null ; AST ab_AST = null ; Token first = cloneToken ( LT ( <NUM_LIT:1> ) ) ; if ( modifiers != null ) { first . setLine ( modifiers . getLine ( ) ) ; first . setColumn ( modifiers . getColumn ( ) ) ; } AST tmp34_AST = null ; tmp34_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( AT ) ; match ( LITERAL_interface ) ; AST tmp36_AST = null ; tmp36_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( IDENT ) ; annotationBlock ( ) ; ab_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { annotationDefinition_AST = ( AST ) currentAST . root ; annotationDefinition_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:4> ) ) . add ( create ( ANNOTATION_DEF , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( modifiers ) . add ( tmp36_AST ) . add ( ab_AST ) ) ; currentAST . root = annotationDefinition_AST ; currentAST . child = annotationDefinition_AST != null && annotationDefinition_AST . getFirstChild ( ) != null ? annotationDefinition_AST . getFirstChild ( ) : annotationDefinition_AST ; currentAST . advanceChildToEnd ( ) ; } returnAST = annotationDefinition_AST ; } public final void declaration ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST declaration_AST = null ; AST m_AST = null ; AST t_AST = null ; AST v_AST = null ; AST t2_AST = null ; AST v2_AST = null ; switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case AT : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : { modifiers ( ) ; m_AST = ( AST ) returnAST ; { if ( ( _tokenSet_20 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_21 . member ( LA ( <NUM_LIT:2> ) ) ) ) { typeSpec ( false ) ; t_AST = ( AST ) returnAST ; } else if ( ( LA ( <NUM_LIT:1> ) == IDENT || LA ( <NUM_LIT:1> ) == STRING_LITERAL ) && ( _tokenSet_22 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } variableDefinitions ( m_AST , t_AST ) ; v_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { declaration_AST = ( AST ) currentAST . root ; declaration_AST = v_AST ; currentAST . root = declaration_AST ; currentAST . child = declaration_AST != null && declaration_AST . getFirstChild ( ) != null ? declaration_AST . getFirstChild ( ) : declaration_AST ; currentAST . advanceChildToEnd ( ) ; } break ; } case IDENT : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : { typeSpec ( false ) ; t2_AST = ( AST ) returnAST ; variableDefinitions ( null , t2_AST ) ; v2_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { declaration_AST = ( AST ) currentAST . root ; declaration_AST = v2_AST ; currentAST . root = declaration_AST ; currentAST . child = declaration_AST != null && declaration_AST . getFirstChild ( ) != null ? declaration_AST . getFirstChild ( ) : declaration_AST ; currentAST . advanceChildToEnd ( ) ; } break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = declaration_AST ; } public final void modifiers ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST modifiers_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; modifiersInternal ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; if ( inputState . guessing == <NUM_LIT:0> ) { modifiers_AST = ( AST ) currentAST . root ; modifiers_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( MODIFIERS , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( modifiers_AST ) ) ; currentAST . root = modifiers_AST ; currentAST . child = modifiers_AST != null && modifiers_AST . getFirstChild ( ) != null ? modifiers_AST . getFirstChild ( ) : modifiers_AST ; currentAST . advanceChildToEnd ( ) ; } modifiers_AST = ( AST ) currentAST . root ; returnAST = modifiers_AST ; } public final void typeSpec ( boolean addImagNode ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST typeSpec_AST = null ; switch ( LA ( <NUM_LIT:1> ) ) { case IDENT : { classTypeSpec ( addImagNode ) ; astFactory . addASTChild ( currentAST , returnAST ) ; typeSpec_AST = ( AST ) currentAST . root ; break ; } case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : { builtInTypeSpec ( addImagNode ) ; astFactory . addASTChild ( currentAST , returnAST ) ; typeSpec_AST = ( AST ) currentAST . root ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = typeSpec_AST ; } public final void variableDefinitions ( AST mods , AST t ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST variableDefinitions_AST = null ; Token id = null ; AST id_AST = null ; Token qid = null ; AST qid_AST = null ; AST param_AST = null ; AST tc_AST = null ; AST mb_AST = null ; Token first = cloneToken ( LT ( <NUM_LIT:1> ) ) ; if ( mods != null ) { first . setLine ( mods . getLine ( ) ) ; first . setColumn ( mods . getColumn ( ) ) ; } else if ( t != null ) { first . setLine ( t . getLine ( ) ) ; first . setColumn ( t . getColumn ( ) ) ; } if ( ( LA ( <NUM_LIT:1> ) == IDENT ) && ( _tokenSet_23 . member ( LA ( <NUM_LIT:2> ) ) ) ) { listOfVariables ( mods , t , first ) ; astFactory . addASTChild ( currentAST , returnAST ) ; variableDefinitions_AST = ( AST ) currentAST . root ; } else if ( ( LA ( <NUM_LIT:1> ) == IDENT || LA ( <NUM_LIT:1> ) == STRING_LITERAL ) && ( LA ( <NUM_LIT:2> ) == LPAREN ) ) { { switch ( LA ( <NUM_LIT:1> ) ) { case IDENT : { id = LT ( <NUM_LIT:1> ) ; id_AST = astFactory . create ( id ) ; astFactory . addASTChild ( currentAST , id_AST ) ; match ( IDENT ) ; break ; } case STRING_LITERAL : { qid = LT ( <NUM_LIT:1> ) ; qid_AST = astFactory . create ( qid ) ; astFactory . addASTChild ( currentAST , qid_AST ) ; match ( STRING_LITERAL ) ; if ( inputState . guessing == <NUM_LIT:0> ) { qid_AST . setType ( IDENT ) ; } break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } match ( LPAREN ) ; parameterDeclarationList ( ) ; param_AST = ( AST ) returnAST ; match ( RPAREN ) ; { boolean synPredMatched220 = false ; if ( ( ( LA ( <NUM_LIT:1> ) == NLS || LA ( <NUM_LIT:1> ) == LITERAL_throws ) && ( _tokenSet_24 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m220 = mark ( ) ; synPredMatched220 = true ; inputState . guessing ++ ; try { { nls ( ) ; match ( LITERAL_throws ) ; } } catch ( RecognitionException pe ) { synPredMatched220 = false ; } rewind ( _m220 ) ; inputState . guessing -- ; } if ( synPredMatched220 ) { throwsClause ( ) ; tc_AST = ( AST ) returnAST ; } else if ( ( _tokenSet_25 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_8 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } { boolean synPredMatched223 = false ; if ( ( ( LA ( <NUM_LIT:1> ) == LCURLY || LA ( <NUM_LIT:1> ) == NLS ) && ( _tokenSet_26 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m223 = mark ( ) ; synPredMatched223 = true ; inputState . guessing ++ ; try { { nls ( ) ; match ( LCURLY ) ; } } catch ( RecognitionException pe ) { synPredMatched223 = false ; } rewind ( _m223 ) ; inputState . guessing -- ; } if ( synPredMatched223 ) { { nlsWarn ( ) ; openBlock ( ) ; mb_AST = ( AST ) returnAST ; } } else if ( ( _tokenSet_7 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_8 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } if ( inputState . guessing == <NUM_LIT:0> ) { variableDefinitions_AST = ( AST ) currentAST . root ; if ( qid_AST != null ) id_AST = qid_AST ; variableDefinitions_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:7> ) ) . add ( create ( METHOD_DEF , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( mods ) . add ( ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( TYPE , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( t ) ) ) . add ( id_AST ) . add ( param_AST ) . add ( tc_AST ) . add ( mb_AST ) ) ; currentAST . root = variableDefinitions_AST ; currentAST . child = variableDefinitions_AST != null && variableDefinitions_AST . getFirstChild ( ) != null ? variableDefinitions_AST . getFirstChild ( ) : variableDefinitions_AST ; currentAST . advanceChildToEnd ( ) ; } variableDefinitions_AST = ( AST ) currentAST . root ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } returnAST = variableDefinitions_AST ; } public final void genericMethod ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST genericMethod_AST = null ; AST m_AST = null ; AST p_AST = null ; AST t_AST = null ; AST v_AST = null ; modifiers ( ) ; m_AST = ( AST ) returnAST ; typeParameters ( ) ; p_AST = ( AST ) returnAST ; typeSpec ( false ) ; t_AST = ( AST ) returnAST ; variableDefinitions ( m_AST , t_AST ) ; v_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { genericMethod_AST = ( AST ) currentAST . root ; genericMethod_AST = v_AST ; AST old = v_AST . getFirstChild ( ) ; genericMethod_AST . setFirstChild ( p_AST ) ; p_AST . setNextSibling ( old ) ; currentAST . root = genericMethod_AST ; currentAST . child = genericMethod_AST != null && genericMethod_AST . getFirstChild ( ) != null ? genericMethod_AST . getFirstChild ( ) : genericMethod_AST ; currentAST . advanceChildToEnd ( ) ; } returnAST = genericMethod_AST ; } public final void typeParameters ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST typeParameters_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; int currentLtLevel = <NUM_LIT:0> ; if ( inputState . guessing == <NUM_LIT:0> ) { currentLtLevel = ltCounter ; } match ( LT ) ; if ( inputState . guessing == <NUM_LIT:0> ) { ltCounter ++ ; } nls ( ) ; typeParameter ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop108 : do { if ( ( LA ( <NUM_LIT:1> ) == COMMA ) ) { match ( COMMA ) ; nls ( ) ; typeParameter ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop108 ; } } while ( true ) ; } nls ( ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case GT : case SR : case BSR : { typeArgumentsOrParametersEnd ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case IDENT : case LITERAL_extends : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LCURLY : case NLS : case LITERAL_implements : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( ! ( matchGenericTypeBrackets ( ( ( currentLtLevel != <NUM_LIT:0> ) || ltCounter == currentLtLevel ) , "<STR_LIT>" , "<STR_LIT>" ) ) ) throw new SemanticException ( "<STR_LIT>" ) ; if ( inputState . guessing == <NUM_LIT:0> ) { typeParameters_AST = ( AST ) currentAST . root ; typeParameters_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( TYPE_PARAMETERS , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( typeParameters_AST ) ) ; currentAST . root = typeParameters_AST ; currentAST . child = typeParameters_AST != null && typeParameters_AST . getFirstChild ( ) != null ? typeParameters_AST . getFirstChild ( ) : typeParameters_AST ; currentAST . advanceChildToEnd ( ) ; } typeParameters_AST = ( AST ) currentAST . root ; returnAST = typeParameters_AST ; } public final void singleDeclarationNoInit ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST singleDeclarationNoInit_AST = null ; AST m_AST = null ; AST t_AST = null ; AST v_AST = null ; AST t2_AST = null ; AST v2_AST = null ; switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case AT : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : { modifiers ( ) ; m_AST = ( AST ) returnAST ; { if ( ( _tokenSet_20 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_27 . member ( LA ( <NUM_LIT:2> ) ) ) ) { typeSpec ( false ) ; t_AST = ( AST ) returnAST ; } else if ( ( LA ( <NUM_LIT:1> ) == IDENT ) && ( _tokenSet_28 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } singleVariable ( m_AST , t_AST ) ; v_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { singleDeclarationNoInit_AST = ( AST ) currentAST . root ; singleDeclarationNoInit_AST = v_AST ; currentAST . root = singleDeclarationNoInit_AST ; currentAST . child = singleDeclarationNoInit_AST != null && singleDeclarationNoInit_AST . getFirstChild ( ) != null ? singleDeclarationNoInit_AST . getFirstChild ( ) : singleDeclarationNoInit_AST ; currentAST . advanceChildToEnd ( ) ; } break ; } case IDENT : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : { typeSpec ( false ) ; t2_AST = ( AST ) returnAST ; singleVariable ( null , t2_AST ) ; v2_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { singleDeclarationNoInit_AST = ( AST ) currentAST . root ; singleDeclarationNoInit_AST = v2_AST ; currentAST . root = singleDeclarationNoInit_AST ; currentAST . child = singleDeclarationNoInit_AST != null && singleDeclarationNoInit_AST . getFirstChild ( ) != null ? singleDeclarationNoInit_AST . getFirstChild ( ) : singleDeclarationNoInit_AST ; currentAST . advanceChildToEnd ( ) ; } break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = singleDeclarationNoInit_AST ; } public final void singleVariable ( AST mods , AST t ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST singleVariable_AST = null ; AST id_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; variableName ( ) ; id_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { singleVariable_AST = ( AST ) currentAST . root ; singleVariable_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:4> ) ) . add ( create ( VARIABLE_DEF , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( mods ) . add ( ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( TYPE , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( t ) ) ) . add ( id_AST ) ) ; currentAST . root = singleVariable_AST ; currentAST . child = singleVariable_AST != null && singleVariable_AST . getFirstChild ( ) != null ? singleVariable_AST . getFirstChild ( ) : singleVariable_AST ; currentAST . advanceChildToEnd ( ) ; } returnAST = singleVariable_AST ; } public final void singleDeclaration ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST singleDeclaration_AST = null ; AST sd_AST = null ; singleDeclarationNoInit ( ) ; sd_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { singleDeclaration_AST = ( AST ) currentAST . root ; singleDeclaration_AST = sd_AST ; currentAST . root = singleDeclaration_AST ; currentAST . child = singleDeclaration_AST != null && singleDeclaration_AST . getFirstChild ( ) != null ? singleDeclaration_AST . getFirstChild ( ) : singleDeclaration_AST ; currentAST . advanceChildToEnd ( ) ; } { switch ( LA ( <NUM_LIT:1> ) ) { case ASSIGN : { varInitializer ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case EOF : case RBRACK : case COMMA : case RPAREN : case SEMI : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } singleDeclaration_AST = ( AST ) currentAST . root ; returnAST = singleDeclaration_AST ; } public final void varInitializer ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST varInitializer_AST = null ; AST tmp41_AST = null ; tmp41_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp41_AST ) ; match ( ASSIGN ) ; nls ( ) ; expression ( LC_INIT ) ; astFactory . addASTChild ( currentAST , returnAST ) ; varInitializer_AST = ( AST ) currentAST . root ; returnAST = varInitializer_AST ; } public final void declarationStart ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST declarationStart_AST = null ; { int _cnt30 = <NUM_LIT:0> ; _loop30 : do { switch ( LA ( <NUM_LIT:1> ) ) { case LITERAL_def : { { match ( LITERAL_def ) ; nls ( ) ; } break ; } case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : { modifier ( ) ; nls ( ) ; break ; } case AT : { annotation ( ) ; nls ( ) ; break ; } default : if ( ( _tokenSet_20 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_29 . member ( LA ( <NUM_LIT:2> ) ) ) ) { { if ( ( LA ( <NUM_LIT:1> ) == IDENT ) && ( _tokenSet_30 . member ( LA ( <NUM_LIT:2> ) ) ) ) { upperCaseIdent ( ) ; } else if ( ( ( LA ( <NUM_LIT:1> ) >= LITERAL_void && LA ( <NUM_LIT:1> ) <= LITERAL_double ) ) ) { builtInType ( ) ; } else if ( ( LA ( <NUM_LIT:1> ) == IDENT ) && ( LA ( <NUM_LIT:2> ) == DOT ) ) { qualifiedTypeName ( ) ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } { switch ( LA ( <NUM_LIT:1> ) ) { case LT : { typeArguments ( ) ; break ; } case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case LBRACK : case IDENT : case STRING_LITERAL : case AT : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } { _loop29 : do { if ( ( LA ( <NUM_LIT:1> ) == LBRACK ) ) { AST tmp43_AST = null ; tmp43_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( LBRACK ) ; balancedTokens ( ) ; AST tmp44_AST = null ; tmp44_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( RBRACK ) ; } else { break _loop29 ; } } while ( true ) ; } } else { if ( _cnt30 >= <NUM_LIT:1> ) { break _loop30 ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } _cnt30 ++ ; } while ( true ) ; } { switch ( LA ( <NUM_LIT:1> ) ) { case IDENT : { AST tmp45_AST = null ; tmp45_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( IDENT ) ; break ; } case STRING_LITERAL : { AST tmp46_AST = null ; tmp46_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( STRING_LITERAL ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } returnAST = declarationStart_AST ; } public final void modifier ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST modifier_AST = null ; switch ( LA ( <NUM_LIT:1> ) ) { case LITERAL_private : { AST tmp47_AST = null ; tmp47_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp47_AST ) ; match ( LITERAL_private ) ; modifier_AST = ( AST ) currentAST . root ; break ; } case LITERAL_public : { AST tmp48_AST = null ; tmp48_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp48_AST ) ; match ( LITERAL_public ) ; modifier_AST = ( AST ) currentAST . root ; break ; } case LITERAL_protected : { AST tmp49_AST = null ; tmp49_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp49_AST ) ; match ( LITERAL_protected ) ; modifier_AST = ( AST ) currentAST . root ; break ; } case LITERAL_static : { AST tmp50_AST = null ; tmp50_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp50_AST ) ; match ( LITERAL_static ) ; modifier_AST = ( AST ) currentAST . root ; break ; } case LITERAL_transient : { AST tmp51_AST = null ; tmp51_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp51_AST ) ; match ( LITERAL_transient ) ; modifier_AST = ( AST ) currentAST . root ; break ; } case FINAL : { AST tmp52_AST = null ; tmp52_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp52_AST ) ; match ( FINAL ) ; modifier_AST = ( AST ) currentAST . root ; break ; } case ABSTRACT : { AST tmp53_AST = null ; tmp53_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp53_AST ) ; match ( ABSTRACT ) ; modifier_AST = ( AST ) currentAST . root ; break ; } case LITERAL_native : { AST tmp54_AST = null ; tmp54_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp54_AST ) ; match ( LITERAL_native ) ; modifier_AST = ( AST ) currentAST . root ; break ; } case LITERAL_threadsafe : { AST tmp55_AST = null ; tmp55_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp55_AST ) ; match ( LITERAL_threadsafe ) ; modifier_AST = ( AST ) currentAST . root ; break ; } case LITERAL_synchronized : { AST tmp56_AST = null ; tmp56_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp56_AST ) ; match ( LITERAL_synchronized ) ; modifier_AST = ( AST ) currentAST . root ; break ; } case LITERAL_volatile : { AST tmp57_AST = null ; tmp57_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp57_AST ) ; match ( LITERAL_volatile ) ; modifier_AST = ( AST ) currentAST . root ; break ; } case STRICTFP : { AST tmp58_AST = null ; tmp58_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp58_AST ) ; match ( STRICTFP ) ; modifier_AST = ( AST ) currentAST . root ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = modifier_AST ; } public final void annotation ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST annotation_AST = null ; AST i_AST = null ; AST args_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; match ( AT ) ; identifier ( ) ; i_AST = ( AST ) returnAST ; nls ( ) ; { if ( ( LA ( <NUM_LIT:1> ) == LPAREN ) && ( _tokenSet_31 . member ( LA ( <NUM_LIT:2> ) ) ) ) { match ( LPAREN ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case UNUSED_GOTO : case UNUSED_DO : case STRICTFP : case LITERAL_package : case LITERAL_import : case LITERAL_static : case LITERAL_def : case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_extends : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_as : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : case LITERAL_default : case LITERAL_throws : case LITERAL_implements : case LITERAL_this : case LITERAL_if : case LITERAL_else : case LITERAL_while : case LITERAL_switch : case LITERAL_for : case LITERAL_in : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case PLUS : case MINUS : case LITERAL_case : case LITERAL_try : case LITERAL_finally : case LITERAL_catch : case LITERAL_false : case LITERAL_instanceof : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { annotationArguments ( ) ; args_AST = ( AST ) returnAST ; break ; } case RPAREN : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } match ( RPAREN ) ; } else if ( ( _tokenSet_32 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_33 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } if ( inputState . guessing == <NUM_LIT:0> ) { annotation_AST = ( AST ) currentAST . root ; annotation_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( ANNOTATION , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( i_AST ) . add ( args_AST ) ) ; currentAST . root = annotation_AST ; currentAST . child = annotation_AST != null && annotation_AST . getFirstChild ( ) != null ? annotation_AST . getFirstChild ( ) : annotation_AST ; currentAST . advanceChildToEnd ( ) ; } returnAST = annotation_AST ; } public final void upperCaseIdent ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST upperCaseIdent_AST = null ; if ( ! ( isUpperCase ( LT ( <NUM_LIT:1> ) ) ) ) throw new SemanticException ( "<STR_LIT>" ) ; AST tmp62_AST = null ; tmp62_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp62_AST ) ; match ( IDENT ) ; upperCaseIdent_AST = ( AST ) currentAST . root ; returnAST = upperCaseIdent_AST ; } public final void builtInType ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST builtInType_AST = null ; switch ( LA ( <NUM_LIT:1> ) ) { case LITERAL_void : { AST tmp63_AST = null ; tmp63_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp63_AST ) ; match ( LITERAL_void ) ; builtInType_AST = ( AST ) currentAST . root ; break ; } case LITERAL_boolean : { AST tmp64_AST = null ; tmp64_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp64_AST ) ; match ( LITERAL_boolean ) ; builtInType_AST = ( AST ) currentAST . root ; break ; } case LITERAL_byte : { AST tmp65_AST = null ; tmp65_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp65_AST ) ; match ( LITERAL_byte ) ; builtInType_AST = ( AST ) currentAST . root ; break ; } case LITERAL_char : { AST tmp66_AST = null ; tmp66_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp66_AST ) ; match ( LITERAL_char ) ; builtInType_AST = ( AST ) currentAST . root ; break ; } case LITERAL_short : { AST tmp67_AST = null ; tmp67_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp67_AST ) ; match ( LITERAL_short ) ; builtInType_AST = ( AST ) currentAST . root ; break ; } case LITERAL_int : { AST tmp68_AST = null ; tmp68_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp68_AST ) ; match ( LITERAL_int ) ; builtInType_AST = ( AST ) currentAST . root ; break ; } case LITERAL_float : { AST tmp69_AST = null ; tmp69_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp69_AST ) ; match ( LITERAL_float ) ; builtInType_AST = ( AST ) currentAST . root ; break ; } case LITERAL_long : { AST tmp70_AST = null ; tmp70_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp70_AST ) ; match ( LITERAL_long ) ; builtInType_AST = ( AST ) currentAST . root ; break ; } case LITERAL_double : { AST tmp71_AST = null ; tmp71_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp71_AST ) ; match ( LITERAL_double ) ; builtInType_AST = ( AST ) currentAST . root ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = builtInType_AST ; } public final void qualifiedTypeName ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST qualifiedTypeName_AST = null ; AST tmp72_AST = null ; tmp72_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( IDENT ) ; AST tmp73_AST = null ; tmp73_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( DOT ) ; { _loop37 : do { if ( ( LA ( <NUM_LIT:1> ) == IDENT ) && ( LA ( <NUM_LIT:2> ) == DOT ) ) { AST tmp74_AST = null ; tmp74_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( IDENT ) ; AST tmp75_AST = null ; tmp75_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( DOT ) ; } else { break _loop37 ; } } while ( true ) ; } upperCaseIdent ( ) ; returnAST = qualifiedTypeName_AST ; } public final void typeArguments ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST typeArguments_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; int currentLtLevel = <NUM_LIT:0> ; if ( inputState . guessing == <NUM_LIT:0> ) { currentLtLevel = ltCounter ; } match ( LT ) ; if ( inputState . guessing == <NUM_LIT:0> ) { ltCounter ++ ; } nls ( ) ; typeArgument ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop58 : do { if ( ( ( LA ( <NUM_LIT:1> ) == COMMA ) && ( _tokenSet_34 . member ( LA ( <NUM_LIT:2> ) ) ) ) && ( inputState . guessing != <NUM_LIT:0> || ltCounter == currentLtLevel + <NUM_LIT:1> ) ) { match ( COMMA ) ; nls ( ) ; typeArgument ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop58 ; } } while ( true ) ; } nls ( ) ; { if ( ( ( LA ( <NUM_LIT:1> ) >= GT && LA ( <NUM_LIT:1> ) <= BSR ) ) && ( _tokenSet_35 . member ( LA ( <NUM_LIT:2> ) ) ) ) { typeArgumentsOrParametersEnd ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else if ( ( _tokenSet_35 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_4 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } if ( ! ( matchGenericTypeBrackets ( ( ( currentLtLevel != <NUM_LIT:0> ) || ltCounter == currentLtLevel ) , "<STR_LIT>" , "<STR_LIT>" ) ) ) throw new SemanticException ( "<STR_LIT>" ) ; if ( inputState . guessing == <NUM_LIT:0> ) { typeArguments_AST = ( AST ) currentAST . root ; typeArguments_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( TYPE_ARGUMENTS , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( typeArguments_AST ) ) ; currentAST . root = typeArguments_AST ; currentAST . child = typeArguments_AST != null && typeArguments_AST . getFirstChild ( ) != null ? typeArguments_AST . getFirstChild ( ) : typeArguments_AST ; currentAST . advanceChildToEnd ( ) ; } typeArguments_AST = ( AST ) currentAST . root ; returnAST = typeArguments_AST ; } public final void balancedTokens ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST balancedTokens_AST = null ; { _loop527 : do { if ( ( _tokenSet_36 . member ( LA ( <NUM_LIT:1> ) ) ) ) { balancedBrackets ( ) ; } else if ( ( _tokenSet_37 . member ( LA ( <NUM_LIT:1> ) ) ) ) { { match ( _tokenSet_37 ) ; } } else { break _loop527 ; } } while ( true ) ; } returnAST = balancedTokens_AST ; } public final void genericMethodStart ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST genericMethodStart_AST = null ; { int _cnt34 = <NUM_LIT:0> ; _loop34 : do { switch ( LA ( <NUM_LIT:1> ) ) { case LITERAL_def : { match ( LITERAL_def ) ; nls ( ) ; break ; } case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : { modifier ( ) ; nls ( ) ; break ; } case AT : { annotation ( ) ; nls ( ) ; break ; } default : { if ( _cnt34 >= <NUM_LIT:1> ) { break _loop34 ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } _cnt34 ++ ; } while ( true ) ; } AST tmp80_AST = null ; tmp80_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( LT ) ; returnAST = genericMethodStart_AST ; } public final void constructorStart ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST constructorStart_AST = null ; Token id = null ; AST id_AST = null ; modifiersOpt ( ) ; id = LT ( <NUM_LIT:1> ) ; id_AST = astFactory . create ( id ) ; match ( IDENT ) ; if ( ! ( isConstructorIdent ( id ) ) ) throw new SemanticException ( "<STR_LIT>" ) ; nls ( ) ; match ( LPAREN ) ; returnAST = constructorStart_AST ; } public final void modifiersOpt ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST modifiersOpt_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; { if ( ( _tokenSet_9 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_38 . member ( LA ( <NUM_LIT:2> ) ) ) ) { modifiersInternal ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else if ( ( _tokenSet_39 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_40 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } if ( inputState . guessing == <NUM_LIT:0> ) { modifiersOpt_AST = ( AST ) currentAST . root ; modifiersOpt_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( MODIFIERS , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( modifiersOpt_AST ) ) ; currentAST . root = modifiersOpt_AST ; currentAST . child = modifiersOpt_AST != null && modifiersOpt_AST . getFirstChild ( ) != null ? modifiersOpt_AST . getFirstChild ( ) : modifiersOpt_AST ; currentAST . advanceChildToEnd ( ) ; } modifiersOpt_AST = ( AST ) currentAST . root ; returnAST = modifiersOpt_AST ; } public final void typeDeclarationStart ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST typeDeclarationStart_AST = null ; modifiersOpt ( ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case LITERAL_class : { match ( LITERAL_class ) ; break ; } case LITERAL_interface : { match ( LITERAL_interface ) ; break ; } case LITERAL_enum : { match ( LITERAL_enum ) ; break ; } case AT : { AST tmp85_AST = null ; tmp85_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( AT ) ; match ( LITERAL_interface ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } returnAST = typeDeclarationStart_AST ; } public final void classTypeSpec ( boolean addImagNode ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST classTypeSpec_AST = null ; AST ct_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; classOrInterfaceType ( false ) ; ct_AST = ( AST ) returnAST ; declaratorBrackets ( ct_AST ) ; astFactory . addASTChild ( currentAST , returnAST ) ; if ( inputState . guessing == <NUM_LIT:0> ) { classTypeSpec_AST = ( AST ) currentAST . root ; if ( addImagNode ) { classTypeSpec_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( TYPE , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( classTypeSpec_AST ) ) ; } currentAST . root = classTypeSpec_AST ; currentAST . child = classTypeSpec_AST != null && classTypeSpec_AST . getFirstChild ( ) != null ? classTypeSpec_AST . getFirstChild ( ) : classTypeSpec_AST ; currentAST . advanceChildToEnd ( ) ; } classTypeSpec_AST = ( AST ) currentAST . root ; returnAST = classTypeSpec_AST ; } public final void builtInTypeSpec ( boolean addImagNode ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST builtInTypeSpec_AST = null ; AST bt_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; builtInType ( ) ; bt_AST = ( AST ) returnAST ; declaratorBrackets ( bt_AST ) ; astFactory . addASTChild ( currentAST , returnAST ) ; if ( inputState . guessing == <NUM_LIT:0> ) { builtInTypeSpec_AST = ( AST ) currentAST . root ; if ( addImagNode ) { builtInTypeSpec_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( TYPE , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( builtInTypeSpec_AST ) ) ; } currentAST . root = builtInTypeSpec_AST ; currentAST . child = builtInTypeSpec_AST != null && builtInTypeSpec_AST . getFirstChild ( ) != null ? builtInTypeSpec_AST . getFirstChild ( ) : builtInTypeSpec_AST ; currentAST . advanceChildToEnd ( ) ; } builtInTypeSpec_AST = ( AST ) currentAST . root ; returnAST = builtInTypeSpec_AST ; } public final void classOrInterfaceType ( boolean addImagNode ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST classOrInterfaceType_AST = null ; Token i1 = null ; AST i1_AST = null ; Token d = null ; AST d_AST = null ; Token i2 = null ; AST i2_AST = null ; AST ta_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; i1 = LT ( <NUM_LIT:1> ) ; i1_AST = astFactory . create ( i1 ) ; astFactory . makeASTRoot ( currentAST , i1_AST ) ; match ( IDENT ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case LT : { typeArguments ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case EOF : case FINAL : case ABSTRACT : case UNUSED_GOTO : case UNUSED_DO : case STRICTFP : case LITERAL_package : case LITERAL_import : case LITERAL_static : case LITERAL_def : case LBRACK : case RBRACK : case IDENT : case STRING_LITERAL : case DOT : case LPAREN : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case QUESTION : case LITERAL_extends : case LITERAL_super : case COMMA : case GT : case SR : case BSR : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_as : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case RPAREN : case ASSIGN : case BAND : case LCURLY : case RCURLY : case SEMI : case NLS : case LITERAL_default : case LITERAL_throws : case LITERAL_implements : case LITERAL_this : case TRIPLE_DOT : case CLOSABLE_BLOCK_OP : case COLON : case LITERAL_if : case LITERAL_else : case LITERAL_while : case LITERAL_switch : case LITERAL_for : case LITERAL_in : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case PLUS : case MINUS : case LITERAL_case : case LITERAL_try : case LITERAL_finally : case LITERAL_catch : case LITERAL_false : case LITERAL_instanceof : case LITERAL_new : case LITERAL_null : case LITERAL_true : case PLUS_ASSIGN : case MINUS_ASSIGN : case STAR_ASSIGN : case DIV_ASSIGN : case MOD_ASSIGN : case SR_ASSIGN : case BSR_ASSIGN : case SL_ASSIGN : case BAND_ASSIGN : case BXOR_ASSIGN : case BOR_ASSIGN : case STAR_STAR_ASSIGN : case ELVIS_OPERATOR : case LOR : case LAND : case BOR : case BXOR : case REGEX_FIND : case REGEX_MATCH : case NOT_EQUAL : case EQUAL : case COMPARE_TO : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } { _loop48 : do { if ( ( LA ( <NUM_LIT:1> ) == DOT ) && ( LA ( <NUM_LIT:2> ) == IDENT ) ) { d = LT ( <NUM_LIT:1> ) ; d_AST = astFactory . create ( d ) ; match ( DOT ) ; i2 = LT ( <NUM_LIT:1> ) ; i2_AST = astFactory . create ( i2 ) ; match ( IDENT ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case LT : { typeArguments ( ) ; ta_AST = ( AST ) returnAST ; break ; } case EOF : case FINAL : case ABSTRACT : case UNUSED_GOTO : case UNUSED_DO : case STRICTFP : case LITERAL_package : case LITERAL_import : case LITERAL_static : case LITERAL_def : case LBRACK : case RBRACK : case IDENT : case STRING_LITERAL : case DOT : case LPAREN : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case QUESTION : case LITERAL_extends : case LITERAL_super : case COMMA : case GT : case SR : case BSR : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_as : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case RPAREN : case ASSIGN : case BAND : case LCURLY : case RCURLY : case SEMI : case NLS : case LITERAL_default : case LITERAL_throws : case LITERAL_implements : case LITERAL_this : case TRIPLE_DOT : case CLOSABLE_BLOCK_OP : case COLON : case LITERAL_if : case LITERAL_else : case LITERAL_while : case LITERAL_switch : case LITERAL_for : case LITERAL_in : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case PLUS : case MINUS : case LITERAL_case : case LITERAL_try : case LITERAL_finally : case LITERAL_catch : case LITERAL_false : case LITERAL_instanceof : case LITERAL_new : case LITERAL_null : case LITERAL_true : case PLUS_ASSIGN : case MINUS_ASSIGN : case STAR_ASSIGN : case DIV_ASSIGN : case MOD_ASSIGN : case SR_ASSIGN : case BSR_ASSIGN : case SL_ASSIGN : case BAND_ASSIGN : case BXOR_ASSIGN : case BOR_ASSIGN : case STAR_STAR_ASSIGN : case ELVIS_OPERATOR : case LOR : case LAND : case BOR : case BXOR : case REGEX_FIND : case REGEX_MATCH : case NOT_EQUAL : case EQUAL : case COMPARE_TO : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { i1_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:4> ) ) . add ( create ( DOT , "<STR_LIT:.>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( i1_AST ) . add ( i2_AST ) . add ( ta_AST ) ) ; } } else { break _loop48 ; } } while ( true ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { classOrInterfaceType_AST = ( AST ) currentAST . root ; classOrInterfaceType_AST = i1_AST ; if ( addImagNode ) { classOrInterfaceType_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( TYPE , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( classOrInterfaceType_AST ) ) ; } currentAST . root = classOrInterfaceType_AST ; currentAST . child = classOrInterfaceType_AST != null && classOrInterfaceType_AST . getFirstChild ( ) != null ? classOrInterfaceType_AST . getFirstChild ( ) : classOrInterfaceType_AST ; currentAST . advanceChildToEnd ( ) ; } classOrInterfaceType_AST = ( AST ) currentAST . root ; returnAST = classOrInterfaceType_AST ; } public final void declaratorBrackets ( AST typ ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST declaratorBrackets_AST = null ; if ( inputState . guessing == <NUM_LIT:0> ) { declaratorBrackets_AST = ( AST ) currentAST . root ; declaratorBrackets_AST = typ ; currentAST . root = declaratorBrackets_AST ; currentAST . child = declaratorBrackets_AST != null && declaratorBrackets_AST . getFirstChild ( ) != null ? declaratorBrackets_AST . getFirstChild ( ) : declaratorBrackets_AST ; currentAST . advanceChildToEnd ( ) ; } { _loop235 : do { if ( ( LA ( <NUM_LIT:1> ) == LBRACK ) && ( LA ( <NUM_LIT:2> ) == RBRACK ) ) { match ( LBRACK ) ; match ( RBRACK ) ; if ( inputState . guessing == <NUM_LIT:0> ) { declaratorBrackets_AST = ( AST ) currentAST . root ; declaratorBrackets_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( ARRAY_DECLARATOR , "<STR_LIT:[>" , typ , LT ( <NUM_LIT:1> ) ) ) . add ( declaratorBrackets_AST ) ) ; currentAST . root = declaratorBrackets_AST ; currentAST . child = declaratorBrackets_AST != null && declaratorBrackets_AST . getFirstChild ( ) != null ? declaratorBrackets_AST . getFirstChild ( ) : declaratorBrackets_AST ; currentAST . advanceChildToEnd ( ) ; } } else { break _loop235 ; } } while ( true ) ; } declaratorBrackets_AST = ( AST ) currentAST . root ; returnAST = declaratorBrackets_AST ; } public final void typeArgumentSpec ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST typeArgumentSpec_AST = null ; switch ( LA ( <NUM_LIT:1> ) ) { case IDENT : { classTypeSpec ( true ) ; astFactory . addASTChild ( currentAST , returnAST ) ; typeArgumentSpec_AST = ( AST ) currentAST . root ; break ; } case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : { builtInTypeArraySpec ( true ) ; astFactory . addASTChild ( currentAST , returnAST ) ; typeArgumentSpec_AST = ( AST ) currentAST . root ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = typeArgumentSpec_AST ; } public final void builtInTypeArraySpec ( boolean addImagNode ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST builtInTypeArraySpec_AST = null ; AST bt_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; builtInType ( ) ; bt_AST = ( AST ) returnAST ; { boolean synPredMatched66 = false ; if ( ( ( _tokenSet_35 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_4 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m66 = mark ( ) ; synPredMatched66 = true ; inputState . guessing ++ ; try { { match ( LBRACK ) ; } } catch ( RecognitionException pe ) { synPredMatched66 = false ; } rewind ( _m66 ) ; inputState . guessing -- ; } if ( synPredMatched66 ) { declaratorBrackets ( bt_AST ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else if ( ( _tokenSet_35 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_4 . member ( LA ( <NUM_LIT:2> ) ) ) ) { if ( inputState . guessing == <NUM_LIT:0> ) { require ( false , "<STR_LIT>" , "<STR_LIT>" ) ; } } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } if ( inputState . guessing == <NUM_LIT:0> ) { builtInTypeArraySpec_AST = ( AST ) currentAST . root ; if ( addImagNode ) { builtInTypeArraySpec_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( TYPE , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( builtInTypeArraySpec_AST ) ) ; } currentAST . root = builtInTypeArraySpec_AST ; currentAST . child = builtInTypeArraySpec_AST != null && builtInTypeArraySpec_AST . getFirstChild ( ) != null ? builtInTypeArraySpec_AST . getFirstChild ( ) : builtInTypeArraySpec_AST ; currentAST . advanceChildToEnd ( ) ; } builtInTypeArraySpec_AST = ( AST ) currentAST . root ; returnAST = builtInTypeArraySpec_AST ; } public final void typeArgument ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST typeArgument_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case IDENT : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : { typeArgumentSpec ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case QUESTION : { wildcardType ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { typeArgument_AST = ( AST ) currentAST . root ; typeArgument_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( TYPE_ARGUMENT , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( typeArgument_AST ) ) ; currentAST . root = typeArgument_AST ; currentAST . child = typeArgument_AST != null && typeArgument_AST . getFirstChild ( ) != null ? typeArgument_AST . getFirstChild ( ) : typeArgument_AST ; currentAST . advanceChildToEnd ( ) ; } typeArgument_AST = ( AST ) currentAST . root ; returnAST = typeArgument_AST ; } public final void wildcardType ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST wildcardType_AST = null ; AST tmp89_AST = null ; tmp89_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp89_AST ) ; match ( QUESTION ) ; { boolean synPredMatched55 = false ; if ( ( ( LA ( <NUM_LIT:1> ) == LITERAL_extends || LA ( <NUM_LIT:1> ) == LITERAL_super ) && ( LA ( <NUM_LIT:2> ) == IDENT || LA ( <NUM_LIT:2> ) == NLS ) ) ) { int _m55 = mark ( ) ; synPredMatched55 = true ; inputState . guessing ++ ; try { { switch ( LA ( <NUM_LIT:1> ) ) { case LITERAL_extends : { match ( LITERAL_extends ) ; break ; } case LITERAL_super : { match ( LITERAL_super ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } } catch ( RecognitionException pe ) { synPredMatched55 = false ; } rewind ( _m55 ) ; inputState . guessing -- ; } if ( synPredMatched55 ) { typeArgumentBounds ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else if ( ( _tokenSet_35 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_4 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } if ( inputState . guessing == <NUM_LIT:0> ) { wildcardType_AST = ( AST ) currentAST . root ; wildcardType_AST . setType ( WILDCARD_TYPE ) ; } wildcardType_AST = ( AST ) currentAST . root ; returnAST = wildcardType_AST ; } public final void typeArgumentBounds ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST typeArgumentBounds_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; boolean isUpperBounds = false ; { switch ( LA ( <NUM_LIT:1> ) ) { case LITERAL_extends : { match ( LITERAL_extends ) ; if ( inputState . guessing == <NUM_LIT:0> ) { isUpperBounds = true ; } break ; } case LITERAL_super : { match ( LITERAL_super ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } nls ( ) ; classOrInterfaceType ( true ) ; astFactory . addASTChild ( currentAST , returnAST ) ; nls ( ) ; if ( inputState . guessing == <NUM_LIT:0> ) { typeArgumentBounds_AST = ( AST ) currentAST . root ; if ( isUpperBounds ) { typeArgumentBounds_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( TYPE_UPPER_BOUNDS , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( typeArgumentBounds_AST ) ) ; } else { typeArgumentBounds_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( TYPE_LOWER_BOUNDS , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( typeArgumentBounds_AST ) ) ; } currentAST . root = typeArgumentBounds_AST ; currentAST . child = typeArgumentBounds_AST != null && typeArgumentBounds_AST . getFirstChild ( ) != null ? typeArgumentBounds_AST . getFirstChild ( ) : typeArgumentBounds_AST ; currentAST . advanceChildToEnd ( ) ; } typeArgumentBounds_AST = ( AST ) currentAST . root ; returnAST = typeArgumentBounds_AST ; } protected final void typeArgumentsOrParametersEnd ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST typeArgumentsOrParametersEnd_AST = null ; switch ( LA ( <NUM_LIT:1> ) ) { case GT : { match ( GT ) ; if ( inputState . guessing == <NUM_LIT:0> ) { ltCounter -= <NUM_LIT:1> ; } typeArgumentsOrParametersEnd_AST = ( AST ) currentAST . root ; break ; } case SR : { match ( SR ) ; if ( inputState . guessing == <NUM_LIT:0> ) { ltCounter -= <NUM_LIT:2> ; } typeArgumentsOrParametersEnd_AST = ( AST ) currentAST . root ; break ; } case BSR : { match ( BSR ) ; if ( inputState . guessing == <NUM_LIT:0> ) { ltCounter -= <NUM_LIT:3> ; } typeArgumentsOrParametersEnd_AST = ( AST ) currentAST . root ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = typeArgumentsOrParametersEnd_AST ; } public final void type ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST type_AST = null ; switch ( LA ( <NUM_LIT:1> ) ) { case IDENT : { classOrInterfaceType ( false ) ; astFactory . addASTChild ( currentAST , returnAST ) ; type_AST = ( AST ) currentAST . root ; break ; } case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : { builtInType ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; type_AST = ( AST ) currentAST . root ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = type_AST ; } public final void modifiersInternal ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST modifiersInternal_AST = null ; int seenDef = <NUM_LIT:0> ; { int _cnt79 = <NUM_LIT:0> ; _loop79 : do { if ( ( ( LA ( <NUM_LIT:1> ) == LITERAL_def ) ) && ( seenDef ++ == <NUM_LIT:0> ) ) { match ( LITERAL_def ) ; nls ( ) ; } else if ( ( _tokenSet_41 . member ( LA ( <NUM_LIT:1> ) ) ) ) { modifier ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; nls ( ) ; } else if ( ( LA ( <NUM_LIT:1> ) == AT ) && ( LA ( <NUM_LIT:2> ) == LITERAL_interface ) ) { if ( inputState . guessing == <NUM_LIT:0> ) { break ; } AST tmp96_AST = null ; tmp96_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp96_AST ) ; match ( AT ) ; AST tmp97_AST = null ; tmp97_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp97_AST ) ; match ( LITERAL_interface ) ; } else if ( ( LA ( <NUM_LIT:1> ) == AT ) && ( LA ( <NUM_LIT:2> ) == IDENT ) ) { annotation ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; nls ( ) ; } else { if ( _cnt79 >= <NUM_LIT:1> ) { break _loop79 ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } _cnt79 ++ ; } while ( true ) ; } modifiersInternal_AST = ( AST ) currentAST . root ; returnAST = modifiersInternal_AST ; } public final void annotationArguments ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST annotationArguments_AST = null ; AST v_AST = null ; if ( ( _tokenSet_42 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_43 . member ( LA ( <NUM_LIT:2> ) ) ) ) { annotationMemberValueInitializer ( ) ; v_AST = ( AST ) returnAST ; astFactory . addASTChild ( currentAST , returnAST ) ; if ( inputState . guessing == <NUM_LIT:0> ) { annotationArguments_AST = ( AST ) currentAST . root ; Token itkn = new Token ( IDENT , "<STR_LIT:value>" ) ; AST i ; i = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:1> ) ) . add ( create ( IDENT , "<STR_LIT:value>" , itkn , itkn ) ) ) ; annotationArguments_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( ANNOTATION_MEMBER_VALUE_PAIR , "<STR_LIT>" , LT ( <NUM_LIT:1> ) , LT ( <NUM_LIT:1> ) ) ) . add ( i ) . add ( v_AST ) ) ; currentAST . root = annotationArguments_AST ; currentAST . child = annotationArguments_AST != null && annotationArguments_AST . getFirstChild ( ) != null ? annotationArguments_AST . getFirstChild ( ) : annotationArguments_AST ; currentAST . advanceChildToEnd ( ) ; } annotationArguments_AST = ( AST ) currentAST . root ; } else if ( ( _tokenSet_44 . member ( LA ( <NUM_LIT:1> ) ) ) && ( LA ( <NUM_LIT:2> ) == ASSIGN ) ) { annotationMemberValuePairs ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; annotationArguments_AST = ( AST ) currentAST . root ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } returnAST = annotationArguments_AST ; } public final void annotationMemberValueInitializer ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST annotationMemberValueInitializer_AST = null ; switch ( LA ( <NUM_LIT:1> ) ) { case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LCURLY : case LITERAL_this : case PLUS : case MINUS : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { conditionalExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; annotationMemberValueInitializer_AST = ( AST ) currentAST . root ; break ; } case AT : { annotation ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; annotationMemberValueInitializer_AST = ( AST ) currentAST . root ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = annotationMemberValueInitializer_AST ; } public final void annotationMemberValuePairs ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST annotationMemberValuePairs_AST = null ; annotationMemberValuePair ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop93 : do { if ( ( LA ( <NUM_LIT:1> ) == COMMA ) ) { match ( COMMA ) ; nls ( ) ; annotationMemberValuePair ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop93 ; } } while ( true ) ; } annotationMemberValuePairs_AST = ( AST ) currentAST . root ; returnAST = annotationMemberValuePairs_AST ; } public final void annotationMemberValuePair ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST annotationMemberValuePair_AST = null ; AST i_AST = null ; AST v_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; annotationIdent ( ) ; i_AST = ( AST ) returnAST ; match ( ASSIGN ) ; nls ( ) ; annotationMemberValueInitializer ( ) ; v_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { annotationMemberValuePair_AST = ( AST ) currentAST . root ; annotationMemberValuePair_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( ANNOTATION_MEMBER_VALUE_PAIR , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( i_AST ) . add ( v_AST ) ) ; currentAST . root = annotationMemberValuePair_AST ; currentAST . child = annotationMemberValuePair_AST != null && annotationMemberValuePair_AST . getFirstChild ( ) != null ? annotationMemberValuePair_AST . getFirstChild ( ) : annotationMemberValuePair_AST ; currentAST . advanceChildToEnd ( ) ; } returnAST = annotationMemberValuePair_AST ; } public final void annotationIdent ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST annotationIdent_AST = null ; switch ( LA ( <NUM_LIT:1> ) ) { case IDENT : { AST tmp100_AST = null ; tmp100_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp100_AST ) ; match ( IDENT ) ; annotationIdent_AST = ( AST ) currentAST . root ; break ; } case FINAL : case ABSTRACT : case UNUSED_GOTO : case UNUSED_DO : case STRICTFP : case LITERAL_package : case LITERAL_import : case LITERAL_static : case LITERAL_def : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case LITERAL_extends : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_as : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LITERAL_default : case LITERAL_throws : case LITERAL_implements : case LITERAL_if : case LITERAL_else : case LITERAL_while : case LITERAL_switch : case LITERAL_for : case LITERAL_in : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case LITERAL_case : case LITERAL_try : case LITERAL_finally : case LITERAL_catch : case LITERAL_false : case LITERAL_instanceof : case LITERAL_new : case LITERAL_null : case LITERAL_true : { keywordPropertyNames ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; annotationIdent_AST = ( AST ) currentAST . root ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = annotationIdent_AST ; } public final void keywordPropertyNames ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST keywordPropertyNames_AST = null ; { switch ( LA ( <NUM_LIT:1> ) ) { case ABSTRACT : { AST tmp101_AST = null ; tmp101_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp101_AST ) ; match ( ABSTRACT ) ; break ; } case LITERAL_as : { AST tmp102_AST = null ; tmp102_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp102_AST ) ; match ( LITERAL_as ) ; break ; } case LITERAL_assert : { AST tmp103_AST = null ; tmp103_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp103_AST ) ; match ( LITERAL_assert ) ; break ; } case LITERAL_break : { AST tmp104_AST = null ; tmp104_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp104_AST ) ; match ( LITERAL_break ) ; break ; } case LITERAL_case : { AST tmp105_AST = null ; tmp105_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp105_AST ) ; match ( LITERAL_case ) ; break ; } case LITERAL_catch : { AST tmp106_AST = null ; tmp106_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp106_AST ) ; match ( LITERAL_catch ) ; break ; } case LITERAL_class : { AST tmp107_AST = null ; tmp107_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp107_AST ) ; match ( LITERAL_class ) ; break ; } case LITERAL_continue : { AST tmp108_AST = null ; tmp108_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp108_AST ) ; match ( LITERAL_continue ) ; break ; } case LITERAL_def : { AST tmp109_AST = null ; tmp109_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp109_AST ) ; match ( LITERAL_def ) ; break ; } case LITERAL_default : { AST tmp110_AST = null ; tmp110_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp110_AST ) ; match ( LITERAL_default ) ; break ; } case UNUSED_DO : { AST tmp111_AST = null ; tmp111_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp111_AST ) ; match ( UNUSED_DO ) ; break ; } case LITERAL_else : { AST tmp112_AST = null ; tmp112_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp112_AST ) ; match ( LITERAL_else ) ; break ; } case LITERAL_enum : { AST tmp113_AST = null ; tmp113_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp113_AST ) ; match ( LITERAL_enum ) ; break ; } case LITERAL_extends : { AST tmp114_AST = null ; tmp114_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp114_AST ) ; match ( LITERAL_extends ) ; break ; } case LITERAL_false : { AST tmp115_AST = null ; tmp115_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp115_AST ) ; match ( LITERAL_false ) ; break ; } case FINAL : { AST tmp116_AST = null ; tmp116_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp116_AST ) ; match ( FINAL ) ; break ; } case LITERAL_finally : { AST tmp117_AST = null ; tmp117_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp117_AST ) ; match ( LITERAL_finally ) ; break ; } case LITERAL_for : { AST tmp118_AST = null ; tmp118_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp118_AST ) ; match ( LITERAL_for ) ; break ; } case UNUSED_GOTO : { AST tmp119_AST = null ; tmp119_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp119_AST ) ; match ( UNUSED_GOTO ) ; break ; } case LITERAL_if : { AST tmp120_AST = null ; tmp120_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp120_AST ) ; match ( LITERAL_if ) ; break ; } case LITERAL_implements : { AST tmp121_AST = null ; tmp121_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp121_AST ) ; match ( LITERAL_implements ) ; break ; } case LITERAL_import : { AST tmp122_AST = null ; tmp122_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp122_AST ) ; match ( LITERAL_import ) ; break ; } case LITERAL_in : { AST tmp123_AST = null ; tmp123_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp123_AST ) ; match ( LITERAL_in ) ; break ; } case LITERAL_instanceof : { AST tmp124_AST = null ; tmp124_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp124_AST ) ; match ( LITERAL_instanceof ) ; break ; } case LITERAL_interface : { AST tmp125_AST = null ; tmp125_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp125_AST ) ; match ( LITERAL_interface ) ; break ; } case LITERAL_native : { AST tmp126_AST = null ; tmp126_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp126_AST ) ; match ( LITERAL_native ) ; break ; } case LITERAL_new : { AST tmp127_AST = null ; tmp127_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp127_AST ) ; match ( LITERAL_new ) ; break ; } case LITERAL_null : { AST tmp128_AST = null ; tmp128_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp128_AST ) ; match ( LITERAL_null ) ; break ; } case LITERAL_package : { AST tmp129_AST = null ; tmp129_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp129_AST ) ; match ( LITERAL_package ) ; break ; } case LITERAL_private : { AST tmp130_AST = null ; tmp130_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp130_AST ) ; match ( LITERAL_private ) ; break ; } case LITERAL_protected : { AST tmp131_AST = null ; tmp131_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp131_AST ) ; match ( LITERAL_protected ) ; break ; } case LITERAL_public : { AST tmp132_AST = null ; tmp132_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp132_AST ) ; match ( LITERAL_public ) ; break ; } case LITERAL_return : { AST tmp133_AST = null ; tmp133_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp133_AST ) ; match ( LITERAL_return ) ; break ; } case LITERAL_static : { AST tmp134_AST = null ; tmp134_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp134_AST ) ; match ( LITERAL_static ) ; break ; } case STRICTFP : { AST tmp135_AST = null ; tmp135_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp135_AST ) ; match ( STRICTFP ) ; break ; } case LITERAL_switch : { AST tmp136_AST = null ; tmp136_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp136_AST ) ; match ( LITERAL_switch ) ; break ; } case LITERAL_synchronized : { AST tmp137_AST = null ; tmp137_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp137_AST ) ; match ( LITERAL_synchronized ) ; break ; } case LITERAL_threadsafe : { AST tmp138_AST = null ; tmp138_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp138_AST ) ; match ( LITERAL_threadsafe ) ; break ; } case LITERAL_throw : { AST tmp139_AST = null ; tmp139_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp139_AST ) ; match ( LITERAL_throw ) ; break ; } case LITERAL_throws : { AST tmp140_AST = null ; tmp140_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp140_AST ) ; match ( LITERAL_throws ) ; break ; } case LITERAL_transient : { AST tmp141_AST = null ; tmp141_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp141_AST ) ; match ( LITERAL_transient ) ; break ; } case LITERAL_true : { AST tmp142_AST = null ; tmp142_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp142_AST ) ; match ( LITERAL_true ) ; break ; } case LITERAL_try : { AST tmp143_AST = null ; tmp143_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp143_AST ) ; match ( LITERAL_try ) ; break ; } case LITERAL_volatile : { AST tmp144_AST = null ; tmp144_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp144_AST ) ; match ( LITERAL_volatile ) ; break ; } case LITERAL_while : { AST tmp145_AST = null ; tmp145_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp145_AST ) ; match ( LITERAL_while ) ; break ; } case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : { builtInType ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { keywordPropertyNames_AST = ( AST ) currentAST . root ; keywordPropertyNames_AST . setType ( IDENT ) ; } keywordPropertyNames_AST = ( AST ) currentAST . root ; returnAST = keywordPropertyNames_AST ; } public final void conditionalExpression ( int lc_stmt ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST conditionalExpression_AST = null ; logicalOrExpression ( lc_stmt ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case ELVIS_OPERATOR : { AST tmp146_AST = null ; tmp146_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp146_AST ) ; match ( ELVIS_OPERATOR ) ; nls ( ) ; conditionalExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case QUESTION : { AST tmp147_AST = null ; tmp147_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp147_AST ) ; match ( QUESTION ) ; nls ( ) ; assignmentExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; match ( COLON ) ; nls ( ) ; conditionalExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case EOF : case FINAL : case ABSTRACT : case UNUSED_GOTO : case UNUSED_DO : case STRICTFP : case LITERAL_package : case LITERAL_import : case LITERAL_static : case LITERAL_def : case LBRACK : case RBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case LITERAL_extends : case LITERAL_super : case COMMA : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_as : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case RPAREN : case ASSIGN : case LCURLY : case RCURLY : case SEMI : case NLS : case LITERAL_default : case LITERAL_throws : case LITERAL_implements : case LITERAL_this : case CLOSABLE_BLOCK_OP : case COLON : case LITERAL_if : case LITERAL_else : case LITERAL_while : case LITERAL_switch : case LITERAL_for : case LITERAL_in : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case PLUS : case MINUS : case LITERAL_case : case LITERAL_try : case LITERAL_finally : case LITERAL_catch : case LITERAL_false : case LITERAL_instanceof : case LITERAL_new : case LITERAL_null : case LITERAL_true : case PLUS_ASSIGN : case MINUS_ASSIGN : case STAR_ASSIGN : case DIV_ASSIGN : case MOD_ASSIGN : case SR_ASSIGN : case BSR_ASSIGN : case SL_ASSIGN : case BAND_ASSIGN : case BXOR_ASSIGN : case BOR_ASSIGN : case STAR_STAR_ASSIGN : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } conditionalExpression_AST = ( AST ) currentAST . root ; returnAST = conditionalExpression_AST ; } public final void annotationMemberArrayValueInitializer ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST annotationMemberArrayValueInitializer_AST = null ; switch ( LA ( <NUM_LIT:1> ) ) { case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LCURLY : case LITERAL_this : case PLUS : case MINUS : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { conditionalExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; annotationMemberArrayValueInitializer_AST = ( AST ) currentAST . root ; break ; } case AT : { annotation ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; nls ( ) ; annotationMemberArrayValueInitializer_AST = ( AST ) currentAST . root ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = annotationMemberArrayValueInitializer_AST ; } public final void superClassClause ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST superClassClause_AST = null ; AST c_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case LITERAL_extends : { match ( LITERAL_extends ) ; nls ( ) ; classOrInterfaceType ( false ) ; c_AST = ( AST ) returnAST ; nls ( ) ; break ; } case LCURLY : case LITERAL_implements : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { superClassClause_AST = ( AST ) currentAST . root ; superClassClause_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( EXTENDS_CLAUSE , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( c_AST ) ) ; currentAST . root = superClassClause_AST ; currentAST . child = superClassClause_AST != null && superClassClause_AST . getFirstChild ( ) != null ? superClassClause_AST . getFirstChild ( ) : superClassClause_AST ; currentAST . advanceChildToEnd ( ) ; } returnAST = superClassClause_AST ; } public final void implementsClause ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST implementsClause_AST = null ; Token i = null ; AST i_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case LITERAL_implements : { i = LT ( <NUM_LIT:1> ) ; i_AST = astFactory . create ( i ) ; match ( LITERAL_implements ) ; nls ( ) ; classOrInterfaceType ( true ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop176 : do { if ( ( LA ( <NUM_LIT:1> ) == COMMA ) ) { match ( COMMA ) ; nls ( ) ; classOrInterfaceType ( true ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop176 ; } } while ( true ) ; } nls ( ) ; break ; } case LCURLY : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { implementsClause_AST = ( AST ) currentAST . root ; implementsClause_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( IMPLEMENTS_CLAUSE , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( implementsClause_AST ) ) ; currentAST . root = implementsClause_AST ; currentAST . child = implementsClause_AST != null && implementsClause_AST . getFirstChild ( ) != null ? implementsClause_AST . getFirstChild ( ) : implementsClause_AST ; currentAST . advanceChildToEnd ( ) ; } implementsClause_AST = ( AST ) currentAST . root ; returnAST = implementsClause_AST ; } public final void classBlock ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST classBlock_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; try { match ( LCURLY ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case IDENT : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : { classField ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case RCURLY : case SEMI : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } { _loop120 : do { if ( ( LA ( <NUM_LIT:1> ) == SEMI || LA ( <NUM_LIT:1> ) == NLS ) ) { sep ( ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case IDENT : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : { classField ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case RCURLY : case SEMI : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } } else { break _loop120 ; } } while ( true ) ; } match ( RCURLY ) ; if ( inputState . guessing == <NUM_LIT:0> ) { classBlock_AST = ( AST ) currentAST . root ; classBlock_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( OBJBLOCK , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( classBlock_AST ) ) ; currentAST . root = classBlock_AST ; currentAST . child = classBlock_AST != null && classBlock_AST . getFirstChild ( ) != null ? classBlock_AST . getFirstChild ( ) : classBlock_AST ; currentAST . advanceChildToEnd ( ) ; } classBlock_AST = ( AST ) currentAST . root ; } catch ( RecognitionException e ) { if ( inputState . guessing == <NUM_LIT:0> ) { reportError ( e ) ; classBlock_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( OBJBLOCK , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( classBlock_AST ) ) ; currentAST . root = classBlock_AST ; currentAST . child = classBlock_AST != null && classBlock_AST . getFirstChild ( ) != null ? classBlock_AST . getFirstChild ( ) : classBlock_AST ; currentAST . advanceChildToEnd ( ) ; } else { throw e ; } } returnAST = classBlock_AST ; } public final void interfaceExtends ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST interfaceExtends_AST = null ; Token e = null ; AST e_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case LITERAL_extends : { e = LT ( <NUM_LIT:1> ) ; e_AST = astFactory . create ( e ) ; match ( LITERAL_extends ) ; nls ( ) ; classOrInterfaceType ( true ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop172 : do { if ( ( LA ( <NUM_LIT:1> ) == COMMA ) ) { match ( COMMA ) ; nls ( ) ; classOrInterfaceType ( true ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop172 ; } } while ( true ) ; } nls ( ) ; break ; } case LCURLY : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { interfaceExtends_AST = ( AST ) currentAST . root ; interfaceExtends_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( EXTENDS_CLAUSE , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( interfaceExtends_AST ) ) ; currentAST . root = interfaceExtends_AST ; currentAST . child = interfaceExtends_AST != null && interfaceExtends_AST . getFirstChild ( ) != null ? interfaceExtends_AST . getFirstChild ( ) : interfaceExtends_AST ; currentAST . advanceChildToEnd ( ) ; } interfaceExtends_AST = ( AST ) currentAST . root ; returnAST = interfaceExtends_AST ; } public final void interfaceBlock ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST interfaceBlock_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; match ( LCURLY ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case IDENT : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : { interfaceField ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case RCURLY : case SEMI : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } { _loop125 : do { if ( ( LA ( <NUM_LIT:1> ) == SEMI || LA ( <NUM_LIT:1> ) == NLS ) ) { sep ( ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case IDENT : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : { interfaceField ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case RCURLY : case SEMI : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } } else { break _loop125 ; } } while ( true ) ; } match ( RCURLY ) ; if ( inputState . guessing == <NUM_LIT:0> ) { interfaceBlock_AST = ( AST ) currentAST . root ; interfaceBlock_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( OBJBLOCK , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( interfaceBlock_AST ) ) ; currentAST . root = interfaceBlock_AST ; currentAST . child = interfaceBlock_AST != null && interfaceBlock_AST . getFirstChild ( ) != null ? interfaceBlock_AST . getFirstChild ( ) : interfaceBlock_AST ; currentAST . advanceChildToEnd ( ) ; } interfaceBlock_AST = ( AST ) currentAST . root ; returnAST = interfaceBlock_AST ; } public final void enumBlock ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST enumBlock_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; match ( LCURLY ) ; nls ( ) ; { boolean synPredMatched134 = false ; if ( ( ( LA ( <NUM_LIT:1> ) == IDENT || LA ( <NUM_LIT:1> ) == AT ) && ( _tokenSet_45 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m134 = mark ( ) ; synPredMatched134 = true ; inputState . guessing ++ ; try { { enumConstantsStart ( ) ; } } catch ( RecognitionException pe ) { synPredMatched134 = false ; } rewind ( _m134 ) ; inputState . guessing -- ; } if ( synPredMatched134 ) { enumConstants ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else if ( ( _tokenSet_46 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_47 . member ( LA ( <NUM_LIT:2> ) ) ) ) { { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case IDENT : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : { classField ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case RCURLY : case SEMI : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } { _loop138 : do { if ( ( LA ( <NUM_LIT:1> ) == SEMI || LA ( <NUM_LIT:1> ) == NLS ) ) { sep ( ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case IDENT : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : { classField ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case RCURLY : case SEMI : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } } else { break _loop138 ; } } while ( true ) ; } match ( RCURLY ) ; if ( inputState . guessing == <NUM_LIT:0> ) { enumBlock_AST = ( AST ) currentAST . root ; enumBlock_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( OBJBLOCK , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( enumBlock_AST ) ) ; currentAST . root = enumBlock_AST ; currentAST . child = enumBlock_AST != null && enumBlock_AST . getFirstChild ( ) != null ? enumBlock_AST . getFirstChild ( ) : enumBlock_AST ; currentAST . advanceChildToEnd ( ) ; } enumBlock_AST = ( AST ) currentAST . root ; returnAST = enumBlock_AST ; } public final void annotationBlock ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST annotationBlock_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; match ( LCURLY ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case IDENT : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : { annotationField ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case RCURLY : case SEMI : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } { _loop130 : do { if ( ( LA ( <NUM_LIT:1> ) == SEMI || LA ( <NUM_LIT:1> ) == NLS ) ) { sep ( ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case IDENT : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : { annotationField ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case RCURLY : case SEMI : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } } else { break _loop130 ; } } while ( true ) ; } match ( RCURLY ) ; if ( inputState . guessing == <NUM_LIT:0> ) { annotationBlock_AST = ( AST ) currentAST . root ; annotationBlock_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( OBJBLOCK , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( annotationBlock_AST ) ) ; currentAST . root = annotationBlock_AST ; currentAST . child = annotationBlock_AST != null && annotationBlock_AST . getFirstChild ( ) != null ? annotationBlock_AST . getFirstChild ( ) : annotationBlock_AST ; currentAST . advanceChildToEnd ( ) ; } annotationBlock_AST = ( AST ) currentAST . root ; returnAST = annotationBlock_AST ; } public final void typeParameter ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST typeParameter_AST = null ; Token id = null ; AST id_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; { id = LT ( <NUM_LIT:1> ) ; id_AST = astFactory . create ( id ) ; astFactory . addASTChild ( currentAST , id_AST ) ; match ( IDENT ) ; } { if ( ( LA ( <NUM_LIT:1> ) == LITERAL_extends ) && ( LA ( <NUM_LIT:2> ) == IDENT || LA ( <NUM_LIT:2> ) == NLS ) ) { typeParameterBounds ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else if ( ( _tokenSet_48 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_49 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } if ( inputState . guessing == <NUM_LIT:0> ) { typeParameter_AST = ( AST ) currentAST . root ; typeParameter_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( TYPE_PARAMETER , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( typeParameter_AST ) ) ; currentAST . root = typeParameter_AST ; currentAST . child = typeParameter_AST != null && typeParameter_AST . getFirstChild ( ) != null ? typeParameter_AST . getFirstChild ( ) : typeParameter_AST ; currentAST . advanceChildToEnd ( ) ; } typeParameter_AST = ( AST ) currentAST . root ; returnAST = typeParameter_AST ; } public final void typeParameterBounds ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST typeParameterBounds_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; match ( LITERAL_extends ) ; nls ( ) ; classOrInterfaceType ( true ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop115 : do { if ( ( LA ( <NUM_LIT:1> ) == BAND ) ) { match ( BAND ) ; nls ( ) ; classOrInterfaceType ( true ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop115 ; } } while ( true ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { typeParameterBounds_AST = ( AST ) currentAST . root ; typeParameterBounds_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( TYPE_UPPER_BOUNDS , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( typeParameterBounds_AST ) ) ; currentAST . root = typeParameterBounds_AST ; currentAST . child = typeParameterBounds_AST != null && typeParameterBounds_AST . getFirstChild ( ) != null ? typeParameterBounds_AST . getFirstChild ( ) : typeParameterBounds_AST ; currentAST . advanceChildToEnd ( ) ; } typeParameterBounds_AST = ( AST ) currentAST . root ; returnAST = typeParameterBounds_AST ; } public final void classField ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST classField_AST = null ; AST mc_AST = null ; AST ctor_AST = null ; AST dg_AST = null ; AST mad_AST = null ; AST dd_AST = null ; AST mods_AST = null ; AST td_AST = null ; AST s3_AST = null ; AST s4_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; try { boolean synPredMatched179 = false ; if ( ( ( _tokenSet_50 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_51 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m179 = mark ( ) ; synPredMatched179 = true ; inputState . guessing ++ ; try { { constructorStart ( ) ; } } catch ( RecognitionException pe ) { synPredMatched179 = false ; } rewind ( _m179 ) ; inputState . guessing -- ; } if ( synPredMatched179 ) { modifiersOpt ( ) ; mc_AST = ( AST ) returnAST ; constructorDefinition ( mc_AST ) ; ctor_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { classField_AST = ( AST ) currentAST . root ; classField_AST = ctor_AST ; currentAST . root = classField_AST ; currentAST . child = classField_AST != null && classField_AST . getFirstChild ( ) != null ? classField_AST . getFirstChild ( ) : classField_AST ; currentAST . advanceChildToEnd ( ) ; } } else { boolean synPredMatched181 = false ; if ( ( ( _tokenSet_9 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_10 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m181 = mark ( ) ; synPredMatched181 = true ; inputState . guessing ++ ; try { { genericMethodStart ( ) ; } } catch ( RecognitionException pe ) { synPredMatched181 = false ; } rewind ( _m181 ) ; inputState . guessing -- ; } if ( synPredMatched181 ) { genericMethod ( ) ; dg_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { classField_AST = ( AST ) currentAST . root ; classField_AST = dg_AST ; currentAST . root = classField_AST ; currentAST . child = classField_AST != null && classField_AST . getFirstChild ( ) != null ? classField_AST . getFirstChild ( ) : classField_AST ; currentAST . advanceChildToEnd ( ) ; } } else { boolean synPredMatched183 = false ; if ( ( ( _tokenSet_9 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_11 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m183 = mark ( ) ; synPredMatched183 = true ; inputState . guessing ++ ; try { { multipleAssignmentDeclarationStart ( ) ; } } catch ( RecognitionException pe ) { synPredMatched183 = false ; } rewind ( _m183 ) ; inputState . guessing -- ; } if ( synPredMatched183 ) { multipleAssignmentDeclaration ( ) ; mad_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { classField_AST = ( AST ) currentAST . root ; classField_AST = mad_AST ; currentAST . root = classField_AST ; currentAST . child = classField_AST != null && classField_AST . getFirstChild ( ) != null ? classField_AST . getFirstChild ( ) : classField_AST ; currentAST . advanceChildToEnd ( ) ; } } else { boolean synPredMatched185 = false ; if ( ( ( _tokenSet_12 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_13 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m185 = mark ( ) ; synPredMatched185 = true ; inputState . guessing ++ ; try { { declarationStart ( ) ; } } catch ( RecognitionException pe ) { synPredMatched185 = false ; } rewind ( _m185 ) ; inputState . guessing -- ; } if ( synPredMatched185 ) { declaration ( ) ; dd_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { classField_AST = ( AST ) currentAST . root ; classField_AST = dd_AST ; currentAST . root = classField_AST ; currentAST . child = classField_AST != null && classField_AST . getFirstChild ( ) != null ? classField_AST . getFirstChild ( ) : classField_AST ; currentAST . advanceChildToEnd ( ) ; } } else { boolean synPredMatched187 = false ; if ( ( ( _tokenSet_17 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_18 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m187 = mark ( ) ; synPredMatched187 = true ; inputState . guessing ++ ; try { { typeDeclarationStart ( ) ; } } catch ( RecognitionException pe ) { synPredMatched187 = false ; } rewind ( _m187 ) ; inputState . guessing -- ; } if ( synPredMatched187 ) { modifiersOpt ( ) ; mods_AST = ( AST ) returnAST ; { typeDefinitionInternal ( mods_AST ) ; td_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { classField_AST = ( AST ) currentAST . root ; classField_AST = td_AST ; currentAST . root = classField_AST ; currentAST . child = classField_AST != null && classField_AST . getFirstChild ( ) != null ? classField_AST . getFirstChild ( ) : classField_AST ; currentAST . advanceChildToEnd ( ) ; } } } else if ( ( LA ( <NUM_LIT:1> ) == LITERAL_static ) && ( LA ( <NUM_LIT:2> ) == LCURLY || LA ( <NUM_LIT:2> ) == NLS ) ) { match ( LITERAL_static ) ; nls ( ) ; compoundStatement ( ) ; s3_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { classField_AST = ( AST ) currentAST . root ; classField_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( STATIC_INIT , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( s3_AST ) ) ; currentAST . root = classField_AST ; currentAST . child = classField_AST != null && classField_AST . getFirstChild ( ) != null ? classField_AST . getFirstChild ( ) : classField_AST ; currentAST . advanceChildToEnd ( ) ; } } else if ( ( LA ( <NUM_LIT:1> ) == LCURLY ) ) { compoundStatement ( ) ; s4_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { classField_AST = ( AST ) currentAST . root ; classField_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( INSTANCE_INIT , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( s4_AST ) ) ; currentAST . root = classField_AST ; currentAST . child = classField_AST != null && classField_AST . getFirstChild ( ) != null ? classField_AST . getFirstChild ( ) : classField_AST ; currentAST . advanceChildToEnd ( ) ; } } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } } } } catch ( RecognitionException e ) { if ( inputState . guessing == <NUM_LIT:0> ) { reportError ( e ) ; classField_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:4> ) ) . add ( create ( VARIABLE_DEF , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( null ) . add ( create ( TYPE , "<STR_LIT>" , LT ( <NUM_LIT:1> ) , LT ( <NUM_LIT:2> ) ) ) . add ( create ( IDENT , first . getText ( ) , LT ( <NUM_LIT:1> ) , LT ( <NUM_LIT:2> ) ) ) ) ; consumeUntil ( NLS ) ; } else { throw e ; } } returnAST = classField_AST ; } public final void interfaceField ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST interfaceField_AST = null ; AST d_AST = null ; AST mods_AST = null ; AST td_AST = null ; boolean synPredMatched191 = false ; if ( ( ( _tokenSet_12 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_13 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m191 = mark ( ) ; synPredMatched191 = true ; inputState . guessing ++ ; try { { declarationStart ( ) ; } } catch ( RecognitionException pe ) { synPredMatched191 = false ; } rewind ( _m191 ) ; inputState . guessing -- ; } if ( synPredMatched191 ) { declaration ( ) ; d_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { interfaceField_AST = ( AST ) currentAST . root ; interfaceField_AST = d_AST ; currentAST . root = interfaceField_AST ; currentAST . child = interfaceField_AST != null && interfaceField_AST . getFirstChild ( ) != null ? interfaceField_AST . getFirstChild ( ) : interfaceField_AST ; currentAST . advanceChildToEnd ( ) ; } } else { boolean synPredMatched193 = false ; if ( ( ( _tokenSet_17 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_18 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m193 = mark ( ) ; synPredMatched193 = true ; inputState . guessing ++ ; try { { typeDeclarationStart ( ) ; } } catch ( RecognitionException pe ) { synPredMatched193 = false ; } rewind ( _m193 ) ; inputState . guessing -- ; } if ( synPredMatched193 ) { modifiersOpt ( ) ; mods_AST = ( AST ) returnAST ; { typeDefinitionInternal ( mods_AST ) ; td_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { interfaceField_AST = ( AST ) currentAST . root ; interfaceField_AST = td_AST ; currentAST . root = interfaceField_AST ; currentAST . child = interfaceField_AST != null && interfaceField_AST . getFirstChild ( ) != null ? interfaceField_AST . getFirstChild ( ) : interfaceField_AST ; currentAST . advanceChildToEnd ( ) ; } } } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = interfaceField_AST ; } public final void annotationField ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST annotationField_AST = null ; AST mods_AST = null ; AST td_AST = null ; AST t_AST = null ; Token i = null ; AST i_AST = null ; AST amvi_AST = null ; AST v_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; modifiersOpt ( ) ; mods_AST = ( AST ) returnAST ; { switch ( LA ( <NUM_LIT:1> ) ) { case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : { typeDefinitionInternal ( mods_AST ) ; td_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { annotationField_AST = ( AST ) currentAST . root ; annotationField_AST = td_AST ; currentAST . root = annotationField_AST ; currentAST . child = annotationField_AST != null && annotationField_AST . getFirstChild ( ) != null ? annotationField_AST . getFirstChild ( ) : annotationField_AST ; currentAST . advanceChildToEnd ( ) ; } break ; } case IDENT : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : { typeSpec ( false ) ; t_AST = ( AST ) returnAST ; { boolean synPredMatched149 = false ; if ( ( ( LA ( <NUM_LIT:1> ) == IDENT ) && ( LA ( <NUM_LIT:2> ) == LPAREN ) ) ) { int _m149 = mark ( ) ; synPredMatched149 = true ; inputState . guessing ++ ; try { { match ( IDENT ) ; match ( LPAREN ) ; } } catch ( RecognitionException pe ) { synPredMatched149 = false ; } rewind ( _m149 ) ; inputState . guessing -- ; } if ( synPredMatched149 ) { i = LT ( <NUM_LIT:1> ) ; i_AST = astFactory . create ( i ) ; match ( IDENT ) ; match ( LPAREN ) ; match ( RPAREN ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case LITERAL_default : { match ( LITERAL_default ) ; nls ( ) ; annotationMemberValueInitializer ( ) ; amvi_AST = ( AST ) returnAST ; break ; } case RCURLY : case SEMI : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { annotationField_AST = ( AST ) currentAST . root ; annotationField_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:5> ) ) . add ( create ( ANNOTATION_FIELD_DEF , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( mods_AST ) . add ( ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( TYPE , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( t_AST ) ) ) . add ( i_AST ) . add ( amvi_AST ) ) ; currentAST . root = annotationField_AST ; currentAST . child = annotationField_AST != null && annotationField_AST . getFirstChild ( ) != null ? annotationField_AST . getFirstChild ( ) : annotationField_AST ; currentAST . advanceChildToEnd ( ) ; } } else if ( ( LA ( <NUM_LIT:1> ) == IDENT || LA ( <NUM_LIT:1> ) == STRING_LITERAL ) && ( _tokenSet_52 . member ( LA ( <NUM_LIT:2> ) ) ) ) { variableDefinitions ( mods_AST , t_AST ) ; v_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { annotationField_AST = ( AST ) currentAST . root ; annotationField_AST = v_AST ; currentAST . root = annotationField_AST ; currentAST . child = annotationField_AST != null && annotationField_AST . getFirstChild ( ) != null ? annotationField_AST . getFirstChild ( ) : annotationField_AST ; currentAST . advanceChildToEnd ( ) ; } } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } returnAST = annotationField_AST ; } public final void enumConstantsStart ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST enumConstantsStart_AST = null ; enumConstant ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case COMMA : { AST tmp166_AST = null ; tmp166_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp166_AST ) ; match ( COMMA ) ; break ; } case SEMI : { AST tmp167_AST = null ; tmp167_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp167_AST ) ; match ( SEMI ) ; break ; } case NLS : { AST tmp168_AST = null ; tmp168_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp168_AST ) ; match ( NLS ) ; break ; } case RCURLY : { AST tmp169_AST = null ; tmp169_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp169_AST ) ; match ( RCURLY ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } enumConstantsStart_AST = ( AST ) currentAST . root ; returnAST = enumConstantsStart_AST ; } public final void enumConstants ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST enumConstants_AST = null ; enumConstant ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop143 : do { if ( ( LA ( <NUM_LIT:1> ) == COMMA ) && ( _tokenSet_53 . member ( LA ( <NUM_LIT:2> ) ) ) ) { match ( COMMA ) ; nls ( ) ; enumConstant ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop143 ; } } while ( true ) ; } { switch ( LA ( <NUM_LIT:1> ) ) { case COMMA : { match ( COMMA ) ; nls ( ) ; break ; } case RCURLY : case SEMI : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } enumConstants_AST = ( AST ) currentAST . root ; returnAST = enumConstants_AST ; } public final void enumConstant ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST enumConstant_AST = null ; AST an_AST = null ; Token i = null ; AST i_AST = null ; AST a_AST = null ; AST b_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; annotationsOpt ( ) ; an_AST = ( AST ) returnAST ; i = LT ( <NUM_LIT:1> ) ; i_AST = astFactory . create ( i ) ; match ( IDENT ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case LPAREN : { match ( LPAREN ) ; argList ( ) ; a_AST = ( AST ) returnAST ; match ( RPAREN ) ; break ; } case COMMA : case LCURLY : case RCURLY : case SEMI : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } { switch ( LA ( <NUM_LIT:1> ) ) { case LCURLY : { enumConstantBlock ( ) ; b_AST = ( AST ) returnAST ; break ; } case COMMA : case RCURLY : case SEMI : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { enumConstant_AST = ( AST ) currentAST . root ; enumConstant_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:5> ) ) . add ( create ( ENUM_CONSTANT_DEF , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( an_AST ) . add ( i_AST ) . add ( a_AST ) . add ( b_AST ) ) ; currentAST . root = enumConstant_AST ; currentAST . child = enumConstant_AST != null && enumConstant_AST . getFirstChild ( ) != null ? enumConstant_AST . getFirstChild ( ) : enumConstant_AST ; currentAST . advanceChildToEnd ( ) ; } returnAST = enumConstant_AST ; } public final void argList ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST argList_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; Token lastComma = null ; int hls = <NUM_LIT:0> , hls2 = <NUM_LIT:0> ; boolean hasClosureList = false ; boolean trailingComma = false ; boolean sce = false ; { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case UNUSED_GOTO : case UNUSED_DO : case STRICTFP : case LITERAL_package : case LITERAL_import : case LITERAL_static : case LITERAL_def : case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_extends : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case STAR : case LITERAL_as : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : case LITERAL_default : case LITERAL_throws : case LITERAL_implements : case LITERAL_this : case LITERAL_if : case LITERAL_else : case LITERAL_while : case LITERAL_switch : case LITERAL_for : case LITERAL_in : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case PLUS : case MINUS : case LITERAL_case : case LITERAL_try : case LITERAL_finally : case LITERAL_catch : case LITERAL_false : case LITERAL_instanceof : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { hls = argument ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case SEMI : { { { int _cnt495 = <NUM_LIT:0> ; _loop495 : do { if ( ( LA ( <NUM_LIT:1> ) == SEMI ) ) { match ( SEMI ) ; if ( inputState . guessing == <NUM_LIT:0> ) { hasClosureList = true ; } { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case AT : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : case LITERAL_this : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case PLUS : case MINUS : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { sce = strictContextExpression ( true ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case RBRACK : case RPAREN : case SEMI : { if ( inputState . guessing == <NUM_LIT:0> ) { astFactory . addASTChild ( currentAST , astFactory . create ( EMPTY_STAT , "<STR_LIT>" ) ) ; } break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } } else { if ( _cnt495 >= <NUM_LIT:1> ) { break _loop495 ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } _cnt495 ++ ; } while ( true ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { argList_AST = ( AST ) currentAST . root ; argList_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( CLOSURE_LIST , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( argList_AST ) ) ; currentAST . root = argList_AST ; currentAST . child = argList_AST != null && argList_AST . getFirstChild ( ) != null ? argList_AST . getFirstChild ( ) : argList_AST ; currentAST . advanceChildToEnd ( ) ; } } break ; } case RBRACK : case COMMA : case RPAREN : { { { _loop501 : do { if ( ( LA ( <NUM_LIT:1> ) == COMMA ) ) { if ( inputState . guessing == <NUM_LIT:0> ) { lastComma = LT ( <NUM_LIT:1> ) ; } match ( COMMA ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case UNUSED_GOTO : case UNUSED_DO : case STRICTFP : case LITERAL_package : case LITERAL_import : case LITERAL_static : case LITERAL_def : case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_extends : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case STAR : case LITERAL_as : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : case LITERAL_default : case LITERAL_throws : case LITERAL_implements : case LITERAL_this : case LITERAL_if : case LITERAL_else : case LITERAL_while : case LITERAL_switch : case LITERAL_for : case LITERAL_in : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case PLUS : case MINUS : case LITERAL_case : case LITERAL_try : case LITERAL_finally : case LITERAL_catch : case LITERAL_false : case LITERAL_instanceof : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { { hls2 = argument ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; if ( inputState . guessing == <NUM_LIT:0> ) { hls |= hls2 ; } } break ; } case RBRACK : case COMMA : case RPAREN : { { if ( inputState . guessing == <NUM_LIT:0> ) { if ( trailingComma ) throw new NoViableAltException ( lastComma , getFilename ( ) ) ; trailingComma = true ; } } break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } } else { break _loop501 ; } } while ( true ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { argList_AST = ( AST ) currentAST . root ; argList_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( ELIST , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( argList_AST ) ) ; currentAST . root = argList_AST ; currentAST . child = argList_AST != null && argList_AST . getFirstChild ( ) != null ? argList_AST . getFirstChild ( ) : argList_AST ; currentAST . advanceChildToEnd ( ) ; } } break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } break ; } case RBRACK : case RPAREN : { { if ( inputState . guessing == <NUM_LIT:0> ) { argList_AST = ( AST ) currentAST . root ; argList_AST = create ( ELIST , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ; currentAST . root = argList_AST ; currentAST . child = argList_AST != null && argList_AST . getFirstChild ( ) != null ? argList_AST . getFirstChild ( ) : argList_AST ; currentAST . advanceChildToEnd ( ) ; } } break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { argListHasLabels = ( hls & <NUM_LIT:1> ) != <NUM_LIT:0> ; } argList_AST = ( AST ) currentAST . root ; returnAST = argList_AST ; } public final void enumConstantBlock ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST enumConstantBlock_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; match ( LCURLY ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case IDENT : case LT : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : { enumConstantField ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case RCURLY : case SEMI : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } { _loop158 : do { if ( ( LA ( <NUM_LIT:1> ) == SEMI || LA ( <NUM_LIT:1> ) == NLS ) ) { sep ( ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case IDENT : case LT : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : { enumConstantField ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case RCURLY : case SEMI : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } } else { break _loop158 ; } } while ( true ) ; } match ( RCURLY ) ; if ( inputState . guessing == <NUM_LIT:0> ) { enumConstantBlock_AST = ( AST ) currentAST . root ; enumConstantBlock_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( OBJBLOCK , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( enumConstantBlock_AST ) ) ; currentAST . root = enumConstantBlock_AST ; currentAST . child = enumConstantBlock_AST != null && enumConstantBlock_AST . getFirstChild ( ) != null ? enumConstantBlock_AST . getFirstChild ( ) : enumConstantBlock_AST ; currentAST . advanceChildToEnd ( ) ; } enumConstantBlock_AST = ( AST ) currentAST . root ; returnAST = enumConstantBlock_AST ; } public final void enumConstantField ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST enumConstantField_AST = null ; AST mods_AST = null ; AST td_AST = null ; AST tp_AST = null ; AST t_AST = null ; AST param_AST = null ; AST tc_AST = null ; AST s2_AST = null ; AST v_AST = null ; AST s4_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case IDENT : case LT : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : { modifiersOpt ( ) ; mods_AST = ( AST ) returnAST ; { switch ( LA ( <NUM_LIT:1> ) ) { case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : { typeDefinitionInternal ( mods_AST ) ; td_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { enumConstantField_AST = ( AST ) currentAST . root ; enumConstantField_AST = td_AST ; currentAST . root = enumConstantField_AST ; currentAST . child = enumConstantField_AST != null && enumConstantField_AST . getFirstChild ( ) != null ? enumConstantField_AST . getFirstChild ( ) : enumConstantField_AST ; currentAST . advanceChildToEnd ( ) ; } break ; } case IDENT : case LT : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : { { switch ( LA ( <NUM_LIT:1> ) ) { case LT : { typeParameters ( ) ; tp_AST = ( AST ) returnAST ; break ; } case IDENT : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } typeSpec ( false ) ; t_AST = ( AST ) returnAST ; { boolean synPredMatched164 = false ; if ( ( ( LA ( <NUM_LIT:1> ) == IDENT ) && ( LA ( <NUM_LIT:2> ) == LPAREN ) ) ) { int _m164 = mark ( ) ; synPredMatched164 = true ; inputState . guessing ++ ; try { { match ( IDENT ) ; match ( LPAREN ) ; } } catch ( RecognitionException pe ) { synPredMatched164 = false ; } rewind ( _m164 ) ; inputState . guessing -- ; } if ( synPredMatched164 ) { AST tmp178_AST = null ; tmp178_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( IDENT ) ; match ( LPAREN ) ; parameterDeclarationList ( ) ; param_AST = ( AST ) returnAST ; match ( RPAREN ) ; { boolean synPredMatched167 = false ; if ( ( ( LA ( <NUM_LIT:1> ) == NLS || LA ( <NUM_LIT:1> ) == LITERAL_throws ) && ( _tokenSet_24 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m167 = mark ( ) ; synPredMatched167 = true ; inputState . guessing ++ ; try { { nls ( ) ; match ( LITERAL_throws ) ; } } catch ( RecognitionException pe ) { synPredMatched167 = false ; } rewind ( _m167 ) ; inputState . guessing -- ; } if ( synPredMatched167 ) { throwsClause ( ) ; tc_AST = ( AST ) returnAST ; } else if ( ( ( LA ( <NUM_LIT:1> ) >= LCURLY && LA ( <NUM_LIT:1> ) <= NLS ) ) && ( _tokenSet_54 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } { switch ( LA ( <NUM_LIT:1> ) ) { case LCURLY : { compoundStatement ( ) ; s2_AST = ( AST ) returnAST ; break ; } case RCURLY : case SEMI : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { enumConstantField_AST = ( AST ) currentAST . root ; enumConstantField_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:8> ) ) . add ( create ( METHOD_DEF , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( mods_AST ) . add ( tp_AST ) . add ( ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( TYPE , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( t_AST ) ) ) . add ( tmp178_AST ) . add ( param_AST ) . add ( tc_AST ) . add ( s2_AST ) ) ; currentAST . root = enumConstantField_AST ; currentAST . child = enumConstantField_AST != null && enumConstantField_AST . getFirstChild ( ) != null ? enumConstantField_AST . getFirstChild ( ) : enumConstantField_AST ; currentAST . advanceChildToEnd ( ) ; } } else if ( ( LA ( <NUM_LIT:1> ) == IDENT || LA ( <NUM_LIT:1> ) == STRING_LITERAL ) && ( _tokenSet_52 . member ( LA ( <NUM_LIT:2> ) ) ) ) { variableDefinitions ( mods_AST , t_AST ) ; v_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { enumConstantField_AST = ( AST ) currentAST . root ; enumConstantField_AST = v_AST ; currentAST . root = enumConstantField_AST ; currentAST . child = enumConstantField_AST != null && enumConstantField_AST . getFirstChild ( ) != null ? enumConstantField_AST . getFirstChild ( ) : enumConstantField_AST ; currentAST . advanceChildToEnd ( ) ; } } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } break ; } case LCURLY : { compoundStatement ( ) ; s4_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { enumConstantField_AST = ( AST ) currentAST . root ; enumConstantField_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( INSTANCE_INIT , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( s4_AST ) ) ; currentAST . root = enumConstantField_AST ; currentAST . child = enumConstantField_AST != null && enumConstantField_AST . getFirstChild ( ) != null ? enumConstantField_AST . getFirstChild ( ) : enumConstantField_AST ; currentAST . advanceChildToEnd ( ) ; } break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = enumConstantField_AST ; } public final void parameterDeclarationList ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST parameterDeclarationList_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case LITERAL_def : case IDENT : case AT : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case TRIPLE_DOT : { parameterDeclaration ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop243 : do { if ( ( LA ( <NUM_LIT:1> ) == COMMA ) ) { match ( COMMA ) ; nls ( ) ; parameterDeclaration ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop243 ; } } while ( true ) ; } break ; } case RPAREN : case NLS : case CLOSABLE_BLOCK_OP : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { parameterDeclarationList_AST = ( AST ) currentAST . root ; parameterDeclarationList_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( PARAMETERS , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( parameterDeclarationList_AST ) ) ; currentAST . root = parameterDeclarationList_AST ; currentAST . child = parameterDeclarationList_AST != null && parameterDeclarationList_AST . getFirstChild ( ) != null ? parameterDeclarationList_AST . getFirstChild ( ) : parameterDeclarationList_AST ; currentAST . advanceChildToEnd ( ) ; } parameterDeclarationList_AST = ( AST ) currentAST . root ; returnAST = parameterDeclarationList_AST ; } public final void throwsClause ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST throwsClause_AST = null ; nls ( ) ; AST tmp182_AST = null ; tmp182_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp182_AST ) ; match ( LITERAL_throws ) ; nls ( ) ; identifier ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop239 : do { if ( ( LA ( <NUM_LIT:1> ) == COMMA ) ) { match ( COMMA ) ; nls ( ) ; identifier ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop239 ; } } while ( true ) ; } throwsClause_AST = ( AST ) currentAST . root ; returnAST = throwsClause_AST ; } public final void compoundStatement ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST compoundStatement_AST = null ; openBlock ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; compoundStatement_AST = ( AST ) currentAST . root ; returnAST = compoundStatement_AST ; } public final void constructorDefinition ( AST mods ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST constructorDefinition_AST = null ; Token id = null ; AST id_AST = null ; AST param_AST = null ; AST tc_AST = null ; AST cb_AST = null ; Token first = cloneToken ( LT ( <NUM_LIT:1> ) ) ; if ( mods != null ) { first . setLine ( mods . getLine ( ) ) ; first . setColumn ( mods . getColumn ( ) ) ; } id = LT ( <NUM_LIT:1> ) ; id_AST = astFactory . create ( id ) ; astFactory . addASTChild ( currentAST , id_AST ) ; match ( IDENT ) ; match ( LPAREN ) ; parameterDeclarationList ( ) ; param_AST = ( AST ) returnAST ; match ( RPAREN ) ; { boolean synPredMatched228 = false ; if ( ( ( LA ( <NUM_LIT:1> ) == NLS || LA ( <NUM_LIT:1> ) == LITERAL_throws ) && ( _tokenSet_24 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m228 = mark ( ) ; synPredMatched228 = true ; inputState . guessing ++ ; try { { nls ( ) ; match ( LITERAL_throws ) ; } } catch ( RecognitionException pe ) { synPredMatched228 = false ; } rewind ( _m228 ) ; inputState . guessing -- ; } if ( synPredMatched228 ) { throwsClause ( ) ; tc_AST = ( AST ) returnAST ; } else if ( ( LA ( <NUM_LIT:1> ) == LCURLY || LA ( <NUM_LIT:1> ) == NLS ) && ( _tokenSet_55 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } nlsWarn ( ) ; if ( inputState . guessing == <NUM_LIT:0> ) { isConstructorIdent ( id ) ; } constructorBody ( ) ; cb_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { constructorDefinition_AST = ( AST ) currentAST . root ; constructorDefinition_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:5> ) ) . add ( create ( CTOR_IDENT , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( mods ) . add ( param_AST ) . add ( tc_AST ) . add ( cb_AST ) ) ; currentAST . root = constructorDefinition_AST ; currentAST . child = constructorDefinition_AST != null && constructorDefinition_AST . getFirstChild ( ) != null ? constructorDefinition_AST . getFirstChild ( ) : constructorDefinition_AST ; currentAST . advanceChildToEnd ( ) ; } constructorDefinition_AST = ( AST ) currentAST . root ; returnAST = constructorDefinition_AST ; } public final void multipleAssignmentDeclarationStart ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST multipleAssignmentDeclarationStart_AST = null ; { _loop208 : do { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : { modifier ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; nls ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case AT : { annotation ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; nls ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } default : { break _loop208 ; } } } while ( true ) ; } AST tmp186_AST = null ; tmp186_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp186_AST ) ; match ( LITERAL_def ) ; nls ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; AST tmp187_AST = null ; tmp187_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp187_AST ) ; match ( LPAREN ) ; multipleAssignmentDeclarationStart_AST = ( AST ) currentAST . root ; returnAST = multipleAssignmentDeclarationStart_AST ; } public final void multipleAssignmentDeclaration ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST multipleAssignmentDeclaration_AST = null ; AST mods_AST = null ; AST t_AST = null ; Token first = cloneToken ( LT ( <NUM_LIT:1> ) ) ; modifiers ( ) ; mods_AST = ( AST ) returnAST ; { switch ( LA ( <NUM_LIT:1> ) ) { case IDENT : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : { typeSpec ( false ) ; t_AST = ( AST ) returnAST ; break ; } case LPAREN : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } AST tmp188_AST = null ; tmp188_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp188_AST ) ; match ( LPAREN ) ; nls ( ) ; typeNamePairs ( mods_AST , first ) ; astFactory . addASTChild ( currentAST , returnAST ) ; match ( RPAREN ) ; AST tmp190_AST = null ; tmp190_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp190_AST ) ; match ( ASSIGN ) ; nls ( ) ; assignmentExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; if ( inputState . guessing == <NUM_LIT:0> ) { multipleAssignmentDeclaration_AST = ( AST ) currentAST . root ; multipleAssignmentDeclaration_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:4> ) ) . add ( create ( VARIABLE_DEF , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( mods_AST ) . add ( ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( TYPE , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( t_AST ) ) ) . add ( multipleAssignmentDeclaration_AST ) ) ; currentAST . root = multipleAssignmentDeclaration_AST ; currentAST . child = multipleAssignmentDeclaration_AST != null && multipleAssignmentDeclaration_AST . getFirstChild ( ) != null ? multipleAssignmentDeclaration_AST . getFirstChild ( ) : multipleAssignmentDeclaration_AST ; currentAST . advanceChildToEnd ( ) ; } multipleAssignmentDeclaration_AST = ( AST ) currentAST . root ; returnAST = multipleAssignmentDeclaration_AST ; } public final void constructorBody ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST constructorBody_AST = null ; AST eci_AST = null ; AST bb1_AST = null ; AST bb2_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; match ( LCURLY ) ; nls ( ) ; { boolean synPredMatched198 = false ; if ( ( ( _tokenSet_56 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_57 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m198 = mark ( ) ; synPredMatched198 = true ; inputState . guessing ++ ; try { { explicitConstructorInvocation ( ) ; } } catch ( RecognitionException pe ) { synPredMatched198 = false ; } rewind ( _m198 ) ; inputState . guessing -- ; } if ( synPredMatched198 ) { explicitConstructorInvocation ( ) ; eci_AST = ( AST ) returnAST ; { switch ( LA ( <NUM_LIT:1> ) ) { case SEMI : case NLS : { sep ( ) ; blockBody ( sepToken ) ; bb1_AST = ( AST ) returnAST ; break ; } case RCURLY : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } } else if ( ( _tokenSet_26 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_58 . member ( LA ( <NUM_LIT:2> ) ) ) ) { blockBody ( EOF ) ; bb2_AST = ( AST ) returnAST ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } match ( RCURLY ) ; if ( inputState . guessing == <NUM_LIT:0> ) { constructorBody_AST = ( AST ) currentAST . root ; if ( eci_AST != null ) constructorBody_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( SLIST , "<STR_LIT:{>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( eci_AST ) . add ( bb1_AST ) ) ; else constructorBody_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( SLIST , "<STR_LIT:{>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( bb2_AST ) ) ; currentAST . root = constructorBody_AST ; currentAST . child = constructorBody_AST != null && constructorBody_AST . getFirstChild ( ) != null ? constructorBody_AST . getFirstChild ( ) : constructorBody_AST ; currentAST . advanceChildToEnd ( ) ; } constructorBody_AST = ( AST ) currentAST . root ; returnAST = constructorBody_AST ; } public final void explicitConstructorInvocation ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST explicitConstructorInvocation_AST = null ; Token lp1 = null ; AST lp1_AST = null ; Token lp2 = null ; AST lp2_AST = null ; { switch ( LA ( <NUM_LIT:1> ) ) { case LT : { typeArguments ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case LITERAL_super : case LITERAL_this : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } { switch ( LA ( <NUM_LIT:1> ) ) { case LITERAL_this : { match ( LITERAL_this ) ; lp1 = LT ( <NUM_LIT:1> ) ; lp1_AST = astFactory . create ( lp1 ) ; astFactory . makeASTRoot ( currentAST , lp1_AST ) ; match ( LPAREN ) ; argList ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; match ( RPAREN ) ; if ( inputState . guessing == <NUM_LIT:0> ) { lp1_AST . setType ( CTOR_CALL ) ; } break ; } case LITERAL_super : { match ( LITERAL_super ) ; lp2 = LT ( <NUM_LIT:1> ) ; lp2_AST = astFactory . create ( lp2 ) ; astFactory . makeASTRoot ( currentAST , lp2_AST ) ; match ( LPAREN ) ; argList ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; match ( RPAREN ) ; if ( inputState . guessing == <NUM_LIT:0> ) { lp2_AST . setType ( SUPER_CTOR_CALL ) ; } break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } explicitConstructorInvocation_AST = ( AST ) currentAST . root ; returnAST = explicitConstructorInvocation_AST ; } public final void listOfVariables ( AST mods , AST t , Token first ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST listOfVariables_AST = null ; variableDeclarator ( getASTFactory ( ) . dupTree ( mods ) , getASTFactory ( ) . dupTree ( t ) , first ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop205 : do { if ( ( LA ( <NUM_LIT:1> ) == COMMA ) ) { match ( COMMA ) ; nls ( ) ; if ( inputState . guessing == <NUM_LIT:0> ) { first = LT ( <NUM_LIT:1> ) ; } variableDeclarator ( getASTFactory ( ) . dupTree ( mods ) , getASTFactory ( ) . dupTree ( t ) , first ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop205 ; } } while ( true ) ; } listOfVariables_AST = ( AST ) currentAST . root ; returnAST = listOfVariables_AST ; } public final void variableDeclarator ( AST mods , AST t , Token first ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST variableDeclarator_AST = null ; AST id_AST = null ; AST v_AST = null ; variableName ( ) ; id_AST = ( AST ) returnAST ; { switch ( LA ( <NUM_LIT:1> ) ) { case ASSIGN : { varInitializer ( ) ; v_AST = ( AST ) returnAST ; break ; } case EOF : case COMMA : case RPAREN : case RCURLY : case SEMI : case NLS : case LITERAL_default : case LITERAL_else : case LITERAL_case : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { variableDeclarator_AST = ( AST ) currentAST . root ; variableDeclarator_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:5> ) ) . add ( create ( VARIABLE_DEF , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( mods ) . add ( ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( TYPE , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( t ) ) ) . add ( id_AST ) . add ( v_AST ) ) ; currentAST . root = variableDeclarator_AST ; currentAST . child = variableDeclarator_AST != null && variableDeclarator_AST . getFirstChild ( ) != null ? variableDeclarator_AST . getFirstChild ( ) : variableDeclarator_AST ; currentAST . advanceChildToEnd ( ) ; } returnAST = variableDeclarator_AST ; } public final void typeNamePairs ( AST mods , Token first ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST typeNamePairs_AST = null ; AST t_AST = null ; AST tn_AST = null ; { if ( ( _tokenSet_20 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_27 . member ( LA ( <NUM_LIT:2> ) ) ) ) { typeSpec ( false ) ; t_AST = ( AST ) returnAST ; } else if ( ( LA ( <NUM_LIT:1> ) == IDENT ) && ( LA ( <NUM_LIT:2> ) == COMMA || LA ( <NUM_LIT:2> ) == RPAREN ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } singleVariable ( getASTFactory ( ) . dupTree ( mods ) , t_AST ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop213 : do { if ( ( LA ( <NUM_LIT:1> ) == COMMA ) ) { match ( COMMA ) ; nls ( ) ; if ( inputState . guessing == <NUM_LIT:0> ) { first = LT ( <NUM_LIT:1> ) ; } { if ( ( _tokenSet_20 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_27 . member ( LA ( <NUM_LIT:2> ) ) ) ) { typeSpec ( false ) ; tn_AST = ( AST ) returnAST ; } else if ( ( LA ( <NUM_LIT:1> ) == IDENT ) && ( LA ( <NUM_LIT:2> ) == COMMA || LA ( <NUM_LIT:2> ) == RPAREN ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } singleVariable ( getASTFactory ( ) . dupTree ( mods ) , tn_AST ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop213 ; } } while ( true ) ; } typeNamePairs_AST = ( AST ) currentAST . root ; returnAST = typeNamePairs_AST ; } public final void assignmentExpression ( int lc_stmt ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST assignmentExpression_AST = null ; conditionalExpression ( lc_stmt ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case ASSIGN : case PLUS_ASSIGN : case MINUS_ASSIGN : case STAR_ASSIGN : case DIV_ASSIGN : case MOD_ASSIGN : case SR_ASSIGN : case BSR_ASSIGN : case SL_ASSIGN : case BAND_ASSIGN : case BXOR_ASSIGN : case BOR_ASSIGN : case STAR_STAR_ASSIGN : { { switch ( LA ( <NUM_LIT:1> ) ) { case ASSIGN : { AST tmp199_AST = null ; tmp199_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp199_AST ) ; match ( ASSIGN ) ; break ; } case PLUS_ASSIGN : { AST tmp200_AST = null ; tmp200_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp200_AST ) ; match ( PLUS_ASSIGN ) ; break ; } case MINUS_ASSIGN : { AST tmp201_AST = null ; tmp201_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp201_AST ) ; match ( MINUS_ASSIGN ) ; break ; } case STAR_ASSIGN : { AST tmp202_AST = null ; tmp202_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp202_AST ) ; match ( STAR_ASSIGN ) ; break ; } case DIV_ASSIGN : { AST tmp203_AST = null ; tmp203_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp203_AST ) ; match ( DIV_ASSIGN ) ; break ; } case MOD_ASSIGN : { AST tmp204_AST = null ; tmp204_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp204_AST ) ; match ( MOD_ASSIGN ) ; break ; } case SR_ASSIGN : { AST tmp205_AST = null ; tmp205_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp205_AST ) ; match ( SR_ASSIGN ) ; break ; } case BSR_ASSIGN : { AST tmp206_AST = null ; tmp206_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp206_AST ) ; match ( BSR_ASSIGN ) ; break ; } case SL_ASSIGN : { AST tmp207_AST = null ; tmp207_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp207_AST ) ; match ( SL_ASSIGN ) ; break ; } case BAND_ASSIGN : { AST tmp208_AST = null ; tmp208_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp208_AST ) ; match ( BAND_ASSIGN ) ; break ; } case BXOR_ASSIGN : { AST tmp209_AST = null ; tmp209_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp209_AST ) ; match ( BXOR_ASSIGN ) ; break ; } case BOR_ASSIGN : { AST tmp210_AST = null ; tmp210_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp210_AST ) ; match ( BOR_ASSIGN ) ; break ; } case STAR_STAR_ASSIGN : { AST tmp211_AST = null ; tmp211_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp211_AST ) ; match ( STAR_STAR_ASSIGN ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } nls ( ) ; assignmentExpression ( lc_stmt == LC_STMT ? LC_INIT : <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case EOF : case FINAL : case ABSTRACT : case UNUSED_GOTO : case UNUSED_DO : case STRICTFP : case LITERAL_package : case LITERAL_import : case LITERAL_static : case LITERAL_def : case LBRACK : case RBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case LITERAL_extends : case LITERAL_super : case COMMA : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_as : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case RPAREN : case LCURLY : case RCURLY : case SEMI : case NLS : case LITERAL_default : case LITERAL_throws : case LITERAL_implements : case LITERAL_this : case CLOSABLE_BLOCK_OP : case COLON : case LITERAL_if : case LITERAL_else : case LITERAL_while : case LITERAL_switch : case LITERAL_for : case LITERAL_in : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case PLUS : case MINUS : case LITERAL_case : case LITERAL_try : case LITERAL_finally : case LITERAL_catch : case LITERAL_false : case LITERAL_instanceof : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } assignmentExpression_AST = ( AST ) currentAST . root ; returnAST = assignmentExpression_AST ; } public final void nlsWarn ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST nlsWarn_AST = null ; { boolean synPredMatched540 = false ; if ( ( ( _tokenSet_59 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_2 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m540 = mark ( ) ; synPredMatched540 = true ; inputState . guessing ++ ; try { { match ( NLS ) ; } } catch ( RecognitionException pe ) { synPredMatched540 = false ; } rewind ( _m540 ) ; inputState . guessing -- ; } if ( synPredMatched540 ) { if ( inputState . guessing == <NUM_LIT:0> ) { addWarning ( "<STR_LIT>" , "<STR_LIT>" ) ; } } else if ( ( _tokenSet_59 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_2 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } nls ( ) ; returnAST = nlsWarn_AST ; } public final void openBlock ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST openBlock_AST = null ; AST bb_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; match ( LCURLY ) ; nls ( ) ; blockBody ( EOF ) ; bb_AST = ( AST ) returnAST ; match ( RCURLY ) ; if ( inputState . guessing == <NUM_LIT:0> ) { openBlock_AST = ( AST ) currentAST . root ; openBlock_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( SLIST , "<STR_LIT:{>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( bb_AST ) ) ; currentAST . root = openBlock_AST ; currentAST . child = openBlock_AST != null && openBlock_AST . getFirstChild ( ) != null ? openBlock_AST . getFirstChild ( ) : openBlock_AST ; currentAST . advanceChildToEnd ( ) ; } openBlock_AST = ( AST ) currentAST . root ; returnAST = openBlock_AST ; } public final void variableName ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST variableName_AST = null ; AST tmp214_AST = null ; tmp214_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp214_AST ) ; match ( IDENT ) ; variableName_AST = ( AST ) currentAST . root ; returnAST = variableName_AST ; } public final void expression ( int lc_stmt ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST expression_AST = null ; AST m_AST = null ; boolean synPredMatched358 = false ; if ( ( ( LA ( <NUM_LIT:1> ) == LPAREN ) && ( LA ( <NUM_LIT:2> ) == IDENT || LA ( <NUM_LIT:2> ) == NLS ) ) ) { int _m358 = mark ( ) ; synPredMatched358 = true ; inputState . guessing ++ ; try { { match ( LPAREN ) ; nls ( ) ; match ( IDENT ) ; { _loop357 : do { if ( ( LA ( <NUM_LIT:1> ) == COMMA ) ) { match ( COMMA ) ; nls ( ) ; match ( IDENT ) ; } else { break _loop357 ; } } while ( true ) ; } match ( RPAREN ) ; match ( ASSIGN ) ; } } catch ( RecognitionException pe ) { synPredMatched358 = false ; } rewind ( _m358 ) ; inputState . guessing -- ; } if ( synPredMatched358 ) { multipleAssignment ( lc_stmt ) ; m_AST = ( AST ) returnAST ; astFactory . addASTChild ( currentAST , returnAST ) ; if ( inputState . guessing == <NUM_LIT:0> ) { expression_AST = ( AST ) currentAST . root ; expression_AST = m_AST ; currentAST . root = expression_AST ; currentAST . child = expression_AST != null && expression_AST . getFirstChild ( ) != null ? expression_AST . getFirstChild ( ) : expression_AST ; currentAST . advanceChildToEnd ( ) ; } expression_AST = ( AST ) currentAST . root ; } else if ( ( _tokenSet_16 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_33 . member ( LA ( <NUM_LIT:2> ) ) ) ) { assignmentExpression ( lc_stmt ) ; astFactory . addASTChild ( currentAST , returnAST ) ; expression_AST = ( AST ) currentAST . root ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } returnAST = expression_AST ; } public final void parameterDeclaration ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST parameterDeclaration_AST = null ; AST pm_AST = null ; AST t_AST = null ; Token id = null ; AST id_AST = null ; AST exp_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; boolean spreadParam = false ; parameterModifiersOpt ( ) ; pm_AST = ( AST ) returnAST ; { if ( ( _tokenSet_20 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_60 . member ( LA ( <NUM_LIT:2> ) ) ) ) { typeSpec ( false ) ; t_AST = ( AST ) returnAST ; } else if ( ( LA ( <NUM_LIT:1> ) == IDENT || LA ( <NUM_LIT:1> ) == TRIPLE_DOT ) && ( _tokenSet_61 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } { switch ( LA ( <NUM_LIT:1> ) ) { case TRIPLE_DOT : { match ( TRIPLE_DOT ) ; if ( inputState . guessing == <NUM_LIT:0> ) { spreadParam = true ; } break ; } case IDENT : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } id = LT ( <NUM_LIT:1> ) ; id_AST = astFactory . create ( id ) ; match ( IDENT ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case ASSIGN : { varInitializer ( ) ; exp_AST = ( AST ) returnAST ; break ; } case COMMA : case RPAREN : case NLS : case CLOSABLE_BLOCK_OP : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { parameterDeclaration_AST = ( AST ) currentAST . root ; if ( spreadParam ) { parameterDeclaration_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:5> ) ) . add ( create ( VARIABLE_PARAMETER_DEF , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( pm_AST ) . add ( ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( TYPE , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( t_AST ) ) ) . add ( id_AST ) . add ( exp_AST ) ) ; } else { parameterDeclaration_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:5> ) ) . add ( create ( PARAMETER_DEF , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( pm_AST ) . add ( ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( TYPE , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( t_AST ) ) ) . add ( id_AST ) . add ( exp_AST ) ) ; } currentAST . root = parameterDeclaration_AST ; currentAST . child = parameterDeclaration_AST != null && parameterDeclaration_AST . getFirstChild ( ) != null ? parameterDeclaration_AST . getFirstChild ( ) : parameterDeclaration_AST ; currentAST . advanceChildToEnd ( ) ; } returnAST = parameterDeclaration_AST ; } public final void parameterModifiersOpt ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST parameterModifiersOpt_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; int seenDef = <NUM_LIT:0> ; { _loop250 : do { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : { AST tmp216_AST = null ; tmp216_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp216_AST ) ; match ( FINAL ) ; nls ( ) ; break ; } case AT : { annotation ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; nls ( ) ; break ; } default : if ( ( ( LA ( <NUM_LIT:1> ) == LITERAL_def ) ) && ( seenDef ++ == <NUM_LIT:0> ) ) { match ( LITERAL_def ) ; nls ( ) ; } else { break _loop250 ; } } } while ( true ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { parameterModifiersOpt_AST = ( AST ) currentAST . root ; parameterModifiersOpt_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( MODIFIERS , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( parameterModifiersOpt_AST ) ) ; currentAST . root = parameterModifiersOpt_AST ; currentAST . child = parameterModifiersOpt_AST != null && parameterModifiersOpt_AST . getFirstChild ( ) != null ? parameterModifiersOpt_AST . getFirstChild ( ) : parameterModifiersOpt_AST ; currentAST . advanceChildToEnd ( ) ; } parameterModifiersOpt_AST = ( AST ) currentAST . root ; returnAST = parameterModifiersOpt_AST ; } public final void closableBlockParamsOpt ( boolean addImplicit ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST closableBlockParamsOpt_AST = null ; boolean synPredMatched253 = false ; if ( ( ( _tokenSet_62 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_63 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m253 = mark ( ) ; synPredMatched253 = true ; inputState . guessing ++ ; try { { parameterDeclarationList ( ) ; nls ( ) ; match ( CLOSABLE_BLOCK_OP ) ; } } catch ( RecognitionException pe ) { synPredMatched253 = false ; } rewind ( _m253 ) ; inputState . guessing -- ; } if ( synPredMatched253 ) { parameterDeclarationList ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; nls ( ) ; match ( CLOSABLE_BLOCK_OP ) ; nls ( ) ; closableBlockParamsOpt_AST = ( AST ) currentAST . root ; } else if ( ( ( _tokenSet_26 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_64 . member ( LA ( <NUM_LIT:2> ) ) ) ) && ( addImplicit ) ) { implicitParameters ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; closableBlockParamsOpt_AST = ( AST ) currentAST . root ; } else if ( ( _tokenSet_26 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_64 . member ( LA ( <NUM_LIT:2> ) ) ) ) { closableBlockParamsOpt_AST = ( AST ) currentAST . root ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } returnAST = closableBlockParamsOpt_AST ; } public final void implicitParameters ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST implicitParameters_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; if ( inputState . guessing == <NUM_LIT:0> ) { implicitParameters_AST = ( AST ) currentAST . root ; implicitParameters_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:1> ) ) . add ( create ( IMPLICIT_PARAMETERS , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) ) ; currentAST . root = implicitParameters_AST ; currentAST . child = implicitParameters_AST != null && implicitParameters_AST . getFirstChild ( ) != null ? implicitParameters_AST . getFirstChild ( ) : implicitParameters_AST ; currentAST . advanceChildToEnd ( ) ; } implicitParameters_AST = ( AST ) currentAST . root ; returnAST = implicitParameters_AST ; } public final void closableBlockParamsStart ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST closableBlockParamsStart_AST = null ; parameterDeclarationList ( ) ; nls ( ) ; AST tmp219_AST = null ; tmp219_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( CLOSABLE_BLOCK_OP ) ; returnAST = closableBlockParamsStart_AST ; } public final void closableBlockParam ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST closableBlockParam_AST = null ; Token id = null ; AST id_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; id = LT ( <NUM_LIT:1> ) ; id_AST = astFactory . create ( id ) ; match ( IDENT ) ; if ( inputState . guessing == <NUM_LIT:0> ) { closableBlockParam_AST = ( AST ) currentAST . root ; closableBlockParam_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:4> ) ) . add ( create ( PARAMETER_DEF , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:1> ) ) . add ( create ( MODIFIERS , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) ) ) . add ( ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:1> ) ) . add ( create ( TYPE , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) ) ) . add ( id_AST ) ) ; currentAST . root = closableBlockParam_AST ; currentAST . child = closableBlockParam_AST != null && closableBlockParam_AST . getFirstChild ( ) != null ? closableBlockParam_AST . getFirstChild ( ) : closableBlockParam_AST ; currentAST . advanceChildToEnd ( ) ; } returnAST = closableBlockParam_AST ; } public final void closableBlock ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST closableBlock_AST = null ; AST cbp_AST = null ; AST bb_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; match ( LCURLY ) ; nls ( ) ; closableBlockParamsOpt ( true ) ; cbp_AST = ( AST ) returnAST ; blockBody ( EOF ) ; bb_AST = ( AST ) returnAST ; match ( RCURLY ) ; if ( inputState . guessing == <NUM_LIT:0> ) { closableBlock_AST = ( AST ) currentAST . root ; closableBlock_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( CLOSABLE_BLOCK , "<STR_LIT:{>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( cbp_AST ) . add ( bb_AST ) ) ; currentAST . root = closableBlock_AST ; currentAST . child = closableBlock_AST != null && closableBlock_AST . getFirstChild ( ) != null ? closableBlock_AST . getFirstChild ( ) : closableBlock_AST ; currentAST . advanceChildToEnd ( ) ; } closableBlock_AST = ( AST ) currentAST . root ; returnAST = closableBlock_AST ; } public final void openOrClosableBlock ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST openOrClosableBlock_AST = null ; AST cp_AST = null ; AST bb_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; match ( LCURLY ) ; nls ( ) ; closableBlockParamsOpt ( false ) ; cp_AST = ( AST ) returnAST ; blockBody ( EOF ) ; bb_AST = ( AST ) returnAST ; match ( RCURLY ) ; if ( inputState . guessing == <NUM_LIT:0> ) { openOrClosableBlock_AST = ( AST ) currentAST . root ; if ( cp_AST == null ) openOrClosableBlock_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( SLIST , "<STR_LIT:{>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( bb_AST ) ) ; else openOrClosableBlock_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( CLOSABLE_BLOCK , "<STR_LIT:{>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( cp_AST ) . add ( bb_AST ) ) ; currentAST . root = openOrClosableBlock_AST ; currentAST . child = openOrClosableBlock_AST != null && openOrClosableBlock_AST . getFirstChild ( ) != null ? openOrClosableBlock_AST . getFirstChild ( ) : openOrClosableBlock_AST ; currentAST . advanceChildToEnd ( ) ; } openOrClosableBlock_AST = ( AST ) currentAST . root ; returnAST = openOrClosableBlock_AST ; } public final void statementLabelPrefix ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST statementLabelPrefix_AST = null ; Token c = null ; AST c_AST = null ; AST tmp224_AST = null ; tmp224_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp224_AST ) ; match ( IDENT ) ; c = LT ( <NUM_LIT:1> ) ; c_AST = astFactory . create ( c ) ; astFactory . makeASTRoot ( currentAST , c_AST ) ; match ( COLON ) ; if ( inputState . guessing == <NUM_LIT:0> ) { c_AST . setType ( LABELED_STAT ) ; } nls ( ) ; statementLabelPrefix_AST = ( AST ) currentAST . root ; returnAST = statementLabelPrefix_AST ; } public final void expressionStatement ( int prevToken ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST expressionStatement_AST = null ; AST head_AST = null ; AST cmd_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; boolean isPathExpr = false ; { boolean synPredMatched314 = false ; if ( ( ( _tokenSet_16 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_2 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m314 = mark ( ) ; synPredMatched314 = true ; inputState . guessing ++ ; try { { suspiciousExpressionStatementStart ( ) ; } } catch ( RecognitionException pe ) { synPredMatched314 = false ; } rewind ( _m314 ) ; inputState . guessing -- ; } if ( synPredMatched314 ) { checkSuspiciousExpressionStatement ( prevToken ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else if ( ( _tokenSet_16 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_2 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } expression ( LC_STMT ) ; head_AST = ( AST ) returnAST ; astFactory . addASTChild ( currentAST , returnAST ) ; if ( inputState . guessing == <NUM_LIT:0> ) { isPathExpr = ( head_AST == lastPathExpression ) ; } { if ( ( ( _tokenSet_65 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_66 . member ( LA ( <NUM_LIT:2> ) ) ) ) && ( isPathExpr ) ) { commandArguments ( head_AST ) ; cmd_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { expressionStatement_AST = ( AST ) currentAST . root ; expressionStatement_AST = cmd_AST ; currentAST . root = expressionStatement_AST ; currentAST . child = expressionStatement_AST != null && expressionStatement_AST . getFirstChild ( ) != null ? expressionStatement_AST . getFirstChild ( ) : expressionStatement_AST ; currentAST . advanceChildToEnd ( ) ; } } else if ( ( _tokenSet_7 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_8 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } if ( inputState . guessing == <NUM_LIT:0> ) { expressionStatement_AST = ( AST ) currentAST . root ; expressionStatement_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( EXPR , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( expressionStatement_AST ) ) ; currentAST . root = expressionStatement_AST ; currentAST . child = expressionStatement_AST != null && expressionStatement_AST . getFirstChild ( ) != null ? expressionStatement_AST . getFirstChild ( ) : expressionStatement_AST ; currentAST . advanceChildToEnd ( ) ; } expressionStatement_AST = ( AST ) currentAST . root ; returnAST = expressionStatement_AST ; } public final void assignmentLessExpression ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST assignmentLessExpression_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; { conditionalExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { assignmentLessExpression_AST = ( AST ) currentAST . root ; assignmentLessExpression_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( EXPR , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( assignmentLessExpression_AST ) ) ; currentAST . root = assignmentLessExpression_AST ; currentAST . child = assignmentLessExpression_AST != null && assignmentLessExpression_AST . getFirstChild ( ) != null ? assignmentLessExpression_AST . getFirstChild ( ) : assignmentLessExpression_AST ; currentAST . advanceChildToEnd ( ) ; } assignmentLessExpression_AST = ( AST ) currentAST . root ; returnAST = assignmentLessExpression_AST ; } public final void compatibleBodyStatement ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST compatibleBodyStatement_AST = null ; boolean synPredMatched303 = false ; if ( ( ( LA ( <NUM_LIT:1> ) == LCURLY ) && ( _tokenSet_26 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m303 = mark ( ) ; synPredMatched303 = true ; inputState . guessing ++ ; try { { match ( LCURLY ) ; } } catch ( RecognitionException pe ) { synPredMatched303 = false ; } rewind ( _m303 ) ; inputState . guessing -- ; } if ( synPredMatched303 ) { compoundStatement ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; compatibleBodyStatement_AST = ( AST ) currentAST . root ; } else if ( ( _tokenSet_15 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_2 . member ( LA ( <NUM_LIT:2> ) ) ) ) { statement ( EOF ) ; astFactory . addASTChild ( currentAST , returnAST ) ; compatibleBodyStatement_AST = ( AST ) currentAST . root ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } returnAST = compatibleBodyStatement_AST ; } public final void forStatement ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST forStatement_AST = null ; AST cl_AST = null ; AST fic_AST = null ; Token s = null ; AST s_AST = null ; AST forCbs_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; match ( LITERAL_for ) ; match ( LPAREN ) ; { boolean synPredMatched290 = false ; if ( ( ( _tokenSet_67 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_68 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m290 = mark ( ) ; synPredMatched290 = true ; inputState . guessing ++ ; try { { switch ( LA ( <NUM_LIT:1> ) ) { case SEMI : { match ( SEMI ) ; break ; } case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case AT : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : case LITERAL_this : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case PLUS : case MINUS : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { { strictContextExpression ( true ) ; match ( SEMI ) ; } break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } } catch ( RecognitionException pe ) { synPredMatched290 = false ; } rewind ( _m290 ) ; inputState . guessing -- ; } if ( synPredMatched290 ) { closureList ( ) ; cl_AST = ( AST ) returnAST ; } else if ( ( _tokenSet_12 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_69 . member ( LA ( <NUM_LIT:2> ) ) ) ) { forInClause ( ) ; fic_AST = ( AST ) returnAST ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } match ( RPAREN ) ; nls ( ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case SEMI : { s = LT ( <NUM_LIT:1> ) ; s_AST = astFactory . create ( s ) ; match ( SEMI ) ; break ; } case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_import : case LITERAL_static : case LITERAL_def : case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : case LITERAL_this : case LITERAL_if : case LITERAL_while : case LITERAL_switch : case LITERAL_for : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case PLUS : case MINUS : case LITERAL_try : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { compatibleBodyStatement ( ) ; forCbs_AST = ( AST ) returnAST ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { forStatement_AST = ( AST ) currentAST . root ; if ( cl_AST != null ) { if ( s_AST != null ) forStatement_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( LITERAL_for , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( cl_AST ) . add ( s_AST ) ) ; else forStatement_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( LITERAL_for , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( cl_AST ) . add ( forCbs_AST ) ) ; } else { if ( s_AST != null ) forStatement_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( LITERAL_for , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( fic_AST ) . add ( s_AST ) ) ; else forStatement_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( LITERAL_for , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( fic_AST ) . add ( forCbs_AST ) ) ; } currentAST . root = forStatement_AST ; currentAST . child = forStatement_AST != null && forStatement_AST . getFirstChild ( ) != null ? forStatement_AST . getFirstChild ( ) : forStatement_AST ; currentAST . advanceChildToEnd ( ) ; } forStatement_AST = ( AST ) currentAST . root ; returnAST = forStatement_AST ; } public final boolean strictContextExpression ( boolean allowDeclaration ) throws RecognitionException , TokenStreamException { boolean hasDeclaration = false ; returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST strictContextExpression_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; { boolean synPredMatched474 = false ; if ( ( ( _tokenSet_12 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_70 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m474 = mark ( ) ; synPredMatched474 = true ; inputState . guessing ++ ; try { { if ( ! ( allowDeclaration ) ) throw new SemanticException ( "<STR_LIT>" ) ; declarationStart ( ) ; } } catch ( RecognitionException pe ) { synPredMatched474 = false ; } rewind ( _m474 ) ; inputState . guessing -- ; } if ( synPredMatched474 ) { if ( inputState . guessing == <NUM_LIT:0> ) { hasDeclaration = true ; } singleDeclaration ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else if ( ( _tokenSet_16 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_33 . member ( LA ( <NUM_LIT:2> ) ) ) ) { expression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else if ( ( ( LA ( <NUM_LIT:1> ) >= LITERAL_return && LA ( <NUM_LIT:1> ) <= LITERAL_assert ) ) ) { branchStatement ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else if ( ( LA ( <NUM_LIT:1> ) == AT ) && ( LA ( <NUM_LIT:2> ) == IDENT ) ) { annotation ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } if ( inputState . guessing == <NUM_LIT:0> ) { strictContextExpression_AST = ( AST ) currentAST . root ; strictContextExpression_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( EXPR , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( strictContextExpression_AST ) ) ; currentAST . root = strictContextExpression_AST ; currentAST . child = strictContextExpression_AST != null && strictContextExpression_AST . getFirstChild ( ) != null ? strictContextExpression_AST . getFirstChild ( ) : strictContextExpression_AST ; currentAST . advanceChildToEnd ( ) ; } strictContextExpression_AST = ( AST ) currentAST . root ; returnAST = strictContextExpression_AST ; return hasDeclaration ; } public final void casesGroup ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST casesGroup_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; { int _cnt326 = <NUM_LIT:0> ; _loop326 : do { if ( ( LA ( <NUM_LIT:1> ) == LITERAL_default || LA ( <NUM_LIT:1> ) == LITERAL_case ) ) { aCase ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { if ( _cnt326 >= <NUM_LIT:1> ) { break _loop326 ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } _cnt326 ++ ; } while ( true ) ; } caseSList ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; if ( inputState . guessing == <NUM_LIT:0> ) { casesGroup_AST = ( AST ) currentAST . root ; casesGroup_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( CASE_GROUP , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( casesGroup_AST ) ) ; currentAST . root = casesGroup_AST ; currentAST . child = casesGroup_AST != null && casesGroup_AST . getFirstChild ( ) != null ? casesGroup_AST . getFirstChild ( ) : casesGroup_AST ; currentAST . advanceChildToEnd ( ) ; } casesGroup_AST = ( AST ) currentAST . root ; returnAST = casesGroup_AST ; } public final void tryBlock ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST tryBlock_AST = null ; AST tryCs_AST = null ; AST h_AST = null ; AST fc_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; List catchNodes = new ArrayList ( ) ; AST newHandler_AST = null ; match ( LITERAL_try ) ; nlsWarn ( ) ; compoundStatement ( ) ; tryCs_AST = ( AST ) returnAST ; { _loop343 : do { if ( ( ( LA ( <NUM_LIT:1> ) == NLS || LA ( <NUM_LIT:1> ) == LITERAL_catch ) && ( LA ( <NUM_LIT:2> ) == LPAREN || LA ( <NUM_LIT:2> ) == LITERAL_catch ) ) && ( ! ( LA ( <NUM_LIT:1> ) == NLS && LA ( <NUM_LIT:2> ) == LPAREN ) ) ) { nls ( ) ; handler ( ) ; h_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { newHandler_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( null ) . add ( newHandler_AST ) . add ( h_AST ) ) ; } } else { break _loop343 ; } } while ( true ) ; } { if ( ( LA ( <NUM_LIT:1> ) == NLS || LA ( <NUM_LIT:1> ) == LITERAL_finally ) && ( _tokenSet_71 . member ( LA ( <NUM_LIT:2> ) ) ) ) { nls ( ) ; finallyClause ( ) ; fc_AST = ( AST ) returnAST ; } else if ( ( _tokenSet_7 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_8 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } if ( inputState . guessing == <NUM_LIT:0> ) { tryBlock_AST = ( AST ) currentAST . root ; tryBlock_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:4> ) ) . add ( create ( LITERAL_try , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( tryCs_AST ) . add ( newHandler_AST ) . add ( fc_AST ) ) ; currentAST . root = tryBlock_AST ; currentAST . child = tryBlock_AST != null && tryBlock_AST . getFirstChild ( ) != null ? tryBlock_AST . getFirstChild ( ) : tryBlock_AST ; currentAST . advanceChildToEnd ( ) ; } tryBlock_AST = ( AST ) currentAST . root ; returnAST = tryBlock_AST ; } public final void branchStatement ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST branchStatement_AST = null ; AST returnE_AST = null ; Token breakI = null ; AST breakI_AST = null ; Token contI = null ; AST contI_AST = null ; AST throwE_AST = null ; AST assertAle_AST = null ; AST assertE_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; switch ( LA ( <NUM_LIT:1> ) ) { case LITERAL_return : { match ( LITERAL_return ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LCURLY : case LITERAL_this : case PLUS : case MINUS : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { expression ( <NUM_LIT:0> ) ; returnE_AST = ( AST ) returnAST ; break ; } case EOF : case RBRACK : case COMMA : case RPAREN : case RCURLY : case SEMI : case NLS : case LITERAL_default : case LITERAL_else : case LITERAL_case : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { branchStatement_AST = ( AST ) currentAST . root ; branchStatement_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( LITERAL_return , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( returnE_AST ) ) ; currentAST . root = branchStatement_AST ; currentAST . child = branchStatement_AST != null && branchStatement_AST . getFirstChild ( ) != null ? branchStatement_AST . getFirstChild ( ) : branchStatement_AST ; currentAST . advanceChildToEnd ( ) ; } branchStatement_AST = ( AST ) currentAST . root ; break ; } case LITERAL_break : { match ( LITERAL_break ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case IDENT : { breakI = LT ( <NUM_LIT:1> ) ; breakI_AST = astFactory . create ( breakI ) ; match ( IDENT ) ; break ; } case EOF : case RBRACK : case COMMA : case RPAREN : case RCURLY : case SEMI : case NLS : case LITERAL_default : case LITERAL_else : case LITERAL_case : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { branchStatement_AST = ( AST ) currentAST . root ; branchStatement_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( LITERAL_break , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( breakI_AST ) ) ; currentAST . root = branchStatement_AST ; currentAST . child = branchStatement_AST != null && branchStatement_AST . getFirstChild ( ) != null ? branchStatement_AST . getFirstChild ( ) : branchStatement_AST ; currentAST . advanceChildToEnd ( ) ; } branchStatement_AST = ( AST ) currentAST . root ; break ; } case LITERAL_continue : { match ( LITERAL_continue ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case IDENT : { contI = LT ( <NUM_LIT:1> ) ; contI_AST = astFactory . create ( contI ) ; match ( IDENT ) ; break ; } case EOF : case RBRACK : case COMMA : case RPAREN : case RCURLY : case SEMI : case NLS : case LITERAL_default : case LITERAL_else : case LITERAL_case : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { branchStatement_AST = ( AST ) currentAST . root ; branchStatement_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( LITERAL_continue , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( contI_AST ) ) ; currentAST . root = branchStatement_AST ; currentAST . child = branchStatement_AST != null && branchStatement_AST . getFirstChild ( ) != null ? branchStatement_AST . getFirstChild ( ) : branchStatement_AST ; currentAST . advanceChildToEnd ( ) ; } branchStatement_AST = ( AST ) currentAST . root ; break ; } case LITERAL_throw : { match ( LITERAL_throw ) ; expression ( <NUM_LIT:0> ) ; throwE_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { branchStatement_AST = ( AST ) currentAST . root ; branchStatement_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( LITERAL_throw , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( throwE_AST ) ) ; currentAST . root = branchStatement_AST ; currentAST . child = branchStatement_AST != null && branchStatement_AST . getFirstChild ( ) != null ? branchStatement_AST . getFirstChild ( ) : branchStatement_AST ; currentAST . advanceChildToEnd ( ) ; } branchStatement_AST = ( AST ) currentAST . root ; break ; } case LITERAL_assert : { match ( LITERAL_assert ) ; assignmentLessExpression ( ) ; assertAle_AST = ( AST ) returnAST ; { if ( ( LA ( <NUM_LIT:1> ) == COMMA || LA ( <NUM_LIT:1> ) == COLON ) && ( _tokenSet_16 . member ( LA ( <NUM_LIT:2> ) ) ) ) { { switch ( LA ( <NUM_LIT:1> ) ) { case COMMA : { match ( COMMA ) ; break ; } case COLON : { match ( COLON ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } expression ( <NUM_LIT:0> ) ; assertE_AST = ( AST ) returnAST ; } else if ( ( _tokenSet_72 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_8 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } if ( inputState . guessing == <NUM_LIT:0> ) { branchStatement_AST = ( AST ) currentAST . root ; branchStatement_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( LITERAL_assert , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( assertAle_AST ) . add ( assertE_AST ) ) ; currentAST . root = branchStatement_AST ; currentAST . child = branchStatement_AST != null && branchStatement_AST . getFirstChild ( ) != null ? branchStatement_AST . getFirstChild ( ) : branchStatement_AST ; currentAST . advanceChildToEnd ( ) ; } branchStatement_AST = ( AST ) currentAST . root ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = branchStatement_AST ; } public final void closureList ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST closureList_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; boolean sce = false ; { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case AT : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : case LITERAL_this : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case PLUS : case MINUS : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { sce = strictContextExpression ( true ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case SEMI : { if ( inputState . guessing == <NUM_LIT:0> ) { astFactory . addASTChild ( currentAST , astFactory . create ( EMPTY_STAT , "<STR_LIT>" ) ) ; } break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } { int _cnt295 = <NUM_LIT:0> ; _loop295 : do { if ( ( LA ( <NUM_LIT:1> ) == SEMI ) && ( _tokenSet_73 . member ( LA ( <NUM_LIT:2> ) ) ) ) { match ( SEMI ) ; sce = strictContextExpression ( true ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else if ( ( LA ( <NUM_LIT:1> ) == SEMI ) && ( LA ( <NUM_LIT:2> ) == RPAREN || LA ( <NUM_LIT:2> ) == SEMI ) ) { match ( SEMI ) ; if ( inputState . guessing == <NUM_LIT:0> ) { astFactory . addASTChild ( currentAST , astFactory . create ( EMPTY_STAT , "<STR_LIT>" ) ) ; } } else { if ( _cnt295 >= <NUM_LIT:1> ) { break _loop295 ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } _cnt295 ++ ; } while ( true ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { closureList_AST = ( AST ) currentAST . root ; closureList_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( CLOSURE_LIST , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( closureList_AST ) ) ; currentAST . root = closureList_AST ; currentAST . child = closureList_AST != null && closureList_AST . getFirstChild ( ) != null ? closureList_AST . getFirstChild ( ) : closureList_AST ; currentAST . advanceChildToEnd ( ) ; } closureList_AST = ( AST ) currentAST . root ; returnAST = closureList_AST ; } public final void forInClause ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST forInClause_AST = null ; AST decl_AST = null ; Token i = null ; AST i_AST = null ; Token c = null ; AST c_AST = null ; { boolean synPredMatched299 = false ; if ( ( ( _tokenSet_12 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_70 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m299 = mark ( ) ; synPredMatched299 = true ; inputState . guessing ++ ; try { { declarationStart ( ) ; } } catch ( RecognitionException pe ) { synPredMatched299 = false ; } rewind ( _m299 ) ; inputState . guessing -- ; } if ( synPredMatched299 ) { singleDeclarationNoInit ( ) ; decl_AST = ( AST ) returnAST ; astFactory . addASTChild ( currentAST , returnAST ) ; } else if ( ( LA ( <NUM_LIT:1> ) == IDENT ) && ( LA ( <NUM_LIT:2> ) == COLON || LA ( <NUM_LIT:2> ) == LITERAL_in ) ) { AST tmp238_AST = null ; tmp238_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp238_AST ) ; match ( IDENT ) ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } { switch ( LA ( <NUM_LIT:1> ) ) { case LITERAL_in : { i = LT ( <NUM_LIT:1> ) ; i_AST = astFactory . create ( i ) ; astFactory . makeASTRoot ( currentAST , i_AST ) ; match ( LITERAL_in ) ; if ( inputState . guessing == <NUM_LIT:0> ) { i_AST . setType ( FOR_IN_ITERABLE ) ; } shiftExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case COLON : { if ( inputState . guessing == <NUM_LIT:0> ) { addWarning ( "<STR_LIT>" , "<STR_LIT>" ) ; require ( decl_AST != null , "<STR_LIT>" , "<STR_LIT>" ) ; } c = LT ( <NUM_LIT:1> ) ; c_AST = astFactory . create ( c ) ; astFactory . makeASTRoot ( currentAST , c_AST ) ; match ( COLON ) ; if ( inputState . guessing == <NUM_LIT:0> ) { c_AST . setType ( FOR_IN_ITERABLE ) ; } expression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } forInClause_AST = ( AST ) currentAST . root ; returnAST = forInClause_AST ; } public final void shiftExpression ( int lc_stmt ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST shiftExpression_AST = null ; additiveExpression ( lc_stmt ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop425 : do { if ( ( _tokenSet_74 . member ( LA ( <NUM_LIT:1> ) ) ) ) { { switch ( LA ( <NUM_LIT:1> ) ) { case SR : case BSR : case SL : { { switch ( LA ( <NUM_LIT:1> ) ) { case SL : { AST tmp239_AST = null ; tmp239_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp239_AST ) ; match ( SL ) ; break ; } case SR : { AST tmp240_AST = null ; tmp240_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp240_AST ) ; match ( SR ) ; break ; } case BSR : { AST tmp241_AST = null ; tmp241_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp241_AST ) ; match ( BSR ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } break ; } case RANGE_INCLUSIVE : { AST tmp242_AST = null ; tmp242_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp242_AST ) ; match ( RANGE_INCLUSIVE ) ; break ; } case RANGE_EXCLUSIVE : { AST tmp243_AST = null ; tmp243_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp243_AST ) ; match ( RANGE_EXCLUSIVE ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } nls ( ) ; additiveExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop425 ; } } while ( true ) ; } shiftExpression_AST = ( AST ) currentAST . root ; returnAST = shiftExpression_AST ; } public final void suspiciousExpressionStatementStart ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST suspiciousExpressionStatementStart_AST = null ; { switch ( LA ( <NUM_LIT:1> ) ) { case PLUS : case MINUS : { { switch ( LA ( <NUM_LIT:1> ) ) { case PLUS : { AST tmp244_AST = null ; tmp244_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp244_AST ) ; match ( PLUS ) ; break ; } case MINUS : { AST tmp245_AST = null ; tmp245_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp245_AST ) ; match ( MINUS ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } break ; } case LBRACK : case LPAREN : case LCURLY : { { switch ( LA ( <NUM_LIT:1> ) ) { case LBRACK : { AST tmp246_AST = null ; tmp246_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp246_AST ) ; match ( LBRACK ) ; break ; } case LPAREN : { AST tmp247_AST = null ; tmp247_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp247_AST ) ; match ( LPAREN ) ; break ; } case LCURLY : { AST tmp248_AST = null ; tmp248_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp248_AST ) ; match ( LCURLY ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } suspiciousExpressionStatementStart_AST = ( AST ) currentAST . root ; returnAST = suspiciousExpressionStatementStart_AST ; } public final void checkSuspiciousExpressionStatement ( int prevToken ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST checkSuspiciousExpressionStatement_AST = null ; boolean synPredMatched318 = false ; if ( ( ( _tokenSet_16 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_2 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m318 = mark ( ) ; synPredMatched318 = true ; inputState . guessing ++ ; try { { if ( ( _tokenSet_75 . member ( LA ( <NUM_LIT:1> ) ) ) ) { matchNot ( LCURLY ) ; } else if ( ( LA ( <NUM_LIT:1> ) == LCURLY ) ) { match ( LCURLY ) ; closableBlockParamsStart ( ) ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } catch ( RecognitionException pe ) { synPredMatched318 = false ; } rewind ( _m318 ) ; inputState . guessing -- ; } if ( synPredMatched318 ) { { if ( ( ( _tokenSet_16 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_2 . member ( LA ( <NUM_LIT:2> ) ) ) ) && ( prevToken == NLS ) ) { if ( inputState . guessing == <NUM_LIT:0> ) { addWarning ( "<STR_LIT>" , "<STR_LIT>" ) ; } } else if ( ( _tokenSet_16 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_2 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } checkSuspiciousExpressionStatement_AST = ( AST ) currentAST . root ; } else if ( ( ( _tokenSet_16 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_2 . member ( LA ( <NUM_LIT:2> ) ) ) ) && ( prevToken == NLS ) ) { if ( inputState . guessing == <NUM_LIT:0> ) { require ( false , "<STR_LIT>" + "<STR_LIT>" , "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" ) ; } checkSuspiciousExpressionStatement_AST = ( AST ) currentAST . root ; } else if ( ( ( _tokenSet_16 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_2 . member ( LA ( <NUM_LIT:2> ) ) ) ) && ( prevToken != NLS ) ) { if ( inputState . guessing == <NUM_LIT:0> ) { require ( false , "<STR_LIT>" + "<STR_LIT>" , "<STR_LIT>" + "<STR_LIT>" ) ; } checkSuspiciousExpressionStatement_AST = ( AST ) currentAST . root ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } returnAST = checkSuspiciousExpressionStatement_AST ; } public final void commandArguments ( AST head ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST commandArguments_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; int hls = <NUM_LIT:0> ; commandArgument ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop349 : do { if ( ( LA ( <NUM_LIT:1> ) == COMMA ) ) { match ( COMMA ) ; nls ( ) ; commandArgument ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop349 ; } } while ( true ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { commandArguments_AST = ( AST ) currentAST . root ; AST elist = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( ELIST , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( commandArguments_AST ) ) ; AST headid = getASTFactory ( ) . dup ( head ) ; headid . setType ( METHOD_CALL ) ; headid . setText ( "<STR_LIT>" ) ; commandArguments_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( headid ) . add ( head ) . add ( elist ) ) ; currentAST . root = commandArguments_AST ; currentAST . child = commandArguments_AST != null && commandArguments_AST . getFirstChild ( ) != null ? commandArguments_AST . getFirstChild ( ) : commandArguments_AST ; currentAST . advanceChildToEnd ( ) ; } commandArguments_AST = ( AST ) currentAST . root ; returnAST = commandArguments_AST ; } public final void aCase ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST aCase_AST = null ; { switch ( LA ( <NUM_LIT:1> ) ) { case LITERAL_case : { AST tmp250_AST = null ; tmp250_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp250_AST ) ; match ( LITERAL_case ) ; expression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case LITERAL_default : { AST tmp251_AST = null ; tmp251_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp251_AST ) ; match ( LITERAL_default ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } match ( COLON ) ; nls ( ) ; aCase_AST = ( AST ) currentAST . root ; returnAST = aCase_AST ; } public final void caseSList ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST caseSList_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; statement ( COLON ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop332 : do { if ( ( LA ( <NUM_LIT:1> ) == SEMI || LA ( <NUM_LIT:1> ) == NLS ) ) { sep ( ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_import : case LITERAL_static : case LITERAL_def : case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : case LITERAL_this : case LITERAL_if : case LITERAL_while : case LITERAL_switch : case LITERAL_for : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case PLUS : case MINUS : case LITERAL_try : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { statement ( sepToken ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case RCURLY : case SEMI : case NLS : case LITERAL_default : case LITERAL_case : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } } else { break _loop332 ; } } while ( true ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { caseSList_AST = ( AST ) currentAST . root ; caseSList_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( SLIST , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( caseSList_AST ) ) ; currentAST . root = caseSList_AST ; currentAST . child = caseSList_AST != null && caseSList_AST . getFirstChild ( ) != null ? caseSList_AST . getFirstChild ( ) : caseSList_AST ; currentAST . advanceChildToEnd ( ) ; } caseSList_AST = ( AST ) currentAST . root ; returnAST = caseSList_AST ; } public final void forInit ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST forInit_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; boolean synPredMatched335 = false ; if ( ( ( _tokenSet_12 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_13 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m335 = mark ( ) ; synPredMatched335 = true ; inputState . guessing ++ ; try { { declarationStart ( ) ; } } catch ( RecognitionException pe ) { synPredMatched335 = false ; } rewind ( _m335 ) ; inputState . guessing -- ; } if ( synPredMatched335 ) { declaration ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; forInit_AST = ( AST ) currentAST . root ; } else if ( ( _tokenSet_76 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_66 . member ( LA ( <NUM_LIT:2> ) ) ) ) { { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case AT : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : case LITERAL_this : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case PLUS : case MINUS : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { controlExpressionList ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case EOF : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { forInit_AST = ( AST ) currentAST . root ; forInit_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( FOR_INIT , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( forInit_AST ) ) ; currentAST . root = forInit_AST ; currentAST . child = forInit_AST != null && forInit_AST . getFirstChild ( ) != null ? forInit_AST . getFirstChild ( ) : forInit_AST ; currentAST . advanceChildToEnd ( ) ; } forInit_AST = ( AST ) currentAST . root ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } returnAST = forInit_AST ; } public final void controlExpressionList ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST controlExpressionList_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; boolean sce = false ; sce = strictContextExpression ( false ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop362 : do { if ( ( LA ( <NUM_LIT:1> ) == COMMA ) ) { match ( COMMA ) ; nls ( ) ; sce = strictContextExpression ( false ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop362 ; } } while ( true ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { controlExpressionList_AST = ( AST ) currentAST . root ; controlExpressionList_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( ELIST , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( controlExpressionList_AST ) ) ; currentAST . root = controlExpressionList_AST ; currentAST . child = controlExpressionList_AST != null && controlExpressionList_AST . getFirstChild ( ) != null ? controlExpressionList_AST . getFirstChild ( ) : controlExpressionList_AST ; currentAST . advanceChildToEnd ( ) ; } controlExpressionList_AST = ( AST ) currentAST . root ; returnAST = controlExpressionList_AST ; } public final void forCond ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST forCond_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; boolean sce = false ; { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case AT : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : case LITERAL_this : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case PLUS : case MINUS : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { sce = strictContextExpression ( false ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case EOF : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { forCond_AST = ( AST ) currentAST . root ; forCond_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( FOR_CONDITION , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( forCond_AST ) ) ; currentAST . root = forCond_AST ; currentAST . child = forCond_AST != null && forCond_AST . getFirstChild ( ) != null ? forCond_AST . getFirstChild ( ) : forCond_AST ; currentAST . advanceChildToEnd ( ) ; } forCond_AST = ( AST ) currentAST . root ; returnAST = forCond_AST ; } public final void forIter ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST forIter_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case AT : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : case LITERAL_this : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case PLUS : case MINUS : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { controlExpressionList ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case EOF : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { forIter_AST = ( AST ) currentAST . root ; forIter_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( FOR_ITERATOR , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( forIter_AST ) ) ; currentAST . root = forIter_AST ; currentAST . child = forIter_AST != null && forIter_AST . getFirstChild ( ) != null ? forIter_AST . getFirstChild ( ) : forIter_AST ; currentAST . advanceChildToEnd ( ) ; } forIter_AST = ( AST ) currentAST . root ; returnAST = forIter_AST ; } public final void handler ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST handler_AST = null ; AST pd_AST = null ; AST handlerCs_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; match ( LITERAL_catch ) ; match ( LPAREN ) ; parameterDeclaration ( ) ; pd_AST = ( AST ) returnAST ; match ( RPAREN ) ; nlsWarn ( ) ; compoundStatement ( ) ; handlerCs_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { handler_AST = ( AST ) currentAST . root ; handler_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( LITERAL_catch , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( pd_AST ) . add ( handlerCs_AST ) ) ; currentAST . root = handler_AST ; currentAST . child = handler_AST != null && handler_AST . getFirstChild ( ) != null ? handler_AST . getFirstChild ( ) : handler_AST ; currentAST . advanceChildToEnd ( ) ; } handler_AST = ( AST ) currentAST . root ; returnAST = handler_AST ; } public final void finallyClause ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST finallyClause_AST = null ; AST finallyCs_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; match ( LITERAL_finally ) ; nlsWarn ( ) ; compoundStatement ( ) ; finallyCs_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { finallyClause_AST = ( AST ) currentAST . root ; finallyClause_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( LITERAL_finally , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( finallyCs_AST ) ) ; currentAST . root = finallyClause_AST ; currentAST . child = finallyClause_AST != null && finallyClause_AST . getFirstChild ( ) != null ? finallyClause_AST . getFirstChild ( ) : finallyClause_AST ; currentAST . advanceChildToEnd ( ) ; } finallyClause_AST = ( AST ) currentAST . root ; returnAST = finallyClause_AST ; } public final void commandArgument ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST commandArgument_AST = null ; Token c = null ; AST c_AST = null ; boolean synPredMatched352 = false ; if ( ( ( _tokenSet_77 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_78 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m352 = mark ( ) ; synPredMatched352 = true ; inputState . guessing ++ ; try { { argumentLabel ( ) ; match ( COLON ) ; } } catch ( RecognitionException pe ) { synPredMatched352 = false ; } rewind ( _m352 ) ; inputState . guessing -- ; } if ( synPredMatched352 ) { { argumentLabel ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; c = LT ( <NUM_LIT:1> ) ; c_AST = astFactory . create ( c ) ; astFactory . makeASTRoot ( currentAST , c_AST ) ; match ( COLON ) ; expression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; if ( inputState . guessing == <NUM_LIT:0> ) { c_AST . setType ( LABELED_ARG ) ; } } commandArgument_AST = ( AST ) currentAST . root ; } else if ( ( _tokenSet_16 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_66 . member ( LA ( <NUM_LIT:2> ) ) ) ) { expression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; commandArgument_AST = ( AST ) currentAST . root ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } returnAST = commandArgument_AST ; } public final void argumentLabel ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST argumentLabel_AST = null ; Token id = null ; AST id_AST = null ; AST kw_AST = null ; boolean synPredMatched510 = false ; if ( ( ( LA ( <NUM_LIT:1> ) == IDENT ) && ( LA ( <NUM_LIT:2> ) == COLON ) ) ) { int _m510 = mark ( ) ; synPredMatched510 = true ; inputState . guessing ++ ; try { { match ( IDENT ) ; } } catch ( RecognitionException pe ) { synPredMatched510 = false ; } rewind ( _m510 ) ; inputState . guessing -- ; } if ( synPredMatched510 ) { id = LT ( <NUM_LIT:1> ) ; id_AST = astFactory . create ( id ) ; astFactory . addASTChild ( currentAST , id_AST ) ; match ( IDENT ) ; if ( inputState . guessing == <NUM_LIT:0> ) { id_AST . setType ( STRING_LITERAL ) ; } argumentLabel_AST = ( AST ) currentAST . root ; } else { boolean synPredMatched512 = false ; if ( ( ( _tokenSet_79 . member ( LA ( <NUM_LIT:1> ) ) ) && ( LA ( <NUM_LIT:2> ) == COLON ) ) ) { int _m512 = mark ( ) ; synPredMatched512 = true ; inputState . guessing ++ ; try { { keywordPropertyNames ( ) ; } } catch ( RecognitionException pe ) { synPredMatched512 = false ; } rewind ( _m512 ) ; inputState . guessing -- ; } if ( synPredMatched512 ) { keywordPropertyNames ( ) ; kw_AST = ( AST ) returnAST ; astFactory . addASTChild ( currentAST , returnAST ) ; if ( inputState . guessing == <NUM_LIT:0> ) { kw_AST . setType ( STRING_LITERAL ) ; } argumentLabel_AST = ( AST ) currentAST . root ; } else if ( ( _tokenSet_80 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_78 . member ( LA ( <NUM_LIT:2> ) ) ) ) { primaryExpression ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; argumentLabel_AST = ( AST ) currentAST . root ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = argumentLabel_AST ; } public final void multipleAssignment ( int lc_stmt ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST multipleAssignment_AST = null ; Token first = cloneToken ( LT ( <NUM_LIT:1> ) ) ; AST tmp258_AST = null ; tmp258_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp258_AST ) ; match ( LPAREN ) ; nls ( ) ; listOfVariables ( null , null , first ) ; astFactory . addASTChild ( currentAST , returnAST ) ; match ( RPAREN ) ; AST tmp260_AST = null ; tmp260_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp260_AST ) ; match ( ASSIGN ) ; nls ( ) ; assignmentExpression ( lc_stmt ) ; astFactory . addASTChild ( currentAST , returnAST ) ; multipleAssignment_AST = ( AST ) currentAST . root ; returnAST = multipleAssignment_AST ; } public final void pathExpression ( int lc_stmt ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST pathExpression_AST = null ; AST pre_AST = null ; AST pe_AST = null ; AST apb_AST = null ; AST prefix = null ; primaryExpression ( ) ; pre_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { prefix = pre_AST ; } { _loop370 : do { boolean synPredMatched366 = false ; if ( ( ( _tokenSet_81 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_82 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m366 = mark ( ) ; synPredMatched366 = true ; inputState . guessing ++ ; try { { pathElementStart ( ) ; } } catch ( RecognitionException pe ) { synPredMatched366 = false ; } rewind ( _m366 ) ; inputState . guessing -- ; } if ( synPredMatched366 ) { nls ( ) ; pathElement ( prefix ) ; pe_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { prefix = pe_AST ; } } else { boolean synPredMatched368 = false ; if ( ( ( ( LA ( <NUM_LIT:1> ) == LCURLY || LA ( <NUM_LIT:1> ) == NLS ) && ( _tokenSet_14 . member ( LA ( <NUM_LIT:2> ) ) ) ) && ( lc_stmt == LC_STMT || lc_stmt == LC_INIT ) ) ) { int _m368 = mark ( ) ; synPredMatched368 = true ; inputState . guessing ++ ; try { { nls ( ) ; match ( LCURLY ) ; } } catch ( RecognitionException pe ) { synPredMatched368 = false ; } rewind ( _m368 ) ; inputState . guessing -- ; } if ( synPredMatched368 ) { nlsWarn ( ) ; appendedBlock ( prefix ) ; apb_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { prefix = apb_AST ; } } else if ( ( _tokenSet_83 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_84 . member ( LA ( <NUM_LIT:2> ) ) ) ) { { switch ( LA ( <NUM_LIT:1> ) ) { case DOT : { match ( DOT ) ; break ; } case SPREAD_DOT : { match ( SPREAD_DOT ) ; break ; } case OPTIONAL_DOT : { AST tmp263_AST = null ; tmp263_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp263_AST ) ; match ( OPTIONAL_DOT ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { reportError ( "<STR_LIT>" ) ; } } else { break _loop370 ; } } } while ( true ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { pathExpression_AST = ( AST ) currentAST . root ; pathExpression_AST = prefix ; lastPathExpression = pathExpression_AST ; currentAST . root = pathExpression_AST ; currentAST . child = pathExpression_AST != null && pathExpression_AST . getFirstChild ( ) != null ? pathExpression_AST . getFirstChild ( ) : pathExpression_AST ; currentAST . advanceChildToEnd ( ) ; } pathExpression_AST = ( AST ) currentAST . root ; returnAST = pathExpression_AST ; } public final void primaryExpression ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST primaryExpression_AST = null ; AST pe_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; switch ( LA ( <NUM_LIT:1> ) ) { case IDENT : { AST tmp264_AST = null ; tmp264_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp264_AST ) ; match ( IDENT ) ; primaryExpression_AST = ( AST ) currentAST . root ; break ; } case STRING_LITERAL : case LITERAL_false : case LITERAL_null : case LITERAL_true : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { constant ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; primaryExpression_AST = ( AST ) currentAST . root ; break ; } case LITERAL_new : { newExpression ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; primaryExpression_AST = ( AST ) currentAST . root ; break ; } case LITERAL_this : { AST tmp265_AST = null ; tmp265_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp265_AST ) ; match ( LITERAL_this ) ; primaryExpression_AST = ( AST ) currentAST . root ; break ; } case LITERAL_super : { AST tmp266_AST = null ; tmp266_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp266_AST ) ; match ( LITERAL_super ) ; primaryExpression_AST = ( AST ) currentAST . root ; break ; } case LPAREN : { parenthesizedExpression ( ) ; pe_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { primaryExpression_AST = ( AST ) currentAST . root ; primaryExpression_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( EXPR , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( pe_AST ) ) ; currentAST . root = primaryExpression_AST ; currentAST . child = primaryExpression_AST != null && primaryExpression_AST . getFirstChild ( ) != null ? primaryExpression_AST . getFirstChild ( ) : primaryExpression_AST ; currentAST . advanceChildToEnd ( ) ; } primaryExpression_AST = ( AST ) currentAST . root ; break ; } case LCURLY : { closableBlockConstructorExpression ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; primaryExpression_AST = ( AST ) currentAST . root ; break ; } case LBRACK : { listOrMapConstructorExpression ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; primaryExpression_AST = ( AST ) currentAST . root ; break ; } case STRING_CTOR_START : { stringConstructorExpression ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; primaryExpression_AST = ( AST ) currentAST . root ; break ; } case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : { builtInType ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; primaryExpression_AST = ( AST ) currentAST . root ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = primaryExpression_AST ; } public final void pathElementStart ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST pathElementStart_AST = null ; switch ( LA ( <NUM_LIT:1> ) ) { case DOT : case NLS : { { nls ( ) ; AST tmp267_AST = null ; tmp267_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( DOT ) ; } break ; } case SPREAD_DOT : { AST tmp268_AST = null ; tmp268_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( SPREAD_DOT ) ; break ; } case OPTIONAL_DOT : { AST tmp269_AST = null ; tmp269_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( OPTIONAL_DOT ) ; break ; } case MEMBER_POINTER : { AST tmp270_AST = null ; tmp270_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( MEMBER_POINTER ) ; break ; } case LBRACK : { AST tmp271_AST = null ; tmp271_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( LBRACK ) ; break ; } case LPAREN : { AST tmp272_AST = null ; tmp272_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( LPAREN ) ; break ; } case LCURLY : { AST tmp273_AST = null ; tmp273_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( LCURLY ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = pathElementStart_AST ; } public final void pathElement ( AST prefix ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST pathElement_AST = null ; AST ta_AST = null ; AST np_AST = null ; AST mca_AST = null ; AST apb_AST = null ; AST ipa_AST = null ; Token operator = LT ( <NUM_LIT:1> ) ; try { switch ( LA ( <NUM_LIT:1> ) ) { case DOT : case NLS : case SPREAD_DOT : case OPTIONAL_DOT : case MEMBER_POINTER : { if ( inputState . guessing == <NUM_LIT:0> ) { pathElement_AST = ( AST ) currentAST . root ; pathElement_AST = prefix ; currentAST . root = pathElement_AST ; currentAST . child = pathElement_AST != null && pathElement_AST . getFirstChild ( ) != null ? pathElement_AST . getFirstChild ( ) : pathElement_AST ; currentAST . advanceChildToEnd ( ) ; } { switch ( LA ( <NUM_LIT:1> ) ) { case SPREAD_DOT : { match ( SPREAD_DOT ) ; break ; } case OPTIONAL_DOT : { match ( OPTIONAL_DOT ) ; break ; } case MEMBER_POINTER : { match ( MEMBER_POINTER ) ; break ; } case DOT : case NLS : { { nls ( ) ; match ( DOT ) ; } break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } nls ( ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case LT : { typeArguments ( ) ; ta_AST = ( AST ) returnAST ; break ; } case FINAL : case ABSTRACT : case UNUSED_GOTO : case UNUSED_DO : case STRICTFP : case LITERAL_package : case LITERAL_import : case LITERAL_static : case LITERAL_def : case IDENT : case STRING_LITERAL : case LPAREN : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_extends : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_as : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : case LITERAL_default : case LITERAL_throws : case LITERAL_implements : case LITERAL_if : case LITERAL_else : case LITERAL_while : case LITERAL_switch : case LITERAL_for : case LITERAL_in : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case LITERAL_case : case LITERAL_try : case LITERAL_finally : case LITERAL_catch : case LITERAL_false : case LITERAL_instanceof : case LITERAL_new : case LITERAL_null : case LITERAL_true : case STRING_CTOR_START : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } namePart ( ) ; np_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { pathElement_AST = ( AST ) currentAST . root ; pathElement_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:4> ) ) . add ( create ( operator . getType ( ) , operator . getText ( ) , prefix , LT ( <NUM_LIT:1> ) ) ) . add ( prefix ) . add ( ta_AST ) . add ( np_AST ) ) ; currentAST . root = pathElement_AST ; currentAST . child = pathElement_AST != null && pathElement_AST . getFirstChild ( ) != null ? pathElement_AST . getFirstChild ( ) : pathElement_AST ; currentAST . advanceChildToEnd ( ) ; } pathElement_AST = ( AST ) currentAST . root ; break ; } case LPAREN : { methodCallArgs ( prefix ) ; mca_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { pathElement_AST = ( AST ) currentAST . root ; pathElement_AST = mca_AST ; currentAST . root = pathElement_AST ; currentAST . child = pathElement_AST != null && pathElement_AST . getFirstChild ( ) != null ? pathElement_AST . getFirstChild ( ) : pathElement_AST ; currentAST . advanceChildToEnd ( ) ; } pathElement_AST = ( AST ) currentAST . root ; break ; } case LCURLY : { appendedBlock ( prefix ) ; apb_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { pathElement_AST = ( AST ) currentAST . root ; pathElement_AST = apb_AST ; currentAST . root = pathElement_AST ; currentAST . child = pathElement_AST != null && pathElement_AST . getFirstChild ( ) != null ? pathElement_AST . getFirstChild ( ) : pathElement_AST ; currentAST . advanceChildToEnd ( ) ; } pathElement_AST = ( AST ) currentAST . root ; break ; } case LBRACK : { indexPropertyArgs ( prefix ) ; ipa_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { pathElement_AST = ( AST ) currentAST . root ; pathElement_AST = ipa_AST ; currentAST . root = pathElement_AST ; currentAST . child = pathElement_AST != null && pathElement_AST . getFirstChild ( ) != null ? pathElement_AST . getFirstChild ( ) : pathElement_AST ; currentAST . advanceChildToEnd ( ) ; } pathElement_AST = ( AST ) currentAST . root ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } catch ( RecognitionException e ) { if ( inputState . guessing == <NUM_LIT:0> ) { if ( pathElement_AST == null ) { throw e ; } reportError ( e ) ; } else { throw e ; } } returnAST = pathElement_AST ; } public final void appendedBlock ( AST callee ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST appendedBlock_AST = null ; AST cb_AST = null ; closableBlock ( ) ; cb_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { appendedBlock_AST = ( AST ) currentAST . root ; if ( callee != null && callee . getType ( ) == METHOD_CALL ) { appendedBlock_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( METHOD_CALL , "<STR_LIT:(>" , callee , LT ( <NUM_LIT:1> ) ) ) . add ( callee . getFirstChild ( ) ) . add ( cb_AST ) ) ; } else { appendedBlock_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( METHOD_CALL , "<STR_LIT:{>" , callee , LT ( <NUM_LIT:1> ) ) ) . add ( callee ) . add ( cb_AST ) ) ; } currentAST . root = appendedBlock_AST ; currentAST . child = appendedBlock_AST != null && appendedBlock_AST . getFirstChild ( ) != null ? appendedBlock_AST . getFirstChild ( ) : appendedBlock_AST ; currentAST . advanceChildToEnd ( ) ; } appendedBlock_AST = ( AST ) currentAST . root ; returnAST = appendedBlock_AST ; } public final void namePart ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST namePart_AST = null ; Token ats = null ; AST ats_AST = null ; Token sl = null ; AST sl_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case AT : { ats = LT ( <NUM_LIT:1> ) ; ats_AST = astFactory . create ( ats ) ; astFactory . makeASTRoot ( currentAST , ats_AST ) ; match ( AT ) ; if ( inputState . guessing == <NUM_LIT:0> ) { ats_AST . setType ( SELECT_SLOT ) ; } break ; } case FINAL : case ABSTRACT : case UNUSED_GOTO : case UNUSED_DO : case STRICTFP : case LITERAL_package : case LITERAL_import : case LITERAL_static : case LITERAL_def : case IDENT : case STRING_LITERAL : case LPAREN : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case LITERAL_extends : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_as : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : case LITERAL_default : case LITERAL_throws : case LITERAL_implements : case LITERAL_if : case LITERAL_else : case LITERAL_while : case LITERAL_switch : case LITERAL_for : case LITERAL_in : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case LITERAL_case : case LITERAL_try : case LITERAL_finally : case LITERAL_catch : case LITERAL_false : case LITERAL_instanceof : case LITERAL_new : case LITERAL_null : case LITERAL_true : case STRING_CTOR_START : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } { switch ( LA ( <NUM_LIT:1> ) ) { case IDENT : { AST tmp278_AST = null ; tmp278_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp278_AST ) ; match ( IDENT ) ; break ; } case STRING_LITERAL : { sl = LT ( <NUM_LIT:1> ) ; sl_AST = astFactory . create ( sl ) ; astFactory . addASTChild ( currentAST , sl_AST ) ; match ( STRING_LITERAL ) ; if ( inputState . guessing == <NUM_LIT:0> ) { sl_AST . setType ( IDENT ) ; } break ; } case LPAREN : case STRING_CTOR_START : { dynamicMemberName ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case LCURLY : { openBlock ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case FINAL : case ABSTRACT : case UNUSED_GOTO : case UNUSED_DO : case STRICTFP : case LITERAL_package : case LITERAL_import : case LITERAL_static : case LITERAL_def : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case LITERAL_extends : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_as : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LITERAL_default : case LITERAL_throws : case LITERAL_implements : case LITERAL_if : case LITERAL_else : case LITERAL_while : case LITERAL_switch : case LITERAL_for : case LITERAL_in : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case LITERAL_case : case LITERAL_try : case LITERAL_finally : case LITERAL_catch : case LITERAL_false : case LITERAL_instanceof : case LITERAL_new : case LITERAL_null : case LITERAL_true : { keywordPropertyNames ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } namePart_AST = ( AST ) currentAST . root ; returnAST = namePart_AST ; } public final void methodCallArgs ( AST callee ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST methodCallArgs_AST = null ; AST al_AST = null ; match ( LPAREN ) ; argList ( ) ; al_AST = ( AST ) returnAST ; match ( RPAREN ) ; if ( inputState . guessing == <NUM_LIT:0> ) { methodCallArgs_AST = ( AST ) currentAST . root ; if ( callee != null && callee . getFirstChild ( ) != null ) { methodCallArgs_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( METHOD_CALL , "<STR_LIT:(>" , callee . getFirstChild ( ) , LT ( <NUM_LIT:1> ) ) ) . add ( callee ) . add ( al_AST ) ) ; } else { methodCallArgs_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( METHOD_CALL , "<STR_LIT:(>" , callee , LT ( <NUM_LIT:1> ) ) ) . add ( callee ) . add ( al_AST ) ) ; } currentAST . root = methodCallArgs_AST ; currentAST . child = methodCallArgs_AST != null && methodCallArgs_AST . getFirstChild ( ) != null ? methodCallArgs_AST . getFirstChild ( ) : methodCallArgs_AST ; currentAST . advanceChildToEnd ( ) ; } methodCallArgs_AST = ( AST ) currentAST . root ; returnAST = methodCallArgs_AST ; } public final void indexPropertyArgs ( AST indexee ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST indexPropertyArgs_AST = null ; AST al_AST = null ; match ( LBRACK ) ; argList ( ) ; al_AST = ( AST ) returnAST ; match ( RBRACK ) ; if ( inputState . guessing == <NUM_LIT:0> ) { indexPropertyArgs_AST = ( AST ) currentAST . root ; if ( indexee != null && indexee . getFirstChild ( ) != null ) { indexPropertyArgs_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( INDEX_OP , "<STR_LIT>" , indexee . getFirstChild ( ) , LT ( <NUM_LIT:1> ) ) ) . add ( indexee ) . add ( al_AST ) ) ; } else { indexPropertyArgs_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( INDEX_OP , "<STR_LIT>" , indexee , LT ( <NUM_LIT:1> ) ) ) . add ( indexee ) . add ( al_AST ) ) ; } currentAST . root = indexPropertyArgs_AST ; currentAST . child = indexPropertyArgs_AST != null && indexPropertyArgs_AST . getFirstChild ( ) != null ? indexPropertyArgs_AST . getFirstChild ( ) : indexPropertyArgs_AST ; currentAST . advanceChildToEnd ( ) ; } indexPropertyArgs_AST = ( AST ) currentAST . root ; returnAST = indexPropertyArgs_AST ; } public final void dynamicMemberName ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST dynamicMemberName_AST = null ; AST pe_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case LPAREN : { parenthesizedExpression ( ) ; pe_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { dynamicMemberName_AST = ( AST ) currentAST . root ; dynamicMemberName_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( EXPR , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( pe_AST ) ) ; currentAST . root = dynamicMemberName_AST ; currentAST . child = dynamicMemberName_AST != null && dynamicMemberName_AST . getFirstChild ( ) != null ? dynamicMemberName_AST . getFirstChild ( ) : dynamicMemberName_AST ; currentAST . advanceChildToEnd ( ) ; } break ; } case STRING_CTOR_START : { stringConstructorExpression ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { dynamicMemberName_AST = ( AST ) currentAST . root ; dynamicMemberName_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( DYNAMIC_MEMBER , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( dynamicMemberName_AST ) ) ; currentAST . root = dynamicMemberName_AST ; currentAST . child = dynamicMemberName_AST != null && dynamicMemberName_AST . getFirstChild ( ) != null ? dynamicMemberName_AST . getFirstChild ( ) : dynamicMemberName_AST ; currentAST . advanceChildToEnd ( ) ; } dynamicMemberName_AST = ( AST ) currentAST . root ; returnAST = dynamicMemberName_AST ; } public final void parenthesizedExpression ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST parenthesizedExpression_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; Token declaration = null ; boolean hasClosureList = false ; boolean firstContainsDeclaration = false ; boolean sce = false ; match ( LPAREN ) ; if ( inputState . guessing == <NUM_LIT:0> ) { declaration = LT ( <NUM_LIT:1> ) ; } firstContainsDeclaration = strictContextExpression ( true ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop470 : do { if ( ( LA ( <NUM_LIT:1> ) == SEMI ) ) { match ( SEMI ) ; if ( inputState . guessing == <NUM_LIT:0> ) { hasClosureList = true ; } { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case AT : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : case LITERAL_this : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case PLUS : case MINUS : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { sce = strictContextExpression ( true ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case RPAREN : case SEMI : { if ( inputState . guessing == <NUM_LIT:0> ) { astFactory . addASTChild ( currentAST , astFactory . create ( EMPTY_STAT , "<STR_LIT>" ) ) ; } break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } } else { break _loop470 ; } } while ( true ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { if ( firstContainsDeclaration && ! hasClosureList ) throw new NoViableAltException ( declaration , getFilename ( ) ) ; } match ( RPAREN ) ; if ( inputState . guessing == <NUM_LIT:0> ) { parenthesizedExpression_AST = ( AST ) currentAST . root ; if ( hasClosureList ) { parenthesizedExpression_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( CLOSURE_LIST , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( parenthesizedExpression_AST ) ) ; } currentAST . root = parenthesizedExpression_AST ; currentAST . child = parenthesizedExpression_AST != null && parenthesizedExpression_AST . getFirstChild ( ) != null ? parenthesizedExpression_AST . getFirstChild ( ) : parenthesizedExpression_AST ; currentAST . advanceChildToEnd ( ) ; } parenthesizedExpression_AST = ( AST ) currentAST . root ; returnAST = parenthesizedExpression_AST ; } public final void stringConstructorExpression ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST stringConstructorExpression_AST = null ; Token cs = null ; AST cs_AST = null ; Token cm = null ; AST cm_AST = null ; Token ce = null ; AST ce_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; cs = LT ( <NUM_LIT:1> ) ; cs_AST = astFactory . create ( cs ) ; astFactory . addASTChild ( currentAST , cs_AST ) ; match ( STRING_CTOR_START ) ; if ( inputState . guessing == <NUM_LIT:0> ) { cs_AST . setType ( STRING_LITERAL ) ; } stringConstructorValuePart ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop480 : do { if ( ( LA ( <NUM_LIT:1> ) == STRING_CTOR_MIDDLE ) ) { cm = LT ( <NUM_LIT:1> ) ; cm_AST = astFactory . create ( cm ) ; astFactory . addASTChild ( currentAST , cm_AST ) ; match ( STRING_CTOR_MIDDLE ) ; if ( inputState . guessing == <NUM_LIT:0> ) { cm_AST . setType ( STRING_LITERAL ) ; } stringConstructorValuePart ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop480 ; } } while ( true ) ; } ce = LT ( <NUM_LIT:1> ) ; ce_AST = astFactory . create ( ce ) ; astFactory . addASTChild ( currentAST , ce_AST ) ; match ( STRING_CTOR_END ) ; if ( inputState . guessing == <NUM_LIT:0> ) { stringConstructorExpression_AST = ( AST ) currentAST . root ; ce_AST . setType ( STRING_LITERAL ) ; stringConstructorExpression_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( STRING_CONSTRUCTOR , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( stringConstructorExpression_AST ) ) ; currentAST . root = stringConstructorExpression_AST ; currentAST . child = stringConstructorExpression_AST != null && stringConstructorExpression_AST . getFirstChild ( ) != null ? stringConstructorExpression_AST . getFirstChild ( ) : stringConstructorExpression_AST ; currentAST . advanceChildToEnd ( ) ; } stringConstructorExpression_AST = ( AST ) currentAST . root ; returnAST = stringConstructorExpression_AST ; } public final void logicalOrExpression ( int lc_stmt ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST logicalOrExpression_AST = null ; logicalAndExpression ( lc_stmt ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop396 : do { if ( ( LA ( <NUM_LIT:1> ) == LOR ) ) { AST tmp286_AST = null ; tmp286_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp286_AST ) ; match ( LOR ) ; nls ( ) ; logicalAndExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop396 ; } } while ( true ) ; } logicalOrExpression_AST = ( AST ) currentAST . root ; returnAST = logicalOrExpression_AST ; } public final void logicalAndExpression ( int lc_stmt ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST logicalAndExpression_AST = null ; inclusiveOrExpression ( lc_stmt ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop399 : do { if ( ( LA ( <NUM_LIT:1> ) == LAND ) ) { AST tmp287_AST = null ; tmp287_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp287_AST ) ; match ( LAND ) ; nls ( ) ; inclusiveOrExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop399 ; } } while ( true ) ; } logicalAndExpression_AST = ( AST ) currentAST . root ; returnAST = logicalAndExpression_AST ; } public final void inclusiveOrExpression ( int lc_stmt ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST inclusiveOrExpression_AST = null ; exclusiveOrExpression ( lc_stmt ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop402 : do { if ( ( LA ( <NUM_LIT:1> ) == BOR ) ) { AST tmp288_AST = null ; tmp288_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp288_AST ) ; match ( BOR ) ; nls ( ) ; exclusiveOrExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop402 ; } } while ( true ) ; } inclusiveOrExpression_AST = ( AST ) currentAST . root ; returnAST = inclusiveOrExpression_AST ; } public final void exclusiveOrExpression ( int lc_stmt ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST exclusiveOrExpression_AST = null ; andExpression ( lc_stmt ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop405 : do { if ( ( LA ( <NUM_LIT:1> ) == BXOR ) ) { AST tmp289_AST = null ; tmp289_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp289_AST ) ; match ( BXOR ) ; nls ( ) ; andExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop405 ; } } while ( true ) ; } exclusiveOrExpression_AST = ( AST ) currentAST . root ; returnAST = exclusiveOrExpression_AST ; } public final void andExpression ( int lc_stmt ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST andExpression_AST = null ; regexExpression ( lc_stmt ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop408 : do { if ( ( LA ( <NUM_LIT:1> ) == BAND ) ) { AST tmp290_AST = null ; tmp290_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp290_AST ) ; match ( BAND ) ; nls ( ) ; regexExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop408 ; } } while ( true ) ; } andExpression_AST = ( AST ) currentAST . root ; returnAST = andExpression_AST ; } public final void regexExpression ( int lc_stmt ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST regexExpression_AST = null ; equalityExpression ( lc_stmt ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop412 : do { if ( ( LA ( <NUM_LIT:1> ) == REGEX_FIND || LA ( <NUM_LIT:1> ) == REGEX_MATCH ) ) { { switch ( LA ( <NUM_LIT:1> ) ) { case REGEX_FIND : { AST tmp291_AST = null ; tmp291_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp291_AST ) ; match ( REGEX_FIND ) ; break ; } case REGEX_MATCH : { AST tmp292_AST = null ; tmp292_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp292_AST ) ; match ( REGEX_MATCH ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } nls ( ) ; equalityExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop412 ; } } while ( true ) ; } regexExpression_AST = ( AST ) currentAST . root ; returnAST = regexExpression_AST ; } public final void equalityExpression ( int lc_stmt ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST equalityExpression_AST = null ; relationalExpression ( lc_stmt ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop416 : do { if ( ( ( LA ( <NUM_LIT:1> ) >= NOT_EQUAL && LA ( <NUM_LIT:1> ) <= COMPARE_TO ) ) ) { { switch ( LA ( <NUM_LIT:1> ) ) { case NOT_EQUAL : { AST tmp293_AST = null ; tmp293_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp293_AST ) ; match ( NOT_EQUAL ) ; break ; } case EQUAL : { AST tmp294_AST = null ; tmp294_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp294_AST ) ; match ( EQUAL ) ; break ; } case COMPARE_TO : { AST tmp295_AST = null ; tmp295_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp295_AST ) ; match ( COMPARE_TO ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } nls ( ) ; relationalExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop416 ; } } while ( true ) ; } equalityExpression_AST = ( AST ) currentAST . root ; returnAST = equalityExpression_AST ; } public final void relationalExpression ( int lc_stmt ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST relationalExpression_AST = null ; shiftExpression ( lc_stmt ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { if ( ( _tokenSet_85 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_86 . member ( LA ( <NUM_LIT:2> ) ) ) ) { { { switch ( LA ( <NUM_LIT:1> ) ) { case LT : { AST tmp296_AST = null ; tmp296_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp296_AST ) ; match ( LT ) ; break ; } case GT : { AST tmp297_AST = null ; tmp297_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp297_AST ) ; match ( GT ) ; break ; } case LE : { AST tmp298_AST = null ; tmp298_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp298_AST ) ; match ( LE ) ; break ; } case GE : { AST tmp299_AST = null ; tmp299_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp299_AST ) ; match ( GE ) ; break ; } case LITERAL_in : { AST tmp300_AST = null ; tmp300_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp300_AST ) ; match ( LITERAL_in ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } nls ( ) ; shiftExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } } else if ( ( LA ( <NUM_LIT:1> ) == LITERAL_instanceof ) && ( _tokenSet_87 . member ( LA ( <NUM_LIT:2> ) ) ) ) { AST tmp301_AST = null ; tmp301_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp301_AST ) ; match ( LITERAL_instanceof ) ; nls ( ) ; typeSpec ( true ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else if ( ( LA ( <NUM_LIT:1> ) == LITERAL_as ) && ( _tokenSet_87 . member ( LA ( <NUM_LIT:2> ) ) ) ) { AST tmp302_AST = null ; tmp302_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp302_AST ) ; match ( LITERAL_as ) ; nls ( ) ; typeSpec ( true ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else if ( ( _tokenSet_88 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_64 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } relationalExpression_AST = ( AST ) currentAST . root ; returnAST = relationalExpression_AST ; } public final void additiveExpression ( int lc_stmt ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST additiveExpression_AST = null ; multiplicativeExpression ( lc_stmt ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop429 : do { if ( ( LA ( <NUM_LIT:1> ) == PLUS || LA ( <NUM_LIT:1> ) == MINUS ) && ( _tokenSet_86 . member ( LA ( <NUM_LIT:2> ) ) ) ) { { switch ( LA ( <NUM_LIT:1> ) ) { case PLUS : { AST tmp303_AST = null ; tmp303_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp303_AST ) ; match ( PLUS ) ; break ; } case MINUS : { AST tmp304_AST = null ; tmp304_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp304_AST ) ; match ( MINUS ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } nls ( ) ; multiplicativeExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop429 ; } } while ( true ) ; } additiveExpression_AST = ( AST ) currentAST . root ; returnAST = additiveExpression_AST ; } public final void multiplicativeExpression ( int lc_stmt ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST multiplicativeExpression_AST = null ; switch ( LA ( <NUM_LIT:1> ) ) { case INC : { { AST tmp305_AST = null ; tmp305_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp305_AST ) ; match ( INC ) ; nls ( ) ; powerExpressionNotPlusMinus ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop434 : do { if ( ( _tokenSet_89 . member ( LA ( <NUM_LIT:1> ) ) ) ) { { switch ( LA ( <NUM_LIT:1> ) ) { case STAR : { AST tmp306_AST = null ; tmp306_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp306_AST ) ; match ( STAR ) ; break ; } case DIV : { AST tmp307_AST = null ; tmp307_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp307_AST ) ; match ( DIV ) ; break ; } case MOD : { AST tmp308_AST = null ; tmp308_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp308_AST ) ; match ( MOD ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } nls ( ) ; powerExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop434 ; } } while ( true ) ; } } multiplicativeExpression_AST = ( AST ) currentAST . root ; break ; } case DEC : { { AST tmp309_AST = null ; tmp309_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp309_AST ) ; match ( DEC ) ; nls ( ) ; powerExpressionNotPlusMinus ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop438 : do { if ( ( _tokenSet_89 . member ( LA ( <NUM_LIT:1> ) ) ) ) { { switch ( LA ( <NUM_LIT:1> ) ) { case STAR : { AST tmp310_AST = null ; tmp310_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp310_AST ) ; match ( STAR ) ; break ; } case DIV : { AST tmp311_AST = null ; tmp311_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp311_AST ) ; match ( DIV ) ; break ; } case MOD : { AST tmp312_AST = null ; tmp312_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp312_AST ) ; match ( MOD ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } nls ( ) ; powerExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop438 ; } } while ( true ) ; } } multiplicativeExpression_AST = ( AST ) currentAST . root ; break ; } case MINUS : { { AST tmp313_AST = null ; tmp313_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp313_AST ) ; match ( MINUS ) ; if ( inputState . guessing == <NUM_LIT:0> ) { tmp313_AST . setType ( UNARY_MINUS ) ; } nls ( ) ; powerExpressionNotPlusMinus ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop442 : do { if ( ( _tokenSet_89 . member ( LA ( <NUM_LIT:1> ) ) ) ) { { switch ( LA ( <NUM_LIT:1> ) ) { case STAR : { AST tmp314_AST = null ; tmp314_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp314_AST ) ; match ( STAR ) ; break ; } case DIV : { AST tmp315_AST = null ; tmp315_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp315_AST ) ; match ( DIV ) ; break ; } case MOD : { AST tmp316_AST = null ; tmp316_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp316_AST ) ; match ( MOD ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } nls ( ) ; powerExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop442 ; } } while ( true ) ; } } multiplicativeExpression_AST = ( AST ) currentAST . root ; break ; } case PLUS : { { AST tmp317_AST = null ; tmp317_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp317_AST ) ; match ( PLUS ) ; if ( inputState . guessing == <NUM_LIT:0> ) { tmp317_AST . setType ( UNARY_PLUS ) ; } nls ( ) ; powerExpressionNotPlusMinus ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop446 : do { if ( ( _tokenSet_89 . member ( LA ( <NUM_LIT:1> ) ) ) ) { { switch ( LA ( <NUM_LIT:1> ) ) { case STAR : { AST tmp318_AST = null ; tmp318_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp318_AST ) ; match ( STAR ) ; break ; } case DIV : { AST tmp319_AST = null ; tmp319_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp319_AST ) ; match ( DIV ) ; break ; } case MOD : { AST tmp320_AST = null ; tmp320_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp320_AST ) ; match ( MOD ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } nls ( ) ; powerExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop446 ; } } while ( true ) ; } } multiplicativeExpression_AST = ( AST ) currentAST . root ; break ; } case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LCURLY : case LITERAL_this : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { { powerExpressionNotPlusMinus ( lc_stmt ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop450 : do { if ( ( _tokenSet_89 . member ( LA ( <NUM_LIT:1> ) ) ) ) { { switch ( LA ( <NUM_LIT:1> ) ) { case STAR : { AST tmp321_AST = null ; tmp321_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp321_AST ) ; match ( STAR ) ; break ; } case DIV : { AST tmp322_AST = null ; tmp322_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp322_AST ) ; match ( DIV ) ; break ; } case MOD : { AST tmp323_AST = null ; tmp323_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp323_AST ) ; match ( MOD ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } nls ( ) ; powerExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop450 ; } } while ( true ) ; } } multiplicativeExpression_AST = ( AST ) currentAST . root ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = multiplicativeExpression_AST ; } public final void powerExpressionNotPlusMinus ( int lc_stmt ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST powerExpressionNotPlusMinus_AST = null ; unaryExpressionNotPlusMinus ( lc_stmt ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop456 : do { if ( ( LA ( <NUM_LIT:1> ) == STAR_STAR ) ) { AST tmp324_AST = null ; tmp324_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp324_AST ) ; match ( STAR_STAR ) ; nls ( ) ; unaryExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop456 ; } } while ( true ) ; } powerExpressionNotPlusMinus_AST = ( AST ) currentAST . root ; returnAST = powerExpressionNotPlusMinus_AST ; } public final void powerExpression ( int lc_stmt ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST powerExpression_AST = null ; unaryExpression ( lc_stmt ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop453 : do { if ( ( LA ( <NUM_LIT:1> ) == STAR_STAR ) ) { AST tmp325_AST = null ; tmp325_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp325_AST ) ; match ( STAR_STAR ) ; nls ( ) ; unaryExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop453 ; } } while ( true ) ; } powerExpression_AST = ( AST ) currentAST . root ; returnAST = powerExpression_AST ; } public final void unaryExpression ( int lc_stmt ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST unaryExpression_AST = null ; switch ( LA ( <NUM_LIT:1> ) ) { case INC : { AST tmp326_AST = null ; tmp326_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp326_AST ) ; match ( INC ) ; nls ( ) ; unaryExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; unaryExpression_AST = ( AST ) currentAST . root ; break ; } case DEC : { AST tmp327_AST = null ; tmp327_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp327_AST ) ; match ( DEC ) ; nls ( ) ; unaryExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; unaryExpression_AST = ( AST ) currentAST . root ; break ; } case MINUS : { AST tmp328_AST = null ; tmp328_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp328_AST ) ; match ( MINUS ) ; if ( inputState . guessing == <NUM_LIT:0> ) { tmp328_AST . setType ( UNARY_MINUS ) ; } nls ( ) ; unaryExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; unaryExpression_AST = ( AST ) currentAST . root ; break ; } case PLUS : { AST tmp329_AST = null ; tmp329_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp329_AST ) ; match ( PLUS ) ; if ( inputState . guessing == <NUM_LIT:0> ) { tmp329_AST . setType ( UNARY_PLUS ) ; } nls ( ) ; unaryExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; unaryExpression_AST = ( AST ) currentAST . root ; break ; } case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LCURLY : case LITERAL_this : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { unaryExpressionNotPlusMinus ( lc_stmt ) ; astFactory . addASTChild ( currentAST , returnAST ) ; unaryExpression_AST = ( AST ) currentAST . root ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = unaryExpression_AST ; } public final void unaryExpressionNotPlusMinus ( int lc_stmt ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST unaryExpressionNotPlusMinus_AST = null ; Token lpb = null ; AST lpb_AST = null ; Token lp = null ; AST lp_AST = null ; switch ( LA ( <NUM_LIT:1> ) ) { case BNOT : { AST tmp330_AST = null ; tmp330_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp330_AST ) ; match ( BNOT ) ; nls ( ) ; unaryExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; unaryExpressionNotPlusMinus_AST = ( AST ) currentAST . root ; break ; } case LNOT : { AST tmp331_AST = null ; tmp331_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp331_AST ) ; match ( LNOT ) ; nls ( ) ; unaryExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; unaryExpressionNotPlusMinus_AST = ( AST ) currentAST . root ; break ; } case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LCURLY : case LITERAL_this : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { { boolean synPredMatched461 = false ; if ( ( ( LA ( <NUM_LIT:1> ) == LPAREN ) && ( ( LA ( <NUM_LIT:2> ) >= LITERAL_void && LA ( <NUM_LIT:2> ) <= LITERAL_double ) ) ) ) { int _m461 = mark ( ) ; synPredMatched461 = true ; inputState . guessing ++ ; try { { match ( LPAREN ) ; builtInTypeSpec ( true ) ; match ( RPAREN ) ; unaryExpression ( <NUM_LIT:0> ) ; } } catch ( RecognitionException pe ) { synPredMatched461 = false ; } rewind ( _m461 ) ; inputState . guessing -- ; } if ( synPredMatched461 ) { lpb = LT ( <NUM_LIT:1> ) ; lpb_AST = astFactory . create ( lpb ) ; astFactory . makeASTRoot ( currentAST , lpb_AST ) ; match ( LPAREN ) ; if ( inputState . guessing == <NUM_LIT:0> ) { lpb_AST . setType ( TYPECAST ) ; } builtInTypeSpec ( true ) ; astFactory . addASTChild ( currentAST , returnAST ) ; match ( RPAREN ) ; unaryExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { boolean synPredMatched463 = false ; if ( ( ( LA ( <NUM_LIT:1> ) == LPAREN ) && ( LA ( <NUM_LIT:2> ) == IDENT ) ) ) { int _m463 = mark ( ) ; synPredMatched463 = true ; inputState . guessing ++ ; try { { match ( LPAREN ) ; classTypeSpec ( true ) ; match ( RPAREN ) ; unaryExpressionNotPlusMinus ( <NUM_LIT:0> ) ; } } catch ( RecognitionException pe ) { synPredMatched463 = false ; } rewind ( _m463 ) ; inputState . guessing -- ; } if ( synPredMatched463 ) { lp = LT ( <NUM_LIT:1> ) ; lp_AST = astFactory . create ( lp ) ; astFactory . makeASTRoot ( currentAST , lp_AST ) ; match ( LPAREN ) ; if ( inputState . guessing == <NUM_LIT:0> ) { lp_AST . setType ( TYPECAST ) ; } classTypeSpec ( true ) ; astFactory . addASTChild ( currentAST , returnAST ) ; match ( RPAREN ) ; unaryExpressionNotPlusMinus ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else if ( ( _tokenSet_80 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_33 . member ( LA ( <NUM_LIT:2> ) ) ) ) { postfixExpression ( lc_stmt ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } unaryExpressionNotPlusMinus_AST = ( AST ) currentAST . root ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = unaryExpressionNotPlusMinus_AST ; } public final void postfixExpression ( int lc_stmt ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST postfixExpression_AST = null ; Token in = null ; AST in_AST = null ; Token de = null ; AST de_AST = null ; pathExpression ( lc_stmt ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { if ( ( LA ( <NUM_LIT:1> ) == INC ) && ( _tokenSet_90 . member ( LA ( <NUM_LIT:2> ) ) ) ) { in = LT ( <NUM_LIT:1> ) ; in_AST = astFactory . create ( in ) ; astFactory . makeASTRoot ( currentAST , in_AST ) ; match ( INC ) ; if ( inputState . guessing == <NUM_LIT:0> ) { in_AST . setType ( POST_INC ) ; } } else if ( ( LA ( <NUM_LIT:1> ) == DEC ) && ( _tokenSet_90 . member ( LA ( <NUM_LIT:2> ) ) ) ) { de = LT ( <NUM_LIT:1> ) ; de_AST = astFactory . create ( de ) ; astFactory . makeASTRoot ( currentAST , de_AST ) ; match ( DEC ) ; if ( inputState . guessing == <NUM_LIT:0> ) { de_AST . setType ( POST_DEC ) ; } } else if ( ( _tokenSet_90 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_64 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } postfixExpression_AST = ( AST ) currentAST . root ; returnAST = postfixExpression_AST ; } public final void constant ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST constant_AST = null ; switch ( LA ( <NUM_LIT:1> ) ) { case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { constantNumber ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; constant_AST = ( AST ) currentAST . root ; break ; } case STRING_LITERAL : { AST tmp334_AST = null ; tmp334_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp334_AST ) ; match ( STRING_LITERAL ) ; constant_AST = ( AST ) currentAST . root ; break ; } case LITERAL_true : { AST tmp335_AST = null ; tmp335_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp335_AST ) ; match ( LITERAL_true ) ; constant_AST = ( AST ) currentAST . root ; break ; } case LITERAL_false : { AST tmp336_AST = null ; tmp336_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp336_AST ) ; match ( LITERAL_false ) ; constant_AST = ( AST ) currentAST . root ; break ; } case LITERAL_null : { AST tmp337_AST = null ; tmp337_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp337_AST ) ; match ( LITERAL_null ) ; constant_AST = ( AST ) currentAST . root ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = constant_AST ; } public final void newExpression ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST newExpression_AST = null ; AST ta_AST = null ; AST t_AST = null ; AST mca_AST = null ; AST apb1_AST = null ; AST ad_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; int jumpBack = mark ( ) ; try { match ( LITERAL_new ) ; nls ( ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case LT : { typeArguments ( ) ; ta_AST = ( AST ) returnAST ; break ; } case LBRACK : case IDENT : case LPAREN : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } { switch ( LA ( <NUM_LIT:1> ) ) { case IDENT : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : { type ( ) ; t_AST = ( AST ) returnAST ; break ; } case LBRACK : case LPAREN : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } { switch ( LA ( <NUM_LIT:1> ) ) { case LPAREN : case NLS : { nls ( ) ; methodCallArgs ( null ) ; mca_AST = ( AST ) returnAST ; { if ( ( LA ( <NUM_LIT:1> ) == LCURLY ) && ( _tokenSet_14 . member ( LA ( <NUM_LIT:2> ) ) ) ) { appendedBlock ( mca_AST ) ; apb1_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { mca_AST = apb1_AST ; } } else if ( ( _tokenSet_84 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_64 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } if ( inputState . guessing == <NUM_LIT:0> ) { newExpression_AST = ( AST ) currentAST . root ; mca_AST = mca_AST . getFirstChild ( ) ; newExpression_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:4> ) ) . add ( create ( LITERAL_new , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( ta_AST ) . add ( t_AST ) . add ( mca_AST ) ) ; currentAST . root = newExpression_AST ; currentAST . child = newExpression_AST != null && newExpression_AST . getFirstChild ( ) != null ? newExpression_AST . getFirstChild ( ) : newExpression_AST ; currentAST . advanceChildToEnd ( ) ; } break ; } case LBRACK : { newArrayDeclarator ( ) ; ad_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { newExpression_AST = ( AST ) currentAST . root ; newExpression_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:4> ) ) . add ( create ( LITERAL_new , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( ta_AST ) . add ( t_AST ) . add ( ad_AST ) ) ; currentAST . root = newExpression_AST ; currentAST . child = newExpression_AST != null && newExpression_AST . getFirstChild ( ) != null ? newExpression_AST . getFirstChild ( ) : newExpression_AST ; currentAST . advanceChildToEnd ( ) ; } break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } newExpression_AST = ( AST ) currentAST . root ; } catch ( RecognitionException e ) { if ( inputState . guessing == <NUM_LIT:0> ) { if ( t_AST == null ) { reportError ( "<STR_LIT>" , first ) ; newExpression_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( LITERAL_new , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( ta_AST ) . add ( null ) ) ; if ( e instanceof MismatchedTokenException || e instanceof NoViableAltException ) { rewind ( jumpBack ) ; consumeUntil ( NLS ) ; } } else if ( mca_AST == null && ad_AST == null ) { reportError ( "<STR_LIT>" , t_AST ) ; newExpression_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( LITERAL_new , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( ta_AST ) . add ( t_AST ) ) ; if ( e instanceof MismatchedTokenException ) { Token t = ( ( MismatchedTokenException ) e ) . token ; int i = ( ( MismatchedTokenException ) e ) . token . getType ( ) ; rewind ( jumpBack ) ; consume ( ) ; consumeUntil ( NLS ) ; } } else { throw e ; } } else { throw e ; } } returnAST = newExpression_AST ; } public final void closableBlockConstructorExpression ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST closableBlockConstructorExpression_AST = null ; closableBlock ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; closableBlockConstructorExpression_AST = ( AST ) currentAST . root ; returnAST = closableBlockConstructorExpression_AST ; } public final void listOrMapConstructorExpression ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST listOrMapConstructorExpression_AST = null ; Token lcon = null ; AST lcon_AST = null ; AST args_AST = null ; Token emcon = null ; AST emcon_AST = null ; boolean hasLabels = false ; if ( ( LA ( <NUM_LIT:1> ) == LBRACK ) && ( _tokenSet_91 . member ( LA ( <NUM_LIT:2> ) ) ) ) { lcon = LT ( <NUM_LIT:1> ) ; lcon_AST = astFactory . create ( lcon ) ; match ( LBRACK ) ; argList ( ) ; args_AST = ( AST ) returnAST ; astFactory . addASTChild ( currentAST , returnAST ) ; if ( inputState . guessing == <NUM_LIT:0> ) { hasLabels |= argListHasLabels ; } match ( RBRACK ) ; if ( inputState . guessing == <NUM_LIT:0> ) { listOrMapConstructorExpression_AST = ( AST ) currentAST . root ; int type = hasLabels ? MAP_CONSTRUCTOR : LIST_CONSTRUCTOR ; listOrMapConstructorExpression_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( type , "<STR_LIT:[>" , lcon_AST , LT ( <NUM_LIT:1> ) ) ) . add ( args_AST ) ) ; currentAST . root = listOrMapConstructorExpression_AST ; currentAST . child = listOrMapConstructorExpression_AST != null && listOrMapConstructorExpression_AST . getFirstChild ( ) != null ? listOrMapConstructorExpression_AST . getFirstChild ( ) : listOrMapConstructorExpression_AST ; currentAST . advanceChildToEnd ( ) ; } listOrMapConstructorExpression_AST = ( AST ) currentAST . root ; } else if ( ( LA ( <NUM_LIT:1> ) == LBRACK ) && ( LA ( <NUM_LIT:2> ) == COLON ) ) { emcon = LT ( <NUM_LIT:1> ) ; emcon_AST = astFactory . create ( emcon ) ; astFactory . makeASTRoot ( currentAST , emcon_AST ) ; match ( LBRACK ) ; match ( COLON ) ; match ( RBRACK ) ; if ( inputState . guessing == <NUM_LIT:0> ) { emcon_AST . setType ( MAP_CONSTRUCTOR ) ; } listOrMapConstructorExpression_AST = ( AST ) currentAST . root ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } returnAST = listOrMapConstructorExpression_AST ; } public final void stringConstructorValuePart ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST stringConstructorValuePart_AST = null ; { switch ( LA ( <NUM_LIT:1> ) ) { case IDENT : { identifier ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case LCURLY : { openOrClosableBlock ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } stringConstructorValuePart_AST = ( AST ) currentAST . root ; returnAST = stringConstructorValuePart_AST ; } public final void newArrayDeclarator ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST newArrayDeclarator_AST = null ; Token lb = null ; AST lb_AST = null ; { int _cnt520 = <NUM_LIT:0> ; _loop520 : do { if ( ( LA ( <NUM_LIT:1> ) == LBRACK ) && ( _tokenSet_92 . member ( LA ( <NUM_LIT:2> ) ) ) ) { lb = LT ( <NUM_LIT:1> ) ; lb_AST = astFactory . create ( lb ) ; astFactory . makeASTRoot ( currentAST , lb_AST ) ; match ( LBRACK ) ; if ( inputState . guessing == <NUM_LIT:0> ) { lb_AST . setType ( ARRAY_DECLARATOR ) ; } { switch ( LA ( <NUM_LIT:1> ) ) { case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LCURLY : case LITERAL_this : case PLUS : case MINUS : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { expression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case RBRACK : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } match ( RBRACK ) ; } else { if ( _cnt520 >= <NUM_LIT:1> ) { break _loop520 ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } _cnt520 ++ ; } while ( true ) ; } newArrayDeclarator_AST = ( AST ) currentAST . root ; returnAST = newArrayDeclarator_AST ; } public final byte argument ( ) throws RecognitionException , TokenStreamException { byte hasLabelOrSpread = <NUM_LIT:0> ; returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST argument_AST = null ; Token c = null ; AST c_AST = null ; Token sp = null ; AST sp_AST = null ; boolean sce = false ; { boolean synPredMatched506 = false ; if ( ( ( _tokenSet_77 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_78 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m506 = mark ( ) ; synPredMatched506 = true ; inputState . guessing ++ ; try { { argumentLabelStart ( ) ; } } catch ( RecognitionException pe ) { synPredMatched506 = false ; } rewind ( _m506 ) ; inputState . guessing -- ; } if ( synPredMatched506 ) { argumentLabel ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; c = LT ( <NUM_LIT:1> ) ; c_AST = astFactory . create ( c ) ; astFactory . makeASTRoot ( currentAST , c_AST ) ; match ( COLON ) ; if ( inputState . guessing == <NUM_LIT:0> ) { c_AST . setType ( LABELED_ARG ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { hasLabelOrSpread |= <NUM_LIT:1> ; } } else if ( ( LA ( <NUM_LIT:1> ) == STAR ) ) { sp = LT ( <NUM_LIT:1> ) ; sp_AST = astFactory . create ( sp ) ; astFactory . makeASTRoot ( currentAST , sp_AST ) ; match ( STAR ) ; if ( inputState . guessing == <NUM_LIT:0> ) { sp_AST . setType ( SPREAD_ARG ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { hasLabelOrSpread |= <NUM_LIT:2> ; } { switch ( LA ( <NUM_LIT:1> ) ) { case COLON : { match ( COLON ) ; if ( inputState . guessing == <NUM_LIT:0> ) { sp_AST . setType ( SPREAD_MAP_ARG ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { hasLabelOrSpread |= <NUM_LIT:1> ; } break ; } case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case AT : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : case LITERAL_this : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case PLUS : case MINUS : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } } else if ( ( _tokenSet_73 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_93 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } sce = strictContextExpression ( true ) ; astFactory . addASTChild ( currentAST , returnAST ) ; if ( inputState . guessing == <NUM_LIT:0> ) { require ( LA ( <NUM_LIT:1> ) != COLON , "<STR_LIT>" , "<STR_LIT>" ) ; } argument_AST = ( AST ) currentAST . root ; returnAST = argument_AST ; return hasLabelOrSpread ; } public final void argumentLabelStart ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST argumentLabelStart_AST = null ; { switch ( LA ( <NUM_LIT:1> ) ) { case IDENT : { AST tmp344_AST = null ; tmp344_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( IDENT ) ; break ; } case FINAL : case ABSTRACT : case UNUSED_GOTO : case UNUSED_DO : case STRICTFP : case LITERAL_package : case LITERAL_import : case LITERAL_static : case LITERAL_def : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case LITERAL_extends : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_as : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LITERAL_default : case LITERAL_throws : case LITERAL_implements : case LITERAL_if : case LITERAL_else : case LITERAL_while : case LITERAL_switch : case LITERAL_for : case LITERAL_in : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case LITERAL_case : case LITERAL_try : case LITERAL_finally : case LITERAL_catch : case LITERAL_false : case LITERAL_instanceof : case LITERAL_new : case LITERAL_null : case LITERAL_true : { keywordPropertyNames ( ) ; break ; } case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { constantNumber ( ) ; break ; } case STRING_LITERAL : { AST tmp345_AST = null ; tmp345_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( STRING_LITERAL ) ; break ; } case LBRACK : case LPAREN : case LCURLY : case STRING_CTOR_START : { balancedBrackets ( ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } AST tmp346_AST = null ; tmp346_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( COLON ) ; returnAST = argumentLabelStart_AST ; } public final void constantNumber ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST constantNumber_AST = null ; switch ( LA ( <NUM_LIT:1> ) ) { case NUM_INT : { AST tmp347_AST = null ; tmp347_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp347_AST ) ; match ( NUM_INT ) ; constantNumber_AST = ( AST ) currentAST . root ; break ; } case NUM_FLOAT : { AST tmp348_AST = null ; tmp348_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp348_AST ) ; match ( NUM_FLOAT ) ; constantNumber_AST = ( AST ) currentAST . root ; break ; } case NUM_LONG : { AST tmp349_AST = null ; tmp349_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp349_AST ) ; match ( NUM_LONG ) ; constantNumber_AST = ( AST ) currentAST . root ; break ; } case NUM_DOUBLE : { AST tmp350_AST = null ; tmp350_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp350_AST ) ; match ( NUM_DOUBLE ) ; constantNumber_AST = ( AST ) currentAST . root ; break ; } case NUM_BIG_INT : { AST tmp351_AST = null ; tmp351_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp351_AST ) ; match ( NUM_BIG_INT ) ; constantNumber_AST = ( AST ) currentAST . root ; break ; } case NUM_BIG_DECIMAL : { AST tmp352_AST = null ; tmp352_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp352_AST ) ; match ( NUM_BIG_DECIMAL ) ; constantNumber_AST = ( AST ) currentAST . root ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = constantNumber_AST ; } public final void balancedBrackets ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST balancedBrackets_AST = null ; switch ( LA ( <NUM_LIT:1> ) ) { case LPAREN : { AST tmp353_AST = null ; tmp353_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( LPAREN ) ; balancedTokens ( ) ; AST tmp354_AST = null ; tmp354_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( RPAREN ) ; break ; } case LBRACK : { AST tmp355_AST = null ; tmp355_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( LBRACK ) ; balancedTokens ( ) ; AST tmp356_AST = null ; tmp356_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( RBRACK ) ; break ; } case LCURLY : { AST tmp357_AST = null ; tmp357_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( LCURLY ) ; balancedTokens ( ) ; AST tmp358_AST = null ; tmp358_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( RCURLY ) ; break ; } case STRING_CTOR_START : { AST tmp359_AST = null ; tmp359_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( STRING_CTOR_START ) ; balancedTokens ( ) ; AST tmp360_AST = null ; tmp360_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( STRING_CTOR_END ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = balancedBrackets_AST ; } public static final String [ ] _tokenNames = { "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" } ; protected void buildTokenTypeASTClassMap ( ) { tokenTypeToASTClassMap = null ; } ; private static final long [ ] mk_tokenSet_0 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_0 = new BitSet ( mk_tokenSet_0 ( ) ) ; private static final long [ ] mk_tokenSet_1 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_1 = new BitSet ( mk_tokenSet_1 ( ) ) ; private static final long [ ] mk_tokenSet_2 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT:1L> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_2 = new BitSet ( mk_tokenSet_2 ( ) ) ; private static final long [ ] mk_tokenSet_3 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_3 = new BitSet ( mk_tokenSet_3 ( ) ) ; private static final long [ ] mk_tokenSet_4 ( ) { long [ ] data = new long [ <NUM_LIT:16> ] ; data [ <NUM_LIT:0> ] = - <NUM_LIT> ; for ( int i = <NUM_LIT:1> ; i <= <NUM_LIT:2> ; i ++ ) { data [ i ] = - <NUM_LIT:1L> ; } data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_4 = new BitSet ( mk_tokenSet_4 ( ) ) ; private static final long [ ] mk_tokenSet_5 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_5 = new BitSet ( mk_tokenSet_5 ( ) ) ; private static final long [ ] mk_tokenSet_6 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_6 = new BitSet ( mk_tokenSet_6 ( ) ) ; private static final long [ ] mk_tokenSet_7 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_7 = new BitSet ( mk_tokenSet_7 ( ) ) ; private static final long [ ] mk_tokenSet_8 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_8 = new BitSet ( mk_tokenSet_8 ( ) ) ; private static final long [ ] mk_tokenSet_9 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_9 = new BitSet ( mk_tokenSet_9 ( ) ) ; private static final long [ ] mk_tokenSet_10 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_10 = new BitSet ( mk_tokenSet_10 ( ) ) ; private static final long [ ] mk_tokenSet_11 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_11 = new BitSet ( mk_tokenSet_11 ( ) ) ; private static final long [ ] mk_tokenSet_12 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_12 = new BitSet ( mk_tokenSet_12 ( ) ) ; private static final long [ ] mk_tokenSet_13 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_13 = new BitSet ( mk_tokenSet_13 ( ) ) ; private static final long [ ] mk_tokenSet_14 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_14 = new BitSet ( mk_tokenSet_14 ( ) ) ; private static final long [ ] mk_tokenSet_15 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_15 = new BitSet ( mk_tokenSet_15 ( ) ) ; private static final long [ ] mk_tokenSet_16 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_16 = new BitSet ( mk_tokenSet_16 ( ) ) ; private static final long [ ] mk_tokenSet_17 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_17 = new BitSet ( mk_tokenSet_17 ( ) ) ; private static final long [ ] mk_tokenSet_18 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_18 = new BitSet ( mk_tokenSet_18 ( ) ) ; private static final long [ ] mk_tokenSet_19 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_19 = new BitSet ( mk_tokenSet_19 ( ) ) ; private static final long [ ] mk_tokenSet_20 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_20 = new BitSet ( mk_tokenSet_20 ( ) ) ; private static final long [ ] mk_tokenSet_21 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_21 = new BitSet ( mk_tokenSet_21 ( ) ) ; private static final long [ ] mk_tokenSet_22 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_22 = new BitSet ( mk_tokenSet_22 ( ) ) ; private static final long [ ] mk_tokenSet_23 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_23 = new BitSet ( mk_tokenSet_23 ( ) ) ; private static final long [ ] mk_tokenSet_24 ( ) { long [ ] data = { <NUM_LIT> , - <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_24 = new BitSet ( mk_tokenSet_24 ( ) ) ; private static final long [ ] mk_tokenSet_25 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_25 = new BitSet ( mk_tokenSet_25 ( ) ) ; private static final long [ ] mk_tokenSet_26 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_26 = new BitSet ( mk_tokenSet_26 ( ) ) ; private static final long [ ] mk_tokenSet_27 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_27 = new BitSet ( mk_tokenSet_27 ( ) ) ; private static final long [ ] mk_tokenSet_28 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_28 = new BitSet ( mk_tokenSet_28 ( ) ) ; private static final long [ ] mk_tokenSet_29 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_29 = new BitSet ( mk_tokenSet_29 ( ) ) ; private static final long [ ] mk_tokenSet_30 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_30 = new BitSet ( mk_tokenSet_30 ( ) ) ; private static final long [ ] mk_tokenSet_31 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_31 = new BitSet ( mk_tokenSet_31 ( ) ) ; private static final long [ ] mk_tokenSet_32 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_32 = new BitSet ( mk_tokenSet_32 ( ) ) ; private static final long [ ] mk_tokenSet_33 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT:1L> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_33 = new BitSet ( mk_tokenSet_33 ( ) ) ; private static final long [ ] mk_tokenSet_34 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_34 = new BitSet ( mk_tokenSet_34 ( ) ) ; private static final long [ ] mk_tokenSet_35 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_35 = new BitSet ( mk_tokenSet_35 ( ) ) ; private static final long [ ] mk_tokenSet_36 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT:1L> ; return data ; } public static final BitSet _tokenSet_36 = new BitSet ( mk_tokenSet_36 ( ) ) ; private static final long [ ] mk_tokenSet_37 ( ) { long [ ] data = new long [ <NUM_LIT:16> ] ; data [ <NUM_LIT:0> ] = - <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT:1L> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_37 = new BitSet ( mk_tokenSet_37 ( ) ) ; private static final long [ ] mk_tokenSet_38 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_38 = new BitSet ( mk_tokenSet_38 ( ) ) ; private static final long [ ] mk_tokenSet_39 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_39 = new BitSet ( mk_tokenSet_39 ( ) ) ; private static final long [ ] mk_tokenSet_40 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_40 = new BitSet ( mk_tokenSet_40 ( ) ) ; private static final long [ ] mk_tokenSet_41 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_41 = new BitSet ( mk_tokenSet_41 ( ) ) ; private static final long [ ] mk_tokenSet_42 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_42 = new BitSet ( mk_tokenSet_42 ( ) ) ; private static final long [ ] mk_tokenSet_43 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_43 = new BitSet ( mk_tokenSet_43 ( ) ) ; private static final long [ ] mk_tokenSet_44 ( ) { long [ ] data = { <NUM_LIT> , - <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_44 = new BitSet ( mk_tokenSet_44 ( ) ) ; private static final long [ ] mk_tokenSet_45 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_45 = new BitSet ( mk_tokenSet_45 ( ) ) ; private static final long [ ] mk_tokenSet_46 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_46 = new BitSet ( mk_tokenSet_46 ( ) ) ; private static final long [ ] mk_tokenSet_47 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_47 = new BitSet ( mk_tokenSet_47 ( ) ) ; private static final long [ ] mk_tokenSet_48 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT:1L> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_48 = new BitSet ( mk_tokenSet_48 ( ) ) ; private static final long [ ] mk_tokenSet_49 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT:1L> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_49 = new BitSet ( mk_tokenSet_49 ( ) ) ; private static final long [ ] mk_tokenSet_50 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_50 = new BitSet ( mk_tokenSet_50 ( ) ) ; private static final long [ ] mk_tokenSet_51 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_51 = new BitSet ( mk_tokenSet_51 ( ) ) ; private static final long [ ] mk_tokenSet_52 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_52 = new BitSet ( mk_tokenSet_52 ( ) ) ; private static final long [ ] mk_tokenSet_53 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_53 = new BitSet ( mk_tokenSet_53 ( ) ) ; private static final long [ ] mk_tokenSet_54 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_54 = new BitSet ( mk_tokenSet_54 ( ) ) ; private static final long [ ] mk_tokenSet_55 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_55 = new BitSet ( mk_tokenSet_55 ( ) ) ; private static final long [ ] mk_tokenSet_56 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_56 = new BitSet ( mk_tokenSet_56 ( ) ) ; private static final long [ ] mk_tokenSet_57 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_57 = new BitSet ( mk_tokenSet_57 ( ) ) ; private static final long [ ] mk_tokenSet_58 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT:1L> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_58 = new BitSet ( mk_tokenSet_58 ( ) ) ; private static final long [ ] mk_tokenSet_59 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_59 = new BitSet ( mk_tokenSet_59 ( ) ) ; private static final long [ ] mk_tokenSet_60 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_60 = new BitSet ( mk_tokenSet_60 ( ) ) ; private static final long [ ] mk_tokenSet_61 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_61 = new BitSet ( mk_tokenSet_61 ( ) ) ; private static final long [ ] mk_tokenSet_62 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_62 = new BitSet ( mk_tokenSet_62 ( ) ) ; private static final long [ ] mk_tokenSet_63 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_63 = new BitSet ( mk_tokenSet_63 ( ) ) ; private static final long [ ] mk_tokenSet_64 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT:1L> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_64 = new BitSet ( mk_tokenSet_64 ( ) ) ; private static final long [ ] mk_tokenSet_65 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_65 = new BitSet ( mk_tokenSet_65 ( ) ) ; private static final long [ ] mk_tokenSet_66 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT:1L> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_66 = new BitSet ( mk_tokenSet_66 ( ) ) ; private static final long [ ] mk_tokenSet_67 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_67 = new BitSet ( mk_tokenSet_67 ( ) ) ; private static final long [ ] mk_tokenSet_68 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT:1L> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_68 = new BitSet ( mk_tokenSet_68 ( ) ) ; private static final long [ ] mk_tokenSet_69 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_69 = new BitSet ( mk_tokenSet_69 ( ) ) ; private static final long [ ] mk_tokenSet_70 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_70 = new BitSet ( mk_tokenSet_70 ( ) ) ; private static final long [ ] mk_tokenSet_71 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_71 = new BitSet ( mk_tokenSet_71 ( ) ) ; private static final long [ ] mk_tokenSet_72 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_72 = new BitSet ( mk_tokenSet_72 ( ) ) ; private static final long [ ] mk_tokenSet_73 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_73 = new BitSet ( mk_tokenSet_73 ( ) ) ; private static final long [ ] mk_tokenSet_74 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_74 = new BitSet ( mk_tokenSet_74 ( ) ) ; private static final long [ ] mk_tokenSet_75 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = - <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT:1L> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_75 = new BitSet ( mk_tokenSet_75 ( ) ) ; private static final long [ ] mk_tokenSet_76 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_76 = new BitSet ( mk_tokenSet_76 ( ) ) ; private static final long [ ] mk_tokenSet_77 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_77 = new BitSet ( mk_tokenSet_77 ( ) ) ; private static final long [ ] mk_tokenSet_78 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_78 = new BitSet ( mk_tokenSet_78 ( ) ) ; private static final long [ ] mk_tokenSet_79 ( ) { long [ ] data = { <NUM_LIT> , - <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_79 = new BitSet ( mk_tokenSet_79 ( ) ) ; private static final long [ ] mk_tokenSet_80 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:2> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_80 = new BitSet ( mk_tokenSet_80 ( ) ) ; private static final long [ ] mk_tokenSet_81 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_81 = new BitSet ( mk_tokenSet_81 ( ) ) ; private static final long [ ] mk_tokenSet_82 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_82 = new BitSet ( mk_tokenSet_82 ( ) ) ; private static final long [ ] mk_tokenSet_83 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_83 = new BitSet ( mk_tokenSet_83 ( ) ) ; private static final long [ ] mk_tokenSet_84 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_84 = new BitSet ( mk_tokenSet_84 ( ) ) ; private static final long [ ] mk_tokenSet_85 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_85 = new BitSet ( mk_tokenSet_85 ( ) ) ; private static final long [ ] mk_tokenSet_86 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_86 = new BitSet ( mk_tokenSet_86 ( ) ) ; private static final long [ ] mk_tokenSet_87 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_87 = new BitSet ( mk_tokenSet_87 ( ) ) ; private static final long [ ] mk_tokenSet_88 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_88 = new BitSet ( mk_tokenSet_88 ( ) ) ; private static final long [ ] mk_tokenSet_89 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_89 = new BitSet ( mk_tokenSet_89 ( ) ) ; private static final long [ ] mk_tokenSet_90 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_90 = new BitSet ( mk_tokenSet_90 ( ) ) ; private static final long [ ] mk_tokenSet_91 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_91 = new BitSet ( mk_tokenSet_91 ( ) ) ; private static final long [ ] mk_tokenSet_92 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_92 = new BitSet ( mk_tokenSet_92 ( ) ) ; private static final long [ ] mk_tokenSet_93 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT:1L> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_93 = new BitSet ( mk_tokenSet_93 ( ) ) ; } </s>
|
<s> package org . codehaus . groovy . antlr ; import org . codehaus . groovy . control . ParserPlugin ; import org . codehaus . groovy . control . ParserPluginFactory ; public class CSTParserPluginFactory extends ParserPluginFactory { private ICSTReporter cstReporter ; public CSTParserPluginFactory ( ICSTReporter cstReporter ) { this . cstReporter = cstReporter ; } public ParserPlugin createParserPlugin ( ) { return new CSTParserPlugin ( cstReporter ) ; } } </s>
|
<s> package org . codehaus . groovy . antlr ; import org . codehaus . groovy . control . ParserPlugin ; import org . codehaus . groovy . control . ParserPluginFactory ; public class ErrorRecoveredCSTParserPluginFactory extends ParserPluginFactory { private ICSTReporter cstReporter ; public ErrorRecoveredCSTParserPluginFactory ( ICSTReporter cstReporter ) { this . cstReporter = cstReporter ; } public ErrorRecoveredCSTParserPluginFactory ( ) { this . cstReporter = null ; } public ParserPlugin createParserPlugin ( ) { return new ErrorRecoveredCSTParserPlugin ( cstReporter ) ; } } </s>
|
<s> package org . codehaus . groovy . antlr ; import java . io . FileNotFoundException ; import java . io . FileOutputStream ; import java . io . PrintStream ; import java . io . Reader ; import java . security . AccessController ; import java . security . PrivilegedAction ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . HashSet ; import java . util . Iterator ; import java . util . LinkedList ; import java . util . List ; import java . util . Map ; import java . util . Set ; import org . codehaus . groovy . GroovyBugError ; import org . codehaus . groovy . antlr . parser . GroovyLexer ; import org . codehaus . groovy . antlr . parser . GroovyRecognizer ; import org . codehaus . groovy . antlr . parser . GroovyTokenTypes ; import org . codehaus . groovy . antlr . treewalker . CompositeVisitor ; import org . codehaus . groovy . antlr . treewalker . MindMapPrinter ; import org . codehaus . groovy . antlr . treewalker . NodeAsHTMLPrinter ; import org . codehaus . groovy . antlr . treewalker . PreOrderTraversal ; import org . codehaus . groovy . antlr . treewalker . SourceCodeTraversal ; import org . codehaus . groovy . antlr . treewalker . SourcePrinter ; import org . codehaus . groovy . antlr . treewalker . Visitor ; import org . codehaus . groovy . antlr . treewalker . VisitorAdapter ; import org . codehaus . groovy . ast . ASTNode ; import org . codehaus . groovy . ast . AnnotationNode ; import org . codehaus . groovy . ast . ClassHelper ; import org . codehaus . groovy . ast . ClassNode ; import org . codehaus . groovy . ast . ConstructorNode ; import org . codehaus . groovy . ast . FieldNode ; import org . codehaus . groovy . ast . GenericsType ; import org . codehaus . groovy . ast . MethodNode ; import org . codehaus . groovy . ast . MixinNode ; import org . codehaus . groovy . ast . ModuleNode ; import org . codehaus . groovy . ast . PackageNode ; import org . codehaus . groovy . ast . Parameter ; import org . codehaus . groovy . ast . PropertyNode ; import org . codehaus . groovy . ast . expr . AnnotationConstantExpression ; import org . codehaus . groovy . ast . expr . ArgumentListExpression ; import org . codehaus . groovy . ast . expr . ArrayExpression ; import org . codehaus . groovy . ast . expr . AttributeExpression ; import org . codehaus . groovy . ast . expr . BinaryExpression ; import org . codehaus . groovy . ast . expr . BitwiseNegationExpression ; import org . codehaus . groovy . ast . expr . BooleanExpression ; import org . codehaus . groovy . ast . expr . CastExpression ; import org . codehaus . groovy . ast . expr . ClassExpression ; import org . codehaus . groovy . ast . expr . ClosureExpression ; import org . codehaus . groovy . ast . expr . ClosureListExpression ; import org . codehaus . groovy . ast . expr . ConstantExpression ; import org . codehaus . groovy . ast . expr . ConstructorCallExpression ; import org . codehaus . groovy . ast . expr . DeclarationExpression ; import org . codehaus . groovy . ast . expr . ElvisOperatorExpression ; import org . codehaus . groovy . ast . expr . EmptyExpression ; import org . codehaus . groovy . ast . expr . Expression ; import org . codehaus . groovy . ast . expr . FieldExpression ; import org . codehaus . groovy . ast . expr . GStringExpression ; import org . codehaus . groovy . ast . expr . ListExpression ; import org . codehaus . groovy . ast . expr . MapEntryExpression ; import org . codehaus . groovy . ast . expr . MapExpression ; import org . codehaus . groovy . ast . expr . MethodCallExpression ; import org . codehaus . groovy . ast . expr . MethodPointerExpression ; import org . codehaus . groovy . ast . expr . NamedArgumentListExpression ; import org . codehaus . groovy . ast . expr . NotExpression ; import org . codehaus . groovy . ast . expr . PostfixExpression ; import org . codehaus . groovy . ast . expr . PrefixExpression ; import org . codehaus . groovy . ast . expr . PropertyExpression ; import org . codehaus . groovy . ast . expr . RangeExpression ; import org . codehaus . groovy . ast . expr . SpreadExpression ; import org . codehaus . groovy . ast . expr . SpreadMapExpression ; import org . codehaus . groovy . ast . expr . TernaryExpression ; import org . codehaus . groovy . ast . expr . TupleExpression ; import org . codehaus . groovy . ast . expr . UnaryMinusExpression ; import org . codehaus . groovy . ast . expr . UnaryPlusExpression ; import org . codehaus . groovy . ast . expr . VariableExpression ; import org . codehaus . groovy . ast . stmt . AssertStatement ; import org . codehaus . groovy . ast . stmt . BlockStatement ; import org . codehaus . groovy . ast . stmt . BreakStatement ; import org . codehaus . groovy . ast . stmt . CaseStatement ; import org . codehaus . groovy . ast . stmt . CatchStatement ; import org . codehaus . groovy . ast . stmt . ContinueStatement ; import org . codehaus . groovy . ast . stmt . EmptyStatement ; import org . codehaus . groovy . ast . stmt . ExpressionStatement ; import org . codehaus . groovy . ast . stmt . ForStatement ; import org . codehaus . groovy . ast . stmt . IfStatement ; import org . codehaus . groovy . ast . stmt . ReturnStatement ; import org . codehaus . groovy . ast . stmt . Statement ; import org . codehaus . groovy . ast . stmt . SwitchStatement ; import org . codehaus . groovy . ast . stmt . SynchronizedStatement ; import org . codehaus . groovy . ast . stmt . ThrowStatement ; import org . codehaus . groovy . ast . stmt . TryCatchStatement ; import org . codehaus . groovy . ast . stmt . WhileStatement ; import org . codehaus . groovy . control . CompilationFailedException ; import org . codehaus . groovy . control . ParserPlugin ; import org . codehaus . groovy . control . SourceUnit ; import org . codehaus . groovy . syntax . ASTHelper ; import org . codehaus . groovy . syntax . Numbers ; import org . codehaus . groovy . syntax . ParserException ; import org . codehaus . groovy . syntax . Reduction ; import org . codehaus . groovy . syntax . SyntaxException ; import org . codehaus . groovy . syntax . Token ; import org . codehaus . groovy . syntax . Types ; import org . objectweb . asm . Opcodes ; import antlr . RecognitionException ; import antlr . TokenStreamException ; import antlr . TokenStreamRecognitionException ; import antlr . collections . AST ; public class AntlrParserPlugin extends ASTHelper implements ParserPlugin , GroovyTokenTypes { protected AST ast ; private ClassNode classNode ; protected String [ ] tokenNames ; private int innerClassCounter = <NUM_LIT:1> ; protected LocationSupport locations = LocationSupport . NO_LOCATIONS ; public Reduction parseCST ( final SourceUnit sourceUnit , Reader reader ) throws CompilationFailedException { final SourceBuffer sourceBuffer = new SourceBuffer ( ) ; transformCSTIntoAST ( sourceUnit , reader , sourceBuffer ) ; processAST ( ) ; return outputAST ( sourceUnit , sourceBuffer ) ; } protected void transformCSTIntoAST ( SourceUnit sourceUnit , Reader reader , SourceBuffer sourceBuffer ) throws CompilationFailedException { ast = null ; setController ( sourceUnit ) ; UnicodeEscapingReader unicodeReader = new UnicodeEscapingReader ( reader , sourceBuffer ) ; GroovyLexer lexer = new GroovyLexer ( unicodeReader ) ; unicodeReader . setLexer ( lexer ) ; GroovyRecognizer parser = GroovyRecognizer . make ( lexer ) ; parser . setSourceBuffer ( sourceBuffer ) ; tokenNames = parser . getTokenNames ( ) ; parser . setFilename ( sourceUnit . getName ( ) ) ; try { parser . compilationUnit ( ) ; } catch ( TokenStreamRecognitionException tsre ) { RecognitionException e = tsre . recog ; SyntaxException se = new SyntaxException ( e . getMessage ( ) , e , e . getLine ( ) , e . getColumn ( ) ) ; se . setFatal ( true ) ; sourceUnit . addError ( se ) ; } catch ( RecognitionException e ) { SyntaxException se = new SyntaxException ( e . getMessage ( ) , e , e . getLine ( ) , e . getColumn ( ) ) ; se . setFatal ( true ) ; sourceUnit . addError ( se ) ; } catch ( TokenStreamException e ) { sourceUnit . addException ( e ) ; } configureLocationSupport ( sourceBuffer ) ; ast = parser . getAST ( ) ; } protected void configureLocationSupport ( SourceBuffer sourceBuffer ) { locations = sourceBuffer . getLocationSupport ( ) ; } protected void processAST ( ) { AntlrASTProcessor snippets = new AntlrASTProcessSnippets ( ) ; ast = snippets . process ( ast ) ; } public Reduction outputAST ( final SourceUnit sourceUnit , final SourceBuffer sourceBuffer ) { AccessController . doPrivileged ( new PrivilegedAction ( ) { public Object run ( ) { outputASTInVariousFormsIfNeeded ( sourceUnit , sourceBuffer ) ; return null ; } } ) ; return null ; } protected void outputASTInVariousFormsIfNeeded ( SourceUnit sourceUnit , SourceBuffer sourceBuffer ) { if ( "<STR_LIT>" . equals ( System . getProperty ( "<STR_LIT>" ) ) ) { try { PrintStream out = new PrintStream ( new FileOutputStream ( sourceUnit . getName ( ) + "<STR_LIT>" ) ) ; Visitor visitor = new SourcePrinter ( out , tokenNames ) ; AntlrASTProcessor treewalker = new SourceCodeTraversal ( visitor ) ; treewalker . process ( ast ) ; } catch ( FileNotFoundException e ) { System . out . println ( "<STR_LIT>" + sourceUnit . getName ( ) + "<STR_LIT>" ) ; } } if ( "<STR_LIT>" . equals ( System . getProperty ( "<STR_LIT>" ) ) ) { try { PrintStream out = new PrintStream ( new FileOutputStream ( sourceUnit . getName ( ) + "<STR_LIT>" ) ) ; Visitor visitor = new MindMapPrinter ( out , tokenNames ) ; AntlrASTProcessor treewalker = new PreOrderTraversal ( visitor ) ; treewalker . process ( ast ) ; } catch ( FileNotFoundException e ) { System . out . println ( "<STR_LIT>" + sourceUnit . getName ( ) + "<STR_LIT>" ) ; } } if ( "<STR_LIT>" . equals ( System . getProperty ( "<STR_LIT>" ) ) ) { try { PrintStream out = new PrintStream ( new FileOutputStream ( sourceUnit . getName ( ) + "<STR_LIT>" ) ) ; Visitor visitor = new MindMapPrinter ( out , tokenNames , sourceBuffer ) ; AntlrASTProcessor treewalker = new PreOrderTraversal ( visitor ) ; treewalker . process ( ast ) ; } catch ( FileNotFoundException e ) { System . out . println ( "<STR_LIT>" + sourceUnit . getName ( ) + "<STR_LIT>" ) ; } } if ( "<STR_LIT>" . equals ( System . getProperty ( "<STR_LIT>" ) ) ) { try { PrintStream out = new PrintStream ( new FileOutputStream ( sourceUnit . getName ( ) + "<STR_LIT>" ) ) ; List < VisitorAdapter > v = new ArrayList < VisitorAdapter > ( ) ; v . add ( new NodeAsHTMLPrinter ( out , tokenNames ) ) ; v . add ( new SourcePrinter ( out , tokenNames ) ) ; Visitor visitors = new CompositeVisitor ( v ) ; AntlrASTProcessor treewalker = new SourceCodeTraversal ( visitors ) ; treewalker . process ( ast ) ; } catch ( FileNotFoundException e ) { System . out . println ( "<STR_LIT>" + sourceUnit . getName ( ) + "<STR_LIT>" ) ; } } } public ModuleNode buildAST ( SourceUnit sourceUnit , ClassLoader classLoader , Reduction cst ) throws ParserException { setClassLoader ( classLoader ) ; makeModule ( ) ; try { innerClassCounter = <NUM_LIT:1> ; convertGroovy ( ast ) ; if ( output . getStatementBlock ( ) . isEmpty ( ) && output . getMethods ( ) . isEmpty ( ) && output . getClasses ( ) . isEmpty ( ) ) { output . addStatement ( ReturnStatement . RETURN_NULL_OR_VOID ) ; } fixModuleNodeLocations ( ) ; } catch ( ASTRuntimeException e ) { throw new ASTParserException ( e . getMessage ( ) + "<STR_LIT>" + sourceUnit . getName ( ) , e ) ; } return output ; } private void fixModuleNodeLocations ( ) { output . setStart ( <NUM_LIT:0> ) ; output . setEnd ( locations . getEnd ( ) ) ; output . setLineNumber ( <NUM_LIT:1> ) ; output . setColumnNumber ( <NUM_LIT:1> ) ; output . setLastColumnNumber ( locations . getEndColumn ( ) ) ; output . setLastLineNumber ( locations . getEndLine ( ) ) ; BlockStatement statements = output . getStatementBlock ( ) ; List < MethodNode > methods = output . getMethods ( ) ; if ( hasScriptMethodsOrStatements ( statements , methods ) ) { ASTNode first = getFirst ( statements , methods ) ; ASTNode last = getLast ( statements , methods ) ; if ( hasScriptStatements ( statements ) ) { statements . setStart ( first . getStart ( ) ) ; statements . setLineNumber ( first . getLineNumber ( ) ) ; statements . setColumnNumber ( first . getColumnNumber ( ) ) ; statements . setEnd ( last . getEnd ( ) ) ; statements . setLastLineNumber ( last . getLastLineNumber ( ) ) ; statements . setLastColumnNumber ( last . getLastColumnNumber ( ) ) ; } if ( output . getClasses ( ) . size ( ) > <NUM_LIT:0> ) { ClassNode scriptClass = ( ClassNode ) output . getClasses ( ) . get ( <NUM_LIT:0> ) ; scriptClass . setStart ( first . getStart ( ) ) ; scriptClass . setLineNumber ( first . getLineNumber ( ) ) ; scriptClass . setColumnNumber ( first . getColumnNumber ( ) ) ; scriptClass . setEnd ( last . getEnd ( ) ) ; scriptClass . setLastLineNumber ( last . getLastLineNumber ( ) ) ; scriptClass . setLastColumnNumber ( last . getLastColumnNumber ( ) ) ; MethodNode runMethod = scriptClass . getDeclaredMethod ( "<STR_LIT>" , new Parameter [ <NUM_LIT:0> ] ) ; runMethod . setStart ( first . getStart ( ) ) ; runMethod . setLineNumber ( first . getLineNumber ( ) ) ; runMethod . setColumnNumber ( first . getColumnNumber ( ) ) ; runMethod . setEnd ( last . getEnd ( ) ) ; runMethod . setLastLineNumber ( last . getLastLineNumber ( ) ) ; runMethod . setLastColumnNumber ( last . getLastColumnNumber ( ) ) ; } } } private ASTNode getFirst ( BlockStatement statements , List < MethodNode > methods ) { Statement firstStatement = hasScriptStatements ( statements ) ? ( Statement ) statements . getStatements ( ) . get ( <NUM_LIT:0> ) : null ; MethodNode firstMethod = hasScriptMethods ( methods ) ? methods . get ( <NUM_LIT:0> ) : null ; int statementStart = firstStatement != null ? firstStatement . getStart ( ) : Integer . MAX_VALUE ; int methodStart = firstMethod != null ? firstMethod . getStart ( ) : Integer . MAX_VALUE ; return statementStart <= methodStart ? firstStatement : firstMethod ; } private ASTNode getLast ( BlockStatement statements , List < MethodNode > methods ) { Statement lastStatement = hasScriptStatements ( statements ) ? ( Statement ) statements . getStatements ( ) . get ( statements . getStatements ( ) . size ( ) - <NUM_LIT:1> ) : null ; MethodNode lastMethod = hasScriptMethods ( methods ) ? methods . get ( methods . size ( ) - <NUM_LIT:1> ) : null ; int statementStart = lastStatement != null ? lastStatement . getEnd ( ) : Integer . MIN_VALUE ; int methodStart = lastMethod != null ? lastMethod . getStart ( ) : Integer . MIN_VALUE ; return statementStart >= methodStart ? lastStatement : lastMethod ; } private boolean hasScriptMethodsOrStatements ( BlockStatement statements , List < MethodNode > methods ) { return hasScriptStatements ( statements ) || hasScriptMethods ( methods ) ; } private boolean hasScriptMethods ( List < MethodNode > methods ) { return methods != null && methods . size ( ) > <NUM_LIT:0> ; } private boolean hasScriptStatements ( BlockStatement statements ) { return statements != null && statements . getStatements ( ) != null && statements . getStatements ( ) . size ( ) > <NUM_LIT:0> ; } protected void convertGroovy ( AST node ) { while ( node != null ) { int type = node . getType ( ) ; switch ( type ) { case PACKAGE_DEF : packageDef ( node ) ; break ; case STATIC_IMPORT : case IMPORT : importDef ( node ) ; break ; case CLASS_DEF : classDef ( node ) ; break ; case INTERFACE_DEF : interfaceDef ( node ) ; break ; case METHOD_DEF : methodDef ( node ) ; break ; case ENUM_DEF : enumDef ( node ) ; break ; case ANNOTATION_DEF : annotationDef ( node ) ; break ; default : { Statement statement = statement ( node ) ; output . addStatement ( statement ) ; } } node = node . getNextSibling ( ) ; } } protected void packageDef ( AST packageDef ) { AST node = packageDef . getFirstChild ( ) ; if ( isType ( ANNOTATIONS , node ) ) { node = node . getNextSibling ( ) ; } if ( node == null ) { return ; } String name = qualifiedName ( node ) ; setPackageName ( name ) ; if ( name != null && name . length ( ) > <NUM_LIT:0> ) { name += '<CHAR_LIT:.>' ; } PackageNode packageNode = new PackageNode ( name ) ; output . setPackage ( packageNode ) ; configureAST ( packageNode , node ) ; } protected void importDef ( AST importNode ) { boolean isStatic = importNode . getType ( ) == STATIC_IMPORT ; AST node = importNode . getFirstChild ( ) ; String alias = null ; if ( isType ( LITERAL_as , node ) ) { node = node . getFirstChild ( ) ; AST aliasNode = node . getNextSibling ( ) ; alias = identifier ( aliasNode ) ; } if ( node . getNumberOfChildren ( ) == <NUM_LIT:0> ) { String name = identifier ( node ) ; ClassNode type = ClassHelper . make ( name ) ; configureAST ( type , importNode ) ; importClass ( type , name , alias ) ; return ; } AST packageNode = node . getFirstChild ( ) ; String packageName = qualifiedName ( packageNode ) ; AST nameNode = packageNode . getNextSibling ( ) ; if ( isType ( STAR , nameNode ) ) { if ( isStatic ) { ClassNode type = ClassHelper . make ( packageName ) ; configureAST ( type , importNode ) ; staticImportClassWithStar ( type , packageName ) ; } else { importPackageWithStar ( packageName ) ; } if ( alias != null ) throw new GroovyBugError ( "<STR_LIT>" + "<STR_LIT>" ) ; } else { String name = identifier ( nameNode ) ; if ( isStatic ) { ClassNode type = ClassHelper . make ( packageName ) ; configureAST ( type , importNode ) ; staticImportMethodOrField ( type , name , alias ) ; } else { ClassNode type = ClassHelper . make ( packageName + "<STR_LIT:.>" + name ) ; configureAST ( type , nameNode ) ; importClass ( type , name , alias ) ; } } } protected void annotationDef ( AST classDef ) { List annotations = new ArrayList ( ) ; AST node = classDef . getFirstChild ( ) ; int modifiers = Opcodes . ACC_PUBLIC ; if ( isType ( MODIFIERS , node ) ) { modifiers = modifiers ( node , annotations , modifiers ) ; checkNoInvalidModifier ( classDef , "<STR_LIT>" , modifiers , Opcodes . ACC_SYNCHRONIZED , "<STR_LIT>" ) ; node = node . getNextSibling ( ) ; } modifiers |= Opcodes . ACC_ABSTRACT | Opcodes . ACC_INTERFACE | Opcodes . ACC_ANNOTATION ; String name = identifier ( node ) ; node = node . getNextSibling ( ) ; ClassNode superClass = ClassHelper . OBJECT_TYPE ; GenericsType [ ] genericsType = null ; if ( isType ( TYPE_PARAMETERS , node ) ) { genericsType = makeGenericsType ( node ) ; node = node . getNextSibling ( ) ; } ClassNode [ ] interfaces = ClassNode . EMPTY_ARRAY ; if ( isType ( EXTENDS_CLAUSE , node ) ) { interfaces = interfaces ( node ) ; node = node . getNextSibling ( ) ; } addNewClassName ( name ) ; classNode = new ClassNode ( dot ( getPackageName ( ) , name ) , modifiers , superClass , interfaces , null ) ; classNode . addAnnotations ( annotations ) ; classNode . setGenericsTypes ( genericsType ) ; classNode . addInterface ( ClassHelper . Annotation_TYPE ) ; configureAST ( classNode , classDef ) ; assertNodeType ( OBJBLOCK , node ) ; objectBlock ( node ) ; output . addClass ( classNode ) ; classNode = null ; } protected void interfaceDef ( AST classDef ) { List annotations = new ArrayList ( ) ; AST node = classDef . getFirstChild ( ) ; int modifiers = Opcodes . ACC_PUBLIC ; if ( isType ( MODIFIERS , node ) ) { modifiers = modifiers ( node , annotations , modifiers ) ; checkNoInvalidModifier ( classDef , "<STR_LIT>" , modifiers , Opcodes . ACC_SYNCHRONIZED , "<STR_LIT>" ) ; node = node . getNextSibling ( ) ; } modifiers |= Opcodes . ACC_ABSTRACT | Opcodes . ACC_INTERFACE ; String name = identifier ( node ) ; node = node . getNextSibling ( ) ; ClassNode superClass = ClassHelper . OBJECT_TYPE ; GenericsType [ ] genericsType = null ; if ( isType ( TYPE_PARAMETERS , node ) ) { genericsType = makeGenericsType ( node ) ; node = node . getNextSibling ( ) ; } ClassNode [ ] interfaces = ClassNode . EMPTY_ARRAY ; if ( isType ( EXTENDS_CLAUSE , node ) ) { interfaces = interfaces ( node ) ; node = node . getNextSibling ( ) ; } addNewClassName ( name ) ; classNode = new ClassNode ( dot ( getPackageName ( ) , name ) , modifiers , superClass , interfaces , null ) ; classNode . addAnnotations ( annotations ) ; classNode . setGenericsTypes ( genericsType ) ; configureAST ( classNode , classDef ) ; assertNodeType ( OBJBLOCK , node ) ; objectBlock ( node ) ; output . addClass ( classNode ) ; classNode = null ; } protected void classDef ( AST classDef ) { List annotations = new ArrayList ( ) ; AST node = classDef . getFirstChild ( ) ; int modifiers = Opcodes . ACC_PUBLIC ; if ( isType ( MODIFIERS , node ) ) { modifiers = modifiers ( node , annotations , modifiers ) ; checkNoInvalidModifier ( classDef , "<STR_LIT>" , modifiers , Opcodes . ACC_SYNCHRONIZED , "<STR_LIT>" ) ; node = node . getNextSibling ( ) ; } String name = identifier ( node ) ; GroovySourceAST groovySourceAST = ( GroovySourceAST ) node ; int nameStart = locations . findOffset ( groovySourceAST . getLine ( ) , groovySourceAST . getColumn ( ) ) ; int nameEnd = locations . findOffset ( groovySourceAST . getLineLast ( ) , groovySourceAST . getColumnLast ( ) ) - <NUM_LIT:1> ; node = node . getNextSibling ( ) ; GenericsType [ ] genericsType = null ; if ( isType ( TYPE_PARAMETERS , node ) ) { genericsType = makeGenericsType ( node ) ; node = node . getNextSibling ( ) ; } ClassNode superClass = null ; if ( isType ( EXTENDS_CLAUSE , node ) ) { superClass = makeTypeWithArguments ( node ) ; node = node . getNextSibling ( ) ; } ClassNode [ ] interfaces = ClassNode . EMPTY_ARRAY ; if ( isType ( IMPLEMENTS_CLAUSE , node ) ) { interfaces = interfaces ( node ) ; node = node . getNextSibling ( ) ; } MixinNode [ ] mixins = { } ; addNewClassName ( name ) ; classNode = new ClassNode ( dot ( getPackageName ( ) , name ) , modifiers , superClass , interfaces , mixins ) ; classNode . addAnnotations ( annotations ) ; classNode . setGenericsTypes ( genericsType ) ; configureAST ( classNode , classDef ) ; classNode . setNameStart ( nameStart ) ; classNode . setNameEnd ( nameEnd ) ; assertNodeType ( OBJBLOCK , node ) ; objectBlock ( node ) ; output . addClass ( classNode ) ; classNode = null ; } protected void objectBlock ( AST objectBlock ) { for ( AST node = objectBlock . getFirstChild ( ) ; node != null ; node = node . getNextSibling ( ) ) { int type = node . getType ( ) ; switch ( type ) { case OBJBLOCK : objectBlock ( node ) ; break ; case ANNOTATION_FIELD_DEF : case METHOD_DEF : methodDef ( node ) ; break ; case CTOR_IDENT : constructorDef ( node ) ; break ; case VARIABLE_DEF : fieldDef ( node ) ; break ; case STATIC_INIT : staticInit ( node ) ; break ; case INSTANCE_INIT : objectInit ( node ) ; break ; case ENUM_DEF : enumDef ( node ) ; break ; case ENUM_CONSTANT_DEF : enumConstantDef ( node ) ; break ; default : unknownAST ( node ) ; } } } protected void enumDef ( AST enumNode ) { assertNodeType ( ENUM_DEF , enumNode ) ; List annotations = new ArrayList ( ) ; AST node = enumNode . getFirstChild ( ) ; int modifiers = Opcodes . ACC_PUBLIC ; if ( isType ( MODIFIERS , node ) ) { modifiers = modifiers ( node , annotations , modifiers ) ; node = node . getNextSibling ( ) ; } String name = identifier ( node ) ; node = node . getNextSibling ( ) ; ClassNode [ ] interfaces = interfaces ( node ) ; node = node . getNextSibling ( ) ; String enumName = ( classNode != null ? name : dot ( getPackageName ( ) , name ) ) ; ClassNode enumClass = EnumHelper . makeEnumNode ( enumName , modifiers , interfaces , classNode ) ; ClassNode oldNode = classNode ; classNode = enumClass ; assertNodeType ( OBJBLOCK , node ) ; objectBlock ( node ) ; classNode = oldNode ; output . addClass ( enumClass ) ; } protected void enumConstantDef ( AST node ) { assertNodeType ( ENUM_CONSTANT_DEF , node ) ; AST element = node . getFirstChild ( ) ; if ( isType ( ANNOTATIONS , element ) ) { element = element . getNextSibling ( ) ; } String identifier = identifier ( element ) ; Expression init = null ; element = element . getNextSibling ( ) ; if ( element != null ) { init = expression ( element ) ; if ( isType ( ELIST , element ) ) { if ( init instanceof ListExpression && ! ( ( ListExpression ) init ) . isWrapped ( ) ) { ListExpression le = new ListExpression ( ) ; le . addExpression ( init ) ; init = le ; } } } EnumHelper . addEnumConstant ( classNode , identifier , init ) ; } protected void throwsList ( AST node , List list ) { String name ; if ( isType ( DOT , node ) ) { name = qualifiedName ( node ) ; } else { name = identifier ( node ) ; } ClassNode exception = ClassHelper . make ( name ) ; configureAST ( exception , node ) ; list . add ( exception ) ; AST next = node . getNextSibling ( ) ; if ( next != null ) throwsList ( next , list ) ; } protected void methodDef ( AST methodDef ) { List annotations = new ArrayList ( ) ; AST node = methodDef . getFirstChild ( ) ; GenericsType [ ] generics = null ; if ( isType ( TYPE_PARAMETERS , node ) ) { generics = makeGenericsType ( node ) ; node = node . getNextSibling ( ) ; } int modifiers = Opcodes . ACC_PUBLIC ; if ( isType ( MODIFIERS , node ) ) { modifiers = modifiers ( node , annotations , modifiers ) ; checkNoInvalidModifier ( methodDef , "<STR_LIT>" , modifiers , Opcodes . ACC_VOLATILE , "<STR_LIT>" ) ; node = node . getNextSibling ( ) ; } if ( isAnInterface ( ) ) { modifiers |= Opcodes . ACC_ABSTRACT ; } ClassNode returnType = null ; if ( isType ( TYPE , node ) ) { returnType = makeTypeWithArguments ( node ) ; node = node . getNextSibling ( ) ; } String name = identifier ( node ) ; if ( classNode != null && ! classNode . isAnnotationDefinition ( ) ) { if ( classNode . getNameWithoutPackage ( ) . equals ( name ) ) { if ( isAnInterface ( ) ) { throw new ASTRuntimeException ( methodDef , "<STR_LIT>" ) ; } throw new ASTRuntimeException ( methodDef , "<STR_LIT>" + returnType . getName ( ) + "<STR_LIT>" ) ; } } GroovySourceAST groovySourceAST = ( GroovySourceAST ) node ; int nameStart = locations . findOffset ( groovySourceAST . getLine ( ) , groovySourceAST . getColumn ( ) ) ; int nameEnd = locations . findOffset ( groovySourceAST . getLineLast ( ) , groovySourceAST . getColumnLast ( ) ) - <NUM_LIT:1> ; node = node . getNextSibling ( ) ; Parameter [ ] parameters = Parameter . EMPTY_ARRAY ; ClassNode [ ] exceptions = ClassNode . EMPTY_ARRAY ; if ( classNode == null || ! classNode . isAnnotationDefinition ( ) ) { assertNodeType ( PARAMETERS , node ) ; parameters = parameters ( node ) ; if ( parameters == null ) parameters = Parameter . EMPTY_ARRAY ; node = node . getNextSibling ( ) ; if ( isType ( LITERAL_throws , node ) ) { AST throwsNode = node . getFirstChild ( ) ; List exceptionList = new ArrayList ( ) ; throwsList ( throwsNode , exceptionList ) ; exceptions = ( ClassNode [ ] ) exceptionList . toArray ( exceptions ) ; node = node . getNextSibling ( ) ; } } boolean hasAnnotationDefault = false ; Statement code = null ; if ( ( modifiers & Opcodes . ACC_ABSTRACT ) == <NUM_LIT:0> ) { if ( node == null ) { throw new ASTRuntimeException ( methodDef , "<STR_LIT>" ) ; } assertNodeType ( SLIST , node ) ; code = statementList ( node ) ; } else if ( node != null && classNode . isAnnotationDefinition ( ) ) { code = statement ( node ) ; hasAnnotationDefault = true ; } MethodNode methodNode = new MethodNode ( name , modifiers , returnType , parameters , exceptions , code ) ; methodNode . addAnnotations ( annotations ) ; methodNode . setGenericsTypes ( generics ) ; methodNode . setAnnotationDefault ( hasAnnotationDefault ) ; configureAST ( methodNode , methodDef ) ; methodNode . setNameStart ( nameStart ) ; methodNode . setNameEnd ( nameEnd ) ; if ( classNode != null ) { classNode . addMethod ( methodNode ) ; } else { output . addMethod ( methodNode ) ; } } private void checkNoInvalidModifier ( AST node , String nodeType , int modifiers , int modifier , String modifierText ) { if ( ( modifiers & modifier ) != <NUM_LIT:0> ) { throw new ASTRuntimeException ( node , nodeType + "<STR_LIT>" + modifierText + "<STR_LIT>" ) ; } } private boolean isAnInterface ( ) { return classNode != null && ( classNode . getModifiers ( ) & Opcodes . ACC_INTERFACE ) > <NUM_LIT:0> ; } protected void staticInit ( AST staticInit ) { BlockStatement code = ( BlockStatement ) statementList ( staticInit ) ; classNode . addStaticInitializerStatements ( code . getStatements ( ) , false ) ; } protected void objectInit ( AST init ) { BlockStatement code = ( BlockStatement ) statementList ( init ) ; classNode . addObjectInitializerStatements ( code ) ; } protected void constructorDef ( AST constructorDef ) { List annotations = new ArrayList ( ) ; AST node = constructorDef . getFirstChild ( ) ; int modifiers = Opcodes . ACC_PUBLIC ; GroovySourceAST groovySourceAST = ( GroovySourceAST ) node ; int nameStart = locations . findOffset ( groovySourceAST . getLineLast ( ) , groovySourceAST . getColumnLast ( ) ) ; if ( isType ( MODIFIERS , node ) ) { modifiers = modifiers ( node , annotations , modifiers ) ; node = node . getNextSibling ( ) ; } assertNodeType ( PARAMETERS , node ) ; Parameter [ ] parameters = parameters ( node ) ; if ( parameters == null ) parameters = Parameter . EMPTY_ARRAY ; int nameEnd = locations . findOffset ( node . getLine ( ) , node . getColumn ( ) ) - <NUM_LIT:2> ; node = node . getNextSibling ( ) ; ClassNode [ ] exceptions = ClassNode . EMPTY_ARRAY ; if ( isType ( LITERAL_throws , node ) ) { AST throwsNode = node . getFirstChild ( ) ; List exceptionList = new ArrayList ( ) ; throwsList ( throwsNode , exceptionList ) ; exceptions = ( ClassNode [ ] ) exceptionList . toArray ( exceptions ) ; node = node . getNextSibling ( ) ; } assertNodeType ( SLIST , node ) ; Statement code = statementList ( node ) ; ConstructorNode constructorNode = classNode . addConstructor ( modifiers , parameters , exceptions , code ) ; constructorNode . addAnnotations ( annotations ) ; configureAST ( constructorNode , constructorDef ) ; constructorNode . setNameStart ( nameStart ) ; constructorNode . setNameEnd ( nameEnd ) ; } protected void fieldDef ( AST fieldDef ) { List annotations = new ArrayList ( ) ; AST node = fieldDef . getFirstChild ( ) ; int modifiers = <NUM_LIT:0> ; if ( isType ( MODIFIERS , node ) ) { modifiers = modifiers ( node , annotations , modifiers ) ; node = node . getNextSibling ( ) ; } if ( classNode . isInterface ( ) ) { modifiers |= Opcodes . ACC_STATIC | Opcodes . ACC_FINAL ; if ( ( modifiers & ( Opcodes . ACC_PRIVATE | Opcodes . ACC_PROTECTED ) ) == <NUM_LIT:0> ) { modifiers |= Opcodes . ACC_PUBLIC ; } } ClassNode type = null ; if ( isType ( TYPE , node ) ) { type = makeTypeWithArguments ( node ) ; node = node . getNextSibling ( ) ; } String name = identifier ( node ) ; GroovySourceAST groovySourceAST = ( GroovySourceAST ) node ; int nameStart = locations . findOffset ( groovySourceAST . getLine ( ) , groovySourceAST . getColumn ( ) ) ; int nameEnd = locations . findOffset ( groovySourceAST . getLineLast ( ) , groovySourceAST . getColumnLast ( ) ) - <NUM_LIT:1> ; node = node . getNextSibling ( ) ; Expression initialValue = null ; if ( node != null ) { assertNodeType ( ASSIGN , node ) ; initialValue = expression ( node . getFirstChild ( ) ) ; } if ( classNode . isInterface ( ) && initialValue == null && type != null ) { if ( type == ClassHelper . int_TYPE ) { initialValue = new ConstantExpression ( Integer . valueOf ( <NUM_LIT:0> ) ) ; } else if ( type == ClassHelper . long_TYPE ) { initialValue = new ConstantExpression ( new Long ( <NUM_LIT> ) ) ; } else if ( type == ClassHelper . double_TYPE ) { initialValue = new ConstantExpression ( new Double ( <NUM_LIT:0.0> ) ) ; } else if ( type == ClassHelper . float_TYPE ) { initialValue = new ConstantExpression ( new Float ( <NUM_LIT> ) ) ; } else if ( type == ClassHelper . boolean_TYPE ) { initialValue = ConstantExpression . FALSE ; } else if ( type == ClassHelper . short_TYPE ) { initialValue = new ConstantExpression ( new Short ( ( short ) <NUM_LIT:0> ) ) ; } else if ( type == ClassHelper . byte_TYPE ) { initialValue = new ConstantExpression ( new Byte ( ( byte ) <NUM_LIT:0> ) ) ; } else if ( type == ClassHelper . char_TYPE ) { initialValue = new ConstantExpression ( new Character ( ( char ) <NUM_LIT:0> ) ) ; } } FieldNode fieldNode = new FieldNode ( name , modifiers , type , classNode , initialValue ) ; fieldNode . addAnnotations ( annotations ) ; configureAST ( fieldNode , fieldDef ) ; fieldNode . setNameStart ( nameStart ) ; fieldNode . setNameEnd ( nameEnd ) ; if ( ! hasVisibility ( modifiers ) ) { int fieldModifiers = <NUM_LIT:0> ; int flags = Opcodes . ACC_STATIC | Opcodes . ACC_TRANSIENT | Opcodes . ACC_VOLATILE | Opcodes . ACC_FINAL ; if ( ! hasVisibility ( modifiers ) ) { modifiers |= Opcodes . ACC_PUBLIC ; fieldModifiers |= Opcodes . ACC_PRIVATE ; } fieldModifiers |= ( modifiers & flags ) ; fieldNode . setModifiers ( fieldModifiers ) ; fieldNode . setSynthetic ( true ) ; FieldNode storedNode = classNode . getDeclaredField ( fieldNode . getName ( ) ) ; if ( storedNode != null && ! classNode . hasProperty ( name ) ) { fieldNode = storedNode ; classNode . getFields ( ) . remove ( storedNode ) ; } PropertyNode propertyNode = new PropertyNode ( fieldNode , modifiers , null , null ) ; configureAST ( propertyNode , fieldDef ) ; classNode . addProperty ( propertyNode ) ; } else { fieldNode . setModifiers ( modifiers ) ; PropertyNode pn = classNode . getProperty ( name ) ; if ( pn != null && pn . getField ( ) . isSynthetic ( ) ) { classNode . getFields ( ) . remove ( pn . getField ( ) ) ; pn . setField ( fieldNode ) ; } classNode . addField ( fieldNode ) ; } } protected ClassNode [ ] interfaces ( AST node ) { List interfaceList = new ArrayList ( ) ; for ( AST implementNode = node . getFirstChild ( ) ; implementNode != null ; implementNode = implementNode . getNextSibling ( ) ) { ClassNode cn = makeTypeWithArguments ( implementNode ) ; configureAST ( cn , implementNode ) ; interfaceList . add ( cn ) ; } ClassNode [ ] interfaces = ClassNode . EMPTY_ARRAY ; if ( ! interfaceList . isEmpty ( ) ) { interfaces = new ClassNode [ interfaceList . size ( ) ] ; interfaceList . toArray ( interfaces ) ; } return interfaces ; } protected Parameter [ ] parameters ( AST parametersNode ) { AST node = parametersNode . getFirstChild ( ) ; if ( node == null ) { if ( isType ( IMPLICIT_PARAMETERS , parametersNode ) ) return Parameter . EMPTY_ARRAY ; return null ; } else { List parameters = new ArrayList ( ) ; do { parameters . add ( parameter ( node ) ) ; node = node . getNextSibling ( ) ; } while ( node != null ) ; Parameter [ ] answer = new Parameter [ parameters . size ( ) ] ; parameters . toArray ( answer ) ; return answer ; } } protected Parameter parameter ( AST paramNode ) { List annotations = new ArrayList ( ) ; boolean variableParameterDef = isType ( VARIABLE_PARAMETER_DEF , paramNode ) ; AST node = paramNode . getFirstChild ( ) ; int modifiers = <NUM_LIT:0> ; if ( isType ( MODIFIERS , node ) ) { modifiers = modifiers ( node , annotations , modifiers ) ; node = node . getNextSibling ( ) ; } ClassNode type = ClassHelper . DYNAMIC_TYPE ; if ( isType ( TYPE , node ) ) { type = makeTypeWithArguments ( node ) ; if ( variableParameterDef ) type = type . makeArray ( ) ; node = node . getNextSibling ( ) ; } String name = identifier ( node ) ; GroovySourceAST groovySourceAST = ( GroovySourceAST ) node ; int nameStart = locations . findOffset ( groovySourceAST . getLine ( ) , groovySourceAST . getColumn ( ) ) ; int nameEnd = nameStart + name . length ( ) ; node = node . getNextSibling ( ) ; VariableExpression leftExpression = new VariableExpression ( name , type ) ; configureAST ( leftExpression , paramNode ) ; Parameter parameter = null ; if ( node != null ) { assertNodeType ( ASSIGN , node ) ; Expression rightExpression = expression ( node . getFirstChild ( ) ) ; if ( isAnInterface ( ) ) { throw new ASTRuntimeException ( node , "<STR_LIT>" + name + "<STR_LIT:U+0020=U+0020>" + rightExpression . getText ( ) + "<STR_LIT>" ) ; } parameter = new Parameter ( type , name , rightExpression ) ; } else parameter = new Parameter ( type , name ) ; configureAST ( parameter , paramNode ) ; parameter . setNameStart ( nameStart ) ; parameter . setNameEnd ( nameEnd ) ; parameter . addAnnotations ( annotations ) ; return parameter ; } protected int modifiers ( AST modifierNode , List annotations , int defaultModifiers ) { assertNodeType ( MODIFIERS , modifierNode ) ; boolean access = false ; int answer = <NUM_LIT:0> ; Map tmpAnnotations = new HashMap ( ) ; for ( AST node = modifierNode . getFirstChild ( ) ; node != null ; node = node . getNextSibling ( ) ) { int type = node . getType ( ) ; switch ( type ) { case STATIC_IMPORT : break ; case ANNOTATION : AnnotationNode annNode = annotation ( node ) ; AnnotationNode anyPrevAnnNode = ( AnnotationNode ) tmpAnnotations . put ( annNode . getClassNode ( ) , annNode ) ; if ( anyPrevAnnNode != null ) { throw new ASTRuntimeException ( modifierNode , "<STR_LIT>" + annNode . getClassNode ( ) . getName ( ) ) ; } annotations . add ( annNode ) ; break ; case LITERAL_private : answer = setModifierBit ( node , answer , Opcodes . ACC_PRIVATE ) ; access = setAccessTrue ( node , access ) ; break ; case LITERAL_protected : answer = setModifierBit ( node , answer , Opcodes . ACC_PROTECTED ) ; access = setAccessTrue ( node , access ) ; break ; case LITERAL_public : answer = setModifierBit ( node , answer , Opcodes . ACC_PUBLIC ) ; access = setAccessTrue ( node , access ) ; break ; case ABSTRACT : answer = setModifierBit ( node , answer , Opcodes . ACC_ABSTRACT ) ; break ; case FINAL : answer = setModifierBit ( node , answer , Opcodes . ACC_FINAL ) ; break ; case LITERAL_native : answer = setModifierBit ( node , answer , Opcodes . ACC_NATIVE ) ; break ; case LITERAL_static : answer = setModifierBit ( node , answer , Opcodes . ACC_STATIC ) ; break ; case STRICTFP : answer = setModifierBit ( node , answer , Opcodes . ACC_STRICT ) ; break ; case LITERAL_synchronized : answer = setModifierBit ( node , answer , Opcodes . ACC_SYNCHRONIZED ) ; break ; case LITERAL_transient : answer = setModifierBit ( node , answer , Opcodes . ACC_TRANSIENT ) ; break ; case LITERAL_volatile : answer = setModifierBit ( node , answer , Opcodes . ACC_VOLATILE ) ; break ; default : unknownAST ( node ) ; } } if ( ! access ) { answer |= defaultModifiers ; } return answer ; } protected boolean setAccessTrue ( AST node , boolean access ) { if ( ! access ) { return true ; } else { throw new ASTRuntimeException ( node , "<STR_LIT>" + node . getText ( ) + "<STR_LIT>" ) ; } } protected int setModifierBit ( AST node , int answer , int bit ) { if ( ( answer & bit ) != <NUM_LIT:0> ) { throw new ASTRuntimeException ( node , "<STR_LIT>" + node . getText ( ) ) ; } return answer | bit ; } protected AnnotationNode annotation ( AST annotationNode ) { AST node = annotationNode . getFirstChild ( ) ; String name = qualifiedName ( node ) ; AnnotationNode annotatedNode = new AnnotationNode ( ClassHelper . make ( name ) ) ; configureAnnotationAST ( annotatedNode , annotationNode ) ; while ( true ) { node = node . getNextSibling ( ) ; if ( isType ( ANNOTATION_MEMBER_VALUE_PAIR , node ) ) { AST memberNode = node . getFirstChild ( ) ; String param = identifier ( memberNode ) ; Expression expression = expression ( memberNode . getNextSibling ( ) ) ; if ( annotatedNode . getMember ( param ) != null ) { throw new ASTRuntimeException ( memberNode , "<STR_LIT>" + param + "<STR_LIT>" ) ; } annotatedNode . setMember ( param , expression ) ; } else { break ; } } return annotatedNode ; } protected Statement statement ( AST node ) { Statement statement = null ; int type = node . getType ( ) ; switch ( type ) { case SLIST : case LITERAL_finally : statement = statementList ( node ) ; break ; case METHOD_CALL : statement = methodCall ( node ) ; break ; case VARIABLE_DEF : statement = variableDef ( node ) ; break ; case LABELED_STAT : statement = labelledStatement ( node ) ; break ; case LITERAL_assert : statement = assertStatement ( node ) ; break ; case LITERAL_break : statement = breakStatement ( node ) ; break ; case LITERAL_continue : statement = continueStatement ( node ) ; break ; case LITERAL_if : statement = ifStatement ( node ) ; break ; case LITERAL_for : statement = forStatement ( node ) ; break ; case LITERAL_return : statement = returnStatement ( node ) ; break ; case LITERAL_synchronized : statement = synchronizedStatement ( node ) ; break ; case LITERAL_switch : statement = switchStatement ( node ) ; break ; case LITERAL_try : statement = tryStatement ( node ) ; break ; case LITERAL_throw : statement = throwStatement ( node ) ; break ; case LITERAL_while : statement = whileStatement ( node ) ; break ; default : statement = new ExpressionStatement ( expression ( node ) ) ; } if ( statement != null ) { configureAST ( statement , node ) ; } return statement ; } protected Statement statementList ( AST code ) { return statementListNoChild ( code . getFirstChild ( ) , code ) ; } protected Statement statementListNoChild ( AST node , AST alternativeConfigureNode ) { BlockStatement block = new BlockStatement ( ) ; if ( node != null ) { configureAST ( block , node ) ; } else { configureAST ( block , alternativeConfigureNode ) ; } for ( ; node != null ; node = node . getNextSibling ( ) ) { block . addStatement ( statement ( node ) ) ; } return block ; } protected Statement assertStatement ( AST assertNode ) { AST node = assertNode . getFirstChild ( ) ; BooleanExpression booleanExpression = booleanExpression ( node ) ; Expression messageExpression = null ; node = node . getNextSibling ( ) ; if ( node != null ) { messageExpression = expression ( node ) ; } else { messageExpression = ConstantExpression . NULL ; } AssertStatement assertStatement = new AssertStatement ( booleanExpression , messageExpression ) ; configureAST ( assertStatement , assertNode ) ; return assertStatement ; } protected Statement breakStatement ( AST node ) { BreakStatement breakStatement = new BreakStatement ( label ( node ) ) ; configureAST ( breakStatement , node ) ; return breakStatement ; } protected Statement continueStatement ( AST node ) { ContinueStatement continueStatement = new ContinueStatement ( label ( node ) ) ; configureAST ( continueStatement , node ) ; return continueStatement ; } protected Statement forStatement ( AST forNode ) { AST inNode = forNode . getFirstChild ( ) ; Expression collectionExpression ; Parameter forParameter ; if ( isType ( CLOSURE_LIST , inNode ) ) { ClosureListExpression clist = closureListExpression ( inNode ) ; int size = clist . getExpressions ( ) . size ( ) ; if ( size != <NUM_LIT:3> ) { throw new ASTRuntimeException ( inNode , "<STR_LIT>" + size ) ; } collectionExpression = clist ; forParameter = ForStatement . FOR_LOOP_DUMMY ; } else { AST variableNode = inNode . getFirstChild ( ) ; AST collectionNode = variableNode . getNextSibling ( ) ; ClassNode type = ClassHelper . OBJECT_TYPE ; if ( isType ( VARIABLE_DEF , variableNode ) ) { AST node = variableNode . getFirstChild ( ) ; if ( isType ( MODIFIERS , node ) ) { int modifiersMask = modifiers ( node , new ArrayList ( ) , <NUM_LIT:0> ) ; if ( ( modifiersMask & ~ Opcodes . ACC_FINAL ) != <NUM_LIT:0> ) { throw new ASTRuntimeException ( node , "<STR_LIT>" ) ; } node = node . getNextSibling ( ) ; } type = makeTypeWithArguments ( node ) ; variableNode = node . getNextSibling ( ) ; } String variable = identifier ( variableNode ) ; collectionExpression = expression ( collectionNode ) ; forParameter = new Parameter ( type , variable ) ; configureAST ( forParameter , variableNode ) ; forParameter . setNameStart ( forParameter . getStart ( ) ) ; forParameter . setNameEnd ( forParameter . getEnd ( ) ) ; } final AST node = inNode . getNextSibling ( ) ; Statement block ; if ( isType ( SEMI , node ) ) { block = EmptyStatement . INSTANCE ; } else { block = statement ( node ) ; } ForStatement forStatement = new ForStatement ( forParameter , collectionExpression , block ) ; configureAST ( forStatement , forNode ) ; return forStatement ; } protected Statement ifStatement ( AST ifNode ) { AST node = ifNode . getFirstChild ( ) ; assertNodeType ( EXPR , node ) ; BooleanExpression booleanExpression = booleanExpression ( node ) ; node = node . getNextSibling ( ) ; Statement ifBlock = statement ( node ) ; Statement elseBlock = EmptyStatement . INSTANCE ; node = node . getNextSibling ( ) ; if ( node != null ) { elseBlock = statement ( node ) ; } IfStatement ifStatement = new IfStatement ( booleanExpression , ifBlock , elseBlock ) ; configureAST ( ifStatement , ifNode ) ; return ifStatement ; } protected Statement labelledStatement ( AST labelNode ) { AST node = labelNode . getFirstChild ( ) ; String label = identifier ( node ) ; Statement statement = statement ( node . getNextSibling ( ) ) ; if ( statement . getStatementLabel ( ) == null ) statement . setStatementLabel ( label ) ; return statement ; } protected Statement methodCall ( AST code ) { Expression expression = methodCallExpression ( code ) ; ExpressionStatement expressionStatement = new ExpressionStatement ( expression ) ; configureAST ( expressionStatement , code ) ; return expressionStatement ; } protected Expression declarationExpression ( AST variableDef ) { AST node = variableDef . getFirstChild ( ) ; ClassNode type = null ; List annotations = new ArrayList ( ) ; boolean staticVariable = false ; AST modifierNode = null ; if ( isType ( MODIFIERS , node ) ) { int modifiers = modifiers ( node , annotations , <NUM_LIT:0> ) ; if ( ( modifiers & Opcodes . ACC_STATIC ) != <NUM_LIT:0> ) { modifierNode = node ; staticVariable = true ; } node = node . getNextSibling ( ) ; } if ( isType ( TYPE , node ) ) { type = makeTypeWithArguments ( node ) ; node = node . getNextSibling ( ) ; } Expression leftExpression ; Expression rightExpression = ConstantExpression . NULL ; AST right ; if ( isType ( ASSIGN , node ) ) { node = node . getFirstChild ( ) ; AST left = node . getFirstChild ( ) ; ArgumentListExpression alist = new ArgumentListExpression ( ) ; for ( AST varDef = left ; varDef != null ; varDef = varDef . getNextSibling ( ) ) { assertNodeType ( VARIABLE_DEF , varDef ) ; DeclarationExpression de = ( DeclarationExpression ) declarationExpression ( varDef ) ; alist . addExpression ( de . getVariableExpression ( ) ) ; } leftExpression = alist ; right = node . getNextSibling ( ) ; if ( right != null ) rightExpression = expression ( right ) ; } else { if ( staticVariable ) { throw new ASTRuntimeException ( modifierNode , "<STR_LIT>" ) ; } String name = identifier ( node ) ; leftExpression = new VariableExpression ( name , type ) ; right = node . getNextSibling ( ) ; if ( right != null ) { assertNodeType ( ASSIGN , right ) ; rightExpression = expression ( right . getFirstChild ( ) ) ; } } configureAST ( leftExpression , node ) ; Token token = makeToken ( Types . ASSIGN , variableDef ) ; DeclarationExpression expression = new DeclarationExpression ( leftExpression , token , rightExpression ) ; configureAST ( expression , variableDef ) ; ExpressionStatement expressionStatement = new ExpressionStatement ( expression ) ; configureAST ( expressionStatement , variableDef ) ; return expression ; } protected Statement variableDef ( AST variableDef ) { ExpressionStatement expressionStatement = new ExpressionStatement ( declarationExpression ( variableDef ) ) ; configureAST ( expressionStatement , variableDef ) ; return expressionStatement ; } protected Statement returnStatement ( AST node ) { AST exprNode = node . getFirstChild ( ) ; Expression expression = exprNode == null ? ConstantExpression . NULL : expression ( exprNode ) ; ReturnStatement returnStatement = new ReturnStatement ( expression ) ; configureAST ( returnStatement , node ) ; return returnStatement ; } protected Statement switchStatement ( AST switchNode ) { AST node = switchNode . getFirstChild ( ) ; Expression expression = expression ( node ) ; Statement defaultStatement = EmptyStatement . INSTANCE ; List list = new ArrayList ( ) ; for ( node = node . getNextSibling ( ) ; isType ( CASE_GROUP , node ) ; node = node . getNextSibling ( ) ) { AST child = node . getFirstChild ( ) ; if ( isType ( LITERAL_case , child ) ) { List cases = new LinkedList ( ) ; defaultStatement = caseStatements ( child , cases ) ; list . addAll ( cases ) ; } else { defaultStatement = statement ( child . getNextSibling ( ) ) ; } } if ( node != null ) { unknownAST ( node ) ; } SwitchStatement switchStatement = new SwitchStatement ( expression , list , defaultStatement ) ; configureAST ( switchStatement , switchNode ) ; return switchStatement ; } protected Statement caseStatements ( AST node , List cases ) { List expressions = new LinkedList ( ) ; Statement statement = EmptyStatement . INSTANCE ; Statement defaultStatement = EmptyStatement . INSTANCE ; AST nextSibling = node ; do { Expression expression = expression ( nextSibling . getFirstChild ( ) ) ; expressions . add ( expression ) ; nextSibling = nextSibling . getNextSibling ( ) ; } while ( isType ( LITERAL_case , nextSibling ) ) ; if ( nextSibling != null ) { if ( isType ( LITERAL_default , nextSibling ) ) { defaultStatement = statement ( nextSibling . getNextSibling ( ) ) ; statement = EmptyStatement . INSTANCE ; } else { statement = statement ( nextSibling ) ; } } for ( Iterator iterator = expressions . iterator ( ) ; iterator . hasNext ( ) ; ) { Expression expr = ( Expression ) iterator . next ( ) ; Statement stmt ; if ( iterator . hasNext ( ) ) { stmt = new CaseStatement ( expr , EmptyStatement . INSTANCE ) ; } else { stmt = new CaseStatement ( expr , statement ) ; } configureAST ( stmt , node ) ; cases . add ( stmt ) ; } return defaultStatement ; } protected Statement synchronizedStatement ( AST syncNode ) { AST node = syncNode . getFirstChild ( ) ; Expression expression = expression ( node ) ; Statement code = statement ( node . getNextSibling ( ) ) ; SynchronizedStatement synchronizedStatement = new SynchronizedStatement ( expression , code ) ; configureAST ( synchronizedStatement , syncNode ) ; return synchronizedStatement ; } protected Statement throwStatement ( AST node ) { AST expressionNode = node . getFirstChild ( ) ; if ( expressionNode == null ) { expressionNode = node . getNextSibling ( ) ; } if ( expressionNode == null ) { throw new ASTRuntimeException ( node , "<STR_LIT>" ) ; } ThrowStatement throwStatement = new ThrowStatement ( expression ( expressionNode ) ) ; configureAST ( throwStatement , node ) ; return throwStatement ; } protected Statement tryStatement ( AST tryStatementNode ) { AST tryNode = tryStatementNode . getFirstChild ( ) ; Statement tryStatement = statement ( tryNode ) ; Statement finallyStatement = EmptyStatement . INSTANCE ; AST node = tryNode . getNextSibling ( ) ; List catches = new ArrayList ( ) ; for ( ; node != null && isType ( LITERAL_catch , node ) ; node = node . getNextSibling ( ) ) { catches . add ( catchStatement ( node ) ) ; } if ( isType ( LITERAL_finally , node ) ) { finallyStatement = statement ( node ) ; node = node . getNextSibling ( ) ; } if ( finallyStatement instanceof EmptyStatement && catches . size ( ) == <NUM_LIT:0> ) { throw new ASTRuntimeException ( tryStatementNode , "<STR_LIT>" ) ; } TryCatchStatement tryCatchStatement = new TryCatchStatement ( tryStatement , finallyStatement ) ; configureAST ( tryCatchStatement , tryStatementNode ) ; for ( Iterator iter = catches . iterator ( ) ; iter . hasNext ( ) ; ) { CatchStatement statement = ( CatchStatement ) iter . next ( ) ; tryCatchStatement . addCatch ( statement ) ; } return tryCatchStatement ; } protected CatchStatement catchStatement ( AST catchNode ) { AST node = catchNode . getFirstChild ( ) ; Parameter parameter = parameter ( node ) ; ClassNode exceptionType = parameter . getType ( ) ; String variable = parameter . getName ( ) ; node = node . getNextSibling ( ) ; Statement code = statement ( node ) ; Parameter catchParameter = new Parameter ( exceptionType , variable ) ; CatchStatement answer = new CatchStatement ( catchParameter , code ) ; configureAST ( answer , catchNode ) ; catchParameter . setNameStart ( catchParameter . getStart ( ) ) ; catchParameter . setNameEnd ( catchParameter . getEnd ( ) ) ; return answer ; } protected Statement whileStatement ( AST whileNode ) { AST node = whileNode . getFirstChild ( ) ; assertNodeType ( EXPR , node ) ; if ( isType ( VARIABLE_DEF , node . getFirstChild ( ) ) ) { throw new ASTRuntimeException ( whileNode , "<STR_LIT>" ) ; } BooleanExpression booleanExpression = booleanExpression ( node ) ; node = node . getNextSibling ( ) ; Statement block ; if ( isType ( SEMI , node ) ) { block = EmptyStatement . INSTANCE ; } else { block = statement ( node ) ; } WhileStatement whileStatement = new WhileStatement ( booleanExpression , block ) ; configureAST ( whileStatement , whileNode ) ; return whileStatement ; } protected Expression expression ( AST node ) { return expression ( node , false ) ; } protected Expression expression ( AST node , boolean convertToConstant ) { if ( node == null ) { return new ConstantExpression ( "<STR_LIT>" ) ; } Expression expression = expressionSwitch ( node ) ; if ( convertToConstant && expression instanceof VariableExpression ) { VariableExpression ve = ( VariableExpression ) expression ; if ( ! ve . isThisExpression ( ) && ! ve . isSuperExpression ( ) ) { expression = new ConstantExpression ( ve . getName ( ) ) ; } } configureAST ( expression , node ) ; return expression ; } protected Expression expressionSwitch ( AST node ) { int type = node . getType ( ) ; switch ( type ) { case EXPR : return expression ( node . getFirstChild ( ) ) ; case ELIST : return expressionList ( node ) ; case SLIST : return blockExpression ( node ) ; case CLOSABLE_BLOCK : return closureExpression ( node ) ; case SUPER_CTOR_CALL : return specialConstructorCallExpression ( node , ClassNode . SUPER ) ; case METHOD_CALL : return methodCallExpression ( node ) ; case LITERAL_new : return constructorCallExpression ( node ) ; case CTOR_CALL : return specialConstructorCallExpression ( node , ClassNode . THIS ) ; case QUESTION : case ELVIS_OPERATOR : return ternaryExpression ( node ) ; case OPTIONAL_DOT : case SPREAD_DOT : case DOT : return dotExpression ( node ) ; case IDENT : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_double : case LITERAL_float : case LITERAL_int : case LITERAL_long : case LITERAL_short : case LITERAL_void : case LITERAL_this : case LITERAL_super : return variableExpression ( node ) ; case LIST_CONSTRUCTOR : return listExpression ( node ) ; case MAP_CONSTRUCTOR : return mapExpression ( node ) ; case LABELED_ARG : return mapEntryExpression ( node ) ; case SPREAD_ARG : return spreadExpression ( node ) ; case SPREAD_MAP_ARG : return spreadMapExpression ( node ) ; case MEMBER_POINTER : return methodPointerExpression ( node ) ; case INDEX_OP : return indexExpression ( node ) ; case LITERAL_instanceof : return instanceofExpression ( node ) ; case LITERAL_as : return asExpression ( node ) ; case TYPECAST : return castExpression ( node ) ; case LITERAL_true : return literalExpression ( node , Boolean . TRUE ) ; case LITERAL_false : return literalExpression ( node , Boolean . FALSE ) ; case LITERAL_null : return literalExpression ( node , null ) ; case STRING_LITERAL : return literalExpression ( node , node . getText ( ) ) ; case STRING_CONSTRUCTOR : return gstring ( node ) ; case NUM_DOUBLE : case NUM_FLOAT : case NUM_BIG_DECIMAL : return decimalExpression ( node ) ; case NUM_BIG_INT : case NUM_INT : case NUM_LONG : return integerExpression ( node ) ; case LNOT : NotExpression notExpression = new NotExpression ( expression ( node . getFirstChild ( ) ) ) ; configureAST ( notExpression , node ) ; return notExpression ; case UNARY_MINUS : return unaryMinusExpression ( node ) ; case BNOT : BitwiseNegationExpression bitwiseNegationExpression = new BitwiseNegationExpression ( expression ( node . getFirstChild ( ) ) ) ; configureAST ( bitwiseNegationExpression , node ) ; return bitwiseNegationExpression ; case UNARY_PLUS : return unaryPlusExpression ( node ) ; case INC : return prefixExpression ( node , Types . PLUS_PLUS ) ; case DEC : return prefixExpression ( node , Types . MINUS_MINUS ) ; case POST_INC : return postfixExpression ( node , Types . PLUS_PLUS ) ; case POST_DEC : return postfixExpression ( node , Types . MINUS_MINUS ) ; case ASSIGN : return binaryExpression ( Types . ASSIGN , node ) ; case EQUAL : return binaryExpression ( Types . COMPARE_EQUAL , node ) ; case NOT_EQUAL : return binaryExpression ( Types . COMPARE_NOT_EQUAL , node ) ; case COMPARE_TO : return binaryExpression ( Types . COMPARE_TO , node ) ; case LE : return binaryExpression ( Types . COMPARE_LESS_THAN_EQUAL , node ) ; case LT : return binaryExpression ( Types . COMPARE_LESS_THAN , node ) ; case GT : return binaryExpression ( Types . COMPARE_GREATER_THAN , node ) ; case GE : return binaryExpression ( Types . COMPARE_GREATER_THAN_EQUAL , node ) ; case LAND : return binaryExpression ( Types . LOGICAL_AND , node ) ; case LOR : return binaryExpression ( Types . LOGICAL_OR , node ) ; case BAND : return binaryExpression ( Types . BITWISE_AND , node ) ; case BAND_ASSIGN : return binaryExpression ( Types . BITWISE_AND_EQUAL , node ) ; case BOR : return binaryExpression ( Types . BITWISE_OR , node ) ; case BOR_ASSIGN : return binaryExpression ( Types . BITWISE_OR_EQUAL , node ) ; case BXOR : return binaryExpression ( Types . BITWISE_XOR , node ) ; case BXOR_ASSIGN : return binaryExpression ( Types . BITWISE_XOR_EQUAL , node ) ; case PLUS : return binaryExpression ( Types . PLUS , node ) ; case PLUS_ASSIGN : return binaryExpression ( Types . PLUS_EQUAL , node ) ; case MINUS : return binaryExpression ( Types . MINUS , node ) ; case MINUS_ASSIGN : return binaryExpression ( Types . MINUS_EQUAL , node ) ; case STAR : return binaryExpression ( Types . MULTIPLY , node ) ; case STAR_ASSIGN : return binaryExpression ( Types . MULTIPLY_EQUAL , node ) ; case STAR_STAR : return binaryExpression ( Types . POWER , node ) ; case STAR_STAR_ASSIGN : return binaryExpression ( Types . POWER_EQUAL , node ) ; case DIV : return binaryExpression ( Types . DIVIDE , node ) ; case DIV_ASSIGN : return binaryExpression ( Types . DIVIDE_EQUAL , node ) ; case MOD : return binaryExpression ( Types . MOD , node ) ; case MOD_ASSIGN : return binaryExpression ( Types . MOD_EQUAL , node ) ; case SL : return binaryExpression ( Types . LEFT_SHIFT , node ) ; case SL_ASSIGN : return binaryExpression ( Types . LEFT_SHIFT_EQUAL , node ) ; case SR : return binaryExpression ( Types . RIGHT_SHIFT , node ) ; case SR_ASSIGN : return binaryExpression ( Types . RIGHT_SHIFT_EQUAL , node ) ; case BSR : return binaryExpression ( Types . RIGHT_SHIFT_UNSIGNED , node ) ; case BSR_ASSIGN : return binaryExpression ( Types . RIGHT_SHIFT_UNSIGNED_EQUAL , node ) ; case VARIABLE_DEF : return declarationExpression ( node ) ; case REGEX_FIND : return binaryExpression ( Types . FIND_REGEX , node ) ; case REGEX_MATCH : return binaryExpression ( Types . MATCH_REGEX , node ) ; case RANGE_INCLUSIVE : return rangeExpression ( node , true ) ; case RANGE_EXCLUSIVE : return rangeExpression ( node , false ) ; case DYNAMIC_MEMBER : return dynamicMemberExpression ( node ) ; case LITERAL_in : return binaryExpression ( Types . KEYWORD_IN , node ) ; case ANNOTATION : return new AnnotationConstantExpression ( annotation ( node ) ) ; case CLOSURE_LIST : return closureListExpression ( node ) ; case LBRACK : case LPAREN : return tupleExpression ( node ) ; default : return unknownAST ( node ) ; } } private TupleExpression tupleExpression ( AST node ) { TupleExpression exp = new TupleExpression ( ) ; configureAST ( exp , node ) ; node = node . getFirstChild ( ) ; while ( node != null ) { assertNodeType ( VARIABLE_DEF , node ) ; AST nameNode = node . getFirstChild ( ) . getNextSibling ( ) ; VariableExpression varExp = new VariableExpression ( nameNode . getText ( ) ) ; configureAST ( varExp , nameNode ) ; exp . addExpression ( varExp ) ; node = node . getNextSibling ( ) ; } return exp ; } private ClosureListExpression closureListExpression ( AST node ) { AST exprNode = node . getFirstChild ( ) ; LinkedList list = new LinkedList ( ) ; while ( exprNode != null ) { if ( isType ( EXPR , exprNode ) ) { Expression expr = expression ( exprNode ) ; configureAST ( expr , exprNode ) ; list . add ( expr ) ; } else { assertNodeType ( EMPTY_STAT , exprNode ) ; list . add ( EmptyExpression . INSTANCE ) ; } exprNode = exprNode . getNextSibling ( ) ; } ClosureListExpression cle = new ClosureListExpression ( list ) ; configureAST ( cle , node ) ; return cle ; } protected Expression dynamicMemberExpression ( AST dynamicMemberNode ) { AST node = dynamicMemberNode . getFirstChild ( ) ; return expression ( node ) ; } protected Expression ternaryExpression ( AST ternaryNode ) { AST node = ternaryNode . getFirstChild ( ) ; Expression base = expression ( node ) ; node = node . getNextSibling ( ) ; Expression left = expression ( node ) ; node = node . getNextSibling ( ) ; Expression ret ; if ( node == null ) { ret = new ElvisOperatorExpression ( base , left ) ; } else { Expression right = expression ( node ) ; BooleanExpression booleanExpression = new BooleanExpression ( base ) ; booleanExpression . setSourcePosition ( base ) ; ret = new TernaryExpression ( booleanExpression , left , right ) ; } configureAST ( ret , ternaryNode ) ; return ret ; } protected Expression variableExpression ( AST node ) { String text = node . getText ( ) ; VariableExpression variableExpression = new VariableExpression ( text ) ; configureAST ( variableExpression , node ) ; return variableExpression ; } protected Expression literalExpression ( AST node , Object value ) { ConstantExpression constantExpression = new ConstantExpression ( value ) ; configureAST ( constantExpression , node ) ; return constantExpression ; } protected Expression rangeExpression ( AST rangeNode , boolean inclusive ) { AST node = rangeNode . getFirstChild ( ) ; Expression left = expression ( node ) ; Expression right = expression ( node . getNextSibling ( ) ) ; RangeExpression rangeExpression = new RangeExpression ( left , right , inclusive ) ; configureAST ( rangeExpression , rangeNode ) ; return rangeExpression ; } protected Expression spreadExpression ( AST node ) { AST exprNode = node . getFirstChild ( ) ; AST listNode = exprNode . getFirstChild ( ) ; Expression right = expression ( listNode ) ; SpreadExpression spreadExpression = new SpreadExpression ( right ) ; configureAST ( spreadExpression , node ) ; return spreadExpression ; } protected Expression spreadMapExpression ( AST node ) { AST exprNode = node . getFirstChild ( ) ; Expression expr = expression ( exprNode ) ; SpreadMapExpression spreadMapExpression = new SpreadMapExpression ( expr ) ; configureAST ( spreadMapExpression , node ) ; return spreadMapExpression ; } protected Expression methodPointerExpression ( AST node ) { AST exprNode = node . getFirstChild ( ) ; Expression objectExpression = expression ( exprNode ) ; AST mNode = exprNode . getNextSibling ( ) ; Expression methodName ; if ( isType ( DYNAMIC_MEMBER , mNode ) ) { methodName = expression ( mNode ) ; } else { methodName = new ConstantExpression ( identifier ( mNode ) ) ; } configureAST ( methodName , mNode ) ; MethodPointerExpression methodPointerExpression = new MethodPointerExpression ( objectExpression , methodName ) ; configureAST ( methodPointerExpression , node ) ; return methodPointerExpression ; } protected Expression listExpression ( AST listNode ) { List expressions = new ArrayList ( ) ; AST elist = listNode . getFirstChild ( ) ; assertNodeType ( ELIST , elist ) ; for ( AST node = elist . getFirstChild ( ) ; node != null ; node = node . getNextSibling ( ) ) { switch ( node . getType ( ) ) { case LABELED_ARG : assertNodeType ( COMMA , node ) ; break ; case SPREAD_MAP_ARG : assertNodeType ( SPREAD_ARG , node ) ; break ; } expressions . add ( expression ( node ) ) ; } ListExpression listExpression = new ListExpression ( expressions ) ; configureAST ( listExpression , listNode ) ; return listExpression ; } protected Expression mapExpression ( AST mapNode ) { List expressions = new ArrayList ( ) ; AST elist = mapNode . getFirstChild ( ) ; if ( elist != null ) { assertNodeType ( ELIST , elist ) ; for ( AST node = elist . getFirstChild ( ) ; node != null ; node = node . getNextSibling ( ) ) { switch ( node . getType ( ) ) { case LABELED_ARG : case SPREAD_MAP_ARG : break ; case SPREAD_ARG : assertNodeType ( SPREAD_MAP_ARG , node ) ; break ; default : assertNodeType ( LABELED_ARG , node ) ; break ; } expressions . add ( mapEntryExpression ( node ) ) ; } } MapExpression mapExpression = new MapExpression ( expressions ) ; configureAST ( mapExpression , mapNode ) ; return mapExpression ; } protected MapEntryExpression mapEntryExpression ( AST node ) { if ( node . getType ( ) == SPREAD_MAP_ARG ) { AST rightNode = node . getFirstChild ( ) ; Expression keyExpression = spreadMapExpression ( node ) ; Expression rightExpression = expression ( rightNode ) ; MapEntryExpression mapEntryExpression = new MapEntryExpression ( keyExpression , rightExpression ) ; configureAST ( mapEntryExpression , node ) ; return mapEntryExpression ; } else { AST keyNode = node . getFirstChild ( ) ; Expression keyExpression = expression ( keyNode ) ; AST valueNode = keyNode . getNextSibling ( ) ; Expression valueExpression = expression ( valueNode ) ; MapEntryExpression mapEntryExpression = new MapEntryExpression ( keyExpression , valueExpression ) ; configureAST ( mapEntryExpression , node ) ; return mapEntryExpression ; } } protected Expression instanceofExpression ( AST node ) { AST leftNode = node . getFirstChild ( ) ; Expression leftExpression = expression ( leftNode ) ; AST rightNode = leftNode . getNextSibling ( ) ; ClassNode type = buildName ( rightNode ) ; assertTypeNotNull ( type , rightNode ) ; Expression rightExpression = new ClassExpression ( type ) ; configureAST ( rightExpression , rightNode ) ; BinaryExpression binaryExpression = new BinaryExpression ( leftExpression , makeToken ( Types . KEYWORD_INSTANCEOF , node ) , rightExpression ) ; configureAST ( binaryExpression , node ) ; return binaryExpression ; } protected void assertTypeNotNull ( ClassNode type , AST rightNode ) { if ( type == null ) { throw new ASTRuntimeException ( rightNode , "<STR_LIT>" + qualifiedName ( rightNode ) ) ; } } protected Expression asExpression ( AST node ) { AST leftNode = node . getFirstChild ( ) ; Expression leftExpression = expression ( leftNode ) ; AST rightNode = leftNode . getNextSibling ( ) ; ClassNode type = buildName ( rightNode ) ; return CastExpression . asExpression ( type , leftExpression ) ; } protected Expression castExpression ( AST castNode ) { AST node = castNode . getFirstChild ( ) ; ClassNode type = buildName ( node ) ; assertTypeNotNull ( type , node ) ; AST expressionNode = node . getNextSibling ( ) ; Expression expression = expression ( expressionNode ) ; CastExpression castExpression = new CastExpression ( type , expression ) ; configureAST ( castExpression , castNode ) ; return castExpression ; } protected Expression indexExpression ( AST indexNode ) { AST leftNode = indexNode . getFirstChild ( ) ; Expression leftExpression = expression ( leftNode ) ; AST rightNode = leftNode . getNextSibling ( ) ; Expression rightExpression = expression ( rightNode ) ; BinaryExpression binaryExpression = new BinaryExpression ( leftExpression , makeToken ( Types . LEFT_SQUARE_BRACKET , indexNode ) , rightExpression ) ; configureAST ( binaryExpression , indexNode ) ; return binaryExpression ; } protected Expression binaryExpression ( int type , AST node ) { Token token = makeToken ( type , node ) ; AST leftNode = node . getFirstChild ( ) ; Expression leftExpression = expression ( leftNode ) ; AST rightNode = leftNode . getNextSibling ( ) ; if ( rightNode == null ) { return leftExpression ; } if ( Types . ofType ( type , Types . ASSIGNMENT_OPERATOR ) ) { if ( leftExpression instanceof VariableExpression || leftExpression . getClass ( ) == PropertyExpression . class || leftExpression instanceof FieldExpression || leftExpression instanceof AttributeExpression || leftExpression instanceof DeclarationExpression || leftExpression instanceof TupleExpression ) { } else if ( leftExpression instanceof ConstantExpression ) { throw new ASTRuntimeException ( node , "<STR_LIT>" + ( ( ConstantExpression ) leftExpression ) . getValue ( ) + "<STR_LIT>" ) ; } else if ( leftExpression instanceof BinaryExpression ) { Expression leftexp = ( ( BinaryExpression ) leftExpression ) . getLeftExpression ( ) ; int lefttype = ( ( BinaryExpression ) leftExpression ) . getOperation ( ) . getType ( ) ; if ( ! Types . ofType ( lefttype , Types . ASSIGNMENT_OPERATOR ) && lefttype != Types . LEFT_SQUARE_BRACKET ) { throw new ASTRuntimeException ( node , "<STR_LIT:n>" + ( ( BinaryExpression ) leftExpression ) . getText ( ) + "<STR_LIT>" ) ; } } else if ( leftExpression instanceof GStringExpression ) { throw new ASTRuntimeException ( node , "<STR_LIT>" + ( ( GStringExpression ) leftExpression ) . getText ( ) + "<STR_LIT>" ) ; } else if ( leftExpression instanceof MethodCallExpression ) { throw new ASTRuntimeException ( node , "<STR_LIT>" + ( ( MethodCallExpression ) leftExpression ) . getText ( ) + "<STR_LIT>" ) ; } else if ( leftExpression instanceof MapExpression ) { throw new ASTRuntimeException ( node , "<STR_LIT>" + ( ( MapExpression ) leftExpression ) . getText ( ) + "<STR_LIT>" ) ; } else { throw new ASTRuntimeException ( node , "<STR_LIT:n>" + leftExpression . getClass ( ) + "<STR_LIT>" + leftExpression . getText ( ) + "<STR_LIT>" ) ; } } Expression rightExpression = expression ( rightNode ) ; BinaryExpression binaryExpression = new BinaryExpression ( leftExpression , token , rightExpression ) ; configureAST ( binaryExpression , node ) ; return binaryExpression ; } protected Expression prefixExpression ( AST node , int token ) { Expression expression = expression ( node . getFirstChild ( ) ) ; PrefixExpression prefixExpression = new PrefixExpression ( makeToken ( token , node ) , expression ) ; configureAST ( prefixExpression , node ) ; return prefixExpression ; } protected Expression postfixExpression ( AST node , int token ) { Expression expression = expression ( node . getFirstChild ( ) ) ; PostfixExpression postfixExpression = new PostfixExpression ( expression , makeToken ( token , node ) ) ; configureAST ( postfixExpression , node ) ; return postfixExpression ; } protected BooleanExpression booleanExpression ( AST node ) { BooleanExpression booleanExpression = new BooleanExpression ( expression ( node ) ) ; configureAST ( booleanExpression , node ) ; return booleanExpression ; } protected Expression dotExpression ( AST node ) { AST leftNode = node . getFirstChild ( ) ; if ( leftNode != null ) { AST identifierNode = leftNode . getNextSibling ( ) ; if ( identifierNode != null ) { Expression leftExpression = expression ( leftNode ) ; if ( isType ( SELECT_SLOT , identifierNode ) ) { Expression field = expression ( identifierNode . getFirstChild ( ) , true ) ; AttributeExpression attributeExpression = new AttributeExpression ( leftExpression , field , node . getType ( ) != DOT ) ; if ( node . getType ( ) == SPREAD_DOT ) { attributeExpression . setSpreadSafe ( true ) ; } configureAST ( attributeExpression , node ) ; return attributeExpression ; } Expression property = expression ( identifierNode , true ) ; PropertyExpression propertyExpression = new PropertyExpression ( leftExpression , property , node . getType ( ) != DOT ) ; if ( node . getType ( ) == SPREAD_DOT ) { propertyExpression . setSpreadSafe ( true ) ; } configureAST ( propertyExpression , node ) ; return propertyExpression ; } } return methodCallExpression ( node ) ; } protected Expression specialConstructorCallExpression ( AST methodCallNode , ClassNode special ) { AST node = methodCallNode . getFirstChild ( ) ; Expression arguments = arguments ( node ) ; ConstructorCallExpression expression = new ConstructorCallExpression ( special , arguments ) ; configureAST ( expression , methodCallNode ) ; return expression ; } private int getTypeInParenthesis ( AST node ) { if ( ! isType ( EXPR , node ) ) node = node . getFirstChild ( ) ; while ( node != null && isType ( EXPR , node ) && node . getNextSibling ( ) == null ) { node = node . getFirstChild ( ) ; } if ( node == null ) return - <NUM_LIT:1> ; return node . getType ( ) ; } protected Expression methodCallExpression ( AST methodCallNode ) { AST node = methodCallNode . getFirstChild ( ) ; Expression objectExpression ; AST selector ; AST elist = node . getNextSibling ( ) ; boolean implicitThis = false ; boolean safe = isType ( OPTIONAL_DOT , node ) ; boolean spreadSafe = isType ( SPREAD_DOT , node ) ; if ( isType ( DOT , node ) || safe || spreadSafe ) { AST objectNode = node . getFirstChild ( ) ; objectExpression = expression ( objectNode ) ; selector = objectNode . getNextSibling ( ) ; } else { implicitThis = true ; objectExpression = VariableExpression . THIS_EXPRESSION ; selector = node ; } Expression name = null ; if ( isType ( LITERAL_super , selector ) ) { implicitThis = true ; name = new ConstantExpression ( "<STR_LIT>" ) ; if ( objectExpression instanceof VariableExpression && ( ( VariableExpression ) objectExpression ) . isThisExpression ( ) ) { objectExpression = VariableExpression . SUPER_EXPRESSION ; } } else if ( isPrimitiveTypeLiteral ( selector ) ) { throw new ASTRuntimeException ( selector , "<STR_LIT>" + selector . getText ( ) + "<STR_LIT>" ) ; } else if ( isType ( SELECT_SLOT , selector ) ) { Expression field = expression ( selector . getFirstChild ( ) , true ) ; AttributeExpression attributeExpression = new AttributeExpression ( objectExpression , field , node . getType ( ) != DOT ) ; configureAST ( attributeExpression , node ) ; Expression arguments = arguments ( elist ) ; MethodCallExpression expression = new MethodCallExpression ( attributeExpression , "<STR_LIT>" , arguments ) ; configureAST ( expression , methodCallNode ) ; return expression ; } else if ( isType ( DYNAMIC_MEMBER , selector ) || isType ( IDENT , selector ) || isType ( STRING_CONSTRUCTOR , selector ) || isType ( STRING_LITERAL , selector ) ) { name = expression ( selector , true ) ; } else { implicitThis = false ; name = new ConstantExpression ( "<STR_LIT>" ) ; objectExpression = expression ( selector , true ) ; } if ( selector . getText ( ) . equals ( "<STR_LIT>" ) || selector . getText ( ) . equals ( "<STR_LIT>" ) ) { throw new ASTRuntimeException ( elist , "<STR_LIT>" ) ; } Expression arguments = arguments ( elist ) ; MethodCallExpression expression = new MethodCallExpression ( objectExpression , name , arguments ) ; expression . setSafe ( safe ) ; expression . setSpreadSafe ( spreadSafe ) ; expression . setImplicitThis ( implicitThis ) ; Expression ret = expression ; if ( implicitThis && "<STR_LIT>" . equals ( expression . getMethodAsString ( ) ) ) { ret = new ConstructorCallExpression ( this . classNode , arguments ) ; } configureAST ( ret , methodCallNode ) ; return ret ; } protected Expression constructorCallExpression ( AST node ) { AST constructorCallNode = node ; ClassNode type = makeTypeWithArguments ( constructorCallNode ) ; if ( isType ( CTOR_CALL , node ) || isType ( LITERAL_new , node ) ) { node = node . getFirstChild ( ) ; } if ( node == null ) { return new ConstructorCallExpression ( ClassHelper . OBJECT_TYPE , new ArgumentListExpression ( ) ) ; } AST elist = node . getNextSibling ( ) ; if ( elist == null && isType ( ELIST , node ) ) { elist = node ; if ( "<STR_LIT:(>" . equals ( type . getName ( ) ) ) { type = classNode ; } } if ( isType ( ARRAY_DECLARATOR , elist ) ) { AST expressionNode = elist . getFirstChild ( ) ; if ( expressionNode == null ) { throw new ASTRuntimeException ( elist , "<STR_LIT>" ) ; } List size = arraySizeExpression ( expressionNode ) ; ArrayExpression arrayExpression = new ArrayExpression ( type , null , size ) ; configureAST ( arrayExpression , constructorCallNode ) ; return arrayExpression ; } Expression arguments = arguments ( elist ) ; ConstructorCallExpression expression = new ConstructorCallExpression ( type , arguments ) ; configureAST ( expression , constructorCallNode ) ; return expression ; } protected List arraySizeExpression ( AST node ) { List list ; Expression size = null ; if ( isType ( ARRAY_DECLARATOR , node ) ) { AST right = node . getNextSibling ( ) ; if ( right != null ) { size = expression ( right ) ; } else { size = ConstantExpression . EMTPY_EXPRESSION ; } list = arraySizeExpression ( node . getFirstChild ( ) ) ; } else { size = expression ( node ) ; list = new ArrayList ( ) ; } list . add ( size ) ; return list ; } protected Expression arguments ( AST elist ) { List expressionList = new ArrayList ( ) ; boolean namedArguments = false ; for ( AST node = elist ; node != null ; node = node . getNextSibling ( ) ) { if ( isType ( ELIST , node ) ) { for ( AST child = node . getFirstChild ( ) ; child != null ; child = child . getNextSibling ( ) ) { namedArguments |= addArgumentExpression ( child , expressionList ) ; } } else { namedArguments |= addArgumentExpression ( node , expressionList ) ; } } if ( namedArguments ) { if ( ! expressionList . isEmpty ( ) ) { List argumentList = new ArrayList ( ) ; for ( Iterator iter = expressionList . iterator ( ) ; iter . hasNext ( ) ; ) { Expression expression = ( Expression ) iter . next ( ) ; if ( ! ( expression instanceof MapEntryExpression ) ) { argumentList . add ( expression ) ; } } if ( ! argumentList . isEmpty ( ) ) { expressionList . removeAll ( argumentList ) ; checkDuplicateNamedParams ( elist , expressionList ) ; MapExpression mapExpression = new MapExpression ( expressionList ) ; configureAST ( mapExpression , elist ) ; argumentList . add ( <NUM_LIT:0> , mapExpression ) ; ArgumentListExpression argumentListExpression = new ArgumentListExpression ( argumentList ) ; configureAST ( argumentListExpression , elist ) ; return argumentListExpression ; } } checkDuplicateNamedParams ( elist , expressionList ) ; NamedArgumentListExpression namedArgumentListExpression = new NamedArgumentListExpression ( expressionList ) ; configureAST ( namedArgumentListExpression , elist ) ; return namedArgumentListExpression ; } else { ArgumentListExpression argumentListExpression = new ArgumentListExpression ( expressionList ) ; if ( elist != null ) { configureAST ( argumentListExpression , elist ) ; } return argumentListExpression ; } } private void checkDuplicateNamedParams ( AST elist , List expressionList ) { if ( expressionList . isEmpty ( ) ) return ; Set < String > namedArgumentNames = new HashSet < String > ( ) ; MapEntryExpression meExp ; for ( Iterator iter = expressionList . iterator ( ) ; iter . hasNext ( ) ; ) { meExp = ( MapEntryExpression ) iter . next ( ) ; if ( meExp . getKeyExpression ( ) instanceof ConstantExpression ) { String argName = ( ( ConstantExpression ) meExp . getKeyExpression ( ) ) . getText ( ) ; if ( ! namedArgumentNames . contains ( argName ) ) { namedArgumentNames . add ( argName ) ; } else { throw new ASTRuntimeException ( elist , "<STR_LIT>" + argName + "<STR_LIT>" ) ; } } } } protected boolean addArgumentExpression ( AST node , List expressionList ) { if ( node . getType ( ) == SPREAD_MAP_ARG ) { AST rightNode = node . getFirstChild ( ) ; Expression keyExpression = spreadMapExpression ( node ) ; Expression rightExpression = expression ( rightNode ) ; MapEntryExpression mapEntryExpression = new MapEntryExpression ( keyExpression , rightExpression ) ; expressionList . add ( mapEntryExpression ) ; return true ; } else { Expression expression = expression ( node ) ; expressionList . add ( expression ) ; return expression instanceof MapEntryExpression ; } } protected Expression expressionList ( AST node ) { List expressionList = new ArrayList ( ) ; for ( AST child = node . getFirstChild ( ) ; child != null ; child = child . getNextSibling ( ) ) { expressionList . add ( expression ( child ) ) ; } if ( expressionList . size ( ) == <NUM_LIT:1> ) { return ( Expression ) expressionList . get ( <NUM_LIT:0> ) ; } else { ListExpression listExpression = new ListExpression ( expressionList ) ; listExpression . setWrapped ( true ) ; configureAST ( listExpression , node ) ; return listExpression ; } } protected ClosureExpression closureExpression ( AST node ) { AST paramNode = node . getFirstChild ( ) ; Parameter [ ] parameters = null ; AST codeNode = paramNode ; if ( isType ( PARAMETERS , paramNode ) || isType ( IMPLICIT_PARAMETERS , paramNode ) ) { parameters = parameters ( paramNode ) ; codeNode = paramNode . getNextSibling ( ) ; } Statement code = statementListNoChild ( codeNode , node ) ; ClosureExpression closureExpression = new ClosureExpression ( parameters , code ) ; configureAST ( closureExpression , node ) ; return closureExpression ; } protected Expression blockExpression ( AST node ) { AST codeNode = node . getFirstChild ( ) ; if ( codeNode == null ) return ConstantExpression . NULL ; if ( codeNode . getType ( ) == EXPR && codeNode . getNextSibling ( ) == null ) { return expression ( codeNode ) ; } Parameter [ ] parameters = Parameter . EMPTY_ARRAY ; Statement code = statementListNoChild ( codeNode , node ) ; ClosureExpression closureExpression = new ClosureExpression ( parameters , code ) ; configureAST ( closureExpression , node ) ; String callName = "<STR_LIT>" ; Expression noArguments = new ArgumentListExpression ( ) ; MethodCallExpression call = new MethodCallExpression ( closureExpression , callName , noArguments ) ; configureAST ( call , node ) ; return call ; } protected Expression unaryMinusExpression ( AST unaryMinusExpr ) { AST node = unaryMinusExpr . getFirstChild ( ) ; String text = node . getText ( ) ; switch ( node . getType ( ) ) { case NUM_DOUBLE : case NUM_FLOAT : case NUM_BIG_DECIMAL : ConstantExpression constantExpression = new ConstantExpression ( Numbers . parseDecimal ( "<STR_LIT:->" + text ) ) ; configureAST ( constantExpression , unaryMinusExpr ) ; return constantExpression ; case NUM_BIG_INT : case NUM_INT : case NUM_LONG : ConstantExpression constantLongExpression = new ConstantExpression ( Numbers . parseInteger ( "<STR_LIT:->" + text ) ) ; configureAST ( constantLongExpression , unaryMinusExpr ) ; return constantLongExpression ; default : UnaryMinusExpression unaryMinusExpression = new UnaryMinusExpression ( expression ( node ) ) ; configureAST ( unaryMinusExpression , unaryMinusExpr ) ; return unaryMinusExpression ; } } protected Expression unaryPlusExpression ( AST unaryPlusExpr ) { AST node = unaryPlusExpr . getFirstChild ( ) ; switch ( node . getType ( ) ) { case NUM_DOUBLE : case NUM_FLOAT : case NUM_BIG_DECIMAL : case NUM_BIG_INT : case NUM_INT : case NUM_LONG : return expression ( node ) ; default : UnaryPlusExpression unaryPlusExpression = new UnaryPlusExpression ( expression ( node ) ) ; configureAST ( unaryPlusExpression , unaryPlusExpr ) ; return unaryPlusExpression ; } } protected ConstantExpression decimalExpression ( AST node ) { String text = node . getText ( ) ; ConstantExpression constantExpression = new ConstantExpression ( Numbers . parseDecimal ( text ) ) ; configureAST ( constantExpression , node ) ; return constantExpression ; } protected ConstantExpression integerExpression ( AST node ) { String text = node . getText ( ) ; ConstantExpression constantExpression = new ConstantExpression ( Numbers . parseInteger ( text ) ) ; configureAST ( constantExpression , node ) ; return constantExpression ; } protected Expression gstring ( AST gstringNode ) { List strings = new ArrayList ( ) ; List values = new ArrayList ( ) ; StringBuffer buffer = new StringBuffer ( ) ; boolean isPrevString = false ; for ( AST node = gstringNode . getFirstChild ( ) ; node != null ; node = node . getNextSibling ( ) ) { int type = node . getType ( ) ; String text = null ; switch ( type ) { case STRING_LITERAL : if ( isPrevString ) assertNodeType ( IDENT , node ) ; isPrevString = true ; text = node . getText ( ) ; ConstantExpression constantExpression = new ConstantExpression ( text ) ; configureAST ( constantExpression , node ) ; strings . add ( constantExpression ) ; buffer . append ( text ) ; break ; default : { if ( ! isPrevString ) assertNodeType ( IDENT , node ) ; isPrevString = false ; Expression expression = expression ( node ) ; values . add ( expression ) ; buffer . append ( "<STR_LIT:$>" ) ; buffer . append ( expression . getText ( ) ) ; } break ; } } GStringExpression gStringExpression = new GStringExpression ( buffer . toString ( ) , strings , values ) ; configureAST ( gStringExpression , gstringNode ) ; return gStringExpression ; } protected ClassNode type ( AST typeNode ) { return buildName ( typeNode . getFirstChild ( ) ) ; } public static String qualifiedName ( AST qualifiedNameNode ) { if ( isType ( IDENT , qualifiedNameNode ) ) { return qualifiedNameNode . getText ( ) ; } if ( isType ( DOT , qualifiedNameNode ) ) { AST node = qualifiedNameNode . getFirstChild ( ) ; StringBuffer buffer = new StringBuffer ( ) ; boolean first = true ; for ( ; node != null && ! isType ( TYPE_ARGUMENTS , node ) ; node = node . getNextSibling ( ) ) { if ( first ) { first = false ; } else { buffer . append ( "<STR_LIT:.>" ) ; } buffer . append ( qualifiedName ( node ) ) ; } return buffer . toString ( ) ; } else { return qualifiedNameNode . getText ( ) ; } } private static AST getTypeArgumentsNode ( AST root ) { while ( root != null && ! isType ( TYPE_ARGUMENTS , root ) ) { root = root . getNextSibling ( ) ; } return root ; } private int getBoundType ( AST node ) { if ( node == null ) return - <NUM_LIT:1> ; if ( isType ( TYPE_UPPER_BOUNDS , node ) ) return TYPE_UPPER_BOUNDS ; if ( isType ( TYPE_LOWER_BOUNDS , node ) ) return TYPE_LOWER_BOUNDS ; throw new ASTRuntimeException ( node , "<STR_LIT>" + getTokenName ( node ) + "<STR_LIT>" + getTokenName ( TYPE_UPPER_BOUNDS ) + "<STR_LIT>" + getTokenName ( TYPE_LOWER_BOUNDS ) ) ; } private GenericsType makeGenericsArgumentType ( AST typeArgument ) { GenericsType gt ; AST rootNode = typeArgument . getFirstChild ( ) ; if ( isType ( WILDCARD_TYPE , rootNode ) ) { ClassNode base = ClassHelper . makeWithoutCaching ( "<STR_LIT:?>" ) ; if ( rootNode . getNextSibling ( ) != null ) { int boundType = getBoundType ( rootNode . getNextSibling ( ) ) ; ClassNode [ ] gts = makeGenericsBounds ( rootNode , boundType ) ; if ( boundType == TYPE_UPPER_BOUNDS ) { gt = new GenericsType ( base , gts , null ) ; } else { gt = new GenericsType ( base , null , gts [ <NUM_LIT:0> ] ) ; } } else { gt = new GenericsType ( base , null , null ) ; } gt . setName ( "<STR_LIT:?>" ) ; gt . setWildcard ( true ) ; } else { ClassNode argument = makeTypeWithArguments ( rootNode ) ; gt = new GenericsType ( argument ) ; } configureAST ( gt , typeArgument ) ; return gt ; } protected ClassNode makeTypeWithArguments ( AST rootNode ) { ClassNode basicType = makeType ( rootNode ) ; LinkedList typeArgumentList = new LinkedList ( ) ; AST node = rootNode . getFirstChild ( ) ; if ( node == null || isType ( INDEX_OP , node ) || isType ( ARRAY_DECLARATOR , node ) ) return basicType ; if ( isType ( DOT , node ) ) return basicType ; node = node . getFirstChild ( ) ; if ( node == null ) return basicType ; assertNodeType ( TYPE_ARGUMENTS , node ) ; AST typeArgument = node . getFirstChild ( ) ; while ( typeArgument != null ) { assertNodeType ( TYPE_ARGUMENT , typeArgument ) ; GenericsType gt = makeGenericsArgumentType ( typeArgument ) ; typeArgumentList . add ( gt ) ; typeArgument = typeArgument . getNextSibling ( ) ; } if ( typeArgumentList . size ( ) > <NUM_LIT:0> ) { basicType . setGenericsTypes ( ( GenericsType [ ] ) typeArgumentList . toArray ( new GenericsType [ <NUM_LIT:0> ] ) ) ; } return basicType ; } private ClassNode [ ] makeGenericsBounds ( AST rn , int boundType ) { AST boundsRoot = rn . getNextSibling ( ) ; if ( boundsRoot == null ) return null ; assertNodeType ( boundType , boundsRoot ) ; LinkedList bounds = new LinkedList ( ) ; for ( AST boundsNode = boundsRoot . getFirstChild ( ) ; boundsNode != null ; boundsNode = boundsNode . getNextSibling ( ) ) { ClassNode bound = null ; bound = makeTypeWithArguments ( boundsNode ) ; configureAST ( bound , boundsNode ) ; bounds . add ( bound ) ; } if ( bounds . size ( ) == <NUM_LIT:0> ) return null ; return ( ClassNode [ ] ) bounds . toArray ( new ClassNode [ bounds . size ( ) ] ) ; } protected GenericsType [ ] makeGenericsType ( AST rootNode ) { AST typeParameter = rootNode . getFirstChild ( ) ; LinkedList ret = new LinkedList ( ) ; assertNodeType ( TYPE_PARAMETER , typeParameter ) ; while ( isType ( TYPE_PARAMETER , typeParameter ) ) { AST typeNode = typeParameter . getFirstChild ( ) ; ClassNode type = makeType ( typeParameter ) ; GenericsType gt = new GenericsType ( type , makeGenericsBounds ( typeNode , TYPE_UPPER_BOUNDS ) , null ) ; configureAST ( gt , typeParameter ) ; ret . add ( gt ) ; typeParameter = typeParameter . getNextSibling ( ) ; } return ( GenericsType [ ] ) ret . toArray ( new GenericsType [ <NUM_LIT:0> ] ) ; } protected ClassNode makeType ( AST typeNode ) { ClassNode answer = ClassHelper . DYNAMIC_TYPE ; AST node = typeNode . getFirstChild ( ) ; if ( node != null ) { if ( isType ( INDEX_OP , node ) || isType ( ARRAY_DECLARATOR , node ) ) { answer = makeType ( node ) . makeArray ( ) ; } else { answer = ClassHelper . make ( qualifiedName ( node ) ) ; if ( answer . isUsingGenerics ( ) ) { ClassNode newAnswer = ClassHelper . makeWithoutCaching ( answer . getName ( ) ) ; newAnswer . setRedirect ( answer ) ; answer = newAnswer ; } } configureAST ( answer , node ) ; } return answer ; } protected ClassNode buildName ( AST node ) { if ( isType ( TYPE , node ) ) { node = node . getFirstChild ( ) ; } ClassNode answer = null ; if ( isType ( DOT , node ) || isType ( OPTIONAL_DOT , node ) ) { answer = ClassHelper . make ( qualifiedName ( node ) ) ; } else if ( isPrimitiveTypeLiteral ( node ) ) { answer = ClassHelper . make ( node . getText ( ) ) ; } else if ( isType ( INDEX_OP , node ) || isType ( ARRAY_DECLARATOR , node ) ) { AST child = node . getFirstChild ( ) ; answer = buildName ( child ) . makeArray ( ) ; configureAST ( answer , node ) ; return answer ; } else { String identifier = node . getText ( ) ; answer = ClassHelper . make ( identifier ) ; } AST nextSibling = node . getNextSibling ( ) ; if ( isType ( INDEX_OP , nextSibling ) || isType ( ARRAY_DECLARATOR , node ) ) { answer = answer . makeArray ( ) ; configureAST ( answer , node ) ; return answer ; } else { configureAST ( answer , node ) ; return answer ; } } protected boolean isPrimitiveTypeLiteral ( AST node ) { int type = node . getType ( ) ; switch ( type ) { case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_double : case LITERAL_float : case LITERAL_int : case LITERAL_long : case LITERAL_short : return true ; default : return false ; } } protected String identifier ( AST node ) { assertNodeType ( IDENT , node ) ; return node . getText ( ) ; } protected String label ( AST labelNode ) { AST node = labelNode . getFirstChild ( ) ; if ( node == null ) { return null ; } return identifier ( node ) ; } protected boolean hasVisibility ( int modifiers ) { return ( modifiers & ( Opcodes . ACC_PRIVATE | Opcodes . ACC_PROTECTED | Opcodes . ACC_PUBLIC ) ) != <NUM_LIT:0> ; } protected void configureAST ( ASTNode node , AST ast ) { if ( ast == null ) throw new ASTRuntimeException ( ast , "<STR_LIT>" + node . getClass ( ) . getName ( ) + "<STR_LIT>" ) ; int startcol = ast . getColumn ( ) ; int startline = ast . getLine ( ) ; node . setColumnNumber ( startcol ) ; node . setLineNumber ( startline ) ; int startoffset = locations . findOffset ( startline , startcol ) ; node . setStart ( startoffset ) ; if ( ast instanceof GroovySourceAST ) { GroovySourceAST groovySourceAST = ( GroovySourceAST ) ast ; int lastcol = groovySourceAST . getColumnLast ( ) ; int lastline = groovySourceAST . getLineLast ( ) ; node . setLastColumnNumber ( lastcol ) ; node . setLastLineNumber ( lastline ) ; int endoffset = locations . findOffset ( lastline , lastcol ) ; node . setEnd ( endoffset ) ; } } protected void configureAnnotationAST ( ASTNode node , AST ast ) { if ( ast == null ) { throw new ASTRuntimeException ( ast , "<STR_LIT>" + node . getClass ( ) . getName ( ) + "<STR_LIT>" ) ; } if ( ast instanceof GroovySourceAST ) { GroovySourceAST correctAst = ( GroovySourceAST ) ast ; correctAst = ( GroovySourceAST ) correctAst . getFirstChild ( ) ; setPositions ( node , correctAst . getColumn ( ) , correctAst . getLine ( ) , correctAst . getColumnLast ( ) , correctAst . getLineLast ( ) ) ; if ( node instanceof AnnotationNode ) { setPositions ( ( ( AnnotationNode ) node ) . getClassNode ( ) , correctAst . getColumn ( ) , correctAst . getLine ( ) , correctAst . getColumnLast ( ) + <NUM_LIT:1> , correctAst . getLineLast ( ) ) ; } } else { int startcol = ast . getColumn ( ) ; int startline = ast . getLine ( ) ; node . setColumnNumber ( startcol ) ; node . setLineNumber ( startline ) ; int startoffset = locations . findOffset ( startline , startcol ) ; node . setStart ( startoffset ) ; } } private void configureClassNodeForClassDefAST ( ASTNode node , AST ast ) { if ( ast == null ) { throw new ASTRuntimeException ( ast , "<STR_LIT>" + node . getClass ( ) . getName ( ) + "<STR_LIT>" ) ; } if ( ast instanceof GroovySourceAST ) { GroovySourceAST theAst = ( GroovySourceAST ) ast ; theAst = ( GroovySourceAST ) theAst . getFirstChild ( ) . getNextSibling ( ) ; setPositions ( node , theAst . getColumn ( ) , theAst . getLine ( ) , theAst . getColumnLast ( ) , theAst . getLineLast ( ) ) ; } else { int startcol = ast . getColumn ( ) ; int startline = ast . getLine ( ) ; node . setColumnNumber ( startcol ) ; node . setLineNumber ( startline ) ; int startoffset = locations . findOffset ( startline , startcol ) ; node . setStart ( startoffset ) ; } } private void setPositions ( ASTNode node , int scol , int sline , int ecol , int eline ) { node . setColumnNumber ( scol ) ; node . setLineNumber ( sline ) ; node . setStart ( locations . findOffset ( sline , scol ) ) ; node . setLastColumnNumber ( ecol ) ; node . setLastLineNumber ( eline ) ; node . setEnd ( locations . findOffset ( eline , ecol ) - <NUM_LIT:1> ) ; } protected static Token makeToken ( int typeCode , AST node ) { return Token . newSymbol ( typeCode , node . getLine ( ) , node . getColumn ( ) ) ; } protected String getFirstChildText ( AST node ) { AST child = node . getFirstChild ( ) ; return child != null ? child . getText ( ) : null ; } public static boolean isType ( int typeCode , AST node ) { return node != null && node . getType ( ) == typeCode ; } private String getTokenName ( int token ) { if ( tokenNames == null ) return "<STR_LIT>" + token ; return tokenNames [ token ] ; } private String getTokenName ( AST node ) { if ( node == null ) return "<STR_LIT:null>" ; return getTokenName ( node . getType ( ) ) ; } protected void assertNodeType ( int type , AST node ) { if ( node == null ) { throw new ASTRuntimeException ( node , "<STR_LIT>" + getTokenName ( type ) ) ; } if ( node . getType ( ) != type ) { throw new ASTRuntimeException ( node , "<STR_LIT>" + getTokenName ( node ) + "<STR_LIT>" + getTokenName ( type ) ) ; } } protected void notImplementedYet ( AST node ) { throw new ASTRuntimeException ( node , "<STR_LIT>" + getTokenName ( node ) ) ; } protected Expression unknownAST ( AST node ) { if ( node . getType ( ) == CLASS_DEF ) { throw new ASTRuntimeException ( node , "<STR_LIT>" + "<STR_LIT>" ) ; } return new ConstantExpression ( "<STR_LIT>" ) ; } protected void dumpTree ( AST ast ) { for ( AST node = ast . getFirstChild ( ) ; node != null ; node = node . getNextSibling ( ) ) { dump ( node ) ; } } protected void dump ( AST node ) { System . out . println ( "<STR_LIT>" + getTokenName ( node ) + "<STR_LIT>" + node . getText ( ) ) ; } } </s>
|
<s> package org . codehaus . groovy . antlr ; import java . util . ArrayList ; import java . util . List ; import javax . swing . text . BadLocationException ; public class LocationSupport { private static final int [ ] NO_LINE_ENDINGS = new int [ <NUM_LIT:0> ] ; public static final LocationSupport NO_LOCATIONS = new LocationSupport ( ) ; private final int [ ] lineEndings ; public LocationSupport ( char [ ] contents ) { if ( contents != null ) { lineEndings = processLineEndings ( contents ) ; } else { lineEndings = NO_LINE_ENDINGS ; } } public LocationSupport ( List < StringBuffer > lines ) { if ( lines != null ) { lineEndings = processLineEndings ( lines ) ; } else { lineEndings = NO_LINE_ENDINGS ; } } public LocationSupport ( int [ ] lineEndings ) { this . lineEndings = lineEndings ; } public LocationSupport ( ) { lineEndings = NO_LINE_ENDINGS ; } private int [ ] processLineEndings ( List < StringBuffer > lines ) { int [ ] newLineEndings = new int [ lines . size ( ) + <NUM_LIT:1> ] ; int total = <NUM_LIT:0> ; int current = <NUM_LIT:1> ; for ( StringBuffer line : lines ) { newLineEndings [ current ++ ] = total += ( line . length ( ) ) ; } return newLineEndings ; } private int [ ] processLineEndings ( char [ ] contents ) { List < Integer > l = new ArrayList < Integer > ( ) ; for ( int i = <NUM_LIT:0> ; i < contents . length ; i ++ ) { if ( contents [ i ] == '<STR_LIT:\n>' ) { l . add ( i ) ; } else if ( contents [ i ] == '<STR_LIT>' ) { l . add ( i ) ; if ( i < contents . length && contents [ i ] == '<STR_LIT:\n>' ) { i ++ ; } } } int [ ] newLineEndings = new int [ l . size ( ) ] ; int i = <NUM_LIT:0> ; for ( Integer integer : l ) { newLineEndings [ i ] = integer . intValue ( ) ; } return newLineEndings ; } public int findOffset ( int row , int col ) { return row <= lineEndings . length && row > <NUM_LIT:0> ? lineEndings [ row - <NUM_LIT:1> ] + col - <NUM_LIT:1> : <NUM_LIT:0> ; } public int getEnd ( ) { return lineEndings . length > <NUM_LIT:0> ? lineEndings [ lineEndings . length - <NUM_LIT:1> ] : <NUM_LIT:0> ; } public int getEndColumn ( ) { if ( lineEndings . length > <NUM_LIT:1> ) { return lineEndings [ lineEndings . length - <NUM_LIT:1> ] - lineEndings [ lineEndings . length - <NUM_LIT:2> ] ; } else if ( lineEndings . length > <NUM_LIT:0> ) { return lineEndings [ <NUM_LIT:0> ] ; } else { return <NUM_LIT:0> ; } } public int getEndLine ( ) { return lineEndings . length > <NUM_LIT:0> ? lineEndings . length - <NUM_LIT:1> : <NUM_LIT:0> ; } public int [ ] getRowCol ( int offset ) { for ( int i = <NUM_LIT:1> ; i < lineEndings . length ; i ++ ) { if ( lineEndings [ i ] > offset ) { return new int [ ] { i , offset - lineEndings [ i - <NUM_LIT:1> ] + <NUM_LIT:1> } ; } } throw new RuntimeException ( "<STR_LIT>" + offset ) ; } public boolean isPopulated ( ) { return lineEndings . length > <NUM_LIT:0> ; } } </s>
|
<s> package org . codehaus . groovy . antlr ; import java . util . List ; import org . codehaus . groovy . antlr . GroovySourceAST ; public interface ICSTReporter { public void generatedCST ( String fileName , GroovySourceAST ast ) ; public void reportErrors ( String fileName , List errors ) ; } </s>
|
<s> package org . codehaus . groovy . antlr ; import java . util . ArrayList ; import java . util . List ; public class SourceBuffer { private final List lines ; private StringBuffer current ; private final List < Integer > lineEndings ; public SourceBuffer ( ) { lines = new ArrayList ( ) ; lineEndings = new ArrayList < Integer > ( ) ; lineEndings . add ( <NUM_LIT:0> ) ; current = new StringBuffer ( ) ; lines . add ( current ) ; } public String getSnippet ( LineColumn start , LineColumn end ) { if ( start == null || end == null ) { return null ; } if ( start . equals ( end ) ) { return null ; } if ( lines . size ( ) == <NUM_LIT:1> && current . length ( ) == <NUM_LIT:0> ) { return null ; } int startLine = start . getLine ( ) ; int startColumn = start . getColumn ( ) ; int endLine = end . getLine ( ) ; int endColumn = end . getColumn ( ) ; if ( startLine < <NUM_LIT:1> ) { startLine = <NUM_LIT:1> ; } if ( endLine < <NUM_LIT:1> ) { endLine = <NUM_LIT:1> ; } if ( startColumn < <NUM_LIT:1> ) { startColumn = <NUM_LIT:1> ; } if ( endColumn < <NUM_LIT:1> ) { endColumn = <NUM_LIT:1> ; } if ( startLine > lines . size ( ) ) { startLine = lines . size ( ) ; } if ( endLine > lines . size ( ) ) { endLine = lines . size ( ) ; } StringBuffer snippet = new StringBuffer ( ) ; for ( int i = startLine - <NUM_LIT:1> ; i < endLine ; i ++ ) { String line = ( ( StringBuffer ) lines . get ( i ) ) . toString ( ) ; if ( startLine == endLine ) { if ( startColumn > line . length ( ) ) { startColumn = line . length ( ) ; } if ( startColumn < <NUM_LIT:1> ) { startColumn = <NUM_LIT:1> ; } if ( endColumn > line . length ( ) ) { endColumn = line . length ( ) + <NUM_LIT:1> ; } if ( endColumn < <NUM_LIT:1> ) { endColumn = <NUM_LIT:1> ; } line = line . substring ( startColumn - <NUM_LIT:1> , endColumn - <NUM_LIT:1> ) ; } else { if ( i == startLine - <NUM_LIT:1> ) { if ( startColumn - <NUM_LIT:1> < line . length ( ) ) { line = line . substring ( startColumn - <NUM_LIT:1> ) ; } } if ( i == endLine - <NUM_LIT:1> ) { if ( endColumn - <NUM_LIT:1> < line . length ( ) ) { line = line . substring ( <NUM_LIT:0> , endColumn - <NUM_LIT:1> ) ; } } } snippet . append ( line ) ; } return snippet . toString ( ) ; } private boolean prevWasCarriageReturn = false ; private int col = <NUM_LIT:0> ; public void write ( int c ) { if ( c != - <NUM_LIT:1> ) { col ++ ; current . append ( ( char ) c ) ; } if ( c == '<STR_LIT:\n>' ) { if ( ! prevWasCarriageReturn ) { current = new StringBuffer ( ) ; lines . add ( current ) ; lineEndings . add ( col ) ; } else { current = new StringBuffer ( ) ; ( ( StringBuffer ) lines . get ( lines . size ( ) - <NUM_LIT:1> ) ) . append ( '<STR_LIT:\n>' ) ; lineEndings . remove ( lineEndings . size ( ) - <NUM_LIT:1> ) ; lineEndings . add ( col ) ; } } if ( c == '<STR_LIT>' ) { current = new StringBuffer ( ) ; lines . add ( current ) ; lineEndings . add ( col ) ; prevWasCarriageReturn = true ; } else { prevWasCarriageReturn = false ; } } public LocationSupport getLocationSupport ( ) { lineEndings . add ( col ) ; int [ ] lineEndingsArray = new int [ lineEndings . size ( ) ] ; for ( int i = <NUM_LIT:0> , max = lineEndings . size ( ) ; i < max ; i ++ ) { lineEndingsArray [ i ] = ( ( Integer ) lineEndings . get ( i ) ) . intValue ( ) ; } return new LocationSupport ( lineEndingsArray ) ; } } </s>
|
<s> package org . codehaus . groovy . antlr ; import java . io . Reader ; import org . codehaus . groovy . control . CompilationFailedException ; import org . codehaus . groovy . control . SourceUnit ; import org . codehaus . groovy . syntax . Reduction ; public class CSTParserPlugin extends AntlrParserPlugin { private ICSTReporter cstReporter ; CSTParserPlugin ( ICSTReporter cstReporter ) { this . cstReporter = cstReporter ; } public Reduction parseCST ( final SourceUnit sourceUnit , Reader reader ) throws CompilationFailedException { Reduction reduction = super . parseCST ( sourceUnit , reader ) ; GroovySourceAST cst = ( GroovySourceAST ) super . ast ; if ( cst != null ) { cstReporter . generatedCST ( sourceUnit . getName ( ) , cst ) ; } return reduction ; } } </s>
|
<s> package org . codehaus . groovy . antlr ; import java . io . Reader ; import java . util . Collections ; import java . util . List ; import java . util . Map ; import org . codehaus . groovy . control . CompilationFailedException ; import org . codehaus . groovy . control . SourceUnit ; import org . codehaus . groovy . internal . antlr . parser . GroovyLexer ; import org . codehaus . groovy . internal . antlr . parser . GroovyRecognizer ; import org . codehaus . groovy . syntax . SyntaxException ; import antlr . RecognitionException ; import antlr . TokenStreamException ; import antlr . TokenStreamRecognitionException ; public class ErrorRecoveredCSTParserPlugin extends AntlrParserPlugin { private final ICSTReporter reporter ; ErrorRecoveredCSTParserPlugin ( ICSTReporter reporter ) { this . reporter = reporter ; } @ Override public void transformCSTIntoAST ( final SourceUnit sourceUnit , Reader reader , SourceBuffer sourceBuffer ) throws CompilationFailedException { super . ast = null ; setController ( sourceUnit ) ; UnicodeEscapingReader unicodeReader = new UnicodeEscapingReader ( reader , sourceBuffer ) ; GroovyLexer lexer = new GroovyLexer ( unicodeReader ) ; unicodeReader . setLexer ( lexer ) ; GroovyRecognizer parser = GroovyRecognizer . make ( lexer ) ; parser . setSourceBuffer ( sourceBuffer ) ; super . tokenNames = parser . getTokenNames ( ) ; parser . setFilename ( sourceUnit . getName ( ) ) ; try { parser . compilationUnit ( ) ; configureLocationSupport ( sourceBuffer ) ; } catch ( TokenStreamRecognitionException tsre ) { configureLocationSupport ( sourceBuffer ) ; RecognitionException e = tsre . recog ; SyntaxException se = new SyntaxException ( e . getMessage ( ) , e , e . getLine ( ) , e . getColumn ( ) ) ; se . setFatal ( true ) ; sourceUnit . addError ( se ) ; } catch ( RecognitionException e ) { configureLocationSupport ( sourceBuffer ) ; int origLine = e . getLine ( ) ; int origColumn = e . getColumn ( ) ; int [ ] newInts = fixLineColumn ( origLine , origColumn ) ; int newLine = newInts [ <NUM_LIT:0> ] ; int newColumn = newInts [ <NUM_LIT:1> ] ; SyntaxException se = new SyntaxException ( e . getMessage ( ) , e , newLine , newColumn ) ; sourceUnit . addError ( se ) ; } catch ( TokenStreamException e ) { configureLocationSupport ( sourceBuffer ) ; sourceUnit . addException ( e ) ; } super . ast = parser . getAST ( ) ; sourceUnit . setComments ( parser . getComments ( ) ) ; reportCST ( sourceUnit , parser ) ; } @ SuppressWarnings ( "<STR_LIT:unchecked>" ) private void reportCST ( final SourceUnit sourceUnit , final GroovyRecognizer parser ) { final List errorList = parser . getErrorList ( ) ; final GroovySourceAST cst = ( GroovySourceAST ) parser . getAST ( ) ; if ( reporter != null ) { if ( cst != null ) reporter . generatedCST ( sourceUnit . getName ( ) , cst ) ; if ( errorList . size ( ) != <NUM_LIT:0> ) reporter . reportErrors ( sourceUnit . getName ( ) , Collections . unmodifiableList ( errorList ) ) ; } else { for ( Map < String , Object > error : ( List < Map < String , Object > > ) errorList ) { int origLine = ( ( Integer ) error . get ( "<STR_LIT>" ) ) . intValue ( ) ; int origColumn = ( ( Integer ) error . get ( "<STR_LIT>" ) ) . intValue ( ) ; int [ ] newInts = fixLineColumn ( origLine , origColumn ) ; int newLine = newInts [ <NUM_LIT:0> ] ; int newColumn = newInts [ <NUM_LIT:1> ] ; SyntaxException se = new SyntaxException ( ( String ) error . get ( "<STR_LIT:error>" ) , newLine , newColumn ) ; sourceUnit . addError ( se ) ; } } } private int [ ] fixLineColumn ( int origLine , int origColumn ) { if ( locations . isPopulated ( ) ) { int offset = locations . findOffset ( origLine , origColumn ) ; if ( offset >= locations . getEnd ( ) - <NUM_LIT:1> ) { return locations . getRowCol ( locations . getEnd ( ) - <NUM_LIT:1> ) ; } } return new int [ ] { origLine , origColumn } ; } } </s>
|
<s> package org . codehaus . groovy . syntax ; @ SuppressWarnings ( "<STR_LIT:serial>" ) public class PreciseSyntaxException extends SyntaxException { private int startOffset ; private int endOffset ; public PreciseSyntaxException ( String message , int line , int col , int startOffset , int endOffset ) { super ( message , line , col ) ; this . startOffset = startOffset ; this . endOffset = endOffset ; } public int getStartOffset ( ) { return startOffset ; } public int getEndOffset ( ) { return endOffset ; } } </s>
|
<s> package org . codehaus . groovy . ast ; import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; public abstract class Comment { protected static final int BLOCK = <NUM_LIT:0> ; protected static final int LINE = <NUM_LIT:1> ; protected static final int JAVADOC = <NUM_LIT:2> ; protected static final boolean debug = false ; protected String comment ; private int kind ; public int sline , scol , eline , ecol ; public Comment ( int kind , int sline , int scol , int eline , int ecol , String string ) { this . kind = kind ; this . sline = sline ; this . scol = scol ; this . eline = eline ; this . ecol = ecol ; this . comment = string ; } public int getLastLine ( ) { return eline ; } public static Comment makeSingleLineComment ( int sline , int scol , int eline , int ecol , String string ) { return new SingleLineComment ( sline , scol , eline , ecol , string ) ; } public static Comment makeMultiLineComment ( int sline , int scol , int eline , int ecol , String string ) { return new MultiLineComment ( sline , scol , eline , ecol , string ) ; } public abstract List < TaskEntry > getPositionsOf ( String taskTag , String taskPriority , int [ ] lineseps , boolean caseSensitive ) ; public int [ ] getPositions ( int [ ] lineseps ) { int offsetToStartLine = ( sline == <NUM_LIT:1> ? <NUM_LIT:0> : lineseps [ sline - <NUM_LIT:2> ] + <NUM_LIT:1> ) ; int start = offsetToStartLine + ( scol - <NUM_LIT:1> ) ; int offsetToEndLine = ( eline == <NUM_LIT:1> ? <NUM_LIT:0> : lineseps [ eline - <NUM_LIT:2> ] + <NUM_LIT:1> ) ; int end = offsetToEndLine + ( ecol - <NUM_LIT:1> ) ; if ( kind == LINE ) { return new int [ ] { - start , - end } ; } else if ( kind == BLOCK ) { return new int [ ] { start , - end } ; } else { return new int [ ] { start , end } ; } } public String toString ( ) { return comment ; } protected boolean isValidStartLocationForTask ( String text , int index , String taskTag ) { int tagLen = taskTag . length ( ) ; if ( comment . charAt ( index - <NUM_LIT:1> ) == '<CHAR_LIT>' ) { return false ; } if ( Character . isJavaIdentifierStart ( comment . charAt ( index ) ) ) { if ( Character . isJavaIdentifierPart ( comment . charAt ( index - <NUM_LIT:1> ) ) ) { return false ; } } if ( ( index + tagLen ) < comment . length ( ) && Character . isJavaIdentifierStart ( comment . charAt ( index + tagLen - <NUM_LIT:1> ) ) ) { if ( Character . isJavaIdentifierPart ( comment . charAt ( index + tagLen ) ) ) { return false ; } } return true ; } protected int findTaskTag ( String text , String tag , boolean caseSensitive , int fromIndex ) { if ( caseSensitive ) { return text . indexOf ( tag , fromIndex ) ; } else { int taglen = tag . length ( ) ; String lcTag = tag . toLowerCase ( ) ; char firstChar = lcTag . charAt ( <NUM_LIT:0> ) ; for ( int p = fromIndex , max = text . length ( ) - tag . length ( ) + <NUM_LIT:1> ; p < max ; p ++ ) { if ( Character . toLowerCase ( text . charAt ( p ) ) == firstChar ) { boolean matched = true ; for ( int t = <NUM_LIT:1> ; t < taglen ; t ++ ) { if ( Character . toLowerCase ( text . charAt ( p + t ) ) != lcTag . charAt ( t ) ) { matched = false ; break ; } } if ( matched ) { return p ; } } } return - <NUM_LIT:1> ; } } public boolean isJavadoc ( ) { return kind == JAVADOC ; } } class SingleLineComment extends Comment { public SingleLineComment ( int sline , int scol , int eline , int ecol , String string ) { super ( LINE , sline , scol , eline , ecol , string ) ; if ( debug ) { System . out . println ( "<STR_LIT>" + string + "<STR_LIT>" + sline + "<STR_LIT:C>" + scol + "<STR_LIT>" + eline + "<STR_LIT:C>" + ecol ) ; } } public List < TaskEntry > getPositionsOf ( String taskTag , String taskPriority , int [ ] lineseps , boolean caseSensitive ) { int i = findTaskTag ( comment , taskTag , caseSensitive , <NUM_LIT:0> ) ; if ( debug ) { System . out . println ( "<STR_LIT>" + comment + "<STR_LIT>" + taskTag + "<STR_LIT>" + i ) ; } if ( i == - <NUM_LIT:1> ) { return Collections . emptyList ( ) ; } List < TaskEntry > tasks = new ArrayList < TaskEntry > ( ) ; while ( i != - <NUM_LIT:1> ) { if ( isValidStartLocationForTask ( comment , i , taskTag ) ) { int offsetToLineStart = ( sline == <NUM_LIT:1> ? <NUM_LIT:0> : lineseps [ sline - <NUM_LIT:2> ] + <NUM_LIT:1> ) ; int taskTagStart = offsetToLineStart + ( scol - <NUM_LIT:1> ) + i ; int taskEnd = offsetToLineStart + ecol - <NUM_LIT:2> ; TaskEntry taskEntry = new TaskEntry ( taskTagStart , taskEnd , taskTag , taskPriority , comment , offsetToLineStart + scol - <NUM_LIT:1> ) ; if ( debug ) { System . out . println ( "<STR_LIT>" + taskEntry . toString ( ) ) ; } tasks . add ( taskEntry ) ; } i = findTaskTag ( comment , taskTag , caseSensitive , i + taskTag . length ( ) ) ; } return tasks ; } } class MultiLineComment extends Comment { public MultiLineComment ( int sline , int scol , int eline , int ecol , String string ) { super ( string . charAt ( <NUM_LIT:2> ) == '<CHAR_LIT>' ? JAVADOC : BLOCK , sline , scol , eline , ecol , string ) ; if ( debug ) { System . out . println ( "<STR_LIT>" + string + "<STR_LIT>" + sline + "<STR_LIT:C>" + scol + "<STR_LIT>" + eline + "<STR_LIT:C>" + ecol ) ; } } @ Override public List < TaskEntry > getPositionsOf ( String taskTag , String taskPriority , int [ ] lineseps , boolean caseSensitive ) { int i = findTaskTag ( comment , taskTag , caseSensitive , <NUM_LIT:0> ) ; if ( debug ) { System . out . println ( "<STR_LIT>" + comment + "<STR_LIT>" + taskTag + "<STR_LIT>" + i ) ; } if ( i == - <NUM_LIT:1> ) { return Collections . emptyList ( ) ; } List < TaskEntry > taskPositions = new ArrayList < TaskEntry > ( ) ; while ( i != - <NUM_LIT:1> ) { if ( isValidStartLocationForTask ( comment , i , taskTag ) ) { int offsetToCommentStart = ( sline == <NUM_LIT:1> ? <NUM_LIT:0> : lineseps [ sline - <NUM_LIT:2> ] + <NUM_LIT:1> ) + scol - <NUM_LIT:1> ; int taskTagStart = offsetToCommentStart + i ; int taskEnd = taskTagStart ; while ( true ) { int pos = taskEnd - offsetToCommentStart ; char ch = comment . charAt ( pos ) ; if ( ch == '<STR_LIT:\n>' || ch == '<STR_LIT>' ) { break ; } if ( ( pos + <NUM_LIT:2> ) > comment . length ( ) ) { taskEnd -- ; break ; } taskEnd ++ ; } TaskEntry taskEntry = new TaskEntry ( taskTagStart , taskEnd - <NUM_LIT:1> , taskTag , taskPriority , comment , offsetToCommentStart ) ; if ( debug ) { System . out . println ( "<STR_LIT>" + taskEntry . toString ( ) ) ; } taskPositions . add ( taskEntry ) ; } i = findTaskTag ( comment , taskTag , caseSensitive , i + taskTag . length ( ) ) ; } return taskPositions ; } } </s>
|
<s> package org . codehaus . groovy . ast ; import org . objectweb . asm . Opcodes ; public class ImportNode extends AnnotatedNode implements Opcodes { private final ClassNode type ; private final String alias ; private String packageName ; public void setPackageName ( String packageName ) { this . packageName = packageName ; } public String getPackageName ( ) { return packageName ; } public ImportNode ( ClassNode type , String alias ) { this . type = type ; this . alias = alias ; } public String getText ( ) { if ( type == null ) { return "<STR_LIT>" + packageName + "<STR_LIT>" ; } if ( alias == null || alias . length ( ) == <NUM_LIT:0> ) { return "<STR_LIT>" + type . getName ( ) ; } else { return "<STR_LIT>" + type . getName ( ) + "<STR_LIT>" + alias ; } } public String getAlias ( ) { return alias ; } public ClassNode getType ( ) { return type ; } public String getClassName ( ) { return type == null ? null : type . getName ( ) ; } } </s>
|
<s> package org . codehaus . groovy . ast ; import org . codehaus . groovy . ast . expr . * ; import org . codehaus . groovy . ast . stmt . * ; import org . codehaus . groovy . classgen . BytecodeExpression ; import java . util . Iterator ; import java . util . List ; public abstract class CodeVisitorSupport implements GroovyCodeVisitor { public void visitBlockStatement ( BlockStatement block ) { List statements = block . getStatements ( ) ; for ( Iterator iter = statements . iterator ( ) ; iter . hasNext ( ) ; ) { Statement statement = ( Statement ) iter . next ( ) ; statement . visit ( this ) ; } } public void visitForLoop ( ForStatement forLoop ) { forLoop . getCollectionExpression ( ) . visit ( this ) ; forLoop . getLoopBlock ( ) . visit ( this ) ; } public void visitWhileLoop ( WhileStatement loop ) { loop . getBooleanExpression ( ) . visit ( this ) ; loop . getLoopBlock ( ) . visit ( this ) ; } public void visitDoWhileLoop ( DoWhileStatement loop ) { loop . getLoopBlock ( ) . visit ( this ) ; loop . getBooleanExpression ( ) . visit ( this ) ; } public void visitIfElse ( IfStatement ifElse ) { ifElse . getBooleanExpression ( ) . visit ( this ) ; ifElse . getIfBlock ( ) . visit ( this ) ; ifElse . getElseBlock ( ) . visit ( this ) ; } public void visitExpressionStatement ( ExpressionStatement statement ) { statement . getExpression ( ) . visit ( this ) ; } public void visitReturnStatement ( ReturnStatement statement ) { statement . getExpression ( ) . visit ( this ) ; } public void visitAssertStatement ( AssertStatement statement ) { statement . getBooleanExpression ( ) . visit ( this ) ; statement . getMessageExpression ( ) . visit ( this ) ; } public void visitTryCatchFinally ( TryCatchStatement statement ) { statement . getTryStatement ( ) . visit ( this ) ; List list = statement . getCatchStatements ( ) ; for ( Iterator iter = list . iterator ( ) ; iter . hasNext ( ) ; ) { CatchStatement catchStatement = ( CatchStatement ) iter . next ( ) ; catchStatement . visit ( this ) ; } statement . getFinallyStatement ( ) . visit ( this ) ; } public void visitSwitch ( SwitchStatement statement ) { statement . getExpression ( ) . visit ( this ) ; List list = statement . getCaseStatements ( ) ; for ( Iterator iter = list . iterator ( ) ; iter . hasNext ( ) ; ) { CaseStatement caseStatement = ( CaseStatement ) iter . next ( ) ; caseStatement . visit ( this ) ; } statement . getDefaultStatement ( ) . visit ( this ) ; } public void visitCaseStatement ( CaseStatement statement ) { statement . getExpression ( ) . visit ( this ) ; statement . getCode ( ) . visit ( this ) ; } public void visitBreakStatement ( BreakStatement statement ) { } public void visitContinueStatement ( ContinueStatement statement ) { } public void visitSynchronizedStatement ( SynchronizedStatement statement ) { statement . getExpression ( ) . visit ( this ) ; statement . getCode ( ) . visit ( this ) ; } public void visitThrowStatement ( ThrowStatement statement ) { statement . getExpression ( ) . visit ( this ) ; } public void visitMethodCallExpression ( MethodCallExpression call ) { call . getObjectExpression ( ) . visit ( this ) ; call . getMethod ( ) . visit ( this ) ; call . getArguments ( ) . visit ( this ) ; } public void visitStaticMethodCallExpression ( StaticMethodCallExpression call ) { call . getArguments ( ) . visit ( this ) ; } public void visitConstructorCallExpression ( ConstructorCallExpression call ) { call . getArguments ( ) . visit ( this ) ; } public void visitBinaryExpression ( BinaryExpression expression ) { expression . getLeftExpression ( ) . visit ( this ) ; expression . getRightExpression ( ) . visit ( this ) ; } public void visitTernaryExpression ( TernaryExpression expression ) { expression . getBooleanExpression ( ) . visit ( this ) ; expression . getTrueExpression ( ) . visit ( this ) ; expression . getFalseExpression ( ) . visit ( this ) ; } public void visitShortTernaryExpression ( ElvisOperatorExpression expression ) { visitTernaryExpression ( expression ) ; } public void visitPostfixExpression ( PostfixExpression expression ) { expression . getExpression ( ) . visit ( this ) ; } public void visitPrefixExpression ( PrefixExpression expression ) { expression . getExpression ( ) . visit ( this ) ; } public void visitBooleanExpression ( BooleanExpression expression ) { expression . getExpression ( ) . visit ( this ) ; } public void visitNotExpression ( NotExpression expression ) { expression . getExpression ( ) . visit ( this ) ; } public void visitClosureExpression ( ClosureExpression expression ) { expression . getCode ( ) . visit ( this ) ; } public void visitTupleExpression ( TupleExpression expression ) { visitListOfExpressions ( expression . getExpressions ( ) ) ; } public void visitListExpression ( ListExpression expression ) { visitListOfExpressions ( expression . getExpressions ( ) ) ; } public void visitArrayExpression ( ArrayExpression expression ) { visitListOfExpressions ( expression . getExpressions ( ) ) ; visitListOfExpressions ( expression . getSizeExpression ( ) ) ; } public void visitMapExpression ( MapExpression expression ) { visitListOfExpressions ( expression . getMapEntryExpressions ( ) ) ; } public void visitMapEntryExpression ( MapEntryExpression expression ) { expression . getKeyExpression ( ) . visit ( this ) ; expression . getValueExpression ( ) . visit ( this ) ; } public void visitRangeExpression ( RangeExpression expression ) { expression . getFrom ( ) . visit ( this ) ; expression . getTo ( ) . visit ( this ) ; } public void visitSpreadExpression ( SpreadExpression expression ) { expression . getExpression ( ) . visit ( this ) ; } public void visitSpreadMapExpression ( SpreadMapExpression expression ) { expression . getExpression ( ) . visit ( this ) ; } public void visitMethodPointerExpression ( MethodPointerExpression expression ) { expression . getExpression ( ) . visit ( this ) ; expression . getMethodName ( ) . visit ( this ) ; } public void visitUnaryMinusExpression ( UnaryMinusExpression expression ) { expression . getExpression ( ) . visit ( this ) ; } public void visitUnaryPlusExpression ( UnaryPlusExpression expression ) { expression . getExpression ( ) . visit ( this ) ; } public void visitBitwiseNegationExpression ( BitwiseNegationExpression expression ) { expression . getExpression ( ) . visit ( this ) ; } public void visitCastExpression ( CastExpression expression ) { expression . getExpression ( ) . visit ( this ) ; } public void visitConstantExpression ( ConstantExpression expression ) { } public void visitClassExpression ( ClassExpression expression ) { } public void visitVariableExpression ( VariableExpression expression ) { } public void visitDeclarationExpression ( DeclarationExpression expression ) { visitBinaryExpression ( expression ) ; } public void visitPropertyExpression ( PropertyExpression expression ) { expression . getObjectExpression ( ) . visit ( this ) ; expression . getProperty ( ) . visit ( this ) ; } public void visitAttributeExpression ( AttributeExpression expression ) { expression . getObjectExpression ( ) . visit ( this ) ; expression . getProperty ( ) . visit ( this ) ; } public void visitFieldExpression ( FieldExpression expression ) { } public void visitRegexExpression ( RegexExpression expression ) { } public void visitGStringExpression ( GStringExpression expression ) { visitListOfExpressions ( expression . getStrings ( ) ) ; visitListOfExpressions ( expression . getValues ( ) ) ; } protected void visitListOfExpressions ( List list ) { if ( list == null ) return ; for ( Iterator iter = list . iterator ( ) ; iter . hasNext ( ) ; ) { Expression expression = ( Expression ) iter . next ( ) ; if ( expression instanceof SpreadExpression ) { Expression spread = ( ( SpreadExpression ) expression ) . getExpression ( ) ; spread . visit ( this ) ; } else { if ( expression != null ) expression . visit ( this ) ; } } } public void visitCatchStatement ( CatchStatement statement ) { statement . getCode ( ) . visit ( this ) ; } public void visitArgumentlistExpression ( ArgumentListExpression ale ) { visitTupleExpression ( ale ) ; } public void visitClosureListExpression ( ClosureListExpression cle ) { visitListOfExpressions ( cle . getExpressions ( ) ) ; } public void visitBytecodeExpression ( BytecodeExpression cle ) { } } </s>
|
<s> package org . codehaus . groovy . ast ; public class GenericsType extends ASTNode { protected ClassNode [ ] upperBounds ; protected ClassNode lowerBound ; protected ClassNode type ; protected String name ; protected boolean placeholder ; private boolean resolved ; private boolean wildcard ; public GenericsType ( ClassNode type , ClassNode [ ] upperBounds , ClassNode lowerBound ) { this . type = type ; this . name = type . getName ( ) ; this . upperBounds = upperBounds ; this . lowerBound = lowerBound ; placeholder = false ; resolved = false ; } public GenericsType ( ) { } public GenericsType ( ClassNode basicType ) { this ( basicType , null , null ) ; } public ClassNode getType ( ) { return type ; } public void setType ( ClassNode type ) { this . type = type ; } public String toString ( ) { String ret = name ; if ( upperBounds != null ) { ret += "<STR_LIT>" ; for ( int i = <NUM_LIT:0> ; i < upperBounds . length ; i ++ ) { ret += upperBounds [ i ] . toString ( ) ; if ( i + <NUM_LIT:1> < upperBounds . length ) ret += "<STR_LIT>" ; } } else if ( lowerBound != null ) { ret += "<STR_LIT>" + lowerBound ; } return ret ; } public ClassNode [ ] getUpperBounds ( ) { return upperBounds ; } public String getName ( ) { return name ; } public boolean isPlaceholder ( ) { return placeholder ; } public void setPlaceholder ( boolean placeholder ) { this . placeholder = placeholder ; } public boolean isResolved ( ) { return resolved || placeholder ; } public void setResolved ( boolean res ) { resolved = res ; } public void setName ( String name ) { this . name = name ; } public boolean isWildcard ( ) { return wildcard ; } public void setWildcard ( boolean wildcard ) { this . wildcard = wildcard ; } public ClassNode getLowerBound ( ) { return lowerBound ; } public void setUpperBounds ( ClassNode [ ] bounds ) { this . upperBounds = bounds ; } public void setLowerBound ( ClassNode bound ) { this . lowerBound = bound ; } } </s>
|
<s> package org . codehaus . groovy . ast ; import java . util . ArrayList ; import java . util . Collections ; import java . util . Comparator ; import java . util . List ; import java . util . Map ; import java . util . SortedSet ; import java . util . TreeSet ; public class ImportNodeCompatibilityWrapper { private class ImportNodeComparator implements Comparator < ImportNode > { public int compare ( ImportNode i1 , ImportNode i2 ) { return i1 . getStart ( ) - i2 . getStart ( ) ; } } private SortedSet < ImportNode > sortedImports ; private ModuleNode module ; public ImportNodeCompatibilityWrapper ( ModuleNode module ) { if ( module == null ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } this . module = module ; } public SortedSet < ImportNode > getAllImportNodes ( ) { if ( sortedImports == null ) { initialize ( ) ; } return sortedImports ; } private void initialize ( ) { sortedImports = new TreeSet < ImportNode > ( new ImportNodeComparator ( ) ) ; sortedImports . addAll ( module . getImports ( ) ) ; } public static String getFieldName ( ImportNode node ) { return null ; } public static Map < String , ImportNode > getStaticImports ( ModuleNode node ) { return Collections . emptyMap ( ) ; } public static Map < String , ImportNode > getStaticStarImports ( ModuleNode node ) { return Collections . emptyMap ( ) ; } public static List < ImportNode > getStarImports ( ModuleNode node ) { List < String > importPackages = node . getImportPackages ( ) ; if ( importPackages != null ) { List < ImportNode > importPackageNodes = new ArrayList < ImportNode > ( importPackages . size ( ) ) ; for ( String importPackage : importPackages ) { ImportNode newImport = new ImportNode ( null , null ) ; newImport . setPackageName ( importPackage ) ; importPackageNodes . add ( newImport ) ; } return importPackageNodes ; } else { return Collections . emptyList ( ) ; } } } </s>
|
<s> package org . codehaus . groovy . ast ; public class TaskEntry { public int start ; private int end ; public String taskTag ; public String taskPriority ; public TaskEntry isAdjacentTo ; private String commentText ; private int offsetToStartOfCommentTextInFile ; public TaskEntry ( int startOffset , int endOffset , String taskTag , String taskPriority , String commentText , int offsetToStartOfCommentTextInFile ) { this . start = startOffset ; this . end = endOffset ; this . taskTag = taskTag ; this . taskPriority = taskPriority ; this . commentText = commentText ; this . offsetToStartOfCommentTextInFile = offsetToStartOfCommentTextInFile ; } public int getEnd ( ) { if ( isAdjacentTo != null ) { return isAdjacentTo . getEnd ( ) ; } return end ; } public void setEnd ( int end ) { this . end = end ; } public String getText ( ) { if ( isAdjacentTo != null ) { return isAdjacentTo . getText ( ) ; } else { int commentStartIndex = start - offsetToStartOfCommentTextInFile + taskTag . length ( ) ; int commentEndIndex = end - offsetToStartOfCommentTextInFile + <NUM_LIT:1> ; return commentText . substring ( commentStartIndex , commentEndIndex ) . trim ( ) ; } } public String toString ( ) { StringBuffer task = new StringBuffer ( ) ; task . append ( "<STR_LIT>" + taskTag + "<STR_LIT:[>" + getText ( ) + "<STR_LIT>" + start + "<STR_LIT>" + end + "<STR_LIT:(>" + getEnd ( ) + "<STR_LIT:)>" ) ; return task . toString ( ) ; } } </s>
|
<s> package org . codehaus . groovy . ast ; public class PackageNode extends AnnotatedNode { private final String packageName ; public PackageNode ( String packageName ) { this . packageName = packageName ; } public String getText ( ) { return "<STR_LIT>" + packageName ; } public String getPackageName ( ) { return packageName ; } public void visit ( GroovyCodeVisitor visitor ) { } } </s>
|
<s> package org . codehaus . groovy . ast ; import groovy . lang . Binding ; import org . codehaus . groovy . ast . expr . ArgumentListExpression ; import org . codehaus . groovy . ast . expr . ClassExpression ; import org . codehaus . groovy . ast . expr . MethodCallExpression ; import org . codehaus . groovy . ast . expr . VariableExpression ; import org . codehaus . groovy . ast . stmt . BlockStatement ; import org . codehaus . groovy . ast . stmt . ExpressionStatement ; import org . codehaus . groovy . ast . stmt . Statement ; import org . codehaus . groovy . control . SourceUnit ; import org . codehaus . groovy . runtime . InvokerHelper ; import org . objectweb . asm . Opcodes ; import java . io . File ; import java . util . * ; public class ModuleNode extends ASTNode implements Opcodes { private BlockStatement statementBlock = new BlockStatement ( ) ; List classes = new LinkedList ( ) ; private List methods = new ArrayList ( ) ; private List imports = new ArrayList ( ) ; private List importPackages = new ArrayList ( ) ; private Map importIndex = new HashMap ( ) ; private Map staticImportAliases = new HashMap ( ) ; private Map staticImportFields = new LinkedHashMap ( ) ; private Map staticImportClasses = new LinkedHashMap ( ) ; private CompileUnit unit ; private PackageNode packageNode ; private String description ; private boolean createClassForStatements = true ; private transient SourceUnit context ; private boolean importsResolved = false ; private static final String [ ] EMPTY_STRING_ARRAY = new String [ ] { } ; public ModuleNode ( SourceUnit context ) { this . context = context ; } public ModuleNode ( CompileUnit unit ) { this . unit = unit ; } public BlockStatement getStatementBlock ( ) { return statementBlock ; } public List getMethods ( ) { return methods ; } public List getClasses ( ) { if ( createClassForStatements && ( ! statementBlock . isEmpty ( ) || ! methods . isEmpty ( ) ) ) { ClassNode mainClass = createStatementsClass ( ) ; createClassForStatements = false ; classes . add ( <NUM_LIT:0> , mainClass ) ; mainClass . setModule ( this ) ; addToCompileUnit ( mainClass ) ; } return classes ; } private boolean encounteredUnrecoverableError ; public void setEncounteredUnrecoverableError ( boolean b ) { encounteredUnrecoverableError = b ; } public boolean encounteredUnrecoverableError ( ) { return encounteredUnrecoverableError ; } public List getImports ( ) { return imports ; } public List getImportPackages ( ) { return importPackages ; } public ClassNode getImport ( String alias ) { return ( ClassNode ) importIndex . get ( alias ) ; } public void addImport ( String alias , ClassNode type ) { ImportNode importNode = new ImportNode ( type , alias ) ; if ( type != null ) { importNode . setSourcePosition ( type ) ; importNode . setColumnNumber ( <NUM_LIT:1> ) ; importNode . setStart ( type . getStart ( ) - type . getColumnNumber ( ) + <NUM_LIT:1> ) ; } imports . add ( importNode ) ; importIndex . put ( alias , type ) ; } public String [ ] addImportPackage ( String packageName ) { importPackages . add ( packageName ) ; return EMPTY_STRING_ARRAY ; } public void addStatement ( Statement node ) { statementBlock . addStatement ( node ) ; } public void addClass ( ClassNode node ) { classes . add ( node ) ; node . setModule ( this ) ; addToCompileUnit ( node ) ; } private void addToCompileUnit ( ClassNode node ) { if ( unit != null ) { unit . addClass ( node ) ; } } public void addMethod ( MethodNode node ) { methods . add ( node ) ; } public void visit ( GroovyCodeVisitor visitor ) { } public String getPackageName ( ) { return packageNode == null ? null : packageNode . getPackageName ( ) ; } public PackageNode getPackage ( ) { return packageNode ; } public void setPackage ( PackageNode packageNode ) { this . packageNode = packageNode ; } public void setPackageName ( String packageName ) { this . packageNode = new PackageNode ( packageName ) ; } public boolean hasPackageName ( ) { return packageNode != null && packageNode . getPackageName ( ) != null ; } public boolean hasPackage ( ) { return this . packageNode != null ; } public SourceUnit getContext ( ) { return context ; } public String getDescription ( ) { if ( context != null ) { return context . getName ( ) ; } else { return this . description ; } } public void setDescription ( String description ) { this . description = description ; } public CompileUnit getUnit ( ) { return unit ; } void setUnit ( CompileUnit unit ) { this . unit = unit ; } protected ClassNode createStatementsClass ( ) { String name = getPackageName ( ) ; if ( name == null ) { name = "<STR_LIT>" ; } if ( getDescription ( ) == null ) { throw new RuntimeException ( "<STR_LIT>" ) ; } name += extractClassFromFileDescription ( ) ; String baseClassName = null ; if ( unit != null ) baseClassName = unit . getConfig ( ) . getScriptBaseClass ( ) ; ClassNode baseClass = null ; if ( baseClassName != null ) { baseClass = ClassHelper . make ( baseClassName ) ; } if ( baseClass == null ) { baseClass = ClassHelper . SCRIPT_TYPE ; } ClassNode classNode = new ClassNode ( name , ACC_PUBLIC , baseClass ) ; classNode . setScript ( true ) ; classNode . setScriptBody ( true ) ; handleMainMethodIfPresent ( methods ) ; classNode . addMethod ( new MethodNode ( "<STR_LIT>" , ACC_PUBLIC | ACC_STATIC , ClassHelper . VOID_TYPE , new Parameter [ ] { new Parameter ( ClassHelper . STRING_TYPE . makeArray ( ) , "<STR_LIT>" ) } , ClassNode . EMPTY_ARRAY , new ExpressionStatement ( new MethodCallExpression ( new ClassExpression ( ClassHelper . make ( InvokerHelper . class ) ) , "<STR_LIT>" , new ArgumentListExpression ( new ClassExpression ( classNode ) , new VariableExpression ( "<STR_LIT>" ) ) ) ) ) ) ; classNode . addMethod ( new MethodNode ( "<STR_LIT>" , ACC_PUBLIC , ClassHelper . OBJECT_TYPE , Parameter . EMPTY_ARRAY , ClassNode . EMPTY_ARRAY , statementBlock ) ) ; classNode . addConstructor ( ACC_PUBLIC , Parameter . EMPTY_ARRAY , ClassNode . EMPTY_ARRAY , new BlockStatement ( ) ) ; Statement stmt = new ExpressionStatement ( new MethodCallExpression ( new VariableExpression ( "<STR_LIT>" ) , "<STR_LIT>" , new ArgumentListExpression ( new VariableExpression ( "<STR_LIT>" ) ) ) ) ; classNode . addConstructor ( ACC_PUBLIC , new Parameter [ ] { new Parameter ( ClassHelper . make ( Binding . class ) , "<STR_LIT>" ) } , ClassNode . EMPTY_ARRAY , stmt ) ; for ( Iterator iter = methods . iterator ( ) ; iter . hasNext ( ) ; ) { MethodNode node = ( MethodNode ) iter . next ( ) ; int modifiers = node . getModifiers ( ) ; if ( ( modifiers & ACC_ABSTRACT ) != <NUM_LIT:0> ) { throw new RuntimeException ( "<STR_LIT>" + node . getName ( ) ) ; } node . setModifiers ( modifiers ) ; classNode . addMethod ( node ) ; } return classNode ; } private void handleMainMethodIfPresent ( List methods ) { for ( Iterator iter = methods . iterator ( ) ; iter . hasNext ( ) ; ) { MethodNode node = ( MethodNode ) iter . next ( ) ; if ( node . getName ( ) . equals ( "<STR_LIT>" ) ) { int modifiers = node . getModifiers ( ) ; if ( node . isStatic ( ) && node . getParameters ( ) . length == <NUM_LIT:1> ) { boolean retTypeMatches , argTypeMatches ; ClassNode argType = node . getParameters ( ) [ <NUM_LIT:0> ] . getType ( ) ; ClassNode retType = node . getReturnType ( ) ; argTypeMatches = ( argType . equals ( ClassHelper . OBJECT_TYPE ) || argType . getName ( ) . contains ( "<STR_LIT>" ) ) ; retTypeMatches = ( retType == ClassHelper . VOID_TYPE || retType == ClassHelper . OBJECT_TYPE ) ; if ( retTypeMatches && argTypeMatches ) { if ( statementBlock . isEmpty ( ) ) { addStatement ( node . getCode ( ) ) ; } iter . remove ( ) ; } } } } } protected String extractClassFromFileDescription ( ) { String answer = getDescription ( ) ; int slashIdx = answer . lastIndexOf ( '<CHAR_LIT:/>' ) ; int separatorIdx = answer . lastIndexOf ( File . separatorChar ) ; int dotIdx = answer . lastIndexOf ( '<CHAR_LIT:.>' ) ; if ( dotIdx > <NUM_LIT:0> && dotIdx > Math . max ( slashIdx , separatorIdx ) ) { answer = answer . substring ( <NUM_LIT:0> , dotIdx ) ; } if ( slashIdx >= <NUM_LIT:0> ) { answer = answer . substring ( slashIdx + <NUM_LIT:1> ) ; } separatorIdx = answer . lastIndexOf ( File . separatorChar ) ; if ( separatorIdx >= <NUM_LIT:0> ) { answer = answer . substring ( separatorIdx + <NUM_LIT:1> ) ; } return answer ; } public boolean isEmpty ( ) { return classes . isEmpty ( ) && statementBlock . getStatements ( ) . isEmpty ( ) ; } public void sortClasses ( ) { if ( isEmpty ( ) ) return ; List classes = getClasses ( ) ; LinkedList sorted = new LinkedList ( ) ; int level = <NUM_LIT:1> ; while ( ! classes . isEmpty ( ) ) { for ( Iterator cni = classes . iterator ( ) ; cni . hasNext ( ) ; ) { ClassNode cn = ( ClassNode ) cni . next ( ) ; ClassNode sn = cn ; for ( int i = <NUM_LIT:0> ; sn != null && i < level ; i ++ ) sn = sn . getSuperClass ( ) ; if ( sn != null && sn . isPrimaryClassNode ( ) ) continue ; cni . remove ( ) ; sorted . addLast ( cn ) ; } level ++ ; } this . classes = sorted ; } public boolean hasImportsResolved ( ) { return importsResolved ; } public void setImportsResolved ( boolean importsResolved ) { this . importsResolved = importsResolved ; } public Map getStaticImportAliases ( ) { return staticImportAliases ; } public Map getStaticImportClasses ( ) { return staticImportClasses ; } public Map getStaticImportFields ( ) { return staticImportFields ; } public void addStaticMethodOrField ( ClassNode type , String fieldName , String alias ) { staticImportAliases . put ( alias , type ) ; staticImportFields . put ( alias , fieldName ) ; } public void addStaticImportClass ( String name , ClassNode type ) { staticImportClasses . put ( name , type ) ; } } </s>
|
<s> package org . codehaus . groovy . ast ; import java . util . Collections ; import java . util . Iterator ; import java . util . List ; import org . objectweb . asm . Opcodes ; public class ASTNodeCompatibilityWrapper { private ASTNodeCompatibilityWrapper ( ) { } public static ClassNode getScriptClassDummy ( ModuleNode module ) { List < ClassNode > classes = module . getClasses ( ) ; if ( classes != null && classes . size ( ) > <NUM_LIT:0> ) { return classes . get ( <NUM_LIT:0> ) ; } else { return new ClassNode ( "<STR_LIT>" , Opcodes . ACC_PUBLIC , ClassHelper . OBJECT_TYPE ) ; } } public static Iterator < InnerClassNode > getInnerClasses ( ClassNode clazz ) { List < InnerClassNode > l = Collections . emptyList ( ) ; return l . iterator ( ) ; } } </s>
|
<s> package org . codehaus . groovy . ast ; import groovy . lang . * ; import org . codehaus . groovy . runtime . GeneratedClosure ; import org . codehaus . groovy . vmplugin . VMPluginFactory ; import org . objectweb . asm . Opcodes ; import java . math . BigDecimal ; import java . math . BigInteger ; import java . util . List ; import java . util . Map ; import java . util . regex . Pattern ; public class ClassHelper { public static final Class [ ] classes = new Class [ ] { Object . class , Boolean . TYPE , Character . TYPE , Byte . TYPE , Short . TYPE , Integer . TYPE , Long . TYPE , Double . TYPE , Float . TYPE , Void . TYPE , Closure . class , GString . class , List . class , Map . class , Range . class , Pattern . class , Script . class , String . class , Boolean . class , Character . class , Byte . class , Short . class , Integer . class , Long . class , Double . class , Float . class , BigDecimal . class , BigInteger . class , Void . class , Reference . class , Class . class , MetaClass . class , } ; private static final String [ ] primitiveClassNames = new String [ ] { "<STR_LIT>" , "<STR_LIT:boolean>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT:int>" , "<STR_LIT:long>" , "<STR_LIT:double>" , "<STR_LIT:float>" , "<STR_LIT>" } ; public static final ClassNode DYNAMIC_TYPE = new ClassNode ( Object . class ) , OBJECT_TYPE = DYNAMIC_TYPE , VOID_TYPE = new ClassNode ( Void . TYPE ) , CLOSURE_TYPE = new ClassNode ( Closure . class ) , GSTRING_TYPE = new ClassNode ( GString . class ) , LIST_TYPE = makeWithoutCaching ( List . class ) , MAP_TYPE = makeWithoutCaching ( Map . class ) , RANGE_TYPE = new ClassNode ( Range . class ) , PATTERN_TYPE = new ClassNode ( Pattern . class ) , STRING_TYPE = new ClassNode ( String . class ) , SCRIPT_TYPE = new ClassNode ( Script . class ) , REFERENCE_TYPE = makeWithoutCaching ( Reference . class ) , boolean_TYPE = new ClassNode ( boolean . class ) , char_TYPE = new ClassNode ( char . class ) , byte_TYPE = new ClassNode ( byte . class ) , int_TYPE = new ClassNode ( int . class ) , long_TYPE = new ClassNode ( long . class ) , short_TYPE = new ClassNode ( short . class ) , double_TYPE = new ClassNode ( double . class ) , float_TYPE = new ClassNode ( float . class ) , Byte_TYPE = new ClassNode ( Byte . class ) , Short_TYPE = new ClassNode ( Short . class ) , Integer_TYPE = new ClassNode ( Integer . class ) , Long_TYPE = new ClassNode ( Long . class ) , Character_TYPE = new ClassNode ( Character . class ) , Float_TYPE = new ClassNode ( Float . class ) , Double_TYPE = new ClassNode ( Double . class ) , Boolean_TYPE = new ClassNode ( Boolean . class ) , BigInteger_TYPE = new ClassNode ( java . math . BigInteger . class ) , BigDecimal_TYPE = new ClassNode ( java . math . BigDecimal . class ) , void_WRAPPER_TYPE = new ClassNode ( Void . class ) , CLASS_Type = makeWithoutCaching ( Class . class ) , METACLASS_TYPE = new ClassNode ( MetaClass . class ) , GENERATED_CLOSURE_Type = new ClassNode ( GeneratedClosure . class ) , Enum_Type = new ClassNode ( "<STR_LIT>" , <NUM_LIT:0> , OBJECT_TYPE ) , Annotation_TYPE = new ClassNode ( "<STR_LIT>" , <NUM_LIT:0> , OBJECT_TYPE ) , ELEMENT_TYPE_TYPE = new ClassNode ( "<STR_LIT>" , <NUM_LIT:0> , Enum_Type ) ; static { Enum_Type . isPrimaryNode = false ; Annotation_TYPE . isPrimaryNode = false ; } private static ClassNode [ ] types = new ClassNode [ ] { OBJECT_TYPE , boolean_TYPE , char_TYPE , byte_TYPE , short_TYPE , int_TYPE , long_TYPE , double_TYPE , float_TYPE , VOID_TYPE , CLOSURE_TYPE , GSTRING_TYPE , LIST_TYPE , MAP_TYPE , RANGE_TYPE , PATTERN_TYPE , SCRIPT_TYPE , STRING_TYPE , Boolean_TYPE , Character_TYPE , Byte_TYPE , Short_TYPE , Integer_TYPE , Long_TYPE , Double_TYPE , Float_TYPE , BigDecimal_TYPE , BigInteger_TYPE , void_WRAPPER_TYPE , REFERENCE_TYPE , CLASS_Type , METACLASS_TYPE , GENERATED_CLOSURE_Type , Enum_Type , Annotation_TYPE } ; private static ClassNode [ ] numbers = new ClassNode [ ] { char_TYPE , byte_TYPE , short_TYPE , int_TYPE , long_TYPE , double_TYPE , float_TYPE , Short_TYPE , Byte_TYPE , Character_TYPE , Integer_TYPE , Float_TYPE , Long_TYPE , Double_TYPE , BigInteger_TYPE , BigDecimal_TYPE } ; protected static final ClassNode [ ] EMPTY_TYPE_ARRAY = { } ; public static final String OBJECT = "<STR_LIT>" ; public static ClassNode [ ] make ( Class [ ] classes ) { ClassNode [ ] cns = new ClassNode [ classes . length ] ; for ( int i = <NUM_LIT:0> ; i < cns . length ; i ++ ) { cns [ i ] = make ( classes [ i ] ) ; } return cns ; } public static ClassNode make ( Class c ) { return make ( c , true ) ; } public static ClassNode make ( Class c , boolean includeGenerics ) { for ( int i = <NUM_LIT:0> ; i < classes . length ; i ++ ) { if ( c == classes [ i ] ) return types [ i ] ; } if ( c . isArray ( ) ) { ClassNode cn = make ( c . getComponentType ( ) , includeGenerics ) ; return cn . makeArray ( ) ; } return makeWithoutCaching ( c , includeGenerics ) ; } public static ClassNode makeWithoutCaching ( Class c ) { return makeWithoutCaching ( c , true ) ; } public static ClassNode makeWithoutCaching ( Class c , boolean includeGenerics ) { ClassNode t = new ClassNode ( c ) ; if ( includeGenerics ) VMPluginFactory . getPlugin ( ) . setAdditionalClassInformation ( t ) ; return t ; } public static ClassNode makeWithoutCaching ( String name ) { ClassNode cn = new ClassNode ( name , Opcodes . ACC_PUBLIC , OBJECT_TYPE ) ; cn . isPrimaryNode = false ; return cn ; } public static ClassNode make ( String name ) { if ( name == null || name . length ( ) == <NUM_LIT:0> ) return DYNAMIC_TYPE ; for ( int i = <NUM_LIT:0> ; i < primitiveClassNames . length ; i ++ ) { if ( primitiveClassNames [ i ] . equals ( name ) ) return types [ i ] ; } for ( int i = <NUM_LIT:0> ; i < classes . length ; i ++ ) { String cname = classes [ i ] . getName ( ) ; if ( name . equals ( cname ) ) return types [ i ] ; } return makeWithoutCaching ( name ) ; } public static ClassNode getWrapper ( ClassNode cn ) { cn = cn . redirect ( ) ; if ( ! isPrimitiveType ( cn ) ) return cn ; if ( cn == boolean_TYPE ) { return Boolean_TYPE ; } else if ( cn == byte_TYPE ) { return Byte_TYPE ; } else if ( cn == char_TYPE ) { return Character_TYPE ; } else if ( cn == short_TYPE ) { return Short_TYPE ; } else if ( cn == int_TYPE ) { return Integer_TYPE ; } else if ( cn == long_TYPE ) { return Long_TYPE ; } else if ( cn == float_TYPE ) { return Float_TYPE ; } else if ( cn == double_TYPE ) { return Double_TYPE ; } else if ( cn == VOID_TYPE ) { return void_WRAPPER_TYPE ; } else { return cn ; } } public static ClassNode getUnwrapper ( ClassNode cn ) { cn = cn . redirect ( ) ; if ( isPrimitiveType ( cn ) ) return cn ; if ( cn == Boolean_TYPE ) { return boolean_TYPE ; } else if ( cn == Byte_TYPE ) { return byte_TYPE ; } else if ( cn == Character_TYPE ) { return char_TYPE ; } else if ( cn == Short_TYPE ) { return short_TYPE ; } else if ( cn == Integer_TYPE ) { return int_TYPE ; } else if ( cn == Long_TYPE ) { return long_TYPE ; } else if ( cn == Float_TYPE ) { return float_TYPE ; } else if ( cn == Double_TYPE ) { return double_TYPE ; } else { return cn ; } } public static boolean isPrimitiveType ( ClassNode cn ) { return cn == boolean_TYPE || cn == char_TYPE || cn == byte_TYPE || cn == short_TYPE || cn == int_TYPE || cn == long_TYPE || cn == float_TYPE || cn == double_TYPE || cn == VOID_TYPE ; } public static boolean isNumberType ( ClassNode cn ) { return cn == Byte_TYPE || cn == Short_TYPE || cn == Integer_TYPE || cn == Long_TYPE || cn == Float_TYPE || cn == Double_TYPE || cn == byte_TYPE || cn == short_TYPE || cn == int_TYPE || cn == long_TYPE || cn == float_TYPE || cn == double_TYPE ; } public static ClassNode makeReference ( ) { return make ( Reference . class ) ; } public static boolean isCachedType ( ClassNode type ) { for ( int i = <NUM_LIT:0> ; i < types . length ; i ++ ) { if ( types [ i ] == type ) return true ; } return false ; } } </s>
|
<s> package org . codehaus . groovy . ast ; import java . util . Collections ; import java . util . HashMap ; import java . util . Iterator ; import java . util . Map ; public class VariableScope { private Map declaredVariables = Collections . EMPTY_MAP ; private Map referencedLocalVariables = Collections . EMPTY_MAP ; private Map referencedClassVariables = Collections . EMPTY_MAP ; private boolean inStaticContext = false ; private boolean resolvesDynamic = false ; private ClassNode clazzScope ; private VariableScope parent ; public VariableScope ( ) { } public VariableScope ( VariableScope parent ) { this . parent = parent ; } public Variable getDeclaredVariable ( String name ) { return ( Variable ) declaredVariables . get ( name ) ; } public Iterator < Variable > getDeclaredVariablesIterator ( ) { return declaredVariables . values ( ) . iterator ( ) ; } public boolean isReferencedLocalVariable ( String name ) { return referencedLocalVariables . containsKey ( name ) ; } public boolean isReferencedClassVariable ( String name ) { return referencedClassVariables . containsKey ( name ) ; } public VariableScope getParent ( ) { return parent ; } public boolean isInStaticContext ( ) { return inStaticContext ; } public void setInStaticContext ( boolean inStaticContext ) { this . inStaticContext = inStaticContext ; } public boolean isResolvingDynamic ( ) { return resolvesDynamic ; } public void setDynamicResolving ( boolean resolvesDynamic ) { this . resolvesDynamic = resolvesDynamic ; } public void setClassScope ( ClassNode node ) { this . clazzScope = node ; } public ClassNode getClassScope ( ) { return clazzScope ; } public boolean isClassScope ( ) { return clazzScope != null ; } public boolean isRoot ( ) { return parent == null ; } public VariableScope copy ( ) { VariableScope copy = new VariableScope ( ) ; copy . clazzScope = clazzScope ; if ( declaredVariables . size ( ) > <NUM_LIT:0> ) { copy . declaredVariables = new HashMap ( ) ; copy . declaredVariables . putAll ( declaredVariables ) ; } copy . inStaticContext = inStaticContext ; copy . parent = parent ; if ( referencedClassVariables . size ( ) > <NUM_LIT:0> ) { copy . referencedClassVariables = new HashMap ( ) ; copy . referencedClassVariables . putAll ( referencedClassVariables ) ; } if ( referencedLocalVariables . size ( ) > <NUM_LIT:0> ) { copy . referencedLocalVariables = new HashMap ( ) ; copy . referencedLocalVariables . putAll ( referencedLocalVariables ) ; } copy . resolvesDynamic = resolvesDynamic ; return copy ; } public void putDeclaredVariable ( Variable var ) { if ( declaredVariables == Collections . EMPTY_MAP ) declaredVariables = new HashMap ( ) ; declaredVariables . put ( var . getName ( ) , var ) ; } public Iterator getReferencedLocalVariablesIterator ( ) { return referencedLocalVariables . values ( ) . iterator ( ) ; } public int getReferencedLocalVariablesCount ( ) { return referencedLocalVariables . size ( ) ; } public Variable getReferencedLocalVariable ( String name ) { return ( Variable ) referencedLocalVariables . get ( name ) ; } public void putReferencedLocalVariable ( Variable var ) { if ( referencedLocalVariables == Collections . EMPTY_MAP ) referencedLocalVariables = new HashMap ( ) ; referencedLocalVariables . put ( var . getName ( ) , var ) ; } public void putReferencedClassVariable ( Variable var ) { if ( referencedClassVariables == Collections . EMPTY_MAP ) referencedClassVariables = new HashMap ( ) ; referencedClassVariables . put ( var . getName ( ) , var ) ; } public Variable getReferencedClassVariable ( String name ) { return ( Variable ) referencedClassVariables . get ( name ) ; } public Object removeReferencedClassVariable ( String name ) { if ( referencedClassVariables == Collections . EMPTY_MAP ) return null ; else return referencedClassVariables . remove ( name ) ; } public Map getReferencedClassVariables ( ) { if ( referencedClassVariables == Collections . EMPTY_MAP ) { return Collections . EMPTY_MAP ; } else { return Collections . unmodifiableMap ( referencedClassVariables ) ; } } public Iterator getReferencedClassVariablesIterator ( ) { return getReferencedClassVariables ( ) . values ( ) . iterator ( ) ; } } </s>
|
<s> package org . codehaus . groovy . ast ; import java . util . Iterator ; import java . util . List ; import java . util . Map ; import org . codehaus . groovy . ast . expr . Expression ; import org . codehaus . groovy . ast . expr . VariableExpression ; import org . codehaus . groovy . ast . stmt . AssertStatement ; import org . codehaus . groovy . ast . stmt . BlockStatement ; import org . codehaus . groovy . ast . stmt . BreakStatement ; import org . codehaus . groovy . ast . stmt . CaseStatement ; import org . codehaus . groovy . ast . stmt . CatchStatement ; import org . codehaus . groovy . ast . stmt . ContinueStatement ; import org . codehaus . groovy . ast . stmt . DoWhileStatement ; import org . codehaus . groovy . ast . stmt . ExpressionStatement ; import org . codehaus . groovy . ast . stmt . ForStatement ; import org . codehaus . groovy . ast . stmt . IfStatement ; import org . codehaus . groovy . ast . stmt . ReturnStatement ; import org . codehaus . groovy . ast . stmt . Statement ; import org . codehaus . groovy . ast . stmt . SwitchStatement ; import org . codehaus . groovy . ast . stmt . SynchronizedStatement ; import org . codehaus . groovy . ast . stmt . ThrowStatement ; import org . codehaus . groovy . ast . stmt . TryCatchStatement ; import org . codehaus . groovy . ast . stmt . WhileStatement ; import org . codehaus . groovy . control . SourceUnit ; import org . codehaus . groovy . control . messages . SyntaxErrorMessage ; import org . codehaus . groovy . syntax . SyntaxException ; import org . codehaus . groovy . syntax . PreciseSyntaxException ; public abstract class ClassCodeVisitorSupport extends CodeVisitorSupport implements GroovyClassVisitor { public void visitClass ( ClassNode node ) { visitAnnotations ( node ) ; node . visitContents ( this ) ; List list = node . getObjectInitializerStatements ( ) ; for ( Iterator iter = list . iterator ( ) ; iter . hasNext ( ) ; ) { Statement element = ( Statement ) iter . next ( ) ; element . visit ( this ) ; } } public void visitAnnotations ( AnnotatedNode node ) { List annotations = node . getAnnotations ( ) ; if ( annotations . isEmpty ( ) ) return ; Iterator it = annotations . iterator ( ) ; while ( it . hasNext ( ) ) { AnnotationNode an = ( AnnotationNode ) it . next ( ) ; if ( an . isBuiltIn ( ) ) continue ; for ( Iterator iter = an . getMembers ( ) . entrySet ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { Map . Entry member = ( Map . Entry ) iter . next ( ) ; Expression memberValue = ( Expression ) member . getValue ( ) ; memberValue . visit ( this ) ; } } } protected void visitClassCodeContainer ( Statement code ) { if ( code != null ) code . visit ( this ) ; } protected void visitConstructorOrMethod ( MethodNode node , boolean isConstructor ) { visitAnnotations ( node ) ; Statement code = node . getCode ( ) ; visitClassCodeContainer ( code ) ; } public void visitConstructor ( ConstructorNode node ) { visitConstructorOrMethod ( node , true ) ; } public void visitMethod ( MethodNode node ) { visitConstructorOrMethod ( node , false ) ; } public void visitField ( FieldNode node ) { visitAnnotations ( node ) ; Expression init = node . getInitialExpression ( ) ; if ( init != null ) init . visit ( this ) ; } public void visitProperty ( PropertyNode node ) { visitAnnotations ( node ) ; Statement statement = node . getGetterBlock ( ) ; visitClassCodeContainer ( statement ) ; statement = node . getSetterBlock ( ) ; visitClassCodeContainer ( statement ) ; Expression init = node . getInitialExpression ( ) ; if ( init != null ) init . visit ( this ) ; } protected void addError ( String msg , ASTNode expr ) { int line = expr . getLineNumber ( ) ; int col = expr . getColumnNumber ( ) ; SourceUnit source = getSourceUnit ( ) ; source . getErrorCollector ( ) . addErrorAndContinue ( new SyntaxErrorMessage ( new SyntaxException ( msg + '<STR_LIT:\n>' , line , col ) , source ) ) ; } protected void addTypeError ( String msg , ClassNode expr ) { int line = expr . getLineNumber ( ) ; int col = expr . getColumnNumber ( ) ; SourceUnit source = getSourceUnit ( ) ; source . getErrorCollector ( ) . addErrorAndContinue ( new SyntaxErrorMessage ( new PreciseSyntaxException ( msg + '<STR_LIT:\n>' , line , col , expr . getNameStart ( ) , expr . getNameEnd ( ) ) , source ) ) ; } protected abstract SourceUnit getSourceUnit ( ) ; protected void visitStatement ( Statement statement ) { } public void visitAssertStatement ( AssertStatement statement ) { visitStatement ( statement ) ; super . visitAssertStatement ( statement ) ; } public void visitBlockStatement ( BlockStatement block ) { visitStatement ( block ) ; super . visitBlockStatement ( block ) ; } public void visitBreakStatement ( BreakStatement statement ) { visitStatement ( statement ) ; super . visitBreakStatement ( statement ) ; } public void visitCaseStatement ( CaseStatement statement ) { visitStatement ( statement ) ; super . visitCaseStatement ( statement ) ; } public void visitCatchStatement ( CatchStatement statement ) { visitStatement ( statement ) ; super . visitCatchStatement ( statement ) ; } public void visitContinueStatement ( ContinueStatement statement ) { visitStatement ( statement ) ; super . visitContinueStatement ( statement ) ; } public void visitDoWhileLoop ( DoWhileStatement loop ) { visitStatement ( loop ) ; super . visitDoWhileLoop ( loop ) ; } public void visitExpressionStatement ( ExpressionStatement statement ) { visitStatement ( statement ) ; super . visitExpressionStatement ( statement ) ; } public void visitForLoop ( ForStatement forLoop ) { visitStatement ( forLoop ) ; super . visitForLoop ( forLoop ) ; } public void visitIfElse ( IfStatement ifElse ) { visitStatement ( ifElse ) ; super . visitIfElse ( ifElse ) ; } public void visitReturnStatement ( ReturnStatement statement ) { visitStatement ( statement ) ; super . visitReturnStatement ( statement ) ; } public void visitSwitch ( SwitchStatement statement ) { visitStatement ( statement ) ; super . visitSwitch ( statement ) ; } public void visitSynchronizedStatement ( SynchronizedStatement statement ) { visitStatement ( statement ) ; super . visitSynchronizedStatement ( statement ) ; } public void visitThrowStatement ( ThrowStatement statement ) { visitStatement ( statement ) ; super . visitThrowStatement ( statement ) ; } public void visitTryCatchFinally ( TryCatchStatement statement ) { visitStatement ( statement ) ; super . visitTryCatchFinally ( statement ) ; } public void visitWhileLoop ( WhileStatement loop ) { visitStatement ( loop ) ; super . visitWhileLoop ( loop ) ; } } </s>
|
<s> package org . codehaus . groovy . ast ; import java . util . * ; public class AnnotatedNode extends ASTNode { private List annotations = Collections . EMPTY_LIST ; private boolean synthetic ; ClassNode declaringClass ; private int nameEnd ; private int nameStart ; public AnnotatedNode ( ) { } public List getAnnotations ( ) { return annotations ; } public List getAnnotations ( ClassNode type ) { List ret = new ArrayList ( annotations . size ( ) ) ; for ( Iterator it = annotations . iterator ( ) ; it . hasNext ( ) ; ) { AnnotationNode node = ( AnnotationNode ) it . next ( ) ; if ( type . equals ( node . getClassNode ( ) ) ) ret . add ( node ) ; } return ret ; } public void addAnnotation ( AnnotationNode value ) { checkInit ( ) ; annotations . add ( value ) ; } private void checkInit ( ) { if ( annotations == Collections . EMPTY_LIST ) annotations = new ArrayList ( <NUM_LIT:3> ) ; } public void addAnnotations ( List annotations ) { for ( Iterator iter = annotations . iterator ( ) ; iter . hasNext ( ) ; ) { AnnotationNode node = ( AnnotationNode ) iter . next ( ) ; addAnnotation ( node ) ; } } public boolean isSynthetic ( ) { return synthetic ; } public void setSynthetic ( boolean synthetic ) { this . synthetic = synthetic ; } public ClassNode getDeclaringClass ( ) { return declaringClass ; } public void setDeclaringClass ( ClassNode declaringClass ) { this . declaringClass = declaringClass ; } public int getNameStart ( ) { return nameStart ; } public void setNameStart ( int nameStart ) { this . nameStart = nameStart ; } public int getNameEnd ( ) { return nameEnd ; } public void setNameEnd ( int nameEnd ) { this . nameEnd = nameEnd ; } } </s>
|
<s> package org . codehaus . groovy . ast ; import groovy . lang . GroovyObject ; import java . lang . reflect . Array ; import java . lang . reflect . Modifier ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . EnumMap ; import java . util . HashMap ; import java . util . HashSet ; import java . util . Iterator ; import java . util . LinkedHashSet ; import java . util . LinkedList ; import java . util . List ; import java . util . ListIterator ; import java . util . Map ; import java . util . Set ; import org . codehaus . groovy . GroovyBugError ; import org . codehaus . groovy . ast . expr . BinaryExpression ; import org . codehaus . groovy . ast . expr . ClassExpression ; import org . codehaus . groovy . ast . expr . Expression ; import org . codehaus . groovy . ast . expr . FieldExpression ; import org . codehaus . groovy . ast . expr . MapExpression ; import org . codehaus . groovy . ast . expr . TupleExpression ; import org . codehaus . groovy . ast . stmt . BlockStatement ; import org . codehaus . groovy . ast . stmt . ExpressionStatement ; import org . codehaus . groovy . ast . stmt . Statement ; import org . codehaus . groovy . control . CompilePhase ; import org . codehaus . groovy . transform . ASTTransformation ; import org . codehaus . groovy . transform . GroovyASTTransformation ; import org . codehaus . groovy . vmplugin . VMPluginFactory ; import org . objectweb . asm . Opcodes ; public class ClassNode extends AnnotatedNode implements Opcodes { private static class MapOfLists { private Map map = new HashMap ( ) ; public List get ( Object key ) { return ( List ) map . get ( key ) ; } public List getNotNull ( Object key ) { List ret = get ( key ) ; if ( ret == null ) ret = Collections . EMPTY_LIST ; return ret ; } public void put ( Object key , Object value ) { if ( map . containsKey ( key ) ) { get ( key ) . add ( value ) ; } else { ArrayList list = new ArrayList ( <NUM_LIT:2> ) ; list . add ( value ) ; map . put ( key , list ) ; } } } public static ClassNode [ ] EMPTY_ARRAY = new ClassNode [ <NUM_LIT:0> ] ; public static ClassNode THIS = new ClassNode ( Object . class ) ; public static ClassNode SUPER = new ClassNode ( Object . class ) ; private String name ; private int modifiers ; private ClassNode [ ] interfaces ; private MixinNode [ ] mixins ; private List constructors ; private List objectInitializers ; private MapOfLists methods ; private List < MethodNode > methodsList ; private LinkedList < FieldNode > fields ; private List properties ; private Map fieldIndex ; private ModuleNode module ; private CompileUnit compileUnit ; private boolean staticClass = false ; private boolean scriptBody = false ; private boolean script ; private ClassNode superClass ; protected boolean isPrimaryNode ; private Map < CompilePhase , Map < Class < ? extends ASTTransformation > , Set < ASTNode > > > transformInstances ; protected Object lazyInitLock = new Object ( ) ; protected Class clazz ; protected boolean lazyInitDone = true ; protected ClassNode componentType = null ; private ClassNode redirect = null ; private boolean annotated ; private GenericsType [ ] genericsTypes = null ; private boolean usesGenerics = false ; private boolean placeholder ; public ClassNode redirect ( ) { ClassNode res = this ; while ( res . redirect != null ) res = res . redirect ; return res ; } public void setRedirect ( ClassNode cn ) { if ( isPrimaryNode ) throw new GroovyBugError ( "<STR_LIT>" + getName ( ) + "<STR_LIT>" + cn . getName ( ) + "<STR_LIT>" ) ; if ( cn != null ) cn = cn . redirect ( ) ; if ( cn == this ) return ; redirect = cn ; } public ClassNode makeArray ( ) { if ( redirect != null ) return redirect ( ) . makeArray ( ) ; ClassNode cn ; if ( clazz != null ) { Class ret = Array . newInstance ( clazz , <NUM_LIT:0> ) . getClass ( ) ; cn = new ClassNode ( ret , this ) ; } else { cn = new ClassNode ( this ) ; } return cn ; } public boolean isPrimaryClassNode ( ) { return redirect ( ) . isPrimaryNode || ( componentType != null && componentType . isPrimaryClassNode ( ) ) ; } public ClassNode ( ClassNode componentType ) { this ( "<STR_LIT:[>" + getTheNameMightBeArray ( componentType ) , ACC_PUBLIC , ClassHelper . OBJECT_TYPE ) ; this . componentType = componentType . redirect ( ) ; isPrimaryNode = false ; } public static String getTheNameMightBeArray ( ClassNode componentType ) { String n = componentType . getName ( ) ; if ( componentType . isArray ( ) || n . length ( ) == <NUM_LIT:1> ) { return componentType . getName ( ) ; } else { if ( Character . isLowerCase ( n . charAt ( <NUM_LIT:0> ) ) ) { if ( n . equals ( "<STR_LIT:int>" ) ) { return "<STR_LIT:I>" ; } else if ( n . equals ( "<STR_LIT:long>" ) ) { return "<STR_LIT>" ; } else if ( n . equals ( "<STR_LIT>" ) ) { return "<STR_LIT:S>" ; } else if ( n . equals ( "<STR_LIT:boolean>" ) ) { return "<STR_LIT:Z>" ; } else if ( n . equals ( "<STR_LIT>" ) ) { return "<STR_LIT:C>" ; } else if ( n . equals ( "<STR_LIT>" ) ) { return "<STR_LIT:B>" ; } else if ( n . equals ( "<STR_LIT:float>" ) ) { return "<STR_LIT:F>" ; } else if ( n . equals ( "<STR_LIT:double>" ) ) { return "<STR_LIT:D>" ; } } return "<STR_LIT>" + componentType . getName ( ) + "<STR_LIT:;>" ; } } private ClassNode ( Class c , ClassNode componentType ) { this ( c ) ; this . componentType = componentType ; isPrimaryNode = false ; } public ClassNode ( Class c ) { this ( c . getName ( ) , c . getModifiers ( ) , null , null , MixinNode . EMPTY_ARRAY ) ; clazz = c ; lazyInitDone = false ; CompileUnit cu = getCompileUnit ( ) ; if ( cu != null ) cu . addClass ( this ) ; isPrimaryNode = false ; } protected void lazyClassInit ( ) { synchronized ( lazyInitLock ) { if ( redirect != null ) { throw new GroovyBugError ( "<STR_LIT>" + "<STR_LIT>" ) ; } if ( lazyInitDone ) return ; VMPluginFactory . getPlugin ( ) . configureClassNode ( compileUnit , this ) ; lazyInitDone = true ; } } private MethodNode enclosingMethod = null ; public MethodNode getEnclosingMethod ( ) { return redirect ( ) . enclosingMethod ; } public void setEnclosingMethod ( MethodNode enclosingMethod ) { redirect ( ) . enclosingMethod = enclosingMethod ; } public ClassNode ( String name , int modifiers , ClassNode superClass ) { this ( name , modifiers , superClass , EMPTY_ARRAY , MixinNode . EMPTY_ARRAY ) ; } public ClassNode ( String name , int modifiers , ClassNode superClass , ClassNode [ ] interfaces , MixinNode [ ] mixins ) { this . name = name ; this . modifiers = modifiers ; this . superClass = superClass ; this . interfaces = interfaces ; this . mixins = mixins ; isPrimaryNode = true ; if ( superClass != null ) { usesGenerics = superClass . isUsingGenerics ( ) ; } if ( ! usesGenerics && interfaces != null ) { for ( int i = <NUM_LIT:0> ; i < interfaces . length ; i ++ ) { usesGenerics = usesGenerics || interfaces [ i ] . isUsingGenerics ( ) ; } } if ( ( modifiers & ACC_INTERFACE ) == <NUM_LIT:0> ) { ClassNode ownClassType ; if ( ! name . equals ( "<STR_LIT>" ) ) { ownClassType = ClassHelper . makeWithoutCaching ( "<STR_LIT>" ) ; ownClassType . setRedirect ( ClassHelper . CLASS_Type ) ; } else { ownClassType = this ; } addField ( "<STR_LIT>" , ACC_STATIC | ACC_PUBLIC | ACC_FINAL | ACC_SYNTHETIC , ownClassType , new ClassExpression ( this ) ) . setSynthetic ( true ) ; } } private void getTransformInstancesLazy ( ) { transformInstances = new EnumMap < CompilePhase , Map < Class < ? extends ASTTransformation > , Set < ASTNode > > > ( CompilePhase . class ) ; for ( CompilePhase phase : CompilePhase . values ( ) ) { transformInstances . put ( phase , new HashMap < Class < ? extends ASTTransformation > , Set < ASTNode > > ( ) ) ; } } public void setSuperClass ( ClassNode superClass ) { redirect ( ) . superClass = superClass ; } public List < FieldNode > getFields ( ) { if ( ! redirect ( ) . lazyInitDone ) redirect ( ) . lazyClassInit ( ) ; if ( redirect != null ) return redirect ( ) . getFields ( ) ; return getFieldsLazy ( ) ; } private List < FieldNode > getFieldsLazy ( ) { if ( fields == null ) { fields = new LinkedList < FieldNode > ( ) ; } return fields ; } public ClassNode [ ] getInterfaces ( ) { if ( ! redirect ( ) . lazyInitDone ) redirect ( ) . lazyClassInit ( ) ; if ( redirect != null ) return redirect ( ) . getInterfaces ( ) ; return interfaces ; } public void setInterfaces ( ClassNode [ ] interfaces ) { if ( redirect != null ) { redirect ( ) . setInterfaces ( interfaces ) ; } else { this . interfaces = interfaces ; } } public MixinNode [ ] getMixins ( ) { return redirect ( ) . mixins ; } public List < MethodNode > getMethods ( ) { if ( ! redirect ( ) . lazyInitDone ) redirect ( ) . lazyClassInit ( ) ; if ( redirect != null ) return redirect ( ) . getMethods ( ) ; return getMethodsListLazy ( ) ; } public List getAbstractMethods ( ) { List result = new ArrayList ( <NUM_LIT:3> ) ; Map declaredMethods = getDeclaredMethodsMap ( ) ; for ( Iterator it = declaredMethods . values ( ) . iterator ( ) ; it . hasNext ( ) ; ) { MethodNode method = ( MethodNode ) it . next ( ) ; if ( method . isAbstract ( ) ) { result . add ( method ) ; } } if ( result . isEmpty ( ) ) { return null ; } else { return result ; } } public List getAllDeclaredMethods ( ) { return new ArrayList ( getDeclaredMethodsMap ( ) . values ( ) ) ; } public Set getAllInterfaces ( ) { Set res = new HashSet ( ) ; getAllInterfaces ( res ) ; return res ; } private void getAllInterfaces ( Set res ) { if ( isInterface ( ) ) res . add ( this ) ; ClassNode [ ] interfaces = getInterfaces ( ) ; for ( int i = <NUM_LIT:0> ; i < interfaces . length ; i ++ ) { res . add ( interfaces [ i ] ) ; interfaces [ i ] . getAllInterfaces ( res ) ; } } public Map getDeclaredMethodsMap ( ) { ClassNode parent = getSuperClass ( ) ; Map result = null ; if ( parent != null ) { result = parent . getDeclaredMethodsMap ( ) ; } else { result = new HashMap ( ) ; } ClassNode [ ] interfaces = getInterfaces ( ) ; for ( int i = <NUM_LIT:0> ; i < interfaces . length ; i ++ ) { ClassNode iface = interfaces [ i ] ; Map ifaceMethodsMap = iface . getDeclaredMethodsMap ( ) ; for ( Object o : ifaceMethodsMap . keySet ( ) ) { String methSig = ( String ) o ; if ( ! result . containsKey ( methSig ) ) { MethodNode methNode = ( MethodNode ) ifaceMethodsMap . get ( methSig ) ; result . put ( methSig , methNode ) ; } } } for ( Object o : getMethods ( ) ) { MethodNode method = ( MethodNode ) o ; String sig = method . getTypeDescriptor ( ) ; result . put ( sig , method ) ; } return result ; } public String getName ( ) { return redirect ( ) . name ; } public String setName ( String name ) { return redirect ( ) . name = name ; } public int getModifiers ( ) { return redirect ( ) . modifiers ; } public void setModifiers ( int modifiers ) { redirect ( ) . modifiers = modifiers ; } public List getProperties ( ) { return redirect ( ) . getPropertiesLazy ( ) ; } private List getPropertiesLazy ( ) { if ( properties == null ) properties = new LinkedList ( ) ; return properties ; } public List getDeclaredConstructors ( ) { if ( ! redirect ( ) . lazyInitDone ) redirect ( ) . lazyClassInit ( ) ; return redirect ( ) . getDeclaredConstructorsLazy ( ) ; } private List getDeclaredConstructorsLazy ( ) { if ( constructors == null ) constructors = new LinkedList ( ) ; return constructors ; } public ModuleNode getModule ( ) { return redirect ( ) . module ; } public void setModule ( ModuleNode module ) { redirect ( ) . module = module ; if ( module != null ) { redirect ( ) . compileUnit = module . getUnit ( ) ; } } public void addField ( FieldNode node ) { node . setDeclaringClass ( redirect ( ) ) ; node . setOwner ( redirect ( ) ) ; redirect ( ) . getFieldsLazy ( ) . add ( node ) ; redirect ( ) . getFieldIndexLazy ( ) . put ( node . getName ( ) , node ) ; } private Map getFieldIndexLazy ( ) { if ( fieldIndex == null ) fieldIndex = new HashMap ( ) ; return fieldIndex ; } public void addProperty ( PropertyNode node ) { node . setDeclaringClass ( redirect ( ) ) ; FieldNode field = node . getField ( ) ; addField ( field ) ; redirect ( ) . getPropertiesLazy ( ) . add ( node ) ; } public PropertyNode addProperty ( String name , int modifiers , ClassNode type , Expression initialValueExpression , Statement getterBlock , Statement setterBlock ) { for ( Object o : getProperties ( ) ) { PropertyNode pn = ( PropertyNode ) o ; if ( pn . getName ( ) . equals ( name ) ) { if ( pn . getInitialExpression ( ) == null && initialValueExpression != null ) pn . getField ( ) . setInitialValueExpression ( initialValueExpression ) ; if ( pn . getGetterBlock ( ) == null && getterBlock != null ) pn . setGetterBlock ( getterBlock ) ; if ( pn . getSetterBlock ( ) == null && setterBlock != null ) pn . setSetterBlock ( setterBlock ) ; return pn ; } } PropertyNode node = new PropertyNode ( name , modifiers , type , redirect ( ) , initialValueExpression , getterBlock , setterBlock ) ; addProperty ( node ) ; return node ; } public boolean hasProperty ( String name ) { return getProperty ( name ) != null ; } public PropertyNode getProperty ( String name ) { for ( Object o : getProperties ( ) ) { PropertyNode pn = ( PropertyNode ) o ; if ( pn . getName ( ) . equals ( name ) ) return pn ; } return null ; } public void addConstructor ( ConstructorNode node ) { node . setDeclaringClass ( this ) ; redirect ( ) . getDeclaredConstructorsLazy ( ) . add ( node ) ; } public ConstructorNode addConstructor ( int modifiers , Parameter [ ] parameters , ClassNode [ ] exceptions , Statement code ) { ConstructorNode node = new ConstructorNode ( modifiers , parameters , exceptions , code ) ; addConstructor ( node ) ; return node ; } public void addMethod ( MethodNode node ) { node . setDeclaringClass ( this ) ; redirect ( ) . getMethodsListLazy ( ) . add ( node ) ; redirect ( ) . getMethodsLazy ( ) . put ( node . getName ( ) , node ) ; } private MapOfLists getMethodsLazy ( ) { if ( methods == null ) methods = new MapOfLists ( ) ; return methods ; } private List < MethodNode > getMethodsListLazy ( ) { if ( methodsList == null ) methodsList = new LinkedList < MethodNode > ( ) ; return methodsList ; } public MethodNode addMethod ( String name , int modifiers , ClassNode returnType , Parameter [ ] parameters , ClassNode [ ] exceptions , Statement code ) { MethodNode other = getDeclaredMethod ( name , parameters ) ; if ( other != null ) { return other ; } MethodNode node = new MethodNode ( name , modifiers , returnType , parameters , exceptions , code ) ; addMethod ( node ) ; return node ; } public boolean hasDeclaredMethod ( String name , Parameter [ ] parameters ) { MethodNode other = getDeclaredMethod ( name , parameters ) ; return other != null ; } public boolean hasMethod ( String name , Parameter [ ] parameters ) { MethodNode other = getMethod ( name , parameters ) ; return other != null ; } public MethodNode addSyntheticMethod ( String name , int modifiers , ClassNode returnType , Parameter [ ] parameters , ClassNode [ ] exceptions , Statement code ) { MethodNode answer = addMethod ( name , modifiers | ACC_SYNTHETIC , returnType , parameters , exceptions , code ) ; answer . setSynthetic ( true ) ; return answer ; } public FieldNode addField ( String name , int modifiers , ClassNode type , Expression initialValue ) { FieldNode node = new FieldNode ( name , modifiers , type , redirect ( ) , initialValue ) ; addField ( node ) ; return node ; } public void addInterface ( ClassNode type ) { boolean skip = false ; ClassNode [ ] interfaces = redirect ( ) . interfaces ; for ( int i = <NUM_LIT:0> ; i < interfaces . length ; i ++ ) { if ( type . equals ( interfaces [ i ] ) ) { skip = true ; } } if ( ! skip ) { ClassNode [ ] newInterfaces = new ClassNode [ interfaces . length + <NUM_LIT:1> ] ; System . arraycopy ( interfaces , <NUM_LIT:0> , newInterfaces , <NUM_LIT:0> , interfaces . length ) ; newInterfaces [ interfaces . length ] = type ; redirect ( ) . interfaces = newInterfaces ; } } public boolean equals ( Object o ) { if ( redirect != null ) return redirect ( ) . equals ( o ) ; ClassNode cn = ( ClassNode ) o ; return ( cn . getName ( ) . equals ( getName ( ) ) ) ; } public int hashCode ( ) { if ( redirect != null ) return redirect ( ) . hashCode ( ) ; return getName ( ) . hashCode ( ) ; } public void addMixin ( MixinNode mixin ) { MixinNode [ ] mixins = redirect ( ) . mixins ; boolean skip = false ; for ( int i = <NUM_LIT:0> ; i < mixins . length ; i ++ ) { if ( mixin . equals ( mixins [ i ] ) ) { skip = true ; } } if ( ! skip ) { MixinNode [ ] newMixins = new MixinNode [ mixins . length + <NUM_LIT:1> ] ; System . arraycopy ( mixins , <NUM_LIT:0> , newMixins , <NUM_LIT:0> , mixins . length ) ; newMixins [ mixins . length ] = mixin ; redirect ( ) . mixins = newMixins ; } } public FieldNode getDeclaredField ( String name ) { return ( FieldNode ) redirect ( ) . getFieldIndexLazy ( ) . get ( name ) ; } public FieldNode getField ( String name ) { ClassNode node = this ; while ( node != null ) { FieldNode fn = node . getDeclaredField ( name ) ; if ( fn != null ) return fn ; node = node . getSuperClass ( ) ; } return null ; } public FieldNode getOuterField ( String name ) { return null ; } public ClassNode getOuterClass ( ) { return null ; } public void addObjectInitializerStatements ( Statement statements ) { if ( objectInitializers == null ) objectInitializers = new LinkedList ( ) ; objectInitializers . add ( statements ) ; } public List getObjectInitializerStatements ( ) { if ( objectInitializers == null ) objectInitializers = new LinkedList ( ) ; return objectInitializers ; } private MethodNode getOrAddStaticConstructorNode ( ) { MethodNode method = null ; List declaredMethods = getDeclaredMethods ( "<STR_LIT>" ) ; if ( declaredMethods . isEmpty ( ) ) { method = addMethod ( "<STR_LIT>" , ACC_STATIC , ClassHelper . VOID_TYPE , Parameter . EMPTY_ARRAY , ClassNode . EMPTY_ARRAY , new BlockStatement ( ) ) ; method . setSynthetic ( true ) ; } else { method = ( MethodNode ) declaredMethods . get ( <NUM_LIT:0> ) ; } return method ; } public void addStaticInitializerStatements ( List staticStatements , boolean fieldInit ) { MethodNode method = getOrAddStaticConstructorNode ( ) ; BlockStatement block = null ; Statement statement = method . getCode ( ) ; if ( statement == null ) { block = new BlockStatement ( ) ; } else if ( statement instanceof BlockStatement ) { block = ( BlockStatement ) statement ; } else { block = new BlockStatement ( ) ; block . addStatement ( statement ) ; } if ( ! fieldInit ) { block . addStatements ( staticStatements ) ; } else { List blockStatements = block . getStatements ( ) ; staticStatements . addAll ( blockStatements ) ; blockStatements . clear ( ) ; blockStatements . addAll ( staticStatements ) ; } } public void positionStmtsAfterEnumInitStmts ( List < Statement > staticFieldStatements ) { MethodNode method = getOrAddStaticConstructorNode ( ) ; Statement statement = method . getCode ( ) ; if ( statement instanceof BlockStatement ) { BlockStatement block = ( BlockStatement ) statement ; List < Statement > blockStatements = block . getStatements ( ) ; ListIterator < Statement > litr = blockStatements . listIterator ( ) ; while ( litr . hasNext ( ) ) { Statement stmt = litr . next ( ) ; if ( stmt instanceof ExpressionStatement && ( ( ExpressionStatement ) stmt ) . getExpression ( ) instanceof BinaryExpression ) { BinaryExpression bExp = ( BinaryExpression ) ( ( ExpressionStatement ) stmt ) . getExpression ( ) ; if ( bExp . getLeftExpression ( ) instanceof FieldExpression ) { FieldExpression fExp = ( FieldExpression ) bExp . getLeftExpression ( ) ; if ( fExp . getFieldName ( ) . equals ( "<STR_LIT>" ) ) { for ( Statement tmpStmt : staticFieldStatements ) { litr . add ( tmpStmt ) ; } } } } } } } public List getDeclaredMethods ( String name ) { if ( ! redirect ( ) . lazyInitDone ) redirect ( ) . lazyClassInit ( ) ; if ( redirect != null ) return redirect ( ) . getDeclaredMethods ( name ) ; return getMethodsLazy ( ) . getNotNull ( name ) ; } public List getMethods ( String name ) { List answer = new ArrayList ( ) ; ClassNode node = this ; while ( node != null ) { answer . addAll ( node . getDeclaredMethods ( name ) ) ; node = node . getSuperClass ( ) ; } return answer ; } public MethodNode getDeclaredMethod ( String name , Parameter [ ] parameters ) { for ( Object o : getDeclaredMethods ( name ) ) { MethodNode method = ( MethodNode ) o ; if ( parametersEqual ( method . getParameters ( ) , parameters ) ) { return method ; } } return null ; } public MethodNode getMethod ( String name , Parameter [ ] parameters ) { for ( Object o : getMethods ( name ) ) { MethodNode method = ( MethodNode ) o ; if ( parametersEqual ( method . getParameters ( ) , parameters ) ) { return method ; } } return null ; } public boolean isDerivedFrom ( ClassNode type ) { if ( this . equals ( ClassHelper . VOID_TYPE ) ) { return type . equals ( ClassHelper . VOID_TYPE ) ? true : false ; } if ( type . equals ( ClassHelper . OBJECT_TYPE ) ) return true ; ClassNode node = this ; while ( node != null ) { if ( type . equals ( node ) ) { return true ; } node = node . getSuperClass ( ) ; } return false ; } public boolean isDerivedFromGroovyObject ( ) { return implementsInterface ( ClassHelper . make ( GroovyObject . class ) ) ; } public boolean implementsInterface ( ClassNode classNode ) { ClassNode node = redirect ( ) ; do { if ( node . declaresInterface ( classNode ) ) { return true ; } node = node . getSuperClass ( ) ; } while ( node != null ) ; return false ; } public boolean declaresInterface ( ClassNode classNode ) { ClassNode [ ] interfaces = redirect ( ) . getInterfaces ( ) ; if ( declaresInterfaceDirect ( interfaces , classNode ) ) return true ; List superInterfaces = Arrays . asList ( interfaces ) ; while ( superInterfaces . size ( ) > <NUM_LIT:0> ) { List keep = new ArrayList ( ) ; for ( int i = <NUM_LIT:0> ; i < superInterfaces . size ( ) ; i ++ ) { ClassNode cn = ( ClassNode ) superInterfaces . get ( i ) ; if ( cn . declaresInterface ( classNode ) ) return true ; keep . addAll ( Arrays . asList ( cn . getInterfaces ( ) ) ) ; } superInterfaces = keep ; } return false ; } private boolean declaresInterfaceDirect ( ClassNode [ ] interfaces , ClassNode classNode ) { int size = interfaces . length ; for ( int i = <NUM_LIT:0> ; i < size ; i ++ ) { if ( interfaces [ i ] . equals ( classNode ) ) { return true ; } } return false ; } public ClassNode getSuperClass ( ) { if ( ! lazyInitDone && ! isResolved ( ) ) { throw new GroovyBugError ( "<STR_LIT>" + getName ( ) + "<STR_LIT>" ) ; } ClassNode sn = redirect ( ) . getUnresolvedSuperClass ( ) ; if ( sn != null ) sn = sn . redirect ( ) ; return sn ; } public ClassNode getUnresolvedSuperClass ( ) { return getUnresolvedSuperClass ( true ) ; } public ClassNode getUnresolvedSuperClass ( boolean useRedirect ) { if ( ! useRedirect ) return superClass ; if ( ! redirect ( ) . lazyInitDone ) redirect ( ) . lazyClassInit ( ) ; return redirect ( ) . superClass ; } public void setUnresolvedSuperClass ( ClassNode sn ) { superClass = sn ; } public CompileUnit getCompileUnit ( ) { if ( redirect != null ) return redirect ( ) . getCompileUnit ( ) ; if ( compileUnit == null && module != null ) { compileUnit = module . getUnit ( ) ; } return compileUnit ; } protected void setCompileUnit ( CompileUnit cu ) { if ( redirect != null ) redirect ( ) . setCompileUnit ( cu ) ; if ( compileUnit != null ) compileUnit = cu ; } protected boolean parametersEqual ( Parameter [ ] a , Parameter [ ] b ) { if ( a . length == b . length ) { boolean answer = true ; for ( int i = <NUM_LIT:0> ; i < a . length ; i ++ ) { if ( ! a [ i ] . getType ( ) . equals ( b [ i ] . getType ( ) ) ) { answer = false ; break ; } } return answer ; } return false ; } public String getPackageName ( ) { int idx = getName ( ) . lastIndexOf ( '<CHAR_LIT:.>' ) ; if ( idx > <NUM_LIT:0> ) { return getName ( ) . substring ( <NUM_LIT:0> , idx ) ; } return null ; } public String getNameWithoutPackage ( ) { int idx = getName ( ) . lastIndexOf ( '<CHAR_LIT:.>' ) ; if ( idx > <NUM_LIT:0> ) { return getName ( ) . substring ( idx + <NUM_LIT:1> ) ; } return getName ( ) ; } public void visitContents ( GroovyClassVisitor visitor ) { for ( Object o : getProperties ( ) ) { PropertyNode pn = ( PropertyNode ) o ; visitor . visitProperty ( pn ) ; } for ( Object o : getFields ( ) ) { FieldNode fn = ( FieldNode ) o ; visitor . visitField ( fn ) ; } for ( Object o : getDeclaredConstructors ( ) ) { ConstructorNode cn = ( ConstructorNode ) o ; visitor . visitConstructor ( cn ) ; } for ( Object o : getMethods ( ) ) { MethodNode mn = ( MethodNode ) o ; visitor . visitMethod ( mn ) ; } } public MethodNode getGetterMethod ( String getterName ) { for ( Object o : getDeclaredMethods ( getterName ) ) { MethodNode method = ( MethodNode ) o ; if ( getterName . equals ( method . getName ( ) ) && ClassHelper . VOID_TYPE != method . getReturnType ( ) && method . getParameters ( ) . length == <NUM_LIT:0> ) { return method ; } } ClassNode parent = getSuperClass ( ) ; if ( parent != null ) return parent . getGetterMethod ( getterName ) ; return null ; } public MethodNode getSetterMethod ( String setterName ) { for ( Object o : getDeclaredMethods ( setterName ) ) { MethodNode method = ( MethodNode ) o ; if ( setterName . equals ( method . getName ( ) ) && ClassHelper . VOID_TYPE == method . getReturnType ( ) && method . getParameters ( ) . length == <NUM_LIT:1> ) { return method ; } } ClassNode parent = getSuperClass ( ) ; if ( parent != null ) return parent . getSetterMethod ( setterName ) ; return null ; } public boolean isStaticClass ( ) { return redirect ( ) . staticClass ; } public void setStaticClass ( boolean staticClass ) { redirect ( ) . staticClass = staticClass ; } public boolean isScriptBody ( ) { return redirect ( ) . scriptBody ; } public void setScriptBody ( boolean scriptBody ) { redirect ( ) . scriptBody = scriptBody ; } public boolean isScript ( ) { return redirect ( ) . script || isDerivedFrom ( ClassHelper . SCRIPT_TYPE ) ; } public void setScript ( boolean script ) { redirect ( ) . script = script ; } public String toString ( ) { String ret = getName ( ) ; if ( genericsTypes != null ) { ret += "<STR_LIT>" ; for ( int i = <NUM_LIT:0> ; i < genericsTypes . length ; i ++ ) { if ( i != <NUM_LIT:0> ) ret += "<STR_LIT:U+002CU+0020>" ; ret += genericsTypes [ i ] ; } ret += "<STR_LIT:>>" ; } if ( redirect != null ) { ret += "<STR_LIT>" + redirect ( ) . toString ( ) ; } return ret ; } public boolean hasPossibleMethod ( String name , Expression arguments ) { int count = <NUM_LIT:0> ; if ( arguments instanceof TupleExpression ) { TupleExpression tuple = ( TupleExpression ) arguments ; count = tuple . getExpressions ( ) . size ( ) ; } ClassNode node = this ; do { for ( Object o : getMethods ( name ) ) { MethodNode method = ( MethodNode ) o ; if ( method . getParameters ( ) . length == count && ! Modifier . isStatic ( method . getModifiers ( ) ) ) { return true ; } } node = node . getSuperClass ( ) ; } while ( node != null ) ; return false ; } public MethodNode tryFindPossibleMethod ( String name , Expression arguments ) { int count = <NUM_LIT:0> ; if ( arguments instanceof TupleExpression ) { TupleExpression tuple = ( TupleExpression ) arguments ; count = tuple . getExpressions ( ) . size ( ) ; } else return null ; MethodNode res = null ; ClassNode node = this ; TupleExpression args = ( TupleExpression ) arguments ; do { for ( Object o : node . getMethods ( name ) ) { MethodNode method = ( MethodNode ) o ; if ( method . getParameters ( ) . length == count ) { boolean match = true ; for ( int i = <NUM_LIT:0> ; i != count ; ++ i ) if ( ! args . getType ( ) . isDerivedFrom ( method . getParameters ( ) [ i ] . getType ( ) ) ) { match = false ; break ; } if ( match ) { if ( res == null ) res = method ; else { if ( res . getParameters ( ) . length != count ) return null ; if ( node . equals ( this ) ) return null ; match = true ; for ( int i = <NUM_LIT:0> ; i != count ; ++ i ) if ( ! res . getParameters ( ) [ i ] . getType ( ) . equals ( method . getParameters ( ) [ i ] . getType ( ) ) ) { match = false ; break ; } if ( ! match ) return null ; } } } } node = node . getSuperClass ( ) ; } while ( node != null ) ; return res ; } public boolean hasPossibleStaticMethod ( String name , Expression arguments ) { int count = <NUM_LIT:0> ; if ( arguments instanceof TupleExpression ) { TupleExpression tuple = ( TupleExpression ) arguments ; count = tuple . getExpressions ( ) . size ( ) ; } else if ( arguments instanceof MapExpression ) { count = <NUM_LIT:1> ; } for ( Object o : getMethods ( name ) ) { MethodNode method = ( MethodNode ) o ; if ( method . isStatic ( ) ) { Parameter [ ] parameters = method . getParameters ( ) ; if ( parameters . length == count ) return true ; if ( parameters . length > <NUM_LIT:0> && parameters [ parameters . length - <NUM_LIT:1> ] . getType ( ) . isArray ( ) ) { if ( count >= parameters . length - <NUM_LIT:1> ) return true ; } int nonDefaultParameters = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < parameters . length ; i ++ ) { if ( parameters [ i ] . hasInitialExpression ( ) == false ) { nonDefaultParameters ++ ; } } if ( count < parameters . length && nonDefaultParameters <= count ) { return true ; } } } return false ; } public boolean isInterface ( ) { return ( getModifiers ( ) & Opcodes . ACC_INTERFACE ) > <NUM_LIT:0> ; } public boolean isResolved ( ) { return redirect ( ) . isReallyResolved ( ) || redirect ( ) . clazz != null || ( componentType != null && componentType . isResolved ( ) ) ; } public boolean isReallyResolved ( ) { return false ; } public boolean isArray ( ) { return componentType != null ; } public ClassNode getComponentType ( ) { return componentType ; } public boolean hasClass ( ) { return redirect ( ) . clazz != null ; } public Class getTypeClass ( ) { Class c = redirect ( ) . clazz ; if ( c != null ) return c ; ClassNode component = redirect ( ) . componentType ; if ( component != null && component . isResolved ( ) ) { ClassNode cn = component . makeArray ( ) ; setRedirect ( cn ) ; return redirect ( ) . clazz ; } throw new GroovyBugError ( "<STR_LIT>" + getName ( ) + "<STR_LIT>" ) ; } public boolean hasPackageName ( ) { return redirect ( ) . name . indexOf ( '<CHAR_LIT:.>' ) > <NUM_LIT:0> ; } public void setAnnotated ( boolean flag ) { this . annotated = flag ; } public boolean isAnnotated ( ) { return this . annotated ; } public GenericsType [ ] getGenericsTypes ( ) { return genericsTypes ; } public void setGenericsTypes ( GenericsType [ ] genericsTypes ) { usesGenerics = usesGenerics || genericsTypes != null ; this . genericsTypes = genericsTypes ; } public void setGenericsPlaceHolder ( boolean b ) { usesGenerics = usesGenerics || b ; placeholder = b ; } public boolean isGenericsPlaceHolder ( ) { return placeholder ; } public boolean isUsingGenerics ( ) { return usesGenerics ; } public void setUsingGenerics ( boolean b ) { usesGenerics = b ; } public ClassNode getPlainNodeReference ( ) { if ( ClassHelper . isPrimitiveType ( this ) ) return this ; ClassNode n = new ClassNode ( getName ( ) , getModifiers ( ) , getSuperClass ( ) , null , null ) ; n . isPrimaryNode = false ; n . setRedirect ( this . redirect ) ; return n ; } public boolean isAnnotationDefinition ( ) { return redirect ( ) . isPrimaryNode && isInterface ( ) && ( getModifiers ( ) & Opcodes . ACC_ANNOTATION ) != <NUM_LIT:0> ; } public List getAnnotations ( ) { if ( redirect != null ) return redirect . getAnnotations ( ) ; lazyClassInit ( ) ; return super . getAnnotations ( ) ; } public List getAnnotations ( ClassNode type ) { if ( redirect != null ) return redirect . getAnnotations ( type ) ; lazyClassInit ( ) ; return super . getAnnotations ( type ) ; } public void addTransform ( Class < ? extends ASTTransformation > transform , ASTNode node ) { if ( transformInstances == null ) getTransformInstancesLazy ( ) ; GroovyASTTransformation annotation = transform . getAnnotation ( GroovyASTTransformation . class ) ; Set < ASTNode > nodes = transformInstances . get ( annotation . phase ( ) ) . get ( transform ) ; if ( nodes == null ) { nodes = new LinkedHashSet ( ) ; transformInstances . get ( annotation . phase ( ) ) . put ( transform , nodes ) ; } nodes . add ( node ) ; } public Map < Class < ? extends ASTTransformation > , Set < ASTNode > > getTransforms ( CompilePhase phase ) { if ( transformInstances == null ) return Collections . EMPTY_MAP ; return transformInstances . get ( phase ) ; } public void renameField ( String oldName , String newName ) { final Map index = redirect ( ) . getFieldIndexLazy ( ) ; index . put ( newName , index . remove ( oldName ) ) ; } public boolean isEnum ( ) { return ( getModifiers ( ) & Opcodes . ACC_ENUM ) != <NUM_LIT:0> ; } public String getClassInternalName ( ) { if ( redirect != null ) return redirect ( ) . getClassInternalName ( ) ; return null ; } public boolean isPrimitive ( ) { if ( clazz != null ) { return clazz . isPrimitive ( ) ; } return false ; } } </s>
|
<s> package org . codehaus . groovy . ast ; public class ASTNode { private int lineNumber = - <NUM_LIT:1> ; private int columnNumber = - <NUM_LIT:1> ; private int lastLineNumber = - <NUM_LIT:1> ; private int lastColumnNumber = - <NUM_LIT:1> ; private int start = <NUM_LIT:0> ; private int end = <NUM_LIT:0> ; public void visit ( GroovyCodeVisitor visitor ) { throw new RuntimeException ( "<STR_LIT>" + getClass ( ) . getName ( ) ) ; } public String getText ( ) { return "<STR_LIT>" + getClass ( ) . getName ( ) + "<STR_LIT:>>" ; } public int getLineNumber ( ) { return lineNumber ; } public void setLineNumber ( int lineNumber ) { this . lineNumber = lineNumber ; } public int getColumnNumber ( ) { return columnNumber ; } public void setColumnNumber ( int columnNumber ) { this . columnNumber = columnNumber ; } public int getLastLineNumber ( ) { return lastLineNumber ; } public void setLastLineNumber ( int lastLineNumber ) { this . lastLineNumber = lastLineNumber ; } public int getLastColumnNumber ( ) { return lastColumnNumber ; } public void setLastColumnNumber ( int lastColumnNumber ) { this . lastColumnNumber = lastColumnNumber ; } public int getStart ( ) { return start ; } public void setStart ( int start ) { this . start = start ; } public int getEnd ( ) { return end ; } public void setEnd ( int end ) { this . end = end ; } public int getLength ( ) { return end >= <NUM_LIT:0> && start >= <NUM_LIT:0> ? end - start : - <NUM_LIT:1> ; } public void setSourcePosition ( ASTNode node ) { this . columnNumber = node . getColumnNumber ( ) ; this . lastLineNumber = node . getLastLineNumber ( ) ; this . lastColumnNumber = node . getLastColumnNumber ( ) ; this . lineNumber = node . getLineNumber ( ) ; this . start = node . getStart ( ) ; this . end = node . getEnd ( ) ; } } </s>
|
<s> package org . codehaus . groovy . classgen ; import java . math . BigDecimal ; import java . math . BigInteger ; import org . codehaus . groovy . ast . ClassHelper ; import org . codehaus . groovy . ast . ClassNode ; import org . codehaus . groovy . ast . FieldNode ; import org . codehaus . groovy . ast . GenericsType ; import org . codehaus . groovy . ast . MethodNode ; import org . codehaus . groovy . ast . Parameter ; import org . codehaus . groovy . reflection . ReflectionCache ; import org . codehaus . groovy . runtime . typehandling . DefaultTypeTransformation ; import org . objectweb . asm . Label ; import org . objectweb . asm . MethodVisitor ; import org . objectweb . asm . Opcodes ; public class BytecodeHelper implements Opcodes { private MethodVisitor mv ; public MethodVisitor getMethodVisitor ( ) { return mv ; } public BytecodeHelper ( MethodVisitor mv ) { this . mv = mv ; } public void quickBoxIfNecessary ( ClassNode type ) { String descr = getTypeDescription ( type ) ; if ( type == ClassHelper . boolean_TYPE ) { boxBoolean ( ) ; } else if ( ClassHelper . isPrimitiveType ( type ) && type != ClassHelper . VOID_TYPE ) { ClassNode wrapper = ClassHelper . getWrapper ( type ) ; String internName = getClassInternalName ( wrapper ) ; mv . visitTypeInsn ( NEW , internName ) ; mv . visitInsn ( DUP ) ; if ( type == ClassHelper . double_TYPE || type == ClassHelper . long_TYPE ) { mv . visitInsn ( DUP2_X2 ) ; mv . visitInsn ( POP2 ) ; } else { mv . visitInsn ( DUP2_X1 ) ; mv . visitInsn ( POP2 ) ; } mv . visitMethodInsn ( INVOKESPECIAL , internName , "<STR_LIT>" , "<STR_LIT:(>" + descr + "<STR_LIT>" ) ; } } public void quickUnboxIfNecessary ( ClassNode type ) { if ( ClassHelper . isPrimitiveType ( type ) && type != ClassHelper . VOID_TYPE ) { ClassNode wrapper = ClassHelper . getWrapper ( type ) ; String internName = getClassInternalName ( wrapper ) ; if ( type == ClassHelper . boolean_TYPE ) { mv . visitTypeInsn ( CHECKCAST , internName ) ; mv . visitMethodInsn ( INVOKEVIRTUAL , internName , type . getName ( ) + "<STR_LIT>" , "<STR_LIT>" + getTypeDescription ( type ) ) ; } else { mv . visitTypeInsn ( CHECKCAST , "<STR_LIT>" ) ; mv . visitMethodInsn ( INVOKEVIRTUAL , "<STR_LIT>" , type . getName ( ) + "<STR_LIT>" , "<STR_LIT>" + getTypeDescription ( type ) ) ; } } } public void box ( Class type ) { if ( ReflectionCache . getCachedClass ( type ) . isPrimitive && type != void . class ) { String returnString = "<STR_LIT:(>" + getTypeDescription ( type ) + "<STR_LIT>" ; mv . visitMethodInsn ( INVOKESTATIC , getClassInternalName ( DefaultTypeTransformation . class . getName ( ) ) , "<STR_LIT>" , returnString ) ; } } public void box ( ClassNode type ) { if ( type . isPrimaryClassNode ( ) ) return ; if ( type . isPrimitive ( ) ) box ( type . getTypeClass ( ) ) ; } public void unbox ( Class type ) { if ( type . isPrimitive ( ) && type != Void . TYPE ) { String returnString = "<STR_LIT>" + getTypeDescription ( type ) ; mv . visitMethodInsn ( INVOKESTATIC , getClassInternalName ( DefaultTypeTransformation . class . getName ( ) ) , type . getName ( ) + "<STR_LIT>" , returnString ) ; } } public void unbox ( ClassNode type ) { if ( type . isPrimaryClassNode ( ) ) return ; if ( type . isPrimitive ( ) ) unbox ( type . getTypeClass ( ) ) ; } public static String getClassInternalName ( ClassNode t ) { if ( t . isPrimaryClassNode ( ) ) { return getClassInternalName ( t . getName ( ) ) ; } String name = t . getClassInternalName ( ) ; if ( name == null ) { if ( t . hasClass ( ) ) { name = getClassInternalName ( t . getTypeClass ( ) ) ; } else { name = getClassInternalName ( t . getName ( ) ) ; } } return name ; } public static String getClassInternalName ( Class t ) { return org . objectweb . asm . Type . getInternalName ( t ) ; } public static String getClassInternalName ( String name ) { return name . replace ( '<CHAR_LIT:.>' , '<CHAR_LIT:/>' ) ; } public static String getMethodDescriptor ( ClassNode returnType , Parameter [ ] parameters ) { StringBuffer buffer = new StringBuffer ( "<STR_LIT:(>" ) ; for ( int i = <NUM_LIT:0> ; i < parameters . length ; i ++ ) { buffer . append ( getTypeDescription ( parameters [ i ] . getType ( ) ) ) ; } buffer . append ( "<STR_LIT:)>" ) ; buffer . append ( getTypeDescription ( returnType ) ) ; return buffer . toString ( ) ; } public static String getMethodDescriptor ( Class returnType , Class [ ] paramTypes ) { StringBuffer buffer = new StringBuffer ( "<STR_LIT:(>" ) ; for ( int i = <NUM_LIT:0> ; i < paramTypes . length ; i ++ ) { buffer . append ( getTypeDescription ( paramTypes [ i ] ) ) ; } buffer . append ( "<STR_LIT:)>" ) ; buffer . append ( getTypeDescription ( returnType ) ) ; return buffer . toString ( ) ; } public static String getTypeDescription ( Class c ) { return org . objectweb . asm . Type . getDescriptor ( c ) ; } public static String getClassLoadingTypeDescription ( ClassNode c ) { StringBuffer buf = new StringBuffer ( ) ; boolean array = false ; while ( true ) { if ( c . isArray ( ) ) { buf . append ( '<CHAR_LIT:[>' ) ; c = c . getComponentType ( ) ; array = true ; } else { if ( ClassHelper . isPrimitiveType ( c ) ) { buf . append ( getTypeDescription ( c ) ) ; } else { if ( array ) buf . append ( '<CHAR_LIT>' ) ; buf . append ( c . getName ( ) ) ; if ( array ) buf . append ( '<CHAR_LIT:;>' ) ; } return buf . toString ( ) ; } } } public static String getTypeDescription ( ClassNode c ) { return getTypeDescription ( c , true ) ; } private static String getTypeDescription ( ClassNode c , boolean end ) { StringBuffer buf = new StringBuffer ( ) ; ClassNode d = c ; while ( true ) { if ( ClassHelper . isPrimitiveType ( d ) ) { char car ; if ( d == ClassHelper . int_TYPE ) { car = '<CHAR_LIT>' ; } else if ( d == ClassHelper . VOID_TYPE ) { car = '<CHAR_LIT>' ; } else if ( d == ClassHelper . boolean_TYPE ) { car = '<CHAR_LIT:Z>' ; } else if ( d == ClassHelper . byte_TYPE ) { car = '<CHAR_LIT>' ; } else if ( d == ClassHelper . char_TYPE ) { car = '<CHAR_LIT>' ; } else if ( d == ClassHelper . short_TYPE ) { car = '<CHAR_LIT>' ; } else if ( d == ClassHelper . double_TYPE ) { car = '<CHAR_LIT>' ; } else if ( d == ClassHelper . float_TYPE ) { car = '<CHAR_LIT>' ; } else { car = '<CHAR_LIT>' ; } buf . append ( car ) ; return buf . toString ( ) ; } else if ( d . isArray ( ) ) { buf . append ( '<CHAR_LIT:[>' ) ; d = d . getComponentType ( ) ; } else { buf . append ( '<CHAR_LIT>' ) ; String name = d . getName ( ) ; int len = name . length ( ) ; for ( int i = <NUM_LIT:0> ; i < len ; ++ i ) { char car = name . charAt ( i ) ; buf . append ( car == '<CHAR_LIT:.>' ? '<CHAR_LIT:/>' : car ) ; } if ( end ) buf . append ( '<CHAR_LIT:;>' ) ; return buf . toString ( ) ; } } } public static String [ ] getClassInternalNames ( ClassNode [ ] names ) { int size = names . length ; String [ ] answer = new String [ size ] ; for ( int i = <NUM_LIT:0> ; i < size ; i ++ ) { answer [ i ] = getClassInternalName ( names [ i ] ) ; } return answer ; } protected void pushConstant ( boolean value ) { if ( value ) { mv . visitInsn ( ICONST_1 ) ; } else { mv . visitInsn ( ICONST_0 ) ; } } public void pushConstant ( int value ) { switch ( value ) { case <NUM_LIT:0> : mv . visitInsn ( ICONST_0 ) ; break ; case <NUM_LIT:1> : mv . visitInsn ( ICONST_1 ) ; break ; case <NUM_LIT:2> : mv . visitInsn ( ICONST_2 ) ; break ; case <NUM_LIT:3> : mv . visitInsn ( ICONST_3 ) ; break ; case <NUM_LIT:4> : mv . visitInsn ( ICONST_4 ) ; break ; case <NUM_LIT:5> : mv . visitInsn ( ICONST_5 ) ; break ; default : if ( value >= Byte . MIN_VALUE && value <= Byte . MAX_VALUE ) { mv . visitIntInsn ( BIPUSH , value ) ; } else if ( value >= Short . MIN_VALUE && value <= Short . MAX_VALUE ) { mv . visitIntInsn ( SIPUSH , value ) ; } else { mv . visitLdcInsn ( Integer . valueOf ( value ) ) ; } } } public void doCast ( Class type ) { if ( type != Object . class ) { if ( type . isPrimitive ( ) && type != Void . TYPE ) { unbox ( type ) ; } else { mv . visitTypeInsn ( CHECKCAST , type . isArray ( ) ? getTypeDescription ( type ) : getClassInternalName ( type . getName ( ) ) ) ; } } } public void doCast ( ClassNode type ) { if ( type == ClassHelper . OBJECT_TYPE ) return ; if ( ClassHelper . isPrimitiveType ( type ) && type != ClassHelper . VOID_TYPE ) { unbox ( type ) ; } else { mv . visitTypeInsn ( CHECKCAST , type . isArray ( ) ? getTypeDescription ( type ) : getClassInternalName ( type ) ) ; } } public void load ( ClassNode type , int idx ) { if ( type == ClassHelper . double_TYPE ) { mv . visitVarInsn ( DLOAD , idx ) ; } else if ( type == ClassHelper . float_TYPE ) { mv . visitVarInsn ( FLOAD , idx ) ; } else if ( type == ClassHelper . long_TYPE ) { mv . visitVarInsn ( LLOAD , idx ) ; } else if ( type == ClassHelper . boolean_TYPE || type == ClassHelper . char_TYPE || type == ClassHelper . byte_TYPE || type == ClassHelper . int_TYPE || type == ClassHelper . short_TYPE ) { mv . visitVarInsn ( ILOAD , idx ) ; } else { mv . visitVarInsn ( ALOAD , idx ) ; } } public void load ( Variable v ) { load ( v . getType ( ) , v . getIndex ( ) ) ; } public void store ( Variable v , boolean markStart ) { ClassNode type = v . getType ( ) ; unbox ( type ) ; int idx = v . getIndex ( ) ; if ( type == ClassHelper . double_TYPE ) { mv . visitVarInsn ( DSTORE , idx ) ; } else if ( type == ClassHelper . float_TYPE ) { mv . visitVarInsn ( FSTORE , idx ) ; } else if ( type == ClassHelper . long_TYPE ) { mv . visitVarInsn ( LSTORE , idx ) ; } else if ( type == ClassHelper . boolean_TYPE || type == ClassHelper . char_TYPE || type == ClassHelper . byte_TYPE || type == ClassHelper . int_TYPE || type == ClassHelper . short_TYPE ) { mv . visitVarInsn ( ISTORE , idx ) ; } else { mv . visitVarInsn ( ASTORE , idx ) ; } } public void store ( Variable v ) { store ( v , false ) ; } void loadConstant ( Object value ) { if ( value == null ) { mv . visitInsn ( ACONST_NULL ) ; } else if ( value instanceof String ) { mv . visitLdcInsn ( value ) ; } else if ( value instanceof Character ) { String className = "<STR_LIT>" ; mv . visitTypeInsn ( NEW , className ) ; mv . visitInsn ( DUP ) ; mv . visitLdcInsn ( value ) ; String methodType = "<STR_LIT>" ; mv . visitMethodInsn ( INVOKESPECIAL , className , "<STR_LIT>" , methodType ) ; } else if ( value instanceof Number ) { Number n = ( Number ) value ; String className = BytecodeHelper . getClassInternalName ( value . getClass ( ) . getName ( ) ) ; mv . visitTypeInsn ( NEW , className ) ; mv . visitInsn ( DUP ) ; String methodType ; if ( n instanceof Integer ) { mv . visitLdcInsn ( n ) ; methodType = "<STR_LIT>" ; } else if ( n instanceof Double ) { mv . visitLdcInsn ( n ) ; methodType = "<STR_LIT>" ; } else if ( n instanceof Float ) { mv . visitLdcInsn ( n ) ; methodType = "<STR_LIT>" ; } else if ( n instanceof Long ) { mv . visitLdcInsn ( n ) ; methodType = "<STR_LIT>" ; } else if ( n instanceof BigDecimal ) { mv . visitLdcInsn ( n . toString ( ) ) ; methodType = "<STR_LIT>" ; } else if ( n instanceof BigInteger ) { mv . visitLdcInsn ( n . toString ( ) ) ; methodType = "<STR_LIT>" ; } else if ( n instanceof Short ) { mv . visitLdcInsn ( n ) ; methodType = "<STR_LIT>" ; } else if ( n instanceof Byte ) { mv . visitLdcInsn ( n ) ; methodType = "<STR_LIT>" ; } else { throw new ClassGeneratorException ( "<STR_LIT>" + value + "<STR_LIT>" + value . getClass ( ) . getName ( ) + "<STR_LIT>" ) ; } mv . visitMethodInsn ( INVOKESPECIAL , className , "<STR_LIT>" , methodType ) ; } else if ( value instanceof Boolean ) { Boolean bool = ( Boolean ) value ; String text = ( bool . booleanValue ( ) ) ? "<STR_LIT>" : "<STR_LIT>" ; mv . visitFieldInsn ( GETSTATIC , "<STR_LIT>" , text , "<STR_LIT>" ) ; } else if ( value instanceof Class ) { Class vc = ( Class ) value ; if ( vc . getName ( ) . equals ( "<STR_LIT>" ) ) { } else { throw new ClassGeneratorException ( "<STR_LIT>" + value + "<STR_LIT>" + value . getClass ( ) . getName ( ) ) ; } } else { throw new ClassGeneratorException ( "<STR_LIT>" + value + "<STR_LIT>" + value . getClass ( ) . getName ( ) ) ; } } public void loadVar ( Variable variable ) { int index = variable . getIndex ( ) ; if ( variable . isHolder ( ) ) { mv . visitVarInsn ( ALOAD , index ) ; mv . visitMethodInsn ( INVOKEVIRTUAL , "<STR_LIT>" , "<STR_LIT:get>" , "<STR_LIT>" ) ; } else { load ( variable ) ; if ( variable != Variable . THIS_VARIABLE && variable != Variable . SUPER_VARIABLE ) { box ( variable . getType ( ) ) ; } } } public void storeVar ( Variable variable ) { String type = variable . getTypeName ( ) ; int index = variable . getIndex ( ) ; if ( variable . isHolder ( ) ) { mv . visitVarInsn ( ALOAD , index ) ; mv . visitInsn ( SWAP ) ; mv . visitMethodInsn ( INVOKEVIRTUAL , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; } else { store ( variable , false ) ; } } public void putField ( FieldNode fld ) { putField ( fld , getClassInternalName ( fld . getOwner ( ) ) ) ; } public void putField ( FieldNode fld , String ownerName ) { mv . visitFieldInsn ( PUTFIELD , ownerName , fld . getName ( ) , getTypeDescription ( fld . getType ( ) ) ) ; } public void swapObjectWith ( ClassNode type ) { if ( type == ClassHelper . long_TYPE || type == ClassHelper . double_TYPE ) { mv . visitInsn ( DUP_X2 ) ; mv . visitInsn ( POP ) ; } else { mv . visitInsn ( SWAP ) ; } } public void swapWithObject ( ClassNode type ) { if ( type == ClassHelper . long_TYPE || type == ClassHelper . double_TYPE ) { mv . visitInsn ( DUP2_X1 ) ; mv . visitInsn ( POP2 ) ; } else { mv . visitInsn ( SWAP ) ; } } public static ClassNode boxOnPrimitive ( ClassNode type ) { if ( ! type . isArray ( ) ) return ClassHelper . getWrapper ( type ) ; return boxOnPrimitive ( type . getComponentType ( ) ) . makeArray ( ) ; } public void boxBoolean ( ) { Label l0 = new Label ( ) ; mv . visitJumpInsn ( IFEQ , l0 ) ; mv . visitFieldInsn ( GETSTATIC , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; Label l1 = new Label ( ) ; mv . visitJumpInsn ( GOTO , l1 ) ; mv . visitLabel ( l0 ) ; mv . visitFieldInsn ( GETSTATIC , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitLabel ( l1 ) ; } public void negateBoolean ( ) { Label endLabel = new Label ( ) ; Label falseLabel = new Label ( ) ; mv . visitJumpInsn ( IFNE , falseLabel ) ; mv . visitInsn ( ICONST_1 ) ; mv . visitJumpInsn ( GOTO , endLabel ) ; mv . visitLabel ( falseLabel ) ; mv . visitInsn ( ICONST_0 ) ; mv . visitLabel ( endLabel ) ; } public void mark ( String msg ) { mv . visitLdcInsn ( msg ) ; mv . visitInsn ( POP ) ; } public static String formatNameForClassLoading ( String name ) { if ( name . equals ( "<STR_LIT:int>" ) || name . equals ( "<STR_LIT:long>" ) || name . equals ( "<STR_LIT>" ) || name . equals ( "<STR_LIT:float>" ) || name . equals ( "<STR_LIT:double>" ) || name . equals ( "<STR_LIT>" ) || name . equals ( "<STR_LIT>" ) || name . equals ( "<STR_LIT:boolean>" ) || name . equals ( "<STR_LIT>" ) ) { return name ; } if ( name == null ) { return "<STR_LIT>" ; } if ( name . startsWith ( "<STR_LIT:[>" ) ) { return name . replace ( '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ; } if ( name . startsWith ( "<STR_LIT>" ) ) { name = name . substring ( <NUM_LIT:1> ) ; if ( name . endsWith ( "<STR_LIT:;>" ) ) { name = name . substring ( <NUM_LIT:0> , name . length ( ) - <NUM_LIT:1> ) ; } return name . replace ( '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ; } String prefix = "<STR_LIT>" ; if ( name . endsWith ( "<STR_LIT:[]>" ) ) { prefix = "<STR_LIT:[>" ; name = name . substring ( <NUM_LIT:0> , name . length ( ) - <NUM_LIT:2> ) ; if ( name . equals ( "<STR_LIT:int>" ) ) { return prefix + "<STR_LIT:I>" ; } else if ( name . equals ( "<STR_LIT:long>" ) ) { return prefix + "<STR_LIT>" ; } else if ( name . equals ( "<STR_LIT>" ) ) { return prefix + "<STR_LIT:S>" ; } else if ( name . equals ( "<STR_LIT:float>" ) ) { return prefix + "<STR_LIT:F>" ; } else if ( name . equals ( "<STR_LIT:double>" ) ) { return prefix + "<STR_LIT:D>" ; } else if ( name . equals ( "<STR_LIT>" ) ) { return prefix + "<STR_LIT:B>" ; } else if ( name . equals ( "<STR_LIT>" ) ) { return prefix + "<STR_LIT:C>" ; } else if ( name . equals ( "<STR_LIT:boolean>" ) ) { return prefix + "<STR_LIT:Z>" ; } else { return prefix + "<STR_LIT>" + name . replace ( '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) + "<STR_LIT:;>" ; } } return name . replace ( '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ; } public void dup ( ) { mv . visitInsn ( DUP ) ; } public void doReturn ( ClassNode returnType ) { if ( returnType == ClassHelper . double_TYPE ) { mv . visitInsn ( DRETURN ) ; } else if ( returnType == ClassHelper . float_TYPE ) { mv . visitInsn ( FRETURN ) ; } else if ( returnType == ClassHelper . long_TYPE ) { mv . visitInsn ( LRETURN ) ; } else if ( returnType == ClassHelper . boolean_TYPE || returnType == ClassHelper . char_TYPE || returnType == ClassHelper . byte_TYPE || returnType == ClassHelper . int_TYPE || returnType == ClassHelper . short_TYPE ) { mv . visitInsn ( IRETURN ) ; } else if ( returnType == ClassHelper . VOID_TYPE ) { mv . visitInsn ( RETURN ) ; } else { mv . visitInsn ( ARETURN ) ; } } private static boolean hasGenerics ( Parameter [ ] param ) { if ( param . length == <NUM_LIT:0> ) return false ; for ( int i = <NUM_LIT:0> ; i < param . length ; i ++ ) { ClassNode type = param [ i ] . getType ( ) ; if ( type . getGenericsTypes ( ) != null ) return true ; } return false ; } public static String getGenericsMethodSignature ( MethodNode node ) { GenericsType [ ] generics = node . getGenericsTypes ( ) ; Parameter [ ] param = node . getParameters ( ) ; ClassNode returnType = node . getReturnType ( ) ; if ( generics == null && ! hasGenerics ( param ) && returnType . getGenericsTypes ( ) == null ) return null ; StringBuffer ret = new StringBuffer ( <NUM_LIT:100> ) ; getGenericsTypeSpec ( ret , generics ) ; GenericsType [ ] paramTypes = new GenericsType [ param . length ] ; for ( int i = <NUM_LIT:0> ; i < param . length ; i ++ ) { ClassNode pType = param [ i ] . getType ( ) ; if ( pType . getGenericsTypes ( ) == null || ! pType . isGenericsPlaceHolder ( ) ) { paramTypes [ i ] = new GenericsType ( pType ) ; } else { paramTypes [ i ] = pType . getGenericsTypes ( ) [ <NUM_LIT:0> ] ; } } addSubTypes ( ret , paramTypes , "<STR_LIT:(>" , "<STR_LIT:)>" ) ; if ( returnType . isGenericsPlaceHolder ( ) ) { addSubTypes ( ret , returnType . getGenericsTypes ( ) , "<STR_LIT>" , "<STR_LIT>" ) ; } else { writeGenericsBounds ( ret , new GenericsType ( returnType ) , false ) ; } return ret . toString ( ) ; } private static boolean usesGenericsInClassSignature ( ClassNode node ) { if ( ! node . isUsingGenerics ( ) ) return false ; if ( node . getGenericsTypes ( ) != null ) return true ; ClassNode sclass = node . getUnresolvedSuperClass ( false ) ; if ( sclass . isUsingGenerics ( ) ) return true ; ClassNode [ ] interfaces = node . getInterfaces ( ) ; if ( interfaces != null ) { for ( int i = <NUM_LIT:0> ; i < interfaces . length ; i ++ ) { if ( interfaces [ i ] . isUsingGenerics ( ) ) return true ; } } return false ; } public static String getGenericsSignature ( ClassNode node ) { if ( ! usesGenericsInClassSignature ( node ) ) return null ; GenericsType [ ] genericsTypes = node . getGenericsTypes ( ) ; StringBuffer ret = new StringBuffer ( <NUM_LIT:100> ) ; getGenericsTypeSpec ( ret , genericsTypes ) ; GenericsType extendsPart = new GenericsType ( node . getUnresolvedSuperClass ( false ) ) ; writeGenericsBounds ( ret , extendsPart , true ) ; ClassNode [ ] interfaces = node . getInterfaces ( ) ; for ( int i = <NUM_LIT:0> ; i < interfaces . length ; i ++ ) { GenericsType interfacePart = new GenericsType ( interfaces [ i ] ) ; writeGenericsBounds ( ret , interfacePart , false ) ; } return ret . toString ( ) ; } private static void getGenericsTypeSpec ( StringBuffer ret , GenericsType [ ] genericsTypes ) { if ( genericsTypes == null ) return ; ret . append ( '<CHAR_LIT>' ) ; for ( int i = <NUM_LIT:0> ; i < genericsTypes . length ; i ++ ) { String name = genericsTypes [ i ] . getName ( ) ; ret . append ( name ) ; ret . append ( '<CHAR_LIT::>' ) ; writeGenericsBounds ( ret , genericsTypes [ i ] , true ) ; } ret . append ( '<CHAR_LIT:>>' ) ; } public static String getGenericsBounds ( ClassNode type ) { GenericsType [ ] genericsTypes = type . getGenericsTypes ( ) ; if ( genericsTypes == null ) return null ; StringBuffer ret = new StringBuffer ( <NUM_LIT:100> ) ; if ( type . isGenericsPlaceHolder ( ) ) { addSubTypes ( ret , type . getGenericsTypes ( ) , "<STR_LIT>" , "<STR_LIT>" ) ; } else { GenericsType gt = new GenericsType ( type ) ; writeGenericsBounds ( ret , gt , false ) ; } return ret . toString ( ) ; } private static void writeGenericsBoundType ( StringBuffer ret , ClassNode printType , boolean writeInterfaceMarker ) { if ( writeInterfaceMarker && printType . isInterface ( ) ) ret . append ( "<STR_LIT::>" ) ; ret . append ( getTypeDescription ( printType , false ) ) ; addSubTypes ( ret , printType . getGenericsTypes ( ) , "<STR_LIT:<>" , "<STR_LIT:>>" ) ; if ( ! ClassHelper . isPrimitiveType ( printType ) ) ret . append ( "<STR_LIT:;>" ) ; } private static void writeGenericsBounds ( StringBuffer ret , GenericsType type , boolean writeInterfaceMarker ) { if ( type . getUpperBounds ( ) != null ) { ClassNode [ ] bounds = type . getUpperBounds ( ) ; for ( int i = <NUM_LIT:0> ; i < bounds . length ; i ++ ) { writeGenericsBoundType ( ret , bounds [ i ] , writeInterfaceMarker ) ; } } else if ( type . getLowerBound ( ) != null ) { writeGenericsBoundType ( ret , type . getLowerBound ( ) , writeInterfaceMarker ) ; } else { writeGenericsBoundType ( ret , type . getType ( ) , writeInterfaceMarker ) ; } } private static void addSubTypes ( StringBuffer ret , GenericsType [ ] types , String start , String end ) { if ( types == null ) return ; ret . append ( start ) ; for ( int i = <NUM_LIT:0> ; i < types . length ; i ++ ) { String name = types [ i ] . getName ( ) ; if ( types [ i ] . isPlaceholder ( ) ) { ret . append ( '<CHAR_LIT>' ) ; ret . append ( name ) ; ret . append ( '<CHAR_LIT:;>' ) ; } else if ( types [ i ] . isWildcard ( ) ) { if ( types [ i ] . getUpperBounds ( ) != null ) { ret . append ( '<CHAR_LIT>' ) ; writeGenericsBounds ( ret , types [ i ] , false ) ; } else if ( types [ i ] . getLowerBound ( ) != null ) { ret . append ( '<CHAR_LIT:->' ) ; writeGenericsBounds ( ret , types [ i ] , false ) ; } else { ret . append ( '<CHAR_LIT>' ) ; } } else { writeGenericsBounds ( ret , types [ i ] , false ) ; } } ret . append ( end ) ; } } </s>
|
<s> package org . codehaus . groovy . classgen ; import java . util . * ; import org . codehaus . groovy . ast . * ; import org . codehaus . groovy . ast . stmt . ReturnStatement ; import org . codehaus . groovy . ast . expr . * ; import org . codehaus . groovy . control . ErrorCollector ; import org . codehaus . groovy . control . SourceUnit ; import org . codehaus . groovy . control . messages . SyntaxErrorMessage ; import org . codehaus . groovy . syntax . SyntaxException ; import org . codehaus . groovy . vmplugin . VMPluginFactory ; public class AnnotationVisitor { private SourceUnit source ; private ErrorCollector errorCollector ; private AnnotationNode annotation ; private ClassNode reportClass ; public AnnotationVisitor ( SourceUnit source , ErrorCollector errorCollector ) { this . source = source ; this . errorCollector = errorCollector ; } public void setReportClass ( ClassNode cn ) { reportClass = cn ; } public AnnotationNode visit ( AnnotationNode node ) { this . annotation = node ; this . reportClass = node . getClassNode ( ) ; if ( ! isValidAnnotationClass ( node . getClassNode ( ) ) ) { addError ( "<STR_LIT>" + node . getClassNode ( ) . getName ( ) + "<STR_LIT>" ) ; return node ; } Map attributes = node . getMembers ( ) ; if ( ! checkIfMandatoryAnnotationValuesPassed ( node ) ) { return node ; } for ( Iterator it = attributes . entrySet ( ) . iterator ( ) ; it . hasNext ( ) ; ) { Map . Entry entry = ( Map . Entry ) it . next ( ) ; String attrName = ( String ) entry . getKey ( ) ; Expression attrExpr = ( Expression ) entry . getValue ( ) ; ClassNode attrType = getAttributeType ( node , attrName ) ; visitExpression ( attrName , attrExpr , attrType ) ; } VMPluginFactory . getPlugin ( ) . configureAnnotation ( node ) ; return this . annotation ; } private boolean checkIfMandatoryAnnotationValuesPassed ( AnnotationNode node ) { boolean ok = true ; Map attributes = node . getMembers ( ) ; List < MethodNode > methods = node . getClassNode ( ) . getMethods ( ) ; for ( MethodNode mn : methods ) { String methodName = mn . getName ( ) ; } return ok ; } private ClassNode getAttributeType ( AnnotationNode node , String attrName ) { List methods = node . getClassNode ( ) . getMethods ( attrName ) ; if ( methods . size ( ) == <NUM_LIT:0> ) { addError ( "<STR_LIT:'>" + attrName + "<STR_LIT>" + node . getClassNode ( ) , node ) ; return ClassHelper . OBJECT_TYPE ; } MethodNode method = ( MethodNode ) methods . get ( <NUM_LIT:0> ) ; return method . getReturnType ( ) ; } private boolean isValidAnnotationClass ( ClassNode node ) { return node . implementsInterface ( ClassHelper . Annotation_TYPE ) ; } protected void visitExpression ( String attrName , Expression attrExp , ClassNode attrType ) { if ( attrType . isArray ( ) ) { if ( attrExp instanceof ListExpression ) { ListExpression le = ( ListExpression ) attrExp ; visitListExpression ( attrName , ( ListExpression ) attrExp , attrType . getComponentType ( ) ) ; } else if ( attrExp instanceof ClosureExpression ) { addError ( "<STR_LIT>" , attrExp ) ; } else { ListExpression listExp = new ListExpression ( ) ; listExp . addExpression ( attrExp ) ; if ( annotation != null ) { annotation . setMember ( attrName , listExp ) ; } visitExpression ( attrName , listExp , attrType ) ; } } else if ( ClassHelper . isPrimitiveType ( attrType ) ) { visitConstantExpression ( attrName , getConstantExpression ( attrExp ) , ClassHelper . getWrapper ( attrType ) ) ; } else if ( ClassHelper . STRING_TYPE . equals ( attrType ) ) { visitConstantExpression ( attrName , getConstantExpression ( attrExp ) , ClassHelper . STRING_TYPE ) ; } else if ( ClassHelper . CLASS_Type . equals ( attrType ) ) { if ( ! ( attrExp instanceof ClassExpression ) ) { addError ( "<STR_LIT>" + attrName + "<STR_LIT:'>" , attrExp ) ; } } else if ( attrType . isDerivedFrom ( ClassHelper . Enum_Type ) ) { if ( attrExp instanceof PropertyExpression ) { visitEnumExpression ( attrName , ( PropertyExpression ) attrExp , attrType ) ; } else { addError ( "<STR_LIT>" + attrName , attrExp ) ; } } else if ( isValidAnnotationClass ( attrType ) ) { if ( attrExp instanceof AnnotationConstantExpression ) { visitAnnotationExpression ( attrName , ( AnnotationConstantExpression ) attrExp , attrType ) ; } else { addError ( "<STR_LIT>" + attrType . getName ( ) + "<STR_LIT>" + attrName , attrExp ) ; } } else { addError ( "<STR_LIT>" + attrType . getName ( ) , attrExp ) ; } } public void checkReturnType ( ClassNode attrType , ASTNode node ) { if ( attrType . isArray ( ) ) { checkReturnType ( attrType . getComponentType ( ) , node ) ; } else if ( ClassHelper . isPrimitiveType ( attrType ) ) { return ; } else if ( ClassHelper . STRING_TYPE . equals ( attrType ) ) { return ; } else if ( ClassHelper . CLASS_Type . equals ( attrType ) ) { return ; } else if ( attrType . isDerivedFrom ( ClassHelper . Enum_Type ) ) { return ; } else if ( isValidAnnotationClass ( attrType ) ) { return ; } else { addError ( "<STR_LIT>" + attrType . getName ( ) , node ) ; } } private ConstantExpression getConstantExpression ( Expression exp ) { if ( exp instanceof ConstantExpression ) { return ( ConstantExpression ) exp ; } else { addError ( "<STR_LIT>" , exp ) ; return ConstantExpression . EMTPY_EXPRESSION ; } } protected void visitAnnotationExpression ( String attrName , AnnotationConstantExpression expression , ClassNode attrType ) { AnnotationNode annotationNode = ( AnnotationNode ) expression . getValue ( ) ; AnnotationVisitor visitor = new AnnotationVisitor ( this . source , this . errorCollector ) ; visitor . visit ( annotationNode ) ; } protected void visitListExpression ( String attrName , ListExpression listExpr , ClassNode elementType ) { List expressions = listExpr . getExpressions ( ) ; for ( int i = <NUM_LIT:0> ; i < expressions . size ( ) ; i ++ ) { visitExpression ( attrName , ( Expression ) expressions . get ( i ) , elementType ) ; } } protected void visitConstantExpression ( String attrName , ConstantExpression constExpr , ClassNode attrType ) { if ( ! constExpr . getType ( ) . isDerivedFrom ( attrType ) ) { addError ( "<STR_LIT>" + attrName + "<STR_LIT>" + attrType . getName ( ) + "<STR_LIT>" + "<STR_LIT>" + constExpr . getType ( ) . getName ( ) + "<STR_LIT:'>" , constExpr ) ; } } protected void visitEnumExpression ( String attrName , PropertyExpression propExpr , ClassNode attrType ) { if ( ! propExpr . getObjectExpression ( ) . getType ( ) . isDerivedFrom ( attrType ) ) { addError ( "<STR_LIT>" + attrName + "<STR_LIT>" + attrType . getName ( ) + "<STR_LIT>" + propExpr . getObjectExpression ( ) . getType ( ) . getName ( ) , propExpr ) ; } } protected void addError ( String msg ) { addError ( msg , this . annotation ) ; } protected void addError ( String msg , ASTNode expr ) { this . errorCollector . addErrorAndContinue ( new SyntaxErrorMessage ( new SyntaxException ( msg + "<STR_LIT>" + this . reportClass . getName ( ) + '<STR_LIT:\n>' , expr . getLineNumber ( ) , expr . getColumnNumber ( ) ) , this . source ) ) ; } public void checkcircularReference ( ClassNode searchClass , ClassNode attrType , Expression startExp ) { if ( ! isValidAnnotationClass ( attrType ) ) return ; AnnotationConstantExpression ace = ( AnnotationConstantExpression ) startExp ; AnnotationNode annotationNode = ( AnnotationNode ) ace . getValue ( ) ; if ( annotationNode . getClassNode ( ) . equals ( searchClass ) ) { addError ( "<STR_LIT>" + searchClass . getName ( ) , startExp ) ; return ; } ClassNode cn = annotationNode . getClassNode ( ) ; List methods = cn . getMethods ( ) ; for ( Iterator it = methods . iterator ( ) ; it . hasNext ( ) ; ) { MethodNode method = ( MethodNode ) it . next ( ) ; if ( method . getReturnType ( ) . equals ( searchClass ) ) { addError ( "<STR_LIT>" + cn . getName ( ) , startExp ) ; } ReturnStatement code = ( ReturnStatement ) method . getCode ( ) ; if ( code == null ) continue ; checkcircularReference ( searchClass , method . getReturnType ( ) , code . getExpression ( ) ) ; } } } </s>
|
<s> package org . codehaus . groovy . classgen ; import org . codehaus . groovy . GroovyBugError ; import org . codehaus . groovy . ast . ClassHelper ; import org . codehaus . groovy . ast . ClassNode ; import org . codehaus . groovy . ast . Parameter ; import org . codehaus . groovy . ast . VariableScope ; import org . objectweb . asm . Label ; import org . objectweb . asm . MethodVisitor ; import org . objectweb . asm . Opcodes ; import java . util . * ; public class CompileStack implements Opcodes { private boolean clear = true ; private VariableScope scope ; private Label continueLabel ; private Label breakLabel ; private Map stackVariables = new HashMap ( ) ; private int currentVariableIndex = <NUM_LIT:1> ; private int nextVariableIndex = <NUM_LIT:1> ; private final LinkedList temporaryVariables = new LinkedList ( ) ; private final LinkedList usedVariables = new LinkedList ( ) ; private Map superBlockNamedLabels = new HashMap ( ) ; private Map currentBlockNamedLabels = new HashMap ( ) ; private LinkedList finallyBlocks = new LinkedList ( ) ; private final List visitedBlocks = new LinkedList ( ) ; private Label thisStartLabel , thisEndLabel ; private MethodVisitor mv ; private BytecodeHelper helper ; private final LinkedList stateStack = new LinkedList ( ) ; private int localVariableOffset ; private final Map namedLoopBreakLabel = new HashMap ( ) ; private final Map namedLoopContinueLabel = new HashMap ( ) ; private String className ; private class StateStackElement { final VariableScope scope ; final Label continueLabel ; final Label breakLabel ; Label finallyLabel ; final int lastVariableIndex ; final int nextVariableIndex ; final Map stackVariables ; List temporaryVariables = new LinkedList ( ) ; List usedVariables = new LinkedList ( ) ; final Map superBlockNamedLabels ; final Map currentBlockNamedLabels ; final LinkedList finallyBlocks ; StateStackElement ( ) { scope = CompileStack . this . scope ; continueLabel = CompileStack . this . continueLabel ; breakLabel = CompileStack . this . breakLabel ; lastVariableIndex = CompileStack . this . currentVariableIndex ; stackVariables = CompileStack . this . stackVariables ; temporaryVariables = CompileStack . this . temporaryVariables ; nextVariableIndex = CompileStack . this . nextVariableIndex ; superBlockNamedLabels = CompileStack . this . superBlockNamedLabels ; currentBlockNamedLabels = CompileStack . this . currentBlockNamedLabels ; finallyBlocks = CompileStack . this . finallyBlocks ; } } protected void pushState ( ) { stateStack . add ( new StateStackElement ( ) ) ; stackVariables = new HashMap ( stackVariables ) ; finallyBlocks = new LinkedList ( finallyBlocks ) ; } private void popState ( ) { if ( stateStack . size ( ) == <NUM_LIT:0> ) { throw new GroovyBugError ( "<STR_LIT>" ) ; } StateStackElement element = ( StateStackElement ) stateStack . removeLast ( ) ; scope = element . scope ; continueLabel = element . continueLabel ; breakLabel = element . breakLabel ; currentVariableIndex = element . lastVariableIndex ; stackVariables = element . stackVariables ; nextVariableIndex = element . nextVariableIndex ; finallyBlocks = element . finallyBlocks ; } public Label getContinueLabel ( ) { return continueLabel ; } public Label getBreakLabel ( ) { return breakLabel ; } public void removeVar ( int tempIndex ) { final Variable head = ( Variable ) temporaryVariables . removeFirst ( ) ; if ( head . getIndex ( ) != tempIndex ) throw new GroovyBugError ( "<STR_LIT>" ) ; currentVariableIndex = head . getPrevIndex ( ) ; nextVariableIndex = tempIndex ; } private void setEndLabels ( ) { Label endLabel = new Label ( ) ; mv . visitLabel ( endLabel ) ; for ( Iterator iter = stackVariables . values ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { Variable var = ( Variable ) iter . next ( ) ; var . setEndLabel ( endLabel ) ; } thisEndLabel = endLabel ; } public void pop ( ) { setEndLabels ( ) ; popState ( ) ; } public VariableScope getScope ( ) { return scope ; } public int defineTemporaryVariable ( org . codehaus . groovy . ast . Variable var , boolean store ) { return defineTemporaryVariable ( var . getName ( ) , var . getType ( ) , store ) ; } public Variable getVariable ( String variableName ) { return getVariable ( variableName , true ) ; } public Variable getVariable ( String variableName , boolean mustExist ) { if ( variableName . equals ( "<STR_LIT>" ) ) return Variable . THIS_VARIABLE ; if ( variableName . equals ( "<STR_LIT>" ) ) return Variable . SUPER_VARIABLE ; Variable v = ( Variable ) stackVariables . get ( variableName ) ; if ( v == null && mustExist ) throw new GroovyBugError ( "<STR_LIT>" + variableName + "<STR_LIT>" ) ; return v ; } public int defineTemporaryVariable ( String name , boolean store ) { return defineTemporaryVariable ( name , ClassHelper . DYNAMIC_TYPE , store ) ; } public int defineTemporaryVariable ( String name , ClassNode node , boolean store ) { Variable answer = defineVar ( name , node , false ) ; temporaryVariables . addFirst ( answer ) ; usedVariables . removeLast ( ) ; if ( store ) mv . visitVarInsn ( ASTORE , currentVariableIndex ) ; return answer . getIndex ( ) ; } private void resetVariableIndex ( boolean isStatic ) { if ( ! isStatic ) { currentVariableIndex = <NUM_LIT:1> ; nextVariableIndex = <NUM_LIT:1> ; } else { currentVariableIndex = <NUM_LIT:0> ; nextVariableIndex = <NUM_LIT:0> ; } } public void clear ( ) { if ( stateStack . size ( ) > <NUM_LIT:1> ) { int size = stateStack . size ( ) - <NUM_LIT:1> ; throw new GroovyBugError ( "<STR_LIT>" + size + "<STR_LIT>" + ( size == <NUM_LIT:1> ? "<STR_LIT>" : "<STR_LIT:s>" ) + "<STR_LIT>" ) ; } clear = true ; if ( true ) { if ( thisEndLabel == null ) setEndLabels ( ) ; if ( ! scope . isInStaticContext ( ) ) { mv . visitLocalVariable ( "<STR_LIT>" , className , null , thisStartLabel , thisEndLabel , <NUM_LIT:0> ) ; } for ( Iterator iterator = usedVariables . iterator ( ) ; iterator . hasNext ( ) ; ) { Variable v = ( Variable ) iterator . next ( ) ; String type = BytecodeHelper . getTypeDescription ( v . getType ( ) ) ; Label start = v . getStartLabel ( ) ; Label end = v . getEndLabel ( ) ; if ( start != null && end != null ) mv . visitLocalVariable ( v . getName ( ) , type , null , start , end , v . getIndex ( ) ) ; } } pop ( ) ; stackVariables . clear ( ) ; usedVariables . clear ( ) ; scope = null ; mv = null ; resetVariableIndex ( false ) ; superBlockNamedLabels . clear ( ) ; currentBlockNamedLabels . clear ( ) ; namedLoopBreakLabel . clear ( ) ; namedLoopContinueLabel . clear ( ) ; continueLabel = null ; breakLabel = null ; helper = null ; thisStartLabel = null ; thisEndLabel = null ; } protected void init ( VariableScope el , Parameter [ ] parameters , MethodVisitor mv , ClassNode cn ) { if ( ! clear ) throw new GroovyBugError ( "<STR_LIT>" ) ; clear = false ; pushVariableScope ( el ) ; this . mv = mv ; this . helper = new BytecodeHelper ( mv ) ; defineMethodVariables ( parameters , el . isInStaticContext ( ) ) ; this . className = BytecodeHelper . getTypeDescription ( cn ) ; } protected void pushVariableScope ( VariableScope el ) { pushState ( ) ; scope = el ; superBlockNamedLabels = new HashMap ( superBlockNamedLabels ) ; superBlockNamedLabels . putAll ( currentBlockNamedLabels ) ; currentBlockNamedLabels = new HashMap ( ) ; } protected void pushLoop ( VariableScope el , String labelName ) { pushVariableScope ( el ) ; initLoopLabels ( labelName ) ; } private void initLoopLabels ( String labelName ) { continueLabel = new Label ( ) ; breakLabel = new Label ( ) ; if ( labelName != null ) { namedLoopBreakLabel . put ( labelName , breakLabel ) ; namedLoopContinueLabel . put ( labelName , continueLabel ) ; } } protected void pushLoop ( String labelName ) { pushState ( ) ; initLoopLabels ( labelName ) ; } protected Label getNamedBreakLabel ( String name ) { Label label = getBreakLabel ( ) ; Label endLabel = null ; if ( name != null ) endLabel = ( Label ) namedLoopBreakLabel . get ( name ) ; if ( endLabel != null ) label = endLabel ; return label ; } protected Label getNamedContinueLabel ( String name ) { Label label = getLabel ( name ) ; Label endLabel = null ; if ( name != null ) endLabel = ( Label ) namedLoopContinueLabel . get ( name ) ; if ( endLabel != null ) label = endLabel ; return label ; } protected Label pushSwitch ( ) { pushState ( ) ; breakLabel = new Label ( ) ; return breakLabel ; } protected void pushBooleanExpression ( ) { pushState ( ) ; } private Variable defineVar ( String name , ClassNode type , boolean methodParameterUsedInClosure ) { int prevCurrent = currentVariableIndex ; makeNextVariableID ( type ) ; int index = currentVariableIndex ; if ( methodParameterUsedInClosure ) { index = localVariableOffset ++ ; type = ClassHelper . getWrapper ( type ) ; } Variable answer = new Variable ( index , type , name , prevCurrent ) ; usedVariables . add ( answer ) ; answer . setHolder ( methodParameterUsedInClosure ) ; return answer ; } private void makeLocalVariablesOffset ( Parameter [ ] paras , boolean isInStaticContext ) { resetVariableIndex ( isInStaticContext ) ; for ( int i = <NUM_LIT:0> ; i < paras . length ; i ++ ) { makeNextVariableID ( paras [ i ] . getType ( ) ) ; } localVariableOffset = nextVariableIndex ; resetVariableIndex ( isInStaticContext ) ; } private void defineMethodVariables ( Parameter [ ] paras , boolean isInStaticContext ) { Label startLabel = new Label ( ) ; thisStartLabel = startLabel ; mv . visitLabel ( startLabel ) ; makeLocalVariablesOffset ( paras , isInStaticContext ) ; boolean hasHolder = false ; for ( int i = <NUM_LIT:0> ; i < paras . length ; i ++ ) { String name = paras [ i ] . getName ( ) ; Variable answer ; ClassNode type = paras [ i ] . getType ( ) ; if ( paras [ i ] . isClosureSharedVariable ( ) ) { answer = defineVar ( name , type , true ) ; helper . load ( type , currentVariableIndex ) ; helper . box ( type ) ; createReference ( answer ) ; hasHolder = true ; } else { answer = defineVar ( name , type , false ) ; } answer . setStartLabel ( startLabel ) ; stackVariables . put ( name , answer ) ; } if ( hasHolder ) { nextVariableIndex = localVariableOffset ; } } private void createReference ( Variable reference ) { mv . visitTypeInsn ( NEW , "<STR_LIT>" ) ; mv . visitInsn ( DUP_X1 ) ; mv . visitInsn ( SWAP ) ; mv . visitMethodInsn ( INVOKESPECIAL , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitVarInsn ( ASTORE , reference . getIndex ( ) ) ; } public Variable defineVariable ( org . codehaus . groovy . ast . Variable v , boolean initFromStack ) { String name = v . getName ( ) ; Variable answer = defineVar ( name , v . getType ( ) , false ) ; if ( v . isClosureSharedVariable ( ) ) answer . setHolder ( true ) ; stackVariables . put ( name , answer ) ; Label startLabel = new Label ( ) ; answer . setStartLabel ( startLabel ) ; if ( answer . isHolder ( ) ) { if ( ! initFromStack ) mv . visitInsn ( ACONST_NULL ) ; createReference ( answer ) ; } else { if ( ! initFromStack ) mv . visitInsn ( ACONST_NULL ) ; mv . visitVarInsn ( ASTORE , currentVariableIndex ) ; } mv . visitLabel ( startLabel ) ; return answer ; } public boolean containsVariable ( String name ) { return stackVariables . containsKey ( name ) ; } private void makeNextVariableID ( ClassNode type ) { currentVariableIndex = nextVariableIndex ; if ( type == ClassHelper . long_TYPE || type == ClassHelper . double_TYPE ) { nextVariableIndex ++ ; } nextVariableIndex ++ ; } public Label getLabel ( String name ) { if ( name == null ) return null ; Label l = ( Label ) superBlockNamedLabels . get ( name ) ; if ( l == null ) l = createLocalLabel ( name ) ; return l ; } public Label createLocalLabel ( String name ) { Label l = ( Label ) currentBlockNamedLabels . get ( name ) ; if ( l == null ) { l = new Label ( ) ; currentBlockNamedLabels . put ( name , l ) ; } return l ; } public void applyFinallyBlocks ( Label label , boolean isBreakLabel ) { StateStackElement result = null ; for ( ListIterator iter = stateStack . listIterator ( stateStack . size ( ) ) ; iter . hasPrevious ( ) ; ) { StateStackElement element = ( StateStackElement ) iter . previous ( ) ; if ( ! element . currentBlockNamedLabels . values ( ) . contains ( label ) ) { if ( isBreakLabel && element . breakLabel != label ) { result = element ; break ; } if ( ! isBreakLabel && element . continueLabel != label ) { result = element ; break ; } } } List blocksToRemove ; if ( result == null ) { blocksToRemove = Collections . EMPTY_LIST ; } else { blocksToRemove = result . finallyBlocks ; } ArrayList blocks = new ArrayList ( finallyBlocks ) ; blocks . removeAll ( blocksToRemove ) ; applyFinallyBlocks ( blocks ) ; } private void applyFinallyBlocks ( List blocks ) { for ( Iterator iter = blocks . iterator ( ) ; iter . hasNext ( ) ; ) { Runnable block = ( Runnable ) iter . next ( ) ; if ( visitedBlocks . contains ( block ) ) continue ; block . run ( ) ; } } public void applyFinallyBlocks ( ) { applyFinallyBlocks ( finallyBlocks ) ; } public boolean hasFinallyBlocks ( ) { return ! finallyBlocks . isEmpty ( ) ; } public void pushFinallyBlock ( Runnable block ) { finallyBlocks . addFirst ( block ) ; pushState ( ) ; } public void popFinallyBlock ( ) { popState ( ) ; finallyBlocks . removeFirst ( ) ; } public void pushFinallyBlockVisit ( Runnable block ) { visitedBlocks . add ( block ) ; } public void popFinallyBlockVisit ( Runnable block ) { visitedBlocks . remove ( block ) ; } } </s>
|
<s> package org . codehaus . groovy . classgen ; import java . util . Iterator ; import java . util . List ; import org . codehaus . groovy . ast . ASTNode ; import org . codehaus . groovy . ast . AnnotatedNode ; import org . codehaus . groovy . ast . AnnotationNode ; import org . codehaus . groovy . ast . ClassNode ; import org . codehaus . groovy . ast . ConstructorNode ; import org . codehaus . groovy . ast . FieldNode ; import org . codehaus . groovy . ast . GenericsType ; import org . codehaus . groovy . ast . GroovyClassVisitor ; import org . codehaus . groovy . ast . MethodNode ; import org . codehaus . groovy . ast . Parameter ; import org . codehaus . groovy . ast . PropertyNode ; import org . codehaus . groovy . ast . stmt . ReturnStatement ; import org . codehaus . groovy . control . CompilerConfiguration ; import org . codehaus . groovy . control . ErrorCollector ; import org . codehaus . groovy . control . SourceUnit ; import org . codehaus . groovy . control . messages . SyntaxErrorMessage ; import org . codehaus . groovy . syntax . PreciseSyntaxException ; import org . codehaus . groovy . syntax . SyntaxException ; import org . objectweb . asm . Opcodes ; public class ExtendedVerifier implements GroovyClassVisitor { public static final String JVM_ERROR_MESSAGE = "<STR_LIT>" ; private SourceUnit source ; private ClassNode currentClass ; public ExtendedVerifier ( SourceUnit sourceUnit ) { this . source = sourceUnit ; } public void visitClass ( ClassNode node ) { this . currentClass = node ; if ( node . isAnnotationDefinition ( ) ) { visitAnnotations ( node , AnnotationNode . ANNOTATION_TARGET ) ; } else { visitAnnotations ( node , AnnotationNode . TYPE_TARGET ) ; } node . visitContents ( this ) ; } public void visitField ( FieldNode node ) { visitAnnotations ( node , AnnotationNode . FIELD_TARGET ) ; } public void visitConstructor ( ConstructorNode node ) { visitConstructorOrMethod ( node , AnnotationNode . CONSTRUCTOR_TARGET ) ; } public void visitMethod ( MethodNode node ) { visitConstructorOrMethod ( node , AnnotationNode . METHOD_TARGET ) ; } private void visitConstructorOrMethod ( MethodNode node , int methodTarget ) { visitAnnotations ( node , methodTarget ) ; for ( int i = <NUM_LIT:0> ; i < node . getParameters ( ) . length ; i ++ ) { Parameter parameter = node . getParameters ( ) [ i ] ; visitAnnotations ( parameter , AnnotationNode . PARAMETER_TARGET ) ; } if ( this . currentClass . isAnnotationDefinition ( ) ) { ErrorCollector errorCollector = new ErrorCollector ( this . source . getConfiguration ( ) ) ; AnnotationVisitor visitor = new AnnotationVisitor ( this . source , errorCollector ) ; visitor . setReportClass ( currentClass ) ; visitor . checkReturnType ( node . getReturnType ( ) , node ) ; if ( node . getParameters ( ) . length > <NUM_LIT:0> ) { addError ( "<STR_LIT>" , node . getParameters ( ) [ <NUM_LIT:0> ] ) ; } if ( node . getExceptions ( ) . length > <NUM_LIT:0> ) { addError ( "<STR_LIT>" , node . getExceptions ( ) [ <NUM_LIT:0> ] ) ; } ReturnStatement code = ( ReturnStatement ) node . getCode ( ) ; if ( code != null ) { visitor . visitExpression ( node . getName ( ) , code . getExpression ( ) , node . getReturnType ( ) ) ; visitor . checkcircularReference ( currentClass , node . getReturnType ( ) , code . getExpression ( ) ) ; } this . source . getErrorCollector ( ) . addCollectorContents ( errorCollector ) ; } } public void visitProperty ( PropertyNode node ) { } protected void visitAnnotations ( AnnotatedNode node , int target ) { if ( node . getAnnotations ( ) . isEmpty ( ) ) { return ; } this . currentClass . setAnnotated ( true ) ; if ( ! isAnnotationCompatible ( ) ) { addError ( "<STR_LIT>" + JVM_ERROR_MESSAGE , node ) ; return ; } List annos = node . getAnnotations ( ) ; for ( Iterator iterator = annos . iterator ( ) ; iterator . hasNext ( ) ; ) { AnnotationNode unvisited = ( AnnotationNode ) iterator . next ( ) ; AnnotationNode visited = visitAnnotation ( unvisited ) ; boolean isTargetAnnotation = visited . getClassNode ( ) . isResolved ( ) && visited . getClassNode ( ) . getName ( ) . equals ( "<STR_LIT>" ) ; if ( ! isTargetAnnotation && ! visited . isTargetAllowed ( target ) ) { addError ( "<STR_LIT>" + visited . getClassNode ( ) . getName ( ) + "<STR_LIT>" + AnnotationNode . targetToName ( target ) , visited ) ; } visitDeprecation ( node , visited ) ; } } private void visitDeprecation ( AnnotatedNode node , AnnotationNode visited ) { if ( visited . getClassNode ( ) . isResolved ( ) && visited . getClassNode ( ) . getName ( ) . equals ( "<STR_LIT>" ) ) { if ( node instanceof MethodNode ) { MethodNode mn = ( MethodNode ) node ; mn . setModifiers ( mn . getModifiers ( ) | Opcodes . ACC_DEPRECATED ) ; } else if ( node instanceof FieldNode ) { FieldNode fn = ( FieldNode ) node ; fn . setModifiers ( fn . getModifiers ( ) | Opcodes . ACC_DEPRECATED ) ; } else if ( node instanceof ClassNode ) { ClassNode cn = ( ClassNode ) node ; cn . setModifiers ( cn . getModifiers ( ) | Opcodes . ACC_DEPRECATED ) ; } } } private AnnotationNode visitAnnotation ( AnnotationNode node ) { ErrorCollector errorCollector = new ErrorCollector ( this . source . getConfiguration ( ) ) ; AnnotationVisitor visitor = new AnnotationVisitor ( this . source , errorCollector ) ; AnnotationNode solvedAnnotation = visitor . visit ( node ) ; this . source . getErrorCollector ( ) . addCollectorContents ( errorCollector ) ; return solvedAnnotation ; } protected boolean isAnnotationCompatible ( ) { return CompilerConfiguration . POST_JDK5 . equals ( this . source . getConfiguration ( ) . getTargetBytecode ( ) ) ; } protected void addError ( String msg , ASTNode expr ) { if ( expr instanceof AnnotationNode ) { AnnotationNode aNode = ( AnnotationNode ) expr ; this . source . getErrorCollector ( ) . addErrorAndContinue ( new SyntaxErrorMessage ( new PreciseSyntaxException ( msg + '<STR_LIT:\n>' , expr . getLineNumber ( ) , expr . getColumnNumber ( ) , aNode . getStart ( ) , aNode . getEnd ( ) ) , this . source ) ) ; } else { this . source . getErrorCollector ( ) . addErrorAndContinue ( new SyntaxErrorMessage ( new SyntaxException ( msg + '<STR_LIT:\n>' , expr . getLineNumber ( ) , expr . getColumnNumber ( ) ) , this . source ) ) ; } } public void visitGenericType ( GenericsType genericsType ) { } } </s>
|
<s> package org . codehaus . groovy . classgen ; import groovy . lang . GroovyClassLoader ; import groovy . lang . GroovyObject ; import groovy . lang . MetaClass ; import groovy . lang . GroovyObjectSupport ; import org . codehaus . groovy . ast . * ; import org . codehaus . groovy . ast . expr . * ; import org . codehaus . groovy . ast . stmt . * ; import org . codehaus . groovy . runtime . MetaClassHelper ; import org . codehaus . groovy . syntax . RuntimeParserException ; import org . codehaus . groovy . syntax . Token ; import org . codehaus . groovy . syntax . Types ; import org . codehaus . groovy . reflection . ClassInfo ; import org . objectweb . asm . Label ; import org . objectweb . asm . MethodVisitor ; import org . objectweb . asm . Opcodes ; import java . lang . reflect . Field ; import java . lang . reflect . Modifier ; import java . util . * ; public class Verifier implements GroovyClassVisitor , Opcodes { public static final String __TIMESTAMP = "<STR_LIT>" ; public static final String __TIMESTAMP__ = "<STR_LIT>" ; private static final Parameter [ ] INVOKE_METHOD_PARAMS = new Parameter [ ] { new Parameter ( ClassHelper . STRING_TYPE , "<STR_LIT>" ) , new Parameter ( ClassHelper . OBJECT_TYPE , "<STR_LIT>" ) } ; private static final Parameter [ ] SET_PROPERTY_PARAMS = new Parameter [ ] { new Parameter ( ClassHelper . STRING_TYPE , "<STR_LIT>" ) , new Parameter ( ClassHelper . OBJECT_TYPE , "<STR_LIT:value>" ) } ; private static final Parameter [ ] GET_PROPERTY_PARAMS = new Parameter [ ] { new Parameter ( ClassHelper . STRING_TYPE , "<STR_LIT>" ) } ; private static final Parameter [ ] SET_METACLASS_PARAMS = new Parameter [ ] { new Parameter ( ClassHelper . METACLASS_TYPE , "<STR_LIT>" ) } ; private ClassNode classNode ; private MethodNode methodNode ; public ClassNode getClassNode ( ) { return classNode ; } public MethodNode getMethodNode ( ) { return methodNode ; } private FieldNode setMetaClassFieldIfNotExists ( ClassNode node , FieldNode metaClassField ) { if ( metaClassField != null ) return metaClassField ; final String classInternalName = BytecodeHelper . getClassInternalName ( node ) ; metaClassField = node . addField ( "<STR_LIT>" , ACC_PRIVATE | ACC_TRANSIENT | ACC_SYNTHETIC , ClassHelper . METACLASS_TYPE , new BytecodeExpression ( ) { public void visit ( MethodVisitor mv ) { mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; mv . visitInsn ( DUP ) ; mv . visitMethodInsn ( INVOKEVIRTUAL , classInternalName , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitFieldInsn ( PUTFIELD , classInternalName , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; mv . visitFieldInsn ( GETFIELD , classInternalName , "<STR_LIT>" , "<STR_LIT>" ) ; } public ClassNode getType ( ) { return ClassHelper . METACLASS_TYPE ; } } ) ; metaClassField . setSynthetic ( true ) ; return metaClassField ; } private FieldNode getMetaClassField ( ClassNode node ) { FieldNode ret = node . getDeclaredField ( "<STR_LIT>" ) ; if ( ret != null ) return ret ; ClassNode current = node . getSuperClass ( ) ; while ( current != null && ! current . equals ( ClassHelper . OBJECT_TYPE ) ) { ret = current . getDeclaredField ( "<STR_LIT>" ) ; if ( ret != null && ! Modifier . isPrivate ( ret . getModifiers ( ) ) ) return ret ; current = current . getSuperClass ( ) ; } return null ; } public void visitClass ( final ClassNode node ) { this . classNode = node ; if ( ( classNode . getModifiers ( ) & Opcodes . ACC_INTERFACE ) > <NUM_LIT:0> ) { ConstructorNode dummy = new ConstructorNode ( <NUM_LIT:0> , null ) ; addInitialization ( node , dummy ) ; node . visitContents ( this ) ; return ; } ClassNode [ ] classNodes = classNode . getInterfaces ( ) ; List interfaces = new ArrayList ( ) ; for ( int i = <NUM_LIT:0> ; i < classNodes . length ; i ++ ) { ClassNode classNode = classNodes [ i ] ; interfaces . add ( classNode . getName ( ) ) ; } Set interfaceSet = new HashSet ( interfaces ) ; if ( interfaceSet . size ( ) != interfaces . size ( ) ) { throw new RuntimeParserException ( "<STR_LIT>" + interfaces , classNode ) ; } for ( Object intf : interfaces ) { String intfName = ( String ) intf ; if ( intfName . equals ( node . getName ( ) ) ) { throw new RuntimeParserException ( "<STR_LIT>" + node . getName ( ) + "<STR_LIT>" , classNode ) ; } } addDefaultParameterMethods ( node ) ; addDefaultParameterConstructors ( node ) ; final String classInternalName = BytecodeHelper . getClassInternalName ( node ) ; String _staticClassInfoFieldName = "<STR_LIT>" ; while ( node . getDeclaredField ( _staticClassInfoFieldName ) != null ) _staticClassInfoFieldName = _staticClassInfoFieldName + "<STR_LIT:$>" ; final String staticMetaClassFieldName = _staticClassInfoFieldName ; FieldNode staticMetaClassField = node . addField ( staticMetaClassFieldName , ACC_PRIVATE | ACC_STATIC | ACC_SYNTHETIC , ClassHelper . make ( ClassInfo . class , false ) , null ) ; staticMetaClassField . setSynthetic ( true ) ; node . addSyntheticMethod ( "<STR_LIT>" , ACC_PROTECTED , ClassHelper . make ( MetaClass . class ) , Parameter . EMPTY_ARRAY , ClassNode . EMPTY_ARRAY , new BytecodeSequence ( new BytecodeInstruction ( ) { public void visit ( MethodVisitor mv ) { mv . visitFieldInsn ( GETSTATIC , classInternalName , staticMetaClassFieldName , "<STR_LIT>" ) ; mv . visitVarInsn ( ASTORE , <NUM_LIT:1> ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:1> ) ; Label l0 = new Label ( ) ; mv . visitJumpInsn ( IFNONNULL , l0 ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; mv . visitMethodInsn ( INVOKEVIRTUAL , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitMethodInsn ( INVOKESTATIC , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitInsn ( DUP ) ; mv . visitVarInsn ( ASTORE , <NUM_LIT:1> ) ; mv . visitFieldInsn ( PUTSTATIC , classInternalName , staticMetaClassFieldName , "<STR_LIT>" ) ; mv . visitLabel ( l0 ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:1> ) ; mv . visitMethodInsn ( INVOKEVIRTUAL , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitInsn ( ARETURN ) ; } } ) ) ; boolean knownSpecialCase = node . isDerivedFrom ( ClassHelper . GSTRING_TYPE ) || node . isDerivedFrom ( ClassHelper . make ( GroovyObjectSupport . class ) ) || node . implementsInterface ( ClassHelper . METACLASS_TYPE ) ; if ( ! knownSpecialCase ) { if ( ! node . isDerivedFromGroovyObject ( ) ) node . addInterface ( ClassHelper . make ( GroovyObject . class ) ) ; FieldNode metaClassField = getMetaClassField ( node ) ; if ( ! node . hasMethod ( "<STR_LIT>" , Parameter . EMPTY_ARRAY ) ) { metaClassField = setMetaClassFieldIfNotExists ( node , metaClassField ) ; node . addSyntheticMethod ( "<STR_LIT>" , ACC_PUBLIC | ACC_SYNTHETIC , ClassHelper . METACLASS_TYPE , Parameter . EMPTY_ARRAY , ClassNode . EMPTY_ARRAY , new BytecodeSequence ( new BytecodeInstruction ( ) { public void visit ( MethodVisitor mv ) { Label nullLabel = new Label ( ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; mv . visitFieldInsn ( GETFIELD , classInternalName , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitInsn ( DUP ) ; mv . visitJumpInsn ( IFNULL , nullLabel ) ; mv . visitInsn ( ARETURN ) ; mv . visitLabel ( nullLabel ) ; mv . visitInsn ( POP ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; mv . visitInsn ( DUP ) ; mv . visitMethodInsn ( INVOKEVIRTUAL , classInternalName , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitFieldInsn ( PUTFIELD , classInternalName , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; mv . visitFieldInsn ( GETFIELD , classInternalName , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitInsn ( ARETURN ) ; } } ) ) ; } Parameter [ ] parameters = new Parameter [ ] { new Parameter ( ClassHelper . METACLASS_TYPE , "<STR_LIT>" ) } ; if ( ! node . hasMethod ( "<STR_LIT>" , parameters ) ) { metaClassField = setMetaClassFieldIfNotExists ( node , metaClassField ) ; Statement setMetaClassCode ; if ( Modifier . isFinal ( metaClassField . getModifiers ( ) ) ) { ConstantExpression text = new ConstantExpression ( "<STR_LIT>" ) ; ConstructorCallExpression cce = new ConstructorCallExpression ( ClassHelper . make ( IllegalArgumentException . class ) , text ) ; setMetaClassCode = new ExpressionStatement ( cce ) ; } else { List list = new ArrayList ( ) ; list . add ( new BytecodeInstruction ( ) { public void visit ( MethodVisitor mv ) { mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:1> ) ; mv . visitFieldInsn ( PUTFIELD , classInternalName , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitInsn ( RETURN ) ; } } ) ; setMetaClassCode = new BytecodeSequence ( list ) ; } node . addSyntheticMethod ( "<STR_LIT>" , ACC_PUBLIC , ClassHelper . VOID_TYPE , SET_METACLASS_PARAMS , ClassNode . EMPTY_ARRAY , setMetaClassCode ) ; } if ( ! node . hasMethod ( "<STR_LIT>" , INVOKE_METHOD_PARAMS ) ) { VariableExpression vMethods = new VariableExpression ( "<STR_LIT>" ) ; VariableExpression vArguments = new VariableExpression ( "<STR_LIT>" ) ; VariableScope blockScope = new VariableScope ( ) ; blockScope . putReferencedLocalVariable ( vMethods ) ; blockScope . putReferencedLocalVariable ( vArguments ) ; node . addSyntheticMethod ( "<STR_LIT>" , ACC_PUBLIC , ClassHelper . OBJECT_TYPE , INVOKE_METHOD_PARAMS , ClassNode . EMPTY_ARRAY , new BytecodeSequence ( new BytecodeInstruction ( ) { public void visit ( MethodVisitor mv ) { mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; mv . visitMethodInsn ( INVOKEVIRTUAL , classInternalName , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:1> ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:2> ) ; mv . visitMethodInsn ( INVOKEINTERFACE , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitInsn ( ARETURN ) ; } } ) ) ; } if ( ! node . hasMethod ( "<STR_LIT>" , GET_PROPERTY_PARAMS ) ) { node . addSyntheticMethod ( "<STR_LIT>" , ACC_PUBLIC , ClassHelper . OBJECT_TYPE , GET_PROPERTY_PARAMS , ClassNode . EMPTY_ARRAY , new BytecodeSequence ( new BytecodeInstruction ( ) { public void visit ( MethodVisitor mv ) { mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; mv . visitMethodInsn ( INVOKEVIRTUAL , classInternalName , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:1> ) ; mv . visitMethodInsn ( INVOKEINTERFACE , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitInsn ( ARETURN ) ; } } ) ) ; } if ( ! node . hasMethod ( "<STR_LIT>" , SET_PROPERTY_PARAMS ) ) { node . addSyntheticMethod ( "<STR_LIT>" , ACC_PUBLIC , ClassHelper . VOID_TYPE , SET_PROPERTY_PARAMS , ClassNode . EMPTY_ARRAY , new BytecodeSequence ( new BytecodeInstruction ( ) { public void visit ( MethodVisitor mv ) { mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; mv . visitMethodInsn ( INVOKEVIRTUAL , classInternalName , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:1> ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:2> ) ; mv . visitMethodInsn ( INVOKEINTERFACE , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitInsn ( RETURN ) ; } } ) ) ; } } if ( node . getDeclaredConstructors ( ) . isEmpty ( ) ) { ConstructorNode constructor = new ConstructorNode ( ACC_PUBLIC , null ) ; constructor . setSynthetic ( true ) ; node . addConstructor ( constructor ) ; } if ( ! ( node instanceof InnerClassNode ) ) { addTimeStamp ( node ) ; } addInitialization ( node ) ; checkReturnInObjectInitializer ( node . getObjectInitializerStatements ( ) ) ; node . getObjectInitializerStatements ( ) . clear ( ) ; addCovariantMethods ( node ) ; node . visitContents ( this ) ; } private void addMethod ( ClassNode node , boolean shouldBeSynthetic , String name , int modifiers , ClassNode returnType , Parameter [ ] parameters , ClassNode [ ] exceptions , Statement code ) { if ( shouldBeSynthetic ) { node . addSyntheticMethod ( name , modifiers , returnType , parameters , exceptions , code ) ; } else { node . addMethod ( name , modifiers & ~ ACC_SYNTHETIC , returnType , parameters , exceptions , code ) ; } } protected void addTimeStamp ( ClassNode node ) { FieldNode timeTagField = new FieldNode ( Verifier . __TIMESTAMP , ACC_PUBLIC | ACC_STATIC | ACC_SYNTHETIC , ClassHelper . Long_TYPE , node , new ConstantExpression ( System . currentTimeMillis ( ) ) ) ; timeTagField . setSynthetic ( true ) ; node . addField ( timeTagField ) ; timeTagField = new FieldNode ( Verifier . __TIMESTAMP__ + String . valueOf ( System . currentTimeMillis ( ) ) , ACC_PUBLIC | ACC_STATIC | ACC_SYNTHETIC , ClassHelper . Long_TYPE , node , new ConstantExpression ( ( long ) <NUM_LIT:0> ) ) ; timeTagField . setSynthetic ( true ) ; node . addField ( timeTagField ) ; } private void checkReturnInObjectInitializer ( List init ) { CodeVisitorSupport cvs = new CodeVisitorSupport ( ) { public void visitReturnStatement ( ReturnStatement statement ) { throw new RuntimeParserException ( "<STR_LIT>" , statement ) ; } } ; for ( Iterator iterator = init . iterator ( ) ; iterator . hasNext ( ) ; ) { Statement stm = ( Statement ) iterator . next ( ) ; stm . visit ( cvs ) ; } } public void visitConstructor ( ConstructorNode node ) { CodeVisitorSupport checkSuper = new CodeVisitorSupport ( ) { boolean firstMethodCall = true ; String type = null ; public void visitMethodCallExpression ( MethodCallExpression call ) { if ( ! firstMethodCall ) return ; firstMethodCall = false ; String name = call . getMethodAsString ( ) ; if ( name == null ) return ; if ( ! name . equals ( "<STR_LIT>" ) && ! name . equals ( "<STR_LIT>" ) ) return ; type = name ; call . getArguments ( ) . visit ( this ) ; type = null ; } public void visitConstructorCallExpression ( ConstructorCallExpression call ) { if ( ! call . isSpecialCall ( ) ) return ; type = call . getText ( ) ; call . getArguments ( ) . visit ( this ) ; type = null ; } public void visitVariableExpression ( VariableExpression expression ) { if ( type == null ) return ; String name = expression . getName ( ) ; if ( ! name . equals ( "<STR_LIT>" ) && ! name . equals ( "<STR_LIT>" ) ) return ; throw new RuntimeParserException ( "<STR_LIT>" + name + "<STR_LIT>" + type + "<STR_LIT>" , expression ) ; } } ; Statement s = node . getCode ( ) ; if ( s != null ) { s . visit ( new VerifierCodeVisitor ( this ) ) ; } else { return ; } s . visit ( checkSuper ) ; } public void visitMethod ( MethodNode node ) { this . methodNode = node ; adjustTypesIfStaticMainMethod ( node ) ; addReturnIfNeeded ( node ) ; Statement statement = node . getCode ( ) ; if ( statement != null ) statement . visit ( new VerifierCodeVisitor ( this ) ) ; } private void adjustTypesIfStaticMainMethod ( MethodNode node ) { if ( node . getName ( ) . equals ( "<STR_LIT>" ) && node . isStatic ( ) ) { Parameter [ ] params = node . getParameters ( ) ; if ( params . length == <NUM_LIT:1> ) { Parameter param = params [ <NUM_LIT:0> ] ; if ( param . getType ( ) == null || param . getType ( ) == ClassHelper . OBJECT_TYPE ) { param . setType ( ClassHelper . STRING_TYPE . makeArray ( ) ) ; if ( node . getReturnType ( ) == ClassHelper . OBJECT_TYPE ) { node . setReturnType ( ClassHelper . VOID_TYPE ) ; } } } } } protected void addReturnIfNeeded ( MethodNode node ) { Statement statement = node . getCode ( ) ; if ( ! node . isVoidMethod ( ) ) { if ( statement != null ) node . setCode ( addReturnsIfNeeded ( statement , node . getVariableScope ( ) ) ) ; } else if ( ! node . isAbstract ( ) ) { if ( ! ( statement instanceof BytecodeSequence ) ) { BlockStatement newBlock = new BlockStatement ( ) ; newBlock . setVariableScope ( node . getVariableScope ( ) ) ; if ( statement instanceof BlockStatement ) { newBlock . addStatements ( ( ( BlockStatement ) statement ) . getStatements ( ) ) ; } else { newBlock . addStatement ( statement ) ; } newBlock . addStatement ( ReturnStatement . RETURN_NULL_OR_VOID ) ; newBlock . setSourcePosition ( statement ) ; node . setCode ( newBlock ) ; } } } private Statement addReturnsIfNeeded ( Statement statement , VariableScope scope ) { if ( statement instanceof ReturnStatement || statement instanceof BytecodeSequence || statement instanceof ThrowStatement ) { return statement ; } if ( statement instanceof EmptyStatement ) { return new ReturnStatement ( ConstantExpression . NULL ) ; } if ( statement instanceof ExpressionStatement ) { ExpressionStatement expStmt = ( ExpressionStatement ) statement ; Expression expr = expStmt . getExpression ( ) ; ReturnStatement ret = new ReturnStatement ( expr ) ; ret . setSourcePosition ( expr ) ; ret . setStatementLabel ( statement . getStatementLabel ( ) ) ; return ret ; } if ( statement instanceof SynchronizedStatement ) { SynchronizedStatement sync = ( SynchronizedStatement ) statement ; sync . setCode ( addReturnsIfNeeded ( sync . getCode ( ) , scope ) ) ; return sync ; } if ( statement instanceof IfStatement ) { IfStatement ifs = ( IfStatement ) statement ; ifs . setIfBlock ( addReturnsIfNeeded ( ifs . getIfBlock ( ) , scope ) ) ; ifs . setElseBlock ( addReturnsIfNeeded ( ifs . getElseBlock ( ) , scope ) ) ; return ifs ; } if ( statement instanceof SwitchStatement ) { SwitchStatement swi = ( SwitchStatement ) statement ; List caseList = swi . getCaseStatements ( ) ; for ( Iterator iter = caseList . iterator ( ) ; iter . hasNext ( ) ; ) { CaseStatement caseStatement = ( CaseStatement ) iter . next ( ) ; caseStatement . setCode ( adjustSwitchCaseCode ( caseStatement . getCode ( ) , scope ) ) ; } swi . setDefaultStatement ( adjustSwitchCaseCode ( swi . getDefaultStatement ( ) , scope ) ) ; return swi ; } if ( statement instanceof TryCatchStatement ) { TryCatchStatement trys = ( TryCatchStatement ) statement ; trys . setTryStatement ( addReturnsIfNeeded ( trys . getTryStatement ( ) , scope ) ) ; final int len = trys . getCatchStatements ( ) . size ( ) ; for ( int i = <NUM_LIT:0> ; i != len ; ++ i ) { final CatchStatement catchStatement = trys . getCatchStatement ( i ) ; catchStatement . setCode ( addReturnsIfNeeded ( catchStatement . getCode ( ) , scope ) ) ; } return trys ; } if ( statement instanceof BlockStatement ) { BlockStatement block = ( BlockStatement ) statement ; final List list = block . getStatements ( ) ; if ( ! list . isEmpty ( ) ) { int idx = list . size ( ) - <NUM_LIT:1> ; Statement last = addReturnsIfNeeded ( ( Statement ) list . get ( idx ) , block . getVariableScope ( ) ) ; list . set ( idx , last ) ; if ( ! statementReturns ( last ) ) { list . add ( new ReturnStatement ( ConstantExpression . NULL ) ) ; } } else { ReturnStatement ret = new ReturnStatement ( ConstantExpression . NULL ) ; ret . setSourcePosition ( block ) ; return ret ; } return new BlockStatement ( list , block . getVariableScope ( ) ) ; } if ( statement == null ) return new ReturnStatement ( ConstantExpression . NULL ) ; else { final List list = new ArrayList ( ) ; list . add ( statement ) ; list . add ( new ReturnStatement ( ConstantExpression . NULL ) ) ; return new BlockStatement ( list , new VariableScope ( scope ) ) ; } } private Statement adjustSwitchCaseCode ( Statement statement , VariableScope scope ) { if ( statement instanceof BlockStatement ) { final List list = ( ( BlockStatement ) statement ) . getStatements ( ) ; if ( ! list . isEmpty ( ) ) { int idx = list . size ( ) - <NUM_LIT:1> ; Statement last = ( Statement ) list . get ( idx ) ; if ( last instanceof BreakStatement ) { list . remove ( idx ) ; return addReturnsIfNeeded ( statement , scope ) ; } } } return statement ; } private boolean statementReturns ( Statement last ) { return ( last instanceof ReturnStatement || last instanceof BlockStatement || last instanceof IfStatement || last instanceof ExpressionStatement || last instanceof EmptyStatement || last instanceof TryCatchStatement || last instanceof BytecodeSequence || last instanceof ThrowStatement || last instanceof SynchronizedStatement ) ; } public void visitField ( FieldNode node ) { } private boolean methodNeedsReplacement ( MethodNode m ) { if ( m == null ) return true ; if ( m . getDeclaringClass ( ) == this . getClassNode ( ) ) return false ; if ( ( m . getModifiers ( ) & ACC_FINAL ) != <NUM_LIT:0> ) return false ; return true ; } public void visitProperty ( PropertyNode node ) { String name = node . getName ( ) ; FieldNode field = node . getField ( ) ; int propNodeModifiers = node . getModifiers ( ) ; String getterName = "<STR_LIT:get>" + capitalize ( name ) ; String setterName = "<STR_LIT>" + capitalize ( name ) ; if ( ( propNodeModifiers & Modifier . VOLATILE ) != <NUM_LIT:0> ) { propNodeModifiers = propNodeModifiers - Modifier . VOLATILE ; } if ( ( propNodeModifiers & Modifier . TRANSIENT ) != <NUM_LIT:0> ) { propNodeModifiers = propNodeModifiers - Modifier . TRANSIENT ; } Statement getterBlock = node . getGetterBlock ( ) ; if ( getterBlock == null ) { MethodNode getter = classNode . getGetterMethod ( getterName ) ; if ( getter == null && ClassHelper . boolean_TYPE == node . getType ( ) ) { String secondGetterName = "<STR_LIT>" + capitalize ( name ) ; getter = classNode . getGetterMethod ( secondGetterName ) ; } if ( ! node . isPrivate ( ) && methodNeedsReplacement ( getter ) ) { getterBlock = createGetterBlock ( node , field ) ; } } Statement setterBlock = node . getSetterBlock ( ) ; if ( setterBlock == null ) { MethodNode setter = classNode . getSetterMethod ( setterName ) ; if ( ! node . isPrivate ( ) && ( propNodeModifiers & ACC_FINAL ) == <NUM_LIT:0> && methodNeedsReplacement ( setter ) ) { setterBlock = createSetterBlock ( node , field ) ; } } if ( getterBlock != null ) { MethodNode getter = new MethodNode ( getterName , propNodeModifiers , node . getType ( ) , Parameter . EMPTY_ARRAY , ClassNode . EMPTY_ARRAY , getterBlock ) ; getter . setSynthetic ( true ) ; addPropertyMethod ( getter ) ; visitMethod ( getter ) ; if ( ClassHelper . boolean_TYPE == node . getType ( ) || ClassHelper . Boolean_TYPE == node . getType ( ) ) { String secondGetterName = "<STR_LIT>" + capitalize ( name ) ; MethodNode secondGetter = new MethodNode ( secondGetterName , propNodeModifiers , node . getType ( ) , Parameter . EMPTY_ARRAY , ClassNode . EMPTY_ARRAY , getterBlock ) ; secondGetter . setSynthetic ( true ) ; addPropertyMethod ( secondGetter ) ; visitMethod ( secondGetter ) ; } } if ( setterBlock != null ) { Parameter [ ] setterParameterTypes = { new Parameter ( node . getType ( ) , "<STR_LIT:value>" ) } ; MethodNode setter = new MethodNode ( setterName , propNodeModifiers , ClassHelper . VOID_TYPE , setterParameterTypes , ClassNode . EMPTY_ARRAY , setterBlock ) ; setter . setSynthetic ( true ) ; addPropertyMethod ( setter ) ; visitMethod ( setter ) ; } } protected void addPropertyMethod ( MethodNode method ) { classNode . addMethod ( method ) ; } private interface DefaultArgsAction { void call ( ArgumentListExpression arguments , Parameter [ ] newParams , MethodNode method ) ; } protected void addDefaultParameterMethods ( final ClassNode node ) { List methods = new ArrayList ( node . getMethods ( ) ) ; addDefaultParameters ( methods , new DefaultArgsAction ( ) { public void call ( ArgumentListExpression arguments , Parameter [ ] newParams , MethodNode method ) { MethodCallExpression expression = new MethodCallExpression ( VariableExpression . THIS_EXPRESSION , method . getName ( ) , arguments ) ; expression . setImplicitThis ( true ) ; Statement code = null ; if ( method . isVoidMethod ( ) ) { code = new ExpressionStatement ( expression ) ; } else { code = new ReturnStatement ( expression ) ; } MethodNode newMethod = new MethodNode ( method . getName ( ) , method . getModifiers ( ) , method . getReturnType ( ) , newParams , method . getExceptions ( ) , code ) ; MethodNode oldMethod = node . getDeclaredMethod ( method . getName ( ) , newParams ) ; if ( oldMethod != null ) { throw new RuntimeParserException ( "<STR_LIT>" + method . getTypeDescriptor ( ) + "<STR_LIT>" + newMethod . getTypeDescriptor ( ) + "<STR_LIT>" , method ) ; } node . addMethod ( newMethod ) ; } } ) ; } protected void addDefaultParameterConstructors ( final ClassNode node ) { List methods = new ArrayList ( node . getDeclaredConstructors ( ) ) ; addDefaultParameters ( methods , new DefaultArgsAction ( ) { public void call ( ArgumentListExpression arguments , Parameter [ ] newParams , MethodNode method ) { ConstructorNode ctor = ( ConstructorNode ) method ; ConstructorCallExpression expression = new ConstructorCallExpression ( ClassNode . THIS , arguments ) ; Statement code = new ExpressionStatement ( expression ) ; node . addConstructor ( ctor . getModifiers ( ) , newParams , ctor . getExceptions ( ) , code ) ; } } ) ; } protected void addDefaultParameters ( List methods , DefaultArgsAction action ) { for ( Iterator iter = methods . iterator ( ) ; iter . hasNext ( ) ; ) { MethodNode method = ( MethodNode ) iter . next ( ) ; if ( method . hasDefaultValue ( ) ) { Parameter [ ] parameters = method . getParameters ( ) ; int counter = <NUM_LIT:0> ; List paramValues = new ArrayList ( ) ; int size = parameters . length ; for ( int i = size - <NUM_LIT:1> ; i >= <NUM_LIT:0> ; i -- ) { Parameter parameter = parameters [ i ] ; if ( parameter != null && parameter . hasInitialExpression ( ) ) { paramValues . add ( Integer . valueOf ( i ) ) ; paramValues . add ( new CastExpression ( parameter . getType ( ) , parameter . getInitialExpression ( ) ) ) ; counter ++ ; } } for ( int j = <NUM_LIT:1> ; j <= counter ; j ++ ) { Parameter [ ] newParams = new Parameter [ parameters . length - j ] ; ArgumentListExpression arguments = new ArgumentListExpression ( ) ; int index = <NUM_LIT:0> ; int k = <NUM_LIT:1> ; for ( int i = <NUM_LIT:0> ; i < parameters . length ; i ++ ) { if ( k > counter - j && parameters [ i ] != null && parameters [ i ] . hasInitialExpression ( ) ) { arguments . addExpression ( new CastExpression ( parameters [ i ] . getType ( ) , parameters [ i ] . getInitialExpression ( ) ) ) ; k ++ ; } else if ( parameters [ i ] != null && parameters [ i ] . hasInitialExpression ( ) ) { newParams [ index ++ ] = parameters [ i ] ; arguments . addExpression ( new CastExpression ( parameters [ i ] . getType ( ) , new VariableExpression ( parameters [ i ] . getName ( ) ) ) ) ; k ++ ; } else { newParams [ index ++ ] = parameters [ i ] ; arguments . addExpression ( new CastExpression ( parameters [ i ] . getType ( ) , new VariableExpression ( parameters [ i ] . getName ( ) ) ) ) ; } } action . call ( arguments , newParams , method ) ; } for ( int i = <NUM_LIT:0> ; i < parameters . length ; i ++ ) { parameters [ i ] . setInitialExpression ( null ) ; } } } } protected void addClosureCode ( InnerClassNode node ) { } protected void addInitialization ( ClassNode node ) { for ( Iterator iter = node . getDeclaredConstructors ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { addInitialization ( node , ( ConstructorNode ) iter . next ( ) ) ; } } protected void addInitialization ( ClassNode node , ConstructorNode constructorNode ) { Statement firstStatement = constructorNode . getFirstStatement ( ) ; ConstructorCallExpression first = getFirstIfSpecialConstructorCall ( firstStatement ) ; if ( first != null && first . isThisCall ( ) ) return ; List statements = new ArrayList ( ) ; List staticStatements = new ArrayList ( ) ; final boolean isEnum = node . isEnum ( ) ; List < Statement > initStmtsAfterEnumValuesInit = new ArrayList < Statement > ( ) ; Set explicitStaticPropsInEnum = new HashSet ( ) ; if ( isEnum ) { for ( Iterator iter = node . getProperties ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { PropertyNode propNode = ( PropertyNode ) iter . next ( ) ; if ( ! propNode . isSynthetic ( ) && propNode . getField ( ) . isStatic ( ) ) { explicitStaticPropsInEnum . add ( propNode . getField ( ) . getName ( ) ) ; } } } for ( Iterator iter = node . getFields ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { addFieldInitialization ( statements , staticStatements , ( FieldNode ) iter . next ( ) , isEnum , initStmtsAfterEnumValuesInit , explicitStaticPropsInEnum ) ; } statements . addAll ( node . getObjectInitializerStatements ( ) ) ; if ( ! statements . isEmpty ( ) ) { Statement code = constructorNode . getCode ( ) ; BlockStatement block = new BlockStatement ( ) ; List otherStatements = block . getStatements ( ) ; if ( code instanceof BlockStatement ) { block = ( BlockStatement ) code ; otherStatements = block . getStatements ( ) ; } else if ( code != null ) { otherStatements . add ( code ) ; } if ( ! otherStatements . isEmpty ( ) ) { if ( first != null ) { otherStatements . remove ( <NUM_LIT:0> ) ; statements . add ( <NUM_LIT:0> , firstStatement ) ; } statements . addAll ( otherStatements ) ; } BlockStatement newBlock = new BlockStatement ( statements , block . getVariableScope ( ) ) ; newBlock . setSourcePosition ( block ) ; constructorNode . setCode ( newBlock ) ; } if ( ! staticStatements . isEmpty ( ) ) { if ( isEnum ) { staticStatements . removeAll ( initStmtsAfterEnumValuesInit ) ; node . addStaticInitializerStatements ( staticStatements , true ) ; if ( ! initStmtsAfterEnumValuesInit . isEmpty ( ) ) { node . positionStmtsAfterEnumInitStmts ( initStmtsAfterEnumValuesInit ) ; } } else { node . addStaticInitializerStatements ( staticStatements , true ) ; } } } private ConstructorCallExpression getFirstIfSpecialConstructorCall ( Statement code ) { if ( code == null || ! ( code instanceof ExpressionStatement ) ) return null ; Expression expression = ( ( ExpressionStatement ) code ) . getExpression ( ) ; if ( ! ( expression instanceof ConstructorCallExpression ) ) return null ; ConstructorCallExpression cce = ( ConstructorCallExpression ) expression ; if ( cce . isSpecialCall ( ) ) return cce ; return null ; } protected void addFieldInitialization ( List list , List staticList , FieldNode fieldNode , boolean isEnumClassNode , List initStmtsAfterEnumValuesInit , Set explicitStaticPropsInEnum ) { Expression expression = fieldNode . getInitialExpression ( ) ; if ( expression != null ) { ExpressionStatement statement = new ExpressionStatement ( new BinaryExpression ( new FieldExpression ( fieldNode ) , Token . newSymbol ( Types . EQUAL , fieldNode . getLineNumber ( ) , fieldNode . getColumnNumber ( ) ) , expression ) ) ; if ( fieldNode . isStatic ( ) ) { if ( fieldNode . isSynthetic ( ) && expression instanceof ConstantExpression ) { staticList . add ( <NUM_LIT:0> , statement ) ; } else { staticList . add ( statement ) ; } fieldNode . setInitialValueExpression ( null ) ; if ( isEnumClassNode && explicitStaticPropsInEnum . contains ( fieldNode . getName ( ) ) ) { initStmtsAfterEnumValuesInit . add ( statement ) ; } } else { list . add ( statement ) ; } } } public static String capitalize ( String name ) { return MetaClassHelper . capitalize ( name ) ; } protected Statement createGetterBlock ( PropertyNode propertyNode , final FieldNode field ) { return new BytecodeSequence ( new BytecodeInstruction ( ) { public void visit ( MethodVisitor mv ) { if ( field . isStatic ( ) ) { mv . visitFieldInsn ( GETSTATIC , BytecodeHelper . getClassInternalName ( classNode ) , field . getName ( ) , BytecodeHelper . getTypeDescription ( field . getType ( ) ) ) ; } else { mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; mv . visitFieldInsn ( GETFIELD , BytecodeHelper . getClassInternalName ( classNode ) , field . getName ( ) , BytecodeHelper . getTypeDescription ( field . getType ( ) ) ) ; } final BytecodeHelper helper = new BytecodeHelper ( mv ) ; helper . doReturn ( field . getType ( ) ) ; } } ) ; } protected Statement createSetterBlock ( PropertyNode propertyNode , final FieldNode field ) { return new BytecodeSequence ( new BytecodeInstruction ( ) { public void visit ( MethodVisitor mv ) { final BytecodeHelper helper = new BytecodeHelper ( mv ) ; if ( field . isStatic ( ) ) { helper . load ( field . getType ( ) , <NUM_LIT:0> ) ; mv . visitFieldInsn ( PUTSTATIC , BytecodeHelper . getClassInternalName ( classNode ) , field . getName ( ) , BytecodeHelper . getTypeDescription ( field . getType ( ) ) ) ; } else { mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; helper . load ( field . getType ( ) , <NUM_LIT:1> ) ; mv . visitFieldInsn ( PUTFIELD , BytecodeHelper . getClassInternalName ( classNode ) , field . getName ( ) , BytecodeHelper . getTypeDescription ( field . getType ( ) ) ) ; } mv . visitInsn ( RETURN ) ; } } ) ; } public void visitGenericType ( GenericsType genericsType ) { } public static long getTimestamp ( Class clazz ) { if ( clazz . getClassLoader ( ) instanceof GroovyClassLoader . InnerLoader ) { GroovyClassLoader . InnerLoader innerLoader = ( GroovyClassLoader . InnerLoader ) clazz . getClassLoader ( ) ; return innerLoader . getTimeStamp ( ) ; } final Field [ ] fields = clazz . getFields ( ) ; for ( int i = <NUM_LIT:0> ; i != fields . length ; ++ i ) { if ( Modifier . isStatic ( fields [ i ] . getModifiers ( ) ) ) { final String name = fields [ i ] . getName ( ) ; if ( name . startsWith ( __TIMESTAMP__ ) ) { try { return Long . decode ( name . substring ( __TIMESTAMP__ . length ( ) ) ) . longValue ( ) ; } catch ( NumberFormatException e ) { return Long . MAX_VALUE ; } } } } return Long . MAX_VALUE ; } protected void addCovariantMethods ( ClassNode classNode ) { Map methodsToAdd = new HashMap ( ) ; Map genericsSpec = new HashMap ( ) ; Map abstractMethods = new HashMap ( ) ; ClassNode [ ] interfaces = classNode . getInterfaces ( ) ; for ( int i = <NUM_LIT:0> ; i < interfaces . length ; i ++ ) { ClassNode iface = interfaces [ i ] ; Map ifaceMethodsMap = iface . getDeclaredMethodsMap ( ) ; abstractMethods . putAll ( ifaceMethodsMap ) ; } List declaredMethods = new ArrayList ( classNode . getMethods ( ) ) ; for ( Iterator methodsIterator = declaredMethods . iterator ( ) ; methodsIterator . hasNext ( ) ; ) { MethodNode m = ( MethodNode ) methodsIterator . next ( ) ; abstractMethods . remove ( m . getTypeDescriptor ( ) ) ; if ( m . isStatic ( ) || ! ( m . isPublic ( ) || m . isProtected ( ) ) ) { methodsIterator . remove ( ) ; } } addCovariantMethods ( classNode , declaredMethods , abstractMethods , methodsToAdd , genericsSpec ) ; Map declaredMethodsMap = new HashMap ( ) ; if ( methodsToAdd . size ( ) > <NUM_LIT:0> ) { for ( Iterator methodsIterator = declaredMethods . iterator ( ) ; methodsIterator . hasNext ( ) ; ) { MethodNode m = ( MethodNode ) methodsIterator . next ( ) ; declaredMethodsMap . put ( m . getTypeDescriptor ( ) , m ) ; } } for ( Iterator it = methodsToAdd . entrySet ( ) . iterator ( ) ; it . hasNext ( ) ; ) { Map . Entry entry = ( Map . Entry ) it . next ( ) ; MethodNode method = ( MethodNode ) entry . getValue ( ) ; MethodNode mn = ( MethodNode ) declaredMethodsMap . get ( entry . getKey ( ) ) ; if ( mn != null && mn . getDeclaringClass ( ) . equals ( classNode ) ) continue ; classNode . addMethod ( method ) ; } } private void addCovariantMethods ( ClassNode classNode , List declaredMethods , Map abstractMethods , Map methodsToAdd , Map oldGenericsSpec ) { ClassNode sn = classNode . getUnresolvedSuperClass ( false ) ; if ( sn != null ) { Map genericsSpec = createGenericsSpec ( sn , oldGenericsSpec ) ; List classMethods = sn . getMethods ( ) ; for ( Iterator it = declaredMethods . iterator ( ) ; it . hasNext ( ) ; ) { MethodNode method = ( MethodNode ) it . next ( ) ; if ( method . isStatic ( ) ) continue ; storeMissingCovariantMethods ( classMethods , method , methodsToAdd , genericsSpec ) ; } if ( ! abstractMethods . isEmpty ( ) ) { for ( Iterator it = classMethods . iterator ( ) ; it . hasNext ( ) ; ) { MethodNode method = ( MethodNode ) it . next ( ) ; if ( method . isStatic ( ) ) continue ; storeMissingCovariantMethods ( abstractMethods . values ( ) , method , methodsToAdd , Collections . EMPTY_MAP ) ; } } addCovariantMethods ( sn . redirect ( ) , declaredMethods , abstractMethods , methodsToAdd , genericsSpec ) ; } ClassNode [ ] interfaces = classNode . getInterfaces ( ) ; for ( int i = <NUM_LIT:0> ; i < interfaces . length ; i ++ ) { List interfacesMethods = interfaces [ i ] . getMethods ( ) ; Map genericsSpec = createGenericsSpec ( interfaces [ i ] , oldGenericsSpec ) ; for ( Iterator it = declaredMethods . iterator ( ) ; it . hasNext ( ) ; ) { MethodNode method = ( MethodNode ) it . next ( ) ; if ( method . isStatic ( ) ) continue ; storeMissingCovariantMethods ( interfacesMethods , method , methodsToAdd , genericsSpec ) ; } addCovariantMethods ( interfaces [ i ] , declaredMethods , abstractMethods , methodsToAdd , genericsSpec ) ; } } private MethodNode getCovariantImplementation ( final MethodNode oldMethod , final MethodNode overridingMethod , Map genericsSpec ) { if ( ! oldMethod . getName ( ) . equals ( overridingMethod . getName ( ) ) ) return null ; boolean normalEqualParameters = equalParametersNormal ( overridingMethod , oldMethod ) ; boolean genericEqualParameters = equalParametersWithGenerics ( overridingMethod , oldMethod , genericsSpec ) ; if ( ! normalEqualParameters && ! genericEqualParameters ) return null ; ClassNode mr = overridingMethod . getReturnType ( ) ; ClassNode omr = oldMethod . getReturnType ( ) ; boolean equalReturnType = mr . equals ( omr ) ; if ( equalReturnType && normalEqualParameters ) return null ; ClassNode testmr = correctToGenericsSpec ( genericsSpec , omr ) ; if ( ! isAssignable ( mr , testmr ) ) { throw new RuntimeParserException ( "<STR_LIT>" + overridingMethod . getTypeDescriptor ( ) + "<STR_LIT>" + overridingMethod . getDeclaringClass ( ) . getName ( ) + "<STR_LIT>" + oldMethod . getTypeDescriptor ( ) + "<STR_LIT>" + oldMethod . getDeclaringClass ( ) . getName ( ) , overridingMethod ) ; } if ( ( oldMethod . getModifiers ( ) & ACC_FINAL ) != <NUM_LIT:0> ) { throw new RuntimeParserException ( "<STR_LIT>" + oldMethod . getTypeDescriptor ( ) + "<STR_LIT>" + oldMethod . getDeclaringClass ( ) . getName ( ) , overridingMethod ) ; } if ( oldMethod . isStatic ( ) != overridingMethod . isStatic ( ) ) { throw new RuntimeParserException ( "<STR_LIT>" + oldMethod . getTypeDescriptor ( ) + "<STR_LIT>" + oldMethod . getDeclaringClass ( ) . getName ( ) + "<STR_LIT>" , overridingMethod ) ; } MethodNode newMethod = new MethodNode ( oldMethod . getName ( ) , overridingMethod . getModifiers ( ) | ACC_SYNTHETIC | ACC_BRIDGE , oldMethod . getReturnType ( ) . getPlainNodeReference ( ) , cleanParameters ( oldMethod . getParameters ( ) ) , oldMethod . getExceptions ( ) , null ) ; List instructions = new ArrayList ( <NUM_LIT:1> ) ; instructions . add ( new BytecodeInstruction ( ) { public void visit ( MethodVisitor mv ) { BytecodeHelper helper = new BytecodeHelper ( mv ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; Parameter [ ] para = oldMethod . getParameters ( ) ; Parameter [ ] goal = overridingMethod . getParameters ( ) ; for ( int i = <NUM_LIT:0> ; i < para . length ; i ++ ) { helper . load ( para [ i ] . getType ( ) , i + <NUM_LIT:1> ) ; if ( ! para [ i ] . getType ( ) . equals ( goal [ i ] . getType ( ) ) ) { helper . doCast ( goal [ i ] . getType ( ) ) ; } } mv . visitMethodInsn ( INVOKEVIRTUAL , BytecodeHelper . getClassInternalName ( classNode ) , overridingMethod . getName ( ) , BytecodeHelper . getMethodDescriptor ( overridingMethod . getReturnType ( ) , overridingMethod . getParameters ( ) ) ) ; helper . doReturn ( oldMethod . getReturnType ( ) ) ; } } ) ; newMethod . setCode ( new BytecodeSequence ( instructions ) ) ; return newMethod ; } private boolean isAssignable ( ClassNode node , ClassNode testNode ) { if ( testNode . isInterface ( ) ) { if ( node . isInterface ( ) ) { if ( node . isDerivedFrom ( testNode ) ) return true ; } else { if ( node . implementsInterface ( testNode ) ) return true ; } } else { if ( node . isDerivedFrom ( testNode ) ) return true ; } return false ; } private Parameter [ ] cleanParameters ( Parameter [ ] parameters ) { Parameter [ ] params = new Parameter [ parameters . length ] ; for ( int i = <NUM_LIT:0> ; i < params . length ; i ++ ) { params [ i ] = new Parameter ( parameters [ i ] . getType ( ) . getPlainNodeReference ( ) , parameters [ i ] . getName ( ) ) ; } return params ; } private void storeMissingCovariantMethods ( Collection methods , MethodNode method , Map methodsToAdd , Map genericsSpec ) { for ( Iterator sit = methods . iterator ( ) ; sit . hasNext ( ) ; ) { MethodNode toOverride = ( MethodNode ) sit . next ( ) ; MethodNode bridgeMethod = getCovariantImplementation ( toOverride , method , genericsSpec ) ; if ( bridgeMethod == null ) continue ; methodsToAdd . put ( bridgeMethod . getTypeDescriptor ( ) , bridgeMethod ) ; return ; } } private ClassNode correctToGenericsSpec ( Map genericsSpec , GenericsType type ) { ClassNode ret = null ; if ( type . isPlaceholder ( ) ) { String name = type . getName ( ) ; ret = ( ClassNode ) genericsSpec . get ( name ) ; } if ( ret == null ) ret = type . getType ( ) ; return ret ; } private ClassNode correctToGenericsSpec ( Map genericsSpec , ClassNode type ) { if ( type . isGenericsPlaceHolder ( ) ) { String name = type . getGenericsTypes ( ) [ <NUM_LIT:0> ] . getName ( ) ; type = ( ClassNode ) genericsSpec . get ( name ) ; } if ( type == null ) type = ClassHelper . OBJECT_TYPE ; return type ; } private boolean equalParametersNormal ( MethodNode m1 , MethodNode m2 ) { Parameter [ ] p1 = m1 . getParameters ( ) ; Parameter [ ] p2 = m2 . getParameters ( ) ; if ( p1 . length != p2 . length ) return false ; for ( int i = <NUM_LIT:0> ; i < p2 . length ; i ++ ) { ClassNode type = p2 [ i ] . getType ( ) ; ClassNode parameterType = p1 [ i ] . getType ( ) ; if ( ! parameterType . equals ( type ) ) return false ; } return true ; } private boolean equalParametersWithGenerics ( MethodNode m1 , MethodNode m2 , Map genericsSpec ) { Parameter [ ] p1 = m1 . getParameters ( ) ; Parameter [ ] p2 = m2 . getParameters ( ) ; if ( p1 . length != p2 . length ) return false ; for ( int i = <NUM_LIT:0> ; i < p2 . length ; i ++ ) { ClassNode type = p2 [ i ] . getType ( ) ; ClassNode genericsType = correctToGenericsSpec ( genericsSpec , type ) ; ClassNode parameterType = p1 [ i ] . getType ( ) ; if ( ! parameterType . equals ( genericsType ) ) return false ; } return true ; } private Map createGenericsSpec ( ClassNode current , Map oldSpec ) { Map ret = new HashMap ( oldSpec ) ; GenericsType [ ] sgts = current . getGenericsTypes ( ) ; if ( sgts != null ) { ClassNode [ ] spec = new ClassNode [ sgts . length ] ; for ( int i = <NUM_LIT:0> ; i < spec . length ; i ++ ) { spec [ i ] = correctToGenericsSpec ( ret , sgts [ i ] ) ; } GenericsType [ ] newGts = current . redirect ( ) . getGenericsTypes ( ) ; if ( newGts == null ) return ret ; ret . clear ( ) ; for ( int i = <NUM_LIT:0> ; i < spec . length ; i ++ ) { ret . put ( newGts [ i ] . getName ( ) , spec [ i ] ) ; } } return ret ; } } </s>
|
<s> package org . codehaus . groovy . classgen ; import java . lang . reflect . Modifier ; import java . util . Iterator ; import java . util . List ; import org . codehaus . groovy . ast . ClassCodeVisitorSupport ; import org . codehaus . groovy . ast . ClassHelper ; import org . codehaus . groovy . ast . ClassNode ; import org . codehaus . groovy . ast . FieldNode ; import org . codehaus . groovy . ast . MethodNode ; import org . codehaus . groovy . ast . Parameter ; import org . codehaus . groovy . ast . PropertyNode ; import org . codehaus . groovy . ast . expr . BinaryExpression ; import org . codehaus . groovy . ast . expr . ConstantExpression ; import org . codehaus . groovy . ast . expr . ConstructorCallExpression ; import org . codehaus . groovy . ast . expr . DeclarationExpression ; import org . codehaus . groovy . ast . expr . Expression ; import org . codehaus . groovy . ast . expr . GStringExpression ; import org . codehaus . groovy . ast . expr . MapEntryExpression ; import org . codehaus . groovy . ast . expr . MethodCallExpression ; import org . codehaus . groovy . ast . expr . TupleExpression ; import org . codehaus . groovy . ast . stmt . CatchStatement ; import org . codehaus . groovy . control . SourceUnit ; import org . objectweb . asm . Opcodes ; import org . codehaus . groovy . runtime . MetaClassHelper ; import org . codehaus . groovy . syntax . Types ; public class ClassCompletionVerifier extends ClassCodeVisitorSupport { private ClassNode currentClass ; private SourceUnit source ; public ClassCompletionVerifier ( SourceUnit source ) { this . source = source ; } public ClassNode getClassNode ( ) { return currentClass ; } public void visitClass ( ClassNode node ) { ClassNode oldClass = currentClass ; currentClass = node ; checkImplementsAndExtends ( node ) ; if ( source != null && ! source . getErrorCollector ( ) . hasErrors ( ) ) { checkClassForIncorrectModifiers ( node ) ; checkClassForOverwritingFinal ( node ) ; checkMethodsForIncorrectModifiers ( node ) ; checkMethodsForOverwritingFinal ( node ) ; checkNoAbstractMethodsNonabstractClass ( node ) ; } super . visitClass ( node ) ; currentClass = oldClass ; } private void checkNoAbstractMethodsNonabstractClass ( ClassNode node ) { if ( Modifier . isAbstract ( node . getModifiers ( ) ) ) return ; List abstractMethods = node . getAbstractMethods ( ) ; if ( abstractMethods == null ) return ; for ( Iterator iter = abstractMethods . iterator ( ) ; iter . hasNext ( ) ; ) { MethodNode method = ( MethodNode ) iter . next ( ) ; addTypeError ( "<STR_LIT>" + "<STR_LIT>" + getDescription ( node ) + "<STR_LIT>" + "<STR_LIT>" + getDescription ( method ) + "<STR_LIT>" , node ) ; } } private void checkClassForIncorrectModifiers ( ClassNode node ) { checkClassForAbstractAndFinal ( node ) ; checkClassForOtherModifiers ( node ) ; } private void checkClassForAbstractAndFinal ( ClassNode node ) { if ( ! Modifier . isAbstract ( node . getModifiers ( ) ) ) return ; if ( ! Modifier . isFinal ( node . getModifiers ( ) ) ) return ; if ( node . isInterface ( ) ) { addError ( "<STR_LIT>" + getDescription ( node ) + "<STR_LIT>" , node ) ; } else { addError ( "<STR_LIT>" + getDescription ( node ) + "<STR_LIT>" , node ) ; } } private void checkClassForOtherModifiers ( ClassNode node ) { checkClassForModifier ( node , Modifier . isTransient ( node . getModifiers ( ) ) , "<STR_LIT>" ) ; checkClassForModifier ( node , Modifier . isVolatile ( node . getModifiers ( ) ) , "<STR_LIT>" ) ; checkClassForModifier ( node , Modifier . isNative ( node . getModifiers ( ) ) , "<STR_LIT>" ) ; } private void checkMethodForModifier ( MethodNode node , boolean condition , String modifierName ) { if ( ! condition ) return ; addError ( "<STR_LIT>" + getDescription ( node ) + "<STR_LIT>" + modifierName + "<STR_LIT:.>" , node ) ; } private void checkClassForModifier ( ClassNode node , boolean condition , String modifierName ) { if ( ! condition ) return ; addError ( "<STR_LIT>" + getDescription ( node ) + "<STR_LIT>" + modifierName + "<STR_LIT:.>" , node ) ; } private String getDescription ( ClassNode node ) { return ( node . isInterface ( ) ? "<STR_LIT>" : "<STR_LIT:class>" ) + "<STR_LIT>" + node . getName ( ) + "<STR_LIT:'>" ; } private String getDescription ( MethodNode node ) { return "<STR_LIT>" + node . getTypeDescriptor ( ) + "<STR_LIT:'>" ; } private String getDescription ( FieldNode node ) { return "<STR_LIT>" + node . getName ( ) + "<STR_LIT:'>" ; } private void checkAbstractDeclaration ( MethodNode methodNode ) { if ( ! Modifier . isAbstract ( methodNode . getModifiers ( ) ) ) return ; if ( Modifier . isAbstract ( currentClass . getModifiers ( ) ) ) return ; addError ( "<STR_LIT>" + "<STR_LIT>" + getDescription ( currentClass ) + "<STR_LIT>" + methodNode . getTypeDescriptor ( ) + "<STR_LIT>" , methodNode ) ; } private void checkClassForOverwritingFinal ( ClassNode cn ) { ClassNode superCN = cn . getSuperClass ( ) ; if ( superCN == null ) return ; if ( ! Modifier . isFinal ( superCN . getModifiers ( ) ) ) return ; StringBuffer msg = new StringBuffer ( ) ; msg . append ( "<STR_LIT>" ) ; msg . append ( getDescription ( superCN ) ) ; msg . append ( "<STR_LIT:.>" ) ; addError ( msg . toString ( ) , cn ) ; } private void checkImplementsAndExtends ( ClassNode node ) { ClassNode cn = node . getSuperClass ( ) ; if ( cn . isInterface ( ) && ! node . isInterface ( ) ) { addTypeError ( "<STR_LIT>" + getDescription ( cn ) + "<STR_LIT>" , node ) ; } ClassNode [ ] interfaces = node . getInterfaces ( ) ; for ( int i = <NUM_LIT:0> ; i < interfaces . length ; i ++ ) { cn = interfaces [ i ] ; if ( ! cn . isInterface ( ) ) { addTypeError ( "<STR_LIT>" + getDescription ( cn ) + "<STR_LIT>" , node ) ; } } } private void checkMethodsForIncorrectModifiers ( ClassNode cn ) { if ( ! cn . isInterface ( ) ) return ; List methods = cn . getMethods ( ) ; for ( Iterator cnIter = methods . iterator ( ) ; cnIter . hasNext ( ) ; ) { MethodNode method = ( MethodNode ) cnIter . next ( ) ; if ( Modifier . isFinal ( method . getModifiers ( ) ) ) { addError ( "<STR_LIT>" + getDescription ( method ) + "<STR_LIT>" + getDescription ( cn ) + "<STR_LIT>" , method ) ; } if ( Modifier . isStatic ( method . getModifiers ( ) ) && ! isConstructor ( method ) ) { addError ( "<STR_LIT>" + getDescription ( method ) + "<STR_LIT>" + getDescription ( cn ) + "<STR_LIT>" , method ) ; } } } private boolean isConstructor ( MethodNode method ) { return method . getName ( ) . equals ( "<STR_LIT>" ) ; } private void checkMethodsForOverwritingFinal ( ClassNode cn ) { List methods = cn . getMethods ( ) ; for ( Iterator cnIter = methods . iterator ( ) ; cnIter . hasNext ( ) ; ) { MethodNode method = ( MethodNode ) cnIter . next ( ) ; Parameter [ ] params = method . getParameters ( ) ; List superMethods = cn . getSuperClass ( ) . getMethods ( method . getName ( ) ) ; for ( Iterator iter = superMethods . iterator ( ) ; iter . hasNext ( ) ; ) { MethodNode superMethod = ( MethodNode ) iter . next ( ) ; Parameter [ ] superParams = superMethod . getParameters ( ) ; if ( ! hasEqualParameterTypes ( params , superParams ) ) continue ; if ( ! Modifier . isFinal ( superMethod . getModifiers ( ) ) ) return ; addInvalidUseOfFinalError ( method , params , superMethod . getDeclaringClass ( ) ) ; return ; } } } private void addInvalidUseOfFinalError ( MethodNode method , Parameter [ ] parameters , ClassNode superCN ) { StringBuffer msg = new StringBuffer ( ) ; msg . append ( "<STR_LIT>" ) . append ( method . getName ( ) ) ; msg . append ( "<STR_LIT:(>" ) ; boolean needsComma = false ; for ( int i = <NUM_LIT:0> ; i < parameters . length ; i ++ ) { if ( needsComma ) { msg . append ( "<STR_LIT:U+002C>" ) ; } else { needsComma = true ; } msg . append ( parameters [ i ] . getType ( ) ) ; } msg . append ( "<STR_LIT>" ) . append ( getDescription ( superCN ) ) ; msg . append ( "<STR_LIT:.>" ) ; addError ( msg . toString ( ) , method ) ; } private boolean hasEqualParameterTypes ( Parameter [ ] first , Parameter [ ] second ) { if ( first . length != second . length ) return false ; for ( int i = <NUM_LIT:0> ; i < first . length ; i ++ ) { String ft = first [ i ] . getType ( ) . getName ( ) ; String st = second [ i ] . getType ( ) . getName ( ) ; if ( ft . equals ( st ) ) continue ; return false ; } return true ; } protected SourceUnit getSourceUnit ( ) { return source ; } public void visitConstructorCallExpression ( ConstructorCallExpression call ) { ClassNode type = call . getType ( ) ; if ( Modifier . isAbstract ( type . getModifiers ( ) ) ) { addError ( "<STR_LIT>" + getDescription ( type ) + "<STR_LIT:.>" , call ) ; } super . visitConstructorCallExpression ( call ) ; } public void visitMethod ( MethodNode node ) { checkAbstractDeclaration ( node ) ; checkRepetitiveMethod ( node ) ; checkOverloadingPrivateAndPublic ( node ) ; checkMethodModifiers ( node ) ; super . visitMethod ( node ) ; } private void checkMethodModifiers ( MethodNode node ) { if ( ( this . currentClass . getModifiers ( ) & Opcodes . ACC_INTERFACE ) != <NUM_LIT:0> ) { checkMethodForModifier ( node , Modifier . isStrict ( node . getModifiers ( ) ) , "<STR_LIT>" ) ; checkMethodForModifier ( node , Modifier . isSynchronized ( node . getModifiers ( ) ) , "<STR_LIT>" ) ; checkMethodForModifier ( node , Modifier . isNative ( node . getModifiers ( ) ) , "<STR_LIT>" ) ; } } private void checkOverloadingPrivateAndPublic ( MethodNode node ) { if ( isConstructor ( node ) ) return ; List methods = currentClass . getMethods ( node . getName ( ) ) ; boolean hasPrivate = false ; boolean hasPublic = false ; for ( Iterator iter = methods . iterator ( ) ; iter . hasNext ( ) ; ) { MethodNode element = ( MethodNode ) iter . next ( ) ; if ( element == node ) continue ; if ( ! element . getDeclaringClass ( ) . equals ( node . getDeclaringClass ( ) ) ) continue ; int modifiers = element . getModifiers ( ) ; if ( Modifier . isPublic ( modifiers ) || Modifier . isProtected ( modifiers ) ) { hasPublic = true ; } else { hasPrivate = true ; } } if ( hasPrivate && hasPublic ) { addError ( "<STR_LIT>" , node ) ; } } private void checkRepetitiveMethod ( MethodNode node ) { if ( isConstructor ( node ) ) return ; List methods = currentClass . getMethods ( node . getName ( ) ) ; for ( Iterator iter = methods . iterator ( ) ; iter . hasNext ( ) ; ) { MethodNode element = ( MethodNode ) iter . next ( ) ; if ( element == node ) continue ; if ( ! element . getDeclaringClass ( ) . equals ( node . getDeclaringClass ( ) ) ) continue ; Parameter [ ] p1 = node . getParameters ( ) ; Parameter [ ] p2 = element . getParameters ( ) ; if ( p1 . length != p2 . length ) continue ; addErrorIfParamsAndReturnTypeEqual ( p2 , p1 , node , element ) ; } } private void addErrorIfParamsAndReturnTypeEqual ( Parameter [ ] p2 , Parameter [ ] p1 , MethodNode node , MethodNode element ) { boolean isEqual = true ; for ( int i = <NUM_LIT:0> ; i < p2 . length ; i ++ ) { isEqual &= p1 [ i ] . getType ( ) . equals ( p2 [ i ] . getType ( ) ) ; } isEqual &= node . getReturnType ( ) . equals ( element . getReturnType ( ) ) ; if ( isEqual ) { addError ( "<STR_LIT>" + getDescription ( node ) + "<STR_LIT>" + getDescription ( currentClass ) + "<STR_LIT:.>" , node ) ; } } public void visitField ( FieldNode node ) { if ( currentClass . getDeclaredField ( node . getName ( ) ) != node ) { addError ( "<STR_LIT>" + getDescription ( node ) + "<STR_LIT>" , node ) ; } checkInterfaceFieldModifiers ( node ) ; super . visitField ( node ) ; } private void checkInterfaceFieldModifiers ( FieldNode node ) { if ( ! currentClass . isInterface ( ) ) return ; if ( ( node . getModifiers ( ) & ( Opcodes . ACC_PUBLIC | Opcodes . ACC_STATIC | Opcodes . ACC_FINAL ) ) == <NUM_LIT:0> ) { addError ( "<STR_LIT>" + getDescription ( node ) + "<STR_LIT>" + getDescription ( currentClass ) + "<STR_LIT:.>" , node ) ; } } public void visitProperty ( PropertyNode node ) { checkDuplicateProperties ( node ) ; super . visitProperty ( node ) ; } private void checkDuplicateProperties ( PropertyNode node ) { ClassNode cn = node . getDeclaringClass ( ) ; String name = node . getName ( ) ; String getterName = "<STR_LIT:get>" + MetaClassHelper . capitalize ( name ) ; if ( Character . isUpperCase ( name . charAt ( <NUM_LIT:0> ) ) ) { for ( Object propObj : cn . getProperties ( ) ) { PropertyNode propNode = ( PropertyNode ) propObj ; String otherName = propNode . getField ( ) . getName ( ) ; String otherGetterName = "<STR_LIT:get>" + MetaClassHelper . capitalize ( otherName ) ; if ( node != propNode && getterName . equals ( otherGetterName ) ) { String msg = "<STR_LIT>" + name + "<STR_LIT:U+0020andU+0020>" + otherName + "<STR_LIT>" + cn . getName ( ) + "<STR_LIT>" ; addError ( msg , node ) ; } } } } public void visitBinaryExpression ( BinaryExpression expression ) { if ( expression . getOperation ( ) . getType ( ) == Types . LEFT_SQUARE_BRACKET && expression . getRightExpression ( ) instanceof MapEntryExpression ) { addError ( "<STR_LIT>" + "<STR_LIT>" , expression . getRightExpression ( ) ) ; } super . visitBinaryExpression ( expression ) ; } public void visitCatchStatement ( CatchStatement cs ) { if ( ! ( cs . getExceptionType ( ) . isDerivedFrom ( ClassHelper . make ( Throwable . class ) ) ) ) { addError ( "<STR_LIT>" , cs ) ; } super . visitCatchStatement ( cs ) ; } public void visitMethodCallExpression ( MethodCallExpression mce ) { super . visitMethodCallExpression ( mce ) ; Expression aexp = mce . getArguments ( ) ; if ( aexp instanceof TupleExpression ) { TupleExpression arguments = ( TupleExpression ) aexp ; for ( Iterator it = arguments . getExpressions ( ) . iterator ( ) ; it . hasNext ( ) ; ) { checkForInvalidDeclaration ( ( Expression ) it . next ( ) ) ; } } else { checkForInvalidDeclaration ( aexp ) ; } } private void checkForInvalidDeclaration ( Expression exp ) { if ( ! ( exp instanceof DeclarationExpression ) ) return ; addError ( "<STR_LIT>" , exp ) ; } public void visitConstantExpression ( ConstantExpression expression ) { super . visitConstantExpression ( expression ) ; checkStringExceedingMaximumLength ( expression ) ; } public void visitGStringExpression ( GStringExpression expression ) { super . visitGStringExpression ( expression ) ; for ( Iterator it = expression . getStrings ( ) . iterator ( ) ; it . hasNext ( ) ; ) { checkStringExceedingMaximumLength ( ( ConstantExpression ) it . next ( ) ) ; } } private void checkStringExceedingMaximumLength ( ConstantExpression expression ) { Object value = expression . getValue ( ) ; if ( value instanceof String ) { String s = ( String ) value ; if ( s . length ( ) > <NUM_LIT> ) { addError ( "<STR_LIT>" + s . length ( ) + "<STR_LIT>" , expression ) ; } } } } </s>
|
<s> package org . codehaus . groovy . classgen ; import groovy . lang . GroovyRuntimeException ; import org . codehaus . groovy . GroovyBugError ; import org . codehaus . groovy . ast . * ; import org . codehaus . groovy . ast . expr . * ; import org . codehaus . groovy . ast . stmt . * ; import org . codehaus . groovy . control . CompilerConfiguration ; import org . codehaus . groovy . control . SourceUnit ; import org . codehaus . groovy . runtime . MetaClassHelper ; import org . codehaus . groovy . runtime . ScriptBytecodeAdapter ; import org . codehaus . groovy . runtime . callsite . CallSite ; import org . codehaus . groovy . runtime . typehandling . DefaultTypeTransformation ; import org . codehaus . groovy . syntax . RuntimeParserException ; import org . codehaus . groovy . syntax . Types ; import org . objectweb . asm . AnnotationVisitor ; import org . objectweb . asm . * ; import java . util . * ; public class AsmClassGenerator extends ClassGenerator { private final ClassVisitor cv ; private MethodVisitor mv ; private GeneratorContext context ; private String sourceFile ; private ClassNode classNode ; private ClassNode outermostClass ; private String internalClassName ; private String internalBaseClassName ; private CompileStack compileStack ; private boolean outputReturn ; private boolean leftHandExpression = false ; static final MethodCallerMultiAdapter invokeMethodOnCurrent = MethodCallerMultiAdapter . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" , true , false ) ; static final MethodCallerMultiAdapter invokeMethodOnSuper = MethodCallerMultiAdapter . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" , true , false ) ; static final MethodCallerMultiAdapter invokeMethod = MethodCallerMultiAdapter . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" , true , false ) ; static final MethodCallerMultiAdapter invokeStaticMethod = MethodCallerMultiAdapter . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" , true , true ) ; static final MethodCallerMultiAdapter invokeNew = MethodCallerMultiAdapter . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" , true , true ) ; static final MethodCallerMultiAdapter setField = MethodCallerMultiAdapter . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" , false , false ) ; static final MethodCallerMultiAdapter getField = MethodCallerMultiAdapter . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" , false , false ) ; static final MethodCallerMultiAdapter setGroovyObjectField = MethodCallerMultiAdapter . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" , false , false ) ; static final MethodCallerMultiAdapter getGroovyObjectField = MethodCallerMultiAdapter . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" , false , false ) ; static final MethodCallerMultiAdapter setFieldOnSuper = MethodCallerMultiAdapter . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" , false , false ) ; static final MethodCallerMultiAdapter getFieldOnSuper = MethodCallerMultiAdapter . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" , false , false ) ; static final MethodCallerMultiAdapter setProperty = MethodCallerMultiAdapter . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" , false , false ) ; static final MethodCallerMultiAdapter getProperty = MethodCallerMultiAdapter . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" , false , false ) ; static final MethodCallerMultiAdapter setGroovyObjectProperty = MethodCallerMultiAdapter . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" , false , false ) ; static final MethodCallerMultiAdapter getGroovyObjectProperty = MethodCallerMultiAdapter . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" , false , false ) ; static final MethodCallerMultiAdapter setPropertyOnSuper = MethodCallerMultiAdapter . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" , false , false ) ; static final MethodCallerMultiAdapter getPropertyOnSuper = MethodCallerMultiAdapter . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" , false , false ) ; static final MethodCaller iteratorNextMethod = MethodCaller . newInterface ( Iterator . class , "<STR_LIT>" ) ; static final MethodCaller iteratorHasNextMethod = MethodCaller . newInterface ( Iterator . class , "<STR_LIT>" ) ; static final MethodCaller assertFailedMethod = MethodCaller . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" ) ; static final MethodCaller isCaseMethod = MethodCaller . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" ) ; static final MethodCaller compareIdenticalMethod = MethodCaller . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" ) ; static final MethodCaller compareEqualMethod = MethodCaller . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" ) ; static final MethodCaller compareNotEqualMethod = MethodCaller . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" ) ; static final MethodCaller compareToMethod = MethodCaller . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" ) ; static final MethodCaller compareLessThanMethod = MethodCaller . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" ) ; static final MethodCaller compareLessThanEqualMethod = MethodCaller . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" ) ; static final MethodCaller compareGreaterThanMethod = MethodCaller . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" ) ; static final MethodCaller compareGreaterThanEqualMethod = MethodCaller . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" ) ; static final MethodCaller findRegexMethod = MethodCaller . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" ) ; static final MethodCaller matchRegexMethod = MethodCaller . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" ) ; static final MethodCaller regexPattern = MethodCaller . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" ) ; static final MethodCaller spreadMap = MethodCaller . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" ) ; static final MethodCaller despreadList = MethodCaller . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" ) ; static final MethodCaller getMethodPointer = MethodCaller . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" ) ; static final MethodCaller invokeClosureMethod = MethodCaller . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" ) ; static final MethodCaller unaryPlus = MethodCaller . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" ) ; static final MethodCaller unaryMinus = MethodCaller . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" ) ; static final MethodCaller bitwiseNegate = MethodCaller . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" ) ; static final MethodCaller asTypeMethod = MethodCaller . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" ) ; static final MethodCaller castToTypeMethod = MethodCaller . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" ) ; static final MethodCaller createListMethod = MethodCaller . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" ) ; static final MethodCaller createTupleMethod = MethodCaller . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" ) ; static final MethodCaller createMapMethod = MethodCaller . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" ) ; static final MethodCaller createRangeMethod = MethodCaller . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" ) ; static final MethodCaller createPojoWrapperMethod = MethodCaller . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" ) ; static final MethodCaller createGroovyObjectWrapperMethod = MethodCaller . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" ) ; static final MethodCaller selectConstructorAndTransformArguments = MethodCaller . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" ) ; private List exceptionBlocks = new ArrayList ( ) ; private Map < String , ClassNode > referencedClasses = new HashMap < String , ClassNode > ( ) ; private boolean passingClosureParams ; private ConstructorNode constructorNode ; private MethodNode methodNode ; private BytecodeHelper helper = new BytecodeHelper ( null ) ; public static final boolean CREATE_DEBUG_INFO = true ; public static final boolean CREATE_LINE_NUMBER_INFO = true ; private static final boolean MARK_START = true ; public static final boolean ASM_DEBUG = false ; private int lineNumber = - <NUM_LIT:1> ; private int columnNumber = - <NUM_LIT:1> ; private ASTNode currentASTNode = null ; private DummyClassGenerator dummyGen = null ; private ClassWriter dummyClassWriter = null ; private ClassNode interfaceClassLoadingClass ; private boolean implicitThis = false ; private Map genericParameterNames = null ; private ClassNode rightHandType ; private static final String CONSTRUCTOR = "<STR_LIT>" ; private List callSites = new ArrayList ( ) ; private int callSiteArrayVarIndex ; private HashMap closureClassMap ; private static final String DTT = BytecodeHelper . getClassInternalName ( DefaultTypeTransformation . class . getName ( ) ) ; private boolean specialCallWithinConstructor = false ; public AsmClassGenerator ( GeneratorContext context , ClassVisitor classVisitor , ClassLoader classLoader , String sourceFile ) { super ( classLoader ) ; this . context = context ; this . cv = classVisitor ; this . sourceFile = sourceFile ; this . dummyClassWriter = new ClassWriter ( true ) ; dummyGen = new DummyClassGenerator ( context , dummyClassWriter , classLoader , sourceFile ) ; compileStack = new CompileStack ( ) ; genericParameterNames = new HashMap ( ) ; closureClassMap = new HashMap ( ) ; } protected SourceUnit getSourceUnit ( ) { return null ; } public void visitClass ( ClassNode classNode ) { try { callSites . clear ( ) ; if ( classNode instanceof InterfaceHelperClassNode ) { InterfaceHelperClassNode ihcn = ( InterfaceHelperClassNode ) classNode ; callSites . addAll ( ihcn . getCallSites ( ) ) ; } referencedClasses . clear ( ) ; this . classNode = classNode ; this . outermostClass = null ; this . internalClassName = BytecodeHelper . getClassInternalName ( classNode ) ; this . internalBaseClassName = BytecodeHelper . getClassInternalName ( classNode . getSuperClass ( ) ) ; cv . visit ( getBytecodeVersion ( ) , adjustedModifiers ( classNode . getModifiers ( ) ) , internalClassName , BytecodeHelper . getGenericsSignature ( classNode ) , internalBaseClassName , BytecodeHelper . getClassInternalNames ( classNode . getInterfaces ( ) ) ) ; cv . visitSource ( sourceFile , null ) ; visitAnnotations ( classNode , cv ) ; if ( classNode . isInterface ( ) ) { ClassNode owner = classNode ; if ( owner instanceof InnerClassNode ) { owner = owner . getOuterClass ( ) ; } String outerClassName = owner . getName ( ) ; String name = outerClassName + "<STR_LIT:$>" + context . getNextInnerClassIdx ( ) ; interfaceClassLoadingClass = new InterfaceHelperClassNode ( owner , name , <NUM_LIT> , ClassHelper . OBJECT_TYPE , callSites ) ; super . visitClass ( classNode ) ; createInterfaceSyntheticStaticFields ( ) ; } else { super . visitClass ( classNode ) ; if ( ! classNode . declaresInterface ( ClassHelper . GENERATED_CLOSURE_Type ) ) { createMopMethods ( ) ; } createSyntheticStaticFields ( ) ; } for ( Iterator iter = innerClasses . iterator ( ) ; iter . hasNext ( ) ; ) { ClassNode innerClass = ( ClassNode ) iter . next ( ) ; String innerClassName = innerClass . getName ( ) ; String innerClassInternalName = BytecodeHelper . getClassInternalName ( innerClassName ) ; { int index = innerClassName . lastIndexOf ( '<CHAR_LIT>' ) ; if ( index >= <NUM_LIT:0> ) innerClassName = innerClassName . substring ( index + <NUM_LIT:1> ) ; } String outerClassName = internalClassName ; MethodNode enclosingMethod = innerClass . getEnclosingMethod ( ) ; if ( enclosingMethod != null ) { outerClassName = null ; innerClassName = null ; } cv . visitInnerClass ( innerClassInternalName , outerClassName , innerClassName , adjustedModifiers ( innerClass . getModifiers ( ) ) ) ; } generateCallSiteArray ( ) ; cv . visitEnd ( ) ; } catch ( GroovyRuntimeException e ) { e . setModule ( classNode . getModule ( ) ) ; throw e ; } } private int adjustedModifiers ( int modifiers ) { boolean needsSuper = ( modifiers & ACC_INTERFACE ) == <NUM_LIT:0> ; return needsSuper ? modifiers | ACC_SUPER : modifiers ; } private void generateCallSiteArray ( ) { if ( ! classNode . isInterface ( ) ) { cv . visitField ( ACC_PRIVATE + ACC_STATIC + ACC_SYNTHETIC , "<STR_LIT>" , "<STR_LIT>" , null , null ) ; generateCreateCallSiteArray ( ) ; generateGetCallSiteArray ( ) ; } } private void generateGetCallSiteArray ( ) { int visibility = ( classNode instanceof InterfaceHelperClassNode ) ? ACC_PUBLIC : ACC_PRIVATE ; MethodVisitor mv = cv . visitMethod ( visibility + ACC_SYNTHETIC + ACC_STATIC , "<STR_LIT>" , "<STR_LIT>" , null , null ) ; mv . visitCode ( ) ; mv . visitFieldInsn ( GETSTATIC , internalClassName , "<STR_LIT>" , "<STR_LIT>" ) ; Label l0 = new Label ( ) ; mv . visitJumpInsn ( IFNULL , l0 ) ; mv . visitFieldInsn ( GETSTATIC , internalClassName , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitMethodInsn ( INVOKEVIRTUAL , "<STR_LIT>" , "<STR_LIT:get>" , "<STR_LIT>" ) ; mv . visitTypeInsn ( CHECKCAST , "<STR_LIT>" ) ; mv . visitInsn ( DUP ) ; mv . visitVarInsn ( ASTORE , <NUM_LIT:0> ) ; Label l1 = new Label ( ) ; mv . visitJumpInsn ( IFNONNULL , l1 ) ; mv . visitLabel ( l0 ) ; mv . visitMethodInsn ( INVOKESTATIC , internalClassName , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitVarInsn ( ASTORE , <NUM_LIT:0> ) ; mv . visitTypeInsn ( NEW , "<STR_LIT>" ) ; mv . visitInsn ( DUP ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; mv . visitMethodInsn ( INVOKESPECIAL , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitFieldInsn ( PUTSTATIC , internalClassName , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitLabel ( l1 ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; mv . visitFieldInsn ( GETFIELD , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitInsn ( ARETURN ) ; mv . visitMaxs ( <NUM_LIT:0> , <NUM_LIT:0> ) ; mv . visitEnd ( ) ; } private void generateCreateCallSiteArray ( ) { MethodVisitor mv = cv . visitMethod ( ACC_PRIVATE + ACC_SYNTHETIC + ACC_STATIC , "<STR_LIT>" , "<STR_LIT>" , null , null ) ; mv . visitCode ( ) ; mv . visitTypeInsn ( NEW , "<STR_LIT>" ) ; mv . visitInsn ( DUP ) ; mv . visitFieldInsn ( GETSTATIC , internalClassName , "<STR_LIT>" , "<STR_LIT>" ) ; final int size = callSites . size ( ) ; mv . visitLdcInsn ( size ) ; mv . visitTypeInsn ( ANEWARRAY , "<STR_LIT>" ) ; for ( int i = <NUM_LIT:0> ; i < size ; i ++ ) { mv . visitInsn ( DUP ) ; mv . visitLdcInsn ( i ) ; mv . visitLdcInsn ( callSites . get ( i ) ) ; mv . visitInsn ( AASTORE ) ; } mv . visitMethodInsn ( INVOKESPECIAL , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitInsn ( ARETURN ) ; mv . visitMaxs ( <NUM_LIT:0> , <NUM_LIT:0> ) ; mv . visitEnd ( ) ; } public void visitGenericType ( GenericsType genericsType ) { ClassNode type = genericsType . getType ( ) ; genericParameterNames . put ( type . getName ( ) , genericsType ) ; } private void createMopMethods ( ) { visitMopMethodList ( classNode . getMethods ( ) , true ) ; visitMopMethodList ( classNode . getSuperClass ( ) . getAllDeclaredMethods ( ) , false ) ; } private String [ ] buildExceptions ( ClassNode [ ] exceptions ) { if ( exceptions == null ) return null ; String [ ] ret = new String [ exceptions . length ] ; for ( int i = <NUM_LIT:0> ; i < exceptions . length ; i ++ ) { ret [ i ] = BytecodeHelper . getClassInternalName ( exceptions [ i ] ) ; } return ret ; } private void visitMopMethodList ( List methods , boolean isThis ) { HashMap mops = new HashMap ( ) ; class Key { int hash = <NUM_LIT:0> ; String name ; Parameter [ ] params ; Key ( String name , Parameter [ ] params ) { this . name = name ; this . params = params ; hash = name . hashCode ( ) << <NUM_LIT:2> + params . length ; } public int hashCode ( ) { return hash ; } public boolean equals ( Object obj ) { Key other = ( Key ) obj ; return other . name . equals ( name ) && equalParameterTypes ( other . params , params ) ; } } LinkedList mopCalls = new LinkedList ( ) ; for ( Iterator iter = methods . iterator ( ) ; iter . hasNext ( ) ; ) { MethodNode mn = ( MethodNode ) iter . next ( ) ; if ( ( mn . getModifiers ( ) & ACC_ABSTRACT ) != <NUM_LIT:0> ) continue ; if ( mn . isStatic ( ) ) continue ; if ( isThis ^ ( mn . getModifiers ( ) & ( ACC_PUBLIC | ACC_PROTECTED ) ) == <NUM_LIT:0> ) continue ; String methodName = mn . getName ( ) ; if ( isMopMethod ( methodName ) ) { mops . put ( new Key ( methodName , mn . getParameters ( ) ) , mn ) ; continue ; } if ( methodName . startsWith ( "<STR_LIT:<>" ) ) continue ; String name = getMopMethodName ( mn , isThis ) ; Key key = new Key ( name , mn . getParameters ( ) ) ; if ( mops . containsKey ( key ) ) continue ; mops . put ( key , mn ) ; mopCalls . add ( mn ) ; } generateMopCalls ( mopCalls , isThis ) ; mopCalls . clear ( ) ; mops . clear ( ) ; } private boolean equalParameterTypes ( Parameter [ ] p1 , Parameter [ ] p2 ) { if ( p1 . length != p2 . length ) return false ; for ( int i = <NUM_LIT:0> ; i < p1 . length ; i ++ ) { if ( ! p1 [ i ] . getType ( ) . equals ( p2 [ i ] . getType ( ) ) ) return false ; } return true ; } private void generateMopCalls ( LinkedList mopCalls , boolean useThis ) { for ( Iterator iter = mopCalls . iterator ( ) ; iter . hasNext ( ) ; ) { MethodNode method = ( MethodNode ) iter . next ( ) ; String name = getMopMethodName ( method , useThis ) ; Parameter [ ] parameters = method . getParameters ( ) ; String methodDescriptor = BytecodeHelper . getMethodDescriptor ( method . getReturnType ( ) , method . getParameters ( ) ) ; mv = cv . visitMethod ( Opcodes . ACC_PUBLIC | Opcodes . ACC_SYNTHETIC , name , methodDescriptor , null , null ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; int newRegister = <NUM_LIT:1> ; BytecodeHelper helper = new BytecodeHelper ( mv ) ; for ( int i = <NUM_LIT:0> ; i < parameters . length ; i ++ ) { ClassNode type = parameters [ i ] . getType ( ) ; helper . load ( parameters [ i ] . getType ( ) , newRegister ) ; newRegister ++ ; if ( type == ClassHelper . double_TYPE || type == ClassHelper . long_TYPE ) newRegister ++ ; } mv . visitMethodInsn ( INVOKESPECIAL , BytecodeHelper . getClassInternalName ( method . getDeclaringClass ( ) ) , method . getName ( ) , methodDescriptor ) ; helper . doReturn ( method . getReturnType ( ) ) ; mv . visitMaxs ( <NUM_LIT:0> , <NUM_LIT:0> ) ; mv . visitEnd ( ) ; classNode . addMethod ( name , Opcodes . ACC_PUBLIC | Opcodes . ACC_SYNTHETIC , method . getReturnType ( ) , parameters , null , null ) ; } } public static String getMopMethodName ( MethodNode method , boolean useThis ) { ClassNode declaringNode = method . getDeclaringClass ( ) ; int distance = <NUM_LIT:0> ; for ( ; declaringNode != null ; declaringNode = declaringNode . getSuperClass ( ) ) { distance ++ ; } return ( useThis ? "<STR_LIT>" : "<STR_LIT>" ) + "<STR_LIT:$>" + distance + "<STR_LIT:$>" + method . getName ( ) ; } public static boolean isMopMethod ( String methodName ) { return methodName . startsWith ( "<STR_LIT>" ) || methodName . startsWith ( "<STR_LIT>" ) ; } protected void visitConstructorOrMethod ( MethodNode node , boolean isConstructor ) { lineNumber = - <NUM_LIT:1> ; columnNumber = - <NUM_LIT:1> ; Parameter [ ] parameters = node . getParameters ( ) ; String methodType = BytecodeHelper . getMethodDescriptor ( node . getReturnType ( ) , parameters ) ; String signature = BytecodeHelper . getGenericsMethodSignature ( node ) ; int modifiers = node . getModifiers ( ) ; if ( isVargs ( node . getParameters ( ) ) ) modifiers |= Opcodes . ACC_VARARGS ; mv = cv . visitMethod ( modifiers , node . getName ( ) , methodType , signature , buildExceptions ( node . getExceptions ( ) ) ) ; mv = new MyMethodAdapter ( ) ; visitAnnotations ( node , mv ) ; for ( int i = <NUM_LIT:0> ; i < parameters . length ; i ++ ) { visitParameterAnnotations ( parameters [ i ] , i , mv ) ; } helper = new BytecodeHelper ( mv ) ; if ( classNode . isAnnotationDefinition ( ) ) { visitAnnotationDefault ( node , mv ) ; } else if ( ! node . isAbstract ( ) ) { Statement code = node . getCode ( ) ; if ( code instanceof BytecodeSequence && ( ( BytecodeSequence ) code ) . getInstructions ( ) . size ( ) == <NUM_LIT:1> && ( ( BytecodeSequence ) code ) . getInstructions ( ) . get ( <NUM_LIT:0> ) instanceof BytecodeInstruction ) { ( ( BytecodeInstruction ) ( ( BytecodeSequence ) code ) . getInstructions ( ) . get ( <NUM_LIT:0> ) ) . visit ( mv ) ; } else { visitStdMethod ( node , isConstructor , parameters , code ) ; } mv . visitMaxs ( <NUM_LIT:0> , <NUM_LIT:0> ) ; } mv . visitEnd ( ) ; } private void visitStdMethod ( MethodNode node , boolean isConstructor , Parameter [ ] parameters , Statement code ) { if ( isConstructor && ( code == null || ! ( ( ConstructorNode ) node ) . firstStatementIsSpecialConstructorCall ( ) ) ) { mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; mv . visitMethodInsn ( INVOKESPECIAL , BytecodeHelper . getClassInternalName ( classNode . getSuperClass ( ) ) , "<STR_LIT>" , "<STR_LIT>" ) ; } compileStack . init ( node . getVariableScope ( ) , parameters , mv , classNode ) ; if ( isNotClinit ( ) ) { mv . visitMethodInsn ( INVOKESTATIC , internalClassName , "<STR_LIT>" , "<STR_LIT>" ) ; callSiteArrayVarIndex = compileStack . defineTemporaryVariable ( "<STR_LIT>" , ClassHelper . make ( CallSite [ ] . class ) , true ) ; } super . visitConstructorOrMethod ( node , isConstructor ) ; if ( ! outputReturn || node . isVoidMethod ( ) ) { mv . visitInsn ( RETURN ) ; } compileStack . clear ( ) ; final Label finallyStart = new Label ( ) ; mv . visitJumpInsn ( GOTO , finallyStart ) ; for ( Iterator iter = exceptionBlocks . iterator ( ) ; iter . hasNext ( ) ; ) { Runnable runnable = ( Runnable ) iter . next ( ) ; runnable . run ( ) ; } exceptionBlocks . clear ( ) ; } void visitAnnotationDefaultExpression ( AnnotationVisitor av , ClassNode type , Expression exp ) { if ( type . isArray ( ) ) { ListExpression list = ( ListExpression ) exp ; AnnotationVisitor avl = av . visitArray ( null ) ; ClassNode componentType = type . getComponentType ( ) ; for ( Iterator it = list . getExpressions ( ) . iterator ( ) ; it . hasNext ( ) ; ) { Expression lExp = ( Expression ) it . next ( ) ; visitAnnotationDefaultExpression ( avl , componentType , lExp ) ; } } else if ( ClassHelper . isPrimitiveType ( type ) || type . equals ( ClassHelper . STRING_TYPE ) ) { ConstantExpression constExp = ( ConstantExpression ) exp ; av . visit ( null , constExp . getValue ( ) ) ; } else if ( ClassHelper . CLASS_Type . equals ( type ) ) { ClassNode clazz = exp . getType ( ) ; Type t = Type . getType ( BytecodeHelper . getTypeDescription ( clazz ) ) ; av . visit ( null , t ) ; } else if ( type . isDerivedFrom ( ClassHelper . Enum_Type ) ) { PropertyExpression pExp = ( PropertyExpression ) exp ; ClassExpression cExp = ( ClassExpression ) pExp . getObjectExpression ( ) ; String desc = BytecodeHelper . getTypeDescription ( cExp . getType ( ) ) ; String name = pExp . getPropertyAsString ( ) ; av . visitEnum ( null , desc , name ) ; } else if ( type . implementsInterface ( ClassHelper . Annotation_TYPE ) ) { AnnotationConstantExpression avExp = ( AnnotationConstantExpression ) exp ; AnnotationNode value = ( AnnotationNode ) avExp . getValue ( ) ; AnnotationVisitor avc = av . visitAnnotation ( null , BytecodeHelper . getTypeDescription ( avExp . getType ( ) ) ) ; visitAnnotationAttributes ( value , avc ) ; } else { throw new GroovyBugError ( "<STR_LIT>" + type . getName ( ) ) ; } av . visitEnd ( ) ; } private void visitAnnotationDefault ( MethodNode node , MethodVisitor mv ) { if ( ! node . hasAnnotationDefault ( ) ) return ; Expression exp = ( ( ReturnStatement ) node . getCode ( ) ) . getExpression ( ) ; AnnotationVisitor av = mv . visitAnnotationDefault ( ) ; visitAnnotationDefaultExpression ( av , node . getReturnType ( ) , exp ) ; } private boolean isNotClinit ( ) { return methodNode == null || ! methodNode . getName ( ) . equals ( "<STR_LIT>" ) ; } private boolean isVargs ( Parameter [ ] p ) { if ( p . length == <NUM_LIT:0> ) return false ; ClassNode clazz = p [ p . length - <NUM_LIT:1> ] . getType ( ) ; return ( clazz . isArray ( ) ) ; } public void visitConstructor ( ConstructorNode node ) { this . constructorNode = node ; this . methodNode = null ; outputReturn = false ; super . visitConstructor ( node ) ; } public void visitMethod ( MethodNode node ) { this . constructorNode = null ; this . methodNode = node ; outputReturn = false ; super . visitMethod ( node ) ; } public void visitField ( FieldNode fieldNode ) { onLineNumber ( fieldNode , "<STR_LIT>" + fieldNode . getName ( ) ) ; ClassNode t = fieldNode . getType ( ) ; String signature = helper . getGenericsBounds ( t ) ; FieldVisitor fv = cv . visitField ( fieldNode . getModifiers ( ) , fieldNode . getName ( ) , BytecodeHelper . getTypeDescription ( t ) , signature , null ) ; visitAnnotations ( fieldNode , fv ) ; fv . visitEnd ( ) ; } public void visitProperty ( PropertyNode statement ) { onLineNumber ( statement , "<STR_LIT>" + statement . getField ( ) . getName ( ) ) ; this . methodNode = null ; } protected void visitStatement ( Statement statement ) { String name = statement . getStatementLabel ( ) ; if ( name != null ) { Label label = compileStack . createLocalLabel ( name ) ; mv . visitLabel ( label ) ; } } public void visitBlockStatement ( BlockStatement block ) { onLineNumber ( block , "<STR_LIT>" ) ; visitStatement ( block ) ; compileStack . pushVariableScope ( block . getVariableScope ( ) ) ; super . visitBlockStatement ( block ) ; compileStack . pop ( ) ; } private void visitExpressionOrStatement ( Object o ) { if ( o == EmptyExpression . INSTANCE ) return ; if ( o instanceof Expression ) { Expression expr = ( Expression ) o ; visitAndAutoboxBoolean ( expr ) ; if ( isPopRequired ( expr ) ) mv . visitInsn ( POP ) ; } else { ( ( Statement ) o ) . visit ( this ) ; } } private void visitForLoopWithClosureList ( ForStatement loop ) { compileStack . pushLoop ( loop . getVariableScope ( ) , loop . getStatementLabel ( ) ) ; ClosureListExpression clExpr = ( ClosureListExpression ) loop . getCollectionExpression ( ) ; compileStack . pushVariableScope ( clExpr . getVariableScope ( ) ) ; List expressions = clExpr . getExpressions ( ) ; int size = expressions . size ( ) ; int condIndex = ( size - <NUM_LIT:1> ) / <NUM_LIT:2> ; for ( int i = <NUM_LIT:0> ; i < condIndex ; i ++ ) { visitExpressionOrStatement ( expressions . get ( i ) ) ; } Label continueLabel = compileStack . getContinueLabel ( ) ; Label breakLabel = compileStack . getBreakLabel ( ) ; Label cond = new Label ( ) ; mv . visitLabel ( cond ) ; { Expression condExpr = ( Expression ) expressions . get ( condIndex ) ; if ( condExpr == EmptyExpression . INSTANCE ) { mv . visitIntInsn ( BIPUSH , <NUM_LIT:1> ) ; } else if ( isComparisonExpression ( condExpr ) ) { condExpr . visit ( this ) ; } else { visitAndAutoboxBoolean ( condExpr ) ; helper . unbox ( ClassHelper . boolean_TYPE ) ; } } mv . visitJumpInsn ( IFEQ , breakLabel ) ; loop . getLoopBlock ( ) . visit ( this ) ; mv . visitLabel ( continueLabel ) ; for ( int i = condIndex + <NUM_LIT:1> ; i < size ; i ++ ) { visitExpressionOrStatement ( expressions . get ( i ) ) ; } mv . visitJumpInsn ( GOTO , cond ) ; mv . visitLabel ( breakLabel ) ; compileStack . pop ( ) ; compileStack . pop ( ) ; } public void visitForLoop ( ForStatement loop ) { onLineNumber ( loop , "<STR_LIT>" ) ; visitStatement ( loop ) ; Parameter loopVar = loop . getVariable ( ) ; if ( loopVar == ForStatement . FOR_LOOP_DUMMY ) { visitForLoopWithClosureList ( loop ) ; return ; } compileStack . pushLoop ( loop . getVariableScope ( ) , loop . getStatementLabel ( ) ) ; Variable variable = compileStack . defineVariable ( loop . getVariable ( ) , false ) ; MethodCallExpression iterator = new MethodCallExpression ( loop . getCollectionExpression ( ) , "<STR_LIT>" , new ArgumentListExpression ( ) ) ; iterator . visit ( this ) ; final int iteratorIdx = compileStack . defineTemporaryVariable ( "<STR_LIT>" , ClassHelper . make ( java . util . Iterator . class ) , true ) ; Label continueLabel = compileStack . getContinueLabel ( ) ; Label breakLabel = compileStack . getBreakLabel ( ) ; mv . visitLabel ( continueLabel ) ; mv . visitVarInsn ( ALOAD , iteratorIdx ) ; iteratorHasNextMethod . call ( mv ) ; mv . visitJumpInsn ( IFEQ , breakLabel ) ; mv . visitVarInsn ( ALOAD , iteratorIdx ) ; iteratorNextMethod . call ( mv ) ; helper . storeVar ( variable ) ; loop . getLoopBlock ( ) . visit ( this ) ; mv . visitJumpInsn ( GOTO , continueLabel ) ; mv . visitLabel ( breakLabel ) ; compileStack . pop ( ) ; } public void visitWhileLoop ( WhileStatement loop ) { onLineNumber ( loop , "<STR_LIT>" ) ; visitStatement ( loop ) ; compileStack . pushLoop ( loop . getStatementLabel ( ) ) ; Label continueLabel = compileStack . getContinueLabel ( ) ; Label breakLabel = compileStack . getBreakLabel ( ) ; mv . visitLabel ( continueLabel ) ; Expression bool = loop . getBooleanExpression ( ) ; boolean boolHandled = false ; if ( bool instanceof ConstantExpression ) { ConstantExpression constant = ( ConstantExpression ) bool ; if ( constant . getValue ( ) == Boolean . TRUE ) { boolHandled = true ; } else if ( constant . getValue ( ) == Boolean . FALSE ) { boolHandled = true ; mv . visitJumpInsn ( GOTO , breakLabel ) ; } } if ( ! boolHandled ) { bool . visit ( this ) ; mv . visitJumpInsn ( IFEQ , breakLabel ) ; } loop . getLoopBlock ( ) . visit ( this ) ; mv . visitJumpInsn ( GOTO , continueLabel ) ; mv . visitLabel ( breakLabel ) ; compileStack . pop ( ) ; } public void visitDoWhileLoop ( DoWhileStatement loop ) { onLineNumber ( loop , "<STR_LIT>" ) ; visitStatement ( loop ) ; compileStack . pushLoop ( loop . getStatementLabel ( ) ) ; Label breakLabel = compileStack . getBreakLabel ( ) ; Label continueLabel = compileStack . getContinueLabel ( ) ; mv . visitLabel ( continueLabel ) ; loop . getLoopBlock ( ) . visit ( this ) ; loop . getBooleanExpression ( ) . visit ( this ) ; mv . visitJumpInsn ( IFEQ , continueLabel ) ; mv . visitLabel ( breakLabel ) ; compileStack . pop ( ) ; } public void visitIfElse ( IfStatement ifElse ) { onLineNumber ( ifElse , "<STR_LIT>" ) ; visitStatement ( ifElse ) ; ifElse . getBooleanExpression ( ) . visit ( this ) ; Label l0 = new Label ( ) ; mv . visitJumpInsn ( IFEQ , l0 ) ; compileStack . pushBooleanExpression ( ) ; ifElse . getIfBlock ( ) . visit ( this ) ; compileStack . pop ( ) ; Label l1 = new Label ( ) ; mv . visitJumpInsn ( GOTO , l1 ) ; mv . visitLabel ( l0 ) ; compileStack . pushBooleanExpression ( ) ; ifElse . getElseBlock ( ) . visit ( this ) ; compileStack . pop ( ) ; mv . visitLabel ( l1 ) ; } public void visitTernaryExpression ( TernaryExpression expression ) { onLineNumber ( expression , "<STR_LIT>" ) ; BooleanExpression boolPart = expression . getBooleanExpression ( ) ; Expression truePart = expression . getTrueExpression ( ) ; Expression falsePart = expression . getFalseExpression ( ) ; if ( expression instanceof ElvisOperatorExpression ) { visitAndAutoboxBoolean ( expression . getTrueExpression ( ) ) ; boolPart = new BooleanExpression ( new BytecodeExpression ( ) { public void visit ( MethodVisitor mv ) { mv . visitInsn ( DUP ) ; } } ) ; truePart = BytecodeExpression . NOP ; final Expression oldFalse = falsePart ; falsePart = new BytecodeExpression ( ) { public void visit ( MethodVisitor mv ) { mv . visitInsn ( POP ) ; visitAndAutoboxBoolean ( oldFalse ) ; } } ; } boolPart . visit ( this ) ; Label l0 = new Label ( ) ; mv . visitJumpInsn ( IFEQ , l0 ) ; compileStack . pushBooleanExpression ( ) ; visitAndAutoboxBoolean ( truePart ) ; compileStack . pop ( ) ; Label l1 = new Label ( ) ; mv . visitJumpInsn ( GOTO , l1 ) ; mv . visitLabel ( l0 ) ; compileStack . pushBooleanExpression ( ) ; visitAndAutoboxBoolean ( falsePart ) ; compileStack . pop ( ) ; mv . visitLabel ( l1 ) ; } public void visitAssertStatement ( AssertStatement statement ) { onLineNumber ( statement , "<STR_LIT>" ) ; visitStatement ( statement ) ; BooleanExpression booleanExpression = statement . getBooleanExpression ( ) ; booleanExpression . visit ( this ) ; Label l0 = new Label ( ) ; mv . visitJumpInsn ( IFEQ , l0 ) ; Label l1 = new Label ( ) ; mv . visitJumpInsn ( GOTO , l1 ) ; mv . visitLabel ( l0 ) ; String expressionText = booleanExpression . getText ( ) ; List list = new ArrayList ( ) ; addVariableNames ( booleanExpression , list ) ; if ( list . isEmpty ( ) ) { mv . visitLdcInsn ( expressionText ) ; } else { boolean first = true ; mv . visitTypeInsn ( NEW , "<STR_LIT>" ) ; mv . visitInsn ( DUP ) ; mv . visitLdcInsn ( expressionText + "<STR_LIT>" ) ; mv . visitMethodInsn ( INVOKESPECIAL , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; int tempIndex = compileStack . defineTemporaryVariable ( "<STR_LIT>" , true ) ; for ( Iterator iter = list . iterator ( ) ; iter . hasNext ( ) ; ) { String name = ( String ) iter . next ( ) ; String text = name + "<STR_LIT:U+0020=U+0020>" ; if ( first ) { first = false ; } else { text = "<STR_LIT:U+002CU+0020>" + text ; } mv . visitVarInsn ( ALOAD , tempIndex ) ; mv . visitLdcInsn ( text ) ; mv . visitMethodInsn ( INVOKEVIRTUAL , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitInsn ( POP ) ; mv . visitVarInsn ( ALOAD , tempIndex ) ; new VariableExpression ( name ) . visit ( this ) ; mv . visitMethodInsn ( INVOKESTATIC , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitMethodInsn ( INVOKEVIRTUAL , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitInsn ( POP ) ; } mv . visitVarInsn ( ALOAD , tempIndex ) ; compileStack . removeVar ( tempIndex ) ; } visitAndAutoboxBoolean ( statement . getMessageExpression ( ) ) ; assertFailedMethod . call ( mv ) ; mv . visitLabel ( l1 ) ; } private void addVariableNames ( Expression expression , List list ) { if ( expression instanceof BooleanExpression ) { BooleanExpression boolExp = ( BooleanExpression ) expression ; addVariableNames ( boolExp . getExpression ( ) , list ) ; } else if ( expression instanceof BinaryExpression ) { BinaryExpression binExp = ( BinaryExpression ) expression ; addVariableNames ( binExp . getLeftExpression ( ) , list ) ; addVariableNames ( binExp . getRightExpression ( ) , list ) ; } else if ( expression instanceof VariableExpression ) { VariableExpression varExp = ( VariableExpression ) expression ; list . add ( varExp . getName ( ) ) ; } } public void visitTryCatchFinally ( TryCatchStatement statement ) { onLineNumber ( statement , "<STR_LIT>" ) ; visitStatement ( statement ) ; CatchStatement catchStatement = statement . getCatchStatement ( <NUM_LIT:0> ) ; Statement tryStatement = statement . getTryStatement ( ) ; final Statement finallyStatement = statement . getFinallyStatement ( ) ; int anyExceptionIndex = compileStack . defineTemporaryVariable ( "<STR_LIT>" , false ) ; if ( ! finallyStatement . isEmpty ( ) ) { compileStack . pushFinallyBlock ( new Runnable ( ) { public void run ( ) { compileStack . pushFinallyBlockVisit ( this ) ; finallyStatement . visit ( AsmClassGenerator . this ) ; compileStack . popFinallyBlockVisit ( this ) ; } } ) ; } final Label tryStart = new Label ( ) ; mv . visitLabel ( tryStart ) ; tryStatement . visit ( this ) ; final Label finallyStart = new Label ( ) ; mv . visitJumpInsn ( GOTO , finallyStart ) ; final Label greEnd = new Label ( ) ; mv . visitLabel ( greEnd ) ; final Label tryEnd = new Label ( ) ; mv . visitLabel ( tryEnd ) ; for ( Iterator it = statement . getCatchStatements ( ) . iterator ( ) ; it . hasNext ( ) ; ) { catchStatement = ( CatchStatement ) it . next ( ) ; ClassNode exceptionType = catchStatement . getExceptionType ( ) ; final Label catchStart = new Label ( ) ; mv . visitLabel ( catchStart ) ; compileStack . pushState ( ) ; compileStack . defineVariable ( catchStatement . getVariable ( ) , true ) ; catchStatement . visit ( this ) ; compileStack . pop ( ) ; mv . visitJumpInsn ( GOTO , finallyStart ) ; final String exceptionTypeInternalName = BytecodeHelper . getClassInternalName ( exceptionType ) ; exceptionBlocks . add ( new Runnable ( ) { public void run ( ) { mv . visitTryCatchBlock ( tryStart , tryEnd , catchStart , exceptionTypeInternalName ) ; } } ) ; } final Label endOfAllCatches = new Label ( ) ; mv . visitLabel ( endOfAllCatches ) ; if ( ! finallyStatement . isEmpty ( ) ) compileStack . popFinallyBlock ( ) ; mv . visitLabel ( finallyStart ) ; finallyStatement . visit ( this ) ; Label afterFinally = new Label ( ) ; mv . visitJumpInsn ( GOTO , afterFinally ) ; final Label catchAny = new Label ( ) ; mv . visitLabel ( catchAny ) ; mv . visitVarInsn ( ASTORE , anyExceptionIndex ) ; finallyStatement . visit ( this ) ; mv . visitVarInsn ( ALOAD , anyExceptionIndex ) ; mv . visitInsn ( ATHROW ) ; mv . visitLabel ( afterFinally ) ; exceptionBlocks . add ( new Runnable ( ) { public void run ( ) { mv . visitTryCatchBlock ( tryStart , endOfAllCatches , catchAny , null ) ; } } ) ; } public void visitSwitch ( SwitchStatement statement ) { onLineNumber ( statement , "<STR_LIT>" ) ; visitStatement ( statement ) ; statement . getExpression ( ) . visit ( this ) ; Label breakLabel = compileStack . pushSwitch ( ) ; int switchVariableIndex = compileStack . defineTemporaryVariable ( "<STR_LIT>" , true ) ; List caseStatements = statement . getCaseStatements ( ) ; int caseCount = caseStatements . size ( ) ; Label [ ] labels = new Label [ caseCount + <NUM_LIT:1> ] ; for ( int i = <NUM_LIT:0> ; i < caseCount ; i ++ ) { labels [ i ] = new Label ( ) ; } int i = <NUM_LIT:0> ; for ( Iterator iter = caseStatements . iterator ( ) ; iter . hasNext ( ) ; i ++ ) { CaseStatement caseStatement = ( CaseStatement ) iter . next ( ) ; visitCaseStatement ( caseStatement , switchVariableIndex , labels [ i ] , labels [ i + <NUM_LIT:1> ] ) ; } statement . getDefaultStatement ( ) . visit ( this ) ; mv . visitLabel ( breakLabel ) ; compileStack . pop ( ) ; } public void visitCaseStatement ( CaseStatement statement ) { } public void visitCaseStatement ( CaseStatement statement , int switchVariableIndex , Label thisLabel , Label nextLabel ) { onLineNumber ( statement , "<STR_LIT>" ) ; mv . visitVarInsn ( ALOAD , switchVariableIndex ) ; statement . getExpression ( ) . visit ( this ) ; isCaseMethod . call ( mv ) ; Label l0 = new Label ( ) ; mv . visitJumpInsn ( IFEQ , l0 ) ; mv . visitLabel ( thisLabel ) ; statement . getCode ( ) . visit ( this ) ; if ( nextLabel != null ) { mv . visitJumpInsn ( GOTO , nextLabel ) ; } mv . visitLabel ( l0 ) ; } public void visitBreakStatement ( BreakStatement statement ) { onLineNumber ( statement , "<STR_LIT>" ) ; visitStatement ( statement ) ; String name = statement . getLabel ( ) ; Label breakLabel = compileStack . getNamedBreakLabel ( name ) ; if ( breakLabel == null ) { return ; } compileStack . applyFinallyBlocks ( breakLabel , true ) ; mv . visitJumpInsn ( GOTO , breakLabel ) ; } public void visitContinueStatement ( ContinueStatement statement ) { onLineNumber ( statement , "<STR_LIT>" ) ; visitStatement ( statement ) ; String name = statement . getLabel ( ) ; Label continueLabel = compileStack . getContinueLabel ( ) ; if ( name != null ) continueLabel = compileStack . getNamedContinueLabel ( name ) ; compileStack . applyFinallyBlocks ( continueLabel , false ) ; if ( continueLabel == null ) { return ; } mv . visitJumpInsn ( GOTO , continueLabel ) ; } public void visitSynchronizedStatement ( SynchronizedStatement statement ) { onLineNumber ( statement , "<STR_LIT>" ) ; visitStatement ( statement ) ; statement . getExpression ( ) . visit ( this ) ; final int index = compileStack . defineTemporaryVariable ( "<STR_LIT>" , ClassHelper . Integer_TYPE , true ) ; final Label synchronizedStart = new Label ( ) ; final Label synchronizedEnd = new Label ( ) ; final Label catchAll = new Label ( ) ; mv . visitVarInsn ( ALOAD , index ) ; mv . visitInsn ( MONITORENTER ) ; mv . visitLabel ( synchronizedStart ) ; Runnable finallyPart = new Runnable ( ) { public void run ( ) { mv . visitVarInsn ( ALOAD , index ) ; mv . visitInsn ( MONITOREXIT ) ; } } ; compileStack . pushFinallyBlock ( finallyPart ) ; statement . getCode ( ) . visit ( this ) ; finallyPart . run ( ) ; mv . visitJumpInsn ( GOTO , synchronizedEnd ) ; mv . visitLabel ( catchAll ) ; finallyPart . run ( ) ; mv . visitInsn ( ATHROW ) ; mv . visitLabel ( synchronizedEnd ) ; compileStack . popFinallyBlock ( ) ; exceptionBlocks . add ( new Runnable ( ) { public void run ( ) { mv . visitTryCatchBlock ( synchronizedStart , catchAll , catchAll , null ) ; } } ) ; } public void visitThrowStatement ( ThrowStatement statement ) { onLineNumber ( statement , "<STR_LIT>" ) ; visitStatement ( statement ) ; statement . getExpression ( ) . visit ( this ) ; mv . visitTypeInsn ( CHECKCAST , "<STR_LIT>" ) ; mv . visitInsn ( ATHROW ) ; } public void visitReturnStatement ( ReturnStatement statement ) { onLineNumber ( statement , "<STR_LIT>" ) ; visitStatement ( statement ) ; ClassNode returnType ; if ( methodNode != null ) { returnType = methodNode . getReturnType ( ) ; } else if ( constructorNode != null ) { returnType = constructorNode . getReturnType ( ) ; } else { throw new GroovyBugError ( "<STR_LIT>" ) ; } if ( returnType == ClassHelper . VOID_TYPE ) { if ( ! ( statement . isReturningNullOrVoid ( ) ) ) { throwException ( "<STR_LIT>" ) ; } compileStack . applyFinallyBlocks ( ) ; mv . visitInsn ( RETURN ) ; outputReturn = true ; return ; } Expression expression = statement . getExpression ( ) ; evaluateExpression ( expression ) ; if ( returnType == ClassHelper . OBJECT_TYPE && expression . getType ( ) != null && expression . getType ( ) == ClassHelper . VOID_TYPE ) { mv . visitInsn ( ACONST_NULL ) ; } else { doConvertAndCast ( returnType , expression , false , true , false ) ; } if ( compileStack . hasFinallyBlocks ( ) ) { int returnValueIdx = compileStack . defineTemporaryVariable ( "<STR_LIT>" , ClassHelper . OBJECT_TYPE , true ) ; compileStack . applyFinallyBlocks ( ) ; helper . load ( ClassHelper . OBJECT_TYPE , returnValueIdx ) ; } helper . unbox ( returnType ) ; helper . doReturn ( returnType ) ; outputReturn = true ; } protected void doConvertAndCast ( ClassNode type , Expression expression , boolean ignoreAutoboxing , boolean forceCast , boolean coerce ) { ClassNode expType = getExpressionType ( expression ) ; if ( ! ignoreAutoboxing && ClassHelper . isPrimitiveType ( type ) ) { type = ClassHelper . getWrapper ( type ) ; } if ( forceCast || ( type != null && ! expType . isDerivedFrom ( type ) && ! expType . implementsInterface ( type ) ) ) { doConvertAndCast ( type , coerce ) ; } } protected void evaluateExpression ( Expression expression ) { visitAndAutoboxBoolean ( expression ) ; if ( isPopRequired ( expression ) ) { return ; } Expression assignExpr = createReturnLHSExpression ( expression ) ; if ( assignExpr != null ) { leftHandExpression = false ; assignExpr . visit ( this ) ; } } public void visitExpressionStatement ( ExpressionStatement statement ) { onLineNumber ( statement , "<STR_LIT>" + statement . getExpression ( ) . getClass ( ) . getName ( ) ) ; visitStatement ( statement ) ; Expression expression = statement . getExpression ( ) ; visitAndAutoboxBoolean ( expression ) ; if ( isPopRequired ( expression ) ) { mv . visitInsn ( POP ) ; } } public void visitDeclarationExpression ( DeclarationExpression expression ) { onLineNumber ( expression , "<STR_LIT>" + expression . getText ( ) + "<STR_LIT:\">" ) ; evaluateEqual ( expression , true ) ; } public void visitBinaryExpression ( BinaryExpression expression ) { onLineNumber ( expression , "<STR_LIT>" + expression . getOperation ( ) . getText ( ) + "<STR_LIT>" ) ; switch ( expression . getOperation ( ) . getType ( ) ) { case Types . EQUAL : evaluateEqual ( expression , false ) ; break ; case Types . COMPARE_IDENTICAL : evaluateBinaryExpression ( compareIdenticalMethod , expression ) ; break ; case Types . COMPARE_EQUAL : evaluateBinaryExpression ( compareEqualMethod , expression ) ; break ; case Types . COMPARE_NOT_EQUAL : evaluateBinaryExpression ( compareNotEqualMethod , expression ) ; break ; case Types . COMPARE_TO : evaluateCompareTo ( expression ) ; break ; case Types . COMPARE_GREATER_THAN : evaluateBinaryExpression ( compareGreaterThanMethod , expression ) ; break ; case Types . COMPARE_GREATER_THAN_EQUAL : evaluateBinaryExpression ( compareGreaterThanEqualMethod , expression ) ; break ; case Types . COMPARE_LESS_THAN : evaluateBinaryExpression ( compareLessThanMethod , expression ) ; break ; case Types . COMPARE_LESS_THAN_EQUAL : evaluateBinaryExpression ( compareLessThanEqualMethod , expression ) ; break ; case Types . LOGICAL_AND : evaluateLogicalAndExpression ( expression ) ; break ; case Types . LOGICAL_OR : evaluateLogicalOrExpression ( expression ) ; break ; case Types . BITWISE_AND : evaluateBinaryExpression ( "<STR_LIT>" , expression ) ; break ; case Types . BITWISE_AND_EQUAL : evaluateBinaryExpressionWithAssignment ( "<STR_LIT>" , expression ) ; break ; case Types . BITWISE_OR : evaluateBinaryExpression ( "<STR_LIT>" , expression ) ; break ; case Types . BITWISE_OR_EQUAL : evaluateBinaryExpressionWithAssignment ( "<STR_LIT>" , expression ) ; break ; case Types . BITWISE_XOR : evaluateBinaryExpression ( "<STR_LIT>" , expression ) ; break ; case Types . BITWISE_XOR_EQUAL : evaluateBinaryExpressionWithAssignment ( "<STR_LIT>" , expression ) ; break ; case Types . PLUS : evaluateBinaryExpression ( "<STR_LIT>" , expression ) ; break ; case Types . PLUS_EQUAL : evaluateBinaryExpressionWithAssignment ( "<STR_LIT>" , expression ) ; break ; case Types . MINUS : evaluateBinaryExpression ( "<STR_LIT>" , expression ) ; break ; case Types . MINUS_EQUAL : evaluateBinaryExpressionWithAssignment ( "<STR_LIT>" , expression ) ; break ; case Types . MULTIPLY : evaluateBinaryExpression ( "<STR_LIT>" , expression ) ; break ; case Types . MULTIPLY_EQUAL : evaluateBinaryExpressionWithAssignment ( "<STR_LIT>" , expression ) ; break ; case Types . DIVIDE : evaluateBinaryExpression ( "<STR_LIT>" , expression ) ; break ; case Types . DIVIDE_EQUAL : evaluateBinaryExpressionWithAssignment ( "<STR_LIT>" , expression ) ; break ; case Types . INTDIV : evaluateBinaryExpression ( "<STR_LIT>" , expression ) ; break ; case Types . INTDIV_EQUAL : evaluateBinaryExpressionWithAssignment ( "<STR_LIT>" , expression ) ; break ; case Types . MOD : evaluateBinaryExpression ( "<STR_LIT>" , expression ) ; break ; case Types . MOD_EQUAL : evaluateBinaryExpressionWithAssignment ( "<STR_LIT>" , expression ) ; break ; case Types . POWER : evaluateBinaryExpression ( "<STR_LIT>" , expression ) ; break ; case Types . POWER_EQUAL : evaluateBinaryExpressionWithAssignment ( "<STR_LIT>" , expression ) ; break ; case Types . LEFT_SHIFT : evaluateBinaryExpression ( "<STR_LIT>" , expression ) ; break ; case Types . LEFT_SHIFT_EQUAL : evaluateBinaryExpressionWithAssignment ( "<STR_LIT>" , expression ) ; break ; case Types . RIGHT_SHIFT : evaluateBinaryExpression ( "<STR_LIT>" , expression ) ; break ; case Types . RIGHT_SHIFT_EQUAL : evaluateBinaryExpressionWithAssignment ( "<STR_LIT>" , expression ) ; break ; case Types . RIGHT_SHIFT_UNSIGNED : evaluateBinaryExpression ( "<STR_LIT>" , expression ) ; break ; case Types . RIGHT_SHIFT_UNSIGNED_EQUAL : evaluateBinaryExpressionWithAssignment ( "<STR_LIT>" , expression ) ; break ; case Types . KEYWORD_INSTANCEOF : evaluateInstanceof ( expression ) ; break ; case Types . FIND_REGEX : evaluateBinaryExpression ( findRegexMethod , expression ) ; break ; case Types . MATCH_REGEX : evaluateBinaryExpression ( matchRegexMethod , expression ) ; break ; case Types . LEFT_SQUARE_BRACKET : if ( leftHandExpression ) { throwException ( "<STR_LIT>" ) ; } else { evaluateBinaryExpression ( "<STR_LIT>" , expression ) ; } break ; case Types . KEYWORD_IN : evaluateBinaryExpression ( isCaseMethod , expression ) ; break ; default : throwException ( "<STR_LIT>" + expression . getOperation ( ) + "<STR_LIT>" ) ; } } private void load ( Expression exp ) { boolean wasLeft = leftHandExpression ; leftHandExpression = false ; visitAndAutoboxBoolean ( exp ) ; leftHandExpression = wasLeft ; } public void visitPostfixExpression ( PostfixExpression expression ) { switch ( expression . getOperation ( ) . getType ( ) ) { case Types . PLUS_PLUS : evaluatePostfixMethod ( "<STR_LIT>" , expression . getExpression ( ) ) ; break ; case Types . MINUS_MINUS : evaluatePostfixMethod ( "<STR_LIT>" , expression . getExpression ( ) ) ; break ; } } private void throwException ( String s ) { throw new RuntimeParserException ( s , currentASTNode ) ; } public void visitPrefixExpression ( PrefixExpression expression ) { switch ( expression . getOperation ( ) . getType ( ) ) { case Types . PLUS_PLUS : evaluatePrefixMethod ( "<STR_LIT>" , expression . getExpression ( ) ) ; break ; case Types . MINUS_MINUS : evaluatePrefixMethod ( "<STR_LIT>" , expression . getExpression ( ) ) ; break ; } } public void visitClosureExpression ( ClosureExpression expression ) { ClassNode innerClass = ( ClassNode ) closureClassMap . get ( expression ) ; if ( innerClass == null ) { innerClass = createClosureClass ( expression ) ; closureClassMap . put ( expression , innerClass ) ; addInnerClass ( innerClass ) ; innerClass . addInterface ( ClassHelper . GENERATED_CLOSURE_Type ) ; } String innerClassinternalName = BytecodeHelper . getClassInternalName ( innerClass ) ; passingClosureParams = true ; List constructors = innerClass . getDeclaredConstructors ( ) ; ConstructorNode node = ( ConstructorNode ) constructors . get ( <NUM_LIT:0> ) ; Parameter [ ] localVariableParams = node . getParameters ( ) ; mv . visitTypeInsn ( NEW , innerClassinternalName ) ; mv . visitInsn ( DUP ) ; if ( ( isStaticMethod ( ) || specialCallWithinConstructor ) && ! classNode . declaresInterface ( ClassHelper . GENERATED_CLOSURE_Type ) ) { visitClassExpression ( new ClassExpression ( classNode ) ) ; visitClassExpression ( new ClassExpression ( getOutermostClass ( ) ) ) ; } else { mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; loadThis ( ) ; } for ( int i = <NUM_LIT:2> ; i < localVariableParams . length ; i ++ ) { Parameter param = localVariableParams [ i ] ; String name = param . getName ( ) ; if ( ! compileStack . containsVariable ( name ) && compileStack . getScope ( ) . isReferencedClassVariable ( name ) ) { visitFieldExpression ( new FieldExpression ( classNode . getDeclaredField ( name ) ) ) ; } else { Variable v = compileStack . getVariable ( name , classNode . getSuperClass ( ) != ClassHelper . CLOSURE_TYPE ) ; if ( v == null ) { FieldNode field = classNode . getDeclaredField ( name ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; mv . visitFieldInsn ( GETFIELD , internalClassName , name , BytecodeHelper . getTypeDescription ( field . getType ( ) ) ) ; param . setClosureSharedVariable ( false ) ; v = compileStack . defineVariable ( param , true ) ; param . setClosureSharedVariable ( true ) ; v . setHolder ( true ) ; } mv . visitVarInsn ( ALOAD , v . getIndex ( ) ) ; } } passingClosureParams = false ; mv . visitMethodInsn ( INVOKESPECIAL , innerClassinternalName , "<STR_LIT>" , BytecodeHelper . getMethodDescriptor ( ClassHelper . VOID_TYPE , localVariableParams ) ) ; } protected void loadThisOrOwner ( ) { if ( isInnerClass ( ) ) { visitFieldExpression ( new FieldExpression ( classNode . getDeclaredField ( "<STR_LIT>" ) ) ) ; } else { loadThis ( ) ; } } public void visitRegexExpression ( RegexExpression expression ) { expression . getRegex ( ) . visit ( this ) ; regexPattern . call ( mv ) ; } public void visitConstantExpression ( ConstantExpression expression ) { final String constantName = expression . getConstantName ( ) ; if ( ( methodNode != null && methodNode . getName ( ) . equals ( "<STR_LIT>" ) ) || constantName == null ) { Object value = expression . getValue ( ) ; helper . loadConstant ( value ) ; } else { mv . visitFieldInsn ( GETSTATIC , internalClassName , constantName , BytecodeHelper . getTypeDescription ( expression . getType ( ) ) ) ; } } public void visitSpreadExpression ( SpreadExpression expression ) { throw new GroovyBugError ( "<STR_LIT>" ) ; } public void visitSpreadMapExpression ( SpreadMapExpression expression ) { Expression subExpression = expression . getExpression ( ) ; subExpression . visit ( this ) ; spreadMap . call ( mv ) ; } public void visitMethodPointerExpression ( MethodPointerExpression expression ) { Expression subExpression = expression . getExpression ( ) ; subExpression . visit ( this ) ; loadDynamicName ( expression . getMethodName ( ) ) ; getMethodPointer . call ( mv ) ; } private void loadDynamicName ( Expression name ) { if ( name instanceof ConstantExpression ) { ConstantExpression ce = ( ConstantExpression ) name ; Object value = ce . getValue ( ) ; if ( value instanceof String ) { helper . loadConstant ( value ) ; return ; } } new CastExpression ( ClassHelper . STRING_TYPE , name ) . visit ( this ) ; } public void visitUnaryMinusExpression ( UnaryMinusExpression expression ) { Expression subExpression = expression . getExpression ( ) ; subExpression . visit ( this ) ; unaryMinus . call ( mv ) ; } public void visitUnaryPlusExpression ( UnaryPlusExpression expression ) { Expression subExpression = expression . getExpression ( ) ; subExpression . visit ( this ) ; unaryPlus . call ( mv ) ; } public void visitBitwiseNegationExpression ( BitwiseNegationExpression expression ) { Expression subExpression = expression . getExpression ( ) ; subExpression . visit ( this ) ; bitwiseNegate . call ( mv ) ; } public void visitCastExpression ( CastExpression castExpression ) { ClassNode type = castExpression . getType ( ) ; visitAndAutoboxBoolean ( castExpression . getExpression ( ) ) ; final ClassNode rht = rightHandType ; rightHandType = castExpression . getExpression ( ) . getType ( ) ; doConvertAndCast ( type , castExpression . getExpression ( ) , castExpression . isIgnoringAutoboxing ( ) , false , castExpression . isCoerce ( ) ) ; rightHandType = rht ; } public void visitNotExpression ( NotExpression expression ) { Expression subExpression = expression . getExpression ( ) ; subExpression . visit ( this ) ; if ( ! isComparisonExpression ( subExpression ) && ! ( subExpression instanceof BooleanExpression ) ) { helper . unbox ( boolean . class ) ; } helper . negateBoolean ( ) ; } public void visitBooleanExpression ( BooleanExpression expression ) { compileStack . pushBooleanExpression ( ) ; expression . getExpression ( ) . visit ( this ) ; if ( ! isComparisonExpression ( expression . getExpression ( ) ) ) { helper . unbox ( boolean . class ) ; } compileStack . pop ( ) ; } private void makeInvokeMethodCall ( MethodCallExpression call , boolean useSuper , MethodCallerMultiAdapter adapter ) { Expression objectExpression = call . getObjectExpression ( ) ; if ( ! isStaticMethod ( ) && ! isStaticContext ( ) && isThisExpression ( call . getObjectExpression ( ) ) ) { objectExpression = new CastExpression ( classNode , objectExpression ) ; } Expression messageName = new CastExpression ( ClassHelper . STRING_TYPE , call . getMethod ( ) ) ; if ( useSuper ) { makeCall ( new ClassExpression ( getOutermostClass ( ) . getSuperClass ( ) ) , objectExpression , messageName , call . getArguments ( ) , adapter , call . isSafe ( ) , call . isSpreadSafe ( ) , false ) ; } else { makeCall ( objectExpression , messageName , call . getArguments ( ) , adapter , call . isSafe ( ) , call . isSpreadSafe ( ) , call . isImplicitThis ( ) ) ; } } private void makeCall ( Expression receiver , Expression message , Expression arguments , MethodCallerMultiAdapter adapter , boolean safe , boolean spreadSafe , boolean implicitThis ) { ClassNode cn = classNode ; if ( isInClosure ( ) && ! implicitThis ) { cn = getOutermostClass ( ) ; } makeCall ( new ClassExpression ( cn ) , receiver , message , arguments , adapter , safe , spreadSafe , implicitThis ) ; } private void makeCall ( ClassExpression sender , Expression receiver , Expression message , Expression arguments , MethodCallerMultiAdapter adapter , boolean safe , boolean spreadSafe , boolean implicitThis ) { if ( ( adapter == invokeMethod || adapter == invokeMethodOnCurrent || adapter == invokeStaticMethod ) && ! spreadSafe ) { String methodName = getMethodName ( message ) ; if ( methodName != null ) { makeCallSite ( receiver , methodName , arguments , safe , implicitThis , adapter == invokeMethodOnCurrent , adapter == invokeStaticMethod ) ; return ; } } boolean lhs = leftHandExpression ; leftHandExpression = false ; sender . visit ( this ) ; boolean oldVal = this . implicitThis ; this . implicitThis = implicitThis ; visitAndAutoboxBoolean ( receiver ) ; this . implicitThis = oldVal ; if ( message != null ) message . visit ( this ) ; boolean containsSpreadExpression = containsSpreadExpression ( arguments ) ; int numberOfArguments = containsSpreadExpression ? - <NUM_LIT:1> : argumentSize ( arguments ) ; if ( numberOfArguments > MethodCallerMultiAdapter . MAX_ARGS || containsSpreadExpression ) { ArgumentListExpression ae ; if ( arguments instanceof ArgumentListExpression ) { ae = ( ArgumentListExpression ) arguments ; } else if ( arguments instanceof TupleExpression ) { TupleExpression te = ( TupleExpression ) arguments ; ae = new ArgumentListExpression ( te . getExpressions ( ) ) ; } else { ae = new ArgumentListExpression ( ) ; ae . addExpression ( arguments ) ; } if ( containsSpreadExpression ) { despreadList ( ae . getExpressions ( ) , true ) ; } else { ae . visit ( this ) ; } } else if ( numberOfArguments > <NUM_LIT:0> ) { TupleExpression te = ( TupleExpression ) arguments ; for ( int i = <NUM_LIT:0> ; i < numberOfArguments ; i ++ ) { Expression argument = te . getExpression ( i ) ; visitAndAutoboxBoolean ( argument ) ; if ( argument instanceof CastExpression ) loadWrapper ( argument ) ; } } adapter . call ( mv , numberOfArguments , safe , spreadSafe ) ; leftHandExpression = lhs ; } private void makeGetPropertySite ( Expression receiver , String methodName , boolean safe , boolean implicitThis ) { if ( isNotClinit ( ) ) { mv . visitVarInsn ( ALOAD , callSiteArrayVarIndex ) ; } else { mv . visitMethodInsn ( INVOKESTATIC , getClassName ( ) , "<STR_LIT>" , "<STR_LIT>" ) ; } final int index = allocateIndex ( methodName ) ; mv . visitLdcInsn ( index ) ; mv . visitInsn ( AALOAD ) ; boolean lhs = leftHandExpression ; leftHandExpression = false ; boolean oldVal = this . implicitThis ; this . implicitThis = implicitThis ; visitAndAutoboxBoolean ( receiver ) ; this . implicitThis = oldVal ; if ( ! safe ) mv . visitMethodInsn ( INVOKEINTERFACE , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; else { mv . visitMethodInsn ( INVOKEINTERFACE , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; } leftHandExpression = lhs ; } private void makeGroovyObjectGetPropertySite ( Expression receiver , String methodName , boolean safe , boolean implicitThis ) { if ( isNotClinit ( ) ) { mv . visitVarInsn ( ALOAD , callSiteArrayVarIndex ) ; } else { mv . visitMethodInsn ( INVOKESTATIC , getClassName ( ) , "<STR_LIT>" , "<STR_LIT>" ) ; } final int index = allocateIndex ( methodName ) ; mv . visitLdcInsn ( index ) ; mv . visitInsn ( AALOAD ) ; boolean lhs = leftHandExpression ; leftHandExpression = false ; boolean oldVal = this . implicitThis ; this . implicitThis = implicitThis ; visitAndAutoboxBoolean ( receiver ) ; this . implicitThis = oldVal ; if ( ! safe ) mv . visitMethodInsn ( INVOKEINTERFACE , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; else { mv . visitMethodInsn ( INVOKEINTERFACE , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; } leftHandExpression = lhs ; } private String getMethodName ( Expression message ) { String methodName = null ; if ( message instanceof CastExpression ) { CastExpression msg = ( CastExpression ) message ; if ( msg . getType ( ) == ClassHelper . STRING_TYPE ) { final Expression methodExpr = msg . getExpression ( ) ; if ( methodExpr instanceof ConstantExpression ) methodName = methodExpr . getText ( ) ; } } if ( methodName == null && message instanceof ConstantExpression ) { ConstantExpression constantExpression = ( ConstantExpression ) message ; methodName = constantExpression . getText ( ) ; } return methodName ; } private void makeCallSite ( Expression receiver , String message , Expression arguments , boolean safe , boolean implicitThis , boolean callCurrent , boolean callStatic ) { if ( isNotClinit ( ) ) { mv . visitVarInsn ( ALOAD , callSiteArrayVarIndex ) ; } else { mv . visitMethodInsn ( INVOKESTATIC , getClassName ( ) , "<STR_LIT>" , "<STR_LIT>" ) ; } final int index = allocateIndex ( message ) ; mv . visitLdcInsn ( index ) ; mv . visitInsn ( AALOAD ) ; boolean constructor = message . equals ( CONSTRUCTOR ) ; boolean lhs = leftHandExpression ; leftHandExpression = false ; boolean oldVal = this . implicitThis ; this . implicitThis = implicitThis ; visitAndAutoboxBoolean ( receiver ) ; this . implicitThis = oldVal ; boolean containsSpreadExpression = containsSpreadExpression ( arguments ) ; int numberOfArguments = containsSpreadExpression ? - <NUM_LIT:1> : argumentSize ( arguments ) ; if ( numberOfArguments > MethodCallerMultiAdapter . MAX_ARGS || containsSpreadExpression ) { ArgumentListExpression ae ; if ( arguments instanceof ArgumentListExpression ) { ae = ( ArgumentListExpression ) arguments ; } else if ( arguments instanceof TupleExpression ) { TupleExpression te = ( TupleExpression ) arguments ; ae = new ArgumentListExpression ( te . getExpressions ( ) ) ; } else { ae = new ArgumentListExpression ( ) ; ae . addExpression ( arguments ) ; } if ( containsSpreadExpression ) { numberOfArguments = - <NUM_LIT:1> ; despreadList ( ae . getExpressions ( ) , true ) ; } else { numberOfArguments = ae . getExpressions ( ) . size ( ) ; for ( int i = <NUM_LIT:0> ; i < numberOfArguments ; i ++ ) { Expression argument = ae . getExpression ( i ) ; visitAndAutoboxBoolean ( argument ) ; if ( argument instanceof CastExpression ) loadWrapper ( argument ) ; } } } if ( numberOfArguments == - <NUM_LIT:1> ) { } else { if ( numberOfArguments > <NUM_LIT:4> ) { final String createArraySignature = getCreateArraySignature ( numberOfArguments ) ; mv . visitMethodInsn ( INVOKESTATIC , "<STR_LIT>" , "<STR_LIT>" , createArraySignature ) ; } } final String desc = getDescForParamNum ( numberOfArguments ) ; if ( callStatic ) { mv . visitMethodInsn ( INVOKEINTERFACE , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" + desc ) ; } else if ( constructor ) { mv . visitMethodInsn ( INVOKEINTERFACE , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" + desc ) ; } else { if ( callCurrent ) { mv . visitMethodInsn ( INVOKEINTERFACE , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" + desc ) ; } else { if ( safe ) { mv . visitMethodInsn ( INVOKEINTERFACE , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" + desc ) ; } else { mv . visitMethodInsn ( INVOKEINTERFACE , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" + desc ) ; } } } leftHandExpression = lhs ; } private static String getDescForParamNum ( int numberOfArguments ) { switch ( numberOfArguments ) { case <NUM_LIT:0> : return "<STR_LIT>" ; case <NUM_LIT:1> : return "<STR_LIT>" ; case <NUM_LIT:2> : return "<STR_LIT>" ; case <NUM_LIT:3> : return "<STR_LIT>" ; case <NUM_LIT:4> : return "<STR_LIT>" ; default : return "<STR_LIT>" ; } } private static String [ ] sig = new String [ <NUM_LIT:255> ] ; private static String getCreateArraySignature ( int numberOfArguments ) { if ( sig [ numberOfArguments ] == null ) { StringBuilder sb = new StringBuilder ( "<STR_LIT:(>" ) ; for ( int i = <NUM_LIT:0> ; i != numberOfArguments ; ++ i ) { sb . append ( "<STR_LIT>" ) ; } sb . append ( "<STR_LIT>" ) ; sig [ numberOfArguments ] = sb . toString ( ) ; } return sig [ numberOfArguments ] ; } private static final HashSet < String > names = new HashSet < String > ( ) ; private static final HashSet < String > basic = new HashSet < String > ( ) ; static { Collections . addAll ( names , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; Collections . addAll ( basic , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; } private void makeBinopCallSite ( BinaryExpression bin , String message ) { final Expression left = bin . getLeftExpression ( ) ; final Expression right = bin . getRightExpression ( ) ; if ( ! names . contains ( message ) ) { makeBinopCallSite ( left , message , right ) ; } else { improveExprType ( bin ) ; ClassNode type1 = getLHSType ( left ) ; ClassNode type2 = getLHSType ( right ) ; if ( ClassHelper . isNumberType ( type1 ) && ClassHelper . isNumberType ( type2 ) ) { ClassNode prim1 = ClassHelper . getUnwrapper ( type1 ) ; ClassNode prim2 = ClassHelper . getUnwrapper ( type2 ) ; if ( message . equals ( "<STR_LIT>" ) && prim1 == ClassHelper . int_TYPE && prim2 == ClassHelper . int_TYPE ) { makeBinopCallSite ( left , message , right ) ; return ; } ClassNode retType ; if ( prim1 == ClassHelper . double_TYPE || prim2 == ClassHelper . double_TYPE ) { retType = ClassHelper . double_TYPE ; } else if ( prim1 == ClassHelper . float_TYPE || prim2 == ClassHelper . float_TYPE ) { retType = ClassHelper . double_TYPE ; } else if ( prim1 == ClassHelper . long_TYPE || prim2 == ClassHelper . long_TYPE ) { retType = ClassHelper . long_TYPE ; } else retType = ClassHelper . int_TYPE ; if ( retType == ClassHelper . double_TYPE && ! basic . contains ( message ) ) { makeBinopCallSite ( left , message , right ) ; return ; } if ( left instanceof ConstantExpression ) { mv . visitLdcInsn ( ( ( ConstantExpression ) left ) . getValue ( ) ) ; } else { visitAndAutoboxBoolean ( left ) ; helper . unbox ( prim1 ) ; } if ( right instanceof ConstantExpression ) { mv . visitLdcInsn ( ( ( ConstantExpression ) right ) . getValue ( ) ) ; } else { visitAndAutoboxBoolean ( right ) ; helper . unbox ( prim2 ) ; } mv . visitMethodInsn ( INVOKESTATIC , "<STR_LIT>" , message , "<STR_LIT:(>" + BytecodeHelper . getTypeDescription ( prim1 ) + BytecodeHelper . getTypeDescription ( prim2 ) + "<STR_LIT:)>" + BytecodeHelper . getTypeDescription ( retType ) ) ; helper . box ( retType ) ; } else { makeBinopCallSite ( left , message , right ) ; } } } private void improveExprType ( Expression expr ) { if ( expr instanceof BinaryExpression ) { if ( ClassHelper . isNumberType ( expr . getType ( ) ) ) return ; final BinaryExpression bin = ( BinaryExpression ) expr ; String message = "<STR_LIT>" ; switch ( bin . getOperation ( ) . getType ( ) ) { case Types . BITWISE_AND : message = "<STR_LIT>" ; break ; case Types . BITWISE_OR : message = "<STR_LIT>" ; break ; case Types . BITWISE_XOR : message = "<STR_LIT>" ; break ; case Types . PLUS : message = "<STR_LIT>" ; break ; case Types . MINUS : message = "<STR_LIT>" ; break ; case Types . MULTIPLY : message = "<STR_LIT>" ; break ; case Types . DIVIDE : message = "<STR_LIT>" ; break ; case Types . INTDIV : message = "<STR_LIT>" ; break ; case Types . MOD : message = "<STR_LIT>" ; break ; case Types . LEFT_SHIFT : message = "<STR_LIT>" ; break ; case Types . RIGHT_SHIFT : message = "<STR_LIT>" ; break ; case Types . RIGHT_SHIFT_UNSIGNED : message = "<STR_LIT>" ; break ; } if ( ! names . contains ( message ) ) return ; improveExprType ( bin . getLeftExpression ( ) ) ; improveExprType ( bin . getRightExpression ( ) ) ; ClassNode type1 = getLHSType ( bin . getLeftExpression ( ) ) ; ClassNode type2 = getLHSType ( bin . getRightExpression ( ) ) ; if ( ClassHelper . isNumberType ( type1 ) && ClassHelper . isNumberType ( type2 ) ) { ClassNode prim1 = ClassHelper . getUnwrapper ( type1 ) ; ClassNode prim2 = ClassHelper . getUnwrapper ( type2 ) ; if ( message . equals ( "<STR_LIT>" ) && prim1 == ClassHelper . int_TYPE && prim2 == ClassHelper . int_TYPE ) { return ; } ClassNode retType ; if ( prim1 == ClassHelper . double_TYPE || prim2 == ClassHelper . double_TYPE ) { retType = ClassHelper . double_TYPE ; } else if ( prim1 == ClassHelper . float_TYPE || prim2 == ClassHelper . float_TYPE ) { retType = ClassHelper . double_TYPE ; } else if ( prim1 == ClassHelper . long_TYPE || prim2 == ClassHelper . long_TYPE ) { retType = ClassHelper . long_TYPE ; } else retType = ClassHelper . int_TYPE ; if ( retType == ClassHelper . double_TYPE && ! basic . contains ( message ) ) { return ; } bin . setType ( retType ) ; } } } private void makeBinopCallSite ( Expression receiver , String message , Expression arguments ) { prepareCallSite ( message ) ; boolean lhs = leftHandExpression ; leftHandExpression = false ; boolean oldVal = this . implicitThis ; this . implicitThis = false ; visitAndAutoboxBoolean ( receiver ) ; this . implicitThis = oldVal ; visitAndAutoboxBoolean ( arguments ) ; mv . visitMethodInsn ( INVOKEINTERFACE , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; leftHandExpression = lhs ; } private void prepareCallSite ( String message ) { if ( isNotClinit ( ) ) { mv . visitVarInsn ( ALOAD , callSiteArrayVarIndex ) ; } else { mv . visitMethodInsn ( INVOKESTATIC , getClassName ( ) , "<STR_LIT>" , "<STR_LIT>" ) ; } final int index = allocateIndex ( message ) ; mv . visitLdcInsn ( index ) ; mv . visitInsn ( AALOAD ) ; } private String getClassName ( ) { String className ; if ( ! classNode . isInterface ( ) || interfaceClassLoadingClass == null ) { className = internalClassName ; } else { className = BytecodeHelper . getClassInternalName ( interfaceClassLoadingClass ) ; } return className ; } private int allocateIndex ( String name ) { callSites . add ( name ) ; return callSites . size ( ) - <NUM_LIT:1> ; } private void despreadList ( List expressions , boolean wrap ) { ArrayList spreadIndexes = new ArrayList ( ) ; ArrayList spreadExpressions = new ArrayList ( ) ; ArrayList normalArguments = new ArrayList ( ) ; for ( int i = <NUM_LIT:0> ; i < expressions . size ( ) ; i ++ ) { Object expr = expressions . get ( i ) ; if ( ! ( expr instanceof SpreadExpression ) ) { normalArguments . add ( expr ) ; } else { spreadIndexes . add ( new ConstantExpression ( Integer . valueOf ( i - spreadExpressions . size ( ) ) ) ) ; spreadExpressions . add ( ( ( SpreadExpression ) expr ) . getExpression ( ) ) ; } } visitTupleExpression ( new ArgumentListExpression ( normalArguments ) , wrap ) ; ( new TupleExpression ( spreadExpressions ) ) . visit ( this ) ; ( new ArrayExpression ( ClassHelper . int_TYPE , spreadIndexes , null ) ) . visit ( this ) ; despreadList . call ( mv ) ; } public void visitMethodCallExpression ( MethodCallExpression call ) { onLineNumber ( call , "<STR_LIT>" + call . getMethod ( ) + "<STR_LIT>" ) ; if ( isClosureCall ( call ) ) { invokeClosure ( call . getArguments ( ) , call . getMethodAsString ( ) ) ; } else { boolean isSuperMethodCall = usesSuper ( call ) ; MethodCallerMultiAdapter adapter = invokeMethod ; if ( isThisExpression ( call . getObjectExpression ( ) ) ) adapter = invokeMethodOnCurrent ; if ( isSuperMethodCall ) adapter = invokeMethodOnSuper ; if ( isStaticInvocation ( call ) ) adapter = invokeStaticMethod ; makeInvokeMethodCall ( call , isSuperMethodCall , adapter ) ; } } private boolean isClosureCall ( MethodCallExpression call ) { String methodName = call . getMethodAsString ( ) ; if ( methodName == null ) return false ; if ( ! call . isImplicitThis ( ) ) return false ; if ( ! isThisExpression ( call . getObjectExpression ( ) ) ) return false ; FieldNode field = classNode . getDeclaredField ( methodName ) ; if ( field == null ) return false ; if ( isStaticInvocation ( call ) && ! field . isStatic ( ) ) return false ; Expression arguments = call . getArguments ( ) ; return ! classNode . hasPossibleMethod ( methodName , arguments ) ; } private void invokeClosure ( Expression arguments , String methodName ) { visitVariableExpression ( new VariableExpression ( methodName ) ) ; if ( arguments instanceof TupleExpression ) { arguments . visit ( this ) ; } else { new TupleExpression ( arguments ) . visit ( this ) ; } invokeClosureMethod . call ( mv ) ; } private boolean isStaticInvocation ( MethodCallExpression call ) { if ( ! isThisExpression ( call . getObjectExpression ( ) ) ) return false ; if ( isStaticMethod ( ) ) return true ; return isStaticContext ( ) && ! call . isImplicitThis ( ) ; } protected boolean emptyArguments ( Expression arguments ) { return argumentSize ( arguments ) == <NUM_LIT:0> ; } protected static boolean containsSpreadExpression ( Expression arguments ) { List args = null ; if ( arguments instanceof TupleExpression ) { TupleExpression tupleExpression = ( TupleExpression ) arguments ; args = tupleExpression . getExpressions ( ) ; } else if ( arguments instanceof ListExpression ) { ListExpression le = ( ListExpression ) arguments ; args = le . getExpressions ( ) ; } else { return arguments instanceof SpreadExpression ; } for ( Iterator iter = args . iterator ( ) ; iter . hasNext ( ) ; ) { if ( iter . next ( ) instanceof SpreadExpression ) return true ; } return false ; } protected static int argumentSize ( Expression arguments ) { if ( arguments instanceof TupleExpression ) { TupleExpression tupleExpression = ( TupleExpression ) arguments ; int size = tupleExpression . getExpressions ( ) . size ( ) ; return size ; } return <NUM_LIT:1> ; } public void visitStaticMethodCallExpression ( StaticMethodCallExpression call ) { onLineNumber ( call , "<STR_LIT>" + call . getMethod ( ) + "<STR_LIT>" ) ; makeCall ( new ClassExpression ( call . getOwnerType ( ) ) , new ConstantExpression ( call . getMethod ( ) ) , call . getArguments ( ) , invokeStaticMethod , false , false , false ) ; } private void addGeneratedClosureConstructorCall ( ConstructorCallExpression call ) { mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; ClassNode callNode = classNode . getSuperClass ( ) ; TupleExpression arguments = ( TupleExpression ) call . getArguments ( ) ; if ( arguments . getExpressions ( ) . size ( ) != <NUM_LIT:2> ) throw new GroovyBugError ( "<STR_LIT>" + arguments . getExpressions ( ) . size ( ) ) ; arguments . getExpression ( <NUM_LIT:0> ) . visit ( this ) ; arguments . getExpression ( <NUM_LIT:1> ) . visit ( this ) ; Parameter p = new Parameter ( ClassHelper . OBJECT_TYPE , "<STR_LIT>" ) ; String descriptor = helper . getMethodDescriptor ( ClassHelper . VOID_TYPE , new Parameter [ ] { p , p } ) ; mv . visitMethodInsn ( INVOKESPECIAL , BytecodeHelper . getClassInternalName ( callNode ) , "<STR_LIT>" , descriptor ) ; } private void visitSpecialConstructorCall ( ConstructorCallExpression call ) { if ( classNode . declaresInterface ( ClassHelper . GENERATED_CLOSURE_Type ) ) { addGeneratedClosureConstructorCall ( call ) ; return ; } ClassNode callNode = classNode ; if ( call . isSuperCall ( ) ) callNode = callNode . getSuperClass ( ) ; List constructors = sortConstructors ( call , callNode ) ; call . getArguments ( ) . visit ( this ) ; mv . visitInsn ( DUP ) ; helper . pushConstant ( constructors . size ( ) ) ; visitClassExpression ( new ClassExpression ( callNode ) ) ; selectConstructorAndTransformArguments . call ( mv ) ; mv . visitInsn ( DUP_X1 ) ; mv . visitInsn ( ICONST_1 ) ; mv . visitInsn ( IAND ) ; Label afterIf = new Label ( ) ; mv . visitJumpInsn ( IFEQ , afterIf ) ; mv . visitInsn ( ICONST_0 ) ; mv . visitInsn ( AALOAD ) ; mv . visitTypeInsn ( CHECKCAST , "<STR_LIT>" ) ; mv . visitLabel ( afterIf ) ; mv . visitInsn ( SWAP ) ; if ( constructorNode != null ) { mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; } else { mv . visitTypeInsn ( NEW , BytecodeHelper . getClassInternalName ( callNode ) ) ; } mv . visitInsn ( SWAP ) ; mv . visitIntInsn ( BIPUSH , <NUM_LIT:8> ) ; mv . visitInsn ( ISHR ) ; Label [ ] targets = new Label [ constructors . size ( ) ] ; int [ ] indices = new int [ constructors . size ( ) ] ; for ( int i = <NUM_LIT:0> ; i < targets . length ; i ++ ) { targets [ i ] = new Label ( ) ; indices [ i ] = i ; } Label defaultLabel = new Label ( ) ; Label afterSwitch = new Label ( ) ; mv . visitLookupSwitchInsn ( defaultLabel , indices , targets ) ; for ( int i = <NUM_LIT:0> ; i < targets . length ; i ++ ) { mv . visitLabel ( targets [ i ] ) ; if ( constructorNode != null ) { mv . visitInsn ( SWAP ) ; mv . visitInsn ( DUP_X1 ) ; } else { mv . visitInsn ( DUP_X1 ) ; mv . visitInsn ( DUP2_X1 ) ; mv . visitInsn ( POP ) ; } ConstructorNode cn = ( ConstructorNode ) constructors . get ( i ) ; String descriptor = helper . getMethodDescriptor ( ClassHelper . VOID_TYPE , cn . getParameters ( ) ) ; Parameter [ ] parameters = cn . getParameters ( ) ; for ( int p = <NUM_LIT:0> ; p < parameters . length ; p ++ ) { mv . visitInsn ( DUP ) ; helper . pushConstant ( p ) ; mv . visitInsn ( AALOAD ) ; ClassNode type = parameters [ p ] . getType ( ) ; if ( ClassHelper . isPrimitiveType ( type ) ) { helper . unbox ( type ) ; } else { helper . doCast ( type ) ; } helper . swapWithObject ( type ) ; } mv . visitInsn ( POP ) ; mv . visitMethodInsn ( INVOKESPECIAL , BytecodeHelper . getClassInternalName ( callNode ) , "<STR_LIT>" , descriptor ) ; mv . visitJumpInsn ( GOTO , afterSwitch ) ; } mv . visitLabel ( defaultLabel ) ; mv . visitTypeInsn ( NEW , "<STR_LIT>" ) ; mv . visitInsn ( DUP ) ; mv . visitLdcInsn ( "<STR_LIT>" ) ; mv . visitMethodInsn ( INVOKESPECIAL , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitInsn ( ATHROW ) ; mv . visitLabel ( afterSwitch ) ; if ( constructorNode == null ) { mv . visitInsn ( SWAP ) ; } mv . visitInsn ( POP ) ; } private List sortConstructors ( ConstructorCallExpression call , ClassNode callNode ) { List constructors = new ArrayList ( callNode . getDeclaredConstructors ( ) ) ; Comparator comp = new Comparator ( ) { public int compare ( Object arg0 , Object arg1 ) { ConstructorNode c0 = ( ConstructorNode ) arg0 ; ConstructorNode c1 = ( ConstructorNode ) arg1 ; String descriptor0 = helper . getMethodDescriptor ( ClassHelper . VOID_TYPE , c0 . getParameters ( ) ) ; String descriptor1 = helper . getMethodDescriptor ( ClassHelper . VOID_TYPE , c1 . getParameters ( ) ) ; return descriptor0 . compareTo ( descriptor1 ) ; } } ; Collections . sort ( constructors , comp ) ; return constructors ; } public void visitConstructorCallExpression ( ConstructorCallExpression call ) { onLineNumber ( call , "<STR_LIT>" + call . getType ( ) . getName ( ) + "<STR_LIT>" ) ; if ( call . isSpecialCall ( ) ) { specialCallWithinConstructor = true ; visitSpecialConstructorCall ( call ) ; specialCallWithinConstructor = false ; return ; } Expression arguments = call . getArguments ( ) ; if ( arguments instanceof TupleExpression ) { TupleExpression tupleExpression = ( TupleExpression ) arguments ; int size = tupleExpression . getExpressions ( ) . size ( ) ; if ( size == <NUM_LIT:0> ) { arguments = MethodCallExpression . NO_ARGUMENTS ; } } Expression receiverClass = new ClassExpression ( call . getType ( ) ) ; makeCallSite ( receiverClass , CONSTRUCTOR , arguments , false , false , false , false ) ; } private static String makeFieldClassName ( ClassNode type ) { String internalName = BytecodeHelper . getClassInternalName ( type ) ; StringBuffer ret = new StringBuffer ( internalName . length ( ) ) ; for ( int i = <NUM_LIT:0> ; i < internalName . length ( ) ; i ++ ) { char c = internalName . charAt ( i ) ; if ( c == '<CHAR_LIT:/>' ) { ret . append ( '<CHAR_LIT>' ) ; } else if ( c == '<CHAR_LIT:;>' ) { } else { ret . append ( c ) ; } } return ret . toString ( ) ; } private static String getStaticFieldName ( ClassNode type ) { ClassNode componentType = type ; String prefix = "<STR_LIT>" ; for ( ; componentType . isArray ( ) ; componentType = componentType . getComponentType ( ) ) { prefix += "<STR_LIT:$>" ; } if ( prefix . length ( ) != <NUM_LIT:0> ) prefix = "<STR_LIT>" + prefix ; String name = prefix + "<STR_LIT>" + makeFieldClassName ( componentType ) ; return name ; } private void visitAttributeOrProperty ( PropertyExpression expression , MethodCallerMultiAdapter adapter ) { Expression objectExpression = expression . getObjectExpression ( ) ; if ( isThisOrSuper ( objectExpression ) ) { String name = expression . getPropertyAsString ( ) ; if ( name != null ) { FieldNode field = null ; if ( isSuperExpression ( objectExpression ) ) { field = classNode . getSuperClass ( ) . getDeclaredField ( name ) ; } else { if ( isNotExplicitThisInClosure ( expression . isImplicitThis ( ) ) ) { field = classNode . getDeclaredField ( name ) ; } } if ( field != null ) { visitFieldExpression ( new FieldExpression ( field ) ) ; return ; } } if ( isSuperExpression ( objectExpression ) ) { String prefix ; if ( leftHandExpression ) { prefix = "<STR_LIT>" ; } else { prefix = "<STR_LIT:get>" ; } String propName = prefix + MetaClassHelper . capitalize ( name ) ; visitMethodCallExpression ( new MethodCallExpression ( objectExpression , propName , MethodCallExpression . NO_ARGUMENTS ) ) ; return ; } } final String methodName = expression . getPropertyAsString ( ) ; if ( adapter == getProperty && ! expression . isSpreadSafe ( ) && methodName != null ) { makeGetPropertySite ( objectExpression , methodName , expression . isSafe ( ) , expression . isImplicitThis ( ) ) ; } else { if ( adapter == getGroovyObjectProperty && ! expression . isSpreadSafe ( ) && methodName != null ) { makeGroovyObjectGetPropertySite ( objectExpression , methodName , expression . isSafe ( ) , expression . isImplicitThis ( ) ) ; } else { makeCall ( objectExpression , new CastExpression ( ClassHelper . STRING_TYPE , expression . getProperty ( ) ) , MethodCallExpression . NO_ARGUMENTS , adapter , expression . isSafe ( ) , expression . isSpreadSafe ( ) , expression . isImplicitThis ( ) ) ; } } } private boolean isStaticContext ( ) { if ( compileStack != null && compileStack . getScope ( ) != null ) { return compileStack . getScope ( ) . isInStaticContext ( ) ; } if ( ! isInClosure ( ) ) return false ; if ( constructorNode != null ) return false ; return classNode . isStaticClass ( ) || methodNode . isStatic ( ) ; } public void visitPropertyExpression ( PropertyExpression expression ) { Expression objectExpression = expression . getObjectExpression ( ) ; MethodCallerMultiAdapter adapter ; if ( leftHandExpression ) { adapter = setProperty ; if ( isGroovyObject ( objectExpression ) ) adapter = setGroovyObjectProperty ; if ( isStaticContext ( ) && isThisOrSuper ( objectExpression ) ) adapter = setProperty ; } else { adapter = getProperty ; if ( isGroovyObject ( objectExpression ) ) adapter = getGroovyObjectProperty ; if ( isStaticContext ( ) && isThisOrSuper ( objectExpression ) ) adapter = getProperty ; } visitAttributeOrProperty ( expression , adapter ) ; } public void visitAttributeExpression ( AttributeExpression expression ) { Expression objectExpression = expression . getObjectExpression ( ) ; MethodCallerMultiAdapter adapter ; if ( leftHandExpression ) { adapter = setField ; if ( isGroovyObject ( objectExpression ) ) adapter = setGroovyObjectField ; if ( usesSuper ( expression ) ) adapter = setFieldOnSuper ; } else { adapter = getField ; if ( isGroovyObject ( objectExpression ) ) adapter = getGroovyObjectField ; if ( usesSuper ( expression ) ) adapter = getFieldOnSuper ; } visitAttributeOrProperty ( expression , adapter ) ; } protected boolean isGroovyObject ( Expression objectExpression ) { return isThisExpression ( objectExpression ) || objectExpression . getType ( ) . isDerivedFromGroovyObject ( ) && ! ( objectExpression instanceof ClassExpression ) ; } public void visitFieldExpression ( FieldExpression expression ) { FieldNode field = expression . getField ( ) ; if ( field . isStatic ( ) ) { if ( leftHandExpression ) { storeStaticField ( expression ) ; } else { loadStaticField ( expression ) ; } } else { if ( leftHandExpression ) { storeThisInstanceField ( expression ) ; } else { loadInstanceField ( expression ) ; } } } public void loadStaticField ( FieldExpression fldExp ) { FieldNode field = fldExp . getField ( ) ; boolean holder = field . isHolder ( ) && ! isInClosureConstructor ( ) ; ClassNode type = field . getType ( ) ; String ownerName = ( field . getOwner ( ) . equals ( classNode ) ) ? internalClassName : BytecodeHelper . getClassInternalName ( field . getOwner ( ) ) ; if ( holder ) { mv . visitFieldInsn ( GETSTATIC , ownerName , fldExp . getFieldName ( ) , BytecodeHelper . getTypeDescription ( type ) ) ; mv . visitMethodInsn ( INVOKEVIRTUAL , "<STR_LIT>" , "<STR_LIT:get>" , "<STR_LIT>" ) ; } else { mv . visitFieldInsn ( GETSTATIC , ownerName , fldExp . getFieldName ( ) , BytecodeHelper . getTypeDescription ( type ) ) ; if ( ClassHelper . isPrimitiveType ( type ) ) { helper . box ( type ) ; } else { } } } public void loadInstanceField ( FieldExpression fldExp ) { FieldNode field = fldExp . getField ( ) ; boolean holder = field . isHolder ( ) && ! isInClosureConstructor ( ) ; ClassNode type = field . getType ( ) ; String ownerName = ( field . getOwner ( ) . equals ( classNode ) ) ? internalClassName : helper . getClassInternalName ( field . getOwner ( ) ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; mv . visitFieldInsn ( GETFIELD , ownerName , fldExp . getFieldName ( ) , BytecodeHelper . getTypeDescription ( type ) ) ; if ( holder ) { mv . visitMethodInsn ( INVOKEVIRTUAL , "<STR_LIT>" , "<STR_LIT:get>" , "<STR_LIT>" ) ; } else { if ( ClassHelper . isPrimitiveType ( type ) ) { helper . box ( type ) ; } else { } } } public void storeThisInstanceField ( FieldExpression expression ) { FieldNode field = expression . getField ( ) ; boolean holder = field . isHolder ( ) && ! isInClosureConstructor ( ) ; ClassNode type = field . getType ( ) ; String ownerName = ( field . getOwner ( ) . equals ( classNode ) ) ? internalClassName : BytecodeHelper . getClassInternalName ( field . getOwner ( ) ) ; if ( holder ) { mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; mv . visitFieldInsn ( GETFIELD , ownerName , expression . getFieldName ( ) , BytecodeHelper . getTypeDescription ( type ) ) ; mv . visitInsn ( SWAP ) ; mv . visitMethodInsn ( INVOKEVIRTUAL , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; } else { if ( isInClosureConstructor ( ) ) { helper . doCast ( type ) ; } else if ( ! ClassHelper . isPrimitiveType ( type ) ) { doConvertAndCast ( type ) ; } mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; mv . visitInsn ( SWAP ) ; helper . unbox ( type ) ; helper . putField ( field , ownerName ) ; } } public void storeStaticField ( FieldExpression expression ) { FieldNode field = expression . getField ( ) ; boolean holder = field . isHolder ( ) && ! isInClosureConstructor ( ) ; ClassNode type = field . getType ( ) ; String ownerName = ( field . getOwner ( ) . equals ( classNode ) ) ? internalClassName : helper . getClassInternalName ( field . getOwner ( ) ) ; if ( holder ) { mv . visitFieldInsn ( GETSTATIC , ownerName , expression . getFieldName ( ) , BytecodeHelper . getTypeDescription ( type ) ) ; mv . visitInsn ( SWAP ) ; mv . visitMethodInsn ( INVOKEVIRTUAL , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; } else { helper . doCast ( type ) ; mv . visitFieldInsn ( PUTSTATIC , ownerName , expression . getFieldName ( ) , BytecodeHelper . getTypeDescription ( type ) ) ; } } protected void visitOuterFieldExpression ( FieldExpression expression , ClassNode outerClassNode , int steps , boolean first ) { FieldNode field = expression . getField ( ) ; boolean isStatic = field . isStatic ( ) ; int tempIdx = compileStack . defineTemporaryVariable ( field , leftHandExpression && first ) ; if ( steps > <NUM_LIT:1> || ! isStatic ) { mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; mv . visitFieldInsn ( GETFIELD , internalClassName , "<STR_LIT>" , BytecodeHelper . getTypeDescription ( outerClassNode ) ) ; } if ( steps == <NUM_LIT:1> ) { int opcode = ( leftHandExpression ) ? ( ( isStatic ) ? PUTSTATIC : PUTFIELD ) : ( ( isStatic ) ? GETSTATIC : GETFIELD ) ; String ownerName = BytecodeHelper . getClassInternalName ( outerClassNode ) ; if ( leftHandExpression ) { mv . visitVarInsn ( ALOAD , tempIdx ) ; boolean holder = field . isHolder ( ) && ! isInClosureConstructor ( ) ; if ( ! holder ) { doConvertAndCast ( field . getType ( ) ) ; } } mv . visitFieldInsn ( opcode , ownerName , expression . getFieldName ( ) , BytecodeHelper . getTypeDescription ( field . getType ( ) ) ) ; if ( ! leftHandExpression ) { if ( ClassHelper . isPrimitiveType ( field . getType ( ) ) ) { helper . box ( field . getType ( ) ) ; } } } else { visitOuterFieldExpression ( expression , outerClassNode . getOuterClass ( ) , steps - <NUM_LIT:1> , false ) ; } } public void visitVariableExpression ( VariableExpression expression ) { String variableName = expression . getName ( ) ; ClassNode classNode = this . classNode ; if ( isInClosure ( ) ) classNode = getOutermostClass ( ) ; if ( variableName . equals ( "<STR_LIT>" ) ) { if ( isStaticMethod ( ) || ( ! implicitThis && isStaticContext ( ) ) ) { visitClassExpression ( new ClassExpression ( classNode ) ) ; } else { loadThis ( ) ; } return ; } if ( variableName . equals ( "<STR_LIT>" ) ) { if ( isStaticMethod ( ) ) { visitClassExpression ( new ClassExpression ( classNode . getSuperClass ( ) ) ) ; } else { loadThis ( ) ; } return ; } Variable variable = compileStack . getVariable ( variableName , false ) ; VariableScope scope = compileStack . getScope ( ) ; if ( variable == null ) { processClassVariable ( variableName ) ; } else { processStackVariable ( variable ) ; } } private void loadThis ( ) { mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; if ( ! implicitThis && isInClosure ( ) ) { mv . visitMethodInsn ( INVOKEVIRTUAL , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; } } protected void processStackVariable ( Variable variable ) { if ( leftHandExpression ) { helper . storeVar ( variable ) ; } else { helper . loadVar ( variable ) ; } if ( ASM_DEBUG ) { helper . mark ( "<STR_LIT>" + variable . getName ( ) ) ; } } protected void processClassVariable ( String name ) { if ( passingClosureParams && isInScriptBody ( ) ) { mv . visitTypeInsn ( NEW , "<STR_LIT>" ) ; mv . visitInsn ( DUP ) ; loadThisOrOwner ( ) ; mv . visitLdcInsn ( name ) ; mv . visitMethodInsn ( INVOKESPECIAL , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; } else { PropertyExpression pexp = new PropertyExpression ( VariableExpression . THIS_EXPRESSION , name ) ; pexp . setImplicitThis ( true ) ; visitPropertyExpression ( pexp ) ; } } protected void processFieldAccess ( String name , FieldNode field , int steps ) { FieldExpression expression = new FieldExpression ( field ) ; if ( steps == <NUM_LIT:0> ) { visitFieldExpression ( expression ) ; } else { visitOuterFieldExpression ( expression , classNode . getOuterClass ( ) , steps , true ) ; } } protected boolean isInScriptBody ( ) { if ( classNode . isScriptBody ( ) ) { return true ; } else { return classNode . isScript ( ) && methodNode != null && methodNode . getName ( ) . equals ( "<STR_LIT>" ) ; } } protected boolean isPopRequired ( Expression expression ) { if ( expression instanceof MethodCallExpression ) { return expression . getType ( ) != ClassHelper . VOID_TYPE ; } if ( expression instanceof DeclarationExpression ) { DeclarationExpression de = ( DeclarationExpression ) expression ; return de . getLeftExpression ( ) instanceof TupleExpression ; } if ( expression instanceof BinaryExpression ) { BinaryExpression binExp = ( BinaryExpression ) expression ; switch ( binExp . getOperation ( ) . getType ( ) ) { } } if ( expression instanceof ConstructorCallExpression ) { ConstructorCallExpression cce = ( ConstructorCallExpression ) expression ; return ! cce . isSpecialCall ( ) ; } return true ; } protected void createInterfaceSyntheticStaticFields ( ) { if ( referencedClasses . isEmpty ( ) ) return ; addInnerClass ( interfaceClassLoadingClass ) ; for ( String staticFieldName : referencedClasses . keySet ( ) ) { interfaceClassLoadingClass . addField ( staticFieldName , ACC_STATIC + ACC_SYNTHETIC , ClassHelper . CLASS_Type , new ClassExpression ( referencedClasses . get ( staticFieldName ) ) ) ; } } protected void createSyntheticStaticFields ( ) { for ( String staticFieldName : referencedClasses . keySet ( ) ) { FieldNode fn = classNode . getDeclaredField ( staticFieldName ) ; if ( fn != null ) { boolean type = fn . getType ( ) == ClassHelper . CLASS_Type ; boolean modifiers = fn . getModifiers ( ) == ACC_STATIC + ACC_SYNTHETIC ; if ( ! type || ! modifiers ) { String text = "<STR_LIT>" ; if ( ! type ) text = "<STR_LIT>" + fn . getType ( ) + "<STR_LIT>" ; if ( ! modifiers ) text = "<STR_LIT>" + fn . getModifiers ( ) + "<STR_LIT:U+0020(>" + ( ACC_STATIC + ACC_SYNTHETIC ) + "<STR_LIT>" ; throwException ( "<STR_LIT>" + staticFieldName + "<STR_LIT>" + classNode . getName ( ) + "<STR_LIT>" + "<STR_LIT>" + text ) ; } } else { cv . visitField ( ACC_PRIVATE + ACC_STATIC + ACC_SYNTHETIC , staticFieldName , "<STR_LIT>" , null , null ) ; } mv = cv . visitMethod ( ACC_PRIVATE + ACC_STATIC + ACC_SYNTHETIC , "<STR_LIT>" + staticFieldName , "<STR_LIT>" , null , null ) ; mv . visitCode ( ) ; mv . visitFieldInsn ( GETSTATIC , internalClassName , staticFieldName , "<STR_LIT>" ) ; mv . visitInsn ( DUP ) ; Label l0 = new Label ( ) ; mv . visitJumpInsn ( IFNONNULL , l0 ) ; mv . visitInsn ( POP ) ; mv . visitLdcInsn ( BytecodeHelper . getClassLoadingTypeDescription ( referencedClasses . get ( staticFieldName ) ) ) ; mv . visitMethodInsn ( INVOKESTATIC , internalClassName , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitInsn ( DUP ) ; mv . visitFieldInsn ( PUTSTATIC , internalClassName , staticFieldName , "<STR_LIT>" ) ; mv . visitLabel ( l0 ) ; mv . visitInsn ( ARETURN ) ; mv . visitMaxs ( <NUM_LIT:0> , <NUM_LIT:0> ) ; mv . visitEnd ( ) ; } mv = cv . visitMethod ( ACC_STATIC + ACC_SYNTHETIC , "<STR_LIT>" , "<STR_LIT>" , null , null ) ; Label l0 = new Label ( ) ; mv . visitLabel ( l0 ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; mv . visitMethodInsn ( INVOKESTATIC , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; Label l1 = new Label ( ) ; mv . visitLabel ( l1 ) ; mv . visitInsn ( ARETURN ) ; Label l2 = new Label ( ) ; mv . visitLabel ( l2 ) ; mv . visitVarInsn ( ASTORE , <NUM_LIT:1> ) ; mv . visitTypeInsn ( NEW , "<STR_LIT>" ) ; mv . visitInsn ( DUP ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:1> ) ; mv . visitMethodInsn ( INVOKEVIRTUAL , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitMethodInsn ( INVOKESPECIAL , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitInsn ( ATHROW ) ; mv . visitTryCatchBlock ( l0 , l2 , l2 , "<STR_LIT>" ) ; mv . visitMaxs ( <NUM_LIT:3> , <NUM_LIT:2> ) ; } public void visitClassExpression ( ClassExpression expression ) { ClassNode type = expression . getType ( ) ; if ( ClassHelper . isPrimitiveType ( type ) ) { ClassNode objectType = ClassHelper . getWrapper ( type ) ; mv . visitFieldInsn ( GETSTATIC , BytecodeHelper . getClassInternalName ( objectType ) , "<STR_LIT>" , "<STR_LIT>" ) ; } else { String staticFieldName = getStaticFieldName ( type ) ; referencedClasses . put ( staticFieldName , type ) ; String internalClassName = this . internalClassName ; if ( classNode . isInterface ( ) ) { internalClassName = BytecodeHelper . getClassInternalName ( interfaceClassLoadingClass ) ; mv . visitFieldInsn ( GETSTATIC , internalClassName , staticFieldName , "<STR_LIT>" ) ; } else { mv . visitMethodInsn ( INVOKESTATIC , internalClassName , "<STR_LIT>" + staticFieldName , "<STR_LIT>" ) ; } } } public void visitRangeExpression ( RangeExpression expression ) { expression . getFrom ( ) . visit ( this ) ; expression . getTo ( ) . visit ( this ) ; helper . pushConstant ( expression . isInclusive ( ) ) ; createRangeMethod . call ( mv ) ; } public void visitMapEntryExpression ( MapEntryExpression expression ) { throw new GroovyBugError ( "<STR_LIT>" ) ; } public void visitMapExpression ( MapExpression expression ) { List entries = expression . getMapEntryExpressions ( ) ; int size = entries . size ( ) ; helper . pushConstant ( size * <NUM_LIT:2> ) ; mv . visitTypeInsn ( ANEWARRAY , "<STR_LIT>" ) ; int i = <NUM_LIT:0> ; for ( Iterator iter = entries . iterator ( ) ; iter . hasNext ( ) ; ) { Object object = iter . next ( ) ; MapEntryExpression entry = ( MapEntryExpression ) object ; mv . visitInsn ( DUP ) ; helper . pushConstant ( i ++ ) ; visitAndAutoboxBoolean ( entry . getKeyExpression ( ) ) ; mv . visitInsn ( AASTORE ) ; mv . visitInsn ( DUP ) ; helper . pushConstant ( i ++ ) ; visitAndAutoboxBoolean ( entry . getValueExpression ( ) ) ; mv . visitInsn ( AASTORE ) ; } createMapMethod . call ( mv ) ; } public void visitArgumentlistExpression ( ArgumentListExpression ale ) { if ( containsSpreadExpression ( ale ) ) { despreadList ( ale . getExpressions ( ) , true ) ; } else { visitTupleExpression ( ale , true ) ; } } public void visitTupleExpression ( TupleExpression expression ) { visitTupleExpression ( expression , false ) ; } private void visitTupleExpression ( TupleExpression expression , boolean useWrapper ) { int size = expression . getExpressions ( ) . size ( ) ; helper . pushConstant ( size ) ; mv . visitTypeInsn ( ANEWARRAY , "<STR_LIT>" ) ; for ( int i = <NUM_LIT:0> ; i < size ; i ++ ) { mv . visitInsn ( DUP ) ; helper . pushConstant ( i ) ; Expression argument = expression . getExpression ( i ) ; visitAndAutoboxBoolean ( argument ) ; if ( useWrapper && argument instanceof CastExpression ) loadWrapper ( argument ) ; mv . visitInsn ( AASTORE ) ; } } private void loadWrapper ( Expression argument ) { ClassNode goalClass = argument . getType ( ) ; visitClassExpression ( new ClassExpression ( goalClass ) ) ; if ( goalClass . isDerivedFromGroovyObject ( ) ) { createGroovyObjectWrapperMethod . call ( mv ) ; } else { createPojoWrapperMethod . call ( mv ) ; } } public void visitArrayExpression ( ArrayExpression expression ) { ClassNode elementType = expression . getElementType ( ) ; String arrayTypeName = BytecodeHelper . getClassInternalName ( elementType ) ; List sizeExpression = expression . getSizeExpression ( ) ; int size = <NUM_LIT:0> ; int dimensions = <NUM_LIT:0> ; if ( sizeExpression != null ) { for ( Iterator iter = sizeExpression . iterator ( ) ; iter . hasNext ( ) ; ) { Expression element = ( Expression ) iter . next ( ) ; if ( element == ConstantExpression . EMTPY_EXPRESSION ) break ; dimensions ++ ; visitAndAutoboxBoolean ( element ) ; helper . unbox ( int . class ) ; } } else { size = expression . getExpressions ( ) . size ( ) ; helper . pushConstant ( size ) ; } int storeIns = AASTORE ; if ( sizeExpression != null ) { arrayTypeName = BytecodeHelper . getTypeDescription ( expression . getType ( ) ) ; mv . visitMultiANewArrayInsn ( arrayTypeName , dimensions ) ; } else if ( ClassHelper . isPrimitiveType ( elementType ) ) { int primType = <NUM_LIT:0> ; if ( elementType == ClassHelper . boolean_TYPE ) { primType = T_BOOLEAN ; storeIns = BASTORE ; } else if ( elementType == ClassHelper . char_TYPE ) { primType = T_CHAR ; storeIns = CASTORE ; } else if ( elementType == ClassHelper . float_TYPE ) { primType = T_FLOAT ; storeIns = FASTORE ; } else if ( elementType == ClassHelper . double_TYPE ) { primType = T_DOUBLE ; storeIns = DASTORE ; } else if ( elementType == ClassHelper . byte_TYPE ) { primType = T_BYTE ; storeIns = BASTORE ; } else if ( elementType == ClassHelper . short_TYPE ) { primType = T_SHORT ; storeIns = SASTORE ; } else if ( elementType == ClassHelper . int_TYPE ) { primType = T_INT ; storeIns = IASTORE ; } else if ( elementType == ClassHelper . long_TYPE ) { primType = T_LONG ; storeIns = LASTORE ; } mv . visitIntInsn ( NEWARRAY , primType ) ; } else { mv . visitTypeInsn ( ANEWARRAY , arrayTypeName ) ; } for ( int i = <NUM_LIT:0> ; i < size ; i ++ ) { mv . visitInsn ( DUP ) ; helper . pushConstant ( i ) ; Expression elementExpression = expression . getExpression ( i ) ; if ( elementExpression == null ) { ConstantExpression . NULL . visit ( this ) ; } else { if ( ! elementType . equals ( elementExpression . getType ( ) ) ) { visitCastExpression ( new CastExpression ( elementType , elementExpression , true ) ) ; } else { visitAndAutoboxBoolean ( elementExpression ) ; } } mv . visitInsn ( storeIns ) ; } if ( sizeExpression == null && ClassHelper . isPrimitiveType ( elementType ) ) { int par = compileStack . defineTemporaryVariable ( "<STR_LIT>" , true ) ; mv . visitVarInsn ( ALOAD , par ) ; } } public void visitClosureListExpression ( ClosureListExpression expression ) { compileStack . pushVariableScope ( expression . getVariableScope ( ) ) ; List expressions = expression . getExpressions ( ) ; final int size = expressions . size ( ) ; LinkedList declarations = new LinkedList ( ) ; for ( int i = <NUM_LIT:0> ; i < size ; i ++ ) { Object expr = expressions . get ( i ) ; if ( expr instanceof DeclarationExpression ) { declarations . add ( expr ) ; DeclarationExpression de = ( DeclarationExpression ) expr ; BinaryExpression be = new BinaryExpression ( de . getLeftExpression ( ) , de . getOperation ( ) , de . getRightExpression ( ) ) ; expressions . set ( i , be ) ; de . setRightExpression ( ConstantExpression . NULL ) ; visitDeclarationExpression ( de ) ; } } LinkedList instructions = new LinkedList ( ) ; BytecodeSequence seq = new BytecodeSequence ( instructions ) ; BlockStatement bs = new BlockStatement ( ) ; bs . addStatement ( seq ) ; Parameter closureIndex = new Parameter ( ClassHelper . int_TYPE , "<STR_LIT>" ) ; ClosureExpression ce = new ClosureExpression ( new Parameter [ ] { closureIndex } , bs ) ; ce . setVariableScope ( expression . getVariableScope ( ) ) ; instructions . add ( ConstantExpression . NULL ) ; final Label dflt = new Label ( ) ; final Label tableEnd = new Label ( ) ; final Label [ ] labels = new Label [ size ] ; instructions . add ( new BytecodeInstruction ( ) { public void visit ( MethodVisitor mv ) { mv . visitVarInsn ( ILOAD , <NUM_LIT:1> ) ; mv . visitTableSwitchInsn ( <NUM_LIT:0> , size - <NUM_LIT:1> , dflt , labels ) ; } } ) ; for ( int i = <NUM_LIT:0> ; i < size ; i ++ ) { final Label label = new Label ( ) ; Object expr = expressions . get ( i ) ; final boolean isStatement = expr instanceof Statement ; labels [ i ] = label ; instructions . add ( new BytecodeInstruction ( ) { public void visit ( MethodVisitor mv ) { mv . visitLabel ( label ) ; if ( ! isStatement ) mv . visitInsn ( POP ) ; } } ) ; instructions . add ( expr ) ; instructions . add ( new BytecodeInstruction ( ) { public void visit ( MethodVisitor mv ) { mv . visitJumpInsn ( GOTO , tableEnd ) ; } } ) ; } { instructions . add ( new BytecodeInstruction ( ) { public void visit ( MethodVisitor mv ) { mv . visitLabel ( dflt ) ; } } ) ; ConstantExpression text = new ConstantExpression ( "<STR_LIT>" ) ; ConstructorCallExpression cce = new ConstructorCallExpression ( ClassHelper . make ( IllegalArgumentException . class ) , text ) ; ThrowStatement ts = new ThrowStatement ( cce ) ; instructions . add ( ts ) ; } instructions . add ( new BytecodeInstruction ( ) { public void visit ( MethodVisitor mv ) { mv . visitLabel ( tableEnd ) ; mv . visitInsn ( ARETURN ) ; } } ) ; visitClosureExpression ( ce ) ; helper . pushConstant ( size ) ; mv . visitTypeInsn ( ANEWARRAY , "<STR_LIT>" ) ; int listArrayVar = compileStack . defineTemporaryVariable ( "<STR_LIT>" , true ) ; for ( int i = <NUM_LIT:0> ; i < size ; i ++ ) { mv . visitTypeInsn ( NEW , "<STR_LIT>" ) ; mv . visitInsn ( DUP2 ) ; mv . visitInsn ( SWAP ) ; helper . pushConstant ( i ) ; mv . visitMethodInsn ( INVOKESPECIAL , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitVarInsn ( ALOAD , listArrayVar ) ; mv . visitInsn ( SWAP ) ; helper . pushConstant ( i ) ; mv . visitInsn ( SWAP ) ; mv . visitInsn ( AASTORE ) ; } mv . visitInsn ( POP ) ; mv . visitVarInsn ( ALOAD , listArrayVar ) ; createListMethod . call ( mv ) ; compileStack . removeVar ( listArrayVar ) ; compileStack . pop ( ) ; } public void visitBytecodeSequence ( BytecodeSequence bytecodeSequence ) { List instructions = bytecodeSequence . getInstructions ( ) ; for ( Iterator iterator = instructions . iterator ( ) ; iterator . hasNext ( ) ; ) { Object part = iterator . next ( ) ; if ( part == EmptyExpression . INSTANCE ) { mv . visitInsn ( ACONST_NULL ) ; } else if ( part instanceof Expression ) { visitAndAutoboxBoolean ( ( Expression ) part ) ; } else if ( part instanceof Statement ) { Statement stm = ( Statement ) part ; stm . visit ( this ) ; mv . visitInsn ( ACONST_NULL ) ; } else { BytecodeInstruction runner = ( BytecodeInstruction ) part ; runner . visit ( mv ) ; } } } public void visitListExpression ( ListExpression expression ) { onLineNumber ( expression , "<STR_LIT>" ) ; int size = expression . getExpressions ( ) . size ( ) ; boolean containsSpreadExpression = containsSpreadExpression ( expression ) ; if ( ! containsSpreadExpression ) { helper . pushConstant ( size ) ; mv . visitTypeInsn ( ANEWARRAY , "<STR_LIT>" ) ; for ( int i = <NUM_LIT:0> ; i < size ; i ++ ) { mv . visitInsn ( DUP ) ; helper . pushConstant ( i ) ; visitAndAutoboxBoolean ( expression . getExpression ( i ) ) ; mv . visitInsn ( AASTORE ) ; } } else { despreadList ( expression . getExpressions ( ) , false ) ; } createListMethod . call ( mv ) ; } public void visitGStringExpression ( GStringExpression expression ) { mv . visitTypeInsn ( NEW , "<STR_LIT>" ) ; mv . visitInsn ( DUP ) ; int size = expression . getValues ( ) . size ( ) ; helper . pushConstant ( size ) ; mv . visitTypeInsn ( ANEWARRAY , "<STR_LIT>" ) ; for ( int i = <NUM_LIT:0> ; i < size ; i ++ ) { mv . visitInsn ( DUP ) ; helper . pushConstant ( i ) ; visitAndAutoboxBoolean ( expression . getValue ( i ) ) ; mv . visitInsn ( AASTORE ) ; } List strings = expression . getStrings ( ) ; size = strings . size ( ) ; helper . pushConstant ( size ) ; mv . visitTypeInsn ( ANEWARRAY , "<STR_LIT>" ) ; for ( int i = <NUM_LIT:0> ; i < size ; i ++ ) { mv . visitInsn ( DUP ) ; helper . pushConstant ( i ) ; mv . visitLdcInsn ( ( ( ConstantExpression ) strings . get ( i ) ) . getValue ( ) ) ; mv . visitInsn ( AASTORE ) ; } mv . visitMethodInsn ( INVOKESPECIAL , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; } public void visitAnnotations ( AnnotatedNode node ) { } private void visitAnnotations ( AnnotatedNode targetNode , Object visitor ) { List annotations = targetNode . getAnnotations ( ) ; if ( annotations . isEmpty ( ) ) return ; Iterator it = annotations . iterator ( ) ; while ( it . hasNext ( ) ) { AnnotationNode an = ( AnnotationNode ) it . next ( ) ; if ( an . isBuiltIn ( ) ) continue ; if ( an . hasSourceRetention ( ) ) continue ; AnnotationVisitor av = getAnnotationVisitor ( targetNode , an , visitor ) ; visitAnnotationAttributes ( an , av ) ; av . visitEnd ( ) ; } } private void visitParameterAnnotations ( Parameter parameter , int paramNumber , MethodVisitor mv ) { List annotations = parameter . getAnnotations ( ) ; if ( annotations . isEmpty ( ) ) return ; Iterator it = annotations . iterator ( ) ; while ( it . hasNext ( ) ) { AnnotationNode an = ( AnnotationNode ) it . next ( ) ; if ( an . isBuiltIn ( ) ) continue ; if ( an . hasSourceRetention ( ) ) continue ; final String annotationDescriptor = BytecodeHelper . getTypeDescription ( an . getClassNode ( ) ) ; AnnotationVisitor av = mv . visitParameterAnnotation ( paramNumber , annotationDescriptor , an . hasRuntimeRetention ( ) ) ; visitAnnotationAttributes ( an , av ) ; av . visitEnd ( ) ; } } private AnnotationVisitor getAnnotationVisitor ( AnnotatedNode targetNode , AnnotationNode an , Object visitor ) { final String annotationDescriptor = BytecodeHelper . getTypeDescription ( an . getClassNode ( ) ) ; if ( targetNode instanceof MethodNode ) { return ( ( MethodVisitor ) visitor ) . visitAnnotation ( annotationDescriptor , an . hasRuntimeRetention ( ) ) ; } else if ( targetNode instanceof FieldNode ) { return ( ( FieldVisitor ) visitor ) . visitAnnotation ( annotationDescriptor , an . hasRuntimeRetention ( ) ) ; } else if ( targetNode instanceof ClassNode ) { return ( ( ClassVisitor ) visitor ) . visitAnnotation ( annotationDescriptor , an . hasRuntimeRetention ( ) ) ; } throwException ( "<STR_LIT>" ) ; return null ; } private void visitAnnotationAttributes ( AnnotationNode an , AnnotationVisitor av ) { Map constantAttrs = new HashMap ( ) ; Map enumAttrs = new HashMap ( ) ; Map atAttrs = new HashMap ( ) ; Map arrayAttrs = new HashMap ( ) ; Iterator mIt = an . getMembers ( ) . keySet ( ) . iterator ( ) ; while ( mIt . hasNext ( ) ) { String name = ( String ) mIt . next ( ) ; Expression expr = an . getMember ( name ) ; if ( expr instanceof AnnotationConstantExpression ) { atAttrs . put ( name , ( ( AnnotationConstantExpression ) expr ) . getValue ( ) ) ; } else if ( expr instanceof ConstantExpression ) { constantAttrs . put ( name , ( ( ConstantExpression ) expr ) . getValue ( ) ) ; } else if ( expr instanceof ClassExpression ) { constantAttrs . put ( name , Type . getType ( BytecodeHelper . getTypeDescription ( expr . getType ( ) ) ) ) ; } else if ( expr instanceof PropertyExpression ) { enumAttrs . put ( name , expr ) ; } else if ( expr instanceof ListExpression ) { arrayAttrs . put ( name , expr ) ; } } for ( Iterator it = constantAttrs . entrySet ( ) . iterator ( ) ; it . hasNext ( ) ; ) { Map . Entry entry = ( Map . Entry ) it . next ( ) ; av . visit ( ( String ) entry . getKey ( ) , entry . getValue ( ) ) ; } for ( Iterator it = enumAttrs . entrySet ( ) . iterator ( ) ; it . hasNext ( ) ; ) { Map . Entry entry = ( Map . Entry ) it . next ( ) ; PropertyExpression propExp = ( PropertyExpression ) entry . getValue ( ) ; av . visitEnum ( ( String ) entry . getKey ( ) , BytecodeHelper . getTypeDescription ( propExp . getObjectExpression ( ) . getType ( ) ) , String . valueOf ( ( ( ConstantExpression ) propExp . getProperty ( ) ) . getValue ( ) ) ) ; } for ( Iterator it = atAttrs . entrySet ( ) . iterator ( ) ; it . hasNext ( ) ; ) { Map . Entry entry = ( Map . Entry ) it . next ( ) ; AnnotationNode atNode = ( AnnotationNode ) entry . getValue ( ) ; AnnotationVisitor av2 = av . visitAnnotation ( ( String ) entry . getKey ( ) , BytecodeHelper . getTypeDescription ( atNode . getClassNode ( ) ) ) ; visitAnnotationAttributes ( atNode , av2 ) ; av2 . visitEnd ( ) ; } visitArrayAttributes ( an , arrayAttrs , av ) ; } private void visitArrayAttributes ( AnnotationNode an , Map arrayAttr , AnnotationVisitor av ) { if ( arrayAttr . isEmpty ( ) ) return ; for ( Iterator it = arrayAttr . entrySet ( ) . iterator ( ) ; it . hasNext ( ) ; ) { Map . Entry entry = ( Map . Entry ) it . next ( ) ; String attrName = ( String ) entry . getKey ( ) ; ListExpression listExpr = ( ListExpression ) entry . getValue ( ) ; AnnotationVisitor av2 = av . visitArray ( attrName ) ; List values = listExpr . getExpressions ( ) ; if ( ! values . isEmpty ( ) ) { Expression expr = ( Expression ) values . get ( <NUM_LIT:0> ) ; int arrayElementType = - <NUM_LIT:1> ; if ( expr instanceof AnnotationConstantExpression ) { arrayElementType = <NUM_LIT:1> ; } else if ( expr instanceof ConstantExpression ) { arrayElementType = <NUM_LIT:2> ; } else if ( expr instanceof ClassExpression ) { arrayElementType = <NUM_LIT:3> ; } else if ( expr instanceof PropertyExpression ) { arrayElementType = <NUM_LIT:4> ; } for ( Iterator exprIt = listExpr . getExpressions ( ) . iterator ( ) ; exprIt . hasNext ( ) ; ) { switch ( arrayElementType ) { case <NUM_LIT:1> : AnnotationNode atAttr = ( AnnotationNode ) ( ( AnnotationConstantExpression ) exprIt . next ( ) ) . getValue ( ) ; AnnotationVisitor av3 = av2 . visitAnnotation ( null , BytecodeHelper . getTypeDescription ( atAttr . getClassNode ( ) ) ) ; visitAnnotationAttributes ( atAttr , av3 ) ; av3 . visitEnd ( ) ; break ; case <NUM_LIT:2> : av2 . visit ( null , ( ( ConstantExpression ) exprIt . next ( ) ) . getValue ( ) ) ; break ; case <NUM_LIT:3> : av2 . visit ( null , Type . getType ( BytecodeHelper . getTypeDescription ( ( ( Expression ) exprIt . next ( ) ) . getType ( ) ) ) ) ; break ; case <NUM_LIT:4> : PropertyExpression propExpr = ( PropertyExpression ) exprIt . next ( ) ; av2 . visitEnum ( null , BytecodeHelper . getTypeDescription ( propExpr . getObjectExpression ( ) . getType ( ) ) , String . valueOf ( ( ( ConstantExpression ) propExpr . getProperty ( ) ) . getValue ( ) ) ) ; break ; } } } av2 . visitEnd ( ) ; } } protected boolean addInnerClass ( ClassNode innerClass ) { innerClass . setModule ( classNode . getModule ( ) ) ; return innerClasses . add ( innerClass ) ; } protected ClassNode createClosureClass ( ClosureExpression expression ) { ClassNode outerClass = getOutermostClass ( ) ; String name = outerClass . getName ( ) + "<STR_LIT:$>" + context . getNextClosureInnerName ( outerClass , classNode , methodNode ) ; boolean staticMethodOrInStaticClass = isStaticMethod ( ) || classNode . isStaticClass ( ) ; Parameter [ ] parameters = expression . getParameters ( ) ; if ( parameters == null ) { parameters = Parameter . EMPTY_ARRAY ; } else if ( parameters . length == <NUM_LIT:0> ) { Parameter it = new Parameter ( ClassHelper . OBJECT_TYPE , "<STR_LIT>" , ConstantExpression . NULL ) ; parameters = new Parameter [ ] { it } ; org . codehaus . groovy . ast . Variable ref = expression . getVariableScope ( ) . getDeclaredVariable ( "<STR_LIT>" ) ; if ( ref != null ) it . setClosureSharedVariable ( ref . isClosureSharedVariable ( ) ) ; } Parameter [ ] localVariableParams = getClosureSharedVariables ( expression ) ; removeInitialValues ( localVariableParams ) ; InnerClassNode answer = new InnerClassNode ( outerClass , name , <NUM_LIT:0> , ClassHelper . CLOSURE_TYPE ) ; answer . setEnclosingMethod ( this . methodNode ) ; answer . setSynthetic ( true ) ; if ( staticMethodOrInStaticClass ) { answer . setStaticClass ( true ) ; } if ( isInScriptBody ( ) ) { answer . setScriptBody ( true ) ; } MethodNode method = answer . addMethod ( "<STR_LIT>" , ACC_PUBLIC , ClassHelper . OBJECT_TYPE , parameters , ClassNode . EMPTY_ARRAY , expression . getCode ( ) ) ; method . setSourcePosition ( expression ) ; VariableScope varScope = expression . getVariableScope ( ) ; if ( varScope == null ) { throw new RuntimeException ( "<STR_LIT>" + expression + "<STR_LIT>" + name ) ; } else { method . setVariableScope ( varScope . copy ( ) ) ; } if ( parameters . length > <NUM_LIT:1> || ( parameters . length == <NUM_LIT:1> && parameters [ <NUM_LIT:0> ] . getType ( ) != null && parameters [ <NUM_LIT:0> ] . getType ( ) != ClassHelper . OBJECT_TYPE ) ) { MethodNode call = answer . addMethod ( "<STR_LIT>" , ACC_PUBLIC , ClassHelper . OBJECT_TYPE , parameters , ClassNode . EMPTY_ARRAY , new ReturnStatement ( new MethodCallExpression ( VariableExpression . THIS_EXPRESSION , "<STR_LIT>" , new ArgumentListExpression ( parameters ) ) ) ) ; call . setSourcePosition ( expression ) ; } BlockStatement block = new BlockStatement ( ) ; VariableExpression outer = new VariableExpression ( "<STR_LIT>" ) ; outer . setSourcePosition ( expression ) ; block . getVariableScope ( ) . putReferencedLocalVariable ( outer ) ; VariableExpression thisObject = new VariableExpression ( "<STR_LIT>" ) ; thisObject . setSourcePosition ( expression ) ; block . getVariableScope ( ) . putReferencedLocalVariable ( thisObject ) ; TupleExpression conArgs = new TupleExpression ( outer , thisObject ) ; block . addStatement ( new ExpressionStatement ( new ConstructorCallExpression ( ClassNode . SUPER , conArgs ) ) ) ; for ( int i = <NUM_LIT:0> ; i < localVariableParams . length ; i ++ ) { Parameter param = localVariableParams [ i ] ; String paramName = param . getName ( ) ; Expression initialValue = null ; ClassNode type = param . getType ( ) ; FieldNode paramField = null ; if ( true ) { initialValue = new VariableExpression ( paramName ) ; ClassNode realType = type ; type = ClassHelper . makeReference ( ) ; param . setType ( ClassHelper . makeReference ( ) ) ; paramField = answer . addField ( paramName , ACC_PRIVATE , type , initialValue ) ; paramField . setHolder ( true ) ; String methodName = Verifier . capitalize ( paramName ) ; Expression fieldExp = new FieldExpression ( paramField ) ; answer . addMethod ( "<STR_LIT:get>" + methodName , ACC_PUBLIC , realType , Parameter . EMPTY_ARRAY , ClassNode . EMPTY_ARRAY , new ReturnStatement ( fieldExp ) ) ; } } Parameter [ ] params = new Parameter [ <NUM_LIT:2> + localVariableParams . length ] ; params [ <NUM_LIT:0> ] = new Parameter ( ClassHelper . OBJECT_TYPE , "<STR_LIT>" ) ; params [ <NUM_LIT:1> ] = new Parameter ( ClassHelper . OBJECT_TYPE , "<STR_LIT>" ) ; System . arraycopy ( localVariableParams , <NUM_LIT:0> , params , <NUM_LIT:2> , localVariableParams . length ) ; ASTNode sn = answer . addConstructor ( ACC_PUBLIC , params , ClassNode . EMPTY_ARRAY , block ) ; sn . setSourcePosition ( expression ) ; return answer ; } private void removeInitialValues ( Parameter [ ] params ) { for ( int i = <NUM_LIT:0> ; i < params . length ; i ++ ) { if ( params [ i ] . hasInitialExpression ( ) ) { params [ i ] = new Parameter ( params [ i ] . getType ( ) , params [ i ] . getName ( ) ) ; } } } protected Parameter [ ] getClosureSharedVariables ( ClosureExpression ce ) { VariableScope scope = ce . getVariableScope ( ) ; Parameter [ ] ret = new Parameter [ scope . getReferencedLocalVariablesCount ( ) ] ; int index = <NUM_LIT:0> ; for ( Iterator iter = scope . getReferencedLocalVariablesIterator ( ) ; iter . hasNext ( ) ; ) { org . codehaus . groovy . ast . Variable element = ( org . codehaus . groovy . ast . Variable ) iter . next ( ) ; Parameter p = new Parameter ( element . getType ( ) , element . getName ( ) ) ; ret [ index ] = p ; index ++ ; } return ret ; } protected ClassNode getOutermostClass ( ) { if ( outermostClass == null ) { outermostClass = classNode ; while ( outermostClass instanceof InnerClassNode ) { outermostClass = outermostClass . getOuterClass ( ) ; } } return outermostClass ; } protected void doConvertAndCast ( ClassNode type ) { doConvertAndCast ( type , false ) ; } protected void doConvertAndCast ( ClassNode type , boolean coerce ) { if ( type == ClassHelper . OBJECT_TYPE ) return ; if ( rightHandType == null || ! rightHandType . isDerivedFrom ( type ) || ! rightHandType . implementsInterface ( type ) ) { if ( isValidTypeForCast ( type ) ) { visitClassExpression ( new ClassExpression ( type ) ) ; if ( coerce ) { asTypeMethod . call ( mv ) ; } else { castToTypeMethod . call ( mv ) ; } } } helper . doCast ( type ) ; } protected void evaluateLogicalOrExpression ( BinaryExpression expression ) { visitBooleanExpression ( new BooleanExpression ( expression . getLeftExpression ( ) ) ) ; Label l0 = new Label ( ) ; Label l2 = new Label ( ) ; mv . visitJumpInsn ( IFEQ , l0 ) ; mv . visitLabel ( l2 ) ; visitConstantExpression ( ConstantExpression . TRUE ) ; Label l1 = new Label ( ) ; mv . visitJumpInsn ( GOTO , l1 ) ; mv . visitLabel ( l0 ) ; visitBooleanExpression ( new BooleanExpression ( expression . getRightExpression ( ) ) ) ; mv . visitJumpInsn ( IFNE , l2 ) ; visitConstantExpression ( ConstantExpression . FALSE ) ; mv . visitLabel ( l1 ) ; } protected void evaluateLogicalAndExpression ( BinaryExpression expression ) { visitBooleanExpression ( new BooleanExpression ( expression . getLeftExpression ( ) ) ) ; Label l0 = new Label ( ) ; mv . visitJumpInsn ( IFEQ , l0 ) ; visitBooleanExpression ( new BooleanExpression ( expression . getRightExpression ( ) ) ) ; mv . visitJumpInsn ( IFEQ , l0 ) ; visitConstantExpression ( ConstantExpression . TRUE ) ; Label l1 = new Label ( ) ; mv . visitJumpInsn ( GOTO , l1 ) ; mv . visitLabel ( l0 ) ; visitConstantExpression ( ConstantExpression . FALSE ) ; mv . visitLabel ( l1 ) ; } protected void evaluateBinaryExpression ( String method , BinaryExpression expression ) { makeBinopCallSite ( expression . getLeftExpression ( ) , method , expression . getRightExpression ( ) ) ; } protected void evaluateCompareTo ( BinaryExpression expression ) { Expression leftExpression = expression . getLeftExpression ( ) ; leftExpression . visit ( this ) ; if ( isComparisonExpression ( leftExpression ) ) { helper . boxBoolean ( ) ; } Expression rightExpression = expression . getRightExpression ( ) ; rightExpression . visit ( this ) ; if ( isComparisonExpression ( rightExpression ) ) { helper . boxBoolean ( ) ; } compareToMethod . call ( mv ) ; } protected void evaluateBinaryExpressionWithAssignment ( String method , BinaryExpression expression ) { Expression leftExpression = expression . getLeftExpression ( ) ; if ( leftExpression instanceof BinaryExpression ) { BinaryExpression leftBinExpr = ( BinaryExpression ) leftExpression ; if ( leftBinExpr . getOperation ( ) . getType ( ) == Types . LEFT_SQUARE_BRACKET ) { prepareCallSite ( "<STR_LIT>" ) ; prepareCallSite ( method ) ; prepareCallSite ( "<STR_LIT>" ) ; visitAndAutoboxBoolean ( leftBinExpr . getLeftExpression ( ) ) ; visitAndAutoboxBoolean ( leftBinExpr . getRightExpression ( ) ) ; mv . visitInsn ( DUP2_X2 ) ; mv . visitMethodInsn ( INVOKEINTERFACE , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; visitAndAutoboxBoolean ( expression . getRightExpression ( ) ) ; mv . visitMethodInsn ( INVOKEINTERFACE , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; final int resultVar = compileStack . defineTemporaryVariable ( "<STR_LIT>" , true ) ; mv . visitVarInsn ( ALOAD , resultVar ) ; mv . visitMethodInsn ( INVOKEINTERFACE , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitInsn ( POP ) ; mv . visitVarInsn ( ALOAD , resultVar ) ; compileStack . removeVar ( resultVar ) ; return ; } } evaluateBinaryExpression ( method , expression ) ; mv . visitInsn ( DUP ) ; doConvertAndCast ( ClassHelper . getWrapper ( leftExpression . getType ( ) ) ) ; leftHandExpression = true ; evaluateExpression ( leftExpression ) ; leftHandExpression = false ; } private void evaluateBinaryExpression ( MethodCaller compareMethod , BinaryExpression expression ) { Expression leftExp = expression . getLeftExpression ( ) ; Expression rightExp = expression . getRightExpression ( ) ; load ( leftExp ) ; load ( rightExp ) ; compareMethod . call ( mv ) ; } protected void evaluateEqual ( BinaryExpression expression , boolean defineVariable ) { Expression leftExpression = expression . getLeftExpression ( ) ; if ( leftExpression instanceof BinaryExpression ) { BinaryExpression leftBinExpr = ( BinaryExpression ) leftExpression ; if ( leftBinExpr . getOperation ( ) . getType ( ) == Types . LEFT_SQUARE_BRACKET ) { prepareCallSite ( "<STR_LIT>" ) ; visitAndAutoboxBoolean ( leftBinExpr . getLeftExpression ( ) ) ; visitAndAutoboxBoolean ( leftBinExpr . getRightExpression ( ) ) ; visitAndAutoboxBoolean ( expression . getRightExpression ( ) ) ; final int resultVar = compileStack . defineTemporaryVariable ( "<STR_LIT>" , true ) ; mv . visitVarInsn ( ALOAD , resultVar ) ; mv . visitMethodInsn ( INVOKEINTERFACE , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitInsn ( POP ) ; mv . visitVarInsn ( ALOAD , resultVar ) ; compileStack . removeVar ( resultVar ) ; return ; } } Expression rightExpression = expression . getRightExpression ( ) ; if ( ! ( leftExpression instanceof TupleExpression ) ) { ClassNode type = null ; if ( expression instanceof DeclarationExpression ) { type = leftExpression . getType ( ) ; } else { type = getLHSType ( leftExpression ) ; } assignmentCastAndVisit ( type , rightExpression ) ; } else { visitAndAutoboxBoolean ( rightExpression ) ; } rightHandType = rightExpression . getType ( ) ; leftHandExpression = true ; if ( leftExpression instanceof TupleExpression ) { TupleExpression tuple = ( TupleExpression ) leftExpression ; int i = <NUM_LIT:0> ; Expression lhsExpr = new BytecodeExpression ( ) { public void visit ( MethodVisitor mv ) { mv . visitInsn ( SWAP ) ; mv . visitInsn ( DUP_X1 ) ; } } ; for ( Iterator iterator = tuple . getExpressions ( ) . iterator ( ) ; iterator . hasNext ( ) ; ) { VariableExpression var = ( VariableExpression ) iterator . next ( ) ; MethodCallExpression call = new MethodCallExpression ( lhsExpr , "<STR_LIT>" , new ArgumentListExpression ( new ConstantExpression ( Integer . valueOf ( i ) ) ) ) ; ClassNode type = getLHSType ( var ) ; assignmentCastAndVisit ( type , call ) ; i ++ ; if ( defineVariable ) { compileStack . defineVariable ( var , true ) ; } else { visitVariableExpression ( var ) ; } } } else if ( defineVariable ) { VariableExpression var = ( VariableExpression ) leftExpression ; compileStack . defineVariable ( var , true ) ; } else { mv . visitInsn ( DUP ) ; leftExpression . visit ( this ) ; } rightHandType = null ; leftHandExpression = false ; } private void assignmentCastAndVisit ( ClassNode type , Expression rightExpression ) { if ( ClassHelper . isPrimitiveType ( type ) ) { visitAndAutoboxBoolean ( rightExpression ) ; } else if ( ! rightExpression . getType ( ) . isDerivedFrom ( type ) ) { visitCastExpression ( new CastExpression ( type , rightExpression ) ) ; } else { visitAndAutoboxBoolean ( rightExpression ) ; } } protected ClassNode getLHSType ( Expression leftExpression ) { if ( leftExpression instanceof VariableExpression ) { VariableExpression varExp = ( VariableExpression ) leftExpression ; ClassNode type = varExp . getType ( ) ; if ( isValidTypeForCast ( type ) ) { return type ; } String variableName = varExp . getName ( ) ; Variable variable = compileStack . getVariable ( variableName , false ) ; if ( variable != null ) { if ( variable . isHolder ( ) ) { return type ; } if ( variable . isProperty ( ) ) return variable . getType ( ) ; type = variable . getType ( ) ; if ( isValidTypeForCast ( type ) ) { return type ; } } else { FieldNode field = classNode . getDeclaredField ( variableName ) ; if ( field == null ) { field = classNode . getOuterField ( variableName ) ; } if ( field != null ) { type = field . getType ( ) ; if ( ! field . isHolder ( ) && isValidTypeForCast ( type ) ) { return type ; } } } } else if ( leftExpression instanceof FieldExpression ) { FieldExpression fieldExp = ( FieldExpression ) leftExpression ; ClassNode type = fieldExp . getType ( ) ; if ( isValidTypeForCast ( type ) ) { return type ; } } return leftExpression . getType ( ) ; } protected boolean isValidTypeForCast ( ClassNode type ) { return type != ClassHelper . DYNAMIC_TYPE && type != ClassHelper . REFERENCE_TYPE ; } public void visitBytecodeExpression ( BytecodeExpression cle ) { cle . visit ( mv ) ; } protected void visitAndAutoboxBoolean ( Expression expression ) { if ( expression == null ) { return ; } expression . visit ( this ) ; if ( isComparisonExpression ( expression ) ) { helper . boxBoolean ( ) ; } } private void execMethodAndStoreForSubscriptOperator ( String method , Expression expression ) { makeCallSite ( expression , method , MethodCallExpression . NO_ARGUMENTS , false , false , false , false ) ; if ( expression instanceof BinaryExpression ) { BinaryExpression be = ( BinaryExpression ) expression ; if ( be . getOperation ( ) . getType ( ) == Types . LEFT_SQUARE_BRACKET ) { mv . visitInsn ( DUP ) ; final int resultIdx = compileStack . defineTemporaryVariable ( "<STR_LIT>" + method , true ) ; BytecodeExpression result = new BytecodeExpression ( ) { public void visit ( MethodVisitor mv ) { mv . visitVarInsn ( ALOAD , resultIdx ) ; } } ; TupleExpression args = new ArgumentListExpression ( ) ; args . addExpression ( be . getRightExpression ( ) ) ; args . addExpression ( result ) ; makeCallSite ( be . getLeftExpression ( ) , "<STR_LIT>" , args , false , false , false , false ) ; mv . visitInsn ( POP ) ; compileStack . removeVar ( resultIdx ) ; } } if ( expression instanceof VariableExpression || expression instanceof FieldExpression || expression instanceof PropertyExpression ) { mv . visitInsn ( DUP ) ; leftHandExpression = true ; expression . visit ( this ) ; leftHandExpression = false ; } } protected void evaluatePrefixMethod ( String method , Expression expression ) { execMethodAndStoreForSubscriptOperator ( method , expression ) ; } protected void evaluatePostfixMethod ( String method , Expression expression ) { expression . visit ( this ) ; int tempIdx = compileStack . defineTemporaryVariable ( "<STR_LIT>" + method , true ) ; execMethodAndStoreForSubscriptOperator ( method , expression ) ; mv . visitInsn ( POP ) ; mv . visitVarInsn ( ALOAD , tempIdx ) ; compileStack . removeVar ( tempIdx ) ; } protected void evaluateInstanceof ( BinaryExpression expression ) { visitAndAutoboxBoolean ( expression . getLeftExpression ( ) ) ; Expression rightExp = expression . getRightExpression ( ) ; ClassNode classType = ClassHelper . DYNAMIC_TYPE ; if ( rightExp instanceof ClassExpression ) { ClassExpression classExp = ( ClassExpression ) rightExp ; classType = classExp . getType ( ) ; } else { throw new RuntimeException ( "<STR_LIT>" + rightExp ) ; } String classInternalName = BytecodeHelper . getClassInternalName ( classType ) ; mv . visitTypeInsn ( INSTANCEOF , classInternalName ) ; } protected boolean argumentsUseStack ( Expression arguments ) { return arguments instanceof TupleExpression || arguments instanceof ClosureExpression ; } private static boolean isThisExpression ( Expression expression ) { if ( expression instanceof VariableExpression ) { VariableExpression varExp = ( VariableExpression ) expression ; return varExp . getName ( ) . equals ( "<STR_LIT>" ) ; } return false ; } private static boolean isSuperExpression ( Expression expression ) { if ( expression instanceof VariableExpression ) { VariableExpression varExp = ( VariableExpression ) expression ; return varExp . getName ( ) . equals ( "<STR_LIT>" ) ; } return false ; } private static boolean isThisOrSuper ( Expression expression ) { return isThisExpression ( expression ) || isSuperExpression ( expression ) ; } protected Expression createReturnLHSExpression ( Expression expression ) { if ( expression instanceof BinaryExpression ) { BinaryExpression binExpr = ( BinaryExpression ) expression ; if ( binExpr . getOperation ( ) . isA ( Types . ASSIGNMENT_OPERATOR ) ) { return createReusableExpression ( binExpr . getLeftExpression ( ) ) ; } } return null ; } protected Expression createReusableExpression ( Expression expression ) { ExpressionTransformer transformer = new ExpressionTransformer ( ) { public Expression transform ( Expression expression ) { if ( expression instanceof PostfixExpression ) { PostfixExpression postfixExp = ( PostfixExpression ) expression ; return postfixExp . getExpression ( ) ; } else if ( expression instanceof PrefixExpression ) { PrefixExpression prefixExp = ( PrefixExpression ) expression ; return prefixExp . getExpression ( ) ; } return expression ; } } ; return transformer . transform ( expression . transformExpression ( transformer ) ) ; } protected boolean isComparisonExpression ( Expression expression ) { if ( expression instanceof BinaryExpression ) { BinaryExpression binExpr = ( BinaryExpression ) expression ; switch ( binExpr . getOperation ( ) . getType ( ) ) { case Types . COMPARE_EQUAL : case Types . MATCH_REGEX : case Types . COMPARE_GREATER_THAN : case Types . COMPARE_GREATER_THAN_EQUAL : case Types . COMPARE_LESS_THAN : case Types . COMPARE_LESS_THAN_EQUAL : case Types . COMPARE_IDENTICAL : case Types . COMPARE_NOT_EQUAL : case Types . KEYWORD_INSTANCEOF : case Types . KEYWORD_IN : return true ; } } else if ( expression instanceof BooleanExpression ) { return true ; } return false ; } protected void onLineNumber ( ASTNode statement , String message ) { if ( statement == null ) return ; int line = statement . getLineNumber ( ) ; int col = statement . getColumnNumber ( ) ; this . currentASTNode = statement ; if ( line < <NUM_LIT:0> ) return ; if ( ! ASM_DEBUG && line == lineNumber ) return ; lineNumber = line ; columnNumber = col ; if ( mv != null ) { Label l = new Label ( ) ; mv . visitLabel ( l ) ; mv . visitLineNumber ( line , l ) ; if ( ASM_DEBUG ) { helper . mark ( message + "<STR_LIT:[>" + statement . getLineNumber ( ) + "<STR_LIT::>" + statement . getColumnNumber ( ) + "<STR_LIT:]>" ) ; } } } private boolean isInnerClass ( ) { return classNode instanceof InnerClassNode ; } protected boolean isFieldOrVariable ( String name ) { return compileStack . containsVariable ( name ) || classNode . getDeclaredField ( name ) != null ; } protected ClassNode getExpressionType ( Expression expression ) { if ( isComparisonExpression ( expression ) ) { return ClassHelper . boolean_TYPE ; } if ( expression instanceof VariableExpression ) { VariableExpression varExpr = ( VariableExpression ) expression ; if ( varExpr . isThisExpression ( ) ) { return classNode ; } else if ( varExpr . isSuperExpression ( ) ) { return classNode . getSuperClass ( ) ; } Variable variable = compileStack . getVariable ( varExpr . getName ( ) , false ) ; if ( variable != null && ! variable . isHolder ( ) ) { ClassNode type = variable . getType ( ) ; if ( ! variable . isDynamicTyped ( ) ) return type ; } if ( variable == null ) { org . codehaus . groovy . ast . Variable var = ( org . codehaus . groovy . ast . Variable ) compileStack . getScope ( ) . getReferencedClassVariable ( varExpr . getName ( ) ) ; if ( var != null && ! var . isDynamicTyped ( ) ) return var . getType ( ) ; } } return expression . getType ( ) ; } protected boolean isInClosureConstructor ( ) { return constructorNode != null && classNode . getOuterClass ( ) != null && classNode . getSuperClass ( ) == ClassHelper . CLOSURE_TYPE ; } protected boolean isInClosure ( ) { return classNode . getOuterClass ( ) != null && classNode . getSuperClass ( ) == ClassHelper . CLOSURE_TYPE ; } protected boolean isNotExplicitThisInClosure ( boolean implicitThis ) { return implicitThis || ! isInClosure ( ) ; } protected boolean isStaticMethod ( ) { return methodNode != null && methodNode . isStatic ( ) ; } protected CompileUnit getCompileUnit ( ) { CompileUnit answer = classNode . getCompileUnit ( ) ; if ( answer == null ) { answer = context . getCompileUnit ( ) ; } return answer ; } public static boolean usesSuper ( MethodCallExpression call ) { Expression expression = call . getObjectExpression ( ) ; if ( expression instanceof VariableExpression ) { VariableExpression varExp = ( VariableExpression ) expression ; String variable = varExp . getName ( ) ; return variable . equals ( "<STR_LIT>" ) ; } return false ; } public static boolean usesSuper ( PropertyExpression pe ) { Expression expression = pe . getObjectExpression ( ) ; if ( expression instanceof VariableExpression ) { VariableExpression varExp = ( VariableExpression ) expression ; String variable = varExp . getName ( ) ; return variable . equals ( "<STR_LIT>" ) ; } return false ; } protected int getBytecodeVersion ( ) { if ( ! classNode . isUsingGenerics ( ) && ! classNode . isAnnotated ( ) && ! classNode . isAnnotationDefinition ( ) ) { return Opcodes . V1_3 ; } final String target = getCompileUnit ( ) . getConfig ( ) . getTargetBytecode ( ) ; return CompilerConfiguration . POST_JDK5 . equals ( target ) ? Opcodes . V1_5 : Opcodes . V1_3 ; } private class MyMethodAdapter extends MethodAdapter { private String boxingDesc = null ; public MyMethodAdapter ( ) { super ( AsmClassGenerator . this . mv ) ; } private void dropBoxing ( ) { if ( boxingDesc != null ) { super . visitMethodInsn ( INVOKESTATIC , DTT , "<STR_LIT>" , boxingDesc ) ; boxingDesc = null ; } } public void visitInsn ( int opcode ) { dropBoxing ( ) ; super . visitInsn ( opcode ) ; } public void visitIntInsn ( int opcode , int operand ) { dropBoxing ( ) ; super . visitIntInsn ( opcode , operand ) ; } public void visitVarInsn ( int opcode , int var ) { dropBoxing ( ) ; super . visitVarInsn ( opcode , var ) ; } public void visitTypeInsn ( int opcode , String desc ) { dropBoxing ( ) ; super . visitTypeInsn ( opcode , desc ) ; } public void visitFieldInsn ( int opcode , String owner , String name , String desc ) { dropBoxing ( ) ; super . visitFieldInsn ( opcode , owner , name , desc ) ; } public void visitMethodInsn ( int opcode , String owner , String name , String desc ) { if ( boxing ( opcode , owner , name ) ) { boxingDesc = desc ; dropBoxing ( ) ; } else { if ( unboxing ( opcode , owner , name ) ) { if ( boxingDesc != null ) boxingDesc = null ; else super . visitMethodInsn ( opcode , owner , name , desc ) ; } else { dropBoxing ( ) ; super . visitMethodInsn ( opcode , owner , name , desc ) ; } } } private boolean boxing ( int opcode , String owner , String name ) { return opcode == INVOKESTATIC && owner . equals ( DTT ) && name . equals ( "<STR_LIT>" ) ; } private boolean unboxing ( int opcode , String owner , String name ) { return opcode == INVOKESTATIC && owner . equals ( DTT ) && name . endsWith ( "<STR_LIT>" ) ; } public void visitJumpInsn ( int opcode , Label label ) { dropBoxing ( ) ; super . visitJumpInsn ( opcode , label ) ; } public void visitLabel ( Label label ) { dropBoxing ( ) ; super . visitLabel ( label ) ; } public void visitLdcInsn ( Object cst ) { dropBoxing ( ) ; super . visitLdcInsn ( cst ) ; } public void visitIincInsn ( int var , int increment ) { dropBoxing ( ) ; super . visitIincInsn ( var , increment ) ; } public void visitTableSwitchInsn ( int min , int max , Label dflt , Label labels [ ] ) { dropBoxing ( ) ; super . visitTableSwitchInsn ( min , max , dflt , labels ) ; } public void visitLookupSwitchInsn ( Label dflt , int keys [ ] , Label labels [ ] ) { dropBoxing ( ) ; super . visitLookupSwitchInsn ( dflt , keys , labels ) ; } public void visitMultiANewArrayInsn ( String desc , int dims ) { dropBoxing ( ) ; super . visitMultiANewArrayInsn ( desc , dims ) ; } public void visitTryCatchBlock ( Label start , Label end , Label handler , String type ) { dropBoxing ( ) ; super . visitTryCatchBlock ( start , end , handler , type ) ; } } } </s>
|
<s> package org . codehaus . groovy . transform ; import groovy . lang . Immutable ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collection ; import java . util . Date ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; import org . codehaus . groovy . ast . ASTNode ; import org . codehaus . groovy . ast . AnnotatedNode ; import org . codehaus . groovy . ast . AnnotationNode ; import org . codehaus . groovy . ast . ClassHelper ; import org . codehaus . groovy . ast . ClassNode ; import org . codehaus . groovy . ast . ConstructorNode ; import org . codehaus . groovy . ast . FieldNode ; import org . codehaus . groovy . ast . MethodNode ; import org . codehaus . groovy . ast . Parameter ; import org . codehaus . groovy . ast . PropertyNode ; import org . codehaus . groovy . ast . expr . ArgumentListExpression ; import org . codehaus . groovy . ast . expr . BinaryExpression ; import org . codehaus . groovy . ast . expr . BooleanExpression ; import org . codehaus . groovy . ast . expr . CastExpression ; import org . codehaus . groovy . ast . expr . ClassExpression ; import org . codehaus . groovy . ast . expr . ConstantExpression ; import org . codehaus . groovy . ast . expr . ConstructorCallExpression ; import org . codehaus . groovy . ast . expr . DeclarationExpression ; import org . codehaus . groovy . ast . expr . Expression ; import org . codehaus . groovy . ast . expr . FieldExpression ; import org . codehaus . groovy . ast . expr . MapExpression ; import org . codehaus . groovy . ast . expr . MethodCallExpression ; import org . codehaus . groovy . ast . expr . PropertyExpression ; import org . codehaus . groovy . ast . expr . StaticMethodCallExpression ; import org . codehaus . groovy . ast . expr . TupleExpression ; import org . codehaus . groovy . ast . expr . VariableExpression ; import org . codehaus . groovy . ast . stmt . BlockStatement ; import org . codehaus . groovy . ast . stmt . EmptyStatement ; import org . codehaus . groovy . ast . stmt . ExpressionStatement ; import org . codehaus . groovy . ast . stmt . IfStatement ; import org . codehaus . groovy . ast . stmt . ReturnStatement ; import org . codehaus . groovy . ast . stmt . Statement ; import org . codehaus . groovy . control . CompilePhase ; import org . codehaus . groovy . control . SourceUnit ; import org . codehaus . groovy . runtime . DefaultGroovyMethods ; import org . codehaus . groovy . syntax . Token ; import org . codehaus . groovy . syntax . Types ; import org . codehaus . groovy . util . HashCodeHelper ; import org . objectweb . asm . Opcodes ; @ GroovyASTTransformation ( phase = CompilePhase . CANONICALIZATION ) public class ImmutableASTTransformation implements ASTTransformation , Opcodes { private static Class [ ] immutableList = { Boolean . class , Byte . class , Character . class , Double . class , Float . class , Integer . class , Long . class , Short . class , String . class , java . math . BigInteger . class , java . math . BigDecimal . class , java . awt . Color . class , } ; private static final Class MY_CLASS = Immutable . class ; private static final ClassNode MY_TYPE = new ClassNode ( MY_CLASS ) ; private static final String MY_TYPE_NAME = "<STR_LIT:@>" + MY_TYPE . getNameWithoutPackage ( ) ; private static final ClassNode OBJECT_TYPE = new ClassNode ( Object . class ) ; private static final ClassNode HASHMAP_TYPE = new ClassNode ( HashMap . class ) ; private static final ClassNode MAP_TYPE = new ClassNode ( Map . class ) ; private static final ClassNode DATE_TYPE = new ClassNode ( Date . class ) ; private static final ClassNode CLONEABLE_TYPE = new ClassNode ( Cloneable . class ) ; private static final ClassNode COLLECTION_TYPE = new ClassNode ( Collection . class ) ; private static final ClassNode HASHUTIL_TYPE = new ClassNode ( HashCodeHelper . class ) ; private static final ClassNode STRINGBUFFER_TYPE = new ClassNode ( StringBuffer . class ) ; private static final ClassNode DGM_TYPE = new ClassNode ( DefaultGroovyMethods . class ) ; private static final ClassNode SELF_TYPE = new ClassNode ( ImmutableASTTransformation . class ) ; private static final Token COMPARE_EQUAL = Token . newSymbol ( Types . COMPARE_EQUAL , - <NUM_LIT:1> , - <NUM_LIT:1> ) ; private static final Token COMPARE_NOT_EQUAL = Token . newSymbol ( Types . COMPARE_NOT_EQUAL , - <NUM_LIT:1> , - <NUM_LIT:1> ) ; private static final Token COMPARE_IDENTICAL = Token . newSymbol ( Types . COMPARE_IDENTICAL , - <NUM_LIT:1> , - <NUM_LIT:1> ) ; private static final Token ASSIGN = Token . newSymbol ( Types . ASSIGN , - <NUM_LIT:1> , - <NUM_LIT:1> ) ; public void visit ( ASTNode [ ] nodes , SourceUnit source ) { if ( nodes . length != <NUM_LIT:2> || ! ( nodes [ <NUM_LIT:0> ] instanceof AnnotationNode ) || ! ( nodes [ <NUM_LIT:1> ] instanceof AnnotatedNode ) ) { throw new RuntimeException ( "<STR_LIT>" + Arrays . asList ( nodes ) ) ; } AnnotatedNode parent = ( AnnotatedNode ) nodes [ <NUM_LIT:1> ] ; AnnotationNode node = ( AnnotationNode ) nodes [ <NUM_LIT:0> ] ; if ( ! MY_TYPE . equals ( node . getClassNode ( ) ) ) return ; List < PropertyNode > newNodes = new ArrayList < PropertyNode > ( ) ; if ( parent instanceof ClassNode ) { ClassNode cNode = ( ClassNode ) parent ; String cName = cNode . getName ( ) ; if ( cNode . isInterface ( ) ) { throw new RuntimeException ( "<STR_LIT>" + cName + "<STR_LIT>" + MY_TYPE_NAME + "<STR_LIT>" ) ; } if ( ( cNode . getModifiers ( ) & ACC_FINAL ) == <NUM_LIT:0> ) { cNode . setModifiers ( cNode . getModifiers ( ) | ACC_FINAL ) ; } final List < PropertyNode > pList = cNode . getProperties ( ) ; for ( PropertyNode pNode : pList ) { adjustPropertyForImmutability ( pNode , newNodes ) ; } for ( PropertyNode pNode : newNodes ) { pList . remove ( pNode ) ; addProperty ( cNode , pNode ) ; } final List < FieldNode > fList = cNode . getFields ( ) ; for ( FieldNode fNode : fList ) { ensureNotPublic ( cName , fNode ) ; } createConstructor ( cNode ) ; createHashCode ( cNode ) ; createEquals ( cNode ) ; createToString ( cNode ) ; } } private boolean hasDeclaredMethod ( ClassNode cNode , String name , int argsCount ) { List < MethodNode > ms = cNode . getDeclaredMethods ( name ) ; for ( MethodNode m : ms ) { Parameter [ ] paras = m . getParameters ( ) ; if ( paras != null && paras . length == argsCount ) { return true ; } } return false ; } private void ensureNotPublic ( String cNode , FieldNode fNode ) { String fName = fNode . getName ( ) ; if ( fNode . isPublic ( ) && ! fName . contains ( "<STR_LIT:$>" ) ) { throw new RuntimeException ( "<STR_LIT>" + fName + "<STR_LIT>" + MY_TYPE_NAME + "<STR_LIT>" + cNode + "<STR_LIT>" ) ; } } private void createHashCode ( ClassNode cNode ) { boolean hasExistingHashCode = hasDeclaredMethod ( cNode , "<STR_LIT>" , <NUM_LIT:0> ) ; if ( hasExistingHashCode && hasDeclaredMethod ( cNode , "<STR_LIT>" , <NUM_LIT:0> ) ) return ; final FieldNode hashField = cNode . addField ( "<STR_LIT>" , ACC_PRIVATE | ACC_SYNTHETIC , ClassHelper . int_TYPE , null ) ; final BlockStatement body = new BlockStatement ( ) ; final Expression hash = new FieldExpression ( hashField ) ; final List < PropertyNode > list = cNode . getProperties ( ) ; body . addStatement ( new IfStatement ( isZeroExpr ( hash ) , calculateHashStatements ( hash , list ) , new EmptyStatement ( ) ) ) ; body . addStatement ( new ReturnStatement ( hash ) ) ; cNode . addMethod ( new MethodNode ( hasExistingHashCode ? "<STR_LIT>" : "<STR_LIT>" , hasExistingHashCode ? ACC_PRIVATE : ACC_PUBLIC , ClassHelper . int_TYPE , Parameter . EMPTY_ARRAY , ClassNode . EMPTY_ARRAY , body ) ) ; } private void createToString ( ClassNode cNode ) { boolean hasExistingToString = hasDeclaredMethod ( cNode , "<STR_LIT>" , <NUM_LIT:0> ) ; if ( hasExistingToString && hasDeclaredMethod ( cNode , "<STR_LIT>" , <NUM_LIT:0> ) ) return ; final BlockStatement body = new BlockStatement ( ) ; final List < PropertyNode > list = cNode . getProperties ( ) ; final Expression result = new VariableExpression ( "<STR_LIT>" ) ; final Expression init = new ConstructorCallExpression ( STRINGBUFFER_TYPE , MethodCallExpression . NO_ARGUMENTS ) ; body . addStatement ( new ExpressionStatement ( new DeclarationExpression ( result , ASSIGN , init ) ) ) ; body . addStatement ( append ( result , new ConstantExpression ( cNode . getName ( ) ) ) ) ; body . addStatement ( append ( result , new ConstantExpression ( "<STR_LIT:(>" ) ) ) ; boolean first = true ; for ( PropertyNode pNode : list ) { if ( first ) { first = false ; } else { body . addStatement ( append ( result , new ConstantExpression ( "<STR_LIT:U+002CU+0020>" ) ) ) ; } body . addStatement ( new IfStatement ( new BooleanExpression ( new FieldExpression ( cNode . getField ( "<STR_LIT>" ) ) ) , toStringPropertyName ( result , pNode . getName ( ) ) , new EmptyStatement ( ) ) ) ; final FieldExpression fieldExpr = new FieldExpression ( pNode . getField ( ) ) ; body . addStatement ( append ( result , new MethodCallExpression ( fieldExpr , "<STR_LIT>" , MethodCallExpression . NO_ARGUMENTS ) ) ) ; } body . addStatement ( append ( result , new ConstantExpression ( "<STR_LIT:)>" ) ) ) ; body . addStatement ( new ReturnStatement ( new MethodCallExpression ( result , "<STR_LIT>" , MethodCallExpression . NO_ARGUMENTS ) ) ) ; cNode . addMethod ( new MethodNode ( hasExistingToString ? "<STR_LIT>" : "<STR_LIT>" , hasExistingToString ? ACC_PRIVATE : ACC_PUBLIC , ClassHelper . STRING_TYPE , Parameter . EMPTY_ARRAY , ClassNode . EMPTY_ARRAY , body ) ) ; } private Statement toStringPropertyName ( Expression result , String fName ) { final BlockStatement body = new BlockStatement ( ) ; body . addStatement ( append ( result , new ConstantExpression ( fName ) ) ) ; body . addStatement ( append ( result , new ConstantExpression ( "<STR_LIT::>" ) ) ) ; return body ; } private ExpressionStatement append ( Expression result , Expression expr ) { return new ExpressionStatement ( new MethodCallExpression ( result , "<STR_LIT>" , expr ) ) ; } private Statement calculateHashStatements ( Expression hash , List < PropertyNode > list ) { final BlockStatement body = new BlockStatement ( ) ; final Expression result = new VariableExpression ( "<STR_LIT>" ) ; final Expression init = new StaticMethodCallExpression ( HASHUTIL_TYPE , "<STR_LIT>" , MethodCallExpression . NO_ARGUMENTS ) ; body . addStatement ( new ExpressionStatement ( new DeclarationExpression ( result , ASSIGN , init ) ) ) ; for ( PropertyNode pNode : list ) { final Expression fieldExpr = new FieldExpression ( pNode . getField ( ) ) ; final Expression args = new TupleExpression ( result , fieldExpr ) ; final Expression current = new StaticMethodCallExpression ( HASHUTIL_TYPE , "<STR_LIT>" , args ) ; body . addStatement ( assignStatement ( result , current ) ) ; } body . addStatement ( assignStatement ( hash , result ) ) ; return body ; } private void createEquals ( ClassNode cNode ) { boolean hasExistingEquals = hasDeclaredMethod ( cNode , "<STR_LIT>" , <NUM_LIT:1> ) ; if ( hasExistingEquals && hasDeclaredMethod ( cNode , "<STR_LIT>" , <NUM_LIT:1> ) ) return ; final BlockStatement body = new BlockStatement ( ) ; Expression other = new VariableExpression ( "<STR_LIT>" ) ; body . addStatement ( returnFalseIfNull ( other ) ) ; body . addStatement ( returnFalseIfWrongType ( cNode , other ) ) ; body . addStatement ( returnTrueIfIdentical ( VariableExpression . THIS_EXPRESSION , other ) ) ; final List < PropertyNode > list = cNode . getProperties ( ) ; for ( PropertyNode pNode : list ) { body . addStatement ( returnFalseIfPropertyNotEqual ( pNode , other ) ) ; } body . addStatement ( new ReturnStatement ( ConstantExpression . TRUE ) ) ; Parameter [ ] params = { new Parameter ( OBJECT_TYPE , "<STR_LIT>" ) } ; cNode . addMethod ( new MethodNode ( hasExistingEquals ? "<STR_LIT>" : "<STR_LIT>" , hasExistingEquals ? ACC_PRIVATE : ACC_PUBLIC , ClassHelper . boolean_TYPE , params , ClassNode . EMPTY_ARRAY , body ) ) ; } private Statement returnFalseIfWrongType ( ClassNode cNode , Expression other ) { return new IfStatement ( notEqualClasses ( cNode , other ) , new ReturnStatement ( ConstantExpression . FALSE ) , new EmptyStatement ( ) ) ; } private IfStatement returnFalseIfNull ( Expression other ) { return new IfStatement ( equalsNullExpr ( other ) , new ReturnStatement ( ConstantExpression . FALSE ) , new EmptyStatement ( ) ) ; } private IfStatement returnTrueIfIdentical ( Expression self , Expression other ) { return new IfStatement ( identicalExpr ( self , other ) , new ReturnStatement ( ConstantExpression . TRUE ) , new EmptyStatement ( ) ) ; } private Statement returnFalseIfPropertyNotEqual ( PropertyNode pNode , Expression other ) { return new IfStatement ( notEqualsExpr ( pNode , other ) , new ReturnStatement ( ConstantExpression . FALSE ) , new EmptyStatement ( ) ) ; } private void addProperty ( ClassNode cNode , PropertyNode pNode ) { final FieldNode fn = pNode . getField ( ) ; cNode . getFields ( ) . remove ( fn ) ; cNode . addProperty ( pNode . getName ( ) , pNode . getModifiers ( ) | ACC_FINAL , pNode . getType ( ) , pNode . getInitialExpression ( ) , pNode . getGetterBlock ( ) , pNode . getSetterBlock ( ) ) ; final FieldNode newfn = cNode . getField ( fn . getName ( ) ) ; cNode . getFields ( ) . remove ( newfn ) ; cNode . addField ( fn ) ; } private void createConstructor ( ClassNode cNode ) { final FieldNode constructorField = cNode . addField ( "<STR_LIT>" , ACC_PRIVATE | ACC_SYNTHETIC , ClassHelper . boolean_TYPE , null ) ; final FieldExpression constructorStyle = new FieldExpression ( constructorField ) ; if ( cNode . getDeclaredConstructors ( ) . size ( ) != <NUM_LIT:0> ) { throw new RuntimeException ( "<STR_LIT>" + MY_TYPE_NAME + "<STR_LIT>" + cNode . getNameWithoutPackage ( ) ) ; } List < PropertyNode > list = cNode . getProperties ( ) ; boolean specialHashMapCase = list . size ( ) == <NUM_LIT:1> && list . get ( <NUM_LIT:0> ) . getField ( ) . getType ( ) . equals ( HASHMAP_TYPE ) ; if ( specialHashMapCase ) { createConstructorMapSpecial ( cNode , constructorStyle , list ) ; } else { createConstructorMap ( cNode , constructorStyle , list ) ; createConstructorOrdered ( cNode , constructorStyle , list ) ; } } private void createConstructorMapSpecial ( ClassNode cNode , FieldExpression constructorStyle , List < PropertyNode > list ) { final BlockStatement body = new BlockStatement ( ) ; body . addStatement ( createConstructorStatementMapSpecial ( list . get ( <NUM_LIT:0> ) . getField ( ) ) ) ; createConstructorMapCommon ( cNode , constructorStyle , body ) ; } private void createConstructorMap ( ClassNode cNode , FieldExpression constructorStyle , List < PropertyNode > list ) { final BlockStatement body = new BlockStatement ( ) ; for ( PropertyNode pNode : list ) { body . addStatement ( createConstructorStatement ( cNode , pNode ) ) ; } createConstructorMapCommon ( cNode , constructorStyle , body ) ; } private void createConstructorMapCommon ( ClassNode cNode , FieldExpression constructorStyle , BlockStatement body ) { final List < FieldNode > fList = cNode . getFields ( ) ; for ( FieldNode fNode : fList ) { if ( ! fNode . isPublic ( ) && ! fNode . getName ( ) . contains ( "<STR_LIT:$>" ) && ( cNode . getProperty ( fNode . getName ( ) ) == null ) ) { body . addStatement ( createConstructorStatementDefault ( fNode ) ) ; } } body . addStatement ( assignStatement ( constructorStyle , ConstantExpression . TRUE ) ) ; final Parameter [ ] params = new Parameter [ ] { new Parameter ( HASHMAP_TYPE , "<STR_LIT>" ) } ; cNode . addConstructor ( new ConstructorNode ( ACC_PUBLIC , params , ClassNode . EMPTY_ARRAY , new IfStatement ( equalsNullExpr ( new VariableExpression ( "<STR_LIT>" ) ) , new EmptyStatement ( ) , body ) ) ) ; } private void createConstructorOrdered ( ClassNode cNode , FieldExpression constructorStyle , List < PropertyNode > list ) { final MapExpression argMap = new MapExpression ( ) ; final Parameter [ ] orderedParams = new Parameter [ list . size ( ) ] ; int index = <NUM_LIT:0> ; for ( PropertyNode pNode : list ) { orderedParams [ index ++ ] = new Parameter ( pNode . getField ( ) . getType ( ) , pNode . getField ( ) . getName ( ) ) ; argMap . addMapEntryExpression ( new ConstantExpression ( pNode . getName ( ) ) , new VariableExpression ( pNode . getName ( ) ) ) ; } final BlockStatement orderedBody = new BlockStatement ( ) ; orderedBody . addStatement ( new ExpressionStatement ( new ConstructorCallExpression ( ClassNode . THIS , new ArgumentListExpression ( new CastExpression ( HASHMAP_TYPE , argMap ) ) ) ) ) ; orderedBody . addStatement ( assignStatement ( constructorStyle , ConstantExpression . FALSE ) ) ; cNode . addConstructor ( new ConstructorNode ( ACC_PUBLIC , orderedParams , ClassNode . EMPTY_ARRAY , orderedBody ) ) ; } private Statement createConstructorStatement ( ClassNode cNode , PropertyNode pNode ) { FieldNode fNode = pNode . getField ( ) ; final ClassNode fieldType = fNode . getType ( ) ; final Statement statement ; if ( fieldType . isArray ( ) || implementsInterface ( fieldType , CLONEABLE_TYPE ) ) { statement = createConstructorStatementArrayOrCloneable ( fNode ) ; } else if ( fieldType . isDerivedFrom ( DATE_TYPE ) ) { statement = createConstructorStatementDate ( fNode ) ; } else if ( fieldType . isDerivedFrom ( COLLECTION_TYPE ) || fieldType . isDerivedFrom ( MAP_TYPE ) ) { statement = createConstructorStatementCollection ( fNode ) ; } else if ( isKnownImmutable ( fieldType ) ) { statement = createConstructorStatementDefault ( fNode ) ; } else if ( fieldType . isResolved ( ) ) { throw new RuntimeException ( createErrorMessage ( cNode . getName ( ) , fNode . getName ( ) , fieldType . getName ( ) , "<STR_LIT>" ) ) ; } else { statement = createConstructorStatementGuarded ( cNode , fNode ) ; } return statement ; } private boolean implementsInterface ( ClassNode fieldType , ClassNode interfaceType ) { return Arrays . asList ( fieldType . getInterfaces ( ) ) . contains ( interfaceType ) ; } private Statement createConstructorStatementGuarded ( ClassNode cNode , FieldNode fNode ) { final FieldExpression fieldExpr = new FieldExpression ( fNode ) ; Expression initExpr = fNode . getInitialValueExpression ( ) ; if ( initExpr == null ) initExpr = ConstantExpression . NULL ; Expression unknown = findArg ( fNode . getName ( ) ) ; return new IfStatement ( equalsNullExpr ( unknown ) , new IfStatement ( equalsNullExpr ( initExpr ) , new EmptyStatement ( ) , assignStatement ( fieldExpr , checkUnresolved ( cNode , fNode , initExpr ) ) ) , assignStatement ( fieldExpr , checkUnresolved ( cNode , fNode , unknown ) ) ) ; } private Expression checkUnresolved ( ClassNode cNode , FieldNode fNode , Expression value ) { Expression args = new TupleExpression ( new ConstantExpression ( cNode . getName ( ) ) , new ConstantExpression ( fNode . getName ( ) ) , value ) ; return new StaticMethodCallExpression ( SELF_TYPE , "<STR_LIT>" , args ) ; } private Statement createConstructorStatementCollection ( FieldNode fNode ) { final FieldExpression fieldExpr = new FieldExpression ( fNode ) ; Expression initExpr = fNode . getInitialValueExpression ( ) ; if ( initExpr == null ) initExpr = ConstantExpression . NULL ; Expression collection = findArg ( fNode . getName ( ) ) ; return new IfStatement ( equalsNullExpr ( collection ) , new IfStatement ( equalsNullExpr ( initExpr ) , new EmptyStatement ( ) , assignStatement ( fieldExpr , cloneCollectionExpr ( initExpr ) ) ) , assignStatement ( fieldExpr , cloneCollectionExpr ( collection ) ) ) ; } private Statement createConstructorStatementMapSpecial ( FieldNode fNode ) { final FieldExpression fieldExpr = new FieldExpression ( fNode ) ; Expression initExpr = fNode . getInitialValueExpression ( ) ; if ( initExpr == null ) initExpr = ConstantExpression . NULL ; Expression namedArgs = findArg ( fNode . getName ( ) ) ; Expression baseArgs = new VariableExpression ( "<STR_LIT>" ) ; return new IfStatement ( equalsNullExpr ( baseArgs ) , new IfStatement ( equalsNullExpr ( initExpr ) , new EmptyStatement ( ) , assignStatement ( fieldExpr , cloneCollectionExpr ( initExpr ) ) ) , new IfStatement ( equalsNullExpr ( namedArgs ) , new IfStatement ( isTrueExpr ( new MethodCallExpression ( baseArgs , "<STR_LIT>" , new ConstantExpression ( fNode . getName ( ) ) ) ) , assignStatement ( fieldExpr , namedArgs ) , assignStatement ( fieldExpr , cloneCollectionExpr ( baseArgs ) ) ) , new IfStatement ( isOneExpr ( new MethodCallExpression ( baseArgs , "<STR_LIT:size>" , MethodCallExpression . NO_ARGUMENTS ) ) , assignStatement ( fieldExpr , cloneCollectionExpr ( namedArgs ) ) , assignStatement ( fieldExpr , cloneCollectionExpr ( baseArgs ) ) ) ) ) ; } private boolean isKnownImmutable ( ClassNode fieldType ) { if ( ! fieldType . isResolved ( ) ) return false ; String s = fieldType . getName ( ) ; return fieldType . isPrimitive ( ) || fieldType . isEnum ( ) || inImmutableList ( fieldType . getName ( ) ) ; } private static boolean inImmutableList ( String signature ) { for ( int i = <NUM_LIT:0> ; i < immutableList . length ; i ++ ) { if ( immutableList [ i ] . getName ( ) . equals ( signature ) ) { return true ; } } return false ; } private static boolean inImmutableList ( Class typeClass ) { return Arrays . asList ( immutableList ) . contains ( typeClass ) ; } private Statement createConstructorStatementDefault ( FieldNode fNode ) { final FieldExpression fieldExpr = new FieldExpression ( fNode ) ; Expression initExpr = fNode . getInitialValueExpression ( ) ; if ( initExpr == null ) initExpr = ConstantExpression . NULL ; Expression value = findArg ( fNode . getName ( ) ) ; return new IfStatement ( equalsNullExpr ( value ) , new IfStatement ( equalsNullExpr ( initExpr ) , new EmptyStatement ( ) , assignStatement ( fieldExpr , initExpr ) ) , assignStatement ( fieldExpr , value ) ) ; } private Statement createConstructorStatementArrayOrCloneable ( FieldNode fNode ) { final FieldExpression fieldExpr = new FieldExpression ( fNode ) ; Expression initExpr = fNode . getInitialValueExpression ( ) ; if ( initExpr == null ) initExpr = ConstantExpression . NULL ; final Expression array = findArg ( fNode . getName ( ) ) ; return new IfStatement ( equalsNullExpr ( array ) , new IfStatement ( equalsNullExpr ( initExpr ) , assignStatement ( fieldExpr , ConstantExpression . NULL ) , assignStatement ( fieldExpr , cloneArrayOrCloneableExpr ( initExpr ) ) ) , assignStatement ( fieldExpr , cloneArrayOrCloneableExpr ( array ) ) ) ; } private Statement createConstructorStatementDate ( FieldNode fNode ) { final FieldExpression fieldExpr = new FieldExpression ( fNode ) ; Expression initExpr = fNode . getInitialValueExpression ( ) ; if ( initExpr == null ) initExpr = ConstantExpression . NULL ; final Expression date = findArg ( fNode . getName ( ) ) ; return new IfStatement ( equalsNullExpr ( date ) , new IfStatement ( equalsNullExpr ( initExpr ) , assignStatement ( fieldExpr , ConstantExpression . NULL ) , assignStatement ( fieldExpr , cloneDateExpr ( initExpr ) ) ) , assignStatement ( fieldExpr , cloneDateExpr ( date ) ) ) ; } private Expression cloneDateExpr ( Expression origDate ) { return new ConstructorCallExpression ( DATE_TYPE , new MethodCallExpression ( origDate , "<STR_LIT>" , MethodCallExpression . NO_ARGUMENTS ) ) ; } private Statement assignStatement ( Expression fieldExpr , Expression value ) { return new ExpressionStatement ( assignExpr ( fieldExpr , value ) ) ; } private Expression assignExpr ( Expression fieldExpr , Expression value ) { return new BinaryExpression ( fieldExpr , ASSIGN , value ) ; } private BooleanExpression equalsNullExpr ( Expression argExpr ) { return new BooleanExpression ( new BinaryExpression ( argExpr , COMPARE_EQUAL , ConstantExpression . NULL ) ) ; } private BooleanExpression isTrueExpr ( Expression argExpr ) { return new BooleanExpression ( new BinaryExpression ( argExpr , COMPARE_EQUAL , ConstantExpression . TRUE ) ) ; } private BooleanExpression isZeroExpr ( Expression expr ) { return new BooleanExpression ( new BinaryExpression ( expr , COMPARE_EQUAL , new ConstantExpression ( <NUM_LIT:0> ) ) ) ; } private BooleanExpression isOneExpr ( Expression expr ) { return new BooleanExpression ( new BinaryExpression ( expr , COMPARE_EQUAL , new ConstantExpression ( <NUM_LIT:1> ) ) ) ; } private BooleanExpression notEqualsExpr ( PropertyNode pNode , Expression other ) { final Expression fieldExpr = new FieldExpression ( pNode . getField ( ) ) ; final Expression otherExpr = new PropertyExpression ( other , pNode . getField ( ) . getName ( ) ) ; return new BooleanExpression ( new BinaryExpression ( fieldExpr , COMPARE_NOT_EQUAL , otherExpr ) ) ; } private BooleanExpression identicalExpr ( Expression self , Expression other ) { return new BooleanExpression ( new BinaryExpression ( self , COMPARE_IDENTICAL , other ) ) ; } private BooleanExpression notEqualClasses ( ClassNode cNode , Expression other ) { return new BooleanExpression ( new BinaryExpression ( new ClassExpression ( cNode ) , COMPARE_NOT_EQUAL , new MethodCallExpression ( other , "<STR_LIT>" , MethodCallExpression . NO_ARGUMENTS ) ) ) ; } private Expression findArg ( String fName ) { return new PropertyExpression ( new VariableExpression ( "<STR_LIT>" ) , fName ) ; } private void adjustPropertyForImmutability ( PropertyNode pNode , List < PropertyNode > newNodes ) { final FieldNode fNode = pNode . getField ( ) ; fNode . setModifiers ( ( pNode . getModifiers ( ) & ( ~ ACC_PUBLIC ) ) | ACC_FINAL | ACC_PRIVATE ) ; adjustPropertyNode ( pNode , createGetterBody ( fNode ) ) ; newNodes . add ( pNode ) ; } private void adjustPropertyNode ( PropertyNode pNode , Statement getterBody ) { pNode . setSetterBlock ( null ) ; pNode . setGetterBlock ( getterBody ) ; } private Statement createGetterBody ( FieldNode fNode ) { BlockStatement body = new BlockStatement ( ) ; final ClassNode fieldType = fNode . getType ( ) ; final Statement statement ; if ( fieldType . isArray ( ) || implementsInterface ( fieldType , CLONEABLE_TYPE ) ) { statement = createGetterBodyArrayOrCloneable ( fNode ) ; } else if ( fieldType . isDerivedFrom ( DATE_TYPE ) ) { statement = createGetterBodyDate ( fNode ) ; } else { statement = createGetterBodyDefault ( fNode ) ; } body . addStatement ( statement ) ; return body ; } private Statement createGetterBodyDefault ( FieldNode fNode ) { final Expression fieldExpr = new FieldExpression ( fNode ) ; return new ExpressionStatement ( fieldExpr ) ; } private static String createErrorMessage ( String className , String fieldName , String typeName , String mode ) { return MY_TYPE_NAME + "<STR_LIT>" + fieldName + "<STR_LIT>" + prettyTypeName ( typeName ) + "<STR_LIT>" + mode + "<STR_LIT>" + className + "<STR_LIT>" + MY_TYPE_NAME + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + MY_TYPE_NAME + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + MY_TYPE_NAME + "<STR_LIT>" ; } private static String prettyTypeName ( String name ) { return name . equals ( "<STR_LIT>" ) ? name + "<STR_LIT>" : name ; } private Statement createGetterBodyArrayOrCloneable ( FieldNode fNode ) { final Expression fieldExpr = new FieldExpression ( fNode ) ; final Expression expression = cloneArrayOrCloneableExpr ( fieldExpr ) ; return safeExpression ( fieldExpr , expression ) ; } private Expression cloneArrayOrCloneableExpr ( Expression fieldExpr ) { return new MethodCallExpression ( fieldExpr , "<STR_LIT>" , MethodCallExpression . NO_ARGUMENTS ) ; } private Expression cloneCollectionExpr ( Expression fieldExpr ) { return new StaticMethodCallExpression ( DGM_TYPE , "<STR_LIT>" , fieldExpr ) ; } private Statement createGetterBodyDate ( FieldNode fNode ) { final Expression fieldExpr = new FieldExpression ( fNode ) ; final Expression expression = cloneDateExpr ( fieldExpr ) ; return safeExpression ( fieldExpr , expression ) ; } private Statement safeExpression ( Expression fieldExpr , Expression expression ) { return new IfStatement ( equalsNullExpr ( fieldExpr ) , new ExpressionStatement ( fieldExpr ) , new ExpressionStatement ( expression ) ) ; } private static Object checkImmutable ( String className , String fieldName , Object field ) { if ( field == null || field instanceof Enum || inImmutableList ( field . getClass ( ) ) ) return field ; if ( field instanceof Collection ) return DefaultGroovyMethods . asImmutable ( ( Collection ) field ) ; if ( field . getClass ( ) . getAnnotation ( MY_CLASS ) != null ) return field ; final String typeName = field . getClass ( ) . getName ( ) ; throw new RuntimeException ( createErrorMessage ( className , fieldName , typeName , "<STR_LIT>" ) ) ; } } </s>
|
<s> package org . codehaus . groovy . transform ; import groovy . lang . GroovyClassLoader ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . net . URL ; import java . util . ArrayList ; import java . util . Collection ; import java . util . Enumeration ; import java . util . HashMap ; import java . util . HashSet ; import java . util . Iterator ; import java . util . LinkedHashMap ; import java . util . LinkedList ; import java . util . List ; import java . util . Map ; import java . util . Set ; import org . codehaus . groovy . GroovyException ; import org . codehaus . groovy . ast . ASTNode ; import org . codehaus . groovy . ast . AnnotatedNode ; import org . codehaus . groovy . ast . AnnotationNode ; import org . codehaus . groovy . ast . ClassCodeVisitorSupport ; import org . codehaus . groovy . ast . ClassNode ; import org . codehaus . groovy . classgen . GeneratorContext ; import org . codehaus . groovy . control . CompilationFailedException ; import org . codehaus . groovy . control . CompilationUnit ; import org . codehaus . groovy . control . CompilePhase ; import org . codehaus . groovy . control . Phases ; import org . codehaus . groovy . control . SourceUnit ; import org . codehaus . groovy . control . messages . SimpleMessage ; import org . codehaus . groovy . control . messages . WarningMessage ; public class ASTTransformationVisitor extends ClassCodeVisitorSupport { private CompilePhase phase ; private SourceUnit source ; private List < ASTNode [ ] > targetNodes ; private Map < ASTNode , List < ASTTransformation > > transforms ; private Map < Class < ? extends ASTTransformation > , ASTTransformation > transformInstances ; private static CompilationUnit compUnit ; private static Set < String > globalTransformNames = new HashSet < String > ( ) ; private ASTTransformationVisitor ( CompilePhase phase ) { this . phase = phase ; } protected SourceUnit getSourceUnit ( ) { return source ; } public void visitClass ( ClassNode classNode ) { Map < Class < ? extends ASTTransformation > , Set < ASTNode > > baseTransforms = classNode . getTransforms ( phase ) ; if ( ! baseTransforms . isEmpty ( ) ) { transformInstances = new HashMap < Class < ? extends ASTTransformation > , ASTTransformation > ( ) ; for ( Class < ? extends ASTTransformation > transformClass : baseTransforms . keySet ( ) ) { try { transformInstances . put ( transformClass , transformClass . newInstance ( ) ) ; } catch ( InstantiationException e ) { source . getErrorCollector ( ) . addError ( new SimpleMessage ( "<STR_LIT>" + transformClass , source ) ) ; } catch ( IllegalAccessException e ) { source . getErrorCollector ( ) . addError ( new SimpleMessage ( "<STR_LIT>" + transformClass , source ) ) ; } } transforms = new HashMap < ASTNode , List < ASTTransformation > > ( ) ; for ( Map . Entry < Class < ? extends ASTTransformation > , Set < ASTNode > > entry : baseTransforms . entrySet ( ) ) { for ( ASTNode node : entry . getValue ( ) ) { List < ASTTransformation > list = transforms . get ( node ) ; if ( list == null ) { list = new ArrayList < ASTTransformation > ( ) ; transforms . put ( node , list ) ; } list . add ( transformInstances . get ( entry . getKey ( ) ) ) ; } } targetNodes = new LinkedList < ASTNode [ ] > ( ) ; super . visitClass ( classNode ) ; for ( ASTNode [ ] node : targetNodes ) { for ( ASTTransformation snt : transforms . get ( node [ <NUM_LIT:0> ] ) ) { snt . visit ( node , source ) ; } } } } public void visitAnnotations ( AnnotatedNode node ) { super . visitAnnotations ( node ) ; for ( AnnotationNode annotation : ( Collection < AnnotationNode > ) node . getAnnotations ( ) ) { if ( transforms . containsKey ( annotation ) ) { targetNodes . add ( new ASTNode [ ] { annotation , node } ) ; } } } public static void addPhaseOperations ( final CompilationUnit compilationUnit ) { addGlobalTransforms ( compilationUnit ) ; compilationUnit . addPhaseOperation ( new CompilationUnit . PrimaryClassNodeOperation ( ) { public void call ( SourceUnit source , GeneratorContext context , ClassNode classNode ) throws CompilationFailedException { ASTTransformationCollectorCodeVisitor collector = new ASTTransformationCollectorCodeVisitor ( source , compilationUnit . getTransformLoader ( ) ) ; collector . visitClass ( classNode ) ; } } , Phases . SEMANTIC_ANALYSIS ) ; for ( CompilePhase phase : CompilePhase . values ( ) ) { final ASTTransformationVisitor visitor = new ASTTransformationVisitor ( phase ) ; switch ( phase ) { case INITIALIZATION : case PARSING : case CONVERSION : break ; default : compilationUnit . addPhaseOperation ( new CompilationUnit . PrimaryClassNodeOperation ( ) { public void call ( SourceUnit source , GeneratorContext context , ClassNode classNode ) throws CompilationFailedException { visitor . source = source ; visitor . visitClass ( classNode ) ; } } , phase . getPhaseNumber ( ) ) ; break ; } } } public static void addGlobalTransformsAfterGrab ( ) { doAddGlobalTransforms ( compUnit , false ) ; } public static void addGlobalTransforms ( CompilationUnit compilationUnit ) { compUnit = compilationUnit ; doAddGlobalTransforms ( compilationUnit , true ) ; } private static void doAddGlobalTransforms ( CompilationUnit compilationUnit , boolean isFirstScan ) { GroovyClassLoader transformLoader = compilationUnit . getTransformLoader ( ) ; Map < String , URL > transformNames = new LinkedHashMap < String , URL > ( ) ; try { Enumeration < URL > globalServices = transformLoader . getResources ( "<STR_LIT>" ) ; while ( globalServices . hasMoreElements ( ) ) { URL service = globalServices . nextElement ( ) ; String className ; InputStream is = service . openStream ( ) ; BufferedReader svcIn = new BufferedReader ( new InputStreamReader ( is ) ) ; try { className = svcIn . readLine ( ) ; } catch ( IOException ioe ) { compilationUnit . getErrorCollector ( ) . addError ( new SimpleMessage ( "<STR_LIT>" + service . toExternalForm ( ) + "<STR_LIT>" + ioe . toString ( ) , null ) ) ; continue ; } while ( className != null ) { if ( ! className . startsWith ( "<STR_LIT:#>" ) && className . length ( ) > <NUM_LIT:0> ) { if ( transformNames . containsKey ( className ) ) { if ( ! service . equals ( transformNames . get ( className ) ) ) { compilationUnit . getErrorCollector ( ) . addWarning ( WarningMessage . POSSIBLE_ERRORS , "<STR_LIT>" + className + "<STR_LIT>" + transformNames . get ( className ) . toExternalForm ( ) + "<STR_LIT:U+0020andU+0020>" + service . toExternalForm ( ) + "<STR_LIT>" , null , null ) ; } } else { transformNames . put ( className , service ) ; } } try { className = svcIn . readLine ( ) ; } catch ( IOException ioe ) { compilationUnit . getErrorCollector ( ) . addError ( new SimpleMessage ( "<STR_LIT>" + service . toExternalForm ( ) + "<STR_LIT>" + ioe . toString ( ) , null ) ) ; continue ; } } is . close ( ) ; } } catch ( IOException e ) { compilationUnit . getErrorCollector ( ) . addError ( new SimpleMessage ( "<STR_LIT>" + e . getMessage ( ) , null ) ) ; } try { Class . forName ( "<STR_LIT>" ) ; } catch ( Exception e ) { StringBuffer sb = new StringBuffer ( ) ; sb . append ( "<STR_LIT>" ) ; sb . append ( "<STR_LIT>" ) ; for ( Map . Entry < String , URL > entry : transformNames . entrySet ( ) ) { sb . append ( '<STR_LIT:\t>' ) ; sb . append ( entry . getKey ( ) ) ; sb . append ( '<STR_LIT:\n>' ) ; } compilationUnit . getErrorCollector ( ) . addWarning ( new WarningMessage ( WarningMessage . POSSIBLE_ERRORS , sb . toString ( ) , null , null ) ) ; return ; } if ( isFirstScan ) { for ( Map . Entry < String , URL > entry : transformNames . entrySet ( ) ) { globalTransformNames . add ( entry . getKey ( ) ) ; } addPhaseOperationsForGlobalTransforms ( compilationUnit , transformNames , isFirstScan ) ; } else { Iterator < Map . Entry < String , URL > > it = transformNames . entrySet ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { Map . Entry < String , URL > entry = it . next ( ) ; if ( ! globalTransformNames . add ( entry . getKey ( ) ) ) { it . remove ( ) ; } } addPhaseOperationsForGlobalTransforms ( compilationUnit , transformNames , isFirstScan ) ; } } private static void addPhaseOperationsForGlobalTransforms ( CompilationUnit compilationUnit , Map < String , URL > transformNames , boolean isFirstScan ) { GroovyClassLoader transformLoader = compilationUnit . getTransformLoader ( ) ; for ( Map . Entry < String , URL > entry : transformNames . entrySet ( ) ) { try { Class gTransClass = transformLoader . loadClass ( entry . getKey ( ) , false , true , false ) ; GroovyASTTransformation transformAnnotation = ( GroovyASTTransformation ) gTransClass . getAnnotation ( GroovyASTTransformation . class ) ; if ( transformAnnotation == null ) { compilationUnit . getErrorCollector ( ) . addWarning ( new WarningMessage ( WarningMessage . POSSIBLE_ERRORS , "<STR_LIT>" + entry . getKey ( ) + "<STR_LIT>" + entry . getValue ( ) . toExternalForm ( ) + "<STR_LIT>" + GroovyASTTransformation . class . getName ( ) + "<STR_LIT>" , null , null ) ) ; continue ; } if ( ASTTransformation . class . isAssignableFrom ( gTransClass ) ) { final ASTTransformation instance = ( ASTTransformation ) gTransClass . newInstance ( ) ; CompilationUnit . SourceUnitOperation suOp = new CompilationUnit . SourceUnitOperation ( ) { private boolean isBuggered = false ; public void call ( SourceUnit source ) throws CompilationFailedException { if ( isBuggered ) return ; try { instance . visit ( new ASTNode [ ] { source . getAST ( ) } , source ) ; } catch ( NoClassDefFoundError ncdfe ) { new RuntimeException ( "<STR_LIT>" + instance . toString ( ) + "<STR_LIT>" , ncdfe ) . printStackTrace ( ) ; source . addException ( new GroovyException ( "<STR_LIT>" + instance . toString ( ) + "<STR_LIT>" , ncdfe ) ) ; isBuggered = true ; } } } ; if ( isFirstScan ) { compilationUnit . addPhaseOperation ( suOp , transformAnnotation . phase ( ) . getPhaseNumber ( ) ) ; } else { compilationUnit . addNewPhaseOperation ( suOp , transformAnnotation . phase ( ) . getPhaseNumber ( ) ) ; } } else { compilationUnit . getErrorCollector ( ) . addError ( new SimpleMessage ( "<STR_LIT>" + entry . getKey ( ) + "<STR_LIT>" + entry . getValue ( ) . toExternalForm ( ) + "<STR_LIT>" , null ) ) ; } } catch ( Exception e ) { compilationUnit . getErrorCollector ( ) . addError ( new SimpleMessage ( "<STR_LIT>" + entry . getKey ( ) + "<STR_LIT>" + entry . getValue ( ) . toExternalForm ( ) + "<STR_LIT>" + e . toString ( ) , null ) ) ; } } } } </s>
|
<s> package org . codehaus . groovy . transform ; import groovy . lang . GroovyClassLoader ; import java . lang . annotation . Annotation ; import java . lang . reflect . Method ; import java . util . Collection ; import java . util . List ; import org . codehaus . groovy . ast . AnnotatedNode ; import org . codehaus . groovy . ast . AnnotationNode ; import org . codehaus . groovy . ast . ClassCodeVisitorSupport ; import org . codehaus . groovy . ast . ClassNode ; import org . codehaus . groovy . ast . expr . ConstantExpression ; import org . codehaus . groovy . ast . expr . Expression ; import org . codehaus . groovy . ast . expr . ListExpression ; import org . codehaus . groovy . control . SourceUnit ; import org . codehaus . groovy . control . messages . SimpleMessage ; public class ASTTransformationCollectorCodeVisitor extends ClassCodeVisitorSupport { private SourceUnit source ; private ClassNode classNode ; private GroovyClassLoader transformLoader ; public ASTTransformationCollectorCodeVisitor ( SourceUnit source , GroovyClassLoader transformLoader ) { this . source = source ; this . transformLoader = transformLoader ; } protected SourceUnit getSourceUnit ( ) { return source ; } public void visitClass ( ClassNode klassNode ) { ClassNode oldClass = classNode ; classNode = klassNode ; super . visitClass ( classNode ) ; classNode = oldClass ; } private final static String [ ] NONE = new String [ <NUM_LIT:0> ] ; private final static Class [ ] NO_CLASSES = new Class [ <NUM_LIT:0> ] ; private String [ ] getTransformClassNames ( ClassNode cn ) { if ( ! cn . hasClass ( ) ) { List < AnnotationNode > annotations = cn . getAnnotations ( ) ; AnnotationNode transformAnnotation = null ; for ( AnnotationNode anno : annotations ) { if ( anno . getClassNode ( ) . getName ( ) . equals ( GroovyASTTransformationClass . class . getName ( ) ) ) { transformAnnotation = anno ; break ; } } if ( transformAnnotation != null ) { ListExpression expression = ( ListExpression ) transformAnnotation . getMember ( "<STR_LIT:value>" ) ; List < Expression > expressions = expression . getExpressions ( ) ; String [ ] values = new String [ expressions . size ( ) ] ; int e = <NUM_LIT:0> ; for ( Expression expr : expressions ) { values [ e ++ ] = ( ( ConstantExpression ) expr ) . getText ( ) ; } return values ; } return null ; } else { Annotation transformClassAnnotation = getTransformClassAnnotation ( cn ) ; if ( transformClassAnnotation == null ) { return null ; } return getTransformClassNames ( transformClassAnnotation ) ; } } private Class [ ] getTransformClasses ( ClassNode classNode ) { if ( ! classNode . hasClass ( ) ) { List < AnnotationNode > annotations = classNode . getAnnotations ( ) ; AnnotationNode transformAnnotation = null ; for ( AnnotationNode anno : annotations ) { if ( anno . getClassNode ( ) . getName ( ) . equals ( GroovyASTTransformationClass . class . getName ( ) ) ) { transformAnnotation = anno ; break ; } } if ( transformAnnotation != null ) { Expression expression = ( Expression ) transformAnnotation . getMember ( "<STR_LIT>" ) ; if ( expression != null ) { throw new RuntimeException ( "<STR_LIT>" ) ; } } return null ; } else { Annotation transformClassAnnotation = getTransformClassAnnotation ( classNode ) ; if ( transformClassAnnotation == null ) { return null ; } return getTransformClasses ( transformClassAnnotation ) ; } } public void visitAnnotations ( AnnotatedNode node ) { super . visitAnnotations ( node ) ; for ( AnnotationNode annotation : ( Collection < AnnotationNode > ) node . getAnnotations ( ) ) { String [ ] transformClassNames = getTransformClassNames ( annotation . getClassNode ( ) ) ; Class [ ] transformClasses = getTransformClasses ( annotation . getClassNode ( ) ) ; if ( transformClassNames == null && transformClasses == null ) { continue ; } if ( transformClassNames == null ) { transformClassNames = NONE ; } if ( transformClasses == null ) { transformClasses = NO_CLASSES ; } addTransformsToClassNode ( annotation , transformClassNames , transformClasses ) ; } } private void addTransformsToClassNode ( AnnotationNode annotation , Annotation transformClassAnnotation ) { String [ ] transformClassNames = getTransformClassNames ( annotation . getClassNode ( ) ) ; Class [ ] transformClasses = getTransformClasses ( transformClassAnnotation ) ; addTransformsToClassNode ( annotation , transformClassNames , transformClasses ) ; } private void addTransformsToClassNode ( AnnotationNode annotation , String [ ] transformClassNames , Class [ ] transformClasses ) { if ( transformClassNames . length == <NUM_LIT:0> && transformClasses . length == <NUM_LIT:0> ) { source . getErrorCollector ( ) . addError ( new SimpleMessage ( "<STR_LIT>" + annotation . getClassNode ( ) . getName ( ) + "<STR_LIT>" , source ) ) ; } if ( transformClassNames . length > <NUM_LIT:0> && transformClasses . length > <NUM_LIT:0> ) { source . getErrorCollector ( ) . addError ( new SimpleMessage ( "<STR_LIT>" + annotation . getClassNode ( ) . getName ( ) + "<STR_LIT>" , source ) ) ; } for ( String transformClass : transformClassNames ) { try { Class klass = transformLoader . loadClass ( transformClass , false , true , false ) ; verifyClassAndAddTransform ( annotation , klass ) ; } catch ( ClassNotFoundException e ) { source . getErrorCollector ( ) . addErrorAndContinue ( new SimpleMessage ( "<STR_LIT>" + transformClass + "<STR_LIT>" + annotation . getClassNode ( ) . getName ( ) , source ) ) ; } } for ( Class klass : transformClasses ) { verifyClassAndAddTransform ( annotation , klass ) ; } } private void verifyClassAndAddTransform ( AnnotationNode annotation , Class klass ) { if ( ASTTransformation . class . isAssignableFrom ( klass ) ) { classNode . addTransform ( klass , annotation ) ; } else { source . getErrorCollector ( ) . addError ( new SimpleMessage ( "<STR_LIT>" + klass . getName ( ) + "<STR_LIT>" + annotation . getClassNode ( ) . getName ( ) , source ) ) ; } } private static Annotation getTransformClassAnnotation ( ClassNode annotatedType ) { if ( ! annotatedType . isResolved ( ) ) return null ; for ( Annotation ann : annotatedType . getTypeClass ( ) . getAnnotations ( ) ) { if ( ann . annotationType ( ) . getName ( ) . equals ( GroovyASTTransformationClass . class . getName ( ) ) ) { return ann ; } } return null ; } private String [ ] getTransformClassNames ( Annotation transformClassAnnotation ) { try { Method valueMethod = transformClassAnnotation . getClass ( ) . getMethod ( "<STR_LIT:value>" ) ; return ( String [ ] ) valueMethod . invoke ( transformClassAnnotation ) ; } catch ( Exception e ) { source . addException ( e ) ; return new String [ <NUM_LIT:0> ] ; } } private Class [ ] getTransformClasses ( Annotation transformClassAnnotation ) { try { Method classesMethod = transformClassAnnotation . getClass ( ) . getMethod ( "<STR_LIT>" ) ; return ( Class [ ] ) classesMethod . invoke ( transformClassAnnotation ) ; } catch ( Exception e ) { source . addException ( e ) ; return new Class [ <NUM_LIT:0> ] ; } } } </s>
|
<s> package org . codehaus . groovy . vmplugin . v5 ; import java . lang . reflect . * ; import java . lang . annotation . * ; import java . util . Iterator ; import java . util . List ; import org . codehaus . groovy . GroovyBugError ; import org . codehaus . groovy . vmplugin . VMPlugin ; import org . codehaus . groovy . ast . * ; import org . codehaus . groovy . ast . expr . * ; import org . codehaus . groovy . ast . stmt . ReturnStatement ; public class Java5 implements VMPlugin { private static final Class [ ] PLUGIN_DGM = { PluginDefaultGroovyMethods . class } ; public void setAdditionalClassInformation ( ClassNode cn ) { setGenericsTypes ( cn ) ; } private void setGenericsTypes ( ClassNode cn ) { TypeVariable [ ] tvs = cn . getTypeClass ( ) . getTypeParameters ( ) ; GenericsType [ ] gts = configureTypeVariable ( tvs ) ; cn . setGenericsTypes ( gts ) ; } private GenericsType [ ] configureTypeVariable ( TypeVariable [ ] tvs ) { if ( tvs . length == <NUM_LIT:0> ) return null ; GenericsType [ ] gts = new GenericsType [ tvs . length ] ; for ( int i = <NUM_LIT:0> ; i < tvs . length ; i ++ ) { gts [ i ] = configureTypeVariableDefinition ( tvs [ i ] ) ; } return gts ; } private GenericsType configureTypeVariableDefinition ( TypeVariable tv ) { ClassNode base = configureTypeVariableReference ( tv ) ; ClassNode redirect = base . redirect ( ) ; base . setRedirect ( null ) ; Type [ ] tBounds = tv . getBounds ( ) ; GenericsType gt ; if ( tBounds . length == <NUM_LIT:0> ) { gt = new GenericsType ( base ) ; } else { ClassNode [ ] cBounds = configureTypes ( tBounds ) ; gt = new GenericsType ( base , cBounds , null ) ; gt . setName ( base . getName ( ) ) ; gt . setPlaceholder ( true ) ; } base . setRedirect ( redirect ) ; return gt ; } private ClassNode [ ] configureTypes ( Type [ ] types ) { if ( types . length == <NUM_LIT:0> ) return null ; ClassNode [ ] nodes = new ClassNode [ types . length ] ; for ( int i = <NUM_LIT:0> ; i < types . length ; i ++ ) { nodes [ i ] = configureType ( types [ i ] ) ; } return nodes ; } private ClassNode configureType ( Type type ) { if ( type instanceof WildcardType ) { return configureWildcardType ( ( WildcardType ) type ) ; } else if ( type instanceof ParameterizedType ) { return configureParameterizedType ( ( ParameterizedType ) type ) ; } else if ( type instanceof GenericArrayType ) { return configureGenericArray ( ( GenericArrayType ) type ) ; } else if ( type instanceof TypeVariable ) { return configureTypeVariableReference ( ( TypeVariable ) type ) ; } else if ( type instanceof Class ) { return configureClass ( ( Class ) type ) ; } else { throw new GroovyBugError ( "<STR_LIT>" + type + "<STR_LIT>" + type . getClass ( ) ) ; } } private ClassNode configureClass ( Class c ) { if ( c . isPrimitive ( ) ) { return ClassHelper . make ( c ) ; } else { return ClassHelper . makeWithoutCaching ( c , false ) ; } } private ClassNode configureGenericArray ( GenericArrayType genericArrayType ) { Type component = genericArrayType . getGenericComponentType ( ) ; ClassNode node = configureType ( component ) ; return node . makeArray ( ) ; } private ClassNode configureWildcardType ( WildcardType wildcardType ) { ClassNode base = ClassHelper . makeWithoutCaching ( "<STR_LIT:?>" ) ; ClassNode [ ] lowers = configureTypes ( wildcardType . getLowerBounds ( ) ) ; ClassNode lower = null ; if ( lower != null ) lower = lowers [ <NUM_LIT:0> ] ; ClassNode [ ] upper = configureTypes ( wildcardType . getUpperBounds ( ) ) ; GenericsType t = new GenericsType ( base , upper , lower ) ; t . setWildcard ( true ) ; ClassNode ref = ClassHelper . makeWithoutCaching ( Object . class , false ) ; ref . setGenericsTypes ( new GenericsType [ ] { t } ) ; return ref ; } private ClassNode configureParameterizedType ( ParameterizedType parameterizedType ) { ClassNode base = configureType ( parameterizedType . getRawType ( ) ) ; GenericsType [ ] gts = configureTypeArguments ( parameterizedType . getActualTypeArguments ( ) ) ; base . setGenericsTypes ( gts ) ; return base ; } private ClassNode configureTypeVariableReference ( TypeVariable tv ) { ClassNode cn = ClassHelper . makeWithoutCaching ( tv . getName ( ) ) ; cn . setGenericsPlaceHolder ( true ) ; ClassNode cn2 = ClassHelper . makeWithoutCaching ( tv . getName ( ) ) ; GenericsType [ ] gts = new GenericsType [ ] { new GenericsType ( cn2 ) } ; cn . setGenericsTypes ( gts ) ; cn . setRedirect ( ClassHelper . OBJECT_TYPE ) ; return cn ; } private GenericsType [ ] configureTypeArguments ( Type [ ] ta ) { if ( ta . length == <NUM_LIT:0> ) return null ; GenericsType [ ] gts = new GenericsType [ ta . length ] ; for ( int i = <NUM_LIT:0> ; i < ta . length ; i ++ ) { gts [ i ] = new GenericsType ( configureType ( ta [ i ] ) ) ; } return gts ; } public Class [ ] getPluginDefaultGroovyMethods ( ) { return PLUGIN_DGM ; } private void setAnnotationMetaData ( ClassNode cn ) { Annotation [ ] annotations = cn . getTypeClass ( ) . getAnnotations ( ) ; for ( Annotation annotation : annotations ) { AnnotationNode node = new AnnotationNode ( ClassHelper . make ( annotation . annotationType ( ) ) ) ; configureAnnotation ( node , annotation ) ; cn . addAnnotation ( node ) ; } } private void setAnnotationMetaData ( MethodNode mn , Method m ) { Annotation [ ] annotations = m . getAnnotations ( ) ; for ( Annotation annotation : annotations ) { AnnotationNode node = new AnnotationNode ( ClassHelper . make ( annotation . annotationType ( ) ) ) ; configureAnnotation ( node , annotation ) ; mn . addAnnotation ( node ) ; } } private void configureAnnotationFromDefinition ( AnnotationNode definition , AnnotationNode root ) { ClassNode type = definition . getClassNode ( ) ; if ( ! type . isResolved ( ) ) return ; if ( type . hasClass ( ) ) { Class clazz = type . getTypeClass ( ) ; if ( clazz == Retention . class ) { Expression exp = definition . getMember ( "<STR_LIT:value>" ) ; if ( ! ( exp instanceof PropertyExpression ) ) return ; PropertyExpression pe = ( PropertyExpression ) exp ; String name = pe . getPropertyAsString ( ) ; RetentionPolicy policy = RetentionPolicy . valueOf ( name ) ; setRetentionPolicy ( policy , root ) ; } else if ( clazz == Target . class ) { Expression exp = definition . getMember ( "<STR_LIT:value>" ) ; if ( ! ( exp instanceof ListExpression ) ) return ; ListExpression le = ( ListExpression ) exp ; int bitmap = <NUM_LIT:0> ; for ( Iterator it = le . getExpressions ( ) . iterator ( ) ; it . hasNext ( ) ; ) { PropertyExpression element = ( PropertyExpression ) it . next ( ) ; String name = element . getPropertyAsString ( ) ; ElementType value = ElementType . valueOf ( name ) ; bitmap |= getElementCode ( value ) ; } root . setAllowedTargets ( bitmap ) ; } } else { String typename = type . getName ( ) ; if ( typename . equals ( "<STR_LIT>" ) ) { Expression exp = definition . getMember ( "<STR_LIT:value>" ) ; if ( ! ( exp instanceof PropertyExpression ) ) return ; PropertyExpression pe = ( PropertyExpression ) exp ; String name = pe . getPropertyAsString ( ) ; RetentionPolicy policy = RetentionPolicy . valueOf ( name ) ; setRetentionPolicy ( policy , root ) ; } else if ( typename . equals ( "<STR_LIT>" ) ) { Expression exp = definition . getMember ( "<STR_LIT:value>" ) ; if ( ! ( exp instanceof ListExpression ) ) return ; ListExpression le = ( ListExpression ) exp ; int bitmap = <NUM_LIT:0> ; List listE = le . getExpressions ( ) ; for ( Iterator iterator = listE . iterator ( ) ; iterator . hasNext ( ) ; ) { Expression expression = ( Expression ) iterator . next ( ) ; PropertyExpression element = ( PropertyExpression ) expression ; String name = element . getPropertyAsString ( ) ; ElementType value = ElementType . valueOf ( name ) ; bitmap |= getElementCode ( value ) ; } root . setAllowedTargets ( bitmap ) ; } } } public void configureAnnotation ( AnnotationNode node ) { ClassNode type = node . getClassNode ( ) ; List < AnnotationNode > annotations = type . getAnnotations ( ) ; for ( AnnotationNode an : annotations ) { configureAnnotationFromDefinition ( an , node ) ; } configureAnnotationFromDefinition ( node , node ) ; } private void configureAnnotation ( AnnotationNode node , Annotation annotation ) { Class type = annotation . annotationType ( ) ; if ( type == Retention . class ) { Retention r = ( Retention ) annotation ; RetentionPolicy value = r . value ( ) ; setRetentionPolicy ( value , node ) ; node . setMember ( "<STR_LIT:value>" , new PropertyExpression ( new ClassExpression ( ClassHelper . makeWithoutCaching ( RetentionPolicy . class , false ) ) , value . toString ( ) ) ) ; } else if ( type == Target . class ) { Target t = ( Target ) annotation ; ElementType [ ] elements = t . value ( ) ; ListExpression elementExprs = new ListExpression ( ) ; for ( ElementType element : elements ) { elementExprs . addExpression ( new PropertyExpression ( new ClassExpression ( ClassHelper . ELEMENT_TYPE_TYPE ) , element . name ( ) ) ) ; } node . setMember ( "<STR_LIT:value>" , elementExprs ) ; } } private void setRetentionPolicy ( RetentionPolicy value , AnnotationNode node ) { switch ( value ) { case RUNTIME : node . setRuntimeRetention ( true ) ; break ; case SOURCE : node . setSourceRetention ( true ) ; break ; case CLASS : node . setClassRetention ( true ) ; break ; default : throw new GroovyBugError ( "<STR_LIT>" + value ) ; } } private int getElementCode ( ElementType value ) { switch ( value ) { case TYPE : return AnnotationNode . TYPE_TARGET ; case CONSTRUCTOR : return AnnotationNode . CONSTRUCTOR_TARGET ; case METHOD : return AnnotationNode . METHOD_TARGET ; case FIELD : return AnnotationNode . FIELD_TARGET ; case PARAMETER : return AnnotationNode . PARAMETER_TARGET ; case LOCAL_VARIABLE : return AnnotationNode . LOCAL_VARIABLE_TARGET ; case ANNOTATION_TYPE : return AnnotationNode . ANNOTATION_TARGET ; case PACKAGE : return AnnotationNode . PACKAGE_TARGET ; default : throw new GroovyBugError ( "<STR_LIT>" + value ) ; } } private void setMethodDefaultValue ( MethodNode mn , Method m ) { Object defaultValue = m . getDefaultValue ( ) ; mn . setCode ( new ReturnStatement ( new ConstantExpression ( defaultValue ) ) ) ; mn . setAnnotationDefault ( true ) ; } public void configureClassNode ( CompileUnit compileUnit , ClassNode classNode ) { Class clazz = classNode . getTypeClass ( ) ; Field [ ] fields = clazz . getDeclaredFields ( ) ; for ( Field f : fields ) { ClassNode ret = makeClassNode ( compileUnit , f . getGenericType ( ) , f . getType ( ) ) ; classNode . addField ( f . getName ( ) , f . getModifiers ( ) , ret , null ) ; } Method [ ] methods = clazz . getDeclaredMethods ( ) ; for ( Method m : methods ) { ClassNode ret = makeClassNode ( compileUnit , m . getGenericReturnType ( ) , m . getReturnType ( ) ) ; Parameter [ ] params = makeParameters ( compileUnit , m . getGenericParameterTypes ( ) , m . getParameterTypes ( ) ) ; ClassNode [ ] exceptions = makeClassNodes ( compileUnit , m . getGenericExceptionTypes ( ) , m . getExceptionTypes ( ) ) ; MethodNode mn = new MethodNode ( m . getName ( ) , m . getModifiers ( ) , ret , params , exceptions , null ) ; setMethodDefaultValue ( mn , m ) ; setAnnotationMetaData ( mn , m ) ; classNode . addMethod ( mn ) ; } Constructor [ ] constructors = clazz . getDeclaredConstructors ( ) ; for ( Constructor ctor : constructors ) { Parameter [ ] params = makeParameters ( compileUnit , ctor . getGenericParameterTypes ( ) , ctor . getParameterTypes ( ) ) ; ClassNode [ ] exceptions = makeClassNodes ( compileUnit , ctor . getGenericExceptionTypes ( ) , ctor . getExceptionTypes ( ) ) ; classNode . addConstructor ( ctor . getModifiers ( ) , params , exceptions , null ) ; } Class sc = clazz . getSuperclass ( ) ; if ( sc != null ) classNode . setUnresolvedSuperClass ( makeClassNode ( compileUnit , clazz . getGenericSuperclass ( ) , sc ) ) ; makeInterfaceTypes ( compileUnit , classNode , clazz ) ; setAnnotationMetaData ( classNode ) ; } private void makeInterfaceTypes ( CompileUnit cu , ClassNode classNode , Class clazz ) { Type [ ] interfaceTypes = clazz . getGenericInterfaces ( ) ; if ( interfaceTypes . length == <NUM_LIT:0> ) { classNode . setInterfaces ( ClassNode . EMPTY_ARRAY ) ; } else { Class [ ] interfaceClasses = clazz . getInterfaces ( ) ; ClassNode [ ] ret = new ClassNode [ interfaceTypes . length ] ; for ( int i = <NUM_LIT:0> ; i < interfaceTypes . length ; i ++ ) { ret [ i ] = makeClassNode ( cu , interfaceTypes [ i ] , interfaceClasses [ i ] ) ; } classNode . setInterfaces ( ret ) ; } } private ClassNode [ ] makeClassNodes ( CompileUnit cu , Type [ ] types , Class [ ] cls ) { ClassNode [ ] nodes = new ClassNode [ types . length ] ; for ( int i = <NUM_LIT:0> ; i < nodes . length ; i ++ ) { nodes [ i ] = makeClassNode ( cu , types [ i ] , cls [ i ] ) ; } return nodes ; } private ClassNode makeClassNode ( CompileUnit cu , Type t , Class c ) { ClassNode back = null ; if ( cu != null ) back = cu . getClass ( c . getName ( ) ) ; if ( back == null ) back = ClassHelper . make ( c ) ; if ( ! ( t instanceof Class ) ) { ClassNode front = configureType ( t ) ; front . setRedirect ( back ) ; return front ; } return back ; } private Parameter [ ] makeParameters ( CompileUnit cu , Type [ ] types , Class [ ] cls ) { Parameter [ ] params = Parameter . EMPTY_ARRAY ; if ( types . length > <NUM_LIT:0> ) { params = new Parameter [ types . length ] ; for ( int i = <NUM_LIT:0> ; i < params . length ; i ++ ) { params [ i ] = makeParameter ( cu , types [ i ] , cls [ i ] , i ) ; } } return params ; } private Parameter makeParameter ( CompileUnit cu , Type type , Class cl , int idx ) { ClassNode cn = makeClassNode ( cu , type , cl ) ; return new Parameter ( cn , "<STR_LIT>" + idx ) ; } } </s>
|
<s> package org . codehaus . groovy . activator ; import java . net . URL ; import org . eclipse . core . runtime . FileLocator ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . core . runtime . Platform ; import org . eclipse . core . runtime . Plugin ; import org . eclipse . core . runtime . Status ; import org . osgi . framework . BundleContext ; public class GroovyActivator extends Plugin { public static final String PLUGIN_ID = "<STR_LIT>" ; public static final String GROOVY_ALL_JAR = "<STR_LIT>" ; public static final String GROOVY_JAR = "<STR_LIT>" ; public static final String ASM_JAR = "<STR_LIT>" ; public static final int GROOVY_LEVEL = <NUM_LIT:16> ; public static URL GROOVY_JAR_URL ; public static URL GROOVY_ALL_JAR_URL ; public static URL ASM_JAR_URL ; private static GroovyActivator DEFAULT ; public GroovyActivator ( ) { DEFAULT = this ; } public static GroovyActivator getDefault ( ) { return DEFAULT ; } @ Override public void start ( BundleContext context ) throws Exception { super . start ( context ) ; try { GROOVY_JAR_URL = FileLocator . resolve ( Platform . getBundle ( PLUGIN_ID ) . getEntry ( GroovyActivator . GROOVY_JAR ) ) ; GROOVY_ALL_JAR_URL = FileLocator . resolve ( Platform . getBundle ( PLUGIN_ID ) . getEntry ( GroovyActivator . GROOVY_ALL_JAR ) ) ; ASM_JAR_URL = FileLocator . resolve ( Platform . getBundle ( PLUGIN_ID ) . getEntry ( GroovyActivator . ASM_JAR ) ) ; } catch ( Exception e ) { getLog ( ) . log ( new Status ( IStatus . ERROR , PLUGIN_ID , "<STR_LIT>" , e ) ) ; } } @ Override public void stop ( BundleContext context ) throws Exception { super . stop ( context ) ; } } </s>
|
<s> package org . codehaus . groovy . tools ; import org . codehaus . groovy . ast . ClassNode ; import org . codehaus . groovy . control . SourceUnit ; public class GroovyClass { public static final GroovyClass [ ] EMPTY_ARRAY = new GroovyClass [ <NUM_LIT:0> ] ; private String name ; private byte [ ] bytes ; private ClassNode classNode ; private SourceUnit source ; public GroovyClass ( String name , byte [ ] bytes , ClassNode classNode , SourceUnit source ) { this . name = name ; this . bytes = bytes ; this . classNode = classNode ; this . source = source ; } public String getName ( ) { return this . name ; } public byte [ ] getBytes ( ) { return this . bytes ; } public SourceUnit getSourceUnit ( ) { return source ; } public ClassNode getClassNode ( ) { return classNode ; } } </s>
|
<s> package org . codehaus . groovy . control ; import groovy . lang . GroovyClassLoader ; public abstract class ProcessingUnit { protected int phase ; protected boolean phaseComplete ; protected int erroredAtPhase = - <NUM_LIT:1> ; protected CompilerConfiguration configuration ; protected GroovyClassLoader classLoader ; protected ErrorCollector errorCollector ; public ProcessingUnit ( CompilerConfiguration configuration , GroovyClassLoader classLoader , ErrorCollector er ) { this . phase = Phases . INITIALIZATION ; this . configuration = configuration ; this . setClassLoader ( classLoader ) ; configure ( ( configuration == null ? new CompilerConfiguration ( ) : configuration ) ) ; if ( er == null ) er = new ErrorCollector ( getConfiguration ( ) ) ; this . errorCollector = er ; } public void configure ( CompilerConfiguration configuration ) { this . configuration = configuration ; } public CompilerConfiguration getConfiguration ( ) { return configuration ; } public void setConfiguration ( CompilerConfiguration configuration ) { this . configuration = configuration ; } public GroovyClassLoader getClassLoader ( ) { return classLoader ; } public void setClassLoader ( GroovyClassLoader loader ) { ClassLoader parent = Thread . currentThread ( ) . getContextClassLoader ( ) ; if ( parent == null ) parent = ProcessingUnit . class . getClassLoader ( ) ; this . classLoader = ( loader == null ? new GroovyClassLoader ( parent , configuration ) : loader ) ; } public int getPhase ( ) { return this . phase ; } public String getPhaseDescription ( ) { return Phases . getDescription ( this . phase ) ; } public ErrorCollector getErrorCollector ( ) { return errorCollector ; } public void completePhase ( ) throws CompilationFailedException { if ( errorCollector . hasErrors ( ) ) { erroredAtPhase = phase ; } phaseComplete = true ; } public void nextPhase ( ) throws CompilationFailedException { gotoPhase ( this . phase + <NUM_LIT:1> ) ; } public void gotoPhase ( int phase ) throws CompilationFailedException { if ( ! this . phaseComplete ) { completePhase ( ) ; } this . phase = phase ; this . phaseComplete = false ; } } </s>
|
<s> package org . codehaus . groovy . control ; import groovy . lang . GroovyClassLoader ; import groovy . lang . GroovyRuntimeException ; import java . io . File ; import java . io . FileOutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . net . URL ; import java . security . CodeSource ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . Iterator ; import java . util . LinkedList ; import java . util . List ; import java . util . Map ; import org . codehaus . groovy . GroovyBugError ; import org . codehaus . groovy . ast . ASTNode ; import org . codehaus . groovy . ast . ClassNode ; import org . codehaus . groovy . ast . CompileUnit ; import org . codehaus . groovy . ast . ModuleNode ; import org . codehaus . groovy . classgen . AsmClassGenerator ; import org . codehaus . groovy . classgen . ClassCompletionVerifier ; import org . codehaus . groovy . classgen . ClassGenerator ; import org . codehaus . groovy . classgen . EnumVisitor ; import org . codehaus . groovy . classgen . ExtendedVerifier ; import org . codehaus . groovy . classgen . GeneratorContext ; import org . codehaus . groovy . classgen . VariableScopeVisitor ; import org . codehaus . groovy . classgen . Verifier ; import org . codehaus . groovy . control . io . InputStreamReaderSource ; import org . codehaus . groovy . control . io . ReaderSource ; import org . codehaus . groovy . control . messages . ExceptionMessage ; import org . codehaus . groovy . control . messages . Message ; import org . codehaus . groovy . control . messages . SimpleMessage ; import org . codehaus . groovy . syntax . SyntaxException ; import org . codehaus . groovy . tools . GroovyClass ; import org . codehaus . groovy . transform . ASTTransformationVisitor ; import org . objectweb . asm . ClassVisitor ; import org . objectweb . asm . ClassWriter ; public class CompilationUnit extends ProcessingUnit { private GroovyClassLoader transformLoader ; protected Map sources ; protected Map summariesBySourceName ; protected Map summariesByPublicClassName ; protected Map classSourcesByPublicClassName ; protected List names ; protected LinkedList queuedSources ; protected CompileUnit ast ; protected List < GroovyClass > generatedClasses ; protected Verifier verifier ; protected boolean debug ; protected boolean configured ; protected ClassgenCallback classgenCallback ; protected ProgressCallback progressCallback ; protected ResolveVisitor resolveVisitor ; protected StaticImportVisitor staticImportVisitor ; protected OptimizerVisitor optimizer ; LinkedList [ ] phaseOperations ; LinkedList [ ] newPhaseOperations ; public interface ProgressListener { void parseComplete ( int phase , String sourceUnitName ) ; void generateComplete ( int phase , ClassNode classNode ) ; } private ProgressListener getProgressListener ( ) { return this . listener ; } public void setProgressListener ( ProgressListener listener ) { this . listener = listener ; } private ProgressListener listener ; public CompilationUnit ( ) { this ( null , null , null ) ; } public CompilationUnit ( GroovyClassLoader loader ) { this ( null , null , loader ) ; } public CompilationUnit ( CompilerConfiguration configuration ) { this ( configuration , null , null ) ; } public CompilationUnit ( CompilerConfiguration configuration , CodeSource security , GroovyClassLoader loader ) { this ( configuration , security , loader , null ) ; } public CompilationUnit ( CompilerConfiguration configuration , CodeSource security , GroovyClassLoader loader , GroovyClassLoader transformLoader ) { super ( configuration , loader , null ) ; this . transformLoader = transformLoader ; this . names = new ArrayList ( ) ; this . queuedSources = new LinkedList ( ) ; this . sources = new HashMap ( ) ; this . summariesBySourceName = new HashMap ( ) ; this . summariesByPublicClassName = new HashMap ( ) ; this . classSourcesByPublicClassName = new HashMap ( ) ; this . ast = new CompileUnit ( this . classLoader , security , this . configuration ) ; this . generatedClasses = new ArrayList ( ) ; this . verifier = new Verifier ( ) ; this . resolveVisitor = new ResolveVisitor ( this ) ; this . staticImportVisitor = new StaticImportVisitor ( this ) ; this . optimizer = new OptimizerVisitor ( this ) ; phaseOperations = new LinkedList [ Phases . ALL + <NUM_LIT:1> ] ; newPhaseOperations = new LinkedList [ Phases . ALL + <NUM_LIT:1> ] ; for ( int i = <NUM_LIT:0> ; i < phaseOperations . length ; i ++ ) { phaseOperations [ i ] = new LinkedList ( ) ; newPhaseOperations [ i ] = new LinkedList ( ) ; } addPhaseOperation ( new SourceUnitOperation ( ) { public void call ( SourceUnit source ) throws CompilationFailedException { source . parse ( ) ; } } , Phases . PARSING ) ; addPhaseOperation ( convert , Phases . CONVERSION ) ; addPhaseOperation ( new PrimaryClassNodeOperation ( ) { public void call ( SourceUnit source , GeneratorContext context , ClassNode classNode ) throws CompilationFailedException { EnumVisitor ev = new EnumVisitor ( CompilationUnit . this , source ) ; ev . visitClass ( classNode ) ; } } , Phases . CONVERSION ) ; addPhaseOperation ( resolve , Phases . SEMANTIC_ANALYSIS ) ; addPhaseOperation ( staticImport , Phases . SEMANTIC_ANALYSIS ) ; addPhaseOperation ( compileCompleteCheck , Phases . CANONICALIZATION ) ; addPhaseOperation ( classgen , Phases . CLASS_GENERATION ) ; if ( transformLoader != null ) { ASTTransformationVisitor . addPhaseOperations ( this ) ; } this . classgenCallback = null ; } public void ensureASTTransformVisitorAdded ( ) { ASTTransformationVisitor . addPhaseOperations ( this ) ; } public GroovyClassLoader getTransformLoader ( ) { return transformLoader == null ? getClassLoader ( ) : transformLoader ; } public void addPhaseOperation ( SourceUnitOperation op , int phase ) { if ( phase < <NUM_LIT:0> || phase > Phases . ALL ) throw new IllegalArgumentException ( "<STR_LIT>" + phase + "<STR_LIT>" ) ; phaseOperations [ phase ] . add ( op ) ; } public void addPhaseOperation ( PrimaryClassNodeOperation op , int phase ) { if ( phase < <NUM_LIT:0> || phase > Phases . ALL ) throw new IllegalArgumentException ( "<STR_LIT>" + phase + "<STR_LIT>" ) ; phaseOperations [ phase ] . add ( op ) ; } public void addPhaseOperation ( GroovyClassOperation op ) { phaseOperations [ Phases . OUTPUT ] . addFirst ( op ) ; } public void addNewPhaseOperation ( SourceUnitOperation op , int phase ) { if ( phase < <NUM_LIT:0> || phase > Phases . ALL ) throw new IllegalArgumentException ( "<STR_LIT>" + phase + "<STR_LIT>" ) ; newPhaseOperations [ phase ] . add ( op ) ; } public boolean removeOutputPhaseOperation ( ) { return phaseOperations [ Phases . OUTPUT ] . remove ( output ) ; } public void configure ( CompilerConfiguration configuration ) { super . configure ( configuration ) ; this . debug = configuration . getDebug ( ) ; if ( ! this . configured && this . classLoader instanceof GroovyClassLoader ) { appendCompilerConfigurationClasspathToClassLoader ( configuration , ( GroovyClassLoader ) this . classLoader ) ; } this . configured = true ; } private void appendCompilerConfigurationClasspathToClassLoader ( CompilerConfiguration configuration , GroovyClassLoader classLoader ) { } public CompileUnit getAST ( ) { return this . ast ; } public Map getSummariesBySourceName ( ) { return summariesBySourceName ; } public Map getSummariesByPublicClassName ( ) { return summariesByPublicClassName ; } public Map getClassSourcesByPublicClassName ( ) { return classSourcesByPublicClassName ; } public boolean isPublicClass ( String className ) { return summariesByPublicClassName . containsKey ( className ) ; } public List getClasses ( ) { return generatedClasses ; } public ClassNode getFirstClassNode ( ) { return ( ClassNode ) ( ( ModuleNode ) this . ast . getModules ( ) . get ( <NUM_LIT:0> ) ) . getClasses ( ) . get ( <NUM_LIT:0> ) ; } public ClassNode getClassNode ( final String name ) { final ClassNode [ ] result = new ClassNode [ ] { null } ; PrimaryClassNodeOperation handler = new PrimaryClassNodeOperation ( ) { public void call ( SourceUnit source , GeneratorContext context , ClassNode classNode ) { if ( classNode . getName ( ) . equals ( name ) ) { result [ <NUM_LIT:0> ] = classNode ; } } } ; try { applyToPrimaryClassNodes ( handler ) ; } catch ( CompilationFailedException e ) { if ( debug ) e . printStackTrace ( ) ; } return result [ <NUM_LIT:0> ] ; } public void addSources ( String [ ] paths ) { for ( int i = <NUM_LIT:0> ; i < paths . length ; i ++ ) { File file = new File ( paths [ i ] ) ; addSource ( file ) ; } } public void addSources ( File [ ] files ) { for ( int i = <NUM_LIT:0> ; i < files . length ; i ++ ) { addSource ( files [ i ] ) ; } } public SourceUnit addSource ( File file ) { return addSource ( new SourceUnit ( file , configuration , classLoader , getErrorCollector ( ) ) ) ; } public SourceUnit addSource ( URL url ) { return addSource ( new SourceUnit ( url , configuration , classLoader , getErrorCollector ( ) ) ) ; } public SourceUnit addSource ( String name , InputStream stream ) { ReaderSource source = new InputStreamReaderSource ( stream , configuration ) ; return addSource ( new SourceUnit ( name , source , configuration , classLoader , getErrorCollector ( ) ) ) ; } public SourceUnit addSource ( SourceUnit source ) { String name = source . getName ( ) ; source . setClassLoader ( this . classLoader ) ; for ( Iterator iter = queuedSources . iterator ( ) ; iter . hasNext ( ) ; ) { SourceUnit su = ( SourceUnit ) iter . next ( ) ; if ( name . equals ( su . getName ( ) ) ) return su ; } queuedSources . add ( source ) ; return source ; } public Iterator iterator ( ) { return new Iterator ( ) { Iterator nameIterator = names . iterator ( ) ; public boolean hasNext ( ) { return nameIterator . hasNext ( ) ; } public Object next ( ) { String name = ( String ) nameIterator . next ( ) ; return sources . get ( name ) ; } public void remove ( ) { throw new UnsupportedOperationException ( ) ; } } ; } public void addClassNode ( ClassNode node ) { ModuleNode module = new ModuleNode ( this . ast ) ; this . ast . addModule ( module ) ; module . addClass ( node ) ; } public abstract static class ClassgenCallback { public abstract void call ( ClassVisitor writer , ClassNode node ) throws CompilationFailedException ; } public void setClassgenCallback ( ClassgenCallback visitor ) { this . classgenCallback = visitor ; } public abstract static class ProgressCallback { public abstract void call ( ProcessingUnit context , int phase ) throws CompilationFailedException ; } public void setProgressCallback ( ProgressCallback callback ) { this . progressCallback = callback ; } public void compile ( ) throws CompilationFailedException { compile ( Phases . ALL ) ; } public void compile ( int throughPhase ) throws CompilationFailedException { gotoPhase ( Phases . INITIALIZATION ) ; throughPhase = Math . min ( throughPhase , Phases . ALL ) ; while ( throughPhase >= phase && phase <= Phases . ALL ) { processPhaseOperations ( phase ) ; processNewPhaseOperations ( phase ) ; if ( progressCallback != null ) progressCallback . call ( this , phase ) ; completePhase ( ) ; applyToSourceUnits ( mark ) ; if ( dequeued ( ) ) continue ; gotoPhase ( phase + <NUM_LIT:1> ) ; if ( phase == Phases . CLASS_GENERATION ) { sortClasses ( ) ; } } errorCollector . failIfErrors ( ) ; } private void processPhaseOperations ( int ph ) { LinkedList ops = phaseOperations [ ph ] ; for ( Iterator it = ops . iterator ( ) ; it . hasNext ( ) ; ) { doPhaseOperation ( it . next ( ) ) ; } } private void processNewPhaseOperations ( int currPhase ) { recordPhaseOpsInAllOtherPhases ( currPhase ) ; LinkedList currentPhaseNewOps = newPhaseOperations [ currPhase ] ; while ( ! currentPhaseNewOps . isEmpty ( ) ) { Object operation = currentPhaseNewOps . removeFirst ( ) ; phaseOperations [ currPhase ] . add ( operation ) ; doPhaseOperation ( operation ) ; recordPhaseOpsInAllOtherPhases ( currPhase ) ; currentPhaseNewOps = newPhaseOperations [ currPhase ] ; } } public void continueThrough ( int throughPhase ) throws CompilationFailedException { throughPhase = Math . min ( throughPhase , Phases . ALL ) ; while ( throughPhase >= phase && phase <= Phases . ALL ) { for ( Iterator it = phaseOperations [ phase ] . iterator ( ) ; it . hasNext ( ) ; ) { Object operation = it . next ( ) ; if ( operation instanceof PrimaryClassNodeOperation ) { applyToPrimaryClassNodes ( ( PrimaryClassNodeOperation ) operation ) ; } else if ( operation instanceof SourceUnitOperation ) { applyToSourceUnits ( ( SourceUnitOperation ) operation ) ; } else { applyToGeneratedGroovyClasses ( ( GroovyClassOperation ) operation ) ; } } if ( progressCallback != null ) progressCallback . call ( this , phase ) ; completePhase ( ) ; applyToSourceUnits ( mark ) ; if ( dequeued ( ) ) continue ; gotoPhase ( phase + <NUM_LIT:1> ) ; if ( phase == Phases . CLASS_GENERATION ) { sortClasses ( ) ; } } errorCollector . failIfErrors ( ) ; } private void doPhaseOperation ( Object operation ) { if ( operation instanceof PrimaryClassNodeOperation ) { applyToPrimaryClassNodes ( ( PrimaryClassNodeOperation ) operation ) ; } else if ( operation instanceof SourceUnitOperation ) { applyToSourceUnits ( ( SourceUnitOperation ) operation ) ; } else { applyToGeneratedGroovyClasses ( ( GroovyClassOperation ) operation ) ; } } private void recordPhaseOpsInAllOtherPhases ( int currPhase ) { for ( int ph = Phases . INITIALIZATION ; ph <= Phases . ALL ; ph ++ ) { if ( ph != currPhase && ! newPhaseOperations [ ph ] . isEmpty ( ) ) { phaseOperations [ ph ] . addAll ( newPhaseOperations [ ph ] ) ; newPhaseOperations [ ph ] . clear ( ) ; } } } private void sortClasses ( ) throws CompilationFailedException { Iterator modules = this . ast . getModules ( ) . iterator ( ) ; while ( modules . hasNext ( ) ) { ModuleNode module = ( ModuleNode ) modules . next ( ) ; module . sortClasses ( ) ; } } protected boolean dequeued ( ) throws CompilationFailedException { boolean dequeue = ! queuedSources . isEmpty ( ) ; while ( ! queuedSources . isEmpty ( ) ) { SourceUnit su = ( SourceUnit ) queuedSources . removeFirst ( ) ; String name = su . getName ( ) ; names . add ( name ) ; sources . put ( name , su ) ; } if ( dequeue ) { gotoPhase ( Phases . INITIALIZATION ) ; } return dequeue ; } private final SourceUnitOperation resolve = new SourceUnitOperation ( ) { public void call ( SourceUnit source ) throws CompilationFailedException { List classes = source . ast . getClasses ( ) ; for ( Iterator it = classes . iterator ( ) ; it . hasNext ( ) ; ) { ClassNode node = ( ClassNode ) it . next ( ) ; VariableScopeVisitor scopeVisitor = new VariableScopeVisitor ( source ) ; scopeVisitor . visitClass ( node ) ; resolveVisitor . startResolving ( node , source ) ; } } } ; private final SourceUnitOperation checkGenerics = new SourceUnitOperation ( ) { public void call ( SourceUnit source ) throws CompilationFailedException { List classes = source . ast . getClasses ( ) ; for ( Iterator it = classes . iterator ( ) ; it . hasNext ( ) ; ) { ClassNode node = ( ClassNode ) it . next ( ) ; GenericsVisitor genericsVisitor = new GenericsVisitor ( source ) ; genericsVisitor . visitClass ( node ) ; } } } ; private PrimaryClassNodeOperation staticImport = new PrimaryClassNodeOperation ( ) { public void call ( SourceUnit source , GeneratorContext context , ClassNode classNode ) throws CompilationFailedException { staticImportVisitor . visitClass ( classNode , source ) ; optimizer . visitClass ( classNode , source ) ; } } ; private SourceUnitOperation convert = new SourceUnitOperation ( ) { public void call ( SourceUnit source ) throws CompilationFailedException { source . convert ( ) ; CompilationUnit . this . ast . addModule ( source . getAST ( ) ) ; if ( CompilationUnit . this . progressCallback != null ) { CompilationUnit . this . progressCallback . call ( source , CompilationUnit . this . phase ) ; } } } ; private GroovyClassOperation output = new GroovyClassOperation ( ) { public void call ( GroovyClass gclass ) throws CompilationFailedException { boolean failures = false ; String name = gclass . getName ( ) . replace ( '<CHAR_LIT:.>' , File . separatorChar ) + "<STR_LIT:.class>" ; File path = new File ( configuration . getTargetDirectory ( ) , name ) ; File directory = path . getParentFile ( ) ; if ( directory != null && ! directory . exists ( ) ) { directory . mkdirs ( ) ; } byte [ ] bytes = gclass . getBytes ( ) ; FileOutputStream stream = null ; try { stream = new FileOutputStream ( path ) ; stream . write ( bytes , <NUM_LIT:0> , bytes . length ) ; } catch ( IOException e ) { getErrorCollector ( ) . addError ( Message . create ( e . getMessage ( ) , CompilationUnit . this ) ) ; failures = true ; } finally { if ( stream != null ) { try { stream . close ( ) ; } catch ( Exception e ) { } } } } } ; private SourceUnitOperation compileCompleteCheck = new SourceUnitOperation ( ) { public void call ( SourceUnit source ) throws CompilationFailedException { List classes = source . ast . getClasses ( ) ; for ( Iterator it = classes . iterator ( ) ; it . hasNext ( ) ; ) { ClassNode node = ( ClassNode ) it . next ( ) ; CompileUnit cu = node . getCompileUnit ( ) ; for ( Iterator iter = cu . iterateClassNodeToCompile ( ) ; iter . hasNext ( ) ; ) { String name = ( String ) iter . next ( ) ; SourceUnit su = ast . getScriptSourceLocation ( name ) ; List classesInSourceUnit = su . ast . getClasses ( ) ; StringBuffer message = new StringBuffer ( ) ; message . append ( "<STR_LIT>" ) . append ( name ) . append ( "<STR_LIT>" ) . append ( su . getName ( ) ) ; if ( classesInSourceUnit . isEmpty ( ) ) { message . append ( "<STR_LIT>" ) ; } else { message . append ( "<STR_LIT>" ) ; boolean first = true ; for ( Iterator suClassesIter = classesInSourceUnit . iterator ( ) ; suClassesIter . hasNext ( ) ; ) { ClassNode cn = ( ClassNode ) suClassesIter . next ( ) ; if ( ! first ) { message . append ( "<STR_LIT:U+002CU+0020>" ) ; } else { first = false ; } message . append ( cn . getName ( ) ) ; } } getErrorCollector ( ) . addErrorAndContinue ( new SimpleMessage ( message . toString ( ) , CompilationUnit . this ) ) ; iter . remove ( ) ; } } } } ; private PrimaryClassNodeOperation classgen = new PrimaryClassNodeOperation ( ) { public boolean needSortedInput ( ) { return true ; } public void call ( SourceUnit source , GeneratorContext context , ClassNode classNode ) throws CompilationFailedException { if ( ! classNode . isSynthetic ( ) ) { GenericsVisitor genericsVisitor = new GenericsVisitor ( source ) ; genericsVisitor . visitClass ( classNode ) ; } try { verifier . visitClass ( classNode ) ; } catch ( GroovyRuntimeException rpe ) { ASTNode node = rpe . getNode ( ) ; getErrorCollector ( ) . addError ( new SyntaxException ( rpe . getMessage ( ) , null , node . getLineNumber ( ) , node . getColumnNumber ( ) ) , source ) ; } LabelVerifier lv = new LabelVerifier ( source ) ; lv . visitClass ( classNode ) ; ClassCompletionVerifier completionVerifier = new ClassCompletionVerifier ( source ) ; completionVerifier . visitClass ( classNode ) ; ExtendedVerifier xverifier = new ExtendedVerifier ( source ) ; xverifier . visitClass ( classNode ) ; getErrorCollector ( ) . failIfErrors ( ) ; ClassVisitor visitor = createClassVisitor ( ) ; String sourceName = ( source == null ? classNode . getModule ( ) . getDescription ( ) : source . getName ( ) ) ; if ( sourceName != null ) sourceName = sourceName . substring ( Math . max ( sourceName . lastIndexOf ( '<STR_LIT:\\>' ) , sourceName . lastIndexOf ( '<CHAR_LIT:/>' ) ) + <NUM_LIT:1> ) ; ClassGenerator generator = new AsmClassGenerator ( context , visitor , classLoader , sourceName ) ; generator . visitClass ( classNode ) ; byte [ ] bytes = ( ( ClassWriter ) visitor ) . toByteArray ( ) ; generatedClasses . add ( new GroovyClass ( classNode . getName ( ) , bytes , classNode , source ) ) ; if ( CompilationUnit . this . classgenCallback != null ) { classgenCallback . call ( visitor , classNode ) ; } LinkedList innerClasses = generator . getInnerClasses ( ) ; while ( ! innerClasses . isEmpty ( ) ) { classgen . call ( source , context , ( ClassNode ) innerClasses . removeFirst ( ) ) ; } } } ; protected ClassVisitor createClassVisitor ( ) { return new ClassWriter ( true ) ; } protected void mark ( ) throws CompilationFailedException { applyToSourceUnits ( mark ) ; } private SourceUnitOperation mark = new SourceUnitOperation ( ) { public void call ( SourceUnit source ) throws CompilationFailedException { if ( source . phase < phase ) { source . gotoPhase ( phase ) ; } if ( source . phase == phase && phaseComplete && ! source . phaseComplete ) { source . completePhase ( ) ; } } } ; public abstract static class SourceUnitOperation { public abstract void call ( SourceUnit source ) throws CompilationFailedException ; } public void applyToSourceUnits ( SourceUnitOperation body ) throws CompilationFailedException { Iterator keys = names . iterator ( ) ; while ( keys . hasNext ( ) ) { String name = ( String ) keys . next ( ) ; SourceUnit source = ( SourceUnit ) sources . get ( name ) ; if ( ( source . phase < phase ) || ( source . phase == phase && ! source . phaseComplete ) ) { try { body . call ( source ) ; } catch ( CompilationFailedException e ) { throw e ; } catch ( Exception e ) { GroovyBugError gbe = new GroovyBugError ( e ) ; changeBugText ( gbe , source ) ; throw gbe ; } catch ( GroovyBugError e ) { changeBugText ( e , source ) ; throw e ; } } } getErrorCollector ( ) . failIfErrors ( ) ; } public abstract static class PrimaryClassNodeOperation { public abstract void call ( SourceUnit source , GeneratorContext context , ClassNode classNode ) throws CompilationFailedException ; public boolean needSortedInput ( ) { return false ; } } public abstract static class GroovyClassOperation { public abstract void call ( GroovyClass gclass ) throws CompilationFailedException ; } private int getSuperClassCount ( ClassNode element ) { int count = <NUM_LIT:0> ; while ( element != null ) { count ++ ; element = element . getSuperClass ( ) ; } return count ; } private int getSuperInterfaceCount ( ClassNode element ) { int count = <NUM_LIT:1> ; ClassNode [ ] interfaces = element . getInterfaces ( ) ; for ( int i = <NUM_LIT:0> ; i < interfaces . length ; i ++ ) { count = Math . max ( count , getSuperInterfaceCount ( interfaces [ i ] ) + <NUM_LIT:1> ) ; } return count ; } private List getPrimaryClassNodes ( boolean sort ) { List unsorted = new ArrayList ( ) ; Iterator modules = this . ast . getModules ( ) . iterator ( ) ; while ( modules . hasNext ( ) ) { ModuleNode module = ( ModuleNode ) modules . next ( ) ; Iterator classNodes = module . getClasses ( ) . iterator ( ) ; while ( classNodes . hasNext ( ) ) { ClassNode classNode = ( ClassNode ) classNodes . next ( ) ; unsorted . add ( classNode ) ; } } if ( sort == false ) return unsorted ; int [ ] indexClass = new int [ unsorted . size ( ) ] ; int [ ] indexInterface = new int [ unsorted . size ( ) ] ; { int i = <NUM_LIT:0> ; for ( Iterator iter = unsorted . iterator ( ) ; iter . hasNext ( ) ; i ++ ) { ClassNode node = ( ClassNode ) iter . next ( ) ; ClassNode element = node ; if ( node . isInterface ( ) ) { indexInterface [ i ] = getSuperInterfaceCount ( element ) ; indexClass [ i ] = - <NUM_LIT:1> ; } else { indexClass [ i ] = getSuperClassCount ( element ) ; indexInterface [ i ] = - <NUM_LIT:1> ; } } } List sorted = getSorted ( indexInterface , unsorted ) ; sorted . addAll ( getSorted ( indexClass , unsorted ) ) ; return sorted ; } private List getSorted ( int [ ] index , List unsorted ) { List sorted = new ArrayList ( unsorted . size ( ) ) ; int start = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < unsorted . size ( ) ; i ++ ) { int min = - <NUM_LIT:1> ; for ( int j = <NUM_LIT:0> ; j < unsorted . size ( ) ; j ++ ) { if ( index [ j ] == - <NUM_LIT:1> ) continue ; if ( min == - <NUM_LIT:1> ) { min = j ; } else if ( index [ j ] < index [ min ] ) { min = j ; } } if ( min == - <NUM_LIT:1> ) break ; sorted . add ( unsorted . get ( min ) ) ; index [ min ] = - <NUM_LIT:1> ; } return sorted ; } public void applyToPrimaryClassNodes ( PrimaryClassNodeOperation body ) throws CompilationFailedException { List primaryClassNodes = getPrimaryClassNodes ( body . needSortedInput ( ) ) ; Iterator classNodes = primaryClassNodes . iterator ( ) ; while ( classNodes . hasNext ( ) ) { SourceUnit context = null ; try { ClassNode classNode = ( ClassNode ) classNodes . next ( ) ; context = classNode . getModule ( ) . getContext ( ) ; if ( context == null || context . phase < phase || ( context . phase == phase && ! context . phaseComplete ) ) { body . call ( context , new GeneratorContext ( this . ast ) , classNode ) ; } } catch ( CompilationFailedException e ) { } catch ( NullPointerException npe ) { throw npe ; } catch ( GroovyBugError e ) { changeBugText ( e , context ) ; throw e ; } catch ( Exception e ) { ErrorCollector nestedCollector = null ; for ( Throwable next = e . getCause ( ) ; next != e && next != null ; next = next . getCause ( ) ) { if ( ! ( next instanceof MultipleCompilationErrorsException ) ) continue ; MultipleCompilationErrorsException mcee = ( MultipleCompilationErrorsException ) next ; nestedCollector = mcee . collector ; break ; } if ( nestedCollector != null ) { getErrorCollector ( ) . addCollectorContents ( nestedCollector ) ; } else { getErrorCollector ( ) . addError ( new ExceptionMessage ( e , configuration . getDebug ( ) , this ) ) ; } } } getErrorCollector ( ) . failIfErrors ( ) ; } public void applyToGeneratedGroovyClasses ( GroovyClassOperation body ) throws CompilationFailedException { if ( this . phase != Phases . OUTPUT && ! ( this . phase == Phases . CLASS_GENERATION && this . phaseComplete ) ) { throw new GroovyBugError ( "<STR_LIT>" + getPhaseDescription ( ) ) ; } boolean failures = false ; Iterator iterator = this . generatedClasses . iterator ( ) ; while ( iterator . hasNext ( ) ) { GroovyClass gclass = ( GroovyClass ) iterator . next ( ) ; try { body . call ( gclass ) ; } catch ( CompilationFailedException e ) { } catch ( NullPointerException npe ) { throw npe ; } catch ( GroovyBugError e ) { changeBugText ( e , null ) ; throw e ; } catch ( Exception e ) { GroovyBugError gbe = new GroovyBugError ( e ) ; throw gbe ; } } getErrorCollector ( ) . failIfErrors ( ) ; } private void changeBugText ( GroovyBugError e , SourceUnit context ) { e . setBugText ( "<STR_LIT>" + getPhaseDescription ( ) + "<STR_LIT>" + ( ( context != null ) ? context . getName ( ) : "<STR_LIT:?>" ) + "<STR_LIT>" + e . getBugText ( ) ) ; } public void setResolveVisitor ( ResolveVisitor resolveVisitor2 ) { this . resolveVisitor = resolveVisitor2 ; } public ResolveVisitor getResolveVisitor ( ) { return this . resolveVisitor ; } } </s>
|
<s> package org . codehaus . groovy . control ; import groovy . lang . GroovyClassLoader ; import java . io . File ; import java . io . FileWriter ; import java . io . IOException ; import java . io . Reader ; import java . net . URL ; import java . security . AccessController ; import java . security . PrivilegedAction ; import java . util . List ; import org . codehaus . groovy . GroovyBugError ; import org . codehaus . groovy . ast . Comment ; import org . codehaus . groovy . ast . ModuleNode ; import org . codehaus . groovy . control . io . FileReaderSource ; import org . codehaus . groovy . control . io . ReaderSource ; import org . codehaus . groovy . control . io . StringReaderSource ; import org . codehaus . groovy . control . io . URLReaderSource ; import org . codehaus . groovy . control . messages . Message ; import org . codehaus . groovy . control . messages . SimpleMessage ; import org . codehaus . groovy . control . messages . SyntaxErrorMessage ; import org . codehaus . groovy . syntax . * ; import org . codehaus . groovy . tools . Utilities ; import antlr . CharScanner ; import antlr . MismatchedTokenException ; import antlr . MismatchedCharException ; import antlr . NoViableAltException ; import antlr . NoViableAltForCharException ; public class SourceUnit extends ProcessingUnit { private List < Comment > comments ; private ParserPlugin parserPlugin ; protected ReaderSource source ; protected String name ; protected Reduction cst ; protected ModuleNode ast ; public SourceUnit ( String name , ReaderSource source , CompilerConfiguration flags , GroovyClassLoader loader , ErrorCollector er ) { super ( flags , loader , er ) ; this . name = name ; this . source = source ; } public SourceUnit ( File source , CompilerConfiguration configuration , GroovyClassLoader loader , ErrorCollector er ) { this ( source . getPath ( ) , new FileReaderSource ( source , configuration ) , configuration , loader , er ) ; } public SourceUnit ( URL source , CompilerConfiguration configuration , GroovyClassLoader loader , ErrorCollector er ) { this ( source . getPath ( ) , new URLReaderSource ( source , configuration ) , configuration , loader , er ) ; } public SourceUnit ( String name , String source , CompilerConfiguration configuration , GroovyClassLoader loader , ErrorCollector er ) { this ( name , new StringReaderSource ( source , configuration ) , configuration , loader , er ) ; } public String getName ( ) { return name ; } public Reduction getCST ( ) { return this . cst ; } public ModuleNode getAST ( ) { return this . ast ; } public boolean failedWithUnexpectedEOF ( ) { if ( getErrorCollector ( ) . hasErrors ( ) ) { Message last = ( Message ) getErrorCollector ( ) . getLastError ( ) ; Throwable cause = null ; if ( last instanceof SyntaxErrorMessage ) { cause = ( ( SyntaxErrorMessage ) last ) . getCause ( ) . getCause ( ) ; } if ( cause != null ) { if ( cause instanceof NoViableAltException ) { return isEofToken ( ( ( NoViableAltException ) cause ) . token ) ; } else if ( cause instanceof NoViableAltForCharException ) { char badChar = ( ( NoViableAltForCharException ) cause ) . foundChar ; return badChar == CharScanner . EOF_CHAR ; } else if ( cause instanceof MismatchedCharException ) { char badChar = ( char ) ( ( MismatchedCharException ) cause ) . foundChar ; return badChar == CharScanner . EOF_CHAR ; } else if ( cause instanceof MismatchedTokenException ) { return isEofToken ( ( ( MismatchedTokenException ) cause ) . token ) ; } } } return false ; } protected boolean isEofToken ( antlr . Token token ) { return token . getType ( ) == antlr . Token . EOF_TYPE ; } public static SourceUnit create ( String name , String source ) { CompilerConfiguration configuration = new CompilerConfiguration ( ) ; configuration . setTolerance ( <NUM_LIT:1> ) ; return new SourceUnit ( name , source , configuration , null , new ErrorCollector ( configuration ) ) ; } public static SourceUnit create ( String name , String source , int tolerance ) { CompilerConfiguration configuration = new CompilerConfiguration ( ) ; configuration . setTolerance ( tolerance ) ; return new SourceUnit ( name , source , configuration , null , new ErrorCollector ( configuration ) ) ; } public void parse ( ) throws CompilationFailedException { if ( this . phase > Phases . PARSING ) { throw new GroovyBugError ( "<STR_LIT>" ) ; } if ( this . phase == Phases . INITIALIZATION ) { nextPhase ( ) ; } Reader reader = null ; try { reader = source . getReader ( ) ; parserPlugin = getConfiguration ( ) . getPluginFactory ( ) . createParserPlugin ( ) ; cst = parserPlugin . parseCST ( this , reader ) ; reader . close ( ) ; } catch ( IOException e ) { getErrorCollector ( ) . addFatalError ( new SimpleMessage ( e . getMessage ( ) , this ) ) ; } finally { if ( reader != null ) { try { reader . close ( ) ; } catch ( IOException e ) { } } } } public void convert ( ) throws CompilationFailedException { if ( this . phase == Phases . PARSING && this . phaseComplete ) { gotoPhase ( Phases . CONVERSION ) ; } if ( this . phase != Phases . CONVERSION ) { throw new GroovyBugError ( "<STR_LIT>" ) ; } try { this . ast = parserPlugin . buildAST ( this , this . classLoader , this . cst ) ; this . ast . setDescription ( this . name ) ; } catch ( SyntaxException e ) { getErrorCollector ( ) . addError ( new SyntaxErrorMessage ( e , this ) ) ; } String property = ( String ) AccessController . doPrivileged ( new PrivilegedAction ( ) { public Object run ( ) { return System . getProperty ( "<STR_LIT>" ) ; } } ) ; if ( "<STR_LIT>" . equals ( property ) ) { saveAsXML ( name , ast ) ; } } private void saveAsXML ( String name , ModuleNode ast ) { } public String getSample ( int line , int column , Janitor janitor ) { String sample = null ; String text = source . getLine ( line , janitor ) ; if ( text != null ) { if ( column > <NUM_LIT:0> ) { String marker = Utilities . repeatString ( "<STR_LIT:U+0020>" , column - <NUM_LIT:1> ) + "<STR_LIT>" ; if ( column > <NUM_LIT> ) { int start = column - <NUM_LIT:30> - <NUM_LIT:1> ; int end = ( column + <NUM_LIT:10> > text . length ( ) ? text . length ( ) : column + <NUM_LIT:10> - <NUM_LIT:1> ) ; sample = "<STR_LIT>" + text . substring ( start , end ) + Utilities . eol ( ) + "<STR_LIT>" + marker . substring ( start , marker . length ( ) ) ; } else { sample = "<STR_LIT>" + text + Utilities . eol ( ) + "<STR_LIT>" + marker ; } } else { sample = text ; } } return sample ; } public void addException ( Exception e ) throws CompilationFailedException { getErrorCollector ( ) . addException ( e , this ) ; } public void addError ( SyntaxException se ) throws CompilationFailedException { getErrorCollector ( ) . addError ( se , this ) ; } public List < Comment > getComments ( ) { return comments ; } public void setComments ( List < Comment > comments ) { this . comments = comments ; } } </s>
|
<s> package org . codehaus . groovy . control ; import groovy . lang . GroovyClassLoader ; import java . io . File ; import java . io . IOException ; import java . net . URL ; import java . net . URLConnection ; import java . util . HashMap ; import java . util . HashSet ; import java . util . Iterator ; import java . util . LinkedList ; import java . util . List ; import java . util . Map ; import java . util . Set ; import org . codehaus . groovy . GroovyBugError ; import org . codehaus . groovy . ast . ASTNode ; import org . codehaus . groovy . ast . AnnotatedNode ; import org . codehaus . groovy . ast . AnnotationNode ; import org . codehaus . groovy . ast . ClassCodeExpressionTransformer ; import org . codehaus . groovy . ast . ClassHelper ; import org . codehaus . groovy . ast . ClassNode ; import org . codehaus . groovy . ast . CompileUnit ; import org . codehaus . groovy . ast . DynamicVariable ; import org . codehaus . groovy . ast . FieldNode ; import org . codehaus . groovy . ast . GenericsType ; import org . codehaus . groovy . ast . ImportNode ; import org . codehaus . groovy . ast . MethodNode ; import org . codehaus . groovy . ast . ModuleNode ; import org . codehaus . groovy . ast . Parameter ; import org . codehaus . groovy . ast . PropertyNode ; import org . codehaus . groovy . ast . Variable ; import org . codehaus . groovy . ast . VariableScope ; import org . codehaus . groovy . ast . expr . AnnotationConstantExpression ; import org . codehaus . groovy . ast . expr . BinaryExpression ; import org . codehaus . groovy . ast . expr . ClassExpression ; import org . codehaus . groovy . ast . expr . ClosureExpression ; import org . codehaus . groovy . ast . expr . ConstructorCallExpression ; import org . codehaus . groovy . ast . expr . DeclarationExpression ; import org . codehaus . groovy . ast . expr . Expression ; import org . codehaus . groovy . ast . expr . ListExpression ; import org . codehaus . groovy . ast . expr . MethodCallExpression ; import org . codehaus . groovy . ast . expr . PropertyExpression ; import org . codehaus . groovy . ast . expr . VariableExpression ; import org . codehaus . groovy . ast . stmt . BlockStatement ; import org . codehaus . groovy . ast . stmt . CatchStatement ; import org . codehaus . groovy . ast . stmt . ForStatement ; import org . codehaus . groovy . ast . stmt . Statement ; import org . codehaus . groovy . classgen . Verifier ; import org . codehaus . groovy . control . messages . ExceptionMessage ; import org . codehaus . groovy . syntax . Types ; import org . objectweb . asm . Opcodes ; public class ResolveVisitor extends ClassCodeExpressionTransformer { public ClassNode currentClass ; public static final String [ ] DEFAULT_IMPORTS = { "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" } ; protected CompilationUnit compilationUnit ; private Map cachedClasses = new HashMap ( ) ; private static final Object NO_CLASS = new Object ( ) ; private static final Object SCRIPT = new Object ( ) ; private SourceUnit source ; private VariableScope currentScope ; private boolean isTopLevelProperty = true ; private boolean inPropertyExpression = false ; private boolean inClosure = false ; private boolean isSpecialConstructorCall = false ; private Map genericParameterNames = new HashMap ( ) ; private Set < FieldNode > fieldTypesChecked = new HashSet < FieldNode > ( ) ; private static class ConstructedClassWithPackage extends ClassNode { String prefix ; String className ; public ConstructedClassWithPackage ( String pkg , String name ) { super ( pkg + name , Opcodes . ACC_PUBLIC , ClassHelper . OBJECT_TYPE ) ; isPrimaryNode = false ; this . prefix = pkg ; this . className = name ; } public String getName ( ) { if ( redirect ( ) != this ) return super . getName ( ) ; return prefix + className ; } public boolean hasPackageName ( ) { if ( redirect ( ) != this ) return super . hasPackageName ( ) ; return className . indexOf ( '<CHAR_LIT:.>' ) != - <NUM_LIT:1> ; } public String setName ( String name ) { if ( redirect ( ) != this ) { return super . setName ( name ) ; } else { throw new GroovyBugError ( "<STR_LIT>" ) ; } } } private static class LowerCaseClass extends ClassNode { String className ; public LowerCaseClass ( String name ) { super ( name , Opcodes . ACC_PUBLIC , ClassHelper . OBJECT_TYPE ) ; isPrimaryNode = false ; this . className = name ; } public String getName ( ) { if ( redirect ( ) != this ) return super . getName ( ) ; return className ; } public boolean hasPackageName ( ) { if ( redirect ( ) != this ) return super . hasPackageName ( ) ; return false ; } public String setName ( String name ) { if ( redirect ( ) != this ) { return super . setName ( name ) ; } else { throw new GroovyBugError ( "<STR_LIT>" ) ; } } } public ResolveVisitor ( CompilationUnit cu ) { compilationUnit = cu ; } public void startResolving ( ClassNode node , SourceUnit source ) { this . source = source ; visitClass ( node ) ; } protected void visitConstructorOrMethod ( MethodNode node , boolean isConstructor ) { VariableScope oldScope = currentScope ; currentScope = node . getVariableScope ( ) ; Map oldPNames = genericParameterNames ; genericParameterNames = new HashMap ( genericParameterNames ) ; resolveGenericsHeader ( node . getGenericsTypes ( ) ) ; Parameter [ ] paras = node . getParameters ( ) ; for ( int i = <NUM_LIT:0> ; i < paras . length ; i ++ ) { Parameter p = paras [ i ] ; p . setInitialExpression ( transform ( p . getInitialExpression ( ) ) ) ; resolveOrFail ( p . getType ( ) , p . getType ( ) ) ; visitAnnotations ( p ) ; } ClassNode [ ] exceptions = node . getExceptions ( ) ; for ( int i = <NUM_LIT:0> ; i < exceptions . length ; i ++ ) { ClassNode t = exceptions [ i ] ; resolveOrFail ( t , node ) ; } resolveOrFail ( node . getReturnType ( ) , node ) ; super . visitConstructorOrMethod ( node , isConstructor ) ; genericParameterNames = oldPNames ; currentScope = oldScope ; } public void visitField ( FieldNode node ) { if ( ! fieldTypesChecked . contains ( node ) ) { ClassNode t = node . getType ( ) ; resolveOrFail ( t , node ) ; } super . visitField ( node ) ; } public void visitProperty ( PropertyNode node ) { ClassNode t = node . getType ( ) ; resolveOrFail ( t , node ) ; super . visitProperty ( node ) ; fieldTypesChecked . add ( node . getField ( ) ) ; } private boolean resolveToInner ( ClassNode type ) { if ( type instanceof ConstructedClassWithPackage ) return false ; String name = type . getName ( ) ; String saved = name ; while ( true ) { int len = name . lastIndexOf ( '<CHAR_LIT:.>' ) ; if ( len == - <NUM_LIT:1> ) break ; name = name . substring ( <NUM_LIT:0> , len ) + "<STR_LIT:$>" + name . substring ( len + <NUM_LIT:1> ) ; type . setName ( name ) ; if ( resolve ( type ) ) return true ; } if ( resolveToInnerEnum ( type ) ) return true ; type . setName ( saved ) ; return false ; } private boolean resolveToInnerEnum ( ClassNode type ) { String name = type . getName ( ) ; if ( currentClass != type && ! name . contains ( "<STR_LIT:.>" ) && type . getClass ( ) . equals ( ClassNode . class ) ) { type . setName ( currentClass . getName ( ) + "<STR_LIT:$>" + name ) ; if ( resolve ( type ) ) return true ; } return false ; } private void resolveOrFail ( ClassNode type , String msg , ASTNode node ) { if ( resolve ( type ) ) return ; if ( resolveToInner ( type ) ) return ; addError ( "<STR_LIT>" + type . getName ( ) + "<STR_LIT:U+0020>" + msg , node ) ; } private void resolveOrFail ( ClassNode type , ASTNode node , boolean prefereImports ) { resolveGenericsTypes ( type . getGenericsTypes ( ) ) ; if ( prefereImports && resolveAliasFromModule ( type ) ) return ; resolveOrFail ( type , node ) ; } private void resolveOrFail ( ClassNode type , ASTNode node ) { resolveOrFail ( type , "<STR_LIT>" , node ) ; } protected boolean resolve ( ClassNode type ) { return resolve ( type , true , true , true ) ; } protected boolean resolve ( ClassNode type , boolean testModuleImports , boolean testDefaultImports , boolean testStaticInnerClasses ) { if ( type . isResolved ( ) || type . isPrimaryClassNode ( ) ) return true ; resolveGenericsTypes ( type . getGenericsTypes ( ) ) ; if ( type . isArray ( ) ) { ClassNode element = type . getComponentType ( ) ; boolean resolved = resolve ( element , testModuleImports , testDefaultImports , testStaticInnerClasses ) ; if ( resolved ) { ClassNode cn = element . makeArray ( ) ; type . setRedirect ( cn ) ; } return resolved ; } if ( currentClass == type ) return true ; if ( genericParameterNames . get ( type . getName ( ) ) != null ) { GenericsType gt = ( GenericsType ) genericParameterNames . get ( type . getName ( ) ) ; type . setRedirect ( gt . getType ( ) ) ; type . setGenericsTypes ( new GenericsType [ ] { gt } ) ; type . setGenericsPlaceHolder ( true ) ; return true ; } if ( currentClass . getNameWithoutPackage ( ) . equals ( type . getName ( ) ) ) { type . setRedirect ( currentClass ) ; return true ; } return resolveFromModule ( type , testModuleImports ) || resolveFromCompileUnit ( type ) || resolveFromDefaultImports ( type , testDefaultImports ) || resolveFromStaticInnerClasses ( type , testStaticInnerClasses ) || resolveFromClassCache ( type ) || resolveToClass ( type ) || resolveToScript ( type ) ; } protected boolean resolveFromClassCache ( ClassNode type ) { String name = type . getName ( ) ; Object val = cachedClasses . get ( name ) ; if ( val == null || val == NO_CLASS ) { return false ; } else { setClass ( type , ( Class ) val ) ; return true ; } } private long getTimeStamp ( Class cls ) { return Verifier . getTimestamp ( cls ) ; } private boolean isSourceNewer ( URL source , Class cls ) { try { long lastMod ; if ( source . getProtocol ( ) . equals ( "<STR_LIT:file>" ) ) { String path = source . getPath ( ) . replace ( '<CHAR_LIT:/>' , File . separatorChar ) . replace ( '<CHAR_LIT>' , '<CHAR_LIT::>' ) ; File file = new File ( path ) ; lastMod = file . lastModified ( ) ; } else { URLConnection conn = source . openConnection ( ) ; lastMod = conn . getLastModified ( ) ; conn . getInputStream ( ) . close ( ) ; } return lastMod > getTimeStamp ( cls ) ; } catch ( IOException e ) { return false ; } } protected boolean resolveToScript ( ClassNode type ) { String name = type . getName ( ) ; if ( type instanceof LowerCaseClass ) { cachedClasses . put ( name , NO_CLASS ) ; } if ( cachedClasses . get ( name ) == NO_CLASS ) return false ; if ( cachedClasses . get ( name ) == SCRIPT ) cachedClasses . put ( name , NO_CLASS ) ; if ( name . startsWith ( "<STR_LIT>" ) ) return type . isResolved ( ) ; if ( name . indexOf ( '<CHAR_LIT>' ) != - <NUM_LIT:1> ) return type . isResolved ( ) ; ModuleNode module = currentClass . getModule ( ) ; if ( module . hasPackageName ( ) && name . indexOf ( '<CHAR_LIT:.>' ) == - <NUM_LIT:1> ) return type . isResolved ( ) ; GroovyClassLoader gcl = compilationUnit . getClassLoader ( ) ; URL url = null ; return type . isResolved ( ) ; } private String replaceLastPoint ( String name ) { int lastPoint = name . lastIndexOf ( '<CHAR_LIT:.>' ) ; name = new StringBuffer ( ) . append ( name . substring ( <NUM_LIT:0> , lastPoint ) ) . append ( "<STR_LIT:$>" ) . append ( name . substring ( lastPoint + <NUM_LIT:1> ) ) . toString ( ) ; return name ; } protected boolean resolveFromStaticInnerClasses ( ClassNode type , boolean testStaticInnerClasses ) { if ( type instanceof LowerCaseClass ) return false ; testStaticInnerClasses &= type . hasPackageName ( ) ; if ( testStaticInnerClasses ) { if ( type instanceof ConstructedClassWithPackage ) { ConstructedClassWithPackage tmp = ( ConstructedClassWithPackage ) type ; String name = ( ( ConstructedClassWithPackage ) type ) . className ; tmp . className = replaceLastPoint ( name ) ; if ( resolve ( tmp , false , true , true ) ) { type . setRedirect ( tmp . redirect ( ) ) ; return true ; } tmp . className = name ; } else { return resolveStaticInner ( type ) ; } } return false ; } protected boolean resolveStaticInner ( ClassNode type ) { String name = type . getName ( ) ; String replacedPointType = replaceLastPoint ( name ) ; type . setName ( replacedPointType ) ; if ( resolve ( type , false , true , true ) ) return true ; type . setName ( name ) ; return false ; } protected boolean resolveFromDefaultImports ( ClassNode type , boolean testDefaultImports ) { testDefaultImports &= ! type . hasPackageName ( ) ; testDefaultImports &= ! ( type instanceof LowerCaseClass ) ; if ( testDefaultImports ) { for ( int i = <NUM_LIT:0> , size = DEFAULT_IMPORTS . length ; i < size ; i ++ ) { String packagePrefix = DEFAULT_IMPORTS [ i ] ; String name = type . getName ( ) ; ConstructedClassWithPackage tmp = new ConstructedClassWithPackage ( packagePrefix , name ) ; if ( resolve ( tmp , false , false , false ) ) { type . setRedirect ( tmp . redirect ( ) ) ; return true ; } } String name = type . getName ( ) ; if ( name . equals ( "<STR_LIT>" ) ) { type . setRedirect ( ClassHelper . BigInteger_TYPE ) ; return true ; } else if ( name . equals ( "<STR_LIT>" ) ) { type . setRedirect ( ClassHelper . BigDecimal_TYPE ) ; return true ; } } return false ; } protected boolean resolveFromCompileUnit ( ClassNode type ) { CompileUnit compileUnit = currentClass . getCompileUnit ( ) ; if ( compileUnit == null ) return false ; ClassNode cuClass = compileUnit . getClass ( type . getName ( ) ) ; if ( cuClass != null ) { if ( type != cuClass ) type . setRedirect ( cuClass ) ; return true ; } return false ; } private void setClass ( ClassNode n , Class cls ) { ClassNode cn = ClassHelper . make ( cls ) ; n . setRedirect ( cn ) ; } private void ambiguousClass ( ClassNode type , ClassNode iType , String name ) { if ( type . getName ( ) . equals ( iType . getName ( ) ) ) { addError ( "<STR_LIT>" + name + "<STR_LIT>" + type . getName ( ) + "<STR_LIT:U+0020andU+0020>" + iType . getName ( ) + "<STR_LIT>" , type ) ; } else { type . setRedirect ( iType ) ; } } private boolean resolveAliasFromModule ( ClassNode type ) { if ( type instanceof ConstructedClassWithPackage ) return false ; ModuleNode module = currentClass . getModule ( ) ; if ( module == null ) return false ; String name = type . getName ( ) ; String pname = name ; int index = name . length ( ) ; while ( true ) { pname = name . substring ( <NUM_LIT:0> , index ) ; ClassNode aliasedNode = module . getImport ( pname ) ; if ( aliasedNode != null ) { if ( pname . length ( ) == name . length ( ) ) { type . setRedirect ( aliasedNode ) ; return true ; } else { String className = aliasedNode . getNameWithoutPackage ( ) + '<CHAR_LIT>' + name . substring ( pname . length ( ) + <NUM_LIT:1> ) . replace ( '<CHAR_LIT:.>' , '<CHAR_LIT>' ) ; ConstructedClassWithPackage tmp = new ConstructedClassWithPackage ( aliasedNode . getPackageName ( ) + "<STR_LIT:.>" , className ) ; if ( resolve ( tmp , true , true , false ) ) { type . setRedirect ( tmp . redirect ( ) ) ; return true ; } } } index = pname . lastIndexOf ( '<CHAR_LIT:.>' ) ; if ( index == - <NUM_LIT:1> ) break ; } return false ; } protected boolean resolveFromModule ( ClassNode type , boolean testModuleImports ) { if ( type instanceof LowerCaseClass ) { return resolveAliasFromModule ( type ) ; } String name = type . getName ( ) ; ModuleNode module = currentClass . getModule ( ) ; if ( module == null ) return false ; boolean newNameUsed = false ; if ( ! type . hasPackageName ( ) && module . hasPackageName ( ) && ! ( type instanceof ConstructedClassWithPackage ) ) { type . setName ( module . getPackageName ( ) + name ) ; newNameUsed = true ; } List moduleClasses = module . getClasses ( ) ; for ( Iterator iter = moduleClasses . iterator ( ) ; iter . hasNext ( ) ; ) { ClassNode mClass = ( ClassNode ) iter . next ( ) ; if ( mClass . getName ( ) . equals ( type . getName ( ) ) ) { if ( mClass != type ) type . setRedirect ( mClass ) ; return true ; } } if ( newNameUsed ) type . setName ( name ) ; if ( testModuleImports ) { if ( resolveAliasFromModule ( type ) ) return true ; if ( module . hasPackageName ( ) ) { ConstructedClassWithPackage tmp = new ConstructedClassWithPackage ( module . getPackageName ( ) , name ) ; if ( resolve ( tmp , false , false , false ) ) { type . setRedirect ( tmp . redirect ( ) ) ; return true ; } } List packages = module . getImportPackages ( ) ; for ( Iterator iter = packages . iterator ( ) ; iter . hasNext ( ) ; ) { String packagePrefix = ( String ) iter . next ( ) ; ConstructedClassWithPackage tmp = new ConstructedClassWithPackage ( packagePrefix , name ) ; if ( resolve ( tmp , false , false , true ) ) { ambiguousClass ( type , tmp , name ) ; type . setRedirect ( tmp . redirect ( ) ) ; return true ; } } } return false ; } protected ClassNode resolveNewName ( String fullname ) { return null ; } protected boolean resolveToClass ( ClassNode type ) { String name = type . getName ( ) ; if ( type instanceof LowerCaseClass ) { cachedClasses . put ( name , NO_CLASS ) ; } Object cached = cachedClasses . get ( name ) ; if ( cached == NO_CLASS ) return false ; if ( cached == SCRIPT ) throw new GroovyBugError ( "<STR_LIT>" + name + "<STR_LIT>" ) ; if ( cached != null ) return true ; if ( currentClass . getModule ( ) . hasPackageName ( ) && name . indexOf ( '<CHAR_LIT:.>' ) == - <NUM_LIT:1> ) return false ; GroovyClassLoader loader = compilationUnit . getClassLoader ( ) ; Class cls ; try { cls = loader . loadClass ( name , false , true ) ; } catch ( ClassNotFoundException cnfe ) { cachedClasses . put ( name , SCRIPT ) ; return false ; } catch ( CompilationFailedException cfe ) { compilationUnit . getErrorCollector ( ) . addErrorAndContinue ( new ExceptionMessage ( cfe , true , source ) ) ; return false ; } if ( cls == null ) return false ; cachedClasses . put ( name , cls ) ; setClass ( type , cls ) ; return cls . getClassLoader ( ) == loader ; } public Expression transform ( Expression exp ) { if ( exp == null ) return null ; Expression ret = null ; if ( exp instanceof VariableExpression ) { ret = transformVariableExpression ( ( VariableExpression ) exp ) ; } else if ( exp . getClass ( ) == PropertyExpression . class ) { ret = transformPropertyExpression ( ( PropertyExpression ) exp ) ; } else if ( exp instanceof DeclarationExpression ) { ret = transformDeclarationExpression ( ( DeclarationExpression ) exp ) ; } else if ( exp instanceof BinaryExpression ) { ret = transformBinaryExpression ( ( BinaryExpression ) exp ) ; } else if ( exp instanceof MethodCallExpression ) { ret = transformMethodCallExpression ( ( MethodCallExpression ) exp ) ; } else if ( exp instanceof ClosureExpression ) { ret = transformClosureExpression ( ( ClosureExpression ) exp ) ; } else if ( exp instanceof ConstructorCallExpression ) { ret = transformConstructorCallExpression ( ( ConstructorCallExpression ) exp ) ; } else if ( exp instanceof AnnotationConstantExpression ) { ret = transformAnnotationConstantExpression ( ( AnnotationConstantExpression ) exp ) ; } else { resolveOrFail ( exp . getType ( ) , exp ) ; ret = exp . transformExpression ( this ) ; } if ( ret != null && ret != exp ) ret . setSourcePosition ( exp ) ; return ret ; } private String lookupClassName ( PropertyExpression pe ) { boolean doInitialClassTest = true ; String name = "<STR_LIT>" ; for ( Expression it = pe ; it != null ; it = ( ( PropertyExpression ) it ) . getObjectExpression ( ) ) { if ( it instanceof VariableExpression ) { VariableExpression ve = ( VariableExpression ) it ; if ( ve . isSuperExpression ( ) || ve . isThisExpression ( ) ) { return null ; } String varName = ve . getName ( ) ; if ( doInitialClassTest ) { if ( ! testVanillaNameForClass ( varName ) ) return null ; doInitialClassTest = false ; name = varName ; } else { name = varName + "<STR_LIT:.>" + name ; } break ; } else if ( ! ( it . getClass ( ) == PropertyExpression . class ) ) { return null ; } else { PropertyExpression current = ( PropertyExpression ) it ; String propertyPart = current . getPropertyAsString ( ) ; if ( propertyPart == null || propertyPart . equals ( "<STR_LIT:class>" ) ) { return null ; } if ( doInitialClassTest ) { if ( ! testVanillaNameForClass ( propertyPart ) ) return null ; doInitialClassTest = false ; name = propertyPart ; } else { name = propertyPart + "<STR_LIT:.>" + name ; } } } if ( name . length ( ) == <NUM_LIT:0> ) return null ; return name ; } private Expression correctClassClassChain ( PropertyExpression pe ) { LinkedList stack = new LinkedList ( ) ; ClassExpression found = null ; for ( Expression it = pe ; it != null ; it = ( ( PropertyExpression ) it ) . getObjectExpression ( ) ) { if ( it instanceof ClassExpression ) { found = ( ClassExpression ) it ; break ; } else if ( ! ( it . getClass ( ) == PropertyExpression . class ) ) { return pe ; } stack . addFirst ( it ) ; } if ( found == null ) return pe ; if ( stack . isEmpty ( ) ) return pe ; Object stackElement = stack . removeFirst ( ) ; if ( ! ( stackElement . getClass ( ) == PropertyExpression . class ) ) return pe ; PropertyExpression classPropertyExpression = ( PropertyExpression ) stackElement ; String propertyNamePart = classPropertyExpression . getPropertyAsString ( ) ; if ( propertyNamePart == null || ! propertyNamePart . equals ( "<STR_LIT:class>" ) ) return pe ; found . setSourcePosition ( classPropertyExpression ) ; if ( stack . isEmpty ( ) ) return found ; stackElement = stack . removeFirst ( ) ; if ( ! ( stackElement . getClass ( ) == PropertyExpression . class ) ) return pe ; PropertyExpression classPropertyExpressionContainer = ( PropertyExpression ) stackElement ; classPropertyExpressionContainer . setObjectExpression ( found ) ; return pe ; } protected Expression transformPropertyExpression ( PropertyExpression pe ) { boolean itlp = isTopLevelProperty ; boolean ipe = inPropertyExpression ; Expression objectExpression = pe . getObjectExpression ( ) ; inPropertyExpression = true ; isTopLevelProperty = ! ( objectExpression . getClass ( ) == PropertyExpression . class ) ; objectExpression = transform ( objectExpression ) ; inPropertyExpression = false ; Expression property = transform ( pe . getProperty ( ) ) ; isTopLevelProperty = itlp ; inPropertyExpression = ipe ; boolean spreadSafe = pe . isSpreadSafe ( ) ; PropertyExpression old = pe ; pe = new PropertyExpression ( objectExpression , property , pe . isSafe ( ) ) ; pe . setSpreadSafe ( spreadSafe ) ; pe . setSourcePosition ( old ) ; String className = lookupClassName ( pe ) ; if ( className != null ) { ClassNode type = ClassHelper . make ( className ) ; if ( resolve ( type ) ) { Expression ret = new ClassExpression ( type ) ; ret . setSourcePosition ( pe ) ; return ret ; } } if ( objectExpression instanceof ClassExpression && pe . getPropertyAsString ( ) != null ) { ClassExpression ce = ( ClassExpression ) objectExpression ; ClassNode type = ClassHelper . make ( ce . getType ( ) . getName ( ) + "<STR_LIT:$>" + pe . getPropertyAsString ( ) ) ; if ( resolve ( type , false , false , false ) ) { Expression ret = new ClassExpression ( type ) ; ret . setSourcePosition ( ce ) ; return ret ; } } Expression ret = pe ; if ( isTopLevelProperty ) ret = correctClassClassChain ( pe ) ; return ret ; } protected Expression transformVariableExpression ( VariableExpression ve ) { Variable v = ve . getAccessedVariable ( ) ; if ( v instanceof DynamicVariable ) { String name = ve . getName ( ) ; ClassNode t = ClassHelper . make ( name ) ; boolean isClass = t . isResolved ( ) ; if ( ! isClass ) { if ( Character . isLowerCase ( name . charAt ( <NUM_LIT:0> ) ) ) { t = new LowerCaseClass ( name ) ; } isClass = resolve ( t ) ; if ( ! isClass ) isClass = resolveToInnerEnum ( t ) ; } if ( isClass ) { for ( VariableScope scope = currentScope ; scope != null && ! scope . isRoot ( ) ; scope = scope . getParent ( ) ) { if ( scope . isRoot ( ) ) break ; if ( scope . removeReferencedClassVariable ( ve . getName ( ) ) == null ) break ; } ClassExpression ce = new ClassExpression ( t ) ; ce . setSourcePosition ( ve ) ; return ce ; } } resolveOrFail ( ve . getType ( ) , ve ) ; return ve ; } private boolean testVanillaNameForClass ( String name ) { if ( name == null || name . length ( ) == <NUM_LIT:0> ) return false ; return ! Character . isLowerCase ( name . charAt ( <NUM_LIT:0> ) ) ; } protected Expression transformBinaryExpression ( BinaryExpression be ) { Expression left = transform ( be . getLeftExpression ( ) ) ; int type = be . getOperation ( ) . getType ( ) ; if ( ( type == Types . ASSIGNMENT_OPERATOR || type == Types . EQUAL ) && left instanceof ClassExpression ) { ClassExpression ce = ( ClassExpression ) left ; String error = "<STR_LIT>" + ce . getType ( ) . getName ( ) + "<STR_LIT:'>" ; if ( ce . getType ( ) . isScript ( ) ) { error += "<STR_LIT>" ; } addError ( error , be . getLeftExpression ( ) ) ; return be ; } if ( left instanceof ClassExpression && be . getRightExpression ( ) instanceof ListExpression ) { ListExpression list = ( ListExpression ) be . getRightExpression ( ) ; if ( list . getExpressions ( ) . isEmpty ( ) ) { return new ClassExpression ( left . getType ( ) . makeArray ( ) ) ; } } Expression right = transform ( be . getRightExpression ( ) ) ; be . setLeftExpression ( left ) ; be . setRightExpression ( right ) ; return be ; } protected Expression transformClosureExpression ( ClosureExpression ce ) { boolean oldInClosure = inClosure ; inClosure = true ; Parameter [ ] paras = ce . getParameters ( ) ; if ( paras != null ) { for ( int i = <NUM_LIT:0> ; i < paras . length ; i ++ ) { ClassNode t = paras [ i ] . getType ( ) ; resolveOrFail ( t , ce ) ; if ( paras [ i ] . hasInitialExpression ( ) ) { Object initialVal = paras [ i ] . getInitialExpression ( ) ; if ( initialVal instanceof Expression ) { transform ( ( Expression ) initialVal ) ; } } } } Statement code = ce . getCode ( ) ; if ( code != null ) code . visit ( this ) ; inClosure = oldInClosure ; return ce ; } protected Expression transformConstructorCallExpression ( ConstructorCallExpression cce ) { ClassNode type = cce . getType ( ) ; resolveOrFail ( type , cce ) ; isSpecialConstructorCall = cce . isSpecialCall ( ) ; Expression ret = cce . transformExpression ( this ) ; isSpecialConstructorCall = false ; return ret ; } protected Expression transformMethodCallExpression ( MethodCallExpression mce ) { Expression args = transform ( mce . getArguments ( ) ) ; Expression method = transform ( mce . getMethod ( ) ) ; Expression object = transform ( mce . getObjectExpression ( ) ) ; MethodCallExpression result = new MethodCallExpression ( object , method , args ) ; result . setSafe ( mce . isSafe ( ) ) ; result . setImplicitThis ( mce . isImplicitThis ( ) ) ; result . setSpreadSafe ( mce . isSpreadSafe ( ) ) ; result . setSourcePosition ( mce ) ; return result ; } protected Expression transformDeclarationExpression ( DeclarationExpression de ) { Expression oldLeft = de . getLeftExpression ( ) ; Expression left = transform ( oldLeft ) ; if ( left instanceof ClassExpression ) { ClassExpression ce = ( ClassExpression ) left ; addError ( "<STR_LIT>" + ce . getType ( ) . getName ( ) , oldLeft ) ; return de ; } Expression right = transform ( de . getRightExpression ( ) ) ; if ( right == de . getRightExpression ( ) ) return de ; DeclarationExpression newDeclExpr = new DeclarationExpression ( left , de . getOperation ( ) , right ) ; newDeclExpr . setSourcePosition ( de ) ; return newDeclExpr ; } protected Expression transformAnnotationConstantExpression ( AnnotationConstantExpression ace ) { AnnotationNode an = ( AnnotationNode ) ace . getValue ( ) ; ClassNode type = an . getClassNode ( ) ; resolveOrFail ( type , "<STR_LIT>" , an ) ; for ( Iterator iter = an . getMembers ( ) . entrySet ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { Map . Entry member = ( Map . Entry ) iter . next ( ) ; Expression memberValue = ( Expression ) member . getValue ( ) ; member . setValue ( transform ( memberValue ) ) ; } return ace ; } public void visitAnnotations ( AnnotatedNode node ) { List annotations = node . getAnnotations ( ) ; if ( annotations . isEmpty ( ) ) return ; Iterator it = annotations . iterator ( ) ; while ( it . hasNext ( ) ) { AnnotationNode an = ( AnnotationNode ) it . next ( ) ; if ( an . isBuiltIn ( ) ) continue ; ClassNode type = an . getClassNode ( ) ; resolveOrFail ( type , "<STR_LIT>" , an ) ; for ( Iterator iter = an . getMembers ( ) . entrySet ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { Map . Entry member = ( Map . Entry ) iter . next ( ) ; Expression memberValue = ( Expression ) member . getValue ( ) ; Expression newValue = transform ( memberValue ) ; member . setValue ( newValue ) ; if ( newValue instanceof PropertyExpression ) { PropertyExpression pe = ( PropertyExpression ) newValue ; if ( ! ( pe . getObjectExpression ( ) instanceof ClassExpression ) ) { addError ( "<STR_LIT>" , pe . getObjectExpression ( ) ) ; } } } } } public void visitClass ( ClassNode node ) { ClassNode oldNode = currentClass ; currentClass = node ; commencingResolution ( ) ; resolveGenericsHeader ( node . getGenericsTypes ( ) ) ; ModuleNode module = node . getModule ( ) ; if ( ! module . hasImportsResolved ( ) ) { List l = module . getImports ( ) ; for ( Iterator iter = l . iterator ( ) ; iter . hasNext ( ) ; ) { ImportNode element = ( ImportNode ) iter . next ( ) ; ClassNode type = element . getType ( ) ; if ( resolve ( type , false , false , true ) ) continue ; addError ( "<STR_LIT>" + type . getName ( ) , type ) ; } Map importPackages = module . getStaticImportClasses ( ) ; for ( Iterator iter = importPackages . values ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { ClassNode type = ( ClassNode ) iter . next ( ) ; if ( resolve ( type , false , false , true ) ) continue ; if ( type . getPackageName ( ) == null && node . getPackageName ( ) != null ) { String oldTypeName = type . getName ( ) ; type . setName ( node . getPackageName ( ) + "<STR_LIT:.>" + oldTypeName ) ; if ( resolve ( type , false , false , true ) ) continue ; type . setName ( oldTypeName ) ; } addError ( "<STR_LIT>" + type . getName ( ) , type ) ; } for ( Iterator iter = module . getStaticImportAliases ( ) . values ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { ClassNode type = ( ClassNode ) iter . next ( ) ; if ( resolve ( type , true , true , true ) ) continue ; addError ( "<STR_LIT>" + type . getName ( ) , type ) ; } for ( Iterator iter = module . getStaticImportClasses ( ) . values ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { ClassNode type = ( ClassNode ) iter . next ( ) ; if ( resolve ( type , true , true , true ) ) continue ; addError ( "<STR_LIT>" + type . getName ( ) , type ) ; } module . setImportsResolved ( true ) ; } ClassNode sn = node . getUnresolvedSuperClass ( ) ; if ( sn != null ) resolveOrFail ( sn , node , true ) ; ClassNode [ ] interfaces = node . getInterfaces ( ) ; for ( int i = <NUM_LIT:0> ; i < interfaces . length ; i ++ ) { resolveOrFail ( interfaces [ i ] , node , true ) ; } checkCyclicInheritence ( node , node . getUnresolvedSuperClass ( ) , node . getInterfaces ( ) ) ; super . visitClass ( node ) ; currentClass = oldNode ; finishedResolution ( ) ; } private void checkCyclicInheritence ( ClassNode originalNode , ClassNode parentToCompare , ClassNode [ ] interfacesToCompare ) { if ( ! originalNode . isInterface ( ) ) { if ( parentToCompare == null ) return ; if ( originalNode == parentToCompare . redirect ( ) ) { addError ( "<STR_LIT>" + parentToCompare . getName ( ) + "<STR_LIT>" + originalNode . getName ( ) , originalNode ) ; return ; } if ( parentToCompare == ClassHelper . OBJECT_TYPE ) return ; checkCyclicInheritence ( originalNode , parentToCompare . getUnresolvedSuperClass ( ) , null ) ; } else { if ( interfacesToCompare != null && interfacesToCompare . length > <NUM_LIT:0> ) { for ( ClassNode intfToCompare : interfacesToCompare ) { if ( originalNode == intfToCompare . redirect ( ) ) { addError ( "<STR_LIT>" + intfToCompare . getName ( ) + "<STR_LIT>" + originalNode . getName ( ) , originalNode ) ; return ; } } for ( ClassNode intf : interfacesToCompare ) { checkCyclicInheritence ( originalNode , null , intf . getInterfaces ( ) ) ; } } else { return ; } } } protected boolean commencingResolution ( ) { return true ; } protected void finishedResolution ( ) { } public void visitCatchStatement ( CatchStatement cs ) { resolveOrFail ( cs . getExceptionType ( ) , cs ) ; if ( cs . getExceptionType ( ) == ClassHelper . DYNAMIC_TYPE ) { cs . getVariable ( ) . setType ( ClassHelper . make ( Exception . class ) ) ; } super . visitCatchStatement ( cs ) ; } public void visitForLoop ( ForStatement forLoop ) { resolveOrFail ( forLoop . getVariableType ( ) , forLoop ) ; super . visitForLoop ( forLoop ) ; } public void visitBlockStatement ( BlockStatement block ) { VariableScope oldScope = currentScope ; currentScope = block . getVariableScope ( ) ; super . visitBlockStatement ( block ) ; currentScope = oldScope ; } protected SourceUnit getSourceUnit ( ) { return source ; } private void resolveGenericsTypes ( GenericsType [ ] types ) { if ( types == null ) return ; currentClass . setUsingGenerics ( true ) ; for ( int i = <NUM_LIT:0> ; i < types . length ; i ++ ) { resolveGenericsType ( types [ i ] ) ; } } private void resolveGenericsHeader ( GenericsType [ ] types ) { if ( types == null ) return ; currentClass . setUsingGenerics ( true ) ; for ( int i = <NUM_LIT:0> ; i < types . length ; i ++ ) { ClassNode type = types [ i ] . getType ( ) ; String name = types [ i ] . getName ( ) ; ClassNode [ ] bounds = types [ i ] . getUpperBounds ( ) ; if ( bounds != null ) { boolean nameAdded = false ; for ( int j = <NUM_LIT:0> ; j < bounds . length ; j ++ ) { ClassNode upperBound = bounds [ j ] ; if ( ! nameAdded && upperBound != null || ! resolve ( type ) ) { genericParameterNames . put ( name , types [ i ] ) ; types [ i ] . setPlaceholder ( true ) ; type . setRedirect ( upperBound ) ; nameAdded = true ; } resolveOrFail ( upperBound , type ) ; } } else { genericParameterNames . put ( name , types [ i ] ) ; type . setRedirect ( ClassHelper . OBJECT_TYPE ) ; types [ i ] . setPlaceholder ( true ) ; } } } private void resolveGenericsType ( GenericsType genericsType ) { if ( genericsType . isResolved ( ) ) return ; currentClass . setUsingGenerics ( true ) ; ClassNode type = genericsType . getType ( ) ; String name = type . getName ( ) ; ClassNode [ ] bounds = genericsType . getUpperBounds ( ) ; if ( ! genericParameterNames . containsKey ( name ) ) { if ( bounds != null ) { for ( int j = <NUM_LIT:0> ; j < bounds . length ; j ++ ) { ClassNode upperBound = bounds [ j ] ; resolveOrFail ( upperBound , genericsType ) ; type . setRedirect ( upperBound ) ; resolveGenericsTypes ( upperBound . getGenericsTypes ( ) ) ; } } else if ( genericsType . isWildcard ( ) ) { type . setRedirect ( ClassHelper . OBJECT_TYPE ) ; } else { resolveOrFail ( type , genericsType ) ; } } else { GenericsType gt = ( GenericsType ) genericParameterNames . get ( name ) ; type . setRedirect ( gt . getType ( ) ) ; genericsType . setPlaceholder ( true ) ; } if ( genericsType . getLowerBound ( ) != null ) { resolveOrFail ( genericsType . getLowerBound ( ) , genericsType ) ; } resolveGenericsTypes ( type . getGenericsTypes ( ) ) ; genericsType . setResolved ( genericsType . getType ( ) . isResolved ( ) ) ; } } </s>
|
<s> package org . codehaus . groovy . control ; import org . codehaus . groovy . antlr . AntlrParserPluginFactory ; public abstract class ParserPluginFactory { public static ParserPluginFactory newInstance ( boolean useNewParser ) { if ( useNewParser ) { Class type = null ; String name = "<STR_LIT>" ; try { type = Class . forName ( name ) ; } catch ( ClassNotFoundException e ) { try { type = ParserPluginFactory . class . getClassLoader ( ) . loadClass ( name ) ; } catch ( ClassNotFoundException e1 ) { ClassLoader contextClassLoader = Thread . currentThread ( ) . getContextClassLoader ( ) ; if ( contextClassLoader != null ) { try { type = contextClassLoader . loadClass ( name ) ; } catch ( ClassNotFoundException e2 ) { } } } } if ( type != null ) { try { return ( ParserPluginFactory ) type . newInstance ( ) ; } catch ( Exception e ) { throw new RuntimeException ( "<STR_LIT>" + e , e ) ; } } } return new AntlrParserPluginFactory ( ) ; } public abstract ParserPlugin createParserPlugin ( ) ; } </s>
|
<s> package groovy . grape ; import groovy . lang . Grab ; import groovy . lang . Grapes ; import org . codehaus . groovy . ast . * ; import org . codehaus . groovy . ast . expr . * ; import org . codehaus . groovy . ast . stmt . ExpressionStatement ; import org . codehaus . groovy . control . CompilePhase ; import org . codehaus . groovy . control . SourceUnit ; import org . codehaus . groovy . transform . ASTTransformation ; import org . codehaus . groovy . transform . ASTTransformationVisitor ; import org . codehaus . groovy . transform . GroovyASTTransformation ; import java . util . * ; @ GroovyASTTransformation ( phase = CompilePhase . CONVERSION ) public class GrabAnnotationTransformation extends ClassCodeVisitorSupport implements ASTTransformation { private static final String GRAB_CLASS_NAME = Grab . class . getName ( ) ; private static final String GRAB_DOT_NAME = GRAB_CLASS_NAME . substring ( GRAB_CLASS_NAME . lastIndexOf ( "<STR_LIT:.>" ) ) ; private static final String GRAB_SHORT_NAME = GRAB_DOT_NAME . substring ( <NUM_LIT:1> ) ; private static final String GRAPES_CLASS_NAME = Grapes . class . getName ( ) ; private static final String GRAPES_DOT_NAME = GRAPES_CLASS_NAME . substring ( GRAPES_CLASS_NAME . lastIndexOf ( "<STR_LIT:.>" ) ) ; private static final String GRAPES_SHORT_NAME = GRAPES_DOT_NAME . substring ( <NUM_LIT:1> ) ; boolean allowShortGrab ; Set < String > grabAliases ; List < AnnotationNode > grabAnnotations ; boolean allowShortGrapes ; Set < String > grapesAliases ; List < AnnotationNode > grapesAnnotations ; SourceUnit sourceUnit ; public SourceUnit getSourceUnit ( ) { return sourceUnit ; } public void visit ( ASTNode [ ] nodes , SourceUnit source ) { sourceUnit = source ; ModuleNode mn = ( ModuleNode ) nodes [ <NUM_LIT:0> ] ; if ( mn == null ) { return ; } allowShortGrab = true ; allowShortGrapes = true ; grabAliases = new HashSet ( ) ; grapesAliases = new HashSet ( ) ; for ( ImportNode im : ( Collection < ImportNode > ) mn . getImports ( ) ) { String alias = im . getAlias ( ) ; String className = im . getClassName ( ) ; if ( ( className . endsWith ( GRAB_DOT_NAME ) && ( ( alias == null ) || ( alias . length ( ) == <NUM_LIT:0> ) ) ) || ( GRAB_CLASS_NAME . equals ( alias ) ) ) { allowShortGrab = false ; } else if ( GRAB_CLASS_NAME . equals ( className ) ) { grabAliases . add ( im . getAlias ( ) ) ; } if ( ( className . endsWith ( GRAPES_DOT_NAME ) && ( ( alias == null ) || ( alias . length ( ) == <NUM_LIT:0> ) ) ) || ( GRAPES_CLASS_NAME . equals ( alias ) ) ) { allowShortGrapes = false ; } else if ( GRAPES_CLASS_NAME . equals ( className ) ) { grapesAliases . add ( im . getAlias ( ) ) ; } } List < Map < String , Object > > grabMaps = new ArrayList ( ) ; for ( ClassNode classNode : ( Collection < ClassNode > ) sourceUnit . getAST ( ) . getClasses ( ) ) { grabAnnotations = new ArrayList < AnnotationNode > ( ) ; grapesAnnotations = new ArrayList < AnnotationNode > ( ) ; visitClass ( classNode ) ; ClassNode grapeClassNode = new ClassNode ( Grape . class ) ; if ( ! grapesAnnotations . isEmpty ( ) ) { for ( AnnotationNode node : grapesAnnotations ) { Expression init = node . getMember ( "<STR_LIT>" ) ; Expression value = node . getMember ( "<STR_LIT:value>" ) ; if ( value instanceof ListExpression ) { for ( Object o : ( ( ListExpression ) value ) . getExpressions ( ) ) { if ( o instanceof AnnotationConstantExpression ) { if ( ( ( AnnotationConstantExpression ) o ) . getValue ( ) instanceof AnnotationNode ) { AnnotationNode annotation = ( AnnotationNode ) ( ( AnnotationConstantExpression ) o ) . getValue ( ) ; if ( ( init != null ) && ( annotation . getMember ( "<STR_LIT>" ) != null ) ) { annotation . setMember ( "<STR_LIT>" , init ) ; } String name = annotation . getClassNode ( ) . getName ( ) ; if ( ( GRAB_CLASS_NAME . equals ( name ) ) || ( allowShortGrab && GRAB_SHORT_NAME . equals ( name ) ) || ( grabAliases . contains ( name ) ) ) { grabAnnotations . add ( annotation ) ; } } } } } } } if ( ! grabAnnotations . isEmpty ( ) ) { grabAnnotationLoop : for ( AnnotationNode node : grabAnnotations ) { Map < String , Object > grabMap = new HashMap ( ) ; checkForConvenienceForm ( node ) ; for ( String s : new String [ ] { "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT:version>" } ) { if ( node . getMember ( s ) == null ) { addError ( "<STR_LIT>" + s + "<STR_LIT>" + node . getClassNode ( ) . getNameWithoutPackage ( ) + "<STR_LIT>" , node ) ; continue grabAnnotationLoop ; } } grabMap . put ( "<STR_LIT>" , ( ( ConstantExpression ) node . getMember ( "<STR_LIT>" ) ) . getValue ( ) ) ; grabMap . put ( "<STR_LIT>" , ( ( ConstantExpression ) node . getMember ( "<STR_LIT>" ) ) . getValue ( ) ) ; grabMap . put ( "<STR_LIT:version>" , ( ( ConstantExpression ) node . getMember ( "<STR_LIT:version>" ) ) . getValue ( ) ) ; if ( node . getMember ( "<STR_LIT>" ) != null ) grabMap . put ( "<STR_LIT>" , ( ( ConstantExpression ) node . getMember ( "<STR_LIT>" ) ) . getValue ( ) ) ; grabMaps . add ( grabMap ) ; if ( ( node . getMember ( "<STR_LIT>" ) == null ) || ( node . getMember ( "<STR_LIT>" ) == ConstantExpression . TRUE ) ) { List grabInitializers = new ArrayList ( ) ; MapExpression me = new MapExpression ( ) ; me . addMapEntryExpression ( new ConstantExpression ( "<STR_LIT>" ) , node . getMember ( "<STR_LIT>" ) ) ; me . addMapEntryExpression ( new ConstantExpression ( "<STR_LIT>" ) , node . getMember ( "<STR_LIT>" ) ) ; me . addMapEntryExpression ( new ConstantExpression ( "<STR_LIT:version>" ) , node . getMember ( "<STR_LIT:version>" ) ) ; if ( node . getMember ( "<STR_LIT>" ) != null ) me . addMapEntryExpression ( new ConstantExpression ( "<STR_LIT>" ) , node . getMember ( "<STR_LIT>" ) ) ; grabInitializers . add ( new ExpressionStatement ( new StaticMethodCallExpression ( grapeClassNode , "<STR_LIT>" , new ArgumentListExpression ( me ) ) ) ) ; classNode . addStaticInitializerStatements ( grabInitializers , true ) ; } } } } if ( ! grabMaps . isEmpty ( ) ) { Map basicArgs = new HashMap ( ) ; basicArgs . put ( "<STR_LIT>" , sourceUnit . getClassLoader ( ) ) ; try { Grape . grab ( basicArgs , grabMaps . toArray ( new Map [ grabMaps . size ( ) ] ) ) ; ASTTransformationVisitor . addGlobalTransformsAfterGrab ( ) ; } catch ( RuntimeException re ) { source . addException ( re ) ; } } } private void checkForConvenienceForm ( AnnotationNode node ) { Object val = node . getMember ( "<STR_LIT:value>" ) ; if ( val == null || ! ( val instanceof ConstantExpression ) ) return ; Object allParts = ( ( ConstantExpression ) val ) . getValue ( ) ; if ( ! ( allParts instanceof String ) ) return ; String allstr = ( String ) allParts ; if ( allstr . contains ( "<STR_LIT::>" ) ) { String [ ] parts = allstr . split ( "<STR_LIT::>" ) ; if ( parts . length > <NUM_LIT:4> ) return ; if ( parts . length > <NUM_LIT:3> ) node . addMember ( "<STR_LIT>" , new ConstantExpression ( parts [ <NUM_LIT:3> ] ) ) ; if ( parts . length > <NUM_LIT:2> ) node . addMember ( "<STR_LIT:version>" , new ConstantExpression ( parts [ <NUM_LIT:2> ] ) ) ; else node . addMember ( "<STR_LIT:version>" , new ConstantExpression ( "<STR_LIT:*>" ) ) ; node . addMember ( "<STR_LIT>" , new ConstantExpression ( parts [ <NUM_LIT:1> ] ) ) ; node . addMember ( "<STR_LIT>" , new ConstantExpression ( parts [ <NUM_LIT:0> ] ) ) ; } } protected void visitConstructorOrMethod ( MethodNode node , boolean isConstructor ) { super . visitConstructorOrMethod ( node , isConstructor ) ; for ( Parameter param : node . getParameters ( ) ) { visitAnnotations ( param ) ; } } public void visitAnnotations ( AnnotatedNode node ) { super . visitAnnotations ( node ) ; for ( AnnotationNode an : ( Collection < AnnotationNode > ) node . getAnnotations ( ) ) { String name = an . getClassNode ( ) . getName ( ) ; if ( ( GRAB_CLASS_NAME . equals ( name ) ) || ( allowShortGrab && GRAB_SHORT_NAME . equals ( name ) ) || ( grabAliases . contains ( name ) ) ) { grabAnnotations . add ( an ) ; } if ( ( GRAPES_CLASS_NAME . equals ( name ) ) || ( allowShortGrapes && GRAPES_SHORT_NAME . equals ( name ) ) || ( grapesAliases . contains ( name ) ) ) { grapesAnnotations . add ( an ) ; } } } } </s>
|
<s> package org . codehaus . groovy . eclipse ; import java . util . Date ; @ SuppressWarnings ( "<STR_LIT>" ) public class DefaultGroovyLogger implements IGroovyLogger { public void log ( TraceCategory category , String message ) { System . out . println ( category . label + "<STR_LIT:U+0020:U+0020>" + new Date ( ) + "<STR_LIT:U+0020:U+0020>" + message ) ; } public boolean isCategoryEnabled ( TraceCategory category ) { return true ; } } </s>
|
<s> package org . codehaus . groovy . eclipse ; import junit . framework . TestCase ; public class LoggerTest extends TestCase { public void testLoggers ( ) throws Exception { DefaultGroovyLogger l1 = new DefaultGroovyLogger ( ) ; DefaultGroovyLogger l2 = new DefaultGroovyLogger ( ) ; DefaultGroovyLogger l3 = new DefaultGroovyLogger ( ) ; DefaultGroovyLogger l4 = new DefaultGroovyLogger ( ) ; DefaultGroovyLogger l5 = new DefaultGroovyLogger ( ) ; assertTrue ( GroovyLogManager . manager . addLogger ( l1 ) ) ; assertFalse ( GroovyLogManager . manager . addLogger ( l1 ) ) ; assertTrue ( GroovyLogManager . manager . addLogger ( l2 ) ) ; assertFalse ( GroovyLogManager . manager . addLogger ( l2 ) ) ; assertTrue ( GroovyLogManager . manager . addLogger ( l3 ) ) ; assertFalse ( GroovyLogManager . manager . addLogger ( l3 ) ) ; assertTrue ( GroovyLogManager . manager . addLogger ( l4 ) ) ; assertFalse ( GroovyLogManager . manager . addLogger ( l4 ) ) ; assertTrue ( GroovyLogManager . manager . addLogger ( l5 ) ) ; assertFalse ( GroovyLogManager . manager . addLogger ( l5 ) ) ; assertTrue ( GroovyLogManager . manager . removeLogger ( l1 ) ) ; assertFalse ( GroovyLogManager . manager . removeLogger ( l1 ) ) ; assertTrue ( GroovyLogManager . manager . removeLogger ( l2 ) ) ; assertFalse ( GroovyLogManager . manager . removeLogger ( l2 ) ) ; assertTrue ( GroovyLogManager . manager . removeLogger ( l3 ) ) ; assertFalse ( GroovyLogManager . manager . removeLogger ( l3 ) ) ; assertTrue ( GroovyLogManager . manager . removeLogger ( l4 ) ) ; assertFalse ( GroovyLogManager . manager . removeLogger ( l4 ) ) ; assertTrue ( GroovyLogManager . manager . removeLogger ( l5 ) ) ; assertFalse ( GroovyLogManager . manager . removeLogger ( l5 ) ) ; assertTrue ( GroovyLogManager . manager . addLogger ( l1 ) ) ; assertFalse ( GroovyLogManager . manager . addLogger ( l1 ) ) ; assertTrue ( GroovyLogManager . manager . addLogger ( l2 ) ) ; assertFalse ( GroovyLogManager . manager . addLogger ( l2 ) ) ; assertTrue ( GroovyLogManager . manager . addLogger ( l3 ) ) ; assertFalse ( GroovyLogManager . manager . addLogger ( l3 ) ) ; assertTrue ( GroovyLogManager . manager . addLogger ( l4 ) ) ; assertFalse ( GroovyLogManager . manager . addLogger ( l4 ) ) ; assertTrue ( GroovyLogManager . manager . addLogger ( l5 ) ) ; assertFalse ( GroovyLogManager . manager . addLogger ( l5 ) ) ; assertTrue ( GroovyLogManager . manager . removeLogger ( l5 ) ) ; assertFalse ( GroovyLogManager . manager . removeLogger ( l5 ) ) ; assertTrue ( GroovyLogManager . manager . removeLogger ( l4 ) ) ; assertFalse ( GroovyLogManager . manager . removeLogger ( l4 ) ) ; assertTrue ( GroovyLogManager . manager . removeLogger ( l3 ) ) ; assertFalse ( GroovyLogManager . manager . removeLogger ( l3 ) ) ; assertTrue ( GroovyLogManager . manager . removeLogger ( l2 ) ) ; assertFalse ( GroovyLogManager . manager . removeLogger ( l2 ) ) ; assertTrue ( GroovyLogManager . manager . removeLogger ( l1 ) ) ; assertFalse ( GroovyLogManager . manager . removeLogger ( l1 ) ) ; assertTrue ( GroovyLogManager . manager . addLogger ( l1 ) ) ; assertFalse ( GroovyLogManager . manager . addLogger ( l1 ) ) ; assertTrue ( GroovyLogManager . manager . addLogger ( l2 ) ) ; assertFalse ( GroovyLogManager . manager . addLogger ( l2 ) ) ; assertTrue ( GroovyLogManager . manager . addLogger ( l3 ) ) ; assertFalse ( GroovyLogManager . manager . addLogger ( l3 ) ) ; assertTrue ( GroovyLogManager . manager . addLogger ( l4 ) ) ; assertFalse ( GroovyLogManager . manager . addLogger ( l4 ) ) ; assertTrue ( GroovyLogManager . manager . addLogger ( l5 ) ) ; assertFalse ( GroovyLogManager . manager . addLogger ( l5 ) ) ; assertTrue ( GroovyLogManager . manager . removeLogger ( l3 ) ) ; assertFalse ( GroovyLogManager . manager . removeLogger ( l3 ) ) ; assertTrue ( GroovyLogManager . manager . removeLogger ( l2 ) ) ; assertFalse ( GroovyLogManager . manager . removeLogger ( l2 ) ) ; assertTrue ( GroovyLogManager . manager . removeLogger ( l4 ) ) ; assertFalse ( GroovyLogManager . manager . removeLogger ( l4 ) ) ; assertTrue ( GroovyLogManager . manager . removeLogger ( l5 ) ) ; assertFalse ( GroovyLogManager . manager . removeLogger ( l5 ) ) ; assertTrue ( GroovyLogManager . manager . removeLogger ( l1 ) ) ; assertFalse ( GroovyLogManager . manager . removeLogger ( l1 ) ) ; } } </s>
|
<s> package org . codehaus . groovy . eclipse ; public interface IGroovyLogger { void log ( TraceCategory category , String message ) ; boolean isCategoryEnabled ( TraceCategory category ) ; } </s>
|
<s> package org . codehaus . groovy . eclipse ; import java . io . PrintWriter ; import java . io . StringWriter ; import java . util . HashMap ; import java . util . Map ; public class GroovyLogManager { public static final GroovyLogManager manager = new GroovyLogManager ( ) ; private GroovyLogManager ( ) { defaultLogger = new DefaultGroovyLogger ( ) ; timers = new HashMap < String , Long > ( ) ; } private IGroovyLogger [ ] loggers = null ; private IGroovyLogger defaultLogger ; private Map < String , Long > timers ; private boolean useDefaultLogger ; public boolean addLogger ( IGroovyLogger logger ) { int newIndex ; if ( loggers == null ) { loggers = new IGroovyLogger [ <NUM_LIT:1> ] ; newIndex = <NUM_LIT:0> ; } else { for ( IGroovyLogger l : loggers ) { if ( l == logger ) { return false ; } } newIndex = loggers . length ; IGroovyLogger [ ] newLoggers = new IGroovyLogger [ newIndex + <NUM_LIT:1> ] ; System . arraycopy ( loggers , <NUM_LIT:0> , newLoggers , <NUM_LIT:0> , newIndex ) ; loggers = newLoggers ; } loggers [ newIndex ] = logger ; return true ; } public boolean removeLogger ( IGroovyLogger logger ) { if ( logger != null ) { int foundIndex = - <NUM_LIT:1> ; for ( int i = <NUM_LIT:0> ; i < loggers . length ; i ++ ) { if ( loggers [ i ] == logger ) { foundIndex = i ; } } if ( foundIndex >= <NUM_LIT:0> ) { if ( loggers . length > <NUM_LIT:1> ) { IGroovyLogger [ ] newLoggers = new IGroovyLogger [ loggers . length - <NUM_LIT:1> ] ; if ( foundIndex > <NUM_LIT:0> ) { System . arraycopy ( loggers , <NUM_LIT:0> , newLoggers , <NUM_LIT:0> , foundIndex ) ; } System . arraycopy ( loggers , foundIndex + <NUM_LIT:1> , newLoggers , foundIndex , loggers . length - foundIndex - <NUM_LIT:1> ) ; loggers = newLoggers ; } else { loggers = null ; } return true ; } } return false ; } public void logStart ( String event ) { timers . put ( event , System . currentTimeMillis ( ) ) ; } public void logEnd ( String event , TraceCategory category ) { logEnd ( event , category , null ) ; } public void logEnd ( String event , TraceCategory category , String message ) { Long then = timers . get ( event ) ; if ( then != null ) { if ( hasLoggers ( ) ) { long now = System . currentTimeMillis ( ) ; long elapsed = now - then . longValue ( ) ; if ( ( message != null ) && ( message . length ( ) > <NUM_LIT:0> ) ) { log ( category , "<STR_LIT>" + elapsed + "<STR_LIT>" + event + "<STR_LIT:U+0020(>" + message + "<STR_LIT:)>" ) ; } else { log ( category , "<STR_LIT>" + elapsed + "<STR_LIT>" + event ) ; } } timers . remove ( event ) ; } } public void log ( String message ) { log ( TraceCategory . DEFAULT , message ) ; } public void log ( TraceCategory category , String message ) { if ( ! hasLoggers ( ) ) { return ; } if ( loggers != null ) { for ( IGroovyLogger logger : loggers ) { if ( logger . isCategoryEnabled ( category ) ) { logger . log ( category , message ) ; } } } if ( useDefaultLogger ) { defaultLogger . log ( category , message ) ; } } public boolean hasLoggers ( ) { return loggers != null || useDefaultLogger ; } public void setUseDefaultLogger ( boolean useDefaultLogger ) { this . useDefaultLogger = useDefaultLogger ; } public void logException ( Throwable t ) { if ( hasLoggers ( ) ) { StringWriter writer = new StringWriter ( ) ; t . printStackTrace ( new PrintWriter ( writer ) ) ; log ( TraceCategory . DSL , "<STR_LIT>" + writer . getBuffer ( ) ) ; } } } </s>
|
<s> package org . codehaus . groovy . eclipse ; import java . util . Arrays ; @ SuppressWarnings ( "<STR_LIT>" ) public enum TraceCategory { DEFAULT ( "<STR_LIT:_>" ) , CLASSPATH ( "<STR_LIT>" ) , REFACTORING ( "<STR_LIT>" ) , COMPILER ( "<STR_LIT>" ) , DSL ( "<STR_LIT>" ) , CODESELECT ( "<STR_LIT>" ) , CONTENT_ASSIST ( "<STR_LIT>" ) , AST_TRANSFORM ( "<STR_LIT>" ) ; TraceCategory ( String label ) { this . label = label ; } public final String label ; private String paddedLabel ; public String getPaddedLabel ( ) { if ( paddedLabel == null ) { synchronized ( TraceCategory . class ) { if ( longestLabel == - <NUM_LIT:1> ) { calculateLongest ( ) ; } } int extraSpace = longestLabel - label . length ( ) ; paddedLabel = spaces ( extraSpace ) + label ; } return paddedLabel ; } private String spaces ( int extraSpace ) { char [ ] a = new char [ extraSpace ] ; Arrays . fill ( a , '<CHAR_LIT:U+0020>' ) ; return new String ( a ) ; } private static void calculateLongest ( ) { int maybeLongest = longestLabel ; for ( TraceCategory category : values ( ) ) { maybeLongest = Math . max ( category . label . length ( ) , maybeLongest ) ; } longestLabel = maybeLongest ; } private static String [ ] stringValues ; public static String [ ] stringValues ( ) { if ( stringValues == null ) { TraceCategory [ ] values = values ( ) ; stringValues = new String [ values . length ] ; for ( int i = <NUM_LIT:0> ; i < values . length ; i ++ ) { stringValues [ i ] = values [ i ] . label ; } } return stringValues ; } private static int longestLabel = - <NUM_LIT:1> ; } </s>
|
<s> package org . codehaus . groovy . eclipse ; import java . util . Arrays ; @ SuppressWarnings ( "<STR_LIT>" ) public enum TraceCategory { DEFAULT ( "<STR_LIT:_>" ) , CLASSPATH ( "<STR_LIT>" ) , REFACTORING ( "<STR_LIT>" ) , COMPILER ( "<STR_LIT>" ) , DSL ( "<STR_LIT>" ) , CODESELECT ( "<STR_LIT>" ) , CONTENT_ASSIST ( "<STR_LIT>" ) , AST_TRANSFORM ( "<STR_LIT>" ) ; TraceCategory ( String label ) { this . label = label ; } public final String label ; private String paddedLabel ; public String getPaddedLabel ( ) { if ( paddedLabel == null ) { synchronized ( TraceCategory . class ) { if ( longestLabel == - <NUM_LIT:1> ) { calculateLongest ( ) ; } } int extraSpace = longestLabel - label . length ( ) ; paddedLabel = spaces ( extraSpace ) + label ; } return paddedLabel ; } private String spaces ( int extraSpace ) { char [ ] a = new char [ extraSpace ] ; Arrays . fill ( a , '<CHAR_LIT:U+0020>' ) ; return new String ( a ) ; } private static void calculateLongest ( ) { int maybeLongest = longestLabel ; for ( TraceCategory category : values ( ) ) { maybeLongest = Math . max ( category . label . length ( ) , maybeLongest ) ; } longestLabel = maybeLongest ; } private static String [ ] stringValues ; public static String [ ] stringValues ( ) { if ( stringValues == null ) { TraceCategory [ ] values = values ( ) ; stringValues = new String [ values . length ] ; for ( int i = <NUM_LIT:0> ; i < values . length ; i ++ ) { stringValues [ i ] = values [ i ] . label ; } } return stringValues ; } private static int longestLabel = - <NUM_LIT:1> ; } </s>
|
<s> package org . codehaus . groovy . eclipse ; import java . util . Date ; @ SuppressWarnings ( "<STR_LIT>" ) public class DefaultGroovyLogger implements IGroovyLogger { public void log ( TraceCategory category , String message ) { System . out . println ( category . label + "<STR_LIT:U+0020:U+0020>" + new Date ( ) + "<STR_LIT:U+0020:U+0020>" + message ) ; } public boolean isCategoryEnabled ( TraceCategory category ) { return true ; } } </s>
|
<s> package org . codehaus . groovy . eclipse ; import junit . framework . TestCase ; public class LoggerTest extends TestCase { public void testLoggers ( ) throws Exception { DefaultGroovyLogger l1 = new DefaultGroovyLogger ( ) ; DefaultGroovyLogger l2 = new DefaultGroovyLogger ( ) ; DefaultGroovyLogger l3 = new DefaultGroovyLogger ( ) ; DefaultGroovyLogger l4 = new DefaultGroovyLogger ( ) ; DefaultGroovyLogger l5 = new DefaultGroovyLogger ( ) ; assertTrue ( GroovyLogManager . manager . addLogger ( l1 ) ) ; assertFalse ( GroovyLogManager . manager . addLogger ( l1 ) ) ; assertTrue ( GroovyLogManager . manager . addLogger ( l2 ) ) ; assertFalse ( GroovyLogManager . manager . addLogger ( l2 ) ) ; assertTrue ( GroovyLogManager . manager . addLogger ( l3 ) ) ; assertFalse ( GroovyLogManager . manager . addLogger ( l3 ) ) ; assertTrue ( GroovyLogManager . manager . addLogger ( l4 ) ) ; assertFalse ( GroovyLogManager . manager . addLogger ( l4 ) ) ; assertTrue ( GroovyLogManager . manager . addLogger ( l5 ) ) ; assertFalse ( GroovyLogManager . manager . addLogger ( l5 ) ) ; assertTrue ( GroovyLogManager . manager . removeLogger ( l1 ) ) ; assertFalse ( GroovyLogManager . manager . removeLogger ( l1 ) ) ; assertTrue ( GroovyLogManager . manager . removeLogger ( l2 ) ) ; assertFalse ( GroovyLogManager . manager . removeLogger ( l2 ) ) ; assertTrue ( GroovyLogManager . manager . removeLogger ( l3 ) ) ; assertFalse ( GroovyLogManager . manager . removeLogger ( l3 ) ) ; assertTrue ( GroovyLogManager . manager . removeLogger ( l4 ) ) ; assertFalse ( GroovyLogManager . manager . removeLogger ( l4 ) ) ; assertTrue ( GroovyLogManager . manager . removeLogger ( l5 ) ) ; assertFalse ( GroovyLogManager . manager . removeLogger ( l5 ) ) ; assertTrue ( GroovyLogManager . manager . addLogger ( l1 ) ) ; assertFalse ( GroovyLogManager . manager . addLogger ( l1 ) ) ; assertTrue ( GroovyLogManager . manager . addLogger ( l2 ) ) ; assertFalse ( GroovyLogManager . manager . addLogger ( l2 ) ) ; assertTrue ( GroovyLogManager . manager . addLogger ( l3 ) ) ; assertFalse ( GroovyLogManager . manager . addLogger ( l3 ) ) ; assertTrue ( GroovyLogManager . manager . addLogger ( l4 ) ) ; assertFalse ( GroovyLogManager . manager . addLogger ( l4 ) ) ; assertTrue ( GroovyLogManager . manager . addLogger ( l5 ) ) ; assertFalse ( GroovyLogManager . manager . addLogger ( l5 ) ) ; assertTrue ( GroovyLogManager . manager . removeLogger ( l5 ) ) ; assertFalse ( GroovyLogManager . manager . removeLogger ( l5 ) ) ; assertTrue ( GroovyLogManager . manager . removeLogger ( l4 ) ) ; assertFalse ( GroovyLogManager . manager . removeLogger ( l4 ) ) ; assertTrue ( GroovyLogManager . manager . removeLogger ( l3 ) ) ; assertFalse ( GroovyLogManager . manager . removeLogger ( l3 ) ) ; assertTrue ( GroovyLogManager . manager . removeLogger ( l2 ) ) ; assertFalse ( GroovyLogManager . manager . removeLogger ( l2 ) ) ; assertTrue ( GroovyLogManager . manager . removeLogger ( l1 ) ) ; assertFalse ( GroovyLogManager . manager . removeLogger ( l1 ) ) ; assertTrue ( GroovyLogManager . manager . addLogger ( l1 ) ) ; assertFalse ( GroovyLogManager . manager . addLogger ( l1 ) ) ; assertTrue ( GroovyLogManager . manager . addLogger ( l2 ) ) ; assertFalse ( GroovyLogManager . manager . addLogger ( l2 ) ) ; assertTrue ( GroovyLogManager . manager . addLogger ( l3 ) ) ; assertFalse ( GroovyLogManager . manager . addLogger ( l3 ) ) ; assertTrue ( GroovyLogManager . manager . addLogger ( l4 ) ) ; assertFalse ( GroovyLogManager . manager . addLogger ( l4 ) ) ; assertTrue ( GroovyLogManager . manager . addLogger ( l5 ) ) ; assertFalse ( GroovyLogManager . manager . addLogger ( l5 ) ) ; assertTrue ( GroovyLogManager . manager . removeLogger ( l3 ) ) ; assertFalse ( GroovyLogManager . manager . removeLogger ( l3 ) ) ; assertTrue ( GroovyLogManager . manager . removeLogger ( l2 ) ) ; assertFalse ( GroovyLogManager . manager . removeLogger ( l2 ) ) ; assertTrue ( GroovyLogManager . manager . removeLogger ( l4 ) ) ; assertFalse ( GroovyLogManager . manager . removeLogger ( l4 ) ) ; assertTrue ( GroovyLogManager . manager . removeLogger ( l5 ) ) ; assertFalse ( GroovyLogManager . manager . removeLogger ( l5 ) ) ; assertTrue ( GroovyLogManager . manager . removeLogger ( l1 ) ) ; assertFalse ( GroovyLogManager . manager . removeLogger ( l1 ) ) ; } } </s>
|
<s> package org . codehaus . groovy . eclipse ; import java . io . PrintWriter ; import java . io . StringWriter ; import java . util . HashMap ; import java . util . Map ; public class GroovyLogManager { public static final GroovyLogManager manager = new GroovyLogManager ( ) ; private GroovyLogManager ( ) { defaultLogger = new DefaultGroovyLogger ( ) ; timers = new HashMap < String , Long > ( ) ; } private IGroovyLogger [ ] loggers = null ; private IGroovyLogger defaultLogger ; private Map < String , Long > timers ; private boolean useDefaultLogger ; public boolean addLogger ( IGroovyLogger logger ) { int newIndex ; if ( loggers == null ) { loggers = new IGroovyLogger [ <NUM_LIT:1> ] ; newIndex = <NUM_LIT:0> ; } else { for ( IGroovyLogger l : loggers ) { if ( l == logger ) { return false ; } } newIndex = loggers . length ; IGroovyLogger [ ] newLoggers = new IGroovyLogger [ newIndex + <NUM_LIT:1> ] ; System . arraycopy ( loggers , <NUM_LIT:0> , newLoggers , <NUM_LIT:0> , newIndex ) ; loggers = newLoggers ; } loggers [ newIndex ] = logger ; return true ; } public boolean removeLogger ( IGroovyLogger logger ) { if ( logger != null ) { int foundIndex = - <NUM_LIT:1> ; for ( int i = <NUM_LIT:0> ; i < loggers . length ; i ++ ) { if ( loggers [ i ] == logger ) { foundIndex = i ; } } if ( foundIndex >= <NUM_LIT:0> ) { if ( loggers . length > <NUM_LIT:1> ) { IGroovyLogger [ ] newLoggers = new IGroovyLogger [ loggers . length - <NUM_LIT:1> ] ; if ( foundIndex > <NUM_LIT:0> ) { System . arraycopy ( loggers , <NUM_LIT:0> , newLoggers , <NUM_LIT:0> , foundIndex ) ; } System . arraycopy ( loggers , foundIndex + <NUM_LIT:1> , newLoggers , foundIndex , loggers . length - foundIndex - <NUM_LIT:1> ) ; loggers = newLoggers ; } else { loggers = null ; } return true ; } } return false ; } public void logStart ( String event ) { timers . put ( event , System . currentTimeMillis ( ) ) ; } public void logEnd ( String event , TraceCategory category ) { logEnd ( event , category , null ) ; } public void logEnd ( String event , TraceCategory category , String message ) { Long then = timers . get ( event ) ; if ( then != null ) { if ( hasLoggers ( ) ) { long now = System . currentTimeMillis ( ) ; long elapsed = now - then . longValue ( ) ; if ( ( message != null ) && ( message . length ( ) > <NUM_LIT:0> ) ) { log ( category , "<STR_LIT>" + elapsed + "<STR_LIT>" + event + "<STR_LIT:U+0020(>" + message + "<STR_LIT:)>" ) ; } else { log ( category , "<STR_LIT>" + elapsed + "<STR_LIT>" + event ) ; } } timers . remove ( event ) ; } } public void log ( String message ) { log ( TraceCategory . DEFAULT , message ) ; } public void log ( TraceCategory category , String message ) { if ( ! hasLoggers ( ) ) { return ; } if ( loggers != null ) { for ( IGroovyLogger logger : loggers ) { if ( logger . isCategoryEnabled ( category ) ) { logger . log ( category , message ) ; } } } if ( useDefaultLogger ) { defaultLogger . log ( category , message ) ; } } public boolean hasLoggers ( ) { return loggers != null || useDefaultLogger ; } public void setUseDefaultLogger ( boolean useDefaultLogger ) { this . useDefaultLogger = useDefaultLogger ; } public void logException ( TraceCategory cat , Throwable t ) { if ( hasLoggers ( ) ) { StringWriter writer = new StringWriter ( ) ; t . printStackTrace ( new PrintWriter ( writer ) ) ; log ( cat , "<STR_LIT>" + writer . getBuffer ( ) ) ; } } } </s>
|
<s> package org . codehaus . groovy . eclipse ; public interface IGroovyLogger { void log ( TraceCategory category , String message ) ; boolean isCategoryEnabled ( TraceCategory category ) ; } </s>
|
<s> package org . codehaus . groovy . antlr ; import java . util . ArrayList ; import java . util . List ; public class LocationSupport { private static final int [ ] NO_LINE_ENDINGS = new int [ <NUM_LIT:0> ] ; public static final LocationSupport NO_LOCATIONS = new LocationSupport ( ) ; private final int [ ] lineEndings ; public LocationSupport ( char [ ] contents ) { if ( contents != null ) { lineEndings = processLineEndings ( contents ) ; } else { lineEndings = NO_LINE_ENDINGS ; } } public LocationSupport ( List < StringBuffer > lines ) { if ( lines != null ) { lineEndings = processLineEndings ( lines ) ; } else { lineEndings = NO_LINE_ENDINGS ; } } public LocationSupport ( int [ ] lineEndings ) { this . lineEndings = lineEndings ; } public LocationSupport ( ) { lineEndings = NO_LINE_ENDINGS ; } private int [ ] processLineEndings ( List < StringBuffer > lines ) { int [ ] newLineEndings = new int [ lines . size ( ) + <NUM_LIT:1> ] ; int total = <NUM_LIT:0> ; int current = <NUM_LIT:1> ; for ( StringBuffer line : lines ) { newLineEndings [ current ++ ] = total += ( line . length ( ) ) ; } return newLineEndings ; } private int [ ] processLineEndings ( char [ ] contents ) { List < Integer > l = new ArrayList < Integer > ( ) ; for ( int i = <NUM_LIT:0> ; i < contents . length ; i ++ ) { if ( contents [ i ] == '<STR_LIT:\n>' ) { l . add ( i ) ; } else if ( contents [ i ] == '<STR_LIT>' ) { l . add ( i ) ; if ( i < contents . length && contents [ i ] == '<STR_LIT:\n>' ) { i ++ ; } } } int [ ] newLineEndings = new int [ l . size ( ) ] ; int i = <NUM_LIT:0> ; for ( Integer integer : l ) { newLineEndings [ i ] = integer . intValue ( ) ; } return newLineEndings ; } public int findOffset ( int row , int col ) { return row <= lineEndings . length && row > <NUM_LIT:0> ? lineEndings [ row - <NUM_LIT:1> ] + col - <NUM_LIT:1> : <NUM_LIT:0> ; } public int getEnd ( ) { return lineEndings . length > <NUM_LIT:0> ? lineEndings [ lineEndings . length - <NUM_LIT:1> ] : <NUM_LIT:0> ; } public int getEndColumn ( ) { if ( lineEndings . length > <NUM_LIT:1> ) { return lineEndings [ lineEndings . length - <NUM_LIT:1> ] - lineEndings [ lineEndings . length - <NUM_LIT:2> ] ; } else if ( lineEndings . length > <NUM_LIT:0> ) { return lineEndings [ <NUM_LIT:0> ] ; } else { return <NUM_LIT:0> ; } } public int getEndLine ( ) { return lineEndings . length > <NUM_LIT:0> ? lineEndings . length - <NUM_LIT:1> : <NUM_LIT:0> ; } public int [ ] getRowCol ( int offset ) { for ( int i = <NUM_LIT:1> ; i < lineEndings . length ; i ++ ) { if ( lineEndings [ i ] > offset ) { return new int [ ] { i , offset - lineEndings [ i - <NUM_LIT:1> ] + <NUM_LIT:1> } ; } } throw new RuntimeException ( "<STR_LIT>" + offset ) ; } public boolean isPopulated ( ) { return lineEndings . length > <NUM_LIT:0> ; } } </s>
|
<s> package org . codehaus . groovy . antlr ; import java . util . List ; import org . codehaus . groovy . antlr . GroovySourceAST ; public interface ICSTReporter { public void generatedCST ( String fileName , GroovySourceAST ast ) ; public void reportErrors ( String fileName , List errors ) ; } </s>
|
<s> package org . codehaus . groovy . antlr ; import java . io . Reader ; class NoEscaper extends UnicodeEscapingReader { public NoEscaper ( ) { super ( null , null ) ; } public int getUnescapedUnicodeColumnCount ( ) { return <NUM_LIT:0> ; } public int getUnescapedUnicodeOffsetCount ( ) { return <NUM_LIT:0> ; } } </s>
|
<s> package org . codehaus . groovy . antlr ; import java . io . IOException ; import java . io . Reader ; import antlr . CharScanner ; import antlr . Token ; import antlr . TokenStreamException ; public class UnicodeEscapingReader extends Reader { private final Reader reader ; private CharScanner lexer ; private boolean hasNextChar = false ; private int nextChar ; private final SourceBuffer sourceBuffer ; private int previousLine ; private int numUnicodeEscapesFound = <NUM_LIT:0> ; private int numUnicodeEscapesFoundOnCurrentLine = <NUM_LIT:0> ; private static class DummyLexer extends CharScanner { final private Token t = new Token ( ) ; public Token nextToken ( ) throws TokenStreamException { return t ; } @ Override public int getColumn ( ) { return <NUM_LIT:0> ; } @ Override public int getLine ( ) { return <NUM_LIT:0> ; } } public UnicodeEscapingReader ( Reader reader , SourceBuffer sourceBuffer ) { this . reader = reader ; this . sourceBuffer = sourceBuffer ; if ( sourceBuffer != null ) { sourceBuffer . setUnescaper ( this ) ; } this . lexer = new DummyLexer ( ) ; } public void setLexer ( CharScanner lexer ) { this . lexer = lexer ; } public int read ( char cbuf [ ] , int off , int len ) throws IOException { int c = <NUM_LIT:0> ; int count = <NUM_LIT:0> ; while ( count < len && ( c = read ( ) ) != - <NUM_LIT:1> ) { cbuf [ off + count ] = ( char ) c ; count ++ ; } return ( count == <NUM_LIT:0> && c == - <NUM_LIT:1> ) ? - <NUM_LIT:1> : count ; } public int read ( ) throws IOException { if ( hasNextChar ) { hasNextChar = false ; write ( nextChar ) ; return nextChar ; } if ( previousLine != lexer . getLine ( ) ) { numUnicodeEscapesFoundOnCurrentLine = <NUM_LIT:0> ; previousLine = lexer . getLine ( ) ; } int c = reader . read ( ) ; if ( c != '<STR_LIT:\\>' ) { write ( c ) ; return c ; } c = reader . read ( ) ; if ( c != '<CHAR_LIT>' ) { hasNextChar = true ; nextChar = c ; write ( '<STR_LIT:\\>' ) ; return '<STR_LIT:\\>' ; } int numberOfUChars = <NUM_LIT:0> ; do { numberOfUChars ++ ; c = reader . read ( ) ; } while ( c == '<CHAR_LIT>' ) ; checkHexDigit ( c ) ; StringBuffer charNum = new StringBuffer ( ) ; charNum . append ( ( char ) c ) ; for ( int i = <NUM_LIT:0> ; i < <NUM_LIT:3> ; i ++ ) { c = reader . read ( ) ; checkHexDigit ( c ) ; charNum . append ( ( char ) c ) ; } int rv = Integer . parseInt ( charNum . toString ( ) , <NUM_LIT:16> ) ; write ( rv ) ; numUnicodeEscapesFound += <NUM_LIT:4> + numberOfUChars ; numUnicodeEscapesFoundOnCurrentLine += <NUM_LIT:4> + numberOfUChars ; return rv ; } private void write ( int c ) { if ( sourceBuffer != null ) { sourceBuffer . write ( c ) ; } } private void checkHexDigit ( int c ) throws IOException { if ( c >= '<CHAR_LIT:0>' && c <= '<CHAR_LIT:9>' ) { return ; } if ( c >= '<CHAR_LIT:a>' && c <= '<CHAR_LIT>' ) { return ; } if ( c >= '<CHAR_LIT:A>' && c <= '<CHAR_LIT>' ) { return ; } hasNextChar = true ; nextChar = c ; throw new IOException ( "<STR_LIT>" + "<STR_LIT>" + lexer . getLine ( ) + "<STR_LIT>" + lexer . getColumn ( ) ) ; } public int getUnescapedUnicodeColumnCount ( ) { return numUnicodeEscapesFoundOnCurrentLine ; } public int getUnescapedUnicodeOffsetCount ( ) { return numUnicodeEscapesFound ; } public void close ( ) throws IOException { reader . close ( ) ; } } </s>
|
<s> package org . codehaus . groovy . antlr . parser ; import org . codehaus . groovy . antlr . * ; import java . util . * ; import java . io . InputStream ; import java . io . Reader ; import antlr . InputBuffer ; import antlr . LexerSharedInputState ; import antlr . CommonToken ; import org . codehaus . groovy . GroovyBugError ; import antlr . TokenStreamRecognitionException ; import org . codehaus . groovy . ast . Comment ; import java . io . InputStream ; import antlr . TokenStreamException ; import antlr . TokenStreamIOException ; import antlr . TokenStreamRecognitionException ; import antlr . CharStreamException ; import antlr . CharStreamIOException ; import antlr . ANTLRException ; import java . io . Reader ; import java . util . Hashtable ; import antlr . CharScanner ; import antlr . InputBuffer ; import antlr . ByteBuffer ; import antlr . CharBuffer ; import antlr . Token ; import antlr . CommonToken ; import antlr . RecognitionException ; import antlr . NoViableAltForCharException ; import antlr . MismatchedCharException ; import antlr . TokenStream ; import antlr . ANTLRHashString ; import antlr . LexerSharedInputState ; import antlr . collections . impl . BitSet ; import antlr . SemanticException ; public class GroovyLexer extends antlr . CharScanner implements GroovyTokenTypes , TokenStream { private boolean assertEnabled = true ; private boolean enumEnabled = true ; private boolean whitespaceIncluded = false ; public void enableAssert ( boolean shouldEnable ) { assertEnabled = shouldEnable ; } public boolean isAssertEnabled ( ) { return assertEnabled ; } public void enableEnum ( boolean shouldEnable ) { enumEnabled = shouldEnable ; } public boolean isEnumEnabled ( ) { return enumEnabled ; } public void setWhitespaceIncluded ( boolean z ) { whitespaceIncluded = z ; } public boolean isWhitespaceIncluded ( ) { return whitespaceIncluded ; } { setTabSize ( <NUM_LIT:1> ) ; } protected int parenLevel = <NUM_LIT:0> ; protected int suppressNewline = <NUM_LIT:0> ; protected static final int SCS_TYPE = <NUM_LIT:3> , SCS_VAL = <NUM_LIT:4> , SCS_LIT = <NUM_LIT:8> , SCS_LIMIT = <NUM_LIT:16> ; protected static final int SCS_SQ_TYPE = <NUM_LIT:0> , SCS_TQ_TYPE = <NUM_LIT:1> , SCS_RE_TYPE = <NUM_LIT:2> , SCS_DRE_TYPE = <NUM_LIT:3> ; protected int stringCtorState = <NUM_LIT:0> ; protected ArrayList parenLevelStack = new ArrayList ( ) ; protected int lastSigTokenType = EOF ; public void setTokenObjectClass ( String name ) { } protected Token makeToken ( int t ) { GroovySourceToken tok = new GroovySourceToken ( t ) ; tok . setColumn ( inputState . getTokenStartColumn ( ) ) ; tok . setLine ( inputState . getTokenStartLine ( ) ) ; tok . setColumnLast ( inputState . getColumn ( ) ) ; tok . setLineLast ( inputState . getLine ( ) ) ; return tok ; } protected void pushParenLevel ( ) { parenLevelStack . add ( Integer . valueOf ( parenLevel * SCS_LIMIT + stringCtorState ) ) ; parenLevel = <NUM_LIT:0> ; stringCtorState = <NUM_LIT:0> ; } protected void popParenLevel ( ) { int npl = parenLevelStack . size ( ) ; if ( npl == <NUM_LIT:0> ) return ; int i = ( ( Integer ) parenLevelStack . remove ( -- npl ) ) . intValue ( ) ; parenLevel = i / SCS_LIMIT ; stringCtorState = i % SCS_LIMIT ; } protected void restartStringCtor ( boolean expectLiteral ) { if ( stringCtorState != <NUM_LIT:0> ) { stringCtorState = ( expectLiteral ? SCS_LIT : SCS_VAL ) + ( stringCtorState & SCS_TYPE ) ; } } protected boolean allowRegexpLiteral ( ) { return ! isExpressionEndingToken ( lastSigTokenType ) ; } protected static boolean isExpressionEndingToken ( int ttype ) { switch ( ttype ) { case INC : case DEC : case RPAREN : case RBRACK : case RCURLY : case STRING_LITERAL : case STRING_CTOR_END : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : case IDENT : case LITERAL_as : case LITERAL_assert : case LITERAL_boolean : case LITERAL_break : case LITERAL_byte : case LITERAL_case : case LITERAL_catch : case LITERAL_char : case LITERAL_class : case LITERAL_continue : case LITERAL_def : case LITERAL_default : case LITERAL_double : case LITERAL_else : case LITERAL_enum : case LITERAL_extends : case LITERAL_false : case LITERAL_finally : case LITERAL_float : case LITERAL_for : case LITERAL_if : case LITERAL_implements : case LITERAL_import : case LITERAL_in : case LITERAL_instanceof : case LITERAL_int : case LITERAL_interface : case LITERAL_long : case LITERAL_native : case LITERAL_new : case LITERAL_null : case LITERAL_package : case LITERAL_private : case LITERAL_protected : case LITERAL_public : case LITERAL_return : case LITERAL_short : case LITERAL_static : case LITERAL_super : case LITERAL_switch : case LITERAL_synchronized : case LITERAL_this : case LITERAL_threadsafe : case LITERAL_throw : case LITERAL_throws : case LITERAL_transient : case LITERAL_true : case LITERAL_try : case LITERAL_void : case LITERAL_volatile : case LITERAL_while : return true ; default : return false ; } } protected void newlineCheck ( boolean check ) throws RecognitionException { if ( check && suppressNewline > <NUM_LIT:0> ) { require ( suppressNewline == <NUM_LIT:0> , "<STR_LIT>" , "<STR_LIT>" ) ; suppressNewline = <NUM_LIT:0> ; } newline ( ) ; } protected boolean atValidDollarEscape ( ) throws CharStreamException { int k = <NUM_LIT:1> ; char lc = LA ( k ++ ) ; if ( lc != '<CHAR_LIT>' ) return false ; lc = LA ( k ++ ) ; if ( lc == '<CHAR_LIT>' ) lc = LA ( k ++ ) ; return ( lc == '<CHAR_LIT>' || ( lc != '<CHAR_LIT>' && Character . isJavaIdentifierStart ( lc ) ) ) ; } protected boolean atDollarDollarEscape ( ) throws CharStreamException { return LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' && LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' ; } protected boolean atDollarSlashEscape ( ) throws CharStreamException { return LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' && LA ( <NUM_LIT:2> ) == '<CHAR_LIT:/>' ; } public TokenStream plumb ( ) { return new TokenStream ( ) { public Token nextToken ( ) throws TokenStreamException { if ( stringCtorState >= SCS_LIT ) { int quoteType = ( stringCtorState & SCS_TYPE ) ; stringCtorState = <NUM_LIT:0> ; resetText ( ) ; try { switch ( quoteType ) { case SCS_SQ_TYPE : mSTRING_CTOR_END ( true , false , false ) ; break ; case SCS_TQ_TYPE : mSTRING_CTOR_END ( true , false , true ) ; break ; case SCS_RE_TYPE : mREGEXP_CTOR_END ( true , false ) ; break ; case SCS_DRE_TYPE : mDOLLAR_REGEXP_CTOR_END ( true , false ) ; break ; default : throw new AssertionError ( false ) ; } lastSigTokenType = _returnToken . getType ( ) ; return _returnToken ; } catch ( RecognitionException e ) { throw new TokenStreamRecognitionException ( e ) ; } catch ( CharStreamException cse ) { if ( cse instanceof CharStreamIOException ) { throw new TokenStreamIOException ( ( ( CharStreamIOException ) cse ) . io ) ; } else { throw new TokenStreamException ( cse . getMessage ( ) ) ; } } } Token token = GroovyLexer . this . nextToken ( ) ; int lasttype = token . getType ( ) ; if ( whitespaceIncluded ) { switch ( lasttype ) { case WS : case ONE_NL : case SL_COMMENT : case ML_COMMENT : lasttype = lastSigTokenType ; } } lastSigTokenType = lasttype ; return token ; } } ; } public static boolean tracing = false ; public void traceIn ( String rname ) throws CharStreamException { if ( ! GroovyLexer . tracing ) return ; super . traceIn ( rname ) ; } public void traceOut ( String rname ) throws CharStreamException { if ( ! GroovyLexer . tracing ) return ; if ( _returnToken != null ) rname += tokenStringOf ( _returnToken ) ; super . traceOut ( rname ) ; } private static java . util . HashMap ttypes ; private static String tokenStringOf ( Token t ) { if ( ttypes == null ) { java . util . HashMap map = new java . util . HashMap ( ) ; java . lang . reflect . Field [ ] fields = GroovyTokenTypes . class . getDeclaredFields ( ) ; for ( int i = <NUM_LIT:0> ; i < fields . length ; i ++ ) { if ( fields [ i ] . getType ( ) != int . class ) continue ; try { map . put ( fields [ i ] . get ( null ) , fields [ i ] . getName ( ) ) ; } catch ( IllegalAccessException ee ) { } } ttypes = map ; } Integer tt = Integer . valueOf ( t . getType ( ) ) ; Object ttn = ttypes . get ( tt ) ; if ( ttn == null ) ttn = "<STR_LIT:<>" + tt + "<STR_LIT:>>" ; return "<STR_LIT:[>" + ttn + "<STR_LIT>" + t . getText ( ) + "<STR_LIT>" ; } protected GroovyRecognizer parser ; private void require ( boolean z , String problem , String solution ) throws SemanticException { if ( ! z ) parser . requireFailed ( problem , solution ) ; } public GroovyLexer ( InputStream in ) { this ( new ByteBuffer ( in ) ) ; } public GroovyLexer ( Reader in ) { this ( new CharBuffer ( in ) ) ; } public GroovyLexer ( InputBuffer ib ) { this ( new LexerSharedInputState ( ib ) ) ; } public GroovyLexer ( LexerSharedInputState state ) { super ( state ) ; caseSensitiveLiterals = true ; setCaseSensitive ( true ) ; literals = new Hashtable ( ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT:float>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT:null>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT:class>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT:double>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT:int>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT:boolean>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT:default>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT:false>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT:true>" , this ) , new Integer ( <NUM_LIT> ) ) ; literals . put ( new ANTLRHashString ( "<STR_LIT:long>" , this ) , new Integer ( <NUM_LIT> ) ) ; } public Token nextToken ( ) throws TokenStreamException { Token theRetToken = null ; tryAgain : for ( ; ; ) { Token _token = null ; int _ttype = Token . INVALID_TYPE ; resetText ( ) ; try { try { switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT:(>' : { mLPAREN ( true ) ; theRetToken = _returnToken ; break ; } case '<CHAR_LIT:)>' : { mRPAREN ( true ) ; theRetToken = _returnToken ; break ; } case '<CHAR_LIT:[>' : { mLBRACK ( true ) ; theRetToken = _returnToken ; break ; } case '<CHAR_LIT:]>' : { mRBRACK ( true ) ; theRetToken = _returnToken ; break ; } case '<CHAR_LIT>' : { mLCURLY ( true ) ; theRetToken = _returnToken ; break ; } case '<CHAR_LIT:}>' : { mRCURLY ( true ) ; theRetToken = _returnToken ; break ; } case '<CHAR_LIT::>' : { mCOLON ( true ) ; theRetToken = _returnToken ; break ; } case '<CHAR_LIT:U+002C>' : { mCOMMA ( true ) ; theRetToken = _returnToken ; break ; } case '<CHAR_LIT>' : { mBNOT ( true ) ; theRetToken = _returnToken ; break ; } case '<CHAR_LIT:;>' : { mSEMI ( true ) ; theRetToken = _returnToken ; break ; } case '<STR_LIT:\t>' : case '<CHAR_LIT>' : case '<CHAR_LIT:U+0020>' : case '<STR_LIT:\\>' : { mWS ( true ) ; theRetToken = _returnToken ; break ; } case '<STR_LIT:\n>' : case '<STR_LIT>' : { mNLS ( true ) ; theRetToken = _returnToken ; break ; } case '<CHAR_LIT:">' : case '<STR_LIT>' : { mSTRING_LITERAL ( true ) ; theRetToken = _returnToken ; break ; } case '<CHAR_LIT:0>' : case '<CHAR_LIT:1>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT:9>' : { mNUM_INT ( true ) ; theRetToken = _returnToken ; break ; } case '<CHAR_LIT>' : { mAT ( true ) ; theRetToken = _returnToken ; break ; } default : if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:>>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:>>' ) && ( LA ( <NUM_LIT:3> ) == '<CHAR_LIT:>>' ) && ( LA ( <NUM_LIT:4> ) == '<CHAR_LIT:=>' ) ) { mBSR_ASSIGN ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:=>' ) && ( LA ( <NUM_LIT:3> ) == '<CHAR_LIT:>>' ) ) { mCOMPARE_TO ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:=>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:=>' ) && ( LA ( <NUM_LIT:3> ) == '<CHAR_LIT:=>' ) ) { mIDENTICAL ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:=>' ) && ( LA ( <NUM_LIT:3> ) == '<CHAR_LIT:=>' ) ) { mNOT_IDENTICAL ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:>>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:>>' ) && ( LA ( <NUM_LIT:3> ) == '<CHAR_LIT:=>' ) ) { mSR_ASSIGN ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:>>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:>>' ) && ( LA ( <NUM_LIT:3> ) == '<CHAR_LIT:>>' ) && ( true ) ) { mBSR ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:3> ) == '<CHAR_LIT:=>' ) ) { mSL_ASSIGN ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:.>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:.>' ) && ( LA ( <NUM_LIT:3> ) == '<CHAR_LIT>' ) ) { mRANGE_EXCLUSIVE ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:.>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:.>' ) && ( LA ( <NUM_LIT:3> ) == '<CHAR_LIT:.>' ) ) { mTRIPLE_DOT ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:=>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:=>' ) && ( LA ( <NUM_LIT:3> ) == '<CHAR_LIT>' ) ) { mREGEX_MATCH ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:3> ) == '<CHAR_LIT:=>' ) ) { mSTAR_STAR_ASSIGN ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:=>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:=>' ) && ( true ) ) { mEQUAL ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:=>' ) && ( true ) ) { mNOT_EQUAL ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:=>' ) ) { mPLUS_ASSIGN ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' ) ) { mINC ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:->' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:=>' ) ) { mMINUS_ASSIGN ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:->' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:->' ) ) { mDEC ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:=>' ) ) { mSTAR_ASSIGN ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:=>' ) ) { mMOD_ASSIGN ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:>>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:>>' ) && ( true ) ) { mSR ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:>>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:=>' ) ) { mGE ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' ) && ( true ) ) { mSL ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:=>' ) && ( true ) ) { mLE ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:=>' ) ) { mBXOR_ASSIGN ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:=>' ) ) { mBOR_ASSIGN ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' ) ) { mLOR ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:=>' ) ) { mBAND_ASSIGN ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' ) ) { mLAND ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:.>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:.>' ) && ( true ) ) { mRANGE_INCLUSIVE ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:.>' ) ) { mSPREAD_DOT ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:.>' ) ) { mOPTIONAL_DOT ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT::>' ) ) { mELVIS_OPERATOR ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:.>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' ) ) { mMEMBER_POINTER ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:=>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' ) ) { mREGEX_FIND ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' ) && ( true ) ) { mSTAR_STAR ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:->' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:>>' ) ) { mCLOSABLE_BLOCK_OP ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:/>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:/>' ) ) { mSL_COMMENT ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:/>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' ) ) { mML_COMMENT ( true ) ; theRetToken = _returnToken ; } else if ( ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:/>' ) ) && ( allowRegexpLiteral ( ) ) ) { mDOLLAR_REGEXP_LITERAL ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( true ) ) { mQUESTION ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:.>' ) && ( true ) ) { mDOT ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:=>' ) && ( true ) ) { mASSIGN ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( true ) ) { mLNOT ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( true ) ) { mPLUS ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:->' ) && ( true ) ) { mMINUS ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( true ) ) { mSTAR ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( true ) ) { mMOD ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:>>' ) && ( true ) ) { mGT ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( true ) ) { mLT ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( true ) ) { mBXOR ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( true ) ) { mBOR ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( true ) ) { mBAND ( true ) ; theRetToken = _returnToken ; } else if ( ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) ) && ( getLine ( ) == <NUM_LIT:1> && getColumn ( ) == <NUM_LIT:1> ) ) { mSH_COMMENT ( true ) ; theRetToken = _returnToken ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:/>' ) && ( true ) ) { mREGEXP_LITERAL ( true ) ; theRetToken = _returnToken ; } else if ( ( _tokenSet_0 . member ( LA ( <NUM_LIT:1> ) ) ) && ( true ) ) { mIDENT ( true ) ; theRetToken = _returnToken ; } else { if ( LA ( <NUM_LIT:1> ) == EOF_CHAR ) { uponEOF ( ) ; _returnToken = makeToken ( Token . EOF_TYPE ) ; } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } } if ( _returnToken == null ) continue tryAgain ; _ttype = _returnToken . getType ( ) ; _returnToken . setType ( _ttype ) ; return _returnToken ; } catch ( RecognitionException e ) { throw new TokenStreamRecognitionException ( e ) ; } } catch ( CharStreamException cse ) { if ( cse instanceof CharStreamIOException ) { throw new TokenStreamIOException ( ( ( CharStreamIOException ) cse ) . io ) ; } else { throw new TokenStreamException ( cse . getMessage ( ) ) ; } } } } public final void mQUESTION ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = QUESTION ; int _saveIndex ; match ( '<CHAR_LIT>' ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mLPAREN ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = LPAREN ; int _saveIndex ; match ( '<CHAR_LIT:(>' ) ; if ( inputState . guessing == <NUM_LIT:0> ) { ++ parenLevel ; } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mRPAREN ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = RPAREN ; int _saveIndex ; match ( '<CHAR_LIT:)>' ) ; if ( inputState . guessing == <NUM_LIT:0> ) { -- parenLevel ; } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mLBRACK ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = LBRACK ; int _saveIndex ; match ( '<CHAR_LIT:[>' ) ; if ( inputState . guessing == <NUM_LIT:0> ) { ++ parenLevel ; } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mRBRACK ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = RBRACK ; int _saveIndex ; match ( '<CHAR_LIT:]>' ) ; if ( inputState . guessing == <NUM_LIT:0> ) { -- parenLevel ; } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mLCURLY ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = LCURLY ; int _saveIndex ; match ( '<CHAR_LIT>' ) ; if ( inputState . guessing == <NUM_LIT:0> ) { pushParenLevel ( ) ; } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mRCURLY ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = RCURLY ; int _saveIndex ; match ( '<CHAR_LIT:}>' ) ; if ( inputState . guessing == <NUM_LIT:0> ) { popParenLevel ( ) ; if ( stringCtorState != <NUM_LIT:0> ) restartStringCtor ( true ) ; } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mCOLON ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = COLON ; int _saveIndex ; match ( '<CHAR_LIT::>' ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mCOMMA ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = COMMA ; int _saveIndex ; match ( '<CHAR_LIT:U+002C>' ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mDOT ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = DOT ; int _saveIndex ; match ( '<CHAR_LIT:.>' ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mASSIGN ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = ASSIGN ; int _saveIndex ; match ( '<CHAR_LIT:=>' ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mCOMPARE_TO ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = COMPARE_TO ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mEQUAL ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = EQUAL ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mIDENTICAL ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = IDENTICAL ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mLNOT ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = LNOT ; int _saveIndex ; match ( '<CHAR_LIT>' ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mBNOT ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = BNOT ; int _saveIndex ; match ( '<CHAR_LIT>' ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mNOT_EQUAL ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = NOT_EQUAL ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mNOT_IDENTICAL ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = NOT_IDENTICAL ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } protected final void mDIV ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = DIV ; int _saveIndex ; match ( '<CHAR_LIT:/>' ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } protected final void mDIV_ASSIGN ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = DIV_ASSIGN ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mPLUS ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = PLUS ; int _saveIndex ; match ( '<CHAR_LIT>' ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mPLUS_ASSIGN ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = PLUS_ASSIGN ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mINC ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = INC ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mMINUS ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = MINUS ; int _saveIndex ; match ( '<CHAR_LIT:->' ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mMINUS_ASSIGN ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = MINUS_ASSIGN ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mDEC ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = DEC ; int _saveIndex ; match ( "<STR_LIT:-->" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mSTAR ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = STAR ; int _saveIndex ; match ( '<CHAR_LIT>' ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mSTAR_ASSIGN ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = STAR_ASSIGN ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mMOD ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = MOD ; int _saveIndex ; match ( '<CHAR_LIT>' ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mMOD_ASSIGN ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = MOD_ASSIGN ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mSR ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = SR ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mSR_ASSIGN ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = SR_ASSIGN ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mBSR ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = BSR ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mBSR_ASSIGN ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = BSR_ASSIGN ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mGE ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = GE ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mGT ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = GT ; int _saveIndex ; match ( "<STR_LIT:>>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mSL ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = SL ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mSL_ASSIGN ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = SL_ASSIGN ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mLE ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = LE ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mLT ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = LT ; int _saveIndex ; match ( '<CHAR_LIT>' ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mBXOR ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = BXOR ; int _saveIndex ; match ( '<CHAR_LIT>' ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mBXOR_ASSIGN ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = BXOR_ASSIGN ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mBOR ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = BOR ; int _saveIndex ; match ( '<CHAR_LIT>' ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mBOR_ASSIGN ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = BOR_ASSIGN ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mLOR ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = LOR ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mBAND ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = BAND ; int _saveIndex ; match ( '<CHAR_LIT>' ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mBAND_ASSIGN ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = BAND_ASSIGN ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mLAND ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = LAND ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mSEMI ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = SEMI ; int _saveIndex ; match ( '<CHAR_LIT:;>' ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } protected final void mDOLLAR ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = DOLLAR ; int _saveIndex ; match ( '<CHAR_LIT>' ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mRANGE_INCLUSIVE ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = RANGE_INCLUSIVE ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mRANGE_EXCLUSIVE ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = RANGE_EXCLUSIVE ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mTRIPLE_DOT ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = TRIPLE_DOT ; int _saveIndex ; match ( "<STR_LIT:...>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mSPREAD_DOT ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = SPREAD_DOT ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mOPTIONAL_DOT ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = OPTIONAL_DOT ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mELVIS_OPERATOR ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = ELVIS_OPERATOR ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mMEMBER_POINTER ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = MEMBER_POINTER ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mREGEX_FIND ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = REGEX_FIND ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mREGEX_MATCH ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = REGEX_MATCH ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mSTAR_STAR ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = STAR_STAR ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mSTAR_STAR_ASSIGN ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = STAR_STAR_ASSIGN ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mCLOSABLE_BLOCK_OP ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = CLOSABLE_BLOCK_OP ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mWS ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = WS ; int _saveIndex ; { int _cnt653 = <NUM_LIT:0> ; _loop653 : do { if ( ( LA ( <NUM_LIT:1> ) == '<STR_LIT:\\>' ) && ( LA ( <NUM_LIT:2> ) == '<STR_LIT:\n>' || LA ( <NUM_LIT:2> ) == '<STR_LIT>' ) && ( true ) && ( true ) ) { match ( '<STR_LIT:\\>' ) ; mONE_NL ( false , false ) ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:U+0020>' ) && ( true ) && ( true ) && ( true ) ) { match ( '<CHAR_LIT:U+0020>' ) ; } else if ( ( LA ( <NUM_LIT:1> ) == '<STR_LIT:\t>' ) && ( true ) && ( true ) && ( true ) ) { match ( '<STR_LIT:\t>' ) ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( true ) && ( true ) && ( true ) ) { match ( '<STR_LIT>' ) ; } else { if ( _cnt653 >= <NUM_LIT:1> ) { break _loop653 ; } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } _cnt653 ++ ; } while ( true ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { if ( ! whitespaceIncluded ) _ttype = Token . SKIP ; } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } protected final void mONE_NL ( boolean _createToken , boolean check ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = ONE_NL ; int _saveIndex ; { if ( ( LA ( <NUM_LIT:1> ) == '<STR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<STR_LIT:\n>' ) && ( true ) && ( true ) ) { _saveIndex = text . length ( ) ; match ( "<STR_LIT>" ) ; text . setLength ( _saveIndex ) ; } else if ( ( LA ( <NUM_LIT:1> ) == '<STR_LIT>' ) && ( true ) && ( true ) && ( true ) ) { _saveIndex = text . length ( ) ; match ( '<STR_LIT>' ) ; text . setLength ( _saveIndex ) ; } else if ( ( LA ( <NUM_LIT:1> ) == '<STR_LIT:\n>' ) ) { _saveIndex = text . length ( ) ; match ( '<STR_LIT:\n>' ) ; text . setLength ( _saveIndex ) ; } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } if ( inputState . guessing == <NUM_LIT:0> ) { newlineCheck ( check ) ; } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } protected final void mONE_NL_KEEP ( boolean _createToken , boolean check ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = ONE_NL_KEEP ; int _saveIndex ; { if ( ( LA ( <NUM_LIT:1> ) == '<STR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<STR_LIT:\n>' ) && ( ( LA ( <NUM_LIT:3> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:3> ) <= '<STR_LIT>' ) ) && ( ( LA ( <NUM_LIT:4> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:4> ) <= '<STR_LIT>' ) ) ) { match ( "<STR_LIT>" ) ; } else if ( ( LA ( <NUM_LIT:1> ) == '<STR_LIT>' ) && ( ( LA ( <NUM_LIT:2> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:2> ) <= '<STR_LIT>' ) ) && ( ( LA ( <NUM_LIT:3> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:3> ) <= '<STR_LIT>' ) ) && ( true ) ) { match ( '<STR_LIT>' ) ; } else if ( ( LA ( <NUM_LIT:1> ) == '<STR_LIT:\n>' ) ) { match ( '<STR_LIT:\n>' ) ; } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } if ( inputState . guessing == <NUM_LIT:0> ) { newlineCheck ( check ) ; } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mNLS ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = NLS ; int _saveIndex ; mONE_NL ( false , true ) ; { if ( ( ( LA ( <NUM_LIT:1> ) == '<STR_LIT:\t>' || LA ( <NUM_LIT:1> ) == '<STR_LIT:\n>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:1> ) == '<STR_LIT>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT:U+0020>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT:/>' || LA ( <NUM_LIT:1> ) == '<STR_LIT:\\>' ) ) && ( ! whitespaceIncluded ) ) { { int _cnt661 = <NUM_LIT:0> ; _loop661 : do { switch ( LA ( <NUM_LIT:1> ) ) { case '<STR_LIT:\n>' : case '<STR_LIT>' : { mONE_NL ( false , true ) ; break ; } case '<STR_LIT:\t>' : case '<CHAR_LIT>' : case '<CHAR_LIT:U+0020>' : case '<STR_LIT:\\>' : { mWS ( false ) ; break ; } default : if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:/>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:/>' ) ) { mSL_COMMENT ( false ) ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:/>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' ) ) { mML_COMMENT ( false ) ; } else { if ( _cnt661 >= <NUM_LIT:1> ) { break _loop661 ; } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } } _cnt661 ++ ; } while ( true ) ; } } else { } } if ( inputState . guessing == <NUM_LIT:0> ) { if ( whitespaceIncluded ) { } else if ( parenLevel != <NUM_LIT:0> ) { _ttype = Token . SKIP ; } else { text . setLength ( _begin ) ; text . append ( "<STR_LIT>" ) ; } } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mSL_COMMENT ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = SL_COMMENT ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( inputState . guessing == <NUM_LIT:0> ) { if ( parser != null ) { parser . startComment ( inputState . getLine ( ) , inputState . getColumn ( ) - <NUM_LIT:2> ) ; } } { _loop665 : do { if ( ( _tokenSet_1 . member ( LA ( <NUM_LIT:1> ) ) ) && ( true ) && ( true ) && ( true ) ) { { match ( _tokenSet_1 ) ; } } else { break _loop665 ; } } while ( true ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { if ( parser != null ) { parser . endComment ( <NUM_LIT:0> , inputState . getLine ( ) , inputState . getColumn ( ) , new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } if ( ! whitespaceIncluded ) _ttype = Token . SKIP ; } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mML_COMMENT ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = ML_COMMENT ; int _saveIndex ; match ( "<STR_LIT>" ) ; if ( inputState . guessing == <NUM_LIT:0> ) { if ( parser != null ) { parser . startComment ( inputState . getLine ( ) , inputState . getColumn ( ) - <NUM_LIT:2> ) ; } } { _loop675 : do { boolean synPredMatched673 = false ; if ( ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( ( LA ( <NUM_LIT:2> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:2> ) <= '<STR_LIT>' ) ) && ( ( LA ( <NUM_LIT:3> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:3> ) <= '<STR_LIT>' ) ) && ( true ) ) ) { int _m673 = mark ( ) ; synPredMatched673 = true ; inputState . guessing ++ ; try { { match ( '<CHAR_LIT>' ) ; matchNot ( '<CHAR_LIT:/>' ) ; } } catch ( RecognitionException pe ) { synPredMatched673 = false ; } rewind ( _m673 ) ; inputState . guessing -- ; } if ( synPredMatched673 ) { match ( '<CHAR_LIT>' ) ; } else if ( ( LA ( <NUM_LIT:1> ) == '<STR_LIT:\n>' || LA ( <NUM_LIT:1> ) == '<STR_LIT>' ) ) { mONE_NL_KEEP ( false , true ) ; } else if ( ( _tokenSet_2 . member ( LA ( <NUM_LIT:1> ) ) ) ) { { match ( _tokenSet_2 ) ; } } else { break _loop675 ; } } while ( true ) ; } match ( "<STR_LIT>" ) ; if ( inputState . guessing == <NUM_LIT:0> ) { if ( parser != null ) { parser . endComment ( <NUM_LIT:1> , inputState . getLine ( ) , inputState . getColumn ( ) , new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } if ( ! whitespaceIncluded ) _ttype = Token . SKIP ; } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mSH_COMMENT ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = SH_COMMENT ; int _saveIndex ; if ( ! ( getLine ( ) == <NUM_LIT:1> && getColumn ( ) == <NUM_LIT:1> ) ) throw new SemanticException ( "<STR_LIT>" ) ; match ( "<STR_LIT>" ) ; { _loop669 : do { if ( ( _tokenSet_1 . member ( LA ( <NUM_LIT:1> ) ) ) ) { { match ( _tokenSet_1 ) ; } } else { break _loop669 ; } } while ( true ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { if ( ! whitespaceIncluded ) _ttype = Token . SKIP ; } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mSTRING_LITERAL ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = STRING_LITERAL ; int _saveIndex ; int tt = <NUM_LIT:0> ; boolean synPredMatched678 = false ; if ( ( ( LA ( <NUM_LIT:1> ) == '<STR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<STR_LIT>' ) && ( LA ( <NUM_LIT:3> ) == '<STR_LIT>' ) && ( ( LA ( <NUM_LIT:4> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:4> ) <= '<STR_LIT>' ) ) ) ) { int _m678 = mark ( ) ; synPredMatched678 = true ; inputState . guessing ++ ; try { { match ( "<STR_LIT>" ) ; } } catch ( RecognitionException pe ) { synPredMatched678 = false ; } rewind ( _m678 ) ; inputState . guessing -- ; } if ( synPredMatched678 ) { _saveIndex = text . length ( ) ; match ( "<STR_LIT>" ) ; text . setLength ( _saveIndex ) ; { _loop683 : do { switch ( LA ( <NUM_LIT:1> ) ) { case '<STR_LIT:\\>' : { mESC ( false ) ; break ; } case '<CHAR_LIT:">' : { match ( '<CHAR_LIT:">' ) ; break ; } case '<CHAR_LIT>' : { match ( '<CHAR_LIT>' ) ; break ; } case '<STR_LIT:\n>' : case '<STR_LIT>' : { mSTRING_NL ( false , true ) ; break ; } default : boolean synPredMatched682 = false ; if ( ( ( LA ( <NUM_LIT:1> ) == '<STR_LIT>' ) && ( ( LA ( <NUM_LIT:2> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:2> ) <= '<STR_LIT>' ) ) && ( ( LA ( <NUM_LIT:3> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:3> ) <= '<STR_LIT>' ) ) && ( ( LA ( <NUM_LIT:4> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:4> ) <= '<STR_LIT>' ) ) ) ) { int _m682 = mark ( ) ; synPredMatched682 = true ; inputState . guessing ++ ; try { { match ( '<STR_LIT>' ) ; { if ( ( _tokenSet_3 . member ( LA ( <NUM_LIT:1> ) ) ) ) { matchNot ( '<STR_LIT>' ) ; } else if ( ( LA ( <NUM_LIT:1> ) == '<STR_LIT>' ) ) { match ( '<STR_LIT>' ) ; matchNot ( '<STR_LIT>' ) ; } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } } } catch ( RecognitionException pe ) { synPredMatched682 = false ; } rewind ( _m682 ) ; inputState . guessing -- ; } if ( synPredMatched682 ) { match ( '<STR_LIT>' ) ; } else if ( ( _tokenSet_4 . member ( LA ( <NUM_LIT:1> ) ) ) ) { mSTRING_CH ( false ) ; } else { break _loop683 ; } } } while ( true ) ; } _saveIndex = text . length ( ) ; match ( "<STR_LIT>" ) ; text . setLength ( _saveIndex ) ; } else { boolean synPredMatched687 = false ; if ( ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:">' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:">' ) && ( LA ( <NUM_LIT:3> ) == '<CHAR_LIT:">' ) && ( ( LA ( <NUM_LIT:4> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:4> ) <= '<STR_LIT>' ) ) ) ) { int _m687 = mark ( ) ; synPredMatched687 = true ; inputState . guessing ++ ; try { { match ( "<STR_LIT>" ) ; } } catch ( RecognitionException pe ) { synPredMatched687 = false ; } rewind ( _m687 ) ; inputState . guessing -- ; } if ( synPredMatched687 ) { _saveIndex = text . length ( ) ; match ( "<STR_LIT>" ) ; text . setLength ( _saveIndex ) ; tt = mSTRING_CTOR_END ( false , true , true ) ; if ( inputState . guessing == <NUM_LIT:0> ) { _ttype = tt ; } } else if ( ( LA ( <NUM_LIT:1> ) == '<STR_LIT>' ) && ( _tokenSet_1 . member ( LA ( <NUM_LIT:2> ) ) ) && ( true ) && ( true ) ) { _saveIndex = text . length ( ) ; match ( '<STR_LIT>' ) ; text . setLength ( _saveIndex ) ; if ( inputState . guessing == <NUM_LIT:0> ) { ++ suppressNewline ; } { _loop685 : do { switch ( LA ( <NUM_LIT:1> ) ) { case '<STR_LIT:\\>' : { mESC ( false ) ; break ; } case '<CHAR_LIT:">' : { match ( '<CHAR_LIT:">' ) ; break ; } case '<CHAR_LIT>' : { match ( '<CHAR_LIT>' ) ; break ; } default : if ( ( _tokenSet_4 . member ( LA ( <NUM_LIT:1> ) ) ) ) { mSTRING_CH ( false ) ; } else { break _loop685 ; } } } while ( true ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { -- suppressNewline ; } _saveIndex = text . length ( ) ; match ( '<STR_LIT>' ) ; text . setLength ( _saveIndex ) ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:">' ) && ( ( LA ( <NUM_LIT:2> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:2> ) <= '<STR_LIT>' ) ) && ( true ) && ( true ) ) { _saveIndex = text . length ( ) ; match ( '<CHAR_LIT:">' ) ; text . setLength ( _saveIndex ) ; if ( inputState . guessing == <NUM_LIT:0> ) { ++ suppressNewline ; } tt = mSTRING_CTOR_END ( false , true , false ) ; if ( inputState . guessing == <NUM_LIT:0> ) { _ttype = tt ; } } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } protected final void mSTRING_CH ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = STRING_CH ; int _saveIndex ; { match ( _tokenSet_4 ) ; } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } protected final void mESC ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = ESC ; int _saveIndex ; if ( ( LA ( <NUM_LIT:1> ) == '<STR_LIT:\\>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:">' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:2> ) == '<STR_LIT>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT:0>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT:1>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:2> ) == '<STR_LIT:\\>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT:b>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' ) ) { _saveIndex = text . length ( ) ; match ( '<STR_LIT:\\>' ) ; text . setLength ( _saveIndex ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT>' : { match ( '<CHAR_LIT>' ) ; if ( inputState . guessing == <NUM_LIT:0> ) { text . setLength ( _begin ) ; text . append ( "<STR_LIT:n>" ) ; } break ; } case '<CHAR_LIT>' : { match ( '<CHAR_LIT>' ) ; if ( inputState . guessing == <NUM_LIT:0> ) { text . setLength ( _begin ) ; text . append ( "<STR_LIT:r>" ) ; } break ; } case '<CHAR_LIT>' : { match ( '<CHAR_LIT>' ) ; if ( inputState . guessing == <NUM_LIT:0> ) { text . setLength ( _begin ) ; text . append ( "<STR_LIT:t>" ) ; } break ; } case '<CHAR_LIT:b>' : { match ( '<CHAR_LIT:b>' ) ; if ( inputState . guessing == <NUM_LIT:0> ) { text . setLength ( _begin ) ; text . append ( "<STR_LIT>" ) ; } break ; } case '<CHAR_LIT>' : { match ( '<CHAR_LIT>' ) ; if ( inputState . guessing == <NUM_LIT:0> ) { text . setLength ( _begin ) ; text . append ( "<STR_LIT>" ) ; } break ; } case '<CHAR_LIT:">' : { match ( '<CHAR_LIT:">' ) ; break ; } case '<STR_LIT>' : { match ( '<STR_LIT>' ) ; break ; } case '<STR_LIT:\\>' : { match ( '<STR_LIT:\\>' ) ; break ; } case '<CHAR_LIT>' : { match ( '<CHAR_LIT>' ) ; break ; } case '<CHAR_LIT>' : { { int _cnt729 = <NUM_LIT:0> ; _loop729 : do { if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) ) { match ( '<CHAR_LIT>' ) ; } else { if ( _cnt729 >= <NUM_LIT:1> ) { break _loop729 ; } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } _cnt729 ++ ; } while ( true ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { text . setLength ( _begin ) ; text . append ( "<STR_LIT>" ) ; } mHEX_DIGIT ( false ) ; mHEX_DIGIT ( false ) ; mHEX_DIGIT ( false ) ; mHEX_DIGIT ( false ) ; if ( inputState . guessing == <NUM_LIT:0> ) { char ch = ( char ) Integer . parseInt ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) , <NUM_LIT:16> ) ; text . setLength ( _begin ) ; text . append ( ch ) ; } break ; } case '<CHAR_LIT:0>' : case '<CHAR_LIT:1>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : { matchRange ( '<CHAR_LIT:0>' , '<CHAR_LIT>' ) ; { if ( ( ( LA ( <NUM_LIT:1> ) >= '<CHAR_LIT:0>' && LA ( <NUM_LIT:1> ) <= '<CHAR_LIT>' ) ) && ( ( LA ( <NUM_LIT:2> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:2> ) <= '<STR_LIT>' ) ) && ( true ) && ( true ) ) { matchRange ( '<CHAR_LIT:0>' , '<CHAR_LIT>' ) ; { if ( ( ( LA ( <NUM_LIT:1> ) >= '<CHAR_LIT:0>' && LA ( <NUM_LIT:1> ) <= '<CHAR_LIT>' ) ) && ( ( LA ( <NUM_LIT:2> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:2> ) <= '<STR_LIT>' ) ) && ( true ) && ( true ) ) { matchRange ( '<CHAR_LIT:0>' , '<CHAR_LIT>' ) ; } else if ( ( ( LA ( <NUM_LIT:1> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:1> ) <= '<STR_LIT>' ) ) && ( true ) && ( true ) && ( true ) ) { } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } } else if ( ( ( LA ( <NUM_LIT:1> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:1> ) <= '<STR_LIT>' ) ) && ( true ) && ( true ) && ( true ) ) { } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } if ( inputState . guessing == <NUM_LIT:0> ) { char ch = ( char ) Integer . parseInt ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) , <NUM_LIT:8> ) ; text . setLength ( _begin ) ; text . append ( ch ) ; } break ; } case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : { matchRange ( '<CHAR_LIT>' , '<CHAR_LIT>' ) ; { if ( ( ( LA ( <NUM_LIT:1> ) >= '<CHAR_LIT:0>' && LA ( <NUM_LIT:1> ) <= '<CHAR_LIT>' ) ) && ( ( LA ( <NUM_LIT:2> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:2> ) <= '<STR_LIT>' ) ) && ( true ) && ( true ) ) { matchRange ( '<CHAR_LIT:0>' , '<CHAR_LIT>' ) ; } else if ( ( ( LA ( <NUM_LIT:1> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:1> ) <= '<STR_LIT>' ) ) && ( true ) && ( true ) && ( true ) ) { } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } if ( inputState . guessing == <NUM_LIT:0> ) { char ch = ( char ) Integer . parseInt ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) , <NUM_LIT:8> ) ; text . setLength ( _begin ) ; text . append ( ch ) ; } break ; } default : { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } } } else if ( ( LA ( <NUM_LIT:1> ) == '<STR_LIT:\\>' ) && ( LA ( <NUM_LIT:2> ) == '<STR_LIT:\n>' || LA ( <NUM_LIT:2> ) == '<STR_LIT>' ) ) { _saveIndex = text . length ( ) ; match ( '<STR_LIT:\\>' ) ; text . setLength ( _saveIndex ) ; _saveIndex = text . length ( ) ; mONE_NL ( false , false ) ; text . setLength ( _saveIndex ) ; } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } protected final void mSTRING_NL ( boolean _createToken , boolean allowNewline ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = STRING_NL ; int _saveIndex ; if ( inputState . guessing == <NUM_LIT:0> ) { if ( ! allowNewline ) throw new MismatchedCharException ( '<STR_LIT:\n>' , '<STR_LIT:\n>' , true , this ) ; } mONE_NL ( false , false ) ; if ( inputState . guessing == <NUM_LIT:0> ) { text . setLength ( _begin ) ; text . append ( '<STR_LIT:\n>' ) ; } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } protected final int mSTRING_CTOR_END ( boolean _createToken , boolean fromStart , boolean tripleQuote ) throws RecognitionException , CharStreamException , TokenStreamException { int tt = STRING_CTOR_END ; int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = STRING_CTOR_END ; int _saveIndex ; boolean dollarOK = false ; { _loop693 : do { switch ( LA ( <NUM_LIT:1> ) ) { case '<STR_LIT:\\>' : { mESC ( false ) ; break ; } case '<STR_LIT>' : { match ( '<STR_LIT>' ) ; break ; } case '<STR_LIT:\n>' : case '<STR_LIT>' : { mSTRING_NL ( false , tripleQuote ) ; break ; } default : boolean synPredMatched692 = false ; if ( ( ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:">' ) && ( ( LA ( <NUM_LIT:2> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:2> ) <= '<STR_LIT>' ) ) && ( true ) && ( true ) ) && ( tripleQuote ) ) ) { int _m692 = mark ( ) ; synPredMatched692 = true ; inputState . guessing ++ ; try { { match ( '<CHAR_LIT:">' ) ; { if ( ( _tokenSet_5 . member ( LA ( <NUM_LIT:1> ) ) ) ) { matchNot ( '<CHAR_LIT:">' ) ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:">' ) ) { match ( '<CHAR_LIT:">' ) ; matchNot ( '<CHAR_LIT:">' ) ; } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } } } catch ( RecognitionException pe ) { synPredMatched692 = false ; } rewind ( _m692 ) ; inputState . guessing -- ; } if ( synPredMatched692 ) { match ( '<CHAR_LIT:">' ) ; } else if ( ( _tokenSet_4 . member ( LA ( <NUM_LIT:1> ) ) ) ) { mSTRING_CH ( false ) ; } else { break _loop693 ; } } } while ( true ) ; } { switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT:">' : { { if ( ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:">' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:">' ) ) && ( tripleQuote ) ) { _saveIndex = text . length ( ) ; match ( "<STR_LIT>" ) ; text . setLength ( _saveIndex ) ; } else if ( ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:">' ) && ( true ) ) && ( ! tripleQuote ) ) { _saveIndex = text . length ( ) ; match ( "<STR_LIT:\">" ) ; text . setLength ( _saveIndex ) ; } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } if ( inputState . guessing == <NUM_LIT:0> ) { if ( fromStart ) tt = STRING_LITERAL ; if ( ! tripleQuote ) { -- suppressNewline ; } } break ; } case '<CHAR_LIT>' : { if ( inputState . guessing == <NUM_LIT:0> ) { dollarOK = atValidDollarEscape ( ) ; } _saveIndex = text . length ( ) ; match ( '<CHAR_LIT>' ) ; text . setLength ( _saveIndex ) ; if ( inputState . guessing == <NUM_LIT:0> ) { require ( dollarOK , "<STR_LIT>" , "<STR_LIT>" ) ; tt = ( fromStart ? STRING_CTOR_START : STRING_CTOR_MIDDLE ) ; stringCtorState = SCS_VAL + ( tripleQuote ? SCS_TQ_TYPE : SCS_SQ_TYPE ) ; } break ; } default : { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { _ttype = tt ; } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; return tt ; } public final void mREGEXP_LITERAL ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = REGEXP_LITERAL ; int _saveIndex ; int tt = <NUM_LIT:0> ; if ( ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:/>' ) && ( _tokenSet_6 . member ( LA ( <NUM_LIT:2> ) ) ) && ( true ) && ( true ) ) && ( allowRegexpLiteral ( ) ) ) { _saveIndex = text . length ( ) ; match ( '<CHAR_LIT:/>' ) ; text . setLength ( _saveIndex ) ; if ( inputState . guessing == <NUM_LIT:0> ) { ++ suppressNewline ; } { if ( ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( _tokenSet_7 . member ( LA ( <NUM_LIT:2> ) ) ) ) && ( ! atValidDollarEscape ( ) ) ) { match ( '<CHAR_LIT>' ) ; tt = mREGEXP_CTOR_END ( false , true ) ; } else if ( ( _tokenSet_8 . member ( LA ( <NUM_LIT:1> ) ) ) ) { mREGEXP_SYMBOL ( false ) ; tt = mREGEXP_CTOR_END ( false , true ) ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( true ) ) { _saveIndex = text . length ( ) ; match ( '<CHAR_LIT>' ) ; text . setLength ( _saveIndex ) ; if ( inputState . guessing == <NUM_LIT:0> ) { tt = STRING_CTOR_START ; stringCtorState = SCS_VAL + SCS_RE_TYPE ; } } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } if ( inputState . guessing == <NUM_LIT:0> ) { _ttype = tt ; } } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:/>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:=>' ) && ( true ) && ( true ) ) { mDIV_ASSIGN ( false ) ; if ( inputState . guessing == <NUM_LIT:0> ) { _ttype = DIV_ASSIGN ; } } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:/>' ) && ( true ) ) { mDIV ( false ) ; if ( inputState . guessing == <NUM_LIT:0> ) { _ttype = DIV ; } } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } protected final void mREGEXP_SYMBOL ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = REGEXP_SYMBOL ; int _saveIndex ; { if ( ( LA ( <NUM_LIT:1> ) == '<STR_LIT:\\>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:/>' ) && ( ( LA ( <NUM_LIT:3> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:3> ) <= '<STR_LIT>' ) ) && ( true ) ) { match ( '<STR_LIT:\\>' ) ; match ( '<CHAR_LIT:/>' ) ; if ( inputState . guessing == <NUM_LIT:0> ) { text . setLength ( _begin ) ; text . append ( '<CHAR_LIT:/>' ) ; } } else if ( ( LA ( <NUM_LIT:1> ) == '<STR_LIT:\\>' ) && ( LA ( <NUM_LIT:2> ) == '<STR_LIT:\n>' || LA ( <NUM_LIT:2> ) == '<STR_LIT>' ) && ( ( LA ( <NUM_LIT:3> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:3> ) <= '<STR_LIT>' ) ) && ( true ) ) { _saveIndex = text . length ( ) ; match ( '<STR_LIT:\\>' ) ; text . setLength ( _saveIndex ) ; _saveIndex = text . length ( ) ; mONE_NL ( false , false ) ; text . setLength ( _saveIndex ) ; } else if ( ( ( LA ( <NUM_LIT:1> ) == '<STR_LIT:\\>' ) && ( ( LA ( <NUM_LIT:2> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:2> ) <= '<STR_LIT>' ) ) && ( true ) && ( true ) ) && ( LA ( <NUM_LIT:2> ) != '<CHAR_LIT:/>' && LA ( <NUM_LIT:2> ) != '<STR_LIT:\n>' && LA ( <NUM_LIT:2> ) != '<STR_LIT>' ) ) { match ( '<STR_LIT:\\>' ) ; } else if ( ( _tokenSet_9 . member ( LA ( <NUM_LIT:1> ) ) ) ) { { match ( _tokenSet_9 ) ; } } else if ( ( LA ( <NUM_LIT:1> ) == '<STR_LIT:\n>' || LA ( <NUM_LIT:1> ) == '<STR_LIT>' ) ) { mSTRING_NL ( false , true ) ; } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } { _loop720 : do { if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) ) { match ( '<CHAR_LIT>' ) ; } else { break _loop720 ; } } while ( true ) ; } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } protected final int mREGEXP_CTOR_END ( boolean _createToken , boolean fromStart ) throws RecognitionException , CharStreamException , TokenStreamException { int tt = STRING_CTOR_END ; int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = REGEXP_CTOR_END ; int _saveIndex ; { _loop704 : do { if ( ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( _tokenSet_7 . member ( LA ( <NUM_LIT:2> ) ) ) ) && ( ! atValidDollarEscape ( ) ) ) { match ( '<CHAR_LIT>' ) ; } else if ( ( _tokenSet_8 . member ( LA ( <NUM_LIT:1> ) ) ) ) { mREGEXP_SYMBOL ( false ) ; } else { break _loop704 ; } } while ( true ) ; } { switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT:/>' : { _saveIndex = text . length ( ) ; match ( '<CHAR_LIT:/>' ) ; text . setLength ( _saveIndex ) ; if ( inputState . guessing == <NUM_LIT:0> ) { if ( fromStart ) tt = STRING_LITERAL ; { -- suppressNewline ; } } break ; } case '<CHAR_LIT>' : { _saveIndex = text . length ( ) ; match ( '<CHAR_LIT>' ) ; text . setLength ( _saveIndex ) ; if ( inputState . guessing == <NUM_LIT:0> ) { tt = ( fromStart ? STRING_CTOR_START : STRING_CTOR_MIDDLE ) ; stringCtorState = SCS_VAL + SCS_RE_TYPE ; } break ; } default : { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { _ttype = tt ; } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; return tt ; } public final void mDOLLAR_REGEXP_LITERAL ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = DOLLAR_REGEXP_LITERAL ; int _saveIndex ; int tt = <NUM_LIT:0> ; if ( ! ( allowRegexpLiteral ( ) ) ) throw new SemanticException ( "<STR_LIT>" ) ; _saveIndex = text . length ( ) ; match ( "<STR_LIT>" ) ; text . setLength ( _saveIndex ) ; { if ( ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( ( LA ( <NUM_LIT:2> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:2> ) <= '<STR_LIT>' ) ) ) && ( ! atValidDollarEscape ( ) ) ) { match ( '<CHAR_LIT>' ) ; tt = mDOLLAR_REGEXP_CTOR_END ( false , true ) ; } else if ( ( _tokenSet_10 . member ( LA ( <NUM_LIT:1> ) ) ) ) { mDOLLAR_REGEXP_SYMBOL ( false ) ; tt = mDOLLAR_REGEXP_CTOR_END ( false , true ) ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( true ) ) { _saveIndex = text . length ( ) ; match ( '<CHAR_LIT>' ) ; text . setLength ( _saveIndex ) ; if ( inputState . guessing == <NUM_LIT:0> ) { tt = STRING_CTOR_START ; stringCtorState = SCS_VAL + SCS_DRE_TYPE ; } } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } if ( inputState . guessing == <NUM_LIT:0> ) { _ttype = tt ; } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } protected final void mDOLLAR_REGEXP_SYMBOL ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = DOLLAR_REGEXP_SYMBOL ; int _saveIndex ; { switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT:/>' : { match ( '<CHAR_LIT:/>' ) ; break ; } case '<STR_LIT:\n>' : case '<STR_LIT>' : { mSTRING_NL ( false , true ) ; break ; } default : if ( ( LA ( <NUM_LIT:1> ) == '<STR_LIT:\\>' ) && ( LA ( <NUM_LIT:2> ) == '<STR_LIT:\n>' || LA ( <NUM_LIT:2> ) == '<STR_LIT>' ) && ( ( LA ( <NUM_LIT:3> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:3> ) <= '<STR_LIT>' ) ) && ( true ) ) { _saveIndex = text . length ( ) ; match ( '<STR_LIT:\\>' ) ; text . setLength ( _saveIndex ) ; _saveIndex = text . length ( ) ; mONE_NL ( false , false ) ; text . setLength ( _saveIndex ) ; } else if ( ( ( LA ( <NUM_LIT:1> ) == '<STR_LIT:\\>' ) && ( ( LA ( <NUM_LIT:2> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:2> ) <= '<STR_LIT>' ) ) && ( true ) && ( true ) ) && ( LA ( <NUM_LIT:2> ) != '<STR_LIT:\n>' && LA ( <NUM_LIT:2> ) != '<STR_LIT>' ) ) { match ( '<STR_LIT:\\>' ) ; } else if ( ( _tokenSet_11 . member ( LA ( <NUM_LIT:1> ) ) ) ) { { match ( _tokenSet_11 ) ; } } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } protected final int mDOLLAR_REGEXP_CTOR_END ( boolean _createToken , boolean fromStart ) throws RecognitionException , CharStreamException , TokenStreamException { int tt = STRING_CTOR_END ; int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = DOLLAR_REGEXP_CTOR_END ; int _saveIndex ; { _loop712 : do { boolean synPredMatched709 = false ; if ( ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:/>' ) && ( ( LA ( <NUM_LIT:3> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:3> ) <= '<STR_LIT>' ) ) && ( true ) ) ) { int _m709 = mark ( ) ; synPredMatched709 = true ; inputState . guessing ++ ; try { { match ( '<CHAR_LIT>' ) ; match ( '<CHAR_LIT:/>' ) ; } } catch ( RecognitionException pe ) { synPredMatched709 = false ; } rewind ( _m709 ) ; inputState . guessing -- ; } if ( synPredMatched709 ) { mESCAPED_SLASH ( false ) ; } else { boolean synPredMatched711 = false ; if ( ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' ) && ( ( LA ( <NUM_LIT:3> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:3> ) <= '<STR_LIT>' ) ) && ( true ) ) ) { int _m711 = mark ( ) ; synPredMatched711 = true ; inputState . guessing ++ ; try { { match ( '<CHAR_LIT>' ) ; match ( '<CHAR_LIT>' ) ; } } catch ( RecognitionException pe ) { synPredMatched711 = false ; } rewind ( _m711 ) ; inputState . guessing -- ; } if ( synPredMatched711 ) { mESCAPED_DOLLAR ( false ) ; } else if ( ( ( _tokenSet_10 . member ( LA ( <NUM_LIT:1> ) ) ) && ( ( LA ( <NUM_LIT:2> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:2> ) <= '<STR_LIT>' ) ) && ( true ) && ( true ) ) && ( ! ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:/>' && LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' ) ) ) { mDOLLAR_REGEXP_SYMBOL ( false ) ; } else if ( ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) && ( ( LA ( <NUM_LIT:2> ) >= '<CHAR_LIT>' && LA ( <NUM_LIT:2> ) <= '<STR_LIT>' ) ) && ( true ) && ( true ) ) && ( ! atValidDollarEscape ( ) && ! atDollarSlashEscape ( ) && ! atDollarDollarEscape ( ) ) ) { match ( '<CHAR_LIT>' ) ; } else { break _loop712 ; } } } while ( true ) ; } { switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT:/>' : { _saveIndex = text . length ( ) ; match ( "<STR_LIT>" ) ; text . setLength ( _saveIndex ) ; if ( inputState . guessing == <NUM_LIT:0> ) { if ( fromStart ) tt = STRING_LITERAL ; } break ; } case '<CHAR_LIT>' : { _saveIndex = text . length ( ) ; match ( '<CHAR_LIT>' ) ; text . setLength ( _saveIndex ) ; if ( inputState . guessing == <NUM_LIT:0> ) { tt = ( fromStart ? STRING_CTOR_START : STRING_CTOR_MIDDLE ) ; stringCtorState = SCS_VAL + SCS_DRE_TYPE ; } break ; } default : { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { _ttype = tt ; } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; return tt ; } protected final void mESCAPED_SLASH ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = ESCAPED_SLASH ; int _saveIndex ; match ( '<CHAR_LIT>' ) ; match ( '<CHAR_LIT:/>' ) ; if ( inputState . guessing == <NUM_LIT:0> ) { text . setLength ( _begin ) ; text . append ( '<CHAR_LIT:/>' ) ; } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } protected final void mESCAPED_DOLLAR ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = ESCAPED_DOLLAR ; int _saveIndex ; match ( '<CHAR_LIT>' ) ; match ( '<CHAR_LIT>' ) ; if ( inputState . guessing == <NUM_LIT:0> ) { text . setLength ( _begin ) ; text . append ( '<CHAR_LIT>' ) ; } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } protected final void mHEX_DIGIT ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = HEX_DIGIT ; int _saveIndex ; { switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT:0>' : case '<CHAR_LIT:1>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT:9>' : { matchRange ( '<CHAR_LIT:0>' , '<CHAR_LIT:9>' ) ; break ; } case '<CHAR_LIT:A>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : { matchRange ( '<CHAR_LIT:A>' , '<CHAR_LIT>' ) ; break ; } case '<CHAR_LIT:a>' : case '<CHAR_LIT:b>' : case '<CHAR_LIT:c>' : case '<CHAR_LIT>' : case '<CHAR_LIT:e>' : case '<CHAR_LIT>' : { matchRange ( '<CHAR_LIT:a>' , '<CHAR_LIT>' ) ; break ; } default : { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } protected final void mVOCAB ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = VOCAB ; int _saveIndex ; matchRange ( '<STR_LIT>' , '<STR_LIT>' ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mIDENT ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = IDENT ; int _saveIndex ; { if ( ( ( _tokenSet_0 . member ( LA ( <NUM_LIT:1> ) ) ) && ( true ) && ( true ) && ( true ) ) && ( stringCtorState == <NUM_LIT:0> ) ) { { if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) ) { mDOLLAR ( false ) ; } else if ( ( _tokenSet_12 . member ( LA ( <NUM_LIT:1> ) ) ) ) { mLETTER ( false ) ; } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } { _loop741 : do { switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT:0>' : case '<CHAR_LIT:1>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT:9>' : { mDIGIT ( false ) ; break ; } case '<CHAR_LIT>' : { mDOLLAR ( false ) ; break ; } default : if ( ( _tokenSet_12 . member ( LA ( <NUM_LIT:1> ) ) ) ) { mLETTER ( false ) ; } else { break _loop741 ; } } } while ( true ) ; } } else if ( ( _tokenSet_12 . member ( LA ( <NUM_LIT:1> ) ) ) && ( true ) && ( true ) && ( true ) ) { mLETTER ( false ) ; { _loop743 : do { if ( ( _tokenSet_12 . member ( LA ( <NUM_LIT:1> ) ) ) ) { mLETTER ( false ) ; } else if ( ( ( LA ( <NUM_LIT:1> ) >= '<CHAR_LIT:0>' && LA ( <NUM_LIT:1> ) <= '<CHAR_LIT:9>' ) ) ) { mDIGIT ( false ) ; } else { break _loop743 ; } } while ( true ) ; } } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } if ( inputState . guessing == <NUM_LIT:0> ) { if ( stringCtorState != <NUM_LIT:0> ) { if ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:.>' && LA ( <NUM_LIT:2> ) != '<CHAR_LIT>' && Character . isJavaIdentifierStart ( LA ( <NUM_LIT:2> ) ) ) { restartStringCtor ( false ) ; } else { restartStringCtor ( true ) ; } } int ttype = testLiteralsTable ( IDENT ) ; if ( ( ttype == LITERAL_as || ttype == LITERAL_def || ttype == LITERAL_in ) && ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:.>' || lastSigTokenType == DOT || lastSigTokenType == LITERAL_package ) ) { ttype = IDENT ; } if ( ttype == LITERAL_static && LA ( <NUM_LIT:1> ) == '<CHAR_LIT:.>' ) { ttype = IDENT ; } _ttype = ttype ; if ( assertEnabled && "<STR_LIT>" . equals ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ) { _ttype = LITERAL_assert ; } if ( enumEnabled && "<STR_LIT>" . equals ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ) { _ttype = LITERAL_enum ; } } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } protected final void mLETTER ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = LETTER ; int _saveIndex ; switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT:a>' : case '<CHAR_LIT:b>' : case '<CHAR_LIT:c>' : case '<CHAR_LIT>' : case '<CHAR_LIT:e>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : { matchRange ( '<CHAR_LIT:a>' , '<CHAR_LIT>' ) ; break ; } case '<CHAR_LIT:A>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT:Z>' : { matchRange ( '<CHAR_LIT:A>' , '<CHAR_LIT:Z>' ) ; break ; } case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : { matchRange ( '<STR_LIT>' , '<STR_LIT>' ) ; break ; } case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : { matchRange ( '<STR_LIT>' , '<STR_LIT>' ) ; break ; } case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : case '<STR_LIT>' : { matchRange ( '<STR_LIT>' , '<STR_LIT>' ) ; break ; } case '<CHAR_LIT:_>' : { match ( '<CHAR_LIT:_>' ) ; break ; } default : if ( ( ( LA ( <NUM_LIT:1> ) >= '<STR_LIT>' && LA ( <NUM_LIT:1> ) <= '<STR_LIT>' ) ) ) { matchRange ( '<STR_LIT>' , '<STR_LIT>' ) ; } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } protected final void mDIGIT ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = DIGIT ; int _saveIndex ; matchRange ( '<CHAR_LIT:0>' , '<CHAR_LIT:9>' ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } protected final void mDIGITS_WITH_UNDERSCORE ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = DIGITS_WITH_UNDERSCORE ; int _saveIndex ; mDIGIT ( false ) ; { if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:0>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT:1>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT:9>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT:_>' ) ) { mDIGITS_WITH_UNDERSCORE_OPT ( false ) ; } else { } } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } protected final void mDIGITS_WITH_UNDERSCORE_OPT ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = DIGITS_WITH_UNDERSCORE_OPT ; int _saveIndex ; { _loop750 : do { if ( ( ( LA ( <NUM_LIT:1> ) >= '<CHAR_LIT:0>' && LA ( <NUM_LIT:1> ) <= '<CHAR_LIT:9>' ) ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:0>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT:1>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT:9>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT:_>' ) ) { mDIGIT ( false ) ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:_>' ) ) { match ( '<CHAR_LIT:_>' ) ; } else { break _loop750 ; } } while ( true ) ; } mDIGIT ( false ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mNUM_INT ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = NUM_INT ; int _saveIndex ; Token e = null ; Token f2 = null ; Token g2 = null ; Token f3 = null ; Token g3 = null ; Token f4 = null ; boolean isDecimal = false ; Token t = null ; { switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT:0>' : { match ( '<CHAR_LIT:0>' ) ; if ( inputState . guessing == <NUM_LIT:0> ) { isDecimal = true ; } { switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT>' : case '<CHAR_LIT>' : { { switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT>' : { match ( '<CHAR_LIT>' ) ; break ; } case '<CHAR_LIT>' : { match ( '<CHAR_LIT>' ) ; break ; } default : { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { isDecimal = false ; } mHEX_DIGIT ( false ) ; { if ( ( _tokenSet_13 . member ( LA ( <NUM_LIT:1> ) ) ) && ( true ) && ( true ) && ( true ) ) { { _loop757 : do { if ( ( _tokenSet_14 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_13 . member ( LA ( <NUM_LIT:2> ) ) ) && ( true ) && ( true ) ) { mHEX_DIGIT ( false ) ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:_>' ) ) { match ( '<CHAR_LIT:_>' ) ; } else { break _loop757 ; } } while ( true ) ; } mHEX_DIGIT ( false ) ; } else { } } break ; } case '<CHAR_LIT>' : case '<CHAR_LIT:b>' : { { switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT:b>' : { match ( '<CHAR_LIT:b>' ) ; break ; } case '<CHAR_LIT>' : { match ( '<CHAR_LIT>' ) ; break ; } default : { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } } { switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT:0>' : { match ( '<CHAR_LIT:0>' ) ; break ; } case '<CHAR_LIT:1>' : { match ( '<CHAR_LIT:1>' ) ; break ; } default : { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } } { if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:0>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT:1>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT:_>' ) ) { { _loop762 : do { if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:0>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:0>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT:1>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT:_>' ) ) { match ( '<CHAR_LIT:0>' ) ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:1>' ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:0>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT:1>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT:_>' ) ) { match ( '<CHAR_LIT:1>' ) ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:_>' ) ) { match ( '<CHAR_LIT:_>' ) ; } else { break _loop762 ; } } while ( true ) ; } { switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT:0>' : { match ( '<CHAR_LIT:0>' ) ; break ; } case '<CHAR_LIT:1>' : { match ( '<CHAR_LIT:1>' ) ; break ; } default : { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } } } else { } } if ( inputState . guessing == <NUM_LIT:0> ) { isDecimal = false ; } break ; } default : boolean synPredMatched766 = false ; if ( ( ( ( LA ( <NUM_LIT:1> ) >= '<CHAR_LIT:0>' && LA ( <NUM_LIT:1> ) <= '<CHAR_LIT:9>' ) ) && ( true ) && ( true ) && ( true ) ) ) { int _m766 = mark ( ) ; synPredMatched766 = true ; inputState . guessing ++ ; try { { mDIGITS_WITH_UNDERSCORE ( false ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT:.>' : { match ( '<CHAR_LIT:.>' ) ; mDIGITS_WITH_UNDERSCORE ( false ) ; break ; } case '<CHAR_LIT>' : case '<CHAR_LIT:e>' : { mEXPONENT ( false ) ; break ; } case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : { mFLOAT_SUFFIX ( false ) ; break ; } default : { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } } } } catch ( RecognitionException pe ) { synPredMatched766 = false ; } rewind ( _m766 ) ; inputState . guessing -- ; } if ( synPredMatched766 ) { mDIGITS_WITH_UNDERSCORE ( false ) ; } else if ( ( ( LA ( <NUM_LIT:1> ) >= '<CHAR_LIT:0>' && LA ( <NUM_LIT:1> ) <= '<CHAR_LIT>' ) ) && ( true ) && ( true ) && ( true ) ) { { matchRange ( '<CHAR_LIT:0>' , '<CHAR_LIT>' ) ; } { if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:0>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT:1>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT:_>' ) ) { { _loop770 : do { if ( ( ( LA ( <NUM_LIT:1> ) >= '<CHAR_LIT:0>' && LA ( <NUM_LIT:1> ) <= '<CHAR_LIT>' ) ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:0>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT:1>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT:_>' ) ) { matchRange ( '<CHAR_LIT:0>' , '<CHAR_LIT>' ) ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:_>' ) ) { match ( '<CHAR_LIT:_>' ) ; } else { break _loop770 ; } } while ( true ) ; } { matchRange ( '<CHAR_LIT:0>' , '<CHAR_LIT>' ) ; } } else { } } if ( inputState . guessing == <NUM_LIT:0> ) { isDecimal = false ; } } else { } } } break ; } case '<CHAR_LIT:1>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT:9>' : { { matchRange ( '<CHAR_LIT:1>' , '<CHAR_LIT:9>' ) ; } { if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:0>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT:1>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT:9>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT:_>' ) ) { mDIGITS_WITH_UNDERSCORE_OPT ( false ) ; } else { } } if ( inputState . guessing == <NUM_LIT:0> ) { isDecimal = true ; } break ; } default : { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } } { switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT>' : case '<CHAR_LIT>' : { { switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT>' : { match ( '<CHAR_LIT>' ) ; break ; } case '<CHAR_LIT>' : { match ( '<CHAR_LIT>' ) ; break ; } default : { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { _ttype = NUM_LONG ; } break ; } case '<CHAR_LIT>' : case '<CHAR_LIT>' : { { switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT>' : { match ( '<CHAR_LIT>' ) ; break ; } case '<CHAR_LIT>' : { match ( '<CHAR_LIT>' ) ; break ; } default : { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { _ttype = NUM_INT ; } break ; } case '<CHAR_LIT>' : case '<CHAR_LIT>' : { mBIG_SUFFIX ( false ) ; if ( inputState . guessing == <NUM_LIT:0> ) { _ttype = NUM_BIG_INT ; } break ; } default : boolean synPredMatched779 = false ; if ( ( ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:.>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT:e>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) ) && ( isDecimal ) ) ) { int _m779 = mark ( ) ; synPredMatched779 = true ; inputState . guessing ++ ; try { { if ( ( _tokenSet_15 . member ( LA ( <NUM_LIT:1> ) ) ) ) { matchNot ( '<CHAR_LIT:.>' ) ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:.>' ) ) { match ( '<CHAR_LIT:.>' ) ; { matchRange ( '<CHAR_LIT:0>' , '<CHAR_LIT:9>' ) ; } } else { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } } catch ( RecognitionException pe ) { synPredMatched779 = false ; } rewind ( _m779 ) ; inputState . guessing -- ; } if ( synPredMatched779 ) { { switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT:.>' : { match ( '<CHAR_LIT:.>' ) ; mDIGITS_WITH_UNDERSCORE ( false ) ; { if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:1> ) == '<CHAR_LIT:e>' ) ) { mEXPONENT ( true ) ; e = _returnToken ; } else { } } { switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : { mFLOAT_SUFFIX ( true ) ; f2 = _returnToken ; if ( inputState . guessing == <NUM_LIT:0> ) { t = f2 ; } break ; } case '<CHAR_LIT>' : case '<CHAR_LIT>' : { mBIG_SUFFIX ( true ) ; g2 = _returnToken ; if ( inputState . guessing == <NUM_LIT:0> ) { t = g2 ; } break ; } default : { } } } break ; } case '<CHAR_LIT>' : case '<CHAR_LIT:e>' : { mEXPONENT ( false ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : { mFLOAT_SUFFIX ( true ) ; f3 = _returnToken ; if ( inputState . guessing == <NUM_LIT:0> ) { t = f3 ; } break ; } case '<CHAR_LIT>' : case '<CHAR_LIT>' : { mBIG_SUFFIX ( true ) ; g3 = _returnToken ; if ( inputState . guessing == <NUM_LIT:0> ) { t = g3 ; } break ; } default : { } } } break ; } case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : { mFLOAT_SUFFIX ( true ) ; f4 = _returnToken ; if ( inputState . guessing == <NUM_LIT:0> ) { t = f4 ; } break ; } default : { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { String txt = ( t == null ? "<STR_LIT>" : t . getText ( ) . toUpperCase ( ) ) ; if ( txt . indexOf ( '<CHAR_LIT>' ) >= <NUM_LIT:0> ) { _ttype = NUM_FLOAT ; } else if ( txt . indexOf ( '<CHAR_LIT>' ) >= <NUM_LIT:0> ) { _ttype = NUM_BIG_DECIMAL ; } else { _ttype = NUM_DOUBLE ; } } } else { } } } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } protected final void mEXPONENT ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = EXPONENT ; int _saveIndex ; { switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT:e>' : { match ( '<CHAR_LIT:e>' ) ; break ; } case '<CHAR_LIT>' : { match ( '<CHAR_LIT>' ) ; break ; } default : { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } } { switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT>' : { match ( '<CHAR_LIT>' ) ; break ; } case '<CHAR_LIT:->' : { match ( '<CHAR_LIT:->' ) ; break ; } case '<CHAR_LIT:0>' : case '<CHAR_LIT:1>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT:9>' : case '<CHAR_LIT:_>' : { break ; } default : { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } } { _loop789 : do { if ( ( ( LA ( <NUM_LIT:1> ) >= '<CHAR_LIT:0>' && LA ( <NUM_LIT:1> ) <= '<CHAR_LIT:9>' ) ) && ( LA ( <NUM_LIT:2> ) == '<CHAR_LIT:0>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT:1>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT:9>' || LA ( <NUM_LIT:2> ) == '<CHAR_LIT:_>' ) ) { matchRange ( '<CHAR_LIT:0>' , '<CHAR_LIT:9>' ) ; } else if ( ( LA ( <NUM_LIT:1> ) == '<CHAR_LIT:_>' ) ) { match ( '<CHAR_LIT:_>' ) ; } else { break _loop789 ; } } while ( true ) ; } { matchRange ( '<CHAR_LIT:0>' , '<CHAR_LIT:9>' ) ; } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } protected final void mFLOAT_SUFFIX ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = FLOAT_SUFFIX ; int _saveIndex ; switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT>' : { match ( '<CHAR_LIT>' ) ; break ; } case '<CHAR_LIT>' : { match ( '<CHAR_LIT>' ) ; break ; } case '<CHAR_LIT>' : { match ( '<CHAR_LIT>' ) ; break ; } case '<CHAR_LIT>' : { match ( '<CHAR_LIT>' ) ; break ; } default : { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } protected final void mBIG_SUFFIX ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = BIG_SUFFIX ; int _saveIndex ; switch ( LA ( <NUM_LIT:1> ) ) { case '<CHAR_LIT>' : { match ( '<CHAR_LIT>' ) ; break ; } case '<CHAR_LIT>' : { match ( '<CHAR_LIT>' ) ; break ; } default : { throw new NoViableAltForCharException ( ( char ) LA ( <NUM_LIT:1> ) , getFilename ( ) , getLine ( ) , getColumn ( ) ) ; } } if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } public final void mAT ( boolean _createToken ) throws RecognitionException , CharStreamException , TokenStreamException { int _ttype ; Token _token = null ; int _begin = text . length ( ) ; _ttype = AT ; int _saveIndex ; match ( '<CHAR_LIT>' ) ; if ( _createToken && _token == null && _ttype != Token . SKIP ) { _token = makeToken ( _ttype ) ; _token . setText ( new String ( text . getBuffer ( ) , _begin , text . length ( ) - _begin ) ) ; } _returnToken = _token ; } private static final long [ ] mk_tokenSet_0 ( ) { long [ ] data = new long [ <NUM_LIT> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = - <NUM_LIT> ; for ( int i = <NUM_LIT:4> ; i <= <NUM_LIT> ; i ++ ) { data [ i ] = - <NUM_LIT:1L> ; } data [ <NUM_LIT> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_0 = new BitSet ( mk_tokenSet_0 ( ) ) ; private static final long [ ] mk_tokenSet_1 ( ) { long [ ] data = new long [ <NUM_LIT> ] ; data [ <NUM_LIT:0> ] = - <NUM_LIT> ; for ( int i = <NUM_LIT:1> ; i <= <NUM_LIT> ; i ++ ) { data [ i ] = - <NUM_LIT:1L> ; } data [ <NUM_LIT> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_1 = new BitSet ( mk_tokenSet_1 ( ) ) ; private static final long [ ] mk_tokenSet_2 ( ) { long [ ] data = new long [ <NUM_LIT> ] ; data [ <NUM_LIT:0> ] = - <NUM_LIT> ; for ( int i = <NUM_LIT:1> ; i <= <NUM_LIT> ; i ++ ) { data [ i ] = - <NUM_LIT:1L> ; } data [ <NUM_LIT> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_2 = new BitSet ( mk_tokenSet_2 ( ) ) ; private static final long [ ] mk_tokenSet_3 ( ) { long [ ] data = new long [ <NUM_LIT> ] ; data [ <NUM_LIT:0> ] = - <NUM_LIT> ; for ( int i = <NUM_LIT:1> ; i <= <NUM_LIT> ; i ++ ) { data [ i ] = - <NUM_LIT:1L> ; } return data ; } public static final BitSet _tokenSet_3 = new BitSet ( mk_tokenSet_3 ( ) ) ; private static final long [ ] mk_tokenSet_4 ( ) { long [ ] data = new long [ <NUM_LIT> ] ; data [ <NUM_LIT:0> ] = - <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; for ( int i = <NUM_LIT:2> ; i <= <NUM_LIT> ; i ++ ) { data [ i ] = - <NUM_LIT:1L> ; } data [ <NUM_LIT> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_4 = new BitSet ( mk_tokenSet_4 ( ) ) ; private static final long [ ] mk_tokenSet_5 ( ) { long [ ] data = new long [ <NUM_LIT> ] ; data [ <NUM_LIT:0> ] = - <NUM_LIT> ; for ( int i = <NUM_LIT:1> ; i <= <NUM_LIT> ; i ++ ) { data [ i ] = - <NUM_LIT:1L> ; } return data ; } public static final BitSet _tokenSet_5 = new BitSet ( mk_tokenSet_5 ( ) ) ; private static final long [ ] mk_tokenSet_6 ( ) { long [ ] data = new long [ <NUM_LIT> ] ; data [ <NUM_LIT:0> ] = - <NUM_LIT> ; for ( int i = <NUM_LIT:1> ; i <= <NUM_LIT> ; i ++ ) { data [ i ] = - <NUM_LIT:1L> ; } data [ <NUM_LIT> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_6 = new BitSet ( mk_tokenSet_6 ( ) ) ; private static final long [ ] mk_tokenSet_7 ( ) { long [ ] data = new long [ <NUM_LIT> ] ; data [ <NUM_LIT:0> ] = - <NUM_LIT> ; for ( int i = <NUM_LIT:1> ; i <= <NUM_LIT> ; i ++ ) { data [ i ] = - <NUM_LIT:1L> ; } data [ <NUM_LIT> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_7 = new BitSet ( mk_tokenSet_7 ( ) ) ; private static final long [ ] mk_tokenSet_8 ( ) { long [ ] data = new long [ <NUM_LIT> ] ; data [ <NUM_LIT:0> ] = - <NUM_LIT> ; for ( int i = <NUM_LIT:1> ; i <= <NUM_LIT> ; i ++ ) { data [ i ] = - <NUM_LIT:1L> ; } data [ <NUM_LIT> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_8 = new BitSet ( mk_tokenSet_8 ( ) ) ; private static final long [ ] mk_tokenSet_9 ( ) { long [ ] data = new long [ <NUM_LIT> ] ; data [ <NUM_LIT:0> ] = - <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; for ( int i = <NUM_LIT:2> ; i <= <NUM_LIT> ; i ++ ) { data [ i ] = - <NUM_LIT:1L> ; } data [ <NUM_LIT> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_9 = new BitSet ( mk_tokenSet_9 ( ) ) ; private static final long [ ] mk_tokenSet_10 ( ) { long [ ] data = new long [ <NUM_LIT> ] ; data [ <NUM_LIT:0> ] = - <NUM_LIT> ; for ( int i = <NUM_LIT:1> ; i <= <NUM_LIT> ; i ++ ) { data [ i ] = - <NUM_LIT:1L> ; } data [ <NUM_LIT> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_10 = new BitSet ( mk_tokenSet_10 ( ) ) ; private static final long [ ] mk_tokenSet_11 ( ) { long [ ] data = new long [ <NUM_LIT> ] ; data [ <NUM_LIT:0> ] = - <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; for ( int i = <NUM_LIT:2> ; i <= <NUM_LIT> ; i ++ ) { data [ i ] = - <NUM_LIT:1L> ; } data [ <NUM_LIT> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_11 = new BitSet ( mk_tokenSet_11 ( ) ) ; private static final long [ ] mk_tokenSet_12 ( ) { long [ ] data = new long [ <NUM_LIT> ] ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = - <NUM_LIT> ; for ( int i = <NUM_LIT:4> ; i <= <NUM_LIT> ; i ++ ) { data [ i ] = - <NUM_LIT:1L> ; } data [ <NUM_LIT> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_12 = new BitSet ( mk_tokenSet_12 ( ) ) ; private static final long [ ] mk_tokenSet_13 ( ) { long [ ] data = new long [ <NUM_LIT> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_13 = new BitSet ( mk_tokenSet_13 ( ) ) ; private static final long [ ] mk_tokenSet_14 ( ) { long [ ] data = new long [ <NUM_LIT> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_14 = new BitSet ( mk_tokenSet_14 ( ) ) ; private static final long [ ] mk_tokenSet_15 ( ) { long [ ] data = new long [ <NUM_LIT> ] ; data [ <NUM_LIT:0> ] = - <NUM_LIT> ; for ( int i = <NUM_LIT:1> ; i <= <NUM_LIT> ; i ++ ) { data [ i ] = - <NUM_LIT:1L> ; } return data ; } public static final BitSet _tokenSet_15 = new BitSet ( mk_tokenSet_15 ( ) ) ; } </s>
|
<s> package org . codehaus . groovy . antlr . parser ; import org . codehaus . groovy . antlr . * ; import java . util . * ; import java . io . InputStream ; import java . io . Reader ; import antlr . InputBuffer ; import antlr . LexerSharedInputState ; import antlr . CommonToken ; import org . codehaus . groovy . GroovyBugError ; import antlr . TokenStreamRecognitionException ; import org . codehaus . groovy . ast . Comment ; public interface GroovyTokenTypes { int EOF = <NUM_LIT:1> ; int NULL_TREE_LOOKAHEAD = <NUM_LIT:3> ; int BLOCK = <NUM_LIT:4> ; int MODIFIERS = <NUM_LIT:5> ; int OBJBLOCK = <NUM_LIT:6> ; int SLIST = <NUM_LIT:7> ; int METHOD_DEF = <NUM_LIT:8> ; int VARIABLE_DEF = <NUM_LIT:9> ; int INSTANCE_INIT = <NUM_LIT:10> ; int STATIC_INIT = <NUM_LIT:11> ; int TYPE = <NUM_LIT:12> ; int CLASS_DEF = <NUM_LIT> ; int INTERFACE_DEF = <NUM_LIT> ; int PACKAGE_DEF = <NUM_LIT:15> ; int ARRAY_DECLARATOR = <NUM_LIT:16> ; int EXTENDS_CLAUSE = <NUM_LIT> ; int IMPLEMENTS_CLAUSE = <NUM_LIT> ; int PARAMETERS = <NUM_LIT> ; int PARAMETER_DEF = <NUM_LIT:20> ; int LABELED_STAT = <NUM_LIT> ; int TYPECAST = <NUM_LIT> ; int INDEX_OP = <NUM_LIT> ; int POST_INC = <NUM_LIT:24> ; int POST_DEC = <NUM_LIT> ; int METHOD_CALL = <NUM_LIT> ; int EXPR = <NUM_LIT> ; int IMPORT = <NUM_LIT> ; int UNARY_MINUS = <NUM_LIT> ; int UNARY_PLUS = <NUM_LIT:30> ; int CASE_GROUP = <NUM_LIT:31> ; int ELIST = <NUM_LIT:32> ; int FOR_INIT = <NUM_LIT> ; int FOR_CONDITION = <NUM_LIT> ; int FOR_ITERATOR = <NUM_LIT> ; int EMPTY_STAT = <NUM_LIT> ; int FINAL = <NUM_LIT> ; int ABSTRACT = <NUM_LIT> ; int UNUSED_GOTO = <NUM_LIT> ; int UNUSED_CONST = <NUM_LIT> ; int UNUSED_DO = <NUM_LIT> ; int STRICTFP = <NUM_LIT> ; int SUPER_CTOR_CALL = <NUM_LIT> ; int CTOR_CALL = <NUM_LIT> ; int CTOR_IDENT = <NUM_LIT> ; int VARIABLE_PARAMETER_DEF = <NUM_LIT> ; int STRING_CONSTRUCTOR = <NUM_LIT> ; int STRING_CTOR_MIDDLE = <NUM_LIT> ; int CLOSABLE_BLOCK = <NUM_LIT> ; int IMPLICIT_PARAMETERS = <NUM_LIT> ; int SELECT_SLOT = <NUM_LIT> ; int DYNAMIC_MEMBER = <NUM_LIT> ; int LABELED_ARG = <NUM_LIT> ; int SPREAD_ARG = <NUM_LIT> ; int SPREAD_MAP_ARG = <NUM_LIT> ; int LIST_CONSTRUCTOR = <NUM_LIT> ; int MAP_CONSTRUCTOR = <NUM_LIT> ; int FOR_IN_ITERABLE = <NUM_LIT> ; int STATIC_IMPORT = <NUM_LIT> ; int ENUM_DEF = <NUM_LIT> ; int ENUM_CONSTANT_DEF = <NUM_LIT> ; int FOR_EACH_CLAUSE = <NUM_LIT> ; int ANNOTATION_DEF = <NUM_LIT> ; int ANNOTATIONS = <NUM_LIT> ; int ANNOTATION = <NUM_LIT> ; int ANNOTATION_MEMBER_VALUE_PAIR = <NUM_LIT> ; int ANNOTATION_FIELD_DEF = <NUM_LIT> ; int ANNOTATION_ARRAY_INIT = <NUM_LIT> ; int TYPE_ARGUMENTS = <NUM_LIT> ; int TYPE_ARGUMENT = <NUM_LIT> ; int TYPE_PARAMETERS = <NUM_LIT> ; int TYPE_PARAMETER = <NUM_LIT> ; int WILDCARD_TYPE = <NUM_LIT> ; int TYPE_UPPER_BOUNDS = <NUM_LIT> ; int TYPE_LOWER_BOUNDS = <NUM_LIT> ; int CLOSURE_LIST = <NUM_LIT> ; int MULTICATCH = <NUM_LIT> ; int MULTICATCH_TYPES = <NUM_LIT> ; int SH_COMMENT = <NUM_LIT> ; int LITERAL_package = <NUM_LIT> ; int LITERAL_import = <NUM_LIT> ; int LITERAL_static = <NUM_LIT> ; int LITERAL_def = <NUM_LIT> ; int LBRACK = <NUM_LIT> ; int RBRACK = <NUM_LIT> ; int IDENT = <NUM_LIT> ; int STRING_LITERAL = <NUM_LIT> ; int LT = <NUM_LIT> ; int DOT = <NUM_LIT> ; int LPAREN = <NUM_LIT> ; int LITERAL_class = <NUM_LIT> ; int LITERAL_interface = <NUM_LIT> ; int LITERAL_enum = <NUM_LIT> ; int AT = <NUM_LIT> ; int QUESTION = <NUM_LIT> ; int LITERAL_extends = <NUM_LIT> ; int LITERAL_super = <NUM_LIT> ; int GT = <NUM_LIT> ; int COMMA = <NUM_LIT> ; int SR = <NUM_LIT:100> ; int BSR = <NUM_LIT> ; int LITERAL_void = <NUM_LIT> ; int LITERAL_boolean = <NUM_LIT> ; int LITERAL_byte = <NUM_LIT> ; int LITERAL_char = <NUM_LIT> ; int LITERAL_short = <NUM_LIT> ; int LITERAL_int = <NUM_LIT> ; int LITERAL_float = <NUM_LIT> ; int LITERAL_long = <NUM_LIT> ; int LITERAL_double = <NUM_LIT> ; int STAR = <NUM_LIT> ; int LITERAL_as = <NUM_LIT> ; int LITERAL_private = <NUM_LIT> ; int LITERAL_public = <NUM_LIT> ; int LITERAL_protected = <NUM_LIT> ; int LITERAL_transient = <NUM_LIT> ; int LITERAL_native = <NUM_LIT> ; int LITERAL_threadsafe = <NUM_LIT> ; int LITERAL_synchronized = <NUM_LIT> ; int LITERAL_volatile = <NUM_LIT> ; int RPAREN = <NUM_LIT> ; int ASSIGN = <NUM_LIT> ; int BAND = <NUM_LIT> ; int LCURLY = <NUM_LIT> ; int RCURLY = <NUM_LIT> ; int SEMI = <NUM_LIT> ; int LITERAL_default = <NUM_LIT> ; int LITERAL_throws = <NUM_LIT> ; int LITERAL_implements = <NUM_LIT> ; int LITERAL_this = <NUM_LIT> ; int TRIPLE_DOT = <NUM_LIT> ; int BOR = <NUM_LIT> ; int CLOSABLE_BLOCK_OP = <NUM_LIT> ; int COLON = <NUM_LIT> ; int LITERAL_if = <NUM_LIT> ; int LITERAL_else = <NUM_LIT> ; int LITERAL_while = <NUM_LIT> ; int LITERAL_switch = <NUM_LIT> ; int LITERAL_for = <NUM_LIT> ; int LITERAL_in = <NUM_LIT> ; int LITERAL_return = <NUM_LIT> ; int LITERAL_break = <NUM_LIT> ; int LITERAL_continue = <NUM_LIT> ; int LITERAL_throw = <NUM_LIT> ; int LITERAL_assert = <NUM_LIT> ; int PLUS = <NUM_LIT> ; int MINUS = <NUM_LIT> ; int LITERAL_case = <NUM_LIT> ; int LITERAL_try = <NUM_LIT> ; int LITERAL_finally = <NUM_LIT> ; int LITERAL_catch = <NUM_LIT> ; int SPREAD_DOT = <NUM_LIT> ; int OPTIONAL_DOT = <NUM_LIT> ; int MEMBER_POINTER = <NUM_LIT> ; int LITERAL_false = <NUM_LIT> ; int LITERAL_instanceof = <NUM_LIT> ; int LITERAL_new = <NUM_LIT> ; int LITERAL_null = <NUM_LIT> ; int LITERAL_true = <NUM_LIT> ; int PLUS_ASSIGN = <NUM_LIT> ; int MINUS_ASSIGN = <NUM_LIT> ; int STAR_ASSIGN = <NUM_LIT> ; int DIV_ASSIGN = <NUM_LIT> ; int MOD_ASSIGN = <NUM_LIT> ; int SR_ASSIGN = <NUM_LIT> ; int BSR_ASSIGN = <NUM_LIT> ; int SL_ASSIGN = <NUM_LIT> ; int BAND_ASSIGN = <NUM_LIT> ; int BXOR_ASSIGN = <NUM_LIT> ; int BOR_ASSIGN = <NUM_LIT> ; int STAR_STAR_ASSIGN = <NUM_LIT> ; int ELVIS_OPERATOR = <NUM_LIT> ; int LOR = <NUM_LIT> ; int LAND = <NUM_LIT> ; int BXOR = <NUM_LIT> ; int REGEX_FIND = <NUM_LIT> ; int REGEX_MATCH = <NUM_LIT> ; int NOT_EQUAL = <NUM_LIT> ; int EQUAL = <NUM_LIT> ; int IDENTICAL = <NUM_LIT> ; int NOT_IDENTICAL = <NUM_LIT> ; int COMPARE_TO = <NUM_LIT> ; int LE = <NUM_LIT> ; int GE = <NUM_LIT> ; int SL = <NUM_LIT> ; int RANGE_INCLUSIVE = <NUM_LIT> ; int RANGE_EXCLUSIVE = <NUM_LIT> ; int INC = <NUM_LIT> ; int DIV = <NUM_LIT> ; int MOD = <NUM_LIT> ; int DEC = <NUM_LIT> ; int STAR_STAR = <NUM_LIT> ; int BNOT = <NUM_LIT> ; int LNOT = <NUM_LIT> ; int STRING_CTOR_START = <NUM_LIT> ; int STRING_CTOR_END = <NUM_LIT> ; int NUM_INT = <NUM_LIT> ; int NUM_FLOAT = <NUM_LIT> ; int NUM_LONG = <NUM_LIT> ; int NUM_DOUBLE = <NUM_LIT> ; int NUM_BIG_INT = <NUM_LIT> ; int NUM_BIG_DECIMAL = <NUM_LIT> ; int NLS = <NUM_LIT> ; int DOLLAR = <NUM_LIT> ; int WS = <NUM_LIT> ; int ONE_NL = <NUM_LIT> ; int ONE_NL_KEEP = <NUM_LIT> ; int SL_COMMENT = <NUM_LIT> ; int ML_COMMENT = <NUM_LIT> ; int STRING_CH = <NUM_LIT> ; int REGEXP_LITERAL = <NUM_LIT> ; int DOLLAR_REGEXP_LITERAL = <NUM_LIT> ; int REGEXP_CTOR_END = <NUM_LIT> ; int DOLLAR_REGEXP_CTOR_END = <NUM_LIT> ; int ESCAPED_SLASH = <NUM_LIT> ; int ESCAPED_DOLLAR = <NUM_LIT> ; int REGEXP_SYMBOL = <NUM_LIT> ; int DOLLAR_REGEXP_SYMBOL = <NUM_LIT> ; int ESC = <NUM_LIT> ; int STRING_NL = <NUM_LIT> ; int HEX_DIGIT = <NUM_LIT> ; int VOCAB = <NUM_LIT> ; int LETTER = <NUM_LIT> ; int DIGIT = <NUM_LIT> ; int DIGITS_WITH_UNDERSCORE = <NUM_LIT> ; int DIGITS_WITH_UNDERSCORE_OPT = <NUM_LIT> ; int EXPONENT = <NUM_LIT> ; int FLOAT_SUFFIX = <NUM_LIT> ; int BIG_SUFFIX = <NUM_LIT> ; } </s>
|
<s> package org . codehaus . groovy . antlr . parser ; import org . codehaus . groovy . antlr . * ; import java . util . * ; import java . io . InputStream ; import java . io . Reader ; import antlr . InputBuffer ; import antlr . LexerSharedInputState ; import antlr . CommonToken ; import org . codehaus . groovy . GroovyBugError ; import antlr . TokenStreamRecognitionException ; import org . codehaus . groovy . ast . Comment ; import antlr . TokenBuffer ; import antlr . TokenStreamException ; import antlr . TokenStreamIOException ; import antlr . ANTLRException ; import antlr . LLkParser ; import antlr . Token ; import antlr . TokenStream ; import antlr . RecognitionException ; import antlr . NoViableAltException ; import antlr . MismatchedTokenException ; import antlr . SemanticException ; import antlr . ParserSharedInputState ; import antlr . collections . impl . BitSet ; import antlr . collections . AST ; import java . util . Hashtable ; import antlr . ASTFactory ; import antlr . ASTPair ; import antlr . collections . impl . ASTArray ; public class GroovyRecognizer extends antlr . LLkParser implements GroovyTokenTypes { public static GroovyRecognizer make ( GroovyLexer lexer ) { GroovyRecognizer parser = new GroovyRecognizer ( lexer . plumb ( ) ) ; parser . lexer = lexer ; lexer . parser = parser ; parser . getASTFactory ( ) . setASTNodeClass ( GroovySourceAST . class ) ; parser . warningList = new ArrayList ( ) ; parser . errorList = new ArrayList ( ) ; return parser ; } public static GroovyRecognizer make ( InputStream in ) { return make ( new GroovyLexer ( in ) ) ; } public static GroovyRecognizer make ( Reader in ) { return make ( new GroovyLexer ( in ) ) ; } public static GroovyRecognizer make ( InputBuffer in ) { return make ( new GroovyLexer ( in ) ) ; } public static GroovyRecognizer make ( LexerSharedInputState in ) { return make ( new GroovyLexer ( in ) ) ; } private static GroovySourceAST dummyVariableToforceClassLoaderToFindASTClass = new GroovySourceAST ( ) ; List warningList ; public List getWarningList ( ) { return warningList ; } List errorList ; public List getErrorList ( ) { return errorList ; } List < Comment > comments = new ArrayList < Comment > ( ) ; public List < Comment > getComments ( ) { return comments ; } GroovyLexer lexer ; public GroovyLexer getLexer ( ) { return lexer ; } public void setFilename ( String f ) { super . setFilename ( f ) ; lexer . setFilename ( f ) ; } private SourceBuffer sourceBuffer ; public void setSourceBuffer ( SourceBuffer sourceBuffer ) { this . sourceBuffer = sourceBuffer ; } public AST create ( int type , String txt , AST first ) { AST t = astFactory . create ( type , txt ) ; if ( t != null && first != null ) { t . initialize ( first ) ; t . initialize ( type , txt ) ; } return t ; } public AST create2 ( int type , String txt , Token first , Token last ) { return setEndLocationBasedOnThisNode ( create ( type , txt , astFactory . create ( first ) ) , last ) ; } private AST setEndLocationBasedOnThisNode ( AST ast , Object node ) { if ( ( ast instanceof GroovySourceAST ) && ( node instanceof SourceInfo ) ) { SourceInfo lastInfo = ( SourceInfo ) node ; GroovySourceAST groovySourceAst = ( GroovySourceAST ) ast ; groovySourceAst . setColumnLast ( lastInfo . getColumnLast ( ) ) ; groovySourceAst . setLineLast ( lastInfo . getLineLast ( ) ) ; } return ast ; } private AST attachLast ( AST t , Object last ) { if ( ( t instanceof GroovySourceAST ) && ( last instanceof SourceInfo ) ) { SourceInfo lastInfo = ( SourceInfo ) last ; GroovySourceAST node = ( GroovySourceAST ) t ; node . setColumnLast ( lastInfo . getColumn ( ) ) ; node . setLineLast ( lastInfo . getLine ( ) ) ; } return t ; } public AST create ( int type , String txt , Token first , Token last ) { return attachLast ( create ( type , txt , astFactory . create ( first ) ) , last ) ; } public AST create ( int type , String txt , AST first , Token last ) { return attachLast ( create ( type , txt , first ) , last ) ; } public AST create ( int type , String txt , AST first , AST last ) { return attachLast ( create ( type , txt , first ) , last ) ; } private Stack < Integer > commentStartPositions = new Stack < Integer > ( ) ; public void startComment ( int line , int column ) { commentStartPositions . push ( ( line << <NUM_LIT:16> ) + column ) ; } public void endComment ( int type , int line , int column , String text ) { int lineAndColumn = commentStartPositions . pop ( ) ; int startLine = lineAndColumn > > > <NUM_LIT:16> ; int startColumn = lineAndColumn & <NUM_LIT> ; if ( type == <NUM_LIT:0> ) { Comment comment = Comment . makeSingleLineComment ( startLine , startColumn , line , column , text ) ; comments . add ( comment ) ; } else if ( type == <NUM_LIT:1> ) { Comment comment = Comment . makeMultiLineComment ( startLine , startColumn , line , column , text ) ; comments . add ( comment ) ; } } public Token cloneToken ( Token t ) { CommonToken clone = new CommonToken ( t . getType ( ) , t . getText ( ) ) ; clone . setLine ( t . getLine ( ) ) ; clone . setColumn ( t . getColumn ( ) ) ; return clone ; } public static boolean tracing = false ; public void traceIn ( String rname ) throws TokenStreamException { if ( ! GroovyRecognizer . tracing ) return ; super . traceIn ( rname ) ; } public void traceOut ( String rname ) throws TokenStreamException { if ( ! GroovyRecognizer . tracing ) return ; if ( returnAST != null ) rname += returnAST . toStringList ( ) ; super . traceOut ( rname ) ; } public void requireFailed ( String problem , String solution ) throws SemanticException { Token lt = null ; int lineNum = Token . badToken . getLine ( ) , colNum = Token . badToken . getColumn ( ) ; try { lt = LT ( <NUM_LIT:1> ) ; if ( lt != null ) { lineNum = lt . getLine ( ) ; colNum = lt . getColumn ( ) ; } } catch ( TokenStreamException ee ) { if ( ee instanceof TokenStreamRecognitionException ) { lineNum = ( ( TokenStreamRecognitionException ) ee ) . recog . getLine ( ) ; colNum = ( ( TokenStreamRecognitionException ) ee ) . recog . getColumn ( ) ; } } throw new SemanticException ( problem + "<STR_LIT>" + solution , getFilename ( ) , lineNum , colNum ) ; } public void addWarning ( String warning , String solution ) { Token lt = null ; try { lt = LT ( <NUM_LIT:1> ) ; } catch ( TokenStreamException ee ) { } if ( lt == null ) lt = Token . badToken ; Map row = new HashMap ( ) ; row . put ( "<STR_LIT>" , warning ) ; row . put ( "<STR_LIT>" , solution ) ; row . put ( "<STR_LIT>" , getFilename ( ) ) ; row . put ( "<STR_LIT>" , Integer . valueOf ( lt . getLine ( ) ) ) ; row . put ( "<STR_LIT>" , Integer . valueOf ( lt . getColumn ( ) ) ) ; warningList . add ( row ) ; } public void reportError ( String message ) { Token lt = null ; try { lt = LT ( <NUM_LIT:1> ) ; } catch ( TokenStreamException ee ) { } if ( lt == null ) lt = Token . badToken ; Map row = new HashMap ( ) ; row . put ( "<STR_LIT:error>" , message ) ; row . put ( "<STR_LIT>" , getFilename ( ) ) ; row . put ( "<STR_LIT>" , new Integer ( lt . getLine ( ) ) ) ; row . put ( "<STR_LIT>" , new Integer ( lt . getColumn ( ) ) ) ; errorList . add ( row ) ; } public void reportError ( String message , Token lt ) { Map row = new HashMap ( ) ; row . put ( "<STR_LIT:error>" , message ) ; row . put ( "<STR_LIT>" , getFilename ( ) ) ; row . put ( "<STR_LIT>" , new Integer ( lt . getLine ( ) ) ) ; row . put ( "<STR_LIT>" , new Integer ( lt . getColumn ( ) ) ) ; errorList . add ( row ) ; } public void reportError ( String message , AST lt ) { Map row = new HashMap ( ) ; row . put ( "<STR_LIT:error>" , message ) ; row . put ( "<STR_LIT>" , getFilename ( ) ) ; row . put ( "<STR_LIT>" , new Integer ( lt . getLine ( ) ) ) ; row . put ( "<STR_LIT>" , new Integer ( lt . getColumn ( ) ) ) ; errorList . add ( row ) ; } public void reportError ( RecognitionException e ) { Token lt = null ; try { lt = LT ( <NUM_LIT:1> ) ; } catch ( TokenStreamException ee ) { } if ( lt == null ) lt = Token . badToken ; Map row = new HashMap ( ) ; row . put ( "<STR_LIT:error>" , e . getMessage ( ) ) ; row . put ( "<STR_LIT>" , getFilename ( ) ) ; row . put ( "<STR_LIT>" , Integer . valueOf ( lt . getLine ( ) ) ) ; row . put ( "<STR_LIT>" , Integer . valueOf ( lt . getColumn ( ) ) ) ; errorList . add ( row ) ; } private void require ( boolean z , String problem , String solution ) throws SemanticException { if ( ! z ) requireFailed ( problem , solution ) ; } private boolean matchGenericTypeBrackets ( boolean z , String problem , String solution ) throws SemanticException { if ( ! z ) matchGenericTypeBracketsFailed ( problem , solution ) ; return z ; } public void matchGenericTypeBracketsFailed ( String problem , String solution ) throws SemanticException { Token lt = null ; int lineNum = Token . badToken . getLine ( ) , colNum = Token . badToken . getColumn ( ) ; try { lt = LT ( <NUM_LIT:1> ) ; if ( lt != null ) { lineNum = lt . getLine ( ) ; colNum = lt . getColumn ( ) ; } } catch ( TokenStreamException ee ) { if ( ee instanceof TokenStreamRecognitionException ) { lineNum = ( ( TokenStreamRecognitionException ) ee ) . recog . getLine ( ) ; colNum = ( ( TokenStreamRecognitionException ) ee ) . recog . getColumn ( ) ; } } throw new SemanticException ( problem + "<STR_LIT>" + solution , getFilename ( ) , lineNum , colNum ) ; } private boolean isUpperCase ( Token x ) { if ( x == null || x . getType ( ) != IDENT ) return false ; String xtext = x . getText ( ) ; return ( xtext . length ( ) > <NUM_LIT:0> && Character . isUpperCase ( xtext . charAt ( <NUM_LIT:0> ) ) ) ; } private AST currentClass = null ; private boolean isConstructorIdent ( Token x ) { if ( currentClass == null ) return false ; if ( currentClass . getType ( ) != IDENT ) return false ; String cname = currentClass . getText ( ) ; if ( x == null || x . getType ( ) != IDENT ) return false ; return cname . equals ( x . getText ( ) ) ; } private void dumpTree ( AST ast , String offset ) { dump ( ast , offset ) ; for ( AST node = ast . getFirstChild ( ) ; node != null ; node = node . getNextSibling ( ) ) { dumpTree ( node , offset + "<STR_LIT:t>" ) ; } } private void dump ( AST node , String offset ) { System . out . println ( offset + "<STR_LIT>" + getTokenName ( node ) + "<STR_LIT>" + node . getText ( ) ) ; } private String getTokenName ( AST node ) { if ( node == null ) return "<STR_LIT:null>" ; return getTokenName ( node . getType ( ) ) ; } private int sepToken = EOF ; private boolean argListHasLabels = false ; private AST lastPathExpression = null ; private final int LC_STMT = <NUM_LIT:1> , LC_INIT = <NUM_LIT:2> ; private int ltCounter = <NUM_LIT:0> ; private static final boolean ANTLR_LOOP_EXIT = false ; protected GroovyRecognizer ( TokenBuffer tokenBuf , int k ) { super ( tokenBuf , k ) ; tokenNames = _tokenNames ; buildTokenTypeASTClassMap ( ) ; astFactory = new ASTFactory ( getTokenTypeToASTClassMap ( ) ) ; } public GroovyRecognizer ( TokenBuffer tokenBuf ) { this ( tokenBuf , <NUM_LIT:2> ) ; } protected GroovyRecognizer ( TokenStream lexer , int k ) { super ( lexer , k ) ; tokenNames = _tokenNames ; buildTokenTypeASTClassMap ( ) ; astFactory = new ASTFactory ( getTokenTypeToASTClassMap ( ) ) ; } public GroovyRecognizer ( TokenStream lexer ) { this ( lexer , <NUM_LIT:2> ) ; } public GroovyRecognizer ( ParserSharedInputState state ) { super ( state , <NUM_LIT:2> ) ; tokenNames = _tokenNames ; buildTokenTypeASTClassMap ( ) ; astFactory = new ASTFactory ( getTokenTypeToASTClassMap ( ) ) ; } public final void compilationUnit ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST compilationUnit_AST = null ; try { { switch ( LA ( <NUM_LIT:1> ) ) { case SH_COMMENT : { match ( SH_COMMENT ) ; break ; } case EOF : case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_package : case LITERAL_import : case LITERAL_static : case LITERAL_def : case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : case SEMI : case LITERAL_this : case LITERAL_if : case LITERAL_while : case LITERAL_switch : case LITERAL_for : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case PLUS : case MINUS : case LITERAL_try : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } nls ( ) ; { boolean synPredMatched5 = false ; if ( ( ( LA ( <NUM_LIT:1> ) == LITERAL_package || LA ( <NUM_LIT:1> ) == AT ) && ( _tokenSet_0 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m5 = mark ( ) ; synPredMatched5 = true ; inputState . guessing ++ ; try { { annotationsOpt ( ) ; match ( LITERAL_package ) ; } } catch ( RecognitionException pe ) { synPredMatched5 = false ; } rewind ( _m5 ) ; inputState . guessing -- ; } if ( synPredMatched5 ) { packageDefinition ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else if ( ( _tokenSet_1 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_2 . member ( LA ( <NUM_LIT:2> ) ) ) ) { { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_import : case LITERAL_static : case LITERAL_def : case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : case LITERAL_this : case LITERAL_if : case LITERAL_while : case LITERAL_switch : case LITERAL_for : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case PLUS : case MINUS : case LITERAL_try : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { statement ( EOF ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case EOF : case SEMI : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } { _loop9 : do { if ( ( LA ( <NUM_LIT:1> ) == SEMI || LA ( <NUM_LIT:1> ) == NLS ) ) { sep ( ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_import : case LITERAL_static : case LITERAL_def : case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : case LITERAL_this : case LITERAL_if : case LITERAL_while : case LITERAL_switch : case LITERAL_for : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case PLUS : case MINUS : case LITERAL_try : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { statement ( sepToken ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case EOF : case SEMI : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } } else { break _loop9 ; } } while ( true ) ; } match ( Token . EOF_TYPE ) ; compilationUnit_AST = ( AST ) currentAST . root ; } catch ( RecognitionException e ) { if ( inputState . guessing == <NUM_LIT:0> ) { reportError ( e ) ; compilationUnit_AST = ( AST ) currentAST . root ; } else { throw e ; } } returnAST = compilationUnit_AST ; } public final void nls ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST nls_AST = null ; { if ( ( LA ( <NUM_LIT:1> ) == NLS ) && ( _tokenSet_3 . member ( LA ( <NUM_LIT:2> ) ) ) ) { match ( NLS ) ; } else if ( ( _tokenSet_3 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_4 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = nls_AST ; } public final void annotationsOpt ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST annotationsOpt_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; { if ( ( _tokenSet_5 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_6 . member ( LA ( <NUM_LIT:2> ) ) ) ) { annotationsInternal ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else if ( ( _tokenSet_7 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_8 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } if ( inputState . guessing == <NUM_LIT:0> ) { annotationsOpt_AST = ( AST ) currentAST . root ; annotationsOpt_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( ANNOTATIONS , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( annotationsOpt_AST ) ) ; currentAST . root = annotationsOpt_AST ; currentAST . child = annotationsOpt_AST != null && annotationsOpt_AST . getFirstChild ( ) != null ? annotationsOpt_AST . getFirstChild ( ) : annotationsOpt_AST ; currentAST . advanceChildToEnd ( ) ; } annotationsOpt_AST = ( AST ) currentAST . root ; returnAST = annotationsOpt_AST ; } public final void packageDefinition ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST packageDefinition_AST = null ; AST an_AST = null ; AST id_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; annotationsOpt ( ) ; an_AST = ( AST ) returnAST ; match ( LITERAL_package ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case IDENT : { identifier ( ) ; id_AST = ( AST ) returnAST ; break ; } case EOF : case SEMI : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { packageDefinition_AST = ( AST ) currentAST . root ; if ( id_AST == null ) { reportError ( "<STR_LIT>" , LT ( <NUM_LIT:0> ) ) ; } else { packageDefinition_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( PACKAGE_DEF , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( an_AST ) . add ( id_AST ) ) ; } currentAST . root = packageDefinition_AST ; currentAST . child = packageDefinition_AST != null && packageDefinition_AST . getFirstChild ( ) != null ? packageDefinition_AST . getFirstChild ( ) : packageDefinition_AST ; currentAST . advanceChildToEnd ( ) ; } packageDefinition_AST = ( AST ) currentAST . root ; returnAST = packageDefinition_AST ; } public final void statement ( int prevToken ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST statement_AST = null ; AST pfx_AST = null ; AST es_AST = null ; AST ale_AST = null ; AST ifCbs_AST = null ; AST elseCbs_AST = null ; AST while_sce_AST = null ; Token s = null ; AST s_AST = null ; AST while_cbs_AST = null ; AST m_AST = null ; AST switchSce_AST = null ; AST cg_AST = null ; AST synch_sce_AST = null ; AST synch_cs_AST = null ; boolean sce = false ; Token first = LT ( <NUM_LIT:1> ) ; AST casesGroup_AST = null ; try { switch ( LA ( <NUM_LIT:1> ) ) { case LITERAL_if : { match ( LITERAL_if ) ; match ( LPAREN ) ; assignmentLessExpression ( ) ; ale_AST = ( AST ) returnAST ; match ( RPAREN ) ; nlsWarn ( ) ; compatibleBodyStatement ( ) ; ifCbs_AST = ( AST ) returnAST ; { boolean synPredMatched304 = false ; if ( ( ( _tokenSet_9 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_10 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m304 = mark ( ) ; synPredMatched304 = true ; inputState . guessing ++ ; try { { { switch ( LA ( <NUM_LIT:1> ) ) { case SEMI : case NLS : { sep ( ) ; break ; } case LITERAL_else : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } match ( LITERAL_else ) ; } } catch ( RecognitionException pe ) { synPredMatched304 = false ; } rewind ( _m304 ) ; inputState . guessing -- ; } if ( synPredMatched304 ) { { switch ( LA ( <NUM_LIT:1> ) ) { case SEMI : case NLS : { sep ( ) ; break ; } case LITERAL_else : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } match ( LITERAL_else ) ; nlsWarn ( ) ; compatibleBodyStatement ( ) ; elseCbs_AST = ( AST ) returnAST ; } else if ( ( _tokenSet_11 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_12 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } if ( inputState . guessing == <NUM_LIT:0> ) { statement_AST = ( AST ) currentAST . root ; statement_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:4> ) ) . add ( create ( LITERAL_if , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( ale_AST ) . add ( ifCbs_AST ) . add ( elseCbs_AST ) ) ; currentAST . root = statement_AST ; currentAST . child = statement_AST != null && statement_AST . getFirstChild ( ) != null ? statement_AST . getFirstChild ( ) : statement_AST ; currentAST . advanceChildToEnd ( ) ; } statement_AST = ( AST ) currentAST . root ; break ; } case LITERAL_for : { forStatement ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; statement_AST = ( AST ) currentAST . root ; break ; } case LITERAL_while : { match ( LITERAL_while ) ; match ( LPAREN ) ; sce = strictContextExpression ( false ) ; while_sce_AST = ( AST ) returnAST ; match ( RPAREN ) ; nlsWarn ( ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case SEMI : { s = LT ( <NUM_LIT:1> ) ; s_AST = astFactory . create ( s ) ; match ( SEMI ) ; break ; } case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_import : case LITERAL_static : case LITERAL_def : case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : case LITERAL_this : case LITERAL_if : case LITERAL_while : case LITERAL_switch : case LITERAL_for : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case PLUS : case MINUS : case LITERAL_try : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { compatibleBodyStatement ( ) ; while_cbs_AST = ( AST ) returnAST ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { statement_AST = ( AST ) currentAST . root ; if ( s_AST != null ) statement_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( LITERAL_while , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( while_sce_AST ) . add ( s_AST ) ) ; else statement_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( LITERAL_while , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( while_sce_AST ) . add ( while_cbs_AST ) ) ; currentAST . root = statement_AST ; currentAST . child = statement_AST != null && statement_AST . getFirstChild ( ) != null ? statement_AST . getFirstChild ( ) : statement_AST ; currentAST . advanceChildToEnd ( ) ; } statement_AST = ( AST ) currentAST . root ; break ; } case LITERAL_switch : { match ( LITERAL_switch ) ; match ( LPAREN ) ; sce = strictContextExpression ( false ) ; switchSce_AST = ( AST ) returnAST ; match ( RPAREN ) ; nlsWarn ( ) ; match ( LCURLY ) ; nls ( ) ; { _loop310 : do { if ( ( LA ( <NUM_LIT:1> ) == LITERAL_default || LA ( <NUM_LIT:1> ) == LITERAL_case ) ) { casesGroup ( ) ; cg_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { casesGroup_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( null ) . add ( casesGroup_AST ) . add ( cg_AST ) ) ; } } else { break _loop310 ; } } while ( true ) ; } match ( RCURLY ) ; if ( inputState . guessing == <NUM_LIT:0> ) { statement_AST = ( AST ) currentAST . root ; statement_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( LITERAL_switch , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( switchSce_AST ) . add ( casesGroup_AST ) ) ; currentAST . root = statement_AST ; currentAST . child = statement_AST != null && statement_AST . getFirstChild ( ) != null ? statement_AST . getFirstChild ( ) : statement_AST ; currentAST . advanceChildToEnd ( ) ; } statement_AST = ( AST ) currentAST . root ; break ; } case LITERAL_try : { tryBlock ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; statement_AST = ( AST ) currentAST . root ; break ; } case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : { branchStatement ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; statement_AST = ( AST ) currentAST . root ; break ; } default : boolean synPredMatched291 = false ; if ( ( ( _tokenSet_13 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_14 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m291 = mark ( ) ; synPredMatched291 = true ; inputState . guessing ++ ; try { { genericMethodStart ( ) ; } } catch ( RecognitionException pe ) { synPredMatched291 = false ; } rewind ( _m291 ) ; inputState . guessing -- ; } if ( synPredMatched291 ) { genericMethod ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; statement_AST = ( AST ) currentAST . root ; } else { boolean synPredMatched293 = false ; if ( ( ( _tokenSet_13 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_15 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m293 = mark ( ) ; synPredMatched293 = true ; inputState . guessing ++ ; try { { multipleAssignmentDeclarationStart ( ) ; } } catch ( RecognitionException pe ) { synPredMatched293 = false ; } rewind ( _m293 ) ; inputState . guessing -- ; } if ( synPredMatched293 ) { multipleAssignmentDeclaration ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; statement_AST = ( AST ) currentAST . root ; } else { boolean synPredMatched295 = false ; if ( ( ( _tokenSet_16 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_17 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m295 = mark ( ) ; synPredMatched295 = true ; inputState . guessing ++ ; try { { declarationStart ( ) ; } } catch ( RecognitionException pe ) { synPredMatched295 = false ; } rewind ( _m295 ) ; inputState . guessing -- ; } if ( synPredMatched295 ) { declaration ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; statement_AST = ( AST ) currentAST . root ; } else { boolean synPredMatched297 = false ; if ( ( ( LA ( <NUM_LIT:1> ) == IDENT ) && ( LA ( <NUM_LIT:2> ) == COLON ) ) ) { int _m297 = mark ( ) ; synPredMatched297 = true ; inputState . guessing ++ ; try { { match ( IDENT ) ; match ( COLON ) ; } } catch ( RecognitionException pe ) { synPredMatched297 = false ; } rewind ( _m297 ) ; inputState . guessing -- ; } if ( synPredMatched297 ) { statementLabelPrefix ( ) ; pfx_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { statement_AST = ( AST ) currentAST . root ; statement_AST = pfx_AST ; currentAST . root = statement_AST ; currentAST . child = statement_AST != null && statement_AST . getFirstChild ( ) != null ? statement_AST . getFirstChild ( ) : statement_AST ; currentAST . advanceChildToEnd ( ) ; } { boolean synPredMatched300 = false ; if ( ( ( LA ( <NUM_LIT:1> ) == LCURLY ) && ( _tokenSet_18 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m300 = mark ( ) ; synPredMatched300 = true ; inputState . guessing ++ ; try { { match ( LCURLY ) ; } } catch ( RecognitionException pe ) { synPredMatched300 = false ; } rewind ( _m300 ) ; inputState . guessing -- ; } if ( synPredMatched300 ) { openOrClosableBlock ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else if ( ( _tokenSet_19 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_2 . member ( LA ( <NUM_LIT:2> ) ) ) ) { statement ( COLON ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } statement_AST = ( AST ) currentAST . root ; } else if ( ( _tokenSet_20 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_2 . member ( LA ( <NUM_LIT:2> ) ) ) ) { expressionStatement ( prevToken ) ; es_AST = ( AST ) returnAST ; astFactory . addASTChild ( currentAST , returnAST ) ; statement_AST = ( AST ) currentAST . root ; } else { boolean synPredMatched308 = false ; if ( ( ( LA ( <NUM_LIT:1> ) == LITERAL_import || LA ( <NUM_LIT:1> ) == AT ) && ( _tokenSet_21 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m308 = mark ( ) ; synPredMatched308 = true ; inputState . guessing ++ ; try { { annotationsOpt ( ) ; match ( LITERAL_import ) ; } } catch ( RecognitionException pe ) { synPredMatched308 = false ; } rewind ( _m308 ) ; inputState . guessing -- ; } if ( synPredMatched308 ) { importStatement ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; statement_AST = ( AST ) currentAST . root ; } else if ( ( _tokenSet_22 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_23 . member ( LA ( <NUM_LIT:2> ) ) ) ) { modifiersOpt ( ) ; m_AST = ( AST ) returnAST ; typeDefinitionInternal ( m_AST ) ; astFactory . addASTChild ( currentAST , returnAST ) ; statement_AST = ( AST ) currentAST . root ; } else if ( ( LA ( <NUM_LIT:1> ) == LITERAL_synchronized ) && ( LA ( <NUM_LIT:2> ) == LPAREN ) ) { match ( LITERAL_synchronized ) ; match ( LPAREN ) ; sce = strictContextExpression ( false ) ; synch_sce_AST = ( AST ) returnAST ; match ( RPAREN ) ; nlsWarn ( ) ; compoundStatement ( ) ; synch_cs_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { statement_AST = ( AST ) currentAST . root ; statement_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( LITERAL_synchronized , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( synch_sce_AST ) . add ( synch_cs_AST ) ) ; currentAST . root = statement_AST ; currentAST . child = statement_AST != null && statement_AST . getFirstChild ( ) != null ? statement_AST . getFirstChild ( ) : statement_AST ; currentAST . advanceChildToEnd ( ) ; } statement_AST = ( AST ) currentAST . root ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } } } } } catch ( RecognitionException e ) { if ( inputState . guessing == <NUM_LIT:0> ) { boolean bang = true ; if ( pfx_AST != null ) { bang = false ; reportError ( e ) ; if ( e instanceof NoViableAltException ) { NoViableAltException nvae = ( NoViableAltException ) e ; if ( pfx_AST . getLine ( ) == nvae . token . getLine ( ) ) { consumeUntil ( NLS ) ; } } } if ( ale_AST != null && ifCbs_AST == null ) { statement_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:4> ) ) . add ( create ( LITERAL_if , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( ale_AST ) . add ( ifCbs_AST ) . add ( elseCbs_AST ) ) ; bang = false ; } if ( bang ) { throw e ; } } else { throw e ; } } returnAST = statement_AST ; } public final void sep ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST sep_AST = null ; switch ( LA ( <NUM_LIT:1> ) ) { case SEMI : { match ( SEMI ) ; { _loop578 : do { if ( ( LA ( <NUM_LIT:1> ) == NLS ) && ( _tokenSet_24 . member ( LA ( <NUM_LIT:2> ) ) ) ) { match ( NLS ) ; } else { break _loop578 ; } } while ( true ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { sepToken = SEMI ; } break ; } case NLS : { match ( NLS ) ; if ( inputState . guessing == <NUM_LIT:0> ) { sepToken = NLS ; } { _loop582 : do { if ( ( LA ( <NUM_LIT:1> ) == SEMI ) && ( _tokenSet_24 . member ( LA ( <NUM_LIT:2> ) ) ) ) { match ( SEMI ) ; { _loop581 : do { if ( ( LA ( <NUM_LIT:1> ) == NLS ) && ( _tokenSet_24 . member ( LA ( <NUM_LIT:2> ) ) ) ) { match ( NLS ) ; } else { break _loop581 ; } } while ( true ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { sepToken = SEMI ; } } else { break _loop582 ; } } while ( true ) ; } break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = sep_AST ; } public final void snippetUnit ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST snippetUnit_AST = null ; nls ( ) ; blockBody ( EOF ) ; astFactory . addASTChild ( currentAST , returnAST ) ; snippetUnit_AST = ( AST ) currentAST . root ; returnAST = snippetUnit_AST ; } public final void blockBody ( int prevToken ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST blockBody_AST = null ; { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_import : case LITERAL_static : case LITERAL_def : case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : case LITERAL_this : case LITERAL_if : case LITERAL_while : case LITERAL_switch : case LITERAL_for : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case PLUS : case MINUS : case LITERAL_try : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { statement ( prevToken ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case EOF : case RCURLY : case SEMI : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } { _loop285 : do { if ( ( LA ( <NUM_LIT:1> ) == SEMI || LA ( <NUM_LIT:1> ) == NLS ) ) { sep ( ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_import : case LITERAL_static : case LITERAL_def : case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : case LITERAL_this : case LITERAL_if : case LITERAL_while : case LITERAL_switch : case LITERAL_for : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case PLUS : case MINUS : case LITERAL_try : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { statement ( sepToken ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case EOF : case RCURLY : case SEMI : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } } else { break _loop285 ; } } while ( true ) ; } blockBody_AST = ( AST ) currentAST . root ; returnAST = blockBody_AST ; } public final void identifier ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST identifier_AST = null ; Token i1 = null ; AST i1_AST = null ; Token d = null ; AST d_AST = null ; Token i2 = null ; AST i2_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; i1 = LT ( <NUM_LIT:1> ) ; i1_AST = astFactory . create ( i1 ) ; match ( IDENT ) ; { _loop74 : do { if ( ( LA ( <NUM_LIT:1> ) == DOT ) ) { d = LT ( <NUM_LIT:1> ) ; d_AST = astFactory . create ( d ) ; match ( DOT ) ; nls ( ) ; i2 = LT ( <NUM_LIT:1> ) ; i2_AST = astFactory . create ( i2 ) ; match ( IDENT ) ; if ( inputState . guessing == <NUM_LIT:0> ) { i1_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( DOT , "<STR_LIT:.>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( i1_AST ) . add ( i2_AST ) ) ; } } else { break _loop74 ; } } while ( true ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { identifier_AST = ( AST ) currentAST . root ; identifier_AST = i1_AST ; currentAST . root = identifier_AST ; currentAST . child = identifier_AST != null && identifier_AST . getFirstChild ( ) != null ? identifier_AST . getFirstChild ( ) : identifier_AST ; currentAST . advanceChildToEnd ( ) ; } identifier_AST = ( AST ) currentAST . root ; returnAST = identifier_AST ; } public final void importStatement ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST importStatement_AST = null ; AST an_AST = null ; AST is_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; boolean isStatic = false ; annotationsOpt ( ) ; an_AST = ( AST ) returnAST ; astFactory . addASTChild ( currentAST , returnAST ) ; match ( LITERAL_import ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case LITERAL_static : { match ( LITERAL_static ) ; if ( inputState . guessing == <NUM_LIT:0> ) { isStatic = true ; } break ; } case EOF : case IDENT : case RCURLY : case SEMI : case LITERAL_default : case LITERAL_else : case LITERAL_case : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } { switch ( LA ( <NUM_LIT:1> ) ) { case IDENT : { identifierStar ( ) ; is_AST = ( AST ) returnAST ; break ; } case EOF : case RCURLY : case SEMI : case LITERAL_default : case LITERAL_else : case LITERAL_case : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { importStatement_AST = ( AST ) currentAST . root ; if ( isStatic ) { if ( is_AST == null ) { reportError ( "<STR_LIT>" , first ) ; importStatement_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( STATIC_IMPORT , "<STR_LIT>" , first , null ) ) . add ( an_AST ) . add ( is_AST ) ) ; } else { importStatement_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( STATIC_IMPORT , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( an_AST ) . add ( is_AST ) ) ; } } else { if ( is_AST == null ) { reportError ( "<STR_LIT>" , LT ( <NUM_LIT:0> ) ) ; importStatement_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( IMPORT , "<STR_LIT>" , first , null ) ) . add ( an_AST ) . add ( is_AST ) ) ; } else { importStatement_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( IMPORT , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( an_AST ) . add ( is_AST ) ) ; } } currentAST . root = importStatement_AST ; currentAST . child = importStatement_AST != null && importStatement_AST . getFirstChild ( ) != null ? importStatement_AST . getFirstChild ( ) : importStatement_AST ; currentAST . advanceChildToEnd ( ) ; } importStatement_AST = ( AST ) currentAST . root ; returnAST = importStatement_AST ; } public final void identifierStar ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST identifierStar_AST = null ; Token i1 = null ; AST i1_AST = null ; Token d1 = null ; AST d1_AST = null ; Token i2 = null ; AST i2_AST = null ; Token d2 = null ; AST d2_AST = null ; Token s = null ; AST s_AST = null ; Token alias = null ; AST alias_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; int mark = mark ( ) ; try { i1 = LT ( <NUM_LIT:1> ) ; i1_AST = astFactory . create ( i1 ) ; match ( IDENT ) ; { _loop77 : do { if ( ( LA ( <NUM_LIT:1> ) == DOT ) && ( LA ( <NUM_LIT:2> ) == IDENT || LA ( <NUM_LIT:2> ) == NLS ) ) { d1 = LT ( <NUM_LIT:1> ) ; d1_AST = astFactory . create ( d1 ) ; match ( DOT ) ; nls ( ) ; i2 = LT ( <NUM_LIT:1> ) ; i2_AST = astFactory . create ( i2 ) ; match ( IDENT ) ; if ( inputState . guessing == <NUM_LIT:0> ) { i1_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( DOT , "<STR_LIT:.>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( i1_AST ) . add ( i2_AST ) ) ; } } else { break _loop77 ; } } while ( true ) ; } { switch ( LA ( <NUM_LIT:1> ) ) { case DOT : { d2 = LT ( <NUM_LIT:1> ) ; d2_AST = astFactory . create ( d2 ) ; match ( DOT ) ; nls ( ) ; s = LT ( <NUM_LIT:1> ) ; s_AST = astFactory . create ( s ) ; match ( STAR ) ; if ( inputState . guessing == <NUM_LIT:0> ) { i1_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( DOT , "<STR_LIT:.>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( i1_AST ) . add ( s_AST ) ) ; } break ; } case LITERAL_as : { match ( LITERAL_as ) ; nls ( ) ; alias = LT ( <NUM_LIT:1> ) ; alias_AST = astFactory . create ( alias ) ; match ( IDENT ) ; if ( inputState . guessing == <NUM_LIT:0> ) { i1_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( LITERAL_as , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( i1_AST ) . add ( alias_AST ) ) ; } break ; } case EOF : case RCURLY : case SEMI : case LITERAL_default : case LITERAL_else : case LITERAL_case : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { identifierStar_AST = ( AST ) currentAST . root ; identifierStar_AST = i1_AST ; currentAST . root = identifierStar_AST ; currentAST . child = identifierStar_AST != null && identifierStar_AST . getFirstChild ( ) != null ? identifierStar_AST . getFirstChild ( ) : identifierStar_AST ; currentAST . advanceChildToEnd ( ) ; } identifierStar_AST = ( AST ) currentAST . root ; } catch ( RecognitionException e ) { if ( inputState . guessing == <NUM_LIT:0> ) { reportError ( "<STR_LIT>" , first ) ; identifierStar_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( DOT , "<STR_LIT:.>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( i1_AST ) . add ( ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:1> ) ) . add ( create ( STAR , "<STR_LIT:*>" , null ) ) ) ) ) ; rewind ( mark ) ; consumeUntil ( NLS ) ; } else { throw e ; } } returnAST = identifierStar_AST ; } protected final void typeDefinitionInternal ( AST mods ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST typeDefinitionInternal_AST = null ; AST cd_AST = null ; AST id_AST = null ; AST ed_AST = null ; AST ad_AST = null ; switch ( LA ( <NUM_LIT:1> ) ) { case LITERAL_class : { classDefinition ( mods ) ; cd_AST = ( AST ) returnAST ; astFactory . addASTChild ( currentAST , returnAST ) ; if ( inputState . guessing == <NUM_LIT:0> ) { typeDefinitionInternal_AST = ( AST ) currentAST . root ; typeDefinitionInternal_AST = cd_AST ; currentAST . root = typeDefinitionInternal_AST ; currentAST . child = typeDefinitionInternal_AST != null && typeDefinitionInternal_AST . getFirstChild ( ) != null ? typeDefinitionInternal_AST . getFirstChild ( ) : typeDefinitionInternal_AST ; currentAST . advanceChildToEnd ( ) ; } typeDefinitionInternal_AST = ( AST ) currentAST . root ; break ; } case LITERAL_interface : { interfaceDefinition ( mods ) ; id_AST = ( AST ) returnAST ; astFactory . addASTChild ( currentAST , returnAST ) ; if ( inputState . guessing == <NUM_LIT:0> ) { typeDefinitionInternal_AST = ( AST ) currentAST . root ; typeDefinitionInternal_AST = id_AST ; currentAST . root = typeDefinitionInternal_AST ; currentAST . child = typeDefinitionInternal_AST != null && typeDefinitionInternal_AST . getFirstChild ( ) != null ? typeDefinitionInternal_AST . getFirstChild ( ) : typeDefinitionInternal_AST ; currentAST . advanceChildToEnd ( ) ; } typeDefinitionInternal_AST = ( AST ) currentAST . root ; break ; } case LITERAL_enum : { enumDefinition ( mods ) ; ed_AST = ( AST ) returnAST ; astFactory . addASTChild ( currentAST , returnAST ) ; if ( inputState . guessing == <NUM_LIT:0> ) { typeDefinitionInternal_AST = ( AST ) currentAST . root ; typeDefinitionInternal_AST = ed_AST ; currentAST . root = typeDefinitionInternal_AST ; currentAST . child = typeDefinitionInternal_AST != null && typeDefinitionInternal_AST . getFirstChild ( ) != null ? typeDefinitionInternal_AST . getFirstChild ( ) : typeDefinitionInternal_AST ; currentAST . advanceChildToEnd ( ) ; } typeDefinitionInternal_AST = ( AST ) currentAST . root ; break ; } case AT : { annotationDefinition ( mods ) ; ad_AST = ( AST ) returnAST ; astFactory . addASTChild ( currentAST , returnAST ) ; if ( inputState . guessing == <NUM_LIT:0> ) { typeDefinitionInternal_AST = ( AST ) currentAST . root ; typeDefinitionInternal_AST = ad_AST ; currentAST . root = typeDefinitionInternal_AST ; currentAST . child = typeDefinitionInternal_AST != null && typeDefinitionInternal_AST . getFirstChild ( ) != null ? typeDefinitionInternal_AST . getFirstChild ( ) : typeDefinitionInternal_AST ; currentAST . advanceChildToEnd ( ) ; } typeDefinitionInternal_AST = ( AST ) currentAST . root ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = typeDefinitionInternal_AST ; } public final void classDefinition ( AST modifiers ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST classDefinition_AST = null ; AST tp_AST = null ; AST sc_AST = null ; AST ic_AST = null ; AST cb_AST = null ; Token first = cloneToken ( LT ( <NUM_LIT:1> ) ) ; AST prevCurrentClass = currentClass ; if ( modifiers != null ) { first . setLine ( modifiers . getLine ( ) ) ; first . setColumn ( modifiers . getColumn ( ) ) ; } match ( LITERAL_class ) ; AST tmp29_AST = null ; tmp29_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( IDENT ) ; nls ( ) ; if ( inputState . guessing == <NUM_LIT:0> ) { currentClass = tmp29_AST ; } { switch ( LA ( <NUM_LIT:1> ) ) { case LT : { typeParameters ( ) ; tp_AST = ( AST ) returnAST ; nls ( ) ; break ; } case EOF : case LITERAL_extends : case LCURLY : case RCURLY : case SEMI : case LITERAL_default : case LITERAL_implements : case LITERAL_else : case LITERAL_case : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } superClassClause ( ) ; sc_AST = ( AST ) returnAST ; implementsClause ( ) ; ic_AST = ( AST ) returnAST ; { switch ( LA ( <NUM_LIT:1> ) ) { case LCURLY : { classBlock ( ) ; cb_AST = ( AST ) returnAST ; break ; } case EOF : case RCURLY : case SEMI : case LITERAL_default : case LITERAL_else : case LITERAL_case : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { classDefinition_AST = ( AST ) currentAST . root ; if ( cb_AST != null ) { classDefinition_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:7> ) ) . add ( create ( CLASS_DEF , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( modifiers ) . add ( tmp29_AST ) . add ( tp_AST ) . add ( sc_AST ) . add ( ic_AST ) . add ( cb_AST ) ) ; } else { reportError ( "<STR_LIT>" , LT ( <NUM_LIT:1> ) ) ; classDefinition_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:7> ) ) . add ( create ( CLASS_DEF , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( modifiers ) . add ( tmp29_AST ) . add ( tp_AST ) . add ( sc_AST ) . add ( ic_AST ) . add ( null ) ) ; } currentAST . root = classDefinition_AST ; currentAST . child = classDefinition_AST != null && classDefinition_AST . getFirstChild ( ) != null ? classDefinition_AST . getFirstChild ( ) : classDefinition_AST ; currentAST . advanceChildToEnd ( ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { currentClass = prevCurrentClass ; } returnAST = classDefinition_AST ; } public final void interfaceDefinition ( AST modifiers ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST interfaceDefinition_AST = null ; AST tp_AST = null ; AST ie_AST = null ; AST ib_AST = null ; Token first = cloneToken ( LT ( <NUM_LIT:1> ) ) ; if ( modifiers != null ) { first . setLine ( modifiers . getLine ( ) ) ; first . setColumn ( modifiers . getColumn ( ) ) ; } match ( LITERAL_interface ) ; AST tmp31_AST = null ; tmp31_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( IDENT ) ; nls ( ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case LT : { typeParameters ( ) ; tp_AST = ( AST ) returnAST ; nls ( ) ; break ; } case LITERAL_extends : case LCURLY : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } interfaceExtends ( ) ; ie_AST = ( AST ) returnAST ; interfaceBlock ( ) ; ib_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { interfaceDefinition_AST = ( AST ) currentAST . root ; interfaceDefinition_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:6> ) ) . add ( create ( INTERFACE_DEF , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( modifiers ) . add ( tmp31_AST ) . add ( tp_AST ) . add ( ie_AST ) . add ( ib_AST ) ) ; currentAST . root = interfaceDefinition_AST ; currentAST . child = interfaceDefinition_AST != null && interfaceDefinition_AST . getFirstChild ( ) != null ? interfaceDefinition_AST . getFirstChild ( ) : interfaceDefinition_AST ; currentAST . advanceChildToEnd ( ) ; } returnAST = interfaceDefinition_AST ; } public final void enumDefinition ( AST modifiers ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST enumDefinition_AST = null ; AST ic_AST = null ; AST eb_AST = null ; Token first = cloneToken ( LT ( <NUM_LIT:1> ) ) ; AST prevCurrentClass = currentClass ; if ( modifiers != null ) { first . setLine ( modifiers . getLine ( ) ) ; first . setColumn ( modifiers . getColumn ( ) ) ; } match ( LITERAL_enum ) ; AST tmp33_AST = null ; tmp33_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( IDENT ) ; if ( inputState . guessing == <NUM_LIT:0> ) { currentClass = tmp33_AST ; } nls ( ) ; implementsClause ( ) ; ic_AST = ( AST ) returnAST ; nls ( ) ; enumBlock ( ) ; eb_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { enumDefinition_AST = ( AST ) currentAST . root ; enumDefinition_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:5> ) ) . add ( create ( ENUM_DEF , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( modifiers ) . add ( tmp33_AST ) . add ( ic_AST ) . add ( eb_AST ) ) ; currentAST . root = enumDefinition_AST ; currentAST . child = enumDefinition_AST != null && enumDefinition_AST . getFirstChild ( ) != null ? enumDefinition_AST . getFirstChild ( ) : enumDefinition_AST ; currentAST . advanceChildToEnd ( ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { currentClass = prevCurrentClass ; } returnAST = enumDefinition_AST ; } public final void annotationDefinition ( AST modifiers ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST annotationDefinition_AST = null ; AST ab_AST = null ; Token first = cloneToken ( LT ( <NUM_LIT:1> ) ) ; if ( modifiers != null ) { first . setLine ( modifiers . getLine ( ) ) ; first . setColumn ( modifiers . getColumn ( ) ) ; } AST tmp34_AST = null ; tmp34_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( AT ) ; match ( LITERAL_interface ) ; AST tmp36_AST = null ; tmp36_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( IDENT ) ; annotationBlock ( ) ; ab_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { annotationDefinition_AST = ( AST ) currentAST . root ; annotationDefinition_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:4> ) ) . add ( create ( ANNOTATION_DEF , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( modifiers ) . add ( tmp36_AST ) . add ( ab_AST ) ) ; currentAST . root = annotationDefinition_AST ; currentAST . child = annotationDefinition_AST != null && annotationDefinition_AST . getFirstChild ( ) != null ? annotationDefinition_AST . getFirstChild ( ) : annotationDefinition_AST ; currentAST . advanceChildToEnd ( ) ; } returnAST = annotationDefinition_AST ; } public final void declaration ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST declaration_AST = null ; AST m_AST = null ; AST t_AST = null ; AST v_AST = null ; AST t2_AST = null ; AST v2_AST = null ; switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case AT : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : { modifiers ( ) ; m_AST = ( AST ) returnAST ; { if ( ( _tokenSet_25 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_26 . member ( LA ( <NUM_LIT:2> ) ) ) ) { typeSpec ( false ) ; t_AST = ( AST ) returnAST ; } else if ( ( LA ( <NUM_LIT:1> ) == IDENT || LA ( <NUM_LIT:1> ) == STRING_LITERAL ) && ( _tokenSet_27 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } variableDefinitions ( m_AST , t_AST ) ; v_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { declaration_AST = ( AST ) currentAST . root ; declaration_AST = v_AST ; currentAST . root = declaration_AST ; currentAST . child = declaration_AST != null && declaration_AST . getFirstChild ( ) != null ? declaration_AST . getFirstChild ( ) : declaration_AST ; currentAST . advanceChildToEnd ( ) ; } break ; } case IDENT : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : { typeSpec ( false ) ; t2_AST = ( AST ) returnAST ; variableDefinitions ( null , t2_AST ) ; v2_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { declaration_AST = ( AST ) currentAST . root ; declaration_AST = v2_AST ; currentAST . root = declaration_AST ; currentAST . child = declaration_AST != null && declaration_AST . getFirstChild ( ) != null ? declaration_AST . getFirstChild ( ) : declaration_AST ; currentAST . advanceChildToEnd ( ) ; } break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = declaration_AST ; } public final void modifiers ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST modifiers_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; modifiersInternal ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; if ( inputState . guessing == <NUM_LIT:0> ) { modifiers_AST = ( AST ) currentAST . root ; modifiers_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( MODIFIERS , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( modifiers_AST ) ) ; currentAST . root = modifiers_AST ; currentAST . child = modifiers_AST != null && modifiers_AST . getFirstChild ( ) != null ? modifiers_AST . getFirstChild ( ) : modifiers_AST ; currentAST . advanceChildToEnd ( ) ; } modifiers_AST = ( AST ) currentAST . root ; returnAST = modifiers_AST ; } public final void typeSpec ( boolean addImagNode ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST typeSpec_AST = null ; switch ( LA ( <NUM_LIT:1> ) ) { case IDENT : { classTypeSpec ( addImagNode ) ; astFactory . addASTChild ( currentAST , returnAST ) ; typeSpec_AST = ( AST ) currentAST . root ; break ; } case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : { builtInTypeSpec ( addImagNode ) ; astFactory . addASTChild ( currentAST , returnAST ) ; typeSpec_AST = ( AST ) currentAST . root ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = typeSpec_AST ; } public final void variableDefinitions ( AST mods , AST t ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST variableDefinitions_AST = null ; Token id = null ; AST id_AST = null ; Token qid = null ; AST qid_AST = null ; AST param_AST = null ; AST tc_AST = null ; AST mb_AST = null ; Token first = cloneToken ( LT ( <NUM_LIT:1> ) ) ; if ( mods != null ) { first . setLine ( mods . getLine ( ) ) ; first . setColumn ( mods . getColumn ( ) ) ; } else if ( t != null ) { first . setLine ( t . getLine ( ) ) ; first . setColumn ( t . getColumn ( ) ) ; } if ( ( LA ( <NUM_LIT:1> ) == IDENT ) && ( _tokenSet_28 . member ( LA ( <NUM_LIT:2> ) ) ) ) { listOfVariables ( mods , t , first ) ; astFactory . addASTChild ( currentAST , returnAST ) ; variableDefinitions_AST = ( AST ) currentAST . root ; } else if ( ( LA ( <NUM_LIT:1> ) == IDENT || LA ( <NUM_LIT:1> ) == STRING_LITERAL ) && ( LA ( <NUM_LIT:2> ) == LPAREN ) ) { { switch ( LA ( <NUM_LIT:1> ) ) { case IDENT : { id = LT ( <NUM_LIT:1> ) ; id_AST = astFactory . create ( id ) ; astFactory . addASTChild ( currentAST , id_AST ) ; match ( IDENT ) ; break ; } case STRING_LITERAL : { qid = LT ( <NUM_LIT:1> ) ; qid_AST = astFactory . create ( qid ) ; astFactory . addASTChild ( currentAST , qid_AST ) ; match ( STRING_LITERAL ) ; if ( inputState . guessing == <NUM_LIT:0> ) { qid_AST . setType ( IDENT ) ; } break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } match ( LPAREN ) ; parameterDeclarationList ( ) ; param_AST = ( AST ) returnAST ; match ( RPAREN ) ; { boolean synPredMatched236 = false ; if ( ( ( LA ( <NUM_LIT:1> ) == LITERAL_throws || LA ( <NUM_LIT:1> ) == NLS ) && ( _tokenSet_29 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m236 = mark ( ) ; synPredMatched236 = true ; inputState . guessing ++ ; try { { nls ( ) ; match ( LITERAL_throws ) ; } } catch ( RecognitionException pe ) { synPredMatched236 = false ; } rewind ( _m236 ) ; inputState . guessing -- ; } if ( synPredMatched236 ) { throwsClause ( ) ; tc_AST = ( AST ) returnAST ; } else if ( ( _tokenSet_30 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_12 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } { boolean synPredMatched239 = false ; if ( ( ( LA ( <NUM_LIT:1> ) == LCURLY || LA ( <NUM_LIT:1> ) == NLS ) && ( _tokenSet_31 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m239 = mark ( ) ; synPredMatched239 = true ; inputState . guessing ++ ; try { { nls ( ) ; match ( LCURLY ) ; } } catch ( RecognitionException pe ) { synPredMatched239 = false ; } rewind ( _m239 ) ; inputState . guessing -- ; } if ( synPredMatched239 ) { { nlsWarn ( ) ; openBlock ( ) ; mb_AST = ( AST ) returnAST ; } } else if ( ( _tokenSet_11 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_12 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } if ( inputState . guessing == <NUM_LIT:0> ) { variableDefinitions_AST = ( AST ) currentAST . root ; if ( qid_AST != null ) id_AST = qid_AST ; variableDefinitions_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:7> ) ) . add ( create ( METHOD_DEF , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( mods ) . add ( ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( TYPE , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( t ) ) ) . add ( id_AST ) . add ( param_AST ) . add ( tc_AST ) . add ( mb_AST ) ) ; currentAST . root = variableDefinitions_AST ; currentAST . child = variableDefinitions_AST != null && variableDefinitions_AST . getFirstChild ( ) != null ? variableDefinitions_AST . getFirstChild ( ) : variableDefinitions_AST ; currentAST . advanceChildToEnd ( ) ; } variableDefinitions_AST = ( AST ) currentAST . root ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } returnAST = variableDefinitions_AST ; } public final void genericMethod ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST genericMethod_AST = null ; AST m_AST = null ; AST p_AST = null ; AST t_AST = null ; AST v_AST = null ; modifiers ( ) ; m_AST = ( AST ) returnAST ; typeParameters ( ) ; p_AST = ( AST ) returnAST ; typeSpec ( false ) ; t_AST = ( AST ) returnAST ; variableDefinitions ( m_AST , t_AST ) ; v_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { genericMethod_AST = ( AST ) currentAST . root ; genericMethod_AST = v_AST ; AST old = v_AST . getFirstChild ( ) ; genericMethod_AST . setFirstChild ( p_AST ) ; p_AST . setNextSibling ( old ) ; currentAST . root = genericMethod_AST ; currentAST . child = genericMethod_AST != null && genericMethod_AST . getFirstChild ( ) != null ? genericMethod_AST . getFirstChild ( ) : genericMethod_AST ; currentAST . advanceChildToEnd ( ) ; } returnAST = genericMethod_AST ; } public final void typeParameters ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST typeParameters_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; int currentLtLevel = <NUM_LIT:0> ; if ( inputState . guessing == <NUM_LIT:0> ) { currentLtLevel = ltCounter ; } match ( LT ) ; if ( inputState . guessing == <NUM_LIT:0> ) { ltCounter ++ ; } nls ( ) ; typeParameter ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop113 : do { if ( ( LA ( <NUM_LIT:1> ) == COMMA ) ) { match ( COMMA ) ; nls ( ) ; typeParameter ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop113 ; } } while ( true ) ; } nls ( ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case GT : case SR : case BSR : { typeArgumentsOrParametersEnd ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case EOF : case IDENT : case LITERAL_extends : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LCURLY : case RCURLY : case SEMI : case LITERAL_default : case LITERAL_implements : case LITERAL_else : case LITERAL_case : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( ! ( matchGenericTypeBrackets ( ( ( currentLtLevel != <NUM_LIT:0> ) || ltCounter == currentLtLevel ) , "<STR_LIT>" , "<STR_LIT>" ) ) ) throw new SemanticException ( "<STR_LIT>" ) ; if ( inputState . guessing == <NUM_LIT:0> ) { typeParameters_AST = ( AST ) currentAST . root ; typeParameters_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( TYPE_PARAMETERS , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( typeParameters_AST ) ) ; currentAST . root = typeParameters_AST ; currentAST . child = typeParameters_AST != null && typeParameters_AST . getFirstChild ( ) != null ? typeParameters_AST . getFirstChild ( ) : typeParameters_AST ; currentAST . advanceChildToEnd ( ) ; } typeParameters_AST = ( AST ) currentAST . root ; returnAST = typeParameters_AST ; } public final void singleDeclarationNoInit ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST singleDeclarationNoInit_AST = null ; AST m_AST = null ; AST t_AST = null ; AST v_AST = null ; AST t2_AST = null ; AST v2_AST = null ; switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case AT : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : { modifiers ( ) ; m_AST = ( AST ) returnAST ; { if ( ( _tokenSet_25 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_32 . member ( LA ( <NUM_LIT:2> ) ) ) ) { typeSpec ( false ) ; t_AST = ( AST ) returnAST ; } else if ( ( LA ( <NUM_LIT:1> ) == IDENT ) && ( _tokenSet_33 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } singleVariable ( m_AST , t_AST ) ; v_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { singleDeclarationNoInit_AST = ( AST ) currentAST . root ; singleDeclarationNoInit_AST = v_AST ; currentAST . root = singleDeclarationNoInit_AST ; currentAST . child = singleDeclarationNoInit_AST != null && singleDeclarationNoInit_AST . getFirstChild ( ) != null ? singleDeclarationNoInit_AST . getFirstChild ( ) : singleDeclarationNoInit_AST ; currentAST . advanceChildToEnd ( ) ; } break ; } case IDENT : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : { typeSpec ( false ) ; t2_AST = ( AST ) returnAST ; singleVariable ( null , t2_AST ) ; v2_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { singleDeclarationNoInit_AST = ( AST ) currentAST . root ; singleDeclarationNoInit_AST = v2_AST ; currentAST . root = singleDeclarationNoInit_AST ; currentAST . child = singleDeclarationNoInit_AST != null && singleDeclarationNoInit_AST . getFirstChild ( ) != null ? singleDeclarationNoInit_AST . getFirstChild ( ) : singleDeclarationNoInit_AST ; currentAST . advanceChildToEnd ( ) ; } break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = singleDeclarationNoInit_AST ; } public final void singleVariable ( AST mods , AST t ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST singleVariable_AST = null ; AST id_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; variableName ( ) ; id_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { singleVariable_AST = ( AST ) currentAST . root ; singleVariable_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:4> ) ) . add ( create ( VARIABLE_DEF , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( mods ) . add ( ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( TYPE , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( t ) ) ) . add ( id_AST ) ) ; currentAST . root = singleVariable_AST ; currentAST . child = singleVariable_AST != null && singleVariable_AST . getFirstChild ( ) != null ? singleVariable_AST . getFirstChild ( ) : singleVariable_AST ; currentAST . advanceChildToEnd ( ) ; } returnAST = singleVariable_AST ; } public final void singleDeclaration ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST singleDeclaration_AST = null ; AST sd_AST = null ; singleDeclarationNoInit ( ) ; sd_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { singleDeclaration_AST = ( AST ) currentAST . root ; singleDeclaration_AST = sd_AST ; currentAST . root = singleDeclaration_AST ; currentAST . child = singleDeclaration_AST != null && singleDeclaration_AST . getFirstChild ( ) != null ? singleDeclaration_AST . getFirstChild ( ) : singleDeclaration_AST ; currentAST . advanceChildToEnd ( ) ; } { switch ( LA ( <NUM_LIT:1> ) ) { case ASSIGN : { varInitializer ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case EOF : case RBRACK : case COMMA : case RPAREN : case SEMI : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } singleDeclaration_AST = ( AST ) currentAST . root ; returnAST = singleDeclaration_AST ; } public final void varInitializer ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST varInitializer_AST = null ; AST tmp41_AST = null ; tmp41_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp41_AST ) ; match ( ASSIGN ) ; nls ( ) ; expressionStatementNoCheck ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; varInitializer_AST = ( AST ) currentAST . root ; returnAST = varInitializer_AST ; } public final void declarationStart ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST declarationStart_AST = null ; { int _cnt31 = <NUM_LIT:0> ; _loop31 : do { switch ( LA ( <NUM_LIT:1> ) ) { case LITERAL_def : { { match ( LITERAL_def ) ; nls ( ) ; } break ; } case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : { modifier ( ) ; nls ( ) ; break ; } case AT : { annotation ( ) ; nls ( ) ; break ; } default : if ( ( _tokenSet_25 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_34 . member ( LA ( <NUM_LIT:2> ) ) ) ) { { if ( ( LA ( <NUM_LIT:1> ) == IDENT ) && ( _tokenSet_35 . member ( LA ( <NUM_LIT:2> ) ) ) ) { upperCaseIdent ( ) ; } else if ( ( ( LA ( <NUM_LIT:1> ) >= LITERAL_void && LA ( <NUM_LIT:1> ) <= LITERAL_double ) ) ) { builtInType ( ) ; } else if ( ( LA ( <NUM_LIT:1> ) == IDENT ) && ( LA ( <NUM_LIT:2> ) == DOT ) ) { qualifiedTypeName ( ) ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } { switch ( LA ( <NUM_LIT:1> ) ) { case LT : { typeArguments ( ) ; break ; } case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case LBRACK : case IDENT : case STRING_LITERAL : case AT : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } { _loop30 : do { if ( ( LA ( <NUM_LIT:1> ) == LBRACK ) ) { AST tmp43_AST = null ; tmp43_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( LBRACK ) ; balancedTokens ( ) ; AST tmp44_AST = null ; tmp44_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( RBRACK ) ; } else { break _loop30 ; } } while ( true ) ; } } else { if ( _cnt31 >= <NUM_LIT:1> ) { break _loop31 ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } _cnt31 ++ ; } while ( true ) ; } { switch ( LA ( <NUM_LIT:1> ) ) { case IDENT : { AST tmp45_AST = null ; tmp45_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( IDENT ) ; break ; } case STRING_LITERAL : { AST tmp46_AST = null ; tmp46_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( STRING_LITERAL ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } returnAST = declarationStart_AST ; } public final void modifier ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST modifier_AST = null ; switch ( LA ( <NUM_LIT:1> ) ) { case LITERAL_private : { AST tmp47_AST = null ; tmp47_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp47_AST ) ; match ( LITERAL_private ) ; modifier_AST = ( AST ) currentAST . root ; break ; } case LITERAL_public : { AST tmp48_AST = null ; tmp48_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp48_AST ) ; match ( LITERAL_public ) ; modifier_AST = ( AST ) currentAST . root ; break ; } case LITERAL_protected : { AST tmp49_AST = null ; tmp49_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp49_AST ) ; match ( LITERAL_protected ) ; modifier_AST = ( AST ) currentAST . root ; break ; } case LITERAL_static : { AST tmp50_AST = null ; tmp50_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp50_AST ) ; match ( LITERAL_static ) ; modifier_AST = ( AST ) currentAST . root ; break ; } case LITERAL_transient : { AST tmp51_AST = null ; tmp51_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp51_AST ) ; match ( LITERAL_transient ) ; modifier_AST = ( AST ) currentAST . root ; break ; } case FINAL : { AST tmp52_AST = null ; tmp52_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp52_AST ) ; match ( FINAL ) ; modifier_AST = ( AST ) currentAST . root ; break ; } case ABSTRACT : { AST tmp53_AST = null ; tmp53_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp53_AST ) ; match ( ABSTRACT ) ; modifier_AST = ( AST ) currentAST . root ; break ; } case LITERAL_native : { AST tmp54_AST = null ; tmp54_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp54_AST ) ; match ( LITERAL_native ) ; modifier_AST = ( AST ) currentAST . root ; break ; } case LITERAL_threadsafe : { AST tmp55_AST = null ; tmp55_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp55_AST ) ; match ( LITERAL_threadsafe ) ; modifier_AST = ( AST ) currentAST . root ; break ; } case LITERAL_synchronized : { AST tmp56_AST = null ; tmp56_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp56_AST ) ; match ( LITERAL_synchronized ) ; modifier_AST = ( AST ) currentAST . root ; break ; } case LITERAL_volatile : { AST tmp57_AST = null ; tmp57_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp57_AST ) ; match ( LITERAL_volatile ) ; modifier_AST = ( AST ) currentAST . root ; break ; } case STRICTFP : { AST tmp58_AST = null ; tmp58_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp58_AST ) ; match ( STRICTFP ) ; modifier_AST = ( AST ) currentAST . root ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = modifier_AST ; } public final void annotation ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST annotation_AST = null ; AST i_AST = null ; AST args_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; match ( AT ) ; identifier ( ) ; i_AST = ( AST ) returnAST ; nls ( ) ; { if ( ( LA ( <NUM_LIT:1> ) == LPAREN ) && ( _tokenSet_36 . member ( LA ( <NUM_LIT:2> ) ) ) ) { match ( LPAREN ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case UNUSED_GOTO : case UNUSED_CONST : case UNUSED_DO : case STRICTFP : case LITERAL_package : case LITERAL_import : case LITERAL_static : case LITERAL_def : case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_extends : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_as : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : case LITERAL_default : case LITERAL_throws : case LITERAL_implements : case LITERAL_this : case LITERAL_if : case LITERAL_else : case LITERAL_while : case LITERAL_switch : case LITERAL_for : case LITERAL_in : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case PLUS : case MINUS : case LITERAL_case : case LITERAL_try : case LITERAL_finally : case LITERAL_catch : case LITERAL_false : case LITERAL_instanceof : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { annotationArguments ( ) ; args_AST = ( AST ) returnAST ; break ; } case RPAREN : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } match ( RPAREN ) ; } else if ( ( _tokenSet_37 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_38 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } if ( inputState . guessing == <NUM_LIT:0> ) { annotation_AST = ( AST ) currentAST . root ; annotation_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( ANNOTATION , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( i_AST ) . add ( args_AST ) ) ; currentAST . root = annotation_AST ; currentAST . child = annotation_AST != null && annotation_AST . getFirstChild ( ) != null ? annotation_AST . getFirstChild ( ) : annotation_AST ; currentAST . advanceChildToEnd ( ) ; } returnAST = annotation_AST ; } public final void upperCaseIdent ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST upperCaseIdent_AST = null ; if ( ! ( isUpperCase ( LT ( <NUM_LIT:1> ) ) ) ) throw new SemanticException ( "<STR_LIT>" ) ; AST tmp62_AST = null ; tmp62_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp62_AST ) ; match ( IDENT ) ; upperCaseIdent_AST = ( AST ) currentAST . root ; returnAST = upperCaseIdent_AST ; } public final void builtInType ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST builtInType_AST = null ; switch ( LA ( <NUM_LIT:1> ) ) { case LITERAL_void : { AST tmp63_AST = null ; tmp63_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp63_AST ) ; match ( LITERAL_void ) ; builtInType_AST = ( AST ) currentAST . root ; break ; } case LITERAL_boolean : { AST tmp64_AST = null ; tmp64_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp64_AST ) ; match ( LITERAL_boolean ) ; builtInType_AST = ( AST ) currentAST . root ; break ; } case LITERAL_byte : { AST tmp65_AST = null ; tmp65_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp65_AST ) ; match ( LITERAL_byte ) ; builtInType_AST = ( AST ) currentAST . root ; break ; } case LITERAL_char : { AST tmp66_AST = null ; tmp66_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp66_AST ) ; match ( LITERAL_char ) ; builtInType_AST = ( AST ) currentAST . root ; break ; } case LITERAL_short : { AST tmp67_AST = null ; tmp67_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp67_AST ) ; match ( LITERAL_short ) ; builtInType_AST = ( AST ) currentAST . root ; break ; } case LITERAL_int : { AST tmp68_AST = null ; tmp68_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp68_AST ) ; match ( LITERAL_int ) ; builtInType_AST = ( AST ) currentAST . root ; break ; } case LITERAL_float : { AST tmp69_AST = null ; tmp69_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp69_AST ) ; match ( LITERAL_float ) ; builtInType_AST = ( AST ) currentAST . root ; break ; } case LITERAL_long : { AST tmp70_AST = null ; tmp70_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp70_AST ) ; match ( LITERAL_long ) ; builtInType_AST = ( AST ) currentAST . root ; break ; } case LITERAL_double : { AST tmp71_AST = null ; tmp71_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp71_AST ) ; match ( LITERAL_double ) ; builtInType_AST = ( AST ) currentAST . root ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = builtInType_AST ; } public final void qualifiedTypeName ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST qualifiedTypeName_AST = null ; AST tmp72_AST = null ; tmp72_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( IDENT ) ; AST tmp73_AST = null ; tmp73_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( DOT ) ; { _loop38 : do { if ( ( LA ( <NUM_LIT:1> ) == IDENT ) && ( LA ( <NUM_LIT:2> ) == DOT ) ) { AST tmp74_AST = null ; tmp74_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( IDENT ) ; AST tmp75_AST = null ; tmp75_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( DOT ) ; } else { break _loop38 ; } } while ( true ) ; } upperCaseIdent ( ) ; returnAST = qualifiedTypeName_AST ; } public final void typeArguments ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST typeArguments_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; int currentLtLevel = <NUM_LIT:0> ; if ( inputState . guessing == <NUM_LIT:0> ) { currentLtLevel = ltCounter ; } match ( LT ) ; if ( inputState . guessing == <NUM_LIT:0> ) { ltCounter ++ ; } nls ( ) ; typeArgument ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop60 : do { if ( ( ( LA ( <NUM_LIT:1> ) == COMMA ) && ( _tokenSet_39 . member ( LA ( <NUM_LIT:2> ) ) ) ) && ( inputState . guessing != <NUM_LIT:0> || ltCounter == currentLtLevel + <NUM_LIT:1> ) ) { match ( COMMA ) ; nls ( ) ; typeArgument ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop60 ; } } while ( true ) ; } nls ( ) ; { if ( ( _tokenSet_40 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_41 . member ( LA ( <NUM_LIT:2> ) ) ) ) { typeArgumentsOrParametersEnd ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else if ( ( _tokenSet_41 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_4 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } if ( ! ( matchGenericTypeBrackets ( ( ( currentLtLevel != <NUM_LIT:0> ) || ltCounter == currentLtLevel ) , "<STR_LIT>" , "<STR_LIT>" ) ) ) throw new SemanticException ( "<STR_LIT>" ) ; if ( inputState . guessing == <NUM_LIT:0> ) { typeArguments_AST = ( AST ) currentAST . root ; typeArguments_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( TYPE_ARGUMENTS , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( typeArguments_AST ) ) ; currentAST . root = typeArguments_AST ; currentAST . child = typeArguments_AST != null && typeArguments_AST . getFirstChild ( ) != null ? typeArguments_AST . getFirstChild ( ) : typeArguments_AST ; currentAST . advanceChildToEnd ( ) ; } typeArguments_AST = ( AST ) currentAST . root ; returnAST = typeArguments_AST ; } public final void balancedTokens ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST balancedTokens_AST = null ; { _loop575 : do { if ( ( _tokenSet_42 . member ( LA ( <NUM_LIT:1> ) ) ) ) { balancedBrackets ( ) ; } else if ( ( _tokenSet_43 . member ( LA ( <NUM_LIT:1> ) ) ) ) { { match ( _tokenSet_43 ) ; } } else { break _loop575 ; } } while ( true ) ; } returnAST = balancedTokens_AST ; } public final void genericMethodStart ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST genericMethodStart_AST = null ; { int _cnt35 = <NUM_LIT:0> ; _loop35 : do { switch ( LA ( <NUM_LIT:1> ) ) { case LITERAL_def : { match ( LITERAL_def ) ; nls ( ) ; break ; } case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : { modifier ( ) ; nls ( ) ; break ; } case AT : { annotation ( ) ; nls ( ) ; break ; } default : { if ( _cnt35 >= <NUM_LIT:1> ) { break _loop35 ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } _cnt35 ++ ; } while ( true ) ; } AST tmp80_AST = null ; tmp80_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( LT ) ; returnAST = genericMethodStart_AST ; } public final void constructorStart ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST constructorStart_AST = null ; Token id = null ; AST id_AST = null ; modifiersOpt ( ) ; id = LT ( <NUM_LIT:1> ) ; id_AST = astFactory . create ( id ) ; match ( IDENT ) ; if ( ! ( isConstructorIdent ( id ) ) ) throw new SemanticException ( "<STR_LIT>" ) ; nls ( ) ; match ( LPAREN ) ; returnAST = constructorStart_AST ; } public final void modifiersOpt ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST modifiersOpt_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; { if ( ( _tokenSet_13 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_44 . member ( LA ( <NUM_LIT:2> ) ) ) ) { modifiersInternal ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else if ( ( _tokenSet_45 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_46 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } if ( inputState . guessing == <NUM_LIT:0> ) { modifiersOpt_AST = ( AST ) currentAST . root ; modifiersOpt_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( MODIFIERS , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( modifiersOpt_AST ) ) ; currentAST . root = modifiersOpt_AST ; currentAST . child = modifiersOpt_AST != null && modifiersOpt_AST . getFirstChild ( ) != null ? modifiersOpt_AST . getFirstChild ( ) : modifiersOpt_AST ; currentAST . advanceChildToEnd ( ) ; } modifiersOpt_AST = ( AST ) currentAST . root ; returnAST = modifiersOpt_AST ; } public final void typeDeclarationStart ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST typeDeclarationStart_AST = null ; modifiersOpt ( ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case LITERAL_class : { match ( LITERAL_class ) ; break ; } case LITERAL_interface : { match ( LITERAL_interface ) ; break ; } case LITERAL_enum : { match ( LITERAL_enum ) ; break ; } case AT : { AST tmp85_AST = null ; tmp85_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( AT ) ; match ( LITERAL_interface ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } returnAST = typeDeclarationStart_AST ; } public final void classTypeSpec ( boolean addImagNode ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST classTypeSpec_AST = null ; AST ct_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; classOrInterfaceType ( false ) ; ct_AST = ( AST ) returnAST ; declaratorBrackets ( ct_AST ) ; astFactory . addASTChild ( currentAST , returnAST ) ; if ( inputState . guessing == <NUM_LIT:0> ) { classTypeSpec_AST = ( AST ) currentAST . root ; if ( addImagNode ) { classTypeSpec_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( TYPE , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( classTypeSpec_AST ) ) ; } currentAST . root = classTypeSpec_AST ; currentAST . child = classTypeSpec_AST != null && classTypeSpec_AST . getFirstChild ( ) != null ? classTypeSpec_AST . getFirstChild ( ) : classTypeSpec_AST ; currentAST . advanceChildToEnd ( ) ; } classTypeSpec_AST = ( AST ) currentAST . root ; returnAST = classTypeSpec_AST ; } public final void builtInTypeSpec ( boolean addImagNode ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST builtInTypeSpec_AST = null ; AST bt_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; builtInType ( ) ; bt_AST = ( AST ) returnAST ; declaratorBrackets ( bt_AST ) ; astFactory . addASTChild ( currentAST , returnAST ) ; if ( inputState . guessing == <NUM_LIT:0> ) { builtInTypeSpec_AST = ( AST ) currentAST . root ; if ( addImagNode ) { builtInTypeSpec_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( TYPE , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( builtInTypeSpec_AST ) ) ; } currentAST . root = builtInTypeSpec_AST ; currentAST . child = builtInTypeSpec_AST != null && builtInTypeSpec_AST . getFirstChild ( ) != null ? builtInTypeSpec_AST . getFirstChild ( ) : builtInTypeSpec_AST ; currentAST . advanceChildToEnd ( ) ; } builtInTypeSpec_AST = ( AST ) currentAST . root ; returnAST = builtInTypeSpec_AST ; } public final void classOrInterfaceType ( boolean addImagNode ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST classOrInterfaceType_AST = null ; Token i1 = null ; AST i1_AST = null ; Token d = null ; AST d_AST = null ; Token i2 = null ; AST i2_AST = null ; AST ta_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; i1 = LT ( <NUM_LIT:1> ) ; i1_AST = astFactory . create ( i1 ) ; astFactory . makeASTRoot ( currentAST , i1_AST ) ; match ( IDENT ) ; { if ( ( LA ( <NUM_LIT:1> ) == LT ) && ( _tokenSet_39 . member ( LA ( <NUM_LIT:2> ) ) ) ) { typeArguments ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else if ( ( LA ( <NUM_LIT:1> ) == LT ) && ( LA ( <NUM_LIT:2> ) == GT ) ) { typeArgumentsDiamond ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else if ( ( _tokenSet_41 . member ( LA ( <NUM_LIT:1> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } { _loop49 : do { if ( ( LA ( <NUM_LIT:1> ) == DOT ) && ( LA ( <NUM_LIT:2> ) == IDENT ) ) { d = LT ( <NUM_LIT:1> ) ; d_AST = astFactory . create ( d ) ; match ( DOT ) ; i2 = LT ( <NUM_LIT:1> ) ; i2_AST = astFactory . create ( i2 ) ; match ( IDENT ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case LT : { typeArguments ( ) ; ta_AST = ( AST ) returnAST ; break ; } case EOF : case FINAL : case ABSTRACT : case UNUSED_GOTO : case UNUSED_CONST : case UNUSED_DO : case STRICTFP : case LITERAL_package : case LITERAL_import : case LITERAL_static : case LITERAL_def : case LBRACK : case RBRACK : case IDENT : case STRING_LITERAL : case DOT : case LPAREN : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case QUESTION : case LITERAL_extends : case LITERAL_super : case GT : case COMMA : case SR : case BSR : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_as : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case RPAREN : case ASSIGN : case BAND : case LCURLY : case RCURLY : case SEMI : case LITERAL_default : case LITERAL_throws : case LITERAL_implements : case LITERAL_this : case TRIPLE_DOT : case BOR : case CLOSABLE_BLOCK_OP : case COLON : case LITERAL_if : case LITERAL_else : case LITERAL_while : case LITERAL_switch : case LITERAL_for : case LITERAL_in : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case PLUS : case MINUS : case LITERAL_case : case LITERAL_try : case LITERAL_finally : case LITERAL_catch : case LITERAL_false : case LITERAL_instanceof : case LITERAL_new : case LITERAL_null : case LITERAL_true : case PLUS_ASSIGN : case MINUS_ASSIGN : case STAR_ASSIGN : case DIV_ASSIGN : case MOD_ASSIGN : case SR_ASSIGN : case BSR_ASSIGN : case SL_ASSIGN : case BAND_ASSIGN : case BXOR_ASSIGN : case BOR_ASSIGN : case STAR_STAR_ASSIGN : case ELVIS_OPERATOR : case LOR : case LAND : case BXOR : case REGEX_FIND : case REGEX_MATCH : case NOT_EQUAL : case EQUAL : case IDENTICAL : case NOT_IDENTICAL : case COMPARE_TO : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { i1_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:4> ) ) . add ( create ( DOT , "<STR_LIT:.>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( i1_AST ) . add ( i2_AST ) . add ( ta_AST ) ) ; } } else { break _loop49 ; } } while ( true ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { classOrInterfaceType_AST = ( AST ) currentAST . root ; classOrInterfaceType_AST = i1_AST ; if ( addImagNode ) { classOrInterfaceType_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( TYPE , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( classOrInterfaceType_AST ) ) ; } currentAST . root = classOrInterfaceType_AST ; currentAST . child = classOrInterfaceType_AST != null && classOrInterfaceType_AST . getFirstChild ( ) != null ? classOrInterfaceType_AST . getFirstChild ( ) : classOrInterfaceType_AST ; currentAST . advanceChildToEnd ( ) ; } classOrInterfaceType_AST = ( AST ) currentAST . root ; returnAST = classOrInterfaceType_AST ; } public final void declaratorBrackets ( AST typ ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST declaratorBrackets_AST = null ; if ( inputState . guessing == <NUM_LIT:0> ) { declaratorBrackets_AST = ( AST ) currentAST . root ; declaratorBrackets_AST = typ ; currentAST . root = declaratorBrackets_AST ; currentAST . child = declaratorBrackets_AST != null && declaratorBrackets_AST . getFirstChild ( ) != null ? declaratorBrackets_AST . getFirstChild ( ) : declaratorBrackets_AST ; currentAST . advanceChildToEnd ( ) ; } { _loop251 : do { if ( ( LA ( <NUM_LIT:1> ) == LBRACK ) && ( LA ( <NUM_LIT:2> ) == RBRACK ) ) { match ( LBRACK ) ; match ( RBRACK ) ; if ( inputState . guessing == <NUM_LIT:0> ) { declaratorBrackets_AST = ( AST ) currentAST . root ; declaratorBrackets_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( ARRAY_DECLARATOR , "<STR_LIT:[>" , typ , LT ( <NUM_LIT:1> ) ) ) . add ( declaratorBrackets_AST ) ) ; currentAST . root = declaratorBrackets_AST ; currentAST . child = declaratorBrackets_AST != null && declaratorBrackets_AST . getFirstChild ( ) != null ? declaratorBrackets_AST . getFirstChild ( ) : declaratorBrackets_AST ; currentAST . advanceChildToEnd ( ) ; } } else { break _loop251 ; } } while ( true ) ; } declaratorBrackets_AST = ( AST ) currentAST . root ; returnAST = declaratorBrackets_AST ; } public final void typeArgumentsDiamond ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST typeArgumentsDiamond_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; match ( LT ) ; match ( GT ) ; nls ( ) ; if ( inputState . guessing == <NUM_LIT:0> ) { typeArgumentsDiamond_AST = ( AST ) currentAST . root ; typeArgumentsDiamond_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( TYPE_ARGUMENTS , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( typeArgumentsDiamond_AST ) ) ; currentAST . root = typeArgumentsDiamond_AST ; currentAST . child = typeArgumentsDiamond_AST != null && typeArgumentsDiamond_AST . getFirstChild ( ) != null ? typeArgumentsDiamond_AST . getFirstChild ( ) : typeArgumentsDiamond_AST ; currentAST . advanceChildToEnd ( ) ; } typeArgumentsDiamond_AST = ( AST ) currentAST . root ; returnAST = typeArgumentsDiamond_AST ; } public final void typeArgumentSpec ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST typeArgumentSpec_AST = null ; switch ( LA ( <NUM_LIT:1> ) ) { case IDENT : { classTypeSpec ( true ) ; astFactory . addASTChild ( currentAST , returnAST ) ; typeArgumentSpec_AST = ( AST ) currentAST . root ; break ; } case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : { builtInTypeArraySpec ( true ) ; astFactory . addASTChild ( currentAST , returnAST ) ; typeArgumentSpec_AST = ( AST ) currentAST . root ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = typeArgumentSpec_AST ; } public final void builtInTypeArraySpec ( boolean addImagNode ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST builtInTypeArraySpec_AST = null ; AST bt_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; builtInType ( ) ; bt_AST = ( AST ) returnAST ; { boolean synPredMatched68 = false ; if ( ( ( _tokenSet_41 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_4 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m68 = mark ( ) ; synPredMatched68 = true ; inputState . guessing ++ ; try { { match ( LBRACK ) ; } } catch ( RecognitionException pe ) { synPredMatched68 = false ; } rewind ( _m68 ) ; inputState . guessing -- ; } if ( synPredMatched68 ) { declaratorBrackets ( bt_AST ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else if ( ( _tokenSet_41 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_4 . member ( LA ( <NUM_LIT:2> ) ) ) ) { if ( inputState . guessing == <NUM_LIT:0> ) { require ( false , "<STR_LIT>" , "<STR_LIT>" ) ; } } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } if ( inputState . guessing == <NUM_LIT:0> ) { builtInTypeArraySpec_AST = ( AST ) currentAST . root ; if ( addImagNode ) { builtInTypeArraySpec_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( TYPE , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( builtInTypeArraySpec_AST ) ) ; } currentAST . root = builtInTypeArraySpec_AST ; currentAST . child = builtInTypeArraySpec_AST != null && builtInTypeArraySpec_AST . getFirstChild ( ) != null ? builtInTypeArraySpec_AST . getFirstChild ( ) : builtInTypeArraySpec_AST ; currentAST . advanceChildToEnd ( ) ; } builtInTypeArraySpec_AST = ( AST ) currentAST . root ; returnAST = builtInTypeArraySpec_AST ; } public final void typeArgument ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST typeArgument_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case IDENT : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : { typeArgumentSpec ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case QUESTION : { wildcardType ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { typeArgument_AST = ( AST ) currentAST . root ; typeArgument_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( TYPE_ARGUMENT , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( typeArgument_AST ) ) ; currentAST . root = typeArgument_AST ; currentAST . child = typeArgument_AST != null && typeArgument_AST . getFirstChild ( ) != null ? typeArgument_AST . getFirstChild ( ) : typeArgument_AST ; currentAST . advanceChildToEnd ( ) ; } typeArgument_AST = ( AST ) currentAST . root ; returnAST = typeArgument_AST ; } public final void wildcardType ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST wildcardType_AST = null ; AST tmp91_AST = null ; tmp91_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp91_AST ) ; match ( QUESTION ) ; { boolean synPredMatched56 = false ; if ( ( ( LA ( <NUM_LIT:1> ) == LITERAL_extends || LA ( <NUM_LIT:1> ) == LITERAL_super ) && ( LA ( <NUM_LIT:2> ) == IDENT || LA ( <NUM_LIT:2> ) == NLS ) ) ) { int _m56 = mark ( ) ; synPredMatched56 = true ; inputState . guessing ++ ; try { { switch ( LA ( <NUM_LIT:1> ) ) { case LITERAL_extends : { match ( LITERAL_extends ) ; break ; } case LITERAL_super : { match ( LITERAL_super ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } } catch ( RecognitionException pe ) { synPredMatched56 = false ; } rewind ( _m56 ) ; inputState . guessing -- ; } if ( synPredMatched56 ) { typeArgumentBounds ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else if ( ( _tokenSet_41 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_4 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } if ( inputState . guessing == <NUM_LIT:0> ) { wildcardType_AST = ( AST ) currentAST . root ; wildcardType_AST . setType ( WILDCARD_TYPE ) ; } wildcardType_AST = ( AST ) currentAST . root ; returnAST = wildcardType_AST ; } public final void typeArgumentBounds ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST typeArgumentBounds_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; boolean isUpperBounds = false ; { switch ( LA ( <NUM_LIT:1> ) ) { case LITERAL_extends : { match ( LITERAL_extends ) ; if ( inputState . guessing == <NUM_LIT:0> ) { isUpperBounds = true ; } break ; } case LITERAL_super : { match ( LITERAL_super ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } nls ( ) ; classOrInterfaceType ( true ) ; astFactory . addASTChild ( currentAST , returnAST ) ; nls ( ) ; if ( inputState . guessing == <NUM_LIT:0> ) { typeArgumentBounds_AST = ( AST ) currentAST . root ; if ( isUpperBounds ) { typeArgumentBounds_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( TYPE_UPPER_BOUNDS , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( typeArgumentBounds_AST ) ) ; } else { typeArgumentBounds_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( TYPE_LOWER_BOUNDS , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( typeArgumentBounds_AST ) ) ; } currentAST . root = typeArgumentBounds_AST ; currentAST . child = typeArgumentBounds_AST != null && typeArgumentBounds_AST . getFirstChild ( ) != null ? typeArgumentBounds_AST . getFirstChild ( ) : typeArgumentBounds_AST ; currentAST . advanceChildToEnd ( ) ; } typeArgumentBounds_AST = ( AST ) currentAST . root ; returnAST = typeArgumentBounds_AST ; } protected final void typeArgumentsOrParametersEnd ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST typeArgumentsOrParametersEnd_AST = null ; switch ( LA ( <NUM_LIT:1> ) ) { case GT : { match ( GT ) ; if ( inputState . guessing == <NUM_LIT:0> ) { ltCounter -= <NUM_LIT:1> ; } typeArgumentsOrParametersEnd_AST = ( AST ) currentAST . root ; break ; } case SR : { match ( SR ) ; if ( inputState . guessing == <NUM_LIT:0> ) { ltCounter -= <NUM_LIT:2> ; } typeArgumentsOrParametersEnd_AST = ( AST ) currentAST . root ; break ; } case BSR : { match ( BSR ) ; if ( inputState . guessing == <NUM_LIT:0> ) { ltCounter -= <NUM_LIT:3> ; } typeArgumentsOrParametersEnd_AST = ( AST ) currentAST . root ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = typeArgumentsOrParametersEnd_AST ; } public final void type ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST type_AST = null ; switch ( LA ( <NUM_LIT:1> ) ) { case IDENT : { classOrInterfaceType ( false ) ; astFactory . addASTChild ( currentAST , returnAST ) ; type_AST = ( AST ) currentAST . root ; break ; } case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : { builtInType ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; type_AST = ( AST ) currentAST . root ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = type_AST ; } public final void modifiersInternal ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST modifiersInternal_AST = null ; int seenDef = <NUM_LIT:0> ; { int _cnt81 = <NUM_LIT:0> ; _loop81 : do { if ( ( ( LA ( <NUM_LIT:1> ) == LITERAL_def ) ) && ( seenDef ++ == <NUM_LIT:0> ) ) { match ( LITERAL_def ) ; nls ( ) ; } else if ( ( _tokenSet_47 . member ( LA ( <NUM_LIT:1> ) ) ) ) { modifier ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; nls ( ) ; } else if ( ( LA ( <NUM_LIT:1> ) == AT ) && ( LA ( <NUM_LIT:2> ) == LITERAL_interface ) ) { if ( inputState . guessing == <NUM_LIT:0> ) { break ; } AST tmp98_AST = null ; tmp98_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp98_AST ) ; match ( AT ) ; AST tmp99_AST = null ; tmp99_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp99_AST ) ; match ( LITERAL_interface ) ; } else if ( ( LA ( <NUM_LIT:1> ) == AT ) && ( LA ( <NUM_LIT:2> ) == IDENT ) ) { annotation ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; nls ( ) ; } else { if ( _cnt81 >= <NUM_LIT:1> ) { break _loop81 ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } _cnt81 ++ ; } while ( true ) ; } modifiersInternal_AST = ( AST ) currentAST . root ; returnAST = modifiersInternal_AST ; } public final void annotationArguments ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST annotationArguments_AST = null ; AST v_AST = null ; if ( ( _tokenSet_48 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_49 . member ( LA ( <NUM_LIT:2> ) ) ) ) { annotationMemberValueInitializer ( ) ; v_AST = ( AST ) returnAST ; astFactory . addASTChild ( currentAST , returnAST ) ; if ( inputState . guessing == <NUM_LIT:0> ) { annotationArguments_AST = ( AST ) currentAST . root ; Token itkn = new Token ( IDENT , "<STR_LIT:value>" ) ; AST i ; i = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:1> ) ) . add ( create ( IDENT , "<STR_LIT:value>" , itkn , itkn ) ) ) ; annotationArguments_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( ANNOTATION_MEMBER_VALUE_PAIR , "<STR_LIT>" , LT ( <NUM_LIT:1> ) , LT ( <NUM_LIT:1> ) ) ) . add ( i ) . add ( v_AST ) ) ; currentAST . root = annotationArguments_AST ; currentAST . child = annotationArguments_AST != null && annotationArguments_AST . getFirstChild ( ) != null ? annotationArguments_AST . getFirstChild ( ) : annotationArguments_AST ; currentAST . advanceChildToEnd ( ) ; } annotationArguments_AST = ( AST ) currentAST . root ; } else if ( ( _tokenSet_50 . member ( LA ( <NUM_LIT:1> ) ) ) && ( LA ( <NUM_LIT:2> ) == ASSIGN ) ) { annotationMemberValuePairs ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; annotationArguments_AST = ( AST ) currentAST . root ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } returnAST = annotationArguments_AST ; } public final void annotationsInternal ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST annotationsInternal_AST = null ; { _loop91 : do { if ( ( LA ( <NUM_LIT:1> ) == AT ) && ( LA ( <NUM_LIT:2> ) == LITERAL_interface ) ) { if ( inputState . guessing == <NUM_LIT:0> ) { break ; } AST tmp100_AST = null ; tmp100_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp100_AST ) ; match ( AT ) ; AST tmp101_AST = null ; tmp101_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp101_AST ) ; match ( LITERAL_interface ) ; } else if ( ( LA ( <NUM_LIT:1> ) == AT ) && ( LA ( <NUM_LIT:2> ) == IDENT ) ) { annotation ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; nls ( ) ; } else { break _loop91 ; } } while ( true ) ; } annotationsInternal_AST = ( AST ) currentAST . root ; returnAST = annotationsInternal_AST ; } public final void annotationMemberValueInitializer ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST annotationMemberValueInitializer_AST = null ; switch ( LA ( <NUM_LIT:1> ) ) { case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LCURLY : case LITERAL_this : case PLUS : case MINUS : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { conditionalExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; annotationMemberValueInitializer_AST = ( AST ) currentAST . root ; break ; } case AT : { annotation ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; annotationMemberValueInitializer_AST = ( AST ) currentAST . root ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = annotationMemberValueInitializer_AST ; } public final void annotationMemberValuePairs ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST annotationMemberValuePairs_AST = null ; annotationMemberValuePair ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop97 : do { if ( ( LA ( <NUM_LIT:1> ) == COMMA ) ) { match ( COMMA ) ; nls ( ) ; annotationMemberValuePair ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop97 ; } } while ( true ) ; } annotationMemberValuePairs_AST = ( AST ) currentAST . root ; returnAST = annotationMemberValuePairs_AST ; } public final void annotationMemberValuePair ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST annotationMemberValuePair_AST = null ; AST i_AST = null ; AST v_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; annotationIdent ( ) ; i_AST = ( AST ) returnAST ; match ( ASSIGN ) ; nls ( ) ; annotationMemberValueInitializer ( ) ; v_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { annotationMemberValuePair_AST = ( AST ) currentAST . root ; annotationMemberValuePair_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( ANNOTATION_MEMBER_VALUE_PAIR , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( i_AST ) . add ( v_AST ) ) ; currentAST . root = annotationMemberValuePair_AST ; currentAST . child = annotationMemberValuePair_AST != null && annotationMemberValuePair_AST . getFirstChild ( ) != null ? annotationMemberValuePair_AST . getFirstChild ( ) : annotationMemberValuePair_AST ; currentAST . advanceChildToEnd ( ) ; } returnAST = annotationMemberValuePair_AST ; } public final void annotationIdent ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST annotationIdent_AST = null ; switch ( LA ( <NUM_LIT:1> ) ) { case IDENT : { AST tmp104_AST = null ; tmp104_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp104_AST ) ; match ( IDENT ) ; annotationIdent_AST = ( AST ) currentAST . root ; break ; } case FINAL : case ABSTRACT : case UNUSED_GOTO : case UNUSED_CONST : case UNUSED_DO : case STRICTFP : case LITERAL_package : case LITERAL_import : case LITERAL_static : case LITERAL_def : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case LITERAL_extends : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_as : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LITERAL_default : case LITERAL_throws : case LITERAL_implements : case LITERAL_this : case LITERAL_if : case LITERAL_else : case LITERAL_while : case LITERAL_switch : case LITERAL_for : case LITERAL_in : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case LITERAL_case : case LITERAL_try : case LITERAL_finally : case LITERAL_catch : case LITERAL_false : case LITERAL_instanceof : case LITERAL_new : case LITERAL_null : case LITERAL_true : { keywordPropertyNames ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; annotationIdent_AST = ( AST ) currentAST . root ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = annotationIdent_AST ; } public final void keywordPropertyNames ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST keywordPropertyNames_AST = null ; { switch ( LA ( <NUM_LIT:1> ) ) { case LITERAL_as : { AST tmp105_AST = null ; tmp105_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp105_AST ) ; match ( LITERAL_as ) ; break ; } case LITERAL_assert : { AST tmp106_AST = null ; tmp106_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp106_AST ) ; match ( LITERAL_assert ) ; break ; } case LITERAL_break : { AST tmp107_AST = null ; tmp107_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp107_AST ) ; match ( LITERAL_break ) ; break ; } case LITERAL_case : { AST tmp108_AST = null ; tmp108_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp108_AST ) ; match ( LITERAL_case ) ; break ; } case LITERAL_catch : { AST tmp109_AST = null ; tmp109_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp109_AST ) ; match ( LITERAL_catch ) ; break ; } case LITERAL_class : { AST tmp110_AST = null ; tmp110_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp110_AST ) ; match ( LITERAL_class ) ; break ; } case UNUSED_CONST : { AST tmp111_AST = null ; tmp111_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp111_AST ) ; match ( UNUSED_CONST ) ; break ; } case LITERAL_continue : { AST tmp112_AST = null ; tmp112_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp112_AST ) ; match ( LITERAL_continue ) ; break ; } case LITERAL_def : { AST tmp113_AST = null ; tmp113_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp113_AST ) ; match ( LITERAL_def ) ; break ; } case LITERAL_default : { AST tmp114_AST = null ; tmp114_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp114_AST ) ; match ( LITERAL_default ) ; break ; } case UNUSED_DO : { AST tmp115_AST = null ; tmp115_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp115_AST ) ; match ( UNUSED_DO ) ; break ; } case LITERAL_else : { AST tmp116_AST = null ; tmp116_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp116_AST ) ; match ( LITERAL_else ) ; break ; } case LITERAL_enum : { AST tmp117_AST = null ; tmp117_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp117_AST ) ; match ( LITERAL_enum ) ; break ; } case LITERAL_extends : { AST tmp118_AST = null ; tmp118_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp118_AST ) ; match ( LITERAL_extends ) ; break ; } case LITERAL_false : { AST tmp119_AST = null ; tmp119_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp119_AST ) ; match ( LITERAL_false ) ; break ; } case LITERAL_finally : { AST tmp120_AST = null ; tmp120_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp120_AST ) ; match ( LITERAL_finally ) ; break ; } case LITERAL_for : { AST tmp121_AST = null ; tmp121_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp121_AST ) ; match ( LITERAL_for ) ; break ; } case UNUSED_GOTO : { AST tmp122_AST = null ; tmp122_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp122_AST ) ; match ( UNUSED_GOTO ) ; break ; } case LITERAL_if : { AST tmp123_AST = null ; tmp123_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp123_AST ) ; match ( LITERAL_if ) ; break ; } case LITERAL_implements : { AST tmp124_AST = null ; tmp124_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp124_AST ) ; match ( LITERAL_implements ) ; break ; } case LITERAL_import : { AST tmp125_AST = null ; tmp125_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp125_AST ) ; match ( LITERAL_import ) ; break ; } case LITERAL_in : { AST tmp126_AST = null ; tmp126_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp126_AST ) ; match ( LITERAL_in ) ; break ; } case LITERAL_instanceof : { AST tmp127_AST = null ; tmp127_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp127_AST ) ; match ( LITERAL_instanceof ) ; break ; } case LITERAL_interface : { AST tmp128_AST = null ; tmp128_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp128_AST ) ; match ( LITERAL_interface ) ; break ; } case LITERAL_new : { AST tmp129_AST = null ; tmp129_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp129_AST ) ; match ( LITERAL_new ) ; break ; } case LITERAL_null : { AST tmp130_AST = null ; tmp130_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp130_AST ) ; match ( LITERAL_null ) ; break ; } case LITERAL_package : { AST tmp131_AST = null ; tmp131_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp131_AST ) ; match ( LITERAL_package ) ; break ; } case LITERAL_return : { AST tmp132_AST = null ; tmp132_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp132_AST ) ; match ( LITERAL_return ) ; break ; } case LITERAL_super : { AST tmp133_AST = null ; tmp133_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp133_AST ) ; match ( LITERAL_super ) ; break ; } case LITERAL_switch : { AST tmp134_AST = null ; tmp134_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp134_AST ) ; match ( LITERAL_switch ) ; break ; } case LITERAL_this : { AST tmp135_AST = null ; tmp135_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp135_AST ) ; match ( LITERAL_this ) ; break ; } case LITERAL_throw : { AST tmp136_AST = null ; tmp136_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp136_AST ) ; match ( LITERAL_throw ) ; break ; } case LITERAL_throws : { AST tmp137_AST = null ; tmp137_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp137_AST ) ; match ( LITERAL_throws ) ; break ; } case LITERAL_true : { AST tmp138_AST = null ; tmp138_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp138_AST ) ; match ( LITERAL_true ) ; break ; } case LITERAL_try : { AST tmp139_AST = null ; tmp139_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp139_AST ) ; match ( LITERAL_try ) ; break ; } case LITERAL_while : { AST tmp140_AST = null ; tmp140_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp140_AST ) ; match ( LITERAL_while ) ; break ; } case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : { modifier ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : { builtInType ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { keywordPropertyNames_AST = ( AST ) currentAST . root ; keywordPropertyNames_AST . setType ( IDENT ) ; } keywordPropertyNames_AST = ( AST ) currentAST . root ; returnAST = keywordPropertyNames_AST ; } public final void conditionalExpression ( int lc_stmt ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST conditionalExpression_AST = null ; logicalOrExpression ( lc_stmt ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case ELVIS_OPERATOR : { AST tmp141_AST = null ; tmp141_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp141_AST ) ; match ( ELVIS_OPERATOR ) ; nls ( ) ; conditionalExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case QUESTION : { AST tmp142_AST = null ; tmp142_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp142_AST ) ; match ( QUESTION ) ; nls ( ) ; assignmentExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; nls ( ) ; match ( COLON ) ; nls ( ) ; conditionalExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case EOF : case FINAL : case ABSTRACT : case UNUSED_GOTO : case UNUSED_CONST : case UNUSED_DO : case STRICTFP : case LITERAL_package : case LITERAL_import : case LITERAL_static : case LITERAL_def : case LBRACK : case RBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case LITERAL_extends : case LITERAL_super : case COMMA : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_as : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case RPAREN : case ASSIGN : case LCURLY : case RCURLY : case SEMI : case LITERAL_default : case LITERAL_throws : case LITERAL_implements : case LITERAL_this : case CLOSABLE_BLOCK_OP : case COLON : case LITERAL_if : case LITERAL_else : case LITERAL_while : case LITERAL_switch : case LITERAL_for : case LITERAL_in : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case PLUS : case MINUS : case LITERAL_case : case LITERAL_try : case LITERAL_finally : case LITERAL_catch : case LITERAL_false : case LITERAL_instanceof : case LITERAL_new : case LITERAL_null : case LITERAL_true : case PLUS_ASSIGN : case MINUS_ASSIGN : case STAR_ASSIGN : case DIV_ASSIGN : case MOD_ASSIGN : case SR_ASSIGN : case BSR_ASSIGN : case SL_ASSIGN : case BAND_ASSIGN : case BXOR_ASSIGN : case BOR_ASSIGN : case STAR_STAR_ASSIGN : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } conditionalExpression_AST = ( AST ) currentAST . root ; returnAST = conditionalExpression_AST ; } public final void annotationMemberArrayValueInitializer ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST annotationMemberArrayValueInitializer_AST = null ; switch ( LA ( <NUM_LIT:1> ) ) { case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LCURLY : case LITERAL_this : case PLUS : case MINUS : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { conditionalExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; annotationMemberArrayValueInitializer_AST = ( AST ) currentAST . root ; break ; } case AT : { annotation ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; nls ( ) ; annotationMemberArrayValueInitializer_AST = ( AST ) currentAST . root ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = annotationMemberArrayValueInitializer_AST ; } public final void superClassClause ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST superClassClause_AST = null ; AST c_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case LITERAL_extends : { match ( LITERAL_extends ) ; nls ( ) ; classOrInterfaceType ( false ) ; c_AST = ( AST ) returnAST ; nls ( ) ; break ; } case EOF : case LCURLY : case RCURLY : case SEMI : case LITERAL_default : case LITERAL_implements : case LITERAL_else : case LITERAL_case : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { superClassClause_AST = ( AST ) currentAST . root ; superClassClause_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( EXTENDS_CLAUSE , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( c_AST ) ) ; currentAST . root = superClassClause_AST ; currentAST . child = superClassClause_AST != null && superClassClause_AST . getFirstChild ( ) != null ? superClassClause_AST . getFirstChild ( ) : superClassClause_AST ; currentAST . advanceChildToEnd ( ) ; } returnAST = superClassClause_AST ; } public final void implementsClause ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST implementsClause_AST = null ; Token i = null ; AST i_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case LITERAL_implements : { i = LT ( <NUM_LIT:1> ) ; i_AST = astFactory . create ( i ) ; match ( LITERAL_implements ) ; nls ( ) ; classOrInterfaceType ( true ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop190 : do { if ( ( LA ( <NUM_LIT:1> ) == COMMA ) ) { match ( COMMA ) ; nls ( ) ; classOrInterfaceType ( true ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop190 ; } } while ( true ) ; } nls ( ) ; break ; } case EOF : case LCURLY : case RCURLY : case SEMI : case LITERAL_default : case LITERAL_else : case LITERAL_case : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { implementsClause_AST = ( AST ) currentAST . root ; implementsClause_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( IMPLEMENTS_CLAUSE , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( implementsClause_AST ) ) ; currentAST . root = implementsClause_AST ; currentAST . child = implementsClause_AST != null && implementsClause_AST . getFirstChild ( ) != null ? implementsClause_AST . getFirstChild ( ) : implementsClause_AST ; currentAST . advanceChildToEnd ( ) ; } implementsClause_AST = ( AST ) currentAST . root ; returnAST = implementsClause_AST ; } public final void classBlock ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST classBlock_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; try { match ( LCURLY ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case IDENT : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : { classField ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case RCURLY : case SEMI : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } { _loop125 : do { if ( ( LA ( <NUM_LIT:1> ) == SEMI || LA ( <NUM_LIT:1> ) == NLS ) ) { sep ( ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case IDENT : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : { classField ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case RCURLY : case SEMI : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } } else { break _loop125 ; } } while ( true ) ; } match ( RCURLY ) ; if ( inputState . guessing == <NUM_LIT:0> ) { classBlock_AST = ( AST ) currentAST . root ; classBlock_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( OBJBLOCK , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( classBlock_AST ) ) ; currentAST . root = classBlock_AST ; currentAST . child = classBlock_AST != null && classBlock_AST . getFirstChild ( ) != null ? classBlock_AST . getFirstChild ( ) : classBlock_AST ; currentAST . advanceChildToEnd ( ) ; } classBlock_AST = ( AST ) currentAST . root ; } catch ( RecognitionException e ) { if ( inputState . guessing == <NUM_LIT:0> ) { if ( errorList . isEmpty ( ) ) { classBlock_AST = ( AST ) currentAST . root ; } reportError ( e ) ; classBlock_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( OBJBLOCK , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( classBlock_AST ) ) ; currentAST . root = classBlock_AST ; currentAST . child = classBlock_AST != null && classBlock_AST . getFirstChild ( ) != null ? classBlock_AST . getFirstChild ( ) : classBlock_AST ; currentAST . advanceChildToEnd ( ) ; } else { throw e ; } } returnAST = classBlock_AST ; } public final void interfaceExtends ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST interfaceExtends_AST = null ; Token e = null ; AST e_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case LITERAL_extends : { e = LT ( <NUM_LIT:1> ) ; e_AST = astFactory . create ( e ) ; match ( LITERAL_extends ) ; nls ( ) ; classOrInterfaceType ( true ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop186 : do { if ( ( LA ( <NUM_LIT:1> ) == COMMA ) ) { match ( COMMA ) ; nls ( ) ; classOrInterfaceType ( true ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop186 ; } } while ( true ) ; } nls ( ) ; break ; } case LCURLY : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { interfaceExtends_AST = ( AST ) currentAST . root ; interfaceExtends_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( EXTENDS_CLAUSE , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( interfaceExtends_AST ) ) ; currentAST . root = interfaceExtends_AST ; currentAST . child = interfaceExtends_AST != null && interfaceExtends_AST . getFirstChild ( ) != null ? interfaceExtends_AST . getFirstChild ( ) : interfaceExtends_AST ; currentAST . advanceChildToEnd ( ) ; } interfaceExtends_AST = ( AST ) currentAST . root ; returnAST = interfaceExtends_AST ; } public final void interfaceBlock ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST interfaceBlock_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; match ( LCURLY ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case IDENT : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : { interfaceField ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case RCURLY : case SEMI : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } { _loop130 : do { if ( ( LA ( <NUM_LIT:1> ) == SEMI || LA ( <NUM_LIT:1> ) == NLS ) ) { sep ( ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case IDENT : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : { interfaceField ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case RCURLY : case SEMI : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } } else { break _loop130 ; } } while ( true ) ; } match ( RCURLY ) ; if ( inputState . guessing == <NUM_LIT:0> ) { interfaceBlock_AST = ( AST ) currentAST . root ; interfaceBlock_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( OBJBLOCK , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( interfaceBlock_AST ) ) ; currentAST . root = interfaceBlock_AST ; currentAST . child = interfaceBlock_AST != null && interfaceBlock_AST . getFirstChild ( ) != null ? interfaceBlock_AST . getFirstChild ( ) : interfaceBlock_AST ; currentAST . advanceChildToEnd ( ) ; } interfaceBlock_AST = ( AST ) currentAST . root ; returnAST = interfaceBlock_AST ; } public final void enumBlock ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST enumBlock_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; match ( LCURLY ) ; nls ( ) ; { boolean synPredMatched139 = false ; if ( ( ( LA ( <NUM_LIT:1> ) == IDENT || LA ( <NUM_LIT:1> ) == AT ) && ( _tokenSet_51 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m139 = mark ( ) ; synPredMatched139 = true ; inputState . guessing ++ ; try { { enumConstantsStart ( ) ; } } catch ( RecognitionException pe ) { synPredMatched139 = false ; } rewind ( _m139 ) ; inputState . guessing -- ; } if ( synPredMatched139 ) { enumConstants ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else if ( ( _tokenSet_52 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_53 . member ( LA ( <NUM_LIT:2> ) ) ) ) { { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case IDENT : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : { classField ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case RCURLY : case SEMI : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } { _loop143 : do { if ( ( LA ( <NUM_LIT:1> ) == SEMI || LA ( <NUM_LIT:1> ) == NLS ) ) { sep ( ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case IDENT : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : { classField ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case RCURLY : case SEMI : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } } else { break _loop143 ; } } while ( true ) ; } match ( RCURLY ) ; if ( inputState . guessing == <NUM_LIT:0> ) { enumBlock_AST = ( AST ) currentAST . root ; enumBlock_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( OBJBLOCK , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( enumBlock_AST ) ) ; currentAST . root = enumBlock_AST ; currentAST . child = enumBlock_AST != null && enumBlock_AST . getFirstChild ( ) != null ? enumBlock_AST . getFirstChild ( ) : enumBlock_AST ; currentAST . advanceChildToEnd ( ) ; } enumBlock_AST = ( AST ) currentAST . root ; returnAST = enumBlock_AST ; } public final void annotationBlock ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST annotationBlock_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; match ( LCURLY ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case IDENT : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : { annotationField ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case RCURLY : case SEMI : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } { _loop135 : do { if ( ( LA ( <NUM_LIT:1> ) == SEMI || LA ( <NUM_LIT:1> ) == NLS ) ) { sep ( ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case IDENT : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : { annotationField ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case RCURLY : case SEMI : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } } else { break _loop135 ; } } while ( true ) ; } match ( RCURLY ) ; if ( inputState . guessing == <NUM_LIT:0> ) { annotationBlock_AST = ( AST ) currentAST . root ; annotationBlock_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( OBJBLOCK , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( annotationBlock_AST ) ) ; currentAST . root = annotationBlock_AST ; currentAST . child = annotationBlock_AST != null && annotationBlock_AST . getFirstChild ( ) != null ? annotationBlock_AST . getFirstChild ( ) : annotationBlock_AST ; currentAST . advanceChildToEnd ( ) ; } annotationBlock_AST = ( AST ) currentAST . root ; returnAST = annotationBlock_AST ; } public final void typeParameter ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST typeParameter_AST = null ; Token id = null ; AST id_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; { id = LT ( <NUM_LIT:1> ) ; id_AST = astFactory . create ( id ) ; astFactory . addASTChild ( currentAST , id_AST ) ; match ( IDENT ) ; } { if ( ( LA ( <NUM_LIT:1> ) == LITERAL_extends ) && ( LA ( <NUM_LIT:2> ) == IDENT || LA ( <NUM_LIT:2> ) == NLS ) ) { typeParameterBounds ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else if ( ( _tokenSet_54 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_12 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } if ( inputState . guessing == <NUM_LIT:0> ) { typeParameter_AST = ( AST ) currentAST . root ; typeParameter_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( TYPE_PARAMETER , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( typeParameter_AST ) ) ; currentAST . root = typeParameter_AST ; currentAST . child = typeParameter_AST != null && typeParameter_AST . getFirstChild ( ) != null ? typeParameter_AST . getFirstChild ( ) : typeParameter_AST ; currentAST . advanceChildToEnd ( ) ; } typeParameter_AST = ( AST ) currentAST . root ; returnAST = typeParameter_AST ; } public final void typeParameterBounds ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST typeParameterBounds_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; match ( LITERAL_extends ) ; nls ( ) ; classOrInterfaceType ( true ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop120 : do { if ( ( LA ( <NUM_LIT:1> ) == BAND ) ) { match ( BAND ) ; nls ( ) ; classOrInterfaceType ( true ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop120 ; } } while ( true ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { typeParameterBounds_AST = ( AST ) currentAST . root ; typeParameterBounds_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( TYPE_UPPER_BOUNDS , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( typeParameterBounds_AST ) ) ; currentAST . root = typeParameterBounds_AST ; currentAST . child = typeParameterBounds_AST != null && typeParameterBounds_AST . getFirstChild ( ) != null ? typeParameterBounds_AST . getFirstChild ( ) : typeParameterBounds_AST ; currentAST . advanceChildToEnd ( ) ; } typeParameterBounds_AST = ( AST ) currentAST . root ; returnAST = typeParameterBounds_AST ; } public final void classField ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST classField_AST = null ; AST mc_AST = null ; AST ctor_AST = null ; AST dg_AST = null ; AST mad_AST = null ; AST dd_AST = null ; AST mods_AST = null ; AST td_AST = null ; AST s3_AST = null ; AST s4_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; try { boolean synPredMatched193 = false ; if ( ( ( _tokenSet_55 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_56 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m193 = mark ( ) ; synPredMatched193 = true ; inputState . guessing ++ ; try { { constructorStart ( ) ; } } catch ( RecognitionException pe ) { synPredMatched193 = false ; } rewind ( _m193 ) ; inputState . guessing -- ; } if ( synPredMatched193 ) { modifiersOpt ( ) ; mc_AST = ( AST ) returnAST ; constructorDefinition ( mc_AST ) ; ctor_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { classField_AST = ( AST ) currentAST . root ; classField_AST = ctor_AST ; currentAST . root = classField_AST ; currentAST . child = classField_AST != null && classField_AST . getFirstChild ( ) != null ? classField_AST . getFirstChild ( ) : classField_AST ; currentAST . advanceChildToEnd ( ) ; } } else { boolean synPredMatched195 = false ; if ( ( ( _tokenSet_13 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_14 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m195 = mark ( ) ; synPredMatched195 = true ; inputState . guessing ++ ; try { { genericMethodStart ( ) ; } } catch ( RecognitionException pe ) { synPredMatched195 = false ; } rewind ( _m195 ) ; inputState . guessing -- ; } if ( synPredMatched195 ) { genericMethod ( ) ; dg_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { classField_AST = ( AST ) currentAST . root ; classField_AST = dg_AST ; currentAST . root = classField_AST ; currentAST . child = classField_AST != null && classField_AST . getFirstChild ( ) != null ? classField_AST . getFirstChild ( ) : classField_AST ; currentAST . advanceChildToEnd ( ) ; } } else { boolean synPredMatched197 = false ; if ( ( ( _tokenSet_13 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_15 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m197 = mark ( ) ; synPredMatched197 = true ; inputState . guessing ++ ; try { { multipleAssignmentDeclarationStart ( ) ; } } catch ( RecognitionException pe ) { synPredMatched197 = false ; } rewind ( _m197 ) ; inputState . guessing -- ; } if ( synPredMatched197 ) { multipleAssignmentDeclaration ( ) ; mad_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { classField_AST = ( AST ) currentAST . root ; classField_AST = mad_AST ; currentAST . root = classField_AST ; currentAST . child = classField_AST != null && classField_AST . getFirstChild ( ) != null ? classField_AST . getFirstChild ( ) : classField_AST ; currentAST . advanceChildToEnd ( ) ; } } else { boolean synPredMatched199 = false ; if ( ( ( _tokenSet_16 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_17 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m199 = mark ( ) ; synPredMatched199 = true ; inputState . guessing ++ ; try { { declarationStart ( ) ; } } catch ( RecognitionException pe ) { synPredMatched199 = false ; } rewind ( _m199 ) ; inputState . guessing -- ; } if ( synPredMatched199 ) { declaration ( ) ; dd_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { classField_AST = ( AST ) currentAST . root ; classField_AST = dd_AST ; currentAST . root = classField_AST ; currentAST . child = classField_AST != null && classField_AST . getFirstChild ( ) != null ? classField_AST . getFirstChild ( ) : classField_AST ; currentAST . advanceChildToEnd ( ) ; } } else { boolean synPredMatched201 = false ; if ( ( ( _tokenSet_22 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_23 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m201 = mark ( ) ; synPredMatched201 = true ; inputState . guessing ++ ; try { { typeDeclarationStart ( ) ; } } catch ( RecognitionException pe ) { synPredMatched201 = false ; } rewind ( _m201 ) ; inputState . guessing -- ; } if ( synPredMatched201 ) { modifiersOpt ( ) ; mods_AST = ( AST ) returnAST ; { typeDefinitionInternal ( mods_AST ) ; td_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { classField_AST = ( AST ) currentAST . root ; classField_AST = td_AST ; currentAST . root = classField_AST ; currentAST . child = classField_AST != null && classField_AST . getFirstChild ( ) != null ? classField_AST . getFirstChild ( ) : classField_AST ; currentAST . advanceChildToEnd ( ) ; } } } else if ( ( LA ( <NUM_LIT:1> ) == LITERAL_static ) && ( LA ( <NUM_LIT:2> ) == LCURLY || LA ( <NUM_LIT:2> ) == NLS ) ) { match ( LITERAL_static ) ; nls ( ) ; compoundStatement ( ) ; s3_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { classField_AST = ( AST ) currentAST . root ; classField_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( STATIC_INIT , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( s3_AST ) ) ; currentAST . root = classField_AST ; currentAST . child = classField_AST != null && classField_AST . getFirstChild ( ) != null ? classField_AST . getFirstChild ( ) : classField_AST ; currentAST . advanceChildToEnd ( ) ; } } else if ( ( LA ( <NUM_LIT:1> ) == LCURLY ) ) { compoundStatement ( ) ; s4_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { classField_AST = ( AST ) currentAST . root ; classField_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( INSTANCE_INIT , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( s4_AST ) ) ; currentAST . root = classField_AST ; currentAST . child = classField_AST != null && classField_AST . getFirstChild ( ) != null ? classField_AST . getFirstChild ( ) : classField_AST ; currentAST . advanceChildToEnd ( ) ; } } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } } } } catch ( RecognitionException e ) { if ( inputState . guessing == <NUM_LIT:0> ) { reportError ( e ) ; classField_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:4> ) ) . add ( create ( VARIABLE_DEF , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( null ) . add ( create ( TYPE , "<STR_LIT>" , LT ( <NUM_LIT:1> ) , LT ( <NUM_LIT:2> ) ) ) . add ( create ( IDENT , first . getText ( ) , LT ( <NUM_LIT:1> ) , LT ( <NUM_LIT:2> ) ) ) ) ; consumeUntil ( NLS ) ; } else { throw e ; } } returnAST = classField_AST ; } public final void interfaceField ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST interfaceField_AST = null ; AST d_AST = null ; AST dg_AST = null ; AST mods_AST = null ; AST td_AST = null ; boolean synPredMatched205 = false ; if ( ( ( _tokenSet_16 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_17 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m205 = mark ( ) ; synPredMatched205 = true ; inputState . guessing ++ ; try { { declarationStart ( ) ; } } catch ( RecognitionException pe ) { synPredMatched205 = false ; } rewind ( _m205 ) ; inputState . guessing -- ; } if ( synPredMatched205 ) { declaration ( ) ; d_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { interfaceField_AST = ( AST ) currentAST . root ; interfaceField_AST = d_AST ; currentAST . root = interfaceField_AST ; currentAST . child = interfaceField_AST != null && interfaceField_AST . getFirstChild ( ) != null ? interfaceField_AST . getFirstChild ( ) : interfaceField_AST ; currentAST . advanceChildToEnd ( ) ; } } else { boolean synPredMatched207 = false ; if ( ( ( _tokenSet_13 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_14 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m207 = mark ( ) ; synPredMatched207 = true ; inputState . guessing ++ ; try { { genericMethodStart ( ) ; } } catch ( RecognitionException pe ) { synPredMatched207 = false ; } rewind ( _m207 ) ; inputState . guessing -- ; } if ( synPredMatched207 ) { genericMethod ( ) ; dg_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { interfaceField_AST = ( AST ) currentAST . root ; interfaceField_AST = dg_AST ; currentAST . root = interfaceField_AST ; currentAST . child = interfaceField_AST != null && interfaceField_AST . getFirstChild ( ) != null ? interfaceField_AST . getFirstChild ( ) : interfaceField_AST ; currentAST . advanceChildToEnd ( ) ; } } else { boolean synPredMatched209 = false ; if ( ( ( _tokenSet_22 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_23 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m209 = mark ( ) ; synPredMatched209 = true ; inputState . guessing ++ ; try { { typeDeclarationStart ( ) ; } } catch ( RecognitionException pe ) { synPredMatched209 = false ; } rewind ( _m209 ) ; inputState . guessing -- ; } if ( synPredMatched209 ) { modifiersOpt ( ) ; mods_AST = ( AST ) returnAST ; { typeDefinitionInternal ( mods_AST ) ; td_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { interfaceField_AST = ( AST ) currentAST . root ; interfaceField_AST = td_AST ; currentAST . root = interfaceField_AST ; currentAST . child = interfaceField_AST != null && interfaceField_AST . getFirstChild ( ) != null ? interfaceField_AST . getFirstChild ( ) : interfaceField_AST ; currentAST . advanceChildToEnd ( ) ; } } } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } returnAST = interfaceField_AST ; } public final void annotationField ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST annotationField_AST = null ; AST mods_AST = null ; AST td_AST = null ; AST t_AST = null ; Token i = null ; AST i_AST = null ; AST amvi_AST = null ; AST v_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; modifiersOpt ( ) ; mods_AST = ( AST ) returnAST ; { switch ( LA ( <NUM_LIT:1> ) ) { case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : { typeDefinitionInternal ( mods_AST ) ; td_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { annotationField_AST = ( AST ) currentAST . root ; annotationField_AST = td_AST ; currentAST . root = annotationField_AST ; currentAST . child = annotationField_AST != null && annotationField_AST . getFirstChild ( ) != null ? annotationField_AST . getFirstChild ( ) : annotationField_AST ; currentAST . advanceChildToEnd ( ) ; } break ; } case IDENT : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : { typeSpec ( false ) ; t_AST = ( AST ) returnAST ; { boolean synPredMatched163 = false ; if ( ( ( LA ( <NUM_LIT:1> ) == IDENT ) && ( LA ( <NUM_LIT:2> ) == LPAREN ) ) ) { int _m163 = mark ( ) ; synPredMatched163 = true ; inputState . guessing ++ ; try { { match ( IDENT ) ; match ( LPAREN ) ; } } catch ( RecognitionException pe ) { synPredMatched163 = false ; } rewind ( _m163 ) ; inputState . guessing -- ; } if ( synPredMatched163 ) { i = LT ( <NUM_LIT:1> ) ; i_AST = astFactory . create ( i ) ; match ( IDENT ) ; match ( LPAREN ) ; match ( RPAREN ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case LITERAL_default : { match ( LITERAL_default ) ; nls ( ) ; annotationMemberValueInitializer ( ) ; amvi_AST = ( AST ) returnAST ; break ; } case RCURLY : case SEMI : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { annotationField_AST = ( AST ) currentAST . root ; annotationField_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:5> ) ) . add ( create ( ANNOTATION_FIELD_DEF , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( mods_AST ) . add ( ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( TYPE , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( t_AST ) ) ) . add ( i_AST ) . add ( amvi_AST ) ) ; currentAST . root = annotationField_AST ; currentAST . child = annotationField_AST != null && annotationField_AST . getFirstChild ( ) != null ? annotationField_AST . getFirstChild ( ) : annotationField_AST ; currentAST . advanceChildToEnd ( ) ; } } else if ( ( LA ( <NUM_LIT:1> ) == IDENT || LA ( <NUM_LIT:1> ) == STRING_LITERAL ) && ( _tokenSet_57 . member ( LA ( <NUM_LIT:2> ) ) ) ) { variableDefinitions ( mods_AST , t_AST ) ; v_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { annotationField_AST = ( AST ) currentAST . root ; annotationField_AST = v_AST ; currentAST . root = annotationField_AST ; currentAST . child = annotationField_AST != null && annotationField_AST . getFirstChild ( ) != null ? annotationField_AST . getFirstChild ( ) : annotationField_AST ; currentAST . advanceChildToEnd ( ) ; } } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } returnAST = annotationField_AST ; } public final void enumConstantsStart ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST enumConstantsStart_AST = null ; annotationsOpt ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; AST tmp161_AST = null ; tmp161_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp161_AST ) ; match ( IDENT ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case LCURLY : { AST tmp162_AST = null ; tmp162_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp162_AST ) ; match ( LCURLY ) ; break ; } case LPAREN : { AST tmp163_AST = null ; tmp163_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp163_AST ) ; match ( LPAREN ) ; break ; } case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case IDENT : case AT : case COMMA : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case RCURLY : case SEMI : case NLS : { nls ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case SEMI : { AST tmp164_AST = null ; tmp164_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp164_AST ) ; match ( SEMI ) ; break ; } case COMMA : { AST tmp165_AST = null ; tmp165_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp165_AST ) ; match ( COMMA ) ; break ; } case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case IDENT : case AT : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : { declarationStart ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case RCURLY : { AST tmp166_AST = null ; tmp166_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp166_AST ) ; match ( RCURLY ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } enumConstantsStart_AST = ( AST ) currentAST . root ; returnAST = enumConstantsStart_AST ; } public final void enumConstants ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST enumConstants_AST = null ; enumConstant ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop158 : do { boolean synPredMatched151 = false ; if ( ( ( _tokenSet_58 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_59 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m151 = mark ( ) ; synPredMatched151 = true ; inputState . guessing ++ ; try { { nls ( ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case RCURLY : { match ( RCURLY ) ; break ; } case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case IDENT : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : { classField ( ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } } } catch ( RecognitionException pe ) { synPredMatched151 = false ; } rewind ( _m151 ) ; inputState . guessing -- ; } if ( synPredMatched151 ) { if ( inputState . guessing == <NUM_LIT:0> ) { break ; } } else if ( ( LA ( <NUM_LIT:1> ) == COMMA || LA ( <NUM_LIT:1> ) == NLS ) && ( _tokenSet_60 . member ( LA ( <NUM_LIT:2> ) ) ) ) { nls ( ) ; match ( COMMA ) ; { boolean synPredMatched155 = false ; if ( ( ( _tokenSet_58 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_59 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m155 = mark ( ) ; synPredMatched155 = true ; inputState . guessing ++ ; try { { nls ( ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case RCURLY : { match ( RCURLY ) ; break ; } case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case IDENT : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : { classField ( ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } } } catch ( RecognitionException pe ) { synPredMatched155 = false ; } rewind ( _m155 ) ; inputState . guessing -- ; } if ( synPredMatched155 ) { if ( inputState . guessing == <NUM_LIT:0> ) { break ; } } else { boolean synPredMatched157 = false ; if ( ( ( _tokenSet_61 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_62 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m157 = mark ( ) ; synPredMatched157 = true ; inputState . guessing ++ ; try { { nls ( ) ; annotationsOpt ( ) ; match ( IDENT ) ; } } catch ( RecognitionException pe ) { synPredMatched157 = false ; } rewind ( _m157 ) ; inputState . guessing -- ; } if ( synPredMatched157 ) { nls ( ) ; enumConstant ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } } else { break _loop158 ; } } while ( true ) ; } enumConstants_AST = ( AST ) currentAST . root ; returnAST = enumConstants_AST ; } public final void enumConstant ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST enumConstant_AST = null ; AST an_AST = null ; Token i = null ; AST i_AST = null ; AST a_AST = null ; AST b_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; annotationsOpt ( ) ; an_AST = ( AST ) returnAST ; i = LT ( <NUM_LIT:1> ) ; i_AST = astFactory . create ( i ) ; match ( IDENT ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case LPAREN : { match ( LPAREN ) ; argList ( ) ; a_AST = ( AST ) returnAST ; match ( RPAREN ) ; break ; } case COMMA : case LCURLY : case RCURLY : case SEMI : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } { switch ( LA ( <NUM_LIT:1> ) ) { case LCURLY : { enumConstantBlock ( ) ; b_AST = ( AST ) returnAST ; break ; } case COMMA : case RCURLY : case SEMI : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { enumConstant_AST = ( AST ) currentAST . root ; enumConstant_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:5> ) ) . add ( create ( ENUM_CONSTANT_DEF , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( an_AST ) . add ( i_AST ) . add ( a_AST ) . add ( b_AST ) ) ; currentAST . root = enumConstant_AST ; currentAST . child = enumConstant_AST != null && enumConstant_AST . getFirstChild ( ) != null ? enumConstant_AST . getFirstChild ( ) : enumConstant_AST ; currentAST . advanceChildToEnd ( ) ; } returnAST = enumConstant_AST ; } public final void argList ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST argList_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; Token lastComma = null ; int hls = <NUM_LIT:0> , hls2 = <NUM_LIT:0> ; boolean hasClosureList = false ; boolean trailingComma = false ; boolean sce = false ; { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case UNUSED_GOTO : case UNUSED_CONST : case UNUSED_DO : case STRICTFP : case LITERAL_package : case LITERAL_import : case LITERAL_static : case LITERAL_def : case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_extends : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case STAR : case LITERAL_as : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : case LITERAL_default : case LITERAL_throws : case LITERAL_implements : case LITERAL_this : case LITERAL_if : case LITERAL_else : case LITERAL_while : case LITERAL_switch : case LITERAL_for : case LITERAL_in : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case PLUS : case MINUS : case LITERAL_case : case LITERAL_try : case LITERAL_finally : case LITERAL_catch : case LITERAL_false : case LITERAL_instanceof : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { hls = argument ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case SEMI : { { { int _cnt543 = <NUM_LIT:0> ; _loop543 : do { if ( ( LA ( <NUM_LIT:1> ) == SEMI ) ) { match ( SEMI ) ; if ( inputState . guessing == <NUM_LIT:0> ) { hasClosureList = true ; } { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case AT : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : case LITERAL_this : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case PLUS : case MINUS : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { sce = strictContextExpression ( true ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case RBRACK : case RPAREN : case SEMI : { if ( inputState . guessing == <NUM_LIT:0> ) { astFactory . addASTChild ( currentAST , astFactory . create ( EMPTY_STAT , "<STR_LIT>" ) ) ; } break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } } else { if ( _cnt543 >= <NUM_LIT:1> ) { break _loop543 ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } _cnt543 ++ ; } while ( true ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { argList_AST = ( AST ) currentAST . root ; argList_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( CLOSURE_LIST , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( argList_AST ) ) ; currentAST . root = argList_AST ; currentAST . child = argList_AST != null && argList_AST . getFirstChild ( ) != null ? argList_AST . getFirstChild ( ) : argList_AST ; currentAST . advanceChildToEnd ( ) ; } } break ; } case RBRACK : case COMMA : case RPAREN : { { { _loop549 : do { if ( ( LA ( <NUM_LIT:1> ) == COMMA ) ) { if ( inputState . guessing == <NUM_LIT:0> ) { lastComma = LT ( <NUM_LIT:1> ) ; } match ( COMMA ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case UNUSED_GOTO : case UNUSED_CONST : case UNUSED_DO : case STRICTFP : case LITERAL_package : case LITERAL_import : case LITERAL_static : case LITERAL_def : case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_extends : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case STAR : case LITERAL_as : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : case LITERAL_default : case LITERAL_throws : case LITERAL_implements : case LITERAL_this : case LITERAL_if : case LITERAL_else : case LITERAL_while : case LITERAL_switch : case LITERAL_for : case LITERAL_in : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case PLUS : case MINUS : case LITERAL_case : case LITERAL_try : case LITERAL_finally : case LITERAL_catch : case LITERAL_false : case LITERAL_instanceof : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { { hls2 = argument ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; if ( inputState . guessing == <NUM_LIT:0> ) { hls |= hls2 ; } } break ; } case RBRACK : case COMMA : case RPAREN : { { if ( inputState . guessing == <NUM_LIT:0> ) { if ( trailingComma ) throw new NoViableAltException ( lastComma , getFilename ( ) ) ; trailingComma = true ; } } break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } } else { break _loop549 ; } } while ( true ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { argList_AST = ( AST ) currentAST . root ; argList_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( ELIST , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( argList_AST ) ) ; currentAST . root = argList_AST ; currentAST . child = argList_AST != null && argList_AST . getFirstChild ( ) != null ? argList_AST . getFirstChild ( ) : argList_AST ; currentAST . advanceChildToEnd ( ) ; } } break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } break ; } case RBRACK : case RPAREN : { { if ( inputState . guessing == <NUM_LIT:0> ) { argList_AST = ( AST ) currentAST . root ; argList_AST = create ( ELIST , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ; currentAST . root = argList_AST ; currentAST . child = argList_AST != null && argList_AST . getFirstChild ( ) != null ? argList_AST . getFirstChild ( ) : argList_AST ; currentAST . advanceChildToEnd ( ) ; } } break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { argListHasLabels = ( hls & <NUM_LIT:1> ) != <NUM_LIT:0> ; } argList_AST = ( AST ) currentAST . root ; returnAST = argList_AST ; } public final void enumConstantBlock ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST enumConstantBlock_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; match ( LCURLY ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case IDENT : case LT : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : { enumConstantField ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case RCURLY : case SEMI : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } { _loop172 : do { if ( ( LA ( <NUM_LIT:1> ) == SEMI || LA ( <NUM_LIT:1> ) == NLS ) ) { sep ( ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case IDENT : case LT : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : { enumConstantField ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case RCURLY : case SEMI : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } } else { break _loop172 ; } } while ( true ) ; } match ( RCURLY ) ; if ( inputState . guessing == <NUM_LIT:0> ) { enumConstantBlock_AST = ( AST ) currentAST . root ; enumConstantBlock_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( OBJBLOCK , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( enumConstantBlock_AST ) ) ; currentAST . root = enumConstantBlock_AST ; currentAST . child = enumConstantBlock_AST != null && enumConstantBlock_AST . getFirstChild ( ) != null ? enumConstantBlock_AST . getFirstChild ( ) : enumConstantBlock_AST ; currentAST . advanceChildToEnd ( ) ; } enumConstantBlock_AST = ( AST ) currentAST . root ; returnAST = enumConstantBlock_AST ; } public final void enumConstantField ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST enumConstantField_AST = null ; AST mods_AST = null ; AST td_AST = null ; AST tp_AST = null ; AST t_AST = null ; AST param_AST = null ; AST tc_AST = null ; AST s2_AST = null ; AST v_AST = null ; AST s4_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case IDENT : case LT : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : { modifiersOpt ( ) ; mods_AST = ( AST ) returnAST ; { switch ( LA ( <NUM_LIT:1> ) ) { case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : { typeDefinitionInternal ( mods_AST ) ; td_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { enumConstantField_AST = ( AST ) currentAST . root ; enumConstantField_AST = td_AST ; currentAST . root = enumConstantField_AST ; currentAST . child = enumConstantField_AST != null && enumConstantField_AST . getFirstChild ( ) != null ? enumConstantField_AST . getFirstChild ( ) : enumConstantField_AST ; currentAST . advanceChildToEnd ( ) ; } break ; } case IDENT : case LT : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : { { switch ( LA ( <NUM_LIT:1> ) ) { case LT : { typeParameters ( ) ; tp_AST = ( AST ) returnAST ; break ; } case IDENT : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } typeSpec ( false ) ; t_AST = ( AST ) returnAST ; { boolean synPredMatched178 = false ; if ( ( ( LA ( <NUM_LIT:1> ) == IDENT ) && ( LA ( <NUM_LIT:2> ) == LPAREN ) ) ) { int _m178 = mark ( ) ; synPredMatched178 = true ; inputState . guessing ++ ; try { { match ( IDENT ) ; match ( LPAREN ) ; } } catch ( RecognitionException pe ) { synPredMatched178 = false ; } rewind ( _m178 ) ; inputState . guessing -- ; } if ( synPredMatched178 ) { AST tmp174_AST = null ; tmp174_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( IDENT ) ; match ( LPAREN ) ; parameterDeclarationList ( ) ; param_AST = ( AST ) returnAST ; match ( RPAREN ) ; { boolean synPredMatched181 = false ; if ( ( ( LA ( <NUM_LIT:1> ) == LITERAL_throws || LA ( <NUM_LIT:1> ) == NLS ) && ( _tokenSet_29 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m181 = mark ( ) ; synPredMatched181 = true ; inputState . guessing ++ ; try { { nls ( ) ; match ( LITERAL_throws ) ; } } catch ( RecognitionException pe ) { synPredMatched181 = false ; } rewind ( _m181 ) ; inputState . guessing -- ; } if ( synPredMatched181 ) { throwsClause ( ) ; tc_AST = ( AST ) returnAST ; } else if ( ( _tokenSet_63 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_64 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } { switch ( LA ( <NUM_LIT:1> ) ) { case LCURLY : { compoundStatement ( ) ; s2_AST = ( AST ) returnAST ; break ; } case RCURLY : case SEMI : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { enumConstantField_AST = ( AST ) currentAST . root ; enumConstantField_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:8> ) ) . add ( create ( METHOD_DEF , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( mods_AST ) . add ( tp_AST ) . add ( ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( TYPE , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( t_AST ) ) ) . add ( tmp174_AST ) . add ( param_AST ) . add ( tc_AST ) . add ( s2_AST ) ) ; currentAST . root = enumConstantField_AST ; currentAST . child = enumConstantField_AST != null && enumConstantField_AST . getFirstChild ( ) != null ? enumConstantField_AST . getFirstChild ( ) : enumConstantField_AST ; currentAST . advanceChildToEnd ( ) ; } } else if ( ( LA ( <NUM_LIT:1> ) == IDENT || LA ( <NUM_LIT:1> ) == STRING_LITERAL ) && ( _tokenSet_57 . member ( LA ( <NUM_LIT:2> ) ) ) ) { variableDefinitions ( mods_AST , t_AST ) ; v_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { enumConstantField_AST = ( AST ) currentAST . root ; enumConstantField_AST = v_AST ; currentAST . root = enumConstantField_AST ; currentAST . child = enumConstantField_AST != null && enumConstantField_AST . getFirstChild ( ) != null ? enumConstantField_AST . getFirstChild ( ) : enumConstantField_AST ; currentAST . advanceChildToEnd ( ) ; } } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } break ; } case LCURLY : { compoundStatement ( ) ; s4_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { enumConstantField_AST = ( AST ) currentAST . root ; enumConstantField_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( INSTANCE_INIT , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( s4_AST ) ) ; currentAST . root = enumConstantField_AST ; currentAST . child = enumConstantField_AST != null && enumConstantField_AST . getFirstChild ( ) != null ? enumConstantField_AST . getFirstChild ( ) : enumConstantField_AST ; currentAST . advanceChildToEnd ( ) ; } break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = enumConstantField_AST ; } public final void parameterDeclarationList ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST parameterDeclarationList_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case LITERAL_def : case IDENT : case AT : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case TRIPLE_DOT : { parameterDeclaration ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop259 : do { if ( ( LA ( <NUM_LIT:1> ) == COMMA ) ) { match ( COMMA ) ; nls ( ) ; parameterDeclaration ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop259 ; } } while ( true ) ; } break ; } case RPAREN : case CLOSABLE_BLOCK_OP : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { parameterDeclarationList_AST = ( AST ) currentAST . root ; parameterDeclarationList_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( PARAMETERS , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( parameterDeclarationList_AST ) ) ; currentAST . root = parameterDeclarationList_AST ; currentAST . child = parameterDeclarationList_AST != null && parameterDeclarationList_AST . getFirstChild ( ) != null ? parameterDeclarationList_AST . getFirstChild ( ) : parameterDeclarationList_AST ; currentAST . advanceChildToEnd ( ) ; } parameterDeclarationList_AST = ( AST ) currentAST . root ; returnAST = parameterDeclarationList_AST ; } public final void throwsClause ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST throwsClause_AST = null ; nls ( ) ; AST tmp178_AST = null ; tmp178_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp178_AST ) ; match ( LITERAL_throws ) ; nls ( ) ; identifier ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop255 : do { if ( ( LA ( <NUM_LIT:1> ) == COMMA ) ) { match ( COMMA ) ; nls ( ) ; identifier ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop255 ; } } while ( true ) ; } throwsClause_AST = ( AST ) currentAST . root ; returnAST = throwsClause_AST ; } public final void compoundStatement ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST compoundStatement_AST = null ; openBlock ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; compoundStatement_AST = ( AST ) currentAST . root ; returnAST = compoundStatement_AST ; } public final void constructorDefinition ( AST mods ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST constructorDefinition_AST = null ; Token id = null ; AST id_AST = null ; AST param_AST = null ; AST tc_AST = null ; AST cb_AST = null ; Token first = cloneToken ( LT ( <NUM_LIT:1> ) ) ; if ( mods != null ) { first . setLine ( mods . getLine ( ) ) ; first . setColumn ( mods . getColumn ( ) ) ; } id = LT ( <NUM_LIT:1> ) ; id_AST = astFactory . create ( id ) ; astFactory . addASTChild ( currentAST , id_AST ) ; match ( IDENT ) ; match ( LPAREN ) ; parameterDeclarationList ( ) ; param_AST = ( AST ) returnAST ; match ( RPAREN ) ; { boolean synPredMatched244 = false ; if ( ( ( LA ( <NUM_LIT:1> ) == LITERAL_throws || LA ( <NUM_LIT:1> ) == NLS ) && ( _tokenSet_29 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m244 = mark ( ) ; synPredMatched244 = true ; inputState . guessing ++ ; try { { nls ( ) ; match ( LITERAL_throws ) ; } } catch ( RecognitionException pe ) { synPredMatched244 = false ; } rewind ( _m244 ) ; inputState . guessing -- ; } if ( synPredMatched244 ) { throwsClause ( ) ; tc_AST = ( AST ) returnAST ; } else if ( ( LA ( <NUM_LIT:1> ) == LCURLY || LA ( <NUM_LIT:1> ) == NLS ) && ( _tokenSet_65 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } nlsWarn ( ) ; if ( inputState . guessing == <NUM_LIT:0> ) { isConstructorIdent ( id ) ; } constructorBody ( ) ; cb_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { constructorDefinition_AST = ( AST ) currentAST . root ; constructorDefinition_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:5> ) ) . add ( create ( CTOR_IDENT , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( mods ) . add ( param_AST ) . add ( tc_AST ) . add ( cb_AST ) ) ; currentAST . root = constructorDefinition_AST ; currentAST . child = constructorDefinition_AST != null && constructorDefinition_AST . getFirstChild ( ) != null ? constructorDefinition_AST . getFirstChild ( ) : constructorDefinition_AST ; currentAST . advanceChildToEnd ( ) ; } constructorDefinition_AST = ( AST ) currentAST . root ; returnAST = constructorDefinition_AST ; } public final void multipleAssignmentDeclarationStart ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST multipleAssignmentDeclarationStart_AST = null ; { _loop224 : do { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : { modifier ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; nls ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case AT : { annotation ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; nls ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } default : { break _loop224 ; } } } while ( true ) ; } AST tmp182_AST = null ; tmp182_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp182_AST ) ; match ( LITERAL_def ) ; nls ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; AST tmp183_AST = null ; tmp183_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp183_AST ) ; match ( LPAREN ) ; multipleAssignmentDeclarationStart_AST = ( AST ) currentAST . root ; returnAST = multipleAssignmentDeclarationStart_AST ; } public final void multipleAssignmentDeclaration ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST multipleAssignmentDeclaration_AST = null ; AST mods_AST = null ; AST t_AST = null ; Token first = cloneToken ( LT ( <NUM_LIT:1> ) ) ; modifiers ( ) ; mods_AST = ( AST ) returnAST ; { switch ( LA ( <NUM_LIT:1> ) ) { case IDENT : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : { typeSpec ( false ) ; t_AST = ( AST ) returnAST ; break ; } case LPAREN : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } AST tmp184_AST = null ; tmp184_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp184_AST ) ; match ( LPAREN ) ; nls ( ) ; typeNamePairs ( mods_AST , first ) ; astFactory . addASTChild ( currentAST , returnAST ) ; match ( RPAREN ) ; AST tmp186_AST = null ; tmp186_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp186_AST ) ; match ( ASSIGN ) ; nls ( ) ; assignmentExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; if ( inputState . guessing == <NUM_LIT:0> ) { multipleAssignmentDeclaration_AST = ( AST ) currentAST . root ; multipleAssignmentDeclaration_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:4> ) ) . add ( create ( VARIABLE_DEF , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( mods_AST ) . add ( ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( TYPE , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( t_AST ) ) ) . add ( multipleAssignmentDeclaration_AST ) ) ; currentAST . root = multipleAssignmentDeclaration_AST ; currentAST . child = multipleAssignmentDeclaration_AST != null && multipleAssignmentDeclaration_AST . getFirstChild ( ) != null ? multipleAssignmentDeclaration_AST . getFirstChild ( ) : multipleAssignmentDeclaration_AST ; currentAST . advanceChildToEnd ( ) ; } multipleAssignmentDeclaration_AST = ( AST ) currentAST . root ; returnAST = multipleAssignmentDeclaration_AST ; } public final void constructorBody ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST constructorBody_AST = null ; AST eci_AST = null ; AST bb1_AST = null ; AST bb2_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; match ( LCURLY ) ; nls ( ) ; { boolean synPredMatched214 = false ; if ( ( ( _tokenSet_66 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_67 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m214 = mark ( ) ; synPredMatched214 = true ; inputState . guessing ++ ; try { { explicitConstructorInvocation ( ) ; } } catch ( RecognitionException pe ) { synPredMatched214 = false ; } rewind ( _m214 ) ; inputState . guessing -- ; } if ( synPredMatched214 ) { explicitConstructorInvocation ( ) ; eci_AST = ( AST ) returnAST ; { switch ( LA ( <NUM_LIT:1> ) ) { case SEMI : case NLS : { sep ( ) ; blockBody ( sepToken ) ; bb1_AST = ( AST ) returnAST ; break ; } case RCURLY : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } } else if ( ( _tokenSet_31 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_68 . member ( LA ( <NUM_LIT:2> ) ) ) ) { blockBody ( EOF ) ; bb2_AST = ( AST ) returnAST ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } match ( RCURLY ) ; if ( inputState . guessing == <NUM_LIT:0> ) { constructorBody_AST = ( AST ) currentAST . root ; if ( eci_AST != null ) constructorBody_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( SLIST , "<STR_LIT:{>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( eci_AST ) . add ( bb1_AST ) ) ; else constructorBody_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( SLIST , "<STR_LIT:{>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( bb2_AST ) ) ; currentAST . root = constructorBody_AST ; currentAST . child = constructorBody_AST != null && constructorBody_AST . getFirstChild ( ) != null ? constructorBody_AST . getFirstChild ( ) : constructorBody_AST ; currentAST . advanceChildToEnd ( ) ; } constructorBody_AST = ( AST ) currentAST . root ; returnAST = constructorBody_AST ; } public final void explicitConstructorInvocation ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST explicitConstructorInvocation_AST = null ; Token lp1 = null ; AST lp1_AST = null ; Token lp2 = null ; AST lp2_AST = null ; { switch ( LA ( <NUM_LIT:1> ) ) { case LT : { typeArguments ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case LITERAL_super : case LITERAL_this : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } { switch ( LA ( <NUM_LIT:1> ) ) { case LITERAL_this : { match ( LITERAL_this ) ; lp1 = LT ( <NUM_LIT:1> ) ; lp1_AST = astFactory . create ( lp1 ) ; astFactory . makeASTRoot ( currentAST , lp1_AST ) ; match ( LPAREN ) ; argList ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; match ( RPAREN ) ; if ( inputState . guessing == <NUM_LIT:0> ) { lp1_AST . setType ( CTOR_CALL ) ; } break ; } case LITERAL_super : { match ( LITERAL_super ) ; lp2 = LT ( <NUM_LIT:1> ) ; lp2_AST = astFactory . create ( lp2 ) ; astFactory . makeASTRoot ( currentAST , lp2_AST ) ; match ( LPAREN ) ; argList ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; match ( RPAREN ) ; if ( inputState . guessing == <NUM_LIT:0> ) { lp2_AST . setType ( SUPER_CTOR_CALL ) ; } break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } explicitConstructorInvocation_AST = ( AST ) currentAST . root ; returnAST = explicitConstructorInvocation_AST ; } public final void listOfVariables ( AST mods , AST t , Token first ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST listOfVariables_AST = null ; variableDeclarator ( getASTFactory ( ) . dupTree ( mods ) , getASTFactory ( ) . dupTree ( t ) , first ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop221 : do { if ( ( LA ( <NUM_LIT:1> ) == COMMA ) ) { match ( COMMA ) ; nls ( ) ; if ( inputState . guessing == <NUM_LIT:0> ) { first = LT ( <NUM_LIT:1> ) ; } variableDeclarator ( getASTFactory ( ) . dupTree ( mods ) , getASTFactory ( ) . dupTree ( t ) , first ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop221 ; } } while ( true ) ; } listOfVariables_AST = ( AST ) currentAST . root ; returnAST = listOfVariables_AST ; } public final void variableDeclarator ( AST mods , AST t , Token first ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST variableDeclarator_AST = null ; AST id_AST = null ; AST v_AST = null ; variableName ( ) ; id_AST = ( AST ) returnAST ; { switch ( LA ( <NUM_LIT:1> ) ) { case ASSIGN : { varInitializer ( ) ; v_AST = ( AST ) returnAST ; break ; } case EOF : case COMMA : case RPAREN : case RCURLY : case SEMI : case LITERAL_default : case LITERAL_else : case LITERAL_case : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { variableDeclarator_AST = ( AST ) currentAST . root ; variableDeclarator_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:5> ) ) . add ( create ( VARIABLE_DEF , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( mods ) . add ( ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( TYPE , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( t ) ) ) . add ( id_AST ) . add ( v_AST ) ) ; currentAST . root = variableDeclarator_AST ; currentAST . child = variableDeclarator_AST != null && variableDeclarator_AST . getFirstChild ( ) != null ? variableDeclarator_AST . getFirstChild ( ) : variableDeclarator_AST ; currentAST . advanceChildToEnd ( ) ; } returnAST = variableDeclarator_AST ; } public final void typeNamePairs ( AST mods , Token first ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST typeNamePairs_AST = null ; AST t_AST = null ; AST tn_AST = null ; { if ( ( _tokenSet_25 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_32 . member ( LA ( <NUM_LIT:2> ) ) ) ) { typeSpec ( false ) ; t_AST = ( AST ) returnAST ; } else if ( ( LA ( <NUM_LIT:1> ) == IDENT ) && ( LA ( <NUM_LIT:2> ) == COMMA || LA ( <NUM_LIT:2> ) == RPAREN ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } singleVariable ( getASTFactory ( ) . dupTree ( mods ) , t_AST ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop229 : do { if ( ( LA ( <NUM_LIT:1> ) == COMMA ) ) { match ( COMMA ) ; nls ( ) ; if ( inputState . guessing == <NUM_LIT:0> ) { first = LT ( <NUM_LIT:1> ) ; } { if ( ( _tokenSet_25 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_32 . member ( LA ( <NUM_LIT:2> ) ) ) ) { typeSpec ( false ) ; tn_AST = ( AST ) returnAST ; } else if ( ( LA ( <NUM_LIT:1> ) == IDENT ) && ( LA ( <NUM_LIT:2> ) == COMMA || LA ( <NUM_LIT:2> ) == RPAREN ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } singleVariable ( getASTFactory ( ) . dupTree ( mods ) , tn_AST ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop229 ; } } while ( true ) ; } typeNamePairs_AST = ( AST ) currentAST . root ; returnAST = typeNamePairs_AST ; } public final void assignmentExpression ( int lc_stmt ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST assignmentExpression_AST = null ; conditionalExpression ( lc_stmt ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case ASSIGN : case PLUS_ASSIGN : case MINUS_ASSIGN : case STAR_ASSIGN : case DIV_ASSIGN : case MOD_ASSIGN : case SR_ASSIGN : case BSR_ASSIGN : case SL_ASSIGN : case BAND_ASSIGN : case BXOR_ASSIGN : case BOR_ASSIGN : case STAR_STAR_ASSIGN : { { switch ( LA ( <NUM_LIT:1> ) ) { case ASSIGN : { AST tmp195_AST = null ; tmp195_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp195_AST ) ; match ( ASSIGN ) ; break ; } case PLUS_ASSIGN : { AST tmp196_AST = null ; tmp196_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp196_AST ) ; match ( PLUS_ASSIGN ) ; break ; } case MINUS_ASSIGN : { AST tmp197_AST = null ; tmp197_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp197_AST ) ; match ( MINUS_ASSIGN ) ; break ; } case STAR_ASSIGN : { AST tmp198_AST = null ; tmp198_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp198_AST ) ; match ( STAR_ASSIGN ) ; break ; } case DIV_ASSIGN : { AST tmp199_AST = null ; tmp199_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp199_AST ) ; match ( DIV_ASSIGN ) ; break ; } case MOD_ASSIGN : { AST tmp200_AST = null ; tmp200_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp200_AST ) ; match ( MOD_ASSIGN ) ; break ; } case SR_ASSIGN : { AST tmp201_AST = null ; tmp201_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp201_AST ) ; match ( SR_ASSIGN ) ; break ; } case BSR_ASSIGN : { AST tmp202_AST = null ; tmp202_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp202_AST ) ; match ( BSR_ASSIGN ) ; break ; } case SL_ASSIGN : { AST tmp203_AST = null ; tmp203_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp203_AST ) ; match ( SL_ASSIGN ) ; break ; } case BAND_ASSIGN : { AST tmp204_AST = null ; tmp204_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp204_AST ) ; match ( BAND_ASSIGN ) ; break ; } case BXOR_ASSIGN : { AST tmp205_AST = null ; tmp205_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp205_AST ) ; match ( BXOR_ASSIGN ) ; break ; } case BOR_ASSIGN : { AST tmp206_AST = null ; tmp206_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp206_AST ) ; match ( BOR_ASSIGN ) ; break ; } case STAR_STAR_ASSIGN : { AST tmp207_AST = null ; tmp207_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp207_AST ) ; match ( STAR_STAR_ASSIGN ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } nls ( ) ; expressionStatementNoCheck ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case EOF : case FINAL : case ABSTRACT : case UNUSED_GOTO : case UNUSED_CONST : case UNUSED_DO : case STRICTFP : case LITERAL_package : case LITERAL_import : case LITERAL_static : case LITERAL_def : case LBRACK : case RBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case LITERAL_extends : case LITERAL_super : case COMMA : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_as : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case RPAREN : case LCURLY : case RCURLY : case SEMI : case LITERAL_default : case LITERAL_throws : case LITERAL_implements : case LITERAL_this : case CLOSABLE_BLOCK_OP : case COLON : case LITERAL_if : case LITERAL_else : case LITERAL_while : case LITERAL_switch : case LITERAL_for : case LITERAL_in : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case PLUS : case MINUS : case LITERAL_case : case LITERAL_try : case LITERAL_finally : case LITERAL_catch : case LITERAL_false : case LITERAL_instanceof : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } assignmentExpression_AST = ( AST ) currentAST . root ; returnAST = assignmentExpression_AST ; } public final void nlsWarn ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST nlsWarn_AST = null ; { boolean synPredMatched588 = false ; if ( ( ( _tokenSet_69 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_2 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m588 = mark ( ) ; synPredMatched588 = true ; inputState . guessing ++ ; try { { match ( NLS ) ; } } catch ( RecognitionException pe ) { synPredMatched588 = false ; } rewind ( _m588 ) ; inputState . guessing -- ; } if ( synPredMatched588 ) { if ( inputState . guessing == <NUM_LIT:0> ) { addWarning ( "<STR_LIT>" , "<STR_LIT>" ) ; } } else if ( ( _tokenSet_69 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_2 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } nls ( ) ; returnAST = nlsWarn_AST ; } public final void openBlock ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST openBlock_AST = null ; AST bb_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; match ( LCURLY ) ; nls ( ) ; blockBody ( EOF ) ; bb_AST = ( AST ) returnAST ; match ( RCURLY ) ; if ( inputState . guessing == <NUM_LIT:0> ) { openBlock_AST = ( AST ) currentAST . root ; openBlock_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( SLIST , "<STR_LIT:{>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( bb_AST ) ) ; currentAST . root = openBlock_AST ; currentAST . child = openBlock_AST != null && openBlock_AST . getFirstChild ( ) != null ? openBlock_AST . getFirstChild ( ) : openBlock_AST ; currentAST . advanceChildToEnd ( ) ; } openBlock_AST = ( AST ) currentAST . root ; returnAST = openBlock_AST ; } public final void variableName ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST variableName_AST = null ; AST tmp210_AST = null ; tmp210_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp210_AST ) ; match ( IDENT ) ; variableName_AST = ( AST ) currentAST . root ; returnAST = variableName_AST ; } public final void expressionStatementNoCheck ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST expressionStatementNoCheck_AST = null ; AST head_AST = null ; AST cmd_AST = null ; boolean isPathExpr = true ; expression ( LC_STMT ) ; head_AST = ( AST ) returnAST ; astFactory . addASTChild ( currentAST , returnAST ) ; if ( inputState . guessing == <NUM_LIT:0> ) { isPathExpr = ( head_AST == lastPathExpression ) ; } { if ( ( ( _tokenSet_70 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_71 . member ( LA ( <NUM_LIT:2> ) ) ) ) && ( LA ( <NUM_LIT:1> ) != LITERAL_else && isPathExpr ) ) { commandArgumentsGreedy ( head_AST ) ; cmd_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { expressionStatementNoCheck_AST = ( AST ) currentAST . root ; expressionStatementNoCheck_AST = cmd_AST ; currentAST . root = expressionStatementNoCheck_AST ; currentAST . child = expressionStatementNoCheck_AST != null && expressionStatementNoCheck_AST . getFirstChild ( ) != null ? expressionStatementNoCheck_AST . getFirstChild ( ) : expressionStatementNoCheck_AST ; currentAST . advanceChildToEnd ( ) ; } } else if ( ( _tokenSet_70 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_71 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } expressionStatementNoCheck_AST = ( AST ) currentAST . root ; returnAST = expressionStatementNoCheck_AST ; } public final void parameterDeclaration ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST parameterDeclaration_AST = null ; AST pm_AST = null ; AST t_AST = null ; Token id = null ; AST id_AST = null ; AST exp_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; boolean spreadParam = false ; parameterModifiersOpt ( ) ; pm_AST = ( AST ) returnAST ; { if ( ( _tokenSet_25 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_72 . member ( LA ( <NUM_LIT:2> ) ) ) ) { typeSpec ( false ) ; t_AST = ( AST ) returnAST ; } else if ( ( LA ( <NUM_LIT:1> ) == IDENT || LA ( <NUM_LIT:1> ) == TRIPLE_DOT ) && ( _tokenSet_73 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } { switch ( LA ( <NUM_LIT:1> ) ) { case TRIPLE_DOT : { match ( TRIPLE_DOT ) ; if ( inputState . guessing == <NUM_LIT:0> ) { spreadParam = true ; } break ; } case IDENT : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } id = LT ( <NUM_LIT:1> ) ; id_AST = astFactory . create ( id ) ; match ( IDENT ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case ASSIGN : { varInitializer ( ) ; exp_AST = ( AST ) returnAST ; break ; } case COMMA : case RPAREN : case CLOSABLE_BLOCK_OP : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { parameterDeclaration_AST = ( AST ) currentAST . root ; if ( spreadParam ) { parameterDeclaration_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:5> ) ) . add ( create ( VARIABLE_PARAMETER_DEF , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( pm_AST ) . add ( ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( TYPE , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( t_AST ) ) ) . add ( id_AST ) . add ( exp_AST ) ) ; } else { parameterDeclaration_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:5> ) ) . add ( create ( PARAMETER_DEF , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( pm_AST ) . add ( ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( TYPE , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( t_AST ) ) ) . add ( id_AST ) . add ( exp_AST ) ) ; } currentAST . root = parameterDeclaration_AST ; currentAST . child = parameterDeclaration_AST != null && parameterDeclaration_AST . getFirstChild ( ) != null ? parameterDeclaration_AST . getFirstChild ( ) : parameterDeclaration_AST ; currentAST . advanceChildToEnd ( ) ; } returnAST = parameterDeclaration_AST ; } public final void parameterModifiersOpt ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST parameterModifiersOpt_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; int seenDef = <NUM_LIT:0> ; { _loop273 : do { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : { AST tmp212_AST = null ; tmp212_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp212_AST ) ; match ( FINAL ) ; nls ( ) ; break ; } case AT : { annotation ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; nls ( ) ; break ; } default : if ( ( ( LA ( <NUM_LIT:1> ) == LITERAL_def ) ) && ( seenDef ++ == <NUM_LIT:0> ) ) { match ( LITERAL_def ) ; nls ( ) ; } else { break _loop273 ; } } } while ( true ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { parameterModifiersOpt_AST = ( AST ) currentAST . root ; parameterModifiersOpt_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( MODIFIERS , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( parameterModifiersOpt_AST ) ) ; currentAST . root = parameterModifiersOpt_AST ; currentAST . child = parameterModifiersOpt_AST != null && parameterModifiersOpt_AST . getFirstChild ( ) != null ? parameterModifiersOpt_AST . getFirstChild ( ) : parameterModifiersOpt_AST ; currentAST . advanceChildToEnd ( ) ; } parameterModifiersOpt_AST = ( AST ) currentAST . root ; returnAST = parameterModifiersOpt_AST ; } public final void multicatch_types ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST multicatch_types_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; nls ( ) ; classOrInterfaceType ( false ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop266 : do { if ( ( LA ( <NUM_LIT:1> ) == BOR ) ) { match ( BOR ) ; nls ( ) ; classOrInterfaceType ( false ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop266 ; } } while ( true ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { multicatch_types_AST = ( AST ) currentAST . root ; multicatch_types_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( MULTICATCH_TYPES , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( multicatch_types_AST ) ) ; currentAST . root = multicatch_types_AST ; currentAST . child = multicatch_types_AST != null && multicatch_types_AST . getFirstChild ( ) != null ? multicatch_types_AST . getFirstChild ( ) : multicatch_types_AST ; currentAST . advanceChildToEnd ( ) ; } multicatch_types_AST = ( AST ) currentAST . root ; returnAST = multicatch_types_AST ; } public final void multicatch ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST multicatch_AST = null ; AST m_AST = null ; Token id = null ; AST id_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; nls ( ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : { AST tmp215_AST = null ; tmp215_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp215_AST ) ; match ( FINAL ) ; break ; } case LITERAL_def : case IDENT : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } { switch ( LA ( <NUM_LIT:1> ) ) { case LITERAL_def : { AST tmp216_AST = null ; tmp216_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp216_AST ) ; match ( LITERAL_def ) ; break ; } case IDENT : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } { if ( ( LA ( <NUM_LIT:1> ) == IDENT || LA ( <NUM_LIT:1> ) == NLS ) && ( _tokenSet_74 . member ( LA ( <NUM_LIT:2> ) ) ) ) { multicatch_types ( ) ; m_AST = ( AST ) returnAST ; astFactory . addASTChild ( currentAST , returnAST ) ; } else if ( ( LA ( <NUM_LIT:1> ) == IDENT ) && ( LA ( <NUM_LIT:2> ) == RPAREN ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } id = LT ( <NUM_LIT:1> ) ; id_AST = astFactory . create ( id ) ; match ( IDENT ) ; if ( inputState . guessing == <NUM_LIT:0> ) { multicatch_AST = ( AST ) currentAST . root ; multicatch_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( MULTICATCH , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( m_AST ) . add ( id_AST ) ) ; currentAST . root = multicatch_AST ; currentAST . child = multicatch_AST != null && multicatch_AST . getFirstChild ( ) != null ? multicatch_AST . getFirstChild ( ) : multicatch_AST ; currentAST . advanceChildToEnd ( ) ; } multicatch_AST = ( AST ) currentAST . root ; returnAST = multicatch_AST ; } public final void closableBlockParamsOpt ( boolean addImplicit ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST closableBlockParamsOpt_AST = null ; boolean synPredMatched276 = false ; if ( ( ( _tokenSet_75 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_76 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m276 = mark ( ) ; synPredMatched276 = true ; inputState . guessing ++ ; try { { parameterDeclarationList ( ) ; nls ( ) ; match ( CLOSABLE_BLOCK_OP ) ; } } catch ( RecognitionException pe ) { synPredMatched276 = false ; } rewind ( _m276 ) ; inputState . guessing -- ; } if ( synPredMatched276 ) { parameterDeclarationList ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; nls ( ) ; match ( CLOSABLE_BLOCK_OP ) ; nls ( ) ; closableBlockParamsOpt_AST = ( AST ) currentAST . root ; } else if ( ( ( _tokenSet_31 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_71 . member ( LA ( <NUM_LIT:2> ) ) ) ) && ( addImplicit ) ) { implicitParameters ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; closableBlockParamsOpt_AST = ( AST ) currentAST . root ; } else if ( ( _tokenSet_31 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_71 . member ( LA ( <NUM_LIT:2> ) ) ) ) { closableBlockParamsOpt_AST = ( AST ) currentAST . root ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } returnAST = closableBlockParamsOpt_AST ; } public final void implicitParameters ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST implicitParameters_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; if ( inputState . guessing == <NUM_LIT:0> ) { implicitParameters_AST = ( AST ) currentAST . root ; implicitParameters_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:1> ) ) . add ( create ( IMPLICIT_PARAMETERS , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) ) ; currentAST . root = implicitParameters_AST ; currentAST . child = implicitParameters_AST != null && implicitParameters_AST . getFirstChild ( ) != null ? implicitParameters_AST . getFirstChild ( ) : implicitParameters_AST ; currentAST . advanceChildToEnd ( ) ; } implicitParameters_AST = ( AST ) currentAST . root ; returnAST = implicitParameters_AST ; } public final void closableBlockParamsStart ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST closableBlockParamsStart_AST = null ; nls ( ) ; parameterDeclarationList ( ) ; nls ( ) ; AST tmp218_AST = null ; tmp218_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( CLOSABLE_BLOCK_OP ) ; returnAST = closableBlockParamsStart_AST ; } public final void closableBlockParam ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST closableBlockParam_AST = null ; Token id = null ; AST id_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; id = LT ( <NUM_LIT:1> ) ; id_AST = astFactory . create ( id ) ; match ( IDENT ) ; if ( inputState . guessing == <NUM_LIT:0> ) { closableBlockParam_AST = ( AST ) currentAST . root ; closableBlockParam_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:4> ) ) . add ( create ( PARAMETER_DEF , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:1> ) ) . add ( create ( MODIFIERS , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) ) ) . add ( ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:1> ) ) . add ( create ( TYPE , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) ) ) . add ( id_AST ) ) ; currentAST . root = closableBlockParam_AST ; currentAST . child = closableBlockParam_AST != null && closableBlockParam_AST . getFirstChild ( ) != null ? closableBlockParam_AST . getFirstChild ( ) : closableBlockParam_AST ; currentAST . advanceChildToEnd ( ) ; } returnAST = closableBlockParam_AST ; } public final void closableBlock ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST closableBlock_AST = null ; AST cbp_AST = null ; AST bb_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; match ( LCURLY ) ; nls ( ) ; closableBlockParamsOpt ( true ) ; cbp_AST = ( AST ) returnAST ; blockBody ( EOF ) ; bb_AST = ( AST ) returnAST ; match ( RCURLY ) ; if ( inputState . guessing == <NUM_LIT:0> ) { closableBlock_AST = ( AST ) currentAST . root ; closableBlock_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( CLOSABLE_BLOCK , "<STR_LIT:{>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( cbp_AST ) . add ( bb_AST ) ) ; currentAST . root = closableBlock_AST ; currentAST . child = closableBlock_AST != null && closableBlock_AST . getFirstChild ( ) != null ? closableBlock_AST . getFirstChild ( ) : closableBlock_AST ; currentAST . advanceChildToEnd ( ) ; } closableBlock_AST = ( AST ) currentAST . root ; returnAST = closableBlock_AST ; } public final void openOrClosableBlock ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST openOrClosableBlock_AST = null ; AST cp_AST = null ; AST bb_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; match ( LCURLY ) ; nls ( ) ; closableBlockParamsOpt ( false ) ; cp_AST = ( AST ) returnAST ; blockBody ( EOF ) ; bb_AST = ( AST ) returnAST ; match ( RCURLY ) ; if ( inputState . guessing == <NUM_LIT:0> ) { openOrClosableBlock_AST = ( AST ) currentAST . root ; if ( cp_AST == null ) openOrClosableBlock_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( SLIST , "<STR_LIT:{>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( bb_AST ) ) ; else openOrClosableBlock_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( CLOSABLE_BLOCK , "<STR_LIT:{>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( cp_AST ) . add ( bb_AST ) ) ; currentAST . root = openOrClosableBlock_AST ; currentAST . child = openOrClosableBlock_AST != null && openOrClosableBlock_AST . getFirstChild ( ) != null ? openOrClosableBlock_AST . getFirstChild ( ) : openOrClosableBlock_AST ; currentAST . advanceChildToEnd ( ) ; } openOrClosableBlock_AST = ( AST ) currentAST . root ; returnAST = openOrClosableBlock_AST ; } public final void statementLabelPrefix ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST statementLabelPrefix_AST = null ; Token c = null ; AST c_AST = null ; AST tmp223_AST = null ; tmp223_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp223_AST ) ; match ( IDENT ) ; c = LT ( <NUM_LIT:1> ) ; c_AST = astFactory . create ( c ) ; astFactory . makeASTRoot ( currentAST , c_AST ) ; match ( COLON ) ; if ( inputState . guessing == <NUM_LIT:0> ) { c_AST . setType ( LABELED_STAT ) ; } nls ( ) ; statementLabelPrefix_AST = ( AST ) currentAST . root ; returnAST = statementLabelPrefix_AST ; } public final void expressionStatement ( int prevToken ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST expressionStatement_AST = null ; AST esn_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; { boolean synPredMatched339 = false ; if ( ( ( _tokenSet_20 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_2 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m339 = mark ( ) ; synPredMatched339 = true ; inputState . guessing ++ ; try { { suspiciousExpressionStatementStart ( ) ; } } catch ( RecognitionException pe ) { synPredMatched339 = false ; } rewind ( _m339 ) ; inputState . guessing -- ; } if ( synPredMatched339 ) { checkSuspiciousExpressionStatement ( prevToken ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else if ( ( _tokenSet_20 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_2 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } expressionStatementNoCheck ( ) ; esn_AST = ( AST ) returnAST ; astFactory . addASTChild ( currentAST , returnAST ) ; if ( inputState . guessing == <NUM_LIT:0> ) { expressionStatement_AST = ( AST ) currentAST . root ; expressionStatement_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( EXPR , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( esn_AST ) ) ; currentAST . root = expressionStatement_AST ; currentAST . child = expressionStatement_AST != null && expressionStatement_AST . getFirstChild ( ) != null ? expressionStatement_AST . getFirstChild ( ) : expressionStatement_AST ; currentAST . advanceChildToEnd ( ) ; } expressionStatement_AST = ( AST ) currentAST . root ; returnAST = expressionStatement_AST ; } public final void assignmentLessExpression ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST assignmentLessExpression_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; { conditionalExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { assignmentLessExpression_AST = ( AST ) currentAST . root ; assignmentLessExpression_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( EXPR , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( assignmentLessExpression_AST ) ) ; currentAST . root = assignmentLessExpression_AST ; currentAST . child = assignmentLessExpression_AST != null && assignmentLessExpression_AST . getFirstChild ( ) != null ? assignmentLessExpression_AST . getFirstChild ( ) : assignmentLessExpression_AST ; currentAST . advanceChildToEnd ( ) ; } assignmentLessExpression_AST = ( AST ) currentAST . root ; returnAST = assignmentLessExpression_AST ; } public final void compatibleBodyStatement ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST compatibleBodyStatement_AST = null ; try { boolean synPredMatched328 = false ; if ( ( ( LA ( <NUM_LIT:1> ) == LCURLY ) && ( _tokenSet_31 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m328 = mark ( ) ; synPredMatched328 = true ; inputState . guessing ++ ; try { { match ( LCURLY ) ; } } catch ( RecognitionException pe ) { synPredMatched328 = false ; } rewind ( _m328 ) ; inputState . guessing -- ; } if ( synPredMatched328 ) { compoundStatement ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; compatibleBodyStatement_AST = ( AST ) currentAST . root ; } else if ( ( _tokenSet_19 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_2 . member ( LA ( <NUM_LIT:2> ) ) ) ) { statement ( EOF ) ; astFactory . addASTChild ( currentAST , returnAST ) ; compatibleBodyStatement_AST = ( AST ) currentAST . root ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } catch ( RecognitionException e ) { if ( inputState . guessing == <NUM_LIT:0> ) { reportError ( e ) ; } else { throw e ; } } returnAST = compatibleBodyStatement_AST ; } public final void forStatement ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST forStatement_AST = null ; AST cl_AST = null ; AST fic_AST = null ; Token s = null ; AST s_AST = null ; AST forCbs_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; match ( LITERAL_for ) ; match ( LPAREN ) ; { boolean synPredMatched315 = false ; if ( ( ( _tokenSet_77 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_78 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m315 = mark ( ) ; synPredMatched315 = true ; inputState . guessing ++ ; try { { switch ( LA ( <NUM_LIT:1> ) ) { case SEMI : { match ( SEMI ) ; break ; } case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case AT : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : case LITERAL_this : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case PLUS : case MINUS : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { { strictContextExpression ( true ) ; match ( SEMI ) ; } break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } } catch ( RecognitionException pe ) { synPredMatched315 = false ; } rewind ( _m315 ) ; inputState . guessing -- ; } if ( synPredMatched315 ) { closureList ( ) ; cl_AST = ( AST ) returnAST ; } else if ( ( _tokenSet_16 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_79 . member ( LA ( <NUM_LIT:2> ) ) ) ) { forInClause ( ) ; fic_AST = ( AST ) returnAST ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } match ( RPAREN ) ; nls ( ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case SEMI : { s = LT ( <NUM_LIT:1> ) ; s_AST = astFactory . create ( s ) ; match ( SEMI ) ; break ; } case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_import : case LITERAL_static : case LITERAL_def : case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : case LITERAL_this : case LITERAL_if : case LITERAL_while : case LITERAL_switch : case LITERAL_for : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case PLUS : case MINUS : case LITERAL_try : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { compatibleBodyStatement ( ) ; forCbs_AST = ( AST ) returnAST ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { forStatement_AST = ( AST ) currentAST . root ; if ( cl_AST != null ) { if ( s_AST != null ) forStatement_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( LITERAL_for , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( cl_AST ) . add ( s_AST ) ) ; else forStatement_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( LITERAL_for , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( cl_AST ) . add ( forCbs_AST ) ) ; } else { if ( s_AST != null ) forStatement_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( LITERAL_for , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( fic_AST ) . add ( s_AST ) ) ; else forStatement_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( LITERAL_for , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( fic_AST ) . add ( forCbs_AST ) ) ; } currentAST . root = forStatement_AST ; currentAST . child = forStatement_AST != null && forStatement_AST . getFirstChild ( ) != null ? forStatement_AST . getFirstChild ( ) : forStatement_AST ; currentAST . advanceChildToEnd ( ) ; } forStatement_AST = ( AST ) currentAST . root ; returnAST = forStatement_AST ; } public final boolean strictContextExpression ( boolean allowDeclaration ) throws RecognitionException , TokenStreamException { boolean hasDeclaration = false ; returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST strictContextExpression_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; { boolean synPredMatched522 = false ; if ( ( ( _tokenSet_16 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_80 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m522 = mark ( ) ; synPredMatched522 = true ; inputState . guessing ++ ; try { { if ( ! ( allowDeclaration ) ) throw new SemanticException ( "<STR_LIT>" ) ; declarationStart ( ) ; } } catch ( RecognitionException pe ) { synPredMatched522 = false ; } rewind ( _m522 ) ; inputState . guessing -- ; } if ( synPredMatched522 ) { if ( inputState . guessing == <NUM_LIT:0> ) { hasDeclaration = true ; } singleDeclaration ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else if ( ( _tokenSet_20 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_38 . member ( LA ( <NUM_LIT:2> ) ) ) ) { expression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else if ( ( ( LA ( <NUM_LIT:1> ) >= LITERAL_return && LA ( <NUM_LIT:1> ) <= LITERAL_assert ) ) ) { branchStatement ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else if ( ( LA ( <NUM_LIT:1> ) == AT ) && ( LA ( <NUM_LIT:2> ) == IDENT ) ) { annotation ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } if ( inputState . guessing == <NUM_LIT:0> ) { strictContextExpression_AST = ( AST ) currentAST . root ; strictContextExpression_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( EXPR , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( strictContextExpression_AST ) ) ; currentAST . root = strictContextExpression_AST ; currentAST . child = strictContextExpression_AST != null && strictContextExpression_AST . getFirstChild ( ) != null ? strictContextExpression_AST . getFirstChild ( ) : strictContextExpression_AST ; currentAST . advanceChildToEnd ( ) ; } strictContextExpression_AST = ( AST ) currentAST . root ; returnAST = strictContextExpression_AST ; return hasDeclaration ; } public final void casesGroup ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST casesGroup_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; { int _cnt352 = <NUM_LIT:0> ; _loop352 : do { if ( ( LA ( <NUM_LIT:1> ) == LITERAL_default || LA ( <NUM_LIT:1> ) == LITERAL_case ) ) { aCase ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { if ( _cnt352 >= <NUM_LIT:1> ) { break _loop352 ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } _cnt352 ++ ; } while ( true ) ; } caseSList ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; if ( inputState . guessing == <NUM_LIT:0> ) { casesGroup_AST = ( AST ) currentAST . root ; casesGroup_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( CASE_GROUP , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( casesGroup_AST ) ) ; currentAST . root = casesGroup_AST ; currentAST . child = casesGroup_AST != null && casesGroup_AST . getFirstChild ( ) != null ? casesGroup_AST . getFirstChild ( ) : casesGroup_AST ; currentAST . advanceChildToEnd ( ) ; } casesGroup_AST = ( AST ) currentAST . root ; returnAST = casesGroup_AST ; } public final void tryBlock ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST tryBlock_AST = null ; AST tryCs_AST = null ; AST h_AST = null ; AST fc_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; List catchNodes = new ArrayList ( ) ; AST newHandler_AST = null ; match ( LITERAL_try ) ; nlsWarn ( ) ; compoundStatement ( ) ; tryCs_AST = ( AST ) returnAST ; { _loop369 : do { if ( ( ( LA ( <NUM_LIT:1> ) == LITERAL_catch || LA ( <NUM_LIT:1> ) == NLS ) && ( LA ( <NUM_LIT:2> ) == LPAREN || LA ( <NUM_LIT:2> ) == LITERAL_catch ) ) && ( ! ( LA ( <NUM_LIT:1> ) == NLS && LA ( <NUM_LIT:2> ) == LPAREN ) ) ) { nls ( ) ; handler ( ) ; h_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { newHandler_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( null ) . add ( newHandler_AST ) . add ( h_AST ) ) ; } } else { break _loop369 ; } } while ( true ) ; } { if ( ( LA ( <NUM_LIT:1> ) == LITERAL_finally || LA ( <NUM_LIT:1> ) == NLS ) && ( _tokenSet_81 . member ( LA ( <NUM_LIT:2> ) ) ) ) { nls ( ) ; finallyClause ( ) ; fc_AST = ( AST ) returnAST ; } else if ( ( _tokenSet_11 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_12 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } if ( inputState . guessing == <NUM_LIT:0> ) { tryBlock_AST = ( AST ) currentAST . root ; tryBlock_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:4> ) ) . add ( create ( LITERAL_try , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( tryCs_AST ) . add ( newHandler_AST ) . add ( fc_AST ) ) ; currentAST . root = tryBlock_AST ; currentAST . child = tryBlock_AST != null && tryBlock_AST . getFirstChild ( ) != null ? tryBlock_AST . getFirstChild ( ) : tryBlock_AST ; currentAST . advanceChildToEnd ( ) ; } tryBlock_AST = ( AST ) currentAST . root ; returnAST = tryBlock_AST ; } public final void branchStatement ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST branchStatement_AST = null ; AST returnE_AST = null ; Token breakI = null ; AST breakI_AST = null ; Token contI = null ; AST contI_AST = null ; AST throwE_AST = null ; AST assertAle_AST = null ; AST assertE_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; switch ( LA ( <NUM_LIT:1> ) ) { case LITERAL_return : { match ( LITERAL_return ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LCURLY : case LITERAL_this : case PLUS : case MINUS : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { expression ( <NUM_LIT:0> ) ; returnE_AST = ( AST ) returnAST ; break ; } case EOF : case RBRACK : case COMMA : case RPAREN : case RCURLY : case SEMI : case LITERAL_default : case LITERAL_else : case LITERAL_case : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { branchStatement_AST = ( AST ) currentAST . root ; branchStatement_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create2 ( LITERAL_return , "<STR_LIT>" , first , LT ( <NUM_LIT:0> ) ) ) . add ( returnE_AST ) ) ; currentAST . root = branchStatement_AST ; currentAST . child = branchStatement_AST != null && branchStatement_AST . getFirstChild ( ) != null ? branchStatement_AST . getFirstChild ( ) : branchStatement_AST ; currentAST . advanceChildToEnd ( ) ; } branchStatement_AST = ( AST ) currentAST . root ; break ; } case LITERAL_break : { match ( LITERAL_break ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case IDENT : { breakI = LT ( <NUM_LIT:1> ) ; breakI_AST = astFactory . create ( breakI ) ; match ( IDENT ) ; break ; } case EOF : case RBRACK : case COMMA : case RPAREN : case RCURLY : case SEMI : case LITERAL_default : case LITERAL_else : case LITERAL_case : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { branchStatement_AST = ( AST ) currentAST . root ; branchStatement_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( LITERAL_break , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( breakI_AST ) ) ; currentAST . root = branchStatement_AST ; currentAST . child = branchStatement_AST != null && branchStatement_AST . getFirstChild ( ) != null ? branchStatement_AST . getFirstChild ( ) : branchStatement_AST ; currentAST . advanceChildToEnd ( ) ; } branchStatement_AST = ( AST ) currentAST . root ; break ; } case LITERAL_continue : { match ( LITERAL_continue ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case IDENT : { contI = LT ( <NUM_LIT:1> ) ; contI_AST = astFactory . create ( contI ) ; match ( IDENT ) ; break ; } case EOF : case RBRACK : case COMMA : case RPAREN : case RCURLY : case SEMI : case LITERAL_default : case LITERAL_else : case LITERAL_case : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { branchStatement_AST = ( AST ) currentAST . root ; branchStatement_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( LITERAL_continue , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( contI_AST ) ) ; currentAST . root = branchStatement_AST ; currentAST . child = branchStatement_AST != null && branchStatement_AST . getFirstChild ( ) != null ? branchStatement_AST . getFirstChild ( ) : branchStatement_AST ; currentAST . advanceChildToEnd ( ) ; } branchStatement_AST = ( AST ) currentAST . root ; break ; } case LITERAL_throw : { match ( LITERAL_throw ) ; expression ( <NUM_LIT:0> ) ; throwE_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { branchStatement_AST = ( AST ) currentAST . root ; branchStatement_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( LITERAL_throw , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( throwE_AST ) ) ; currentAST . root = branchStatement_AST ; currentAST . child = branchStatement_AST != null && branchStatement_AST . getFirstChild ( ) != null ? branchStatement_AST . getFirstChild ( ) : branchStatement_AST ; currentAST . advanceChildToEnd ( ) ; } branchStatement_AST = ( AST ) currentAST . root ; break ; } case LITERAL_assert : { match ( LITERAL_assert ) ; assignmentLessExpression ( ) ; assertAle_AST = ( AST ) returnAST ; { if ( ( LA ( <NUM_LIT:1> ) == COMMA || LA ( <NUM_LIT:1> ) == COLON ) && ( _tokenSet_82 . member ( LA ( <NUM_LIT:2> ) ) ) ) { { switch ( LA ( <NUM_LIT:1> ) ) { case COMMA : { match ( COMMA ) ; nls ( ) ; break ; } case COLON : { match ( COLON ) ; nls ( ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } expression ( <NUM_LIT:0> ) ; assertE_AST = ( AST ) returnAST ; } else if ( ( _tokenSet_83 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_12 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } if ( inputState . guessing == <NUM_LIT:0> ) { branchStatement_AST = ( AST ) currentAST . root ; branchStatement_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( LITERAL_assert , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( assertAle_AST ) . add ( assertE_AST ) ) ; currentAST . root = branchStatement_AST ; currentAST . child = branchStatement_AST != null && branchStatement_AST . getFirstChild ( ) != null ? branchStatement_AST . getFirstChild ( ) : branchStatement_AST ; currentAST . advanceChildToEnd ( ) ; } branchStatement_AST = ( AST ) currentAST . root ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = branchStatement_AST ; } public final void closureList ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST closureList_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; boolean sce = false ; { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case AT : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : case LITERAL_this : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case PLUS : case MINUS : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { sce = strictContextExpression ( true ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case SEMI : { if ( inputState . guessing == <NUM_LIT:0> ) { astFactory . addASTChild ( currentAST , astFactory . create ( EMPTY_STAT , "<STR_LIT>" ) ) ; } break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } { int _cnt320 = <NUM_LIT:0> ; _loop320 : do { if ( ( LA ( <NUM_LIT:1> ) == SEMI ) && ( _tokenSet_84 . member ( LA ( <NUM_LIT:2> ) ) ) ) { match ( SEMI ) ; sce = strictContextExpression ( true ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else if ( ( LA ( <NUM_LIT:1> ) == SEMI ) && ( LA ( <NUM_LIT:2> ) == RPAREN || LA ( <NUM_LIT:2> ) == SEMI ) ) { match ( SEMI ) ; if ( inputState . guessing == <NUM_LIT:0> ) { astFactory . addASTChild ( currentAST , astFactory . create ( EMPTY_STAT , "<STR_LIT>" ) ) ; } } else { if ( _cnt320 >= <NUM_LIT:1> ) { break _loop320 ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } _cnt320 ++ ; } while ( true ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { closureList_AST = ( AST ) currentAST . root ; closureList_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( CLOSURE_LIST , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( closureList_AST ) ) ; currentAST . root = closureList_AST ; currentAST . child = closureList_AST != null && closureList_AST . getFirstChild ( ) != null ? closureList_AST . getFirstChild ( ) : closureList_AST ; currentAST . advanceChildToEnd ( ) ; } closureList_AST = ( AST ) currentAST . root ; returnAST = closureList_AST ; } public final void forInClause ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST forInClause_AST = null ; AST decl_AST = null ; Token i = null ; AST i_AST = null ; Token c = null ; AST c_AST = null ; { boolean synPredMatched324 = false ; if ( ( ( _tokenSet_16 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_80 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m324 = mark ( ) ; synPredMatched324 = true ; inputState . guessing ++ ; try { { declarationStart ( ) ; } } catch ( RecognitionException pe ) { synPredMatched324 = false ; } rewind ( _m324 ) ; inputState . guessing -- ; } if ( synPredMatched324 ) { singleDeclarationNoInit ( ) ; decl_AST = ( AST ) returnAST ; astFactory . addASTChild ( currentAST , returnAST ) ; } else if ( ( LA ( <NUM_LIT:1> ) == IDENT ) && ( LA ( <NUM_LIT:2> ) == COLON || LA ( <NUM_LIT:2> ) == LITERAL_in ) ) { AST tmp237_AST = null ; tmp237_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp237_AST ) ; match ( IDENT ) ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } { switch ( LA ( <NUM_LIT:1> ) ) { case LITERAL_in : { i = LT ( <NUM_LIT:1> ) ; i_AST = astFactory . create ( i ) ; astFactory . makeASTRoot ( currentAST , i_AST ) ; match ( LITERAL_in ) ; if ( inputState . guessing == <NUM_LIT:0> ) { i_AST . setType ( FOR_IN_ITERABLE ) ; } shiftExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case COLON : { if ( inputState . guessing == <NUM_LIT:0> ) { addWarning ( "<STR_LIT>" , "<STR_LIT>" ) ; require ( decl_AST != null , "<STR_LIT>" , "<STR_LIT>" ) ; } c = LT ( <NUM_LIT:1> ) ; c_AST = astFactory . create ( c ) ; astFactory . makeASTRoot ( currentAST , c_AST ) ; match ( COLON ) ; if ( inputState . guessing == <NUM_LIT:0> ) { c_AST . setType ( FOR_IN_ITERABLE ) ; } expression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } forInClause_AST = ( AST ) currentAST . root ; returnAST = forInClause_AST ; } public final void shiftExpression ( int lc_stmt ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST shiftExpression_AST = null ; additiveExpression ( lc_stmt ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop473 : do { if ( ( _tokenSet_85 . member ( LA ( <NUM_LIT:1> ) ) ) ) { { switch ( LA ( <NUM_LIT:1> ) ) { case SR : case BSR : case SL : { { switch ( LA ( <NUM_LIT:1> ) ) { case SL : { AST tmp238_AST = null ; tmp238_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp238_AST ) ; match ( SL ) ; break ; } case SR : { AST tmp239_AST = null ; tmp239_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp239_AST ) ; match ( SR ) ; break ; } case BSR : { AST tmp240_AST = null ; tmp240_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp240_AST ) ; match ( BSR ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } break ; } case RANGE_INCLUSIVE : { AST tmp241_AST = null ; tmp241_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp241_AST ) ; match ( RANGE_INCLUSIVE ) ; break ; } case RANGE_EXCLUSIVE : { AST tmp242_AST = null ; tmp242_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp242_AST ) ; match ( RANGE_EXCLUSIVE ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } nls ( ) ; additiveExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop473 ; } } while ( true ) ; } shiftExpression_AST = ( AST ) currentAST . root ; returnAST = shiftExpression_AST ; } public final void expression ( int lc_stmt ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST expression_AST = null ; Token lp = null ; AST lp_AST = null ; AST m_AST = null ; boolean synPredMatched395 = false ; if ( ( ( LA ( <NUM_LIT:1> ) == LPAREN ) && ( _tokenSet_25 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m395 = mark ( ) ; synPredMatched395 = true ; inputState . guessing ++ ; try { { match ( LPAREN ) ; typeSpec ( true ) ; match ( RPAREN ) ; expression ( lc_stmt ) ; } } catch ( RecognitionException pe ) { synPredMatched395 = false ; } rewind ( _m395 ) ; inputState . guessing -- ; } if ( synPredMatched395 ) { lp = LT ( <NUM_LIT:1> ) ; lp_AST = astFactory . create ( lp ) ; astFactory . makeASTRoot ( currentAST , lp_AST ) ; match ( LPAREN ) ; if ( inputState . guessing == <NUM_LIT:0> ) { lp_AST . setType ( TYPECAST ) ; } typeSpec ( true ) ; astFactory . addASTChild ( currentAST , returnAST ) ; match ( RPAREN ) ; expression ( lc_stmt ) ; astFactory . addASTChild ( currentAST , returnAST ) ; expression_AST = ( AST ) currentAST . root ; } else { boolean synPredMatched399 = false ; if ( ( ( LA ( <NUM_LIT:1> ) == LPAREN ) && ( LA ( <NUM_LIT:2> ) == IDENT || LA ( <NUM_LIT:2> ) == NLS ) ) ) { int _m399 = mark ( ) ; synPredMatched399 = true ; inputState . guessing ++ ; try { { match ( LPAREN ) ; nls ( ) ; match ( IDENT ) ; { _loop398 : do { if ( ( LA ( <NUM_LIT:1> ) == COMMA ) ) { match ( COMMA ) ; nls ( ) ; match ( IDENT ) ; } else { break _loop398 ; } } while ( true ) ; } match ( RPAREN ) ; match ( ASSIGN ) ; } } catch ( RecognitionException pe ) { synPredMatched399 = false ; } rewind ( _m399 ) ; inputState . guessing -- ; } if ( synPredMatched399 ) { multipleAssignment ( lc_stmt ) ; m_AST = ( AST ) returnAST ; astFactory . addASTChild ( currentAST , returnAST ) ; if ( inputState . guessing == <NUM_LIT:0> ) { expression_AST = ( AST ) currentAST . root ; expression_AST = m_AST ; currentAST . root = expression_AST ; currentAST . child = expression_AST != null && expression_AST . getFirstChild ( ) != null ? expression_AST . getFirstChild ( ) : expression_AST ; currentAST . advanceChildToEnd ( ) ; } expression_AST = ( AST ) currentAST . root ; } else if ( ( _tokenSet_20 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_38 . member ( LA ( <NUM_LIT:2> ) ) ) ) { assignmentExpression ( lc_stmt ) ; astFactory . addASTChild ( currentAST , returnAST ) ; expression_AST = ( AST ) currentAST . root ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = expression_AST ; } public final void suspiciousExpressionStatementStart ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST suspiciousExpressionStatementStart_AST = null ; { switch ( LA ( <NUM_LIT:1> ) ) { case PLUS : case MINUS : { { switch ( LA ( <NUM_LIT:1> ) ) { case PLUS : { AST tmp244_AST = null ; tmp244_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp244_AST ) ; match ( PLUS ) ; break ; } case MINUS : { AST tmp245_AST = null ; tmp245_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp245_AST ) ; match ( MINUS ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } break ; } case LBRACK : case LPAREN : case LCURLY : { { switch ( LA ( <NUM_LIT:1> ) ) { case LBRACK : { AST tmp246_AST = null ; tmp246_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp246_AST ) ; match ( LBRACK ) ; break ; } case LPAREN : { AST tmp247_AST = null ; tmp247_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp247_AST ) ; match ( LPAREN ) ; break ; } case LCURLY : { AST tmp248_AST = null ; tmp248_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp248_AST ) ; match ( LCURLY ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } suspiciousExpressionStatementStart_AST = ( AST ) currentAST . root ; returnAST = suspiciousExpressionStatementStart_AST ; } public final void checkSuspiciousExpressionStatement ( int prevToken ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST checkSuspiciousExpressionStatement_AST = null ; boolean synPredMatched344 = false ; if ( ( ( _tokenSet_20 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_2 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m344 = mark ( ) ; synPredMatched344 = true ; inputState . guessing ++ ; try { { if ( ( _tokenSet_86 . member ( LA ( <NUM_LIT:1> ) ) ) ) { matchNot ( LCURLY ) ; } else if ( ( LA ( <NUM_LIT:1> ) == LCURLY ) ) { match ( LCURLY ) ; closableBlockParamsStart ( ) ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } catch ( RecognitionException pe ) { synPredMatched344 = false ; } rewind ( _m344 ) ; inputState . guessing -- ; } if ( synPredMatched344 ) { { if ( ( ( _tokenSet_20 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_2 . member ( LA ( <NUM_LIT:2> ) ) ) ) && ( prevToken == NLS ) ) { if ( inputState . guessing == <NUM_LIT:0> ) { addWarning ( "<STR_LIT>" , "<STR_LIT>" ) ; } } else if ( ( _tokenSet_20 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_2 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } checkSuspiciousExpressionStatement_AST = ( AST ) currentAST . root ; } else if ( ( ( _tokenSet_20 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_2 . member ( LA ( <NUM_LIT:2> ) ) ) ) && ( prevToken == NLS ) ) { if ( inputState . guessing == <NUM_LIT:0> ) { require ( false , "<STR_LIT>" + "<STR_LIT>" , "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" ) ; } checkSuspiciousExpressionStatement_AST = ( AST ) currentAST . root ; } else if ( ( ( _tokenSet_20 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_2 . member ( LA ( <NUM_LIT:2> ) ) ) ) && ( prevToken != NLS ) ) { if ( inputState . guessing == <NUM_LIT:0> ) { require ( false , "<STR_LIT>" + "<STR_LIT>" , "<STR_LIT>" + "<STR_LIT>" ) ; } checkSuspiciousExpressionStatement_AST = ( AST ) currentAST . root ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } returnAST = checkSuspiciousExpressionStatement_AST ; } public final void commandArgumentsGreedy ( AST head ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST commandArgumentsGreedy_AST = null ; AST first_AST = null ; AST pre_AST = null ; AST pc_AST = null ; AST ca_AST = null ; AST prev = head ; { boolean synPredMatched379 = false ; if ( ( ( _tokenSet_87 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_38 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m379 = mark ( ) ; synPredMatched379 = true ; inputState . guessing ++ ; try { { if ( ! ( prev == null || prev . getType ( ) != METHOD_CALL ) ) throw new SemanticException ( "<STR_LIT>" ) ; commandArgument ( ) ; } } catch ( RecognitionException pe ) { synPredMatched379 = false ; } rewind ( _m379 ) ; inputState . guessing -- ; } if ( synPredMatched379 ) { { commandArguments ( head ) ; first_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { prev = first_AST ; } } } else if ( ( _tokenSet_70 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_71 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } { { _loop388 : do { if ( ( _tokenSet_88 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_89 . member ( LA ( <NUM_LIT:2> ) ) ) ) { primaryExpression ( ) ; pre_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { prev = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( DOT , "<STR_LIT:.>" , prev ) ) . add ( prev ) . add ( pre_AST ) ) ; } { boolean synPredMatched385 = false ; if ( ( ( _tokenSet_90 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_91 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m385 = mark ( ) ; synPredMatched385 = true ; inputState . guessing ++ ; try { { pathElementStart ( ) ; } } catch ( RecognitionException pe ) { synPredMatched385 = false ; } rewind ( _m385 ) ; inputState . guessing -- ; } if ( synPredMatched385 ) { { pathChain ( LC_STMT , prev ) ; pc_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { prev = pc_AST ; } } } else if ( ( _tokenSet_87 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_38 . member ( LA ( <NUM_LIT:2> ) ) ) ) { { commandArguments ( prev ) ; ca_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { prev = ca_AST ; } } } else if ( ( _tokenSet_70 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_71 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } else { break _loop388 ; } } while ( true ) ; } } if ( inputState . guessing == <NUM_LIT:0> ) { commandArgumentsGreedy_AST = ( AST ) currentAST . root ; commandArgumentsGreedy_AST = prev ; currentAST . root = commandArgumentsGreedy_AST ; currentAST . child = commandArgumentsGreedy_AST != null && commandArgumentsGreedy_AST . getFirstChild ( ) != null ? commandArgumentsGreedy_AST . getFirstChild ( ) : commandArgumentsGreedy_AST ; currentAST . advanceChildToEnd ( ) ; } commandArgumentsGreedy_AST = ( AST ) currentAST . root ; returnAST = commandArgumentsGreedy_AST ; } public final void aCase ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST aCase_AST = null ; { switch ( LA ( <NUM_LIT:1> ) ) { case LITERAL_case : { AST tmp249_AST = null ; tmp249_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp249_AST ) ; match ( LITERAL_case ) ; expression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case LITERAL_default : { AST tmp250_AST = null ; tmp250_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp250_AST ) ; match ( LITERAL_default ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } match ( COLON ) ; nls ( ) ; aCase_AST = ( AST ) currentAST . root ; returnAST = aCase_AST ; } public final void caseSList ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST caseSList_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; statement ( COLON ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop358 : do { if ( ( LA ( <NUM_LIT:1> ) == SEMI || LA ( <NUM_LIT:1> ) == NLS ) ) { sep ( ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_import : case LITERAL_static : case LITERAL_def : case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : case LITERAL_this : case LITERAL_if : case LITERAL_while : case LITERAL_switch : case LITERAL_for : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case PLUS : case MINUS : case LITERAL_try : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { statement ( sepToken ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case RCURLY : case SEMI : case LITERAL_default : case LITERAL_case : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } } else { break _loop358 ; } } while ( true ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { caseSList_AST = ( AST ) currentAST . root ; caseSList_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( SLIST , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( caseSList_AST ) ) ; currentAST . root = caseSList_AST ; currentAST . child = caseSList_AST != null && caseSList_AST . getFirstChild ( ) != null ? caseSList_AST . getFirstChild ( ) : caseSList_AST ; currentAST . advanceChildToEnd ( ) ; } caseSList_AST = ( AST ) currentAST . root ; returnAST = caseSList_AST ; } public final void forInit ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST forInit_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; boolean synPredMatched361 = false ; if ( ( ( _tokenSet_16 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_17 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m361 = mark ( ) ; synPredMatched361 = true ; inputState . guessing ++ ; try { { declarationStart ( ) ; } } catch ( RecognitionException pe ) { synPredMatched361 = false ; } rewind ( _m361 ) ; inputState . guessing -- ; } if ( synPredMatched361 ) { declaration ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; forInit_AST = ( AST ) currentAST . root ; } else if ( ( _tokenSet_92 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_93 . member ( LA ( <NUM_LIT:2> ) ) ) ) { { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case AT : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : case LITERAL_this : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case PLUS : case MINUS : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { controlExpressionList ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case EOF : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { forInit_AST = ( AST ) currentAST . root ; forInit_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( FOR_INIT , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( forInit_AST ) ) ; currentAST . root = forInit_AST ; currentAST . child = forInit_AST != null && forInit_AST . getFirstChild ( ) != null ? forInit_AST . getFirstChild ( ) : forInit_AST ; currentAST . advanceChildToEnd ( ) ; } forInit_AST = ( AST ) currentAST . root ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } returnAST = forInit_AST ; } public final void controlExpressionList ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST controlExpressionList_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; boolean sce = false ; sce = strictContextExpression ( false ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop403 : do { if ( ( LA ( <NUM_LIT:1> ) == COMMA ) ) { match ( COMMA ) ; nls ( ) ; sce = strictContextExpression ( false ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop403 ; } } while ( true ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { controlExpressionList_AST = ( AST ) currentAST . root ; controlExpressionList_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( ELIST , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( controlExpressionList_AST ) ) ; currentAST . root = controlExpressionList_AST ; currentAST . child = controlExpressionList_AST != null && controlExpressionList_AST . getFirstChild ( ) != null ? controlExpressionList_AST . getFirstChild ( ) : controlExpressionList_AST ; currentAST . advanceChildToEnd ( ) ; } controlExpressionList_AST = ( AST ) currentAST . root ; returnAST = controlExpressionList_AST ; } public final void forCond ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST forCond_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; boolean sce = false ; { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case AT : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : case LITERAL_this : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case PLUS : case MINUS : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { sce = strictContextExpression ( false ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case EOF : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { forCond_AST = ( AST ) currentAST . root ; forCond_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( FOR_CONDITION , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( forCond_AST ) ) ; currentAST . root = forCond_AST ; currentAST . child = forCond_AST != null && forCond_AST . getFirstChild ( ) != null ? forCond_AST . getFirstChild ( ) : forCond_AST ; currentAST . advanceChildToEnd ( ) ; } forCond_AST = ( AST ) currentAST . root ; returnAST = forCond_AST ; } public final void forIter ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST forIter_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case AT : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : case LITERAL_this : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case PLUS : case MINUS : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { controlExpressionList ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case EOF : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { forIter_AST = ( AST ) currentAST . root ; forIter_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( FOR_ITERATOR , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( forIter_AST ) ) ; currentAST . root = forIter_AST ; currentAST . child = forIter_AST != null && forIter_AST . getFirstChild ( ) != null ? forIter_AST . getFirstChild ( ) : forIter_AST ; currentAST . advanceChildToEnd ( ) ; } forIter_AST = ( AST ) currentAST . root ; returnAST = forIter_AST ; } public final void handler ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST handler_AST = null ; AST pd_AST = null ; AST handlerCs_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; match ( LITERAL_catch ) ; match ( LPAREN ) ; multicatch ( ) ; pd_AST = ( AST ) returnAST ; match ( RPAREN ) ; nlsWarn ( ) ; compoundStatement ( ) ; handlerCs_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { handler_AST = ( AST ) currentAST . root ; handler_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( LITERAL_catch , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( pd_AST ) . add ( handlerCs_AST ) ) ; currentAST . root = handler_AST ; currentAST . child = handler_AST != null && handler_AST . getFirstChild ( ) != null ? handler_AST . getFirstChild ( ) : handler_AST ; currentAST . advanceChildToEnd ( ) ; } handler_AST = ( AST ) currentAST . root ; returnAST = handler_AST ; } public final void finallyClause ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST finallyClause_AST = null ; AST finallyCs_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; match ( LITERAL_finally ) ; nlsWarn ( ) ; compoundStatement ( ) ; finallyCs_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { finallyClause_AST = ( AST ) currentAST . root ; finallyClause_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( LITERAL_finally , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( finallyCs_AST ) ) ; currentAST . root = finallyClause_AST ; currentAST . child = finallyClause_AST != null && finallyClause_AST . getFirstChild ( ) != null ? finallyClause_AST . getFirstChild ( ) : finallyClause_AST ; currentAST . advanceChildToEnd ( ) ; } finallyClause_AST = ( AST ) currentAST . root ; returnAST = finallyClause_AST ; } public final void commandArguments ( AST head ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST commandArguments_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; try { commandArgument ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop375 : do { if ( ( LA ( <NUM_LIT:1> ) == COMMA ) && ( _tokenSet_94 . member ( LA ( <NUM_LIT:2> ) ) ) ) { match ( COMMA ) ; nls ( ) ; commandArgument ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop375 ; } } while ( true ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { commandArguments_AST = ( AST ) currentAST . root ; AST elist = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( ELIST , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( commandArguments_AST ) ) ; AST headid = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( METHOD_CALL , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( head ) . add ( elist ) ) ; commandArguments_AST = headid ; currentAST . root = commandArguments_AST ; currentAST . child = commandArguments_AST != null && commandArguments_AST . getFirstChild ( ) != null ? commandArguments_AST . getFirstChild ( ) : commandArguments_AST ; currentAST . advanceChildToEnd ( ) ; } commandArguments_AST = ( AST ) currentAST . root ; } catch ( RecognitionException e ) { if ( inputState . guessing == <NUM_LIT:0> ) { reportError ( e ) ; } else { throw e ; } } returnAST = commandArguments_AST ; } public final void commandArgument ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST commandArgument_AST = null ; Token c = null ; AST c_AST = null ; boolean synPredMatched391 = false ; if ( ( ( _tokenSet_95 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_96 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m391 = mark ( ) ; synPredMatched391 = true ; inputState . guessing ++ ; try { { argumentLabel ( ) ; match ( COLON ) ; nls ( ) ; } } catch ( RecognitionException pe ) { synPredMatched391 = false ; } rewind ( _m391 ) ; inputState . guessing -- ; } if ( synPredMatched391 ) { { argumentLabel ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; c = LT ( <NUM_LIT:1> ) ; c_AST = astFactory . create ( c ) ; astFactory . makeASTRoot ( currentAST , c_AST ) ; match ( COLON ) ; nls ( ) ; expression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; if ( inputState . guessing == <NUM_LIT:0> ) { c_AST . setType ( LABELED_ARG ) ; } } commandArgument_AST = ( AST ) currentAST . root ; } else if ( ( _tokenSet_20 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_38 . member ( LA ( <NUM_LIT:2> ) ) ) ) { expression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; commandArgument_AST = ( AST ) currentAST . root ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } returnAST = commandArgument_AST ; } public final void primaryExpression ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST primaryExpression_AST = null ; AST pe_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; switch ( LA ( <NUM_LIT:1> ) ) { case IDENT : { AST tmp258_AST = null ; tmp258_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp258_AST ) ; match ( IDENT ) ; primaryExpression_AST = ( AST ) currentAST . root ; break ; } case STRING_LITERAL : case LITERAL_false : case LITERAL_null : case LITERAL_true : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { constant ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; primaryExpression_AST = ( AST ) currentAST . root ; break ; } case LITERAL_new : { newExpression ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; primaryExpression_AST = ( AST ) currentAST . root ; break ; } case LITERAL_this : { AST tmp259_AST = null ; tmp259_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp259_AST ) ; match ( LITERAL_this ) ; primaryExpression_AST = ( AST ) currentAST . root ; break ; } case LITERAL_super : { AST tmp260_AST = null ; tmp260_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp260_AST ) ; match ( LITERAL_super ) ; primaryExpression_AST = ( AST ) currentAST . root ; break ; } case LPAREN : { parenthesizedExpression ( ) ; pe_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { primaryExpression_AST = ( AST ) currentAST . root ; primaryExpression_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( EXPR , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( pe_AST ) ) ; currentAST . root = primaryExpression_AST ; currentAST . child = primaryExpression_AST != null && primaryExpression_AST . getFirstChild ( ) != null ? primaryExpression_AST . getFirstChild ( ) : primaryExpression_AST ; currentAST . advanceChildToEnd ( ) ; } primaryExpression_AST = ( AST ) currentAST . root ; break ; } case LCURLY : { closableBlockConstructorExpression ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; primaryExpression_AST = ( AST ) currentAST . root ; break ; } case LBRACK : { listOrMapConstructorExpression ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; primaryExpression_AST = ( AST ) currentAST . root ; break ; } case STRING_CTOR_START : { stringConstructorExpression ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; primaryExpression_AST = ( AST ) currentAST . root ; break ; } case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : { builtInType ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; primaryExpression_AST = ( AST ) currentAST . root ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = primaryExpression_AST ; } public final void pathElementStart ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST pathElementStart_AST = null ; switch ( LA ( <NUM_LIT:1> ) ) { case DOT : case NLS : { { nls ( ) ; AST tmp261_AST = null ; tmp261_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( DOT ) ; } break ; } case SPREAD_DOT : { AST tmp262_AST = null ; tmp262_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( SPREAD_DOT ) ; break ; } case OPTIONAL_DOT : { AST tmp263_AST = null ; tmp263_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( OPTIONAL_DOT ) ; break ; } case MEMBER_POINTER : { AST tmp264_AST = null ; tmp264_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( MEMBER_POINTER ) ; break ; } case LBRACK : { AST tmp265_AST = null ; tmp265_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( LBRACK ) ; break ; } case LPAREN : { AST tmp266_AST = null ; tmp266_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( LPAREN ) ; break ; } case LCURLY : { AST tmp267_AST = null ; tmp267_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( LCURLY ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = pathElementStart_AST ; } public final void pathChain ( int lc_stmt , AST prefix ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST pathChain_AST = null ; AST pe_AST = null ; AST apb_AST = null ; { int _cnt410 = <NUM_LIT:0> ; _loop410 : do { boolean synPredMatched407 = false ; if ( ( ( _tokenSet_90 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_91 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m407 = mark ( ) ; synPredMatched407 = true ; inputState . guessing ++ ; try { { pathElementStart ( ) ; } } catch ( RecognitionException pe ) { synPredMatched407 = false ; } rewind ( _m407 ) ; inputState . guessing -- ; } if ( synPredMatched407 ) { nls ( ) ; pathElement ( prefix ) ; pe_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { prefix = pe_AST ; } } else { boolean synPredMatched409 = false ; if ( ( ( ( LA ( <NUM_LIT:1> ) == LCURLY || LA ( <NUM_LIT:1> ) == NLS ) && ( _tokenSet_18 . member ( LA ( <NUM_LIT:2> ) ) ) ) && ( lc_stmt == LC_STMT || lc_stmt == LC_INIT ) ) ) { int _m409 = mark ( ) ; synPredMatched409 = true ; inputState . guessing ++ ; try { { nls ( ) ; match ( LCURLY ) ; } } catch ( RecognitionException pe ) { synPredMatched409 = false ; } rewind ( _m409 ) ; inputState . guessing -- ; } if ( synPredMatched409 ) { nlsWarn ( ) ; appendedBlock ( prefix ) ; apb_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { prefix = apb_AST ; } } else { if ( _cnt410 >= <NUM_LIT:1> ) { break _loop410 ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } _cnt410 ++ ; } while ( true ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { pathChain_AST = ( AST ) currentAST . root ; pathChain_AST = prefix ; currentAST . root = pathChain_AST ; currentAST . child = pathChain_AST != null && pathChain_AST . getFirstChild ( ) != null ? pathChain_AST . getFirstChild ( ) : pathChain_AST ; currentAST . advanceChildToEnd ( ) ; } pathChain_AST = ( AST ) currentAST . root ; returnAST = pathChain_AST ; } public final void argumentLabel ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST argumentLabel_AST = null ; Token id = null ; AST id_AST = null ; AST kw_AST = null ; boolean synPredMatched558 = false ; if ( ( ( LA ( <NUM_LIT:1> ) == IDENT ) && ( LA ( <NUM_LIT:2> ) == COLON ) ) ) { int _m558 = mark ( ) ; synPredMatched558 = true ; inputState . guessing ++ ; try { { match ( IDENT ) ; } } catch ( RecognitionException pe ) { synPredMatched558 = false ; } rewind ( _m558 ) ; inputState . guessing -- ; } if ( synPredMatched558 ) { id = LT ( <NUM_LIT:1> ) ; id_AST = astFactory . create ( id ) ; astFactory . addASTChild ( currentAST , id_AST ) ; match ( IDENT ) ; if ( inputState . guessing == <NUM_LIT:0> ) { id_AST . setType ( STRING_LITERAL ) ; } argumentLabel_AST = ( AST ) currentAST . root ; } else { boolean synPredMatched560 = false ; if ( ( ( _tokenSet_97 . member ( LA ( <NUM_LIT:1> ) ) ) && ( LA ( <NUM_LIT:2> ) == COLON ) ) ) { int _m560 = mark ( ) ; synPredMatched560 = true ; inputState . guessing ++ ; try { { keywordPropertyNames ( ) ; } } catch ( RecognitionException pe ) { synPredMatched560 = false ; } rewind ( _m560 ) ; inputState . guessing -- ; } if ( synPredMatched560 ) { keywordPropertyNames ( ) ; kw_AST = ( AST ) returnAST ; astFactory . addASTChild ( currentAST , returnAST ) ; if ( inputState . guessing == <NUM_LIT:0> ) { kw_AST . setType ( STRING_LITERAL ) ; } argumentLabel_AST = ( AST ) currentAST . root ; } else if ( ( _tokenSet_88 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_96 . member ( LA ( <NUM_LIT:2> ) ) ) ) { primaryExpression ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; argumentLabel_AST = ( AST ) currentAST . root ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = argumentLabel_AST ; } public final void multipleAssignment ( int lc_stmt ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST multipleAssignment_AST = null ; Token first = cloneToken ( LT ( <NUM_LIT:1> ) ) ; AST tmp268_AST = null ; tmp268_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp268_AST ) ; match ( LPAREN ) ; nls ( ) ; listOfVariables ( null , null , first ) ; astFactory . addASTChild ( currentAST , returnAST ) ; match ( RPAREN ) ; AST tmp270_AST = null ; tmp270_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp270_AST ) ; match ( ASSIGN ) ; nls ( ) ; assignmentExpression ( lc_stmt ) ; astFactory . addASTChild ( currentAST , returnAST ) ; multipleAssignment_AST = ( AST ) currentAST . root ; returnAST = multipleAssignment_AST ; } public final void pathElement ( AST prefix ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST pathElement_AST = null ; AST ta_AST = null ; AST np_AST = null ; AST mca_AST = null ; AST apb_AST = null ; AST ipa_AST = null ; Token operator = LT ( <NUM_LIT:1> ) ; try { switch ( LA ( <NUM_LIT:1> ) ) { case DOT : case SPREAD_DOT : case OPTIONAL_DOT : case MEMBER_POINTER : case NLS : { if ( inputState . guessing == <NUM_LIT:0> ) { pathElement_AST = ( AST ) currentAST . root ; pathElement_AST = prefix ; currentAST . root = pathElement_AST ; currentAST . child = pathElement_AST != null && pathElement_AST . getFirstChild ( ) != null ? pathElement_AST . getFirstChild ( ) : pathElement_AST ; currentAST . advanceChildToEnd ( ) ; } { switch ( LA ( <NUM_LIT:1> ) ) { case SPREAD_DOT : { match ( SPREAD_DOT ) ; break ; } case OPTIONAL_DOT : { match ( OPTIONAL_DOT ) ; break ; } case MEMBER_POINTER : { match ( MEMBER_POINTER ) ; break ; } case DOT : case NLS : { { nls ( ) ; match ( DOT ) ; } break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } nls ( ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case LT : { typeArguments ( ) ; ta_AST = ( AST ) returnAST ; break ; } case FINAL : case ABSTRACT : case UNUSED_GOTO : case UNUSED_CONST : case UNUSED_DO : case STRICTFP : case LITERAL_package : case LITERAL_import : case LITERAL_static : case LITERAL_def : case IDENT : case STRING_LITERAL : case LPAREN : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case AT : case LITERAL_extends : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_as : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : case LITERAL_default : case LITERAL_throws : case LITERAL_implements : case LITERAL_this : case LITERAL_if : case LITERAL_else : case LITERAL_while : case LITERAL_switch : case LITERAL_for : case LITERAL_in : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case LITERAL_case : case LITERAL_try : case LITERAL_finally : case LITERAL_catch : case LITERAL_false : case LITERAL_instanceof : case LITERAL_new : case LITERAL_null : case LITERAL_true : case STRING_CTOR_START : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } namePart ( ) ; np_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { pathElement_AST = ( AST ) currentAST . root ; pathElement_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:4> ) ) . add ( create ( operator . getType ( ) , operator . getText ( ) , prefix , LT ( <NUM_LIT:1> ) ) ) . add ( prefix ) . add ( ta_AST ) . add ( np_AST ) ) ; currentAST . root = pathElement_AST ; currentAST . child = pathElement_AST != null && pathElement_AST . getFirstChild ( ) != null ? pathElement_AST . getFirstChild ( ) : pathElement_AST ; currentAST . advanceChildToEnd ( ) ; } pathElement_AST = ( AST ) currentAST . root ; break ; } case LPAREN : { methodCallArgs ( prefix ) ; mca_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { pathElement_AST = ( AST ) currentAST . root ; pathElement_AST = mca_AST ; currentAST . root = pathElement_AST ; currentAST . child = pathElement_AST != null && pathElement_AST . getFirstChild ( ) != null ? pathElement_AST . getFirstChild ( ) : pathElement_AST ; currentAST . advanceChildToEnd ( ) ; } pathElement_AST = ( AST ) currentAST . root ; break ; } case LCURLY : { appendedBlock ( prefix ) ; apb_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { pathElement_AST = ( AST ) currentAST . root ; pathElement_AST = apb_AST ; currentAST . root = pathElement_AST ; currentAST . child = pathElement_AST != null && pathElement_AST . getFirstChild ( ) != null ? pathElement_AST . getFirstChild ( ) : pathElement_AST ; currentAST . advanceChildToEnd ( ) ; } pathElement_AST = ( AST ) currentAST . root ; break ; } case LBRACK : { indexPropertyArgs ( prefix ) ; ipa_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { pathElement_AST = ( AST ) currentAST . root ; pathElement_AST = ipa_AST ; currentAST . root = pathElement_AST ; currentAST . child = pathElement_AST != null && pathElement_AST . getFirstChild ( ) != null ? pathElement_AST . getFirstChild ( ) : pathElement_AST ; currentAST . advanceChildToEnd ( ) ; } pathElement_AST = ( AST ) currentAST . root ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } catch ( RecognitionException e ) { if ( inputState . guessing == <NUM_LIT:0> ) { if ( pathElement_AST == null ) { throw e ; } reportError ( e ) ; } else { throw e ; } } returnAST = pathElement_AST ; } public final void appendedBlock ( AST callee ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST appendedBlock_AST = null ; AST cb_AST = null ; closableBlock ( ) ; cb_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { appendedBlock_AST = ( AST ) currentAST . root ; if ( callee != null && callee . getType ( ) == METHOD_CALL ) { appendedBlock_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( METHOD_CALL , "<STR_LIT:(>" , callee , LT ( <NUM_LIT:1> ) ) ) . add ( callee . getFirstChild ( ) ) . add ( cb_AST ) ) ; } else { appendedBlock_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( METHOD_CALL , "<STR_LIT:{>" , callee , LT ( <NUM_LIT:1> ) ) ) . add ( callee ) . add ( cb_AST ) ) ; } currentAST . root = appendedBlock_AST ; currentAST . child = appendedBlock_AST != null && appendedBlock_AST . getFirstChild ( ) != null ? appendedBlock_AST . getFirstChild ( ) : appendedBlock_AST ; currentAST . advanceChildToEnd ( ) ; } appendedBlock_AST = ( AST ) currentAST . root ; returnAST = appendedBlock_AST ; } public final void pathExpression ( int lc_stmt ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST pathExpression_AST = null ; AST pre_AST = null ; AST pe_AST = null ; AST apb_AST = null ; AST prefix = null ; primaryExpression ( ) ; pre_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { prefix = pre_AST ; } { _loop418 : do { boolean synPredMatched414 = false ; if ( ( ( _tokenSet_90 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_91 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m414 = mark ( ) ; synPredMatched414 = true ; inputState . guessing ++ ; try { { pathElementStart ( ) ; } } catch ( RecognitionException pe ) { synPredMatched414 = false ; } rewind ( _m414 ) ; inputState . guessing -- ; } if ( synPredMatched414 ) { nls ( ) ; pathElement ( prefix ) ; pe_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { prefix = pe_AST ; } } else { boolean synPredMatched416 = false ; if ( ( ( ( LA ( <NUM_LIT:1> ) == LCURLY || LA ( <NUM_LIT:1> ) == NLS ) && ( _tokenSet_18 . member ( LA ( <NUM_LIT:2> ) ) ) ) && ( lc_stmt == LC_STMT || lc_stmt == LC_INIT ) ) ) { int _m416 = mark ( ) ; synPredMatched416 = true ; inputState . guessing ++ ; try { { nls ( ) ; match ( LCURLY ) ; } } catch ( RecognitionException pe ) { synPredMatched416 = false ; } rewind ( _m416 ) ; inputState . guessing -- ; } if ( synPredMatched416 ) { nlsWarn ( ) ; appendedBlock ( prefix ) ; apb_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { prefix = apb_AST ; } } else if ( ( _tokenSet_98 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_99 . member ( LA ( <NUM_LIT:2> ) ) ) ) { { switch ( LA ( <NUM_LIT:1> ) ) { case DOT : { match ( DOT ) ; break ; } case SPREAD_DOT : { match ( SPREAD_DOT ) ; break ; } case OPTIONAL_DOT : { AST tmp277_AST = null ; tmp277_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp277_AST ) ; match ( OPTIONAL_DOT ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { reportError ( "<STR_LIT>" ) ; } } else { break _loop418 ; } } } while ( true ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { pathExpression_AST = ( AST ) currentAST . root ; pathExpression_AST = prefix ; lastPathExpression = pathExpression_AST ; currentAST . root = pathExpression_AST ; currentAST . child = pathExpression_AST != null && pathExpression_AST . getFirstChild ( ) != null ? pathExpression_AST . getFirstChild ( ) : pathExpression_AST ; currentAST . advanceChildToEnd ( ) ; } pathExpression_AST = ( AST ) currentAST . root ; returnAST = pathExpression_AST ; } public final void namePart ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST namePart_AST = null ; Token ats = null ; AST ats_AST = null ; Token sl = null ; AST sl_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case AT : { ats = LT ( <NUM_LIT:1> ) ; ats_AST = astFactory . create ( ats ) ; astFactory . makeASTRoot ( currentAST , ats_AST ) ; match ( AT ) ; if ( inputState . guessing == <NUM_LIT:0> ) { ats_AST . setType ( SELECT_SLOT ) ; } break ; } case FINAL : case ABSTRACT : case UNUSED_GOTO : case UNUSED_CONST : case UNUSED_DO : case STRICTFP : case LITERAL_package : case LITERAL_import : case LITERAL_static : case LITERAL_def : case IDENT : case STRING_LITERAL : case LPAREN : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case LITERAL_extends : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_as : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : case LITERAL_default : case LITERAL_throws : case LITERAL_implements : case LITERAL_this : case LITERAL_if : case LITERAL_else : case LITERAL_while : case LITERAL_switch : case LITERAL_for : case LITERAL_in : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case LITERAL_case : case LITERAL_try : case LITERAL_finally : case LITERAL_catch : case LITERAL_false : case LITERAL_instanceof : case LITERAL_new : case LITERAL_null : case LITERAL_true : case STRING_CTOR_START : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } { switch ( LA ( <NUM_LIT:1> ) ) { case IDENT : { AST tmp278_AST = null ; tmp278_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp278_AST ) ; match ( IDENT ) ; break ; } case STRING_LITERAL : { sl = LT ( <NUM_LIT:1> ) ; sl_AST = astFactory . create ( sl ) ; astFactory . addASTChild ( currentAST , sl_AST ) ; match ( STRING_LITERAL ) ; if ( inputState . guessing == <NUM_LIT:0> ) { sl_AST . setType ( IDENT ) ; } break ; } case LPAREN : case STRING_CTOR_START : { dynamicMemberName ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case LCURLY : { openBlock ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case FINAL : case ABSTRACT : case UNUSED_GOTO : case UNUSED_CONST : case UNUSED_DO : case STRICTFP : case LITERAL_package : case LITERAL_import : case LITERAL_static : case LITERAL_def : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case LITERAL_extends : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_as : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LITERAL_default : case LITERAL_throws : case LITERAL_implements : case LITERAL_this : case LITERAL_if : case LITERAL_else : case LITERAL_while : case LITERAL_switch : case LITERAL_for : case LITERAL_in : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case LITERAL_case : case LITERAL_try : case LITERAL_finally : case LITERAL_catch : case LITERAL_false : case LITERAL_instanceof : case LITERAL_new : case LITERAL_null : case LITERAL_true : { keywordPropertyNames ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } namePart_AST = ( AST ) currentAST . root ; returnAST = namePart_AST ; } public final void methodCallArgs ( AST callee ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST methodCallArgs_AST = null ; AST al_AST = null ; try { match ( LPAREN ) ; argList ( ) ; al_AST = ( AST ) returnAST ; match ( RPAREN ) ; if ( inputState . guessing == <NUM_LIT:0> ) { methodCallArgs_AST = ( AST ) currentAST . root ; if ( callee != null && callee . getFirstChild ( ) != null ) { methodCallArgs_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( METHOD_CALL , "<STR_LIT:(>" , callee . getFirstChild ( ) , LT ( <NUM_LIT:1> ) ) ) . add ( callee ) . add ( al_AST ) ) ; } else { methodCallArgs_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( METHOD_CALL , "<STR_LIT:(>" , callee , LT ( <NUM_LIT:1> ) ) ) . add ( callee ) . add ( al_AST ) ) ; } currentAST . root = methodCallArgs_AST ; currentAST . child = methodCallArgs_AST != null && methodCallArgs_AST . getFirstChild ( ) != null ? methodCallArgs_AST . getFirstChild ( ) : methodCallArgs_AST ; currentAST . advanceChildToEnd ( ) ; } methodCallArgs_AST = ( AST ) currentAST . root ; } catch ( RecognitionException e ) { if ( inputState . guessing == <NUM_LIT:0> ) { if ( al_AST != null ) { reportError ( e ) ; if ( callee != null && callee . getFirstChild ( ) != null ) { methodCallArgs_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( METHOD_CALL , "<STR_LIT:(>" , callee . getFirstChild ( ) , LT ( <NUM_LIT:1> ) ) ) . add ( callee ) . add ( al_AST ) ) ; } else { methodCallArgs_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( METHOD_CALL , "<STR_LIT:(>" , callee , LT ( <NUM_LIT:1> ) ) ) . add ( callee ) . add ( al_AST ) ) ; } } else { throw e ; } } else { throw e ; } } returnAST = methodCallArgs_AST ; } public final void indexPropertyArgs ( AST indexee ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST indexPropertyArgs_AST = null ; Token lb = null ; AST lb_AST = null ; AST al_AST = null ; lb = LT ( <NUM_LIT:1> ) ; lb_AST = astFactory . create ( lb ) ; astFactory . addASTChild ( currentAST , lb_AST ) ; match ( LBRACK ) ; argList ( ) ; al_AST = ( AST ) returnAST ; match ( RBRACK ) ; if ( inputState . guessing == <NUM_LIT:0> ) { indexPropertyArgs_AST = ( AST ) currentAST . root ; if ( indexee != null && indexee . getFirstChild ( ) != null ) { indexPropertyArgs_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:4> ) ) . add ( create ( INDEX_OP , "<STR_LIT>" , indexee . getFirstChild ( ) , LT ( <NUM_LIT:1> ) ) ) . add ( lb_AST ) . add ( indexee ) . add ( al_AST ) ) ; } else { indexPropertyArgs_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:4> ) ) . add ( create ( INDEX_OP , "<STR_LIT>" , indexee , LT ( <NUM_LIT:1> ) ) ) . add ( lb_AST ) . add ( indexee ) . add ( al_AST ) ) ; } currentAST . root = indexPropertyArgs_AST ; currentAST . child = indexPropertyArgs_AST != null && indexPropertyArgs_AST . getFirstChild ( ) != null ? indexPropertyArgs_AST . getFirstChild ( ) : indexPropertyArgs_AST ; currentAST . advanceChildToEnd ( ) ; } indexPropertyArgs_AST = ( AST ) currentAST . root ; returnAST = indexPropertyArgs_AST ; } public final void dynamicMemberName ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST dynamicMemberName_AST = null ; AST pe_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case LPAREN : { parenthesizedExpression ( ) ; pe_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { dynamicMemberName_AST = ( AST ) currentAST . root ; dynamicMemberName_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( EXPR , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( pe_AST ) ) ; currentAST . root = dynamicMemberName_AST ; currentAST . child = dynamicMemberName_AST != null && dynamicMemberName_AST . getFirstChild ( ) != null ? dynamicMemberName_AST . getFirstChild ( ) : dynamicMemberName_AST ; currentAST . advanceChildToEnd ( ) ; } break ; } case STRING_CTOR_START : { stringConstructorExpression ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } if ( inputState . guessing == <NUM_LIT:0> ) { dynamicMemberName_AST = ( AST ) currentAST . root ; dynamicMemberName_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( DYNAMIC_MEMBER , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( dynamicMemberName_AST ) ) ; currentAST . root = dynamicMemberName_AST ; currentAST . child = dynamicMemberName_AST != null && dynamicMemberName_AST . getFirstChild ( ) != null ? dynamicMemberName_AST . getFirstChild ( ) : dynamicMemberName_AST ; currentAST . advanceChildToEnd ( ) ; } dynamicMemberName_AST = ( AST ) currentAST . root ; returnAST = dynamicMemberName_AST ; } public final void parenthesizedExpression ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST parenthesizedExpression_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; Token declaration = null ; boolean hasClosureList = false ; boolean firstContainsDeclaration = false ; boolean sce = false ; try { match ( LPAREN ) ; if ( inputState . guessing == <NUM_LIT:0> ) { declaration = LT ( <NUM_LIT:1> ) ; } firstContainsDeclaration = strictContextExpression ( true ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop518 : do { if ( ( LA ( <NUM_LIT:1> ) == SEMI ) ) { match ( SEMI ) ; if ( inputState . guessing == <NUM_LIT:0> ) { hasClosureList = true ; } { switch ( LA ( <NUM_LIT:1> ) ) { case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case AT : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : case LITERAL_this : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case PLUS : case MINUS : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { sce = strictContextExpression ( true ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case RPAREN : case SEMI : { if ( inputState . guessing == <NUM_LIT:0> ) { astFactory . addASTChild ( currentAST , astFactory . create ( EMPTY_STAT , "<STR_LIT>" ) ) ; } break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } } else { break _loop518 ; } } while ( true ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { if ( firstContainsDeclaration && ! hasClosureList ) throw new NoViableAltException ( declaration , getFilename ( ) ) ; } match ( RPAREN ) ; if ( inputState . guessing == <NUM_LIT:0> ) { parenthesizedExpression_AST = ( AST ) currentAST . root ; if ( hasClosureList ) { parenthesizedExpression_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( CLOSURE_LIST , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( parenthesizedExpression_AST ) ) ; } currentAST . root = parenthesizedExpression_AST ; currentAST . child = parenthesizedExpression_AST != null && parenthesizedExpression_AST . getFirstChild ( ) != null ? parenthesizedExpression_AST . getFirstChild ( ) : parenthesizedExpression_AST ; currentAST . advanceChildToEnd ( ) ; } parenthesizedExpression_AST = ( AST ) currentAST . root ; } catch ( RecognitionException e ) { if ( inputState . guessing == <NUM_LIT:0> ) { reportError ( e ) ; parenthesizedExpression_AST = ( AST ) currentAST . root ; } else { throw e ; } } returnAST = parenthesizedExpression_AST ; } public final void stringConstructorExpression ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST stringConstructorExpression_AST = null ; Token cs = null ; AST cs_AST = null ; Token cm = null ; AST cm_AST = null ; Token ce = null ; AST ce_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; cs = LT ( <NUM_LIT:1> ) ; cs_AST = astFactory . create ( cs ) ; astFactory . addASTChild ( currentAST , cs_AST ) ; match ( STRING_CTOR_START ) ; if ( inputState . guessing == <NUM_LIT:0> ) { cs_AST . setType ( STRING_LITERAL ) ; } stringConstructorValuePart ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop528 : do { if ( ( LA ( <NUM_LIT:1> ) == STRING_CTOR_MIDDLE ) ) { cm = LT ( <NUM_LIT:1> ) ; cm_AST = astFactory . create ( cm ) ; astFactory . addASTChild ( currentAST , cm_AST ) ; match ( STRING_CTOR_MIDDLE ) ; if ( inputState . guessing == <NUM_LIT:0> ) { cm_AST . setType ( STRING_LITERAL ) ; } stringConstructorValuePart ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop528 ; } } while ( true ) ; } ce = LT ( <NUM_LIT:1> ) ; ce_AST = astFactory . create ( ce ) ; astFactory . addASTChild ( currentAST , ce_AST ) ; match ( STRING_CTOR_END ) ; if ( inputState . guessing == <NUM_LIT:0> ) { stringConstructorExpression_AST = ( AST ) currentAST . root ; ce_AST . setType ( STRING_LITERAL ) ; stringConstructorExpression_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( STRING_CONSTRUCTOR , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( stringConstructorExpression_AST ) ) ; currentAST . root = stringConstructorExpression_AST ; currentAST . child = stringConstructorExpression_AST != null && stringConstructorExpression_AST . getFirstChild ( ) != null ? stringConstructorExpression_AST . getFirstChild ( ) : stringConstructorExpression_AST ; currentAST . advanceChildToEnd ( ) ; } stringConstructorExpression_AST = ( AST ) currentAST . root ; returnAST = stringConstructorExpression_AST ; } public final void logicalOrExpression ( int lc_stmt ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST logicalOrExpression_AST = null ; logicalAndExpression ( lc_stmt ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop444 : do { if ( ( LA ( <NUM_LIT:1> ) == LOR ) ) { AST tmp285_AST = null ; tmp285_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp285_AST ) ; match ( LOR ) ; nls ( ) ; logicalAndExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop444 ; } } while ( true ) ; } logicalOrExpression_AST = ( AST ) currentAST . root ; returnAST = logicalOrExpression_AST ; } public final void logicalAndExpression ( int lc_stmt ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST logicalAndExpression_AST = null ; inclusiveOrExpression ( lc_stmt ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop447 : do { if ( ( LA ( <NUM_LIT:1> ) == LAND ) ) { AST tmp286_AST = null ; tmp286_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp286_AST ) ; match ( LAND ) ; nls ( ) ; inclusiveOrExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop447 ; } } while ( true ) ; } logicalAndExpression_AST = ( AST ) currentAST . root ; returnAST = logicalAndExpression_AST ; } public final void inclusiveOrExpression ( int lc_stmt ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST inclusiveOrExpression_AST = null ; exclusiveOrExpression ( lc_stmt ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop450 : do { if ( ( LA ( <NUM_LIT:1> ) == BOR ) ) { AST tmp287_AST = null ; tmp287_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp287_AST ) ; match ( BOR ) ; nls ( ) ; exclusiveOrExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop450 ; } } while ( true ) ; } inclusiveOrExpression_AST = ( AST ) currentAST . root ; returnAST = inclusiveOrExpression_AST ; } public final void exclusiveOrExpression ( int lc_stmt ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST exclusiveOrExpression_AST = null ; andExpression ( lc_stmt ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop453 : do { if ( ( LA ( <NUM_LIT:1> ) == BXOR ) ) { AST tmp288_AST = null ; tmp288_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp288_AST ) ; match ( BXOR ) ; nls ( ) ; andExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop453 ; } } while ( true ) ; } exclusiveOrExpression_AST = ( AST ) currentAST . root ; returnAST = exclusiveOrExpression_AST ; } public final void andExpression ( int lc_stmt ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST andExpression_AST = null ; regexExpression ( lc_stmt ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop456 : do { if ( ( LA ( <NUM_LIT:1> ) == BAND ) ) { AST tmp289_AST = null ; tmp289_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp289_AST ) ; match ( BAND ) ; nls ( ) ; regexExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop456 ; } } while ( true ) ; } andExpression_AST = ( AST ) currentAST . root ; returnAST = andExpression_AST ; } public final void regexExpression ( int lc_stmt ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST regexExpression_AST = null ; equalityExpression ( lc_stmt ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop460 : do { if ( ( LA ( <NUM_LIT:1> ) == REGEX_FIND || LA ( <NUM_LIT:1> ) == REGEX_MATCH ) ) { { switch ( LA ( <NUM_LIT:1> ) ) { case REGEX_FIND : { AST tmp290_AST = null ; tmp290_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp290_AST ) ; match ( REGEX_FIND ) ; break ; } case REGEX_MATCH : { AST tmp291_AST = null ; tmp291_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp291_AST ) ; match ( REGEX_MATCH ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } nls ( ) ; equalityExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop460 ; } } while ( true ) ; } regexExpression_AST = ( AST ) currentAST . root ; returnAST = regexExpression_AST ; } public final void equalityExpression ( int lc_stmt ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST equalityExpression_AST = null ; relationalExpression ( lc_stmt ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop464 : do { if ( ( ( LA ( <NUM_LIT:1> ) >= NOT_EQUAL && LA ( <NUM_LIT:1> ) <= COMPARE_TO ) ) ) { { switch ( LA ( <NUM_LIT:1> ) ) { case NOT_EQUAL : { AST tmp292_AST = null ; tmp292_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp292_AST ) ; match ( NOT_EQUAL ) ; break ; } case EQUAL : { AST tmp293_AST = null ; tmp293_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp293_AST ) ; match ( EQUAL ) ; break ; } case IDENTICAL : { AST tmp294_AST = null ; tmp294_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp294_AST ) ; match ( IDENTICAL ) ; break ; } case NOT_IDENTICAL : { AST tmp295_AST = null ; tmp295_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp295_AST ) ; match ( NOT_IDENTICAL ) ; break ; } case COMPARE_TO : { AST tmp296_AST = null ; tmp296_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp296_AST ) ; match ( COMPARE_TO ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } nls ( ) ; relationalExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop464 ; } } while ( true ) ; } equalityExpression_AST = ( AST ) currentAST . root ; returnAST = equalityExpression_AST ; } public final void relationalExpression ( int lc_stmt ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST relationalExpression_AST = null ; shiftExpression ( lc_stmt ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { if ( ( _tokenSet_100 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_82 . member ( LA ( <NUM_LIT:2> ) ) ) ) { { { switch ( LA ( <NUM_LIT:1> ) ) { case LT : { AST tmp297_AST = null ; tmp297_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp297_AST ) ; match ( LT ) ; break ; } case GT : { AST tmp298_AST = null ; tmp298_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp298_AST ) ; match ( GT ) ; break ; } case LE : { AST tmp299_AST = null ; tmp299_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp299_AST ) ; match ( LE ) ; break ; } case GE : { AST tmp300_AST = null ; tmp300_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp300_AST ) ; match ( GE ) ; break ; } case LITERAL_in : { AST tmp301_AST = null ; tmp301_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp301_AST ) ; match ( LITERAL_in ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } nls ( ) ; shiftExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } } else if ( ( LA ( <NUM_LIT:1> ) == LITERAL_instanceof ) && ( _tokenSet_101 . member ( LA ( <NUM_LIT:2> ) ) ) ) { AST tmp302_AST = null ; tmp302_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp302_AST ) ; match ( LITERAL_instanceof ) ; nls ( ) ; typeSpec ( true ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else if ( ( LA ( <NUM_LIT:1> ) == LITERAL_as ) && ( _tokenSet_101 . member ( LA ( <NUM_LIT:2> ) ) ) ) { AST tmp303_AST = null ; tmp303_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp303_AST ) ; match ( LITERAL_as ) ; nls ( ) ; typeSpec ( true ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else if ( ( _tokenSet_102 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_71 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } relationalExpression_AST = ( AST ) currentAST . root ; returnAST = relationalExpression_AST ; } public final void additiveExpression ( int lc_stmt ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST additiveExpression_AST = null ; multiplicativeExpression ( lc_stmt ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop477 : do { if ( ( LA ( <NUM_LIT:1> ) == PLUS || LA ( <NUM_LIT:1> ) == MINUS ) && ( _tokenSet_82 . member ( LA ( <NUM_LIT:2> ) ) ) ) { { switch ( LA ( <NUM_LIT:1> ) ) { case PLUS : { AST tmp304_AST = null ; tmp304_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp304_AST ) ; match ( PLUS ) ; break ; } case MINUS : { AST tmp305_AST = null ; tmp305_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp305_AST ) ; match ( MINUS ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } nls ( ) ; multiplicativeExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop477 ; } } while ( true ) ; } additiveExpression_AST = ( AST ) currentAST . root ; returnAST = additiveExpression_AST ; } public final void multiplicativeExpression ( int lc_stmt ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST multiplicativeExpression_AST = null ; switch ( LA ( <NUM_LIT:1> ) ) { case INC : { { AST tmp306_AST = null ; tmp306_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp306_AST ) ; match ( INC ) ; nls ( ) ; powerExpressionNotPlusMinus ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop482 : do { if ( ( _tokenSet_103 . member ( LA ( <NUM_LIT:1> ) ) ) ) { { switch ( LA ( <NUM_LIT:1> ) ) { case STAR : { AST tmp307_AST = null ; tmp307_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp307_AST ) ; match ( STAR ) ; break ; } case DIV : { AST tmp308_AST = null ; tmp308_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp308_AST ) ; match ( DIV ) ; break ; } case MOD : { AST tmp309_AST = null ; tmp309_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp309_AST ) ; match ( MOD ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } nls ( ) ; powerExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop482 ; } } while ( true ) ; } } multiplicativeExpression_AST = ( AST ) currentAST . root ; break ; } case DEC : { { AST tmp310_AST = null ; tmp310_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp310_AST ) ; match ( DEC ) ; nls ( ) ; powerExpressionNotPlusMinus ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop486 : do { if ( ( _tokenSet_103 . member ( LA ( <NUM_LIT:1> ) ) ) ) { { switch ( LA ( <NUM_LIT:1> ) ) { case STAR : { AST tmp311_AST = null ; tmp311_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp311_AST ) ; match ( STAR ) ; break ; } case DIV : { AST tmp312_AST = null ; tmp312_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp312_AST ) ; match ( DIV ) ; break ; } case MOD : { AST tmp313_AST = null ; tmp313_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp313_AST ) ; match ( MOD ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } nls ( ) ; powerExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop486 ; } } while ( true ) ; } } multiplicativeExpression_AST = ( AST ) currentAST . root ; break ; } case MINUS : { { AST tmp314_AST = null ; tmp314_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp314_AST ) ; match ( MINUS ) ; if ( inputState . guessing == <NUM_LIT:0> ) { tmp314_AST . setType ( UNARY_MINUS ) ; } nls ( ) ; powerExpressionNotPlusMinus ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop490 : do { if ( ( _tokenSet_103 . member ( LA ( <NUM_LIT:1> ) ) ) ) { { switch ( LA ( <NUM_LIT:1> ) ) { case STAR : { AST tmp315_AST = null ; tmp315_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp315_AST ) ; match ( STAR ) ; break ; } case DIV : { AST tmp316_AST = null ; tmp316_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp316_AST ) ; match ( DIV ) ; break ; } case MOD : { AST tmp317_AST = null ; tmp317_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp317_AST ) ; match ( MOD ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } nls ( ) ; powerExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop490 ; } } while ( true ) ; } } multiplicativeExpression_AST = ( AST ) currentAST . root ; break ; } case PLUS : { { AST tmp318_AST = null ; tmp318_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp318_AST ) ; match ( PLUS ) ; if ( inputState . guessing == <NUM_LIT:0> ) { tmp318_AST . setType ( UNARY_PLUS ) ; } nls ( ) ; powerExpressionNotPlusMinus ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop494 : do { if ( ( _tokenSet_103 . member ( LA ( <NUM_LIT:1> ) ) ) ) { { switch ( LA ( <NUM_LIT:1> ) ) { case STAR : { AST tmp319_AST = null ; tmp319_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp319_AST ) ; match ( STAR ) ; break ; } case DIV : { AST tmp320_AST = null ; tmp320_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp320_AST ) ; match ( DIV ) ; break ; } case MOD : { AST tmp321_AST = null ; tmp321_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp321_AST ) ; match ( MOD ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } nls ( ) ; powerExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop494 ; } } while ( true ) ; } } multiplicativeExpression_AST = ( AST ) currentAST . root ; break ; } case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LCURLY : case LITERAL_this : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { { powerExpressionNotPlusMinus ( lc_stmt ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop498 : do { if ( ( _tokenSet_103 . member ( LA ( <NUM_LIT:1> ) ) ) ) { { switch ( LA ( <NUM_LIT:1> ) ) { case STAR : { AST tmp322_AST = null ; tmp322_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp322_AST ) ; match ( STAR ) ; break ; } case DIV : { AST tmp323_AST = null ; tmp323_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp323_AST ) ; match ( DIV ) ; break ; } case MOD : { AST tmp324_AST = null ; tmp324_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp324_AST ) ; match ( MOD ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } nls ( ) ; powerExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop498 ; } } while ( true ) ; } } multiplicativeExpression_AST = ( AST ) currentAST . root ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = multiplicativeExpression_AST ; } public final void powerExpressionNotPlusMinus ( int lc_stmt ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST powerExpressionNotPlusMinus_AST = null ; unaryExpressionNotPlusMinus ( lc_stmt ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop504 : do { if ( ( LA ( <NUM_LIT:1> ) == STAR_STAR ) ) { AST tmp325_AST = null ; tmp325_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp325_AST ) ; match ( STAR_STAR ) ; nls ( ) ; unaryExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop504 ; } } while ( true ) ; } powerExpressionNotPlusMinus_AST = ( AST ) currentAST . root ; returnAST = powerExpressionNotPlusMinus_AST ; } public final void powerExpression ( int lc_stmt ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST powerExpression_AST = null ; unaryExpression ( lc_stmt ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { _loop501 : do { if ( ( LA ( <NUM_LIT:1> ) == STAR_STAR ) ) { AST tmp326_AST = null ; tmp326_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp326_AST ) ; match ( STAR_STAR ) ; nls ( ) ; unaryExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { break _loop501 ; } } while ( true ) ; } powerExpression_AST = ( AST ) currentAST . root ; returnAST = powerExpression_AST ; } public final void unaryExpression ( int lc_stmt ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST unaryExpression_AST = null ; switch ( LA ( <NUM_LIT:1> ) ) { case INC : { AST tmp327_AST = null ; tmp327_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp327_AST ) ; match ( INC ) ; nls ( ) ; unaryExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; unaryExpression_AST = ( AST ) currentAST . root ; break ; } case DEC : { AST tmp328_AST = null ; tmp328_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp328_AST ) ; match ( DEC ) ; nls ( ) ; unaryExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; unaryExpression_AST = ( AST ) currentAST . root ; break ; } case MINUS : { AST tmp329_AST = null ; tmp329_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp329_AST ) ; match ( MINUS ) ; if ( inputState . guessing == <NUM_LIT:0> ) { tmp329_AST . setType ( UNARY_MINUS ) ; } nls ( ) ; unaryExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; unaryExpression_AST = ( AST ) currentAST . root ; break ; } case PLUS : { AST tmp330_AST = null ; tmp330_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp330_AST ) ; match ( PLUS ) ; if ( inputState . guessing == <NUM_LIT:0> ) { tmp330_AST . setType ( UNARY_PLUS ) ; } nls ( ) ; unaryExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; unaryExpression_AST = ( AST ) currentAST . root ; break ; } case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LCURLY : case LITERAL_this : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { unaryExpressionNotPlusMinus ( lc_stmt ) ; astFactory . addASTChild ( currentAST , returnAST ) ; unaryExpression_AST = ( AST ) currentAST . root ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = unaryExpression_AST ; } public final void unaryExpressionNotPlusMinus ( int lc_stmt ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST unaryExpressionNotPlusMinus_AST = null ; Token lpb = null ; AST lpb_AST = null ; Token lp = null ; AST lp_AST = null ; switch ( LA ( <NUM_LIT:1> ) ) { case BNOT : { AST tmp331_AST = null ; tmp331_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp331_AST ) ; match ( BNOT ) ; nls ( ) ; unaryExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; unaryExpressionNotPlusMinus_AST = ( AST ) currentAST . root ; break ; } case LNOT : { AST tmp332_AST = null ; tmp332_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . makeASTRoot ( currentAST , tmp332_AST ) ; match ( LNOT ) ; nls ( ) ; unaryExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; unaryExpressionNotPlusMinus_AST = ( AST ) currentAST . root ; break ; } case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LCURLY : case LITERAL_this : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { { boolean synPredMatched509 = false ; if ( ( ( LA ( <NUM_LIT:1> ) == LPAREN ) && ( ( LA ( <NUM_LIT:2> ) >= LITERAL_void && LA ( <NUM_LIT:2> ) <= LITERAL_double ) ) ) ) { int _m509 = mark ( ) ; synPredMatched509 = true ; inputState . guessing ++ ; try { { match ( LPAREN ) ; builtInTypeSpec ( true ) ; match ( RPAREN ) ; unaryExpression ( <NUM_LIT:0> ) ; } } catch ( RecognitionException pe ) { synPredMatched509 = false ; } rewind ( _m509 ) ; inputState . guessing -- ; } if ( synPredMatched509 ) { lpb = LT ( <NUM_LIT:1> ) ; lpb_AST = astFactory . create ( lpb ) ; astFactory . makeASTRoot ( currentAST , lpb_AST ) ; match ( LPAREN ) ; if ( inputState . guessing == <NUM_LIT:0> ) { lpb_AST . setType ( TYPECAST ) ; } builtInTypeSpec ( true ) ; astFactory . addASTChild ( currentAST , returnAST ) ; match ( RPAREN ) ; unaryExpression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { boolean synPredMatched511 = false ; if ( ( ( LA ( <NUM_LIT:1> ) == LPAREN ) && ( LA ( <NUM_LIT:2> ) == IDENT ) ) ) { int _m511 = mark ( ) ; synPredMatched511 = true ; inputState . guessing ++ ; try { { match ( LPAREN ) ; classTypeSpec ( true ) ; match ( RPAREN ) ; unaryExpressionNotPlusMinus ( <NUM_LIT:0> ) ; } } catch ( RecognitionException pe ) { synPredMatched511 = false ; } rewind ( _m511 ) ; inputState . guessing -- ; } if ( synPredMatched511 ) { lp = LT ( <NUM_LIT:1> ) ; lp_AST = astFactory . create ( lp ) ; astFactory . makeASTRoot ( currentAST , lp_AST ) ; match ( LPAREN ) ; if ( inputState . guessing == <NUM_LIT:0> ) { lp_AST . setType ( TYPECAST ) ; } classTypeSpec ( true ) ; astFactory . addASTChild ( currentAST , returnAST ) ; match ( RPAREN ) ; unaryExpressionNotPlusMinus ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else if ( ( _tokenSet_88 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_38 . member ( LA ( <NUM_LIT:2> ) ) ) ) { postfixExpression ( lc_stmt ) ; astFactory . addASTChild ( currentAST , returnAST ) ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } unaryExpressionNotPlusMinus_AST = ( AST ) currentAST . root ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = unaryExpressionNotPlusMinus_AST ; } public final void postfixExpression ( int lc_stmt ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST postfixExpression_AST = null ; Token in = null ; AST in_AST = null ; Token de = null ; AST de_AST = null ; pathExpression ( lc_stmt ) ; astFactory . addASTChild ( currentAST , returnAST ) ; { if ( ( LA ( <NUM_LIT:1> ) == INC ) && ( _tokenSet_104 . member ( LA ( <NUM_LIT:2> ) ) ) ) { in = LT ( <NUM_LIT:1> ) ; in_AST = astFactory . create ( in ) ; astFactory . makeASTRoot ( currentAST , in_AST ) ; match ( INC ) ; if ( inputState . guessing == <NUM_LIT:0> ) { in_AST . setType ( POST_INC ) ; } } else if ( ( LA ( <NUM_LIT:1> ) == DEC ) && ( _tokenSet_104 . member ( LA ( <NUM_LIT:2> ) ) ) ) { de = LT ( <NUM_LIT:1> ) ; de_AST = astFactory . create ( de ) ; astFactory . makeASTRoot ( currentAST , de_AST ) ; match ( DEC ) ; if ( inputState . guessing == <NUM_LIT:0> ) { de_AST . setType ( POST_DEC ) ; } } else if ( ( _tokenSet_104 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_71 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } postfixExpression_AST = ( AST ) currentAST . root ; returnAST = postfixExpression_AST ; } public final void constant ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST constant_AST = null ; switch ( LA ( <NUM_LIT:1> ) ) { case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { constantNumber ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; constant_AST = ( AST ) currentAST . root ; break ; } case STRING_LITERAL : { AST tmp335_AST = null ; tmp335_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp335_AST ) ; match ( STRING_LITERAL ) ; constant_AST = ( AST ) currentAST . root ; break ; } case LITERAL_true : { AST tmp336_AST = null ; tmp336_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp336_AST ) ; match ( LITERAL_true ) ; constant_AST = ( AST ) currentAST . root ; break ; } case LITERAL_false : { AST tmp337_AST = null ; tmp337_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp337_AST ) ; match ( LITERAL_false ) ; constant_AST = ( AST ) currentAST . root ; break ; } case LITERAL_null : { AST tmp338_AST = null ; tmp338_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp338_AST ) ; match ( LITERAL_null ) ; constant_AST = ( AST ) currentAST . root ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = constant_AST ; } public final void newExpression ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST newExpression_AST = null ; AST ta_AST = null ; AST t_AST = null ; AST mca_AST = null ; AST cb_AST = null ; AST ad_AST = null ; Token first = LT ( <NUM_LIT:1> ) ; int jumpBack = mark ( ) ; try { match ( LITERAL_new ) ; nls ( ) ; { switch ( LA ( <NUM_LIT:1> ) ) { case LT : { typeArguments ( ) ; ta_AST = ( AST ) returnAST ; break ; } case LBRACK : case IDENT : case LPAREN : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } { switch ( LA ( <NUM_LIT:1> ) ) { case IDENT : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : { type ( ) ; t_AST = ( AST ) returnAST ; break ; } case LBRACK : case LPAREN : case NLS : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } { switch ( LA ( <NUM_LIT:1> ) ) { case LPAREN : case NLS : { nls ( ) ; methodCallArgs ( null ) ; mca_AST = ( AST ) returnAST ; { if ( ( LA ( <NUM_LIT:1> ) == LCURLY ) && ( _tokenSet_52 . member ( LA ( <NUM_LIT:2> ) ) ) ) { classBlock ( ) ; cb_AST = ( AST ) returnAST ; astFactory . addASTChild ( currentAST , returnAST ) ; } else if ( ( _tokenSet_99 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_71 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } if ( inputState . guessing == <NUM_LIT:0> ) { newExpression_AST = ( AST ) currentAST . root ; mca_AST = mca_AST . getFirstChild ( ) ; newExpression_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:5> ) ) . add ( create ( LITERAL_new , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( ta_AST ) . add ( t_AST ) . add ( mca_AST ) . add ( cb_AST ) ) ; currentAST . root = newExpression_AST ; currentAST . child = newExpression_AST != null && newExpression_AST . getFirstChild ( ) != null ? newExpression_AST . getFirstChild ( ) : newExpression_AST ; currentAST . advanceChildToEnd ( ) ; } break ; } case LBRACK : { newArrayDeclarator ( ) ; ad_AST = ( AST ) returnAST ; if ( inputState . guessing == <NUM_LIT:0> ) { newExpression_AST = ( AST ) currentAST . root ; newExpression_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:4> ) ) . add ( create ( LITERAL_new , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( ta_AST ) . add ( t_AST ) . add ( ad_AST ) ) ; currentAST . root = newExpression_AST ; currentAST . child = newExpression_AST != null && newExpression_AST . getFirstChild ( ) != null ? newExpression_AST . getFirstChild ( ) : newExpression_AST ; currentAST . advanceChildToEnd ( ) ; } break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } newExpression_AST = ( AST ) currentAST . root ; } catch ( RecognitionException e ) { if ( inputState . guessing == <NUM_LIT:0> ) { if ( t_AST == null ) { reportError ( "<STR_LIT>" , first ) ; newExpression_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( LITERAL_new , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( ta_AST ) . add ( null ) ) ; if ( e instanceof MismatchedTokenException || e instanceof NoViableAltException ) { rewind ( jumpBack ) ; consumeUntil ( NLS ) ; } } else if ( mca_AST == null && ad_AST == null ) { reportError ( "<STR_LIT>" , t_AST ) ; newExpression_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:3> ) ) . add ( create ( LITERAL_new , "<STR_LIT>" , first , LT ( <NUM_LIT:1> ) ) ) . add ( ta_AST ) . add ( t_AST ) ) ; if ( e instanceof MismatchedTokenException ) { Token t = ( ( MismatchedTokenException ) e ) . token ; int i = ( ( MismatchedTokenException ) e ) . token . getType ( ) ; rewind ( jumpBack ) ; consume ( ) ; consumeUntil ( NLS ) ; } } else { throw e ; } } else { throw e ; } } returnAST = newExpression_AST ; } public final void closableBlockConstructorExpression ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST closableBlockConstructorExpression_AST = null ; closableBlock ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; closableBlockConstructorExpression_AST = ( AST ) currentAST . root ; returnAST = closableBlockConstructorExpression_AST ; } public final void listOrMapConstructorExpression ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST listOrMapConstructorExpression_AST = null ; Token lcon = null ; AST lcon_AST = null ; AST args_AST = null ; Token emcon = null ; AST emcon_AST = null ; boolean hasLabels = false ; if ( ( LA ( <NUM_LIT:1> ) == LBRACK ) && ( _tokenSet_105 . member ( LA ( <NUM_LIT:2> ) ) ) ) { lcon = LT ( <NUM_LIT:1> ) ; lcon_AST = astFactory . create ( lcon ) ; match ( LBRACK ) ; argList ( ) ; args_AST = ( AST ) returnAST ; astFactory . addASTChild ( currentAST , returnAST ) ; if ( inputState . guessing == <NUM_LIT:0> ) { hasLabels |= argListHasLabels ; } match ( RBRACK ) ; if ( inputState . guessing == <NUM_LIT:0> ) { listOrMapConstructorExpression_AST = ( AST ) currentAST . root ; int type = hasLabels ? MAP_CONSTRUCTOR : LIST_CONSTRUCTOR ; listOrMapConstructorExpression_AST = ( AST ) astFactory . make ( ( new ASTArray ( <NUM_LIT:2> ) ) . add ( create ( type , "<STR_LIT:[>" , lcon_AST , LT ( <NUM_LIT:1> ) ) ) . add ( args_AST ) ) ; currentAST . root = listOrMapConstructorExpression_AST ; currentAST . child = listOrMapConstructorExpression_AST != null && listOrMapConstructorExpression_AST . getFirstChild ( ) != null ? listOrMapConstructorExpression_AST . getFirstChild ( ) : listOrMapConstructorExpression_AST ; currentAST . advanceChildToEnd ( ) ; } listOrMapConstructorExpression_AST = ( AST ) currentAST . root ; } else if ( ( LA ( <NUM_LIT:1> ) == LBRACK ) && ( LA ( <NUM_LIT:2> ) == COLON ) ) { emcon = LT ( <NUM_LIT:1> ) ; emcon_AST = astFactory . create ( emcon ) ; astFactory . makeASTRoot ( currentAST , emcon_AST ) ; match ( LBRACK ) ; match ( COLON ) ; match ( RBRACK ) ; if ( inputState . guessing == <NUM_LIT:0> ) { emcon_AST . setType ( MAP_CONSTRUCTOR ) ; } listOrMapConstructorExpression_AST = ( AST ) currentAST . root ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } returnAST = listOrMapConstructorExpression_AST ; } public final void stringConstructorValuePart ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST stringConstructorValuePart_AST = null ; { switch ( LA ( <NUM_LIT:1> ) ) { case IDENT : { identifier ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case LITERAL_this : { AST tmp343_AST = null ; tmp343_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp343_AST ) ; match ( LITERAL_this ) ; break ; } case LITERAL_super : { AST tmp344_AST = null ; tmp344_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp344_AST ) ; match ( LITERAL_super ) ; break ; } case LCURLY : { openOrClosableBlock ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } stringConstructorValuePart_AST = ( AST ) currentAST . root ; returnAST = stringConstructorValuePart_AST ; } public final void newArrayDeclarator ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST newArrayDeclarator_AST = null ; Token lb = null ; AST lb_AST = null ; { int _cnt568 = <NUM_LIT:0> ; _loop568 : do { if ( ( LA ( <NUM_LIT:1> ) == LBRACK ) && ( _tokenSet_106 . member ( LA ( <NUM_LIT:2> ) ) ) ) { lb = LT ( <NUM_LIT:1> ) ; lb_AST = astFactory . create ( lb ) ; astFactory . makeASTRoot ( currentAST , lb_AST ) ; match ( LBRACK ) ; if ( inputState . guessing == <NUM_LIT:0> ) { lb_AST . setType ( ARRAY_DECLARATOR ) ; } { switch ( LA ( <NUM_LIT:1> ) ) { case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LCURLY : case LITERAL_this : case PLUS : case MINUS : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { expression ( <NUM_LIT:0> ) ; astFactory . addASTChild ( currentAST , returnAST ) ; break ; } case RBRACK : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } match ( RBRACK ) ; } else { if ( _cnt568 >= <NUM_LIT:1> ) { break _loop568 ; } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } _cnt568 ++ ; } while ( true ) ; } newArrayDeclarator_AST = ( AST ) currentAST . root ; returnAST = newArrayDeclarator_AST ; } public final byte argument ( ) throws RecognitionException , TokenStreamException { byte hasLabelOrSpread = <NUM_LIT:0> ; returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST argument_AST = null ; Token c = null ; AST c_AST = null ; Token sp = null ; AST sp_AST = null ; boolean sce = false ; { boolean synPredMatched554 = false ; if ( ( ( _tokenSet_95 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_96 . member ( LA ( <NUM_LIT:2> ) ) ) ) ) { int _m554 = mark ( ) ; synPredMatched554 = true ; inputState . guessing ++ ; try { { argumentLabelStart ( ) ; } } catch ( RecognitionException pe ) { synPredMatched554 = false ; } rewind ( _m554 ) ; inputState . guessing -- ; } if ( synPredMatched554 ) { argumentLabel ( ) ; astFactory . addASTChild ( currentAST , returnAST ) ; c = LT ( <NUM_LIT:1> ) ; c_AST = astFactory . create ( c ) ; astFactory . makeASTRoot ( currentAST , c_AST ) ; match ( COLON ) ; if ( inputState . guessing == <NUM_LIT:0> ) { c_AST . setType ( LABELED_ARG ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { hasLabelOrSpread |= <NUM_LIT:1> ; } } else if ( ( LA ( <NUM_LIT:1> ) == STAR ) ) { sp = LT ( <NUM_LIT:1> ) ; sp_AST = astFactory . create ( sp ) ; astFactory . makeASTRoot ( currentAST , sp_AST ) ; match ( STAR ) ; if ( inputState . guessing == <NUM_LIT:0> ) { sp_AST . setType ( SPREAD_ARG ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { hasLabelOrSpread |= <NUM_LIT:2> ; } { switch ( LA ( <NUM_LIT:1> ) ) { case COLON : { match ( COLON ) ; if ( inputState . guessing == <NUM_LIT:0> ) { sp_AST . setType ( SPREAD_MAP_ARG ) ; } if ( inputState . guessing == <NUM_LIT:0> ) { hasLabelOrSpread |= <NUM_LIT:1> ; } break ; } case FINAL : case ABSTRACT : case STRICTFP : case LITERAL_static : case LITERAL_def : case LBRACK : case IDENT : case STRING_LITERAL : case LPAREN : case AT : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LCURLY : case LITERAL_this : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case PLUS : case MINUS : case LITERAL_false : case LITERAL_new : case LITERAL_null : case LITERAL_true : case INC : case DEC : case BNOT : case LNOT : case STRING_CTOR_START : case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } } else if ( ( _tokenSet_84 . member ( LA ( <NUM_LIT:1> ) ) ) && ( _tokenSet_107 . member ( LA ( <NUM_LIT:2> ) ) ) ) { } else { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } sce = strictContextExpression ( true ) ; astFactory . addASTChild ( currentAST , returnAST ) ; if ( inputState . guessing == <NUM_LIT:0> ) { require ( LA ( <NUM_LIT:1> ) != COLON , "<STR_LIT>" , "<STR_LIT>" ) ; } argument_AST = ( AST ) currentAST . root ; returnAST = argument_AST ; return hasLabelOrSpread ; } public final void argumentLabelStart ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST argumentLabelStart_AST = null ; { switch ( LA ( <NUM_LIT:1> ) ) { case IDENT : { AST tmp347_AST = null ; tmp347_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( IDENT ) ; break ; } case FINAL : case ABSTRACT : case UNUSED_GOTO : case UNUSED_CONST : case UNUSED_DO : case STRICTFP : case LITERAL_package : case LITERAL_import : case LITERAL_static : case LITERAL_def : case LITERAL_class : case LITERAL_interface : case LITERAL_enum : case LITERAL_extends : case LITERAL_super : case LITERAL_void : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_short : case LITERAL_int : case LITERAL_float : case LITERAL_long : case LITERAL_double : case LITERAL_as : case LITERAL_private : case LITERAL_public : case LITERAL_protected : case LITERAL_transient : case LITERAL_native : case LITERAL_threadsafe : case LITERAL_synchronized : case LITERAL_volatile : case LITERAL_default : case LITERAL_throws : case LITERAL_implements : case LITERAL_this : case LITERAL_if : case LITERAL_else : case LITERAL_while : case LITERAL_switch : case LITERAL_for : case LITERAL_in : case LITERAL_return : case LITERAL_break : case LITERAL_continue : case LITERAL_throw : case LITERAL_assert : case LITERAL_case : case LITERAL_try : case LITERAL_finally : case LITERAL_catch : case LITERAL_false : case LITERAL_instanceof : case LITERAL_new : case LITERAL_null : case LITERAL_true : { keywordPropertyNames ( ) ; break ; } case NUM_INT : case NUM_FLOAT : case NUM_LONG : case NUM_DOUBLE : case NUM_BIG_INT : case NUM_BIG_DECIMAL : { constantNumber ( ) ; break ; } case STRING_LITERAL : { AST tmp348_AST = null ; tmp348_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( STRING_LITERAL ) ; break ; } case LBRACK : case LPAREN : case LCURLY : case STRING_CTOR_START : { balancedBrackets ( ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } } AST tmp349_AST = null ; tmp349_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( COLON ) ; returnAST = argumentLabelStart_AST ; } public final void constantNumber ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST constantNumber_AST = null ; switch ( LA ( <NUM_LIT:1> ) ) { case NUM_INT : { AST tmp350_AST = null ; tmp350_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp350_AST ) ; match ( NUM_INT ) ; constantNumber_AST = ( AST ) currentAST . root ; break ; } case NUM_FLOAT : { AST tmp351_AST = null ; tmp351_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp351_AST ) ; match ( NUM_FLOAT ) ; constantNumber_AST = ( AST ) currentAST . root ; break ; } case NUM_LONG : { AST tmp352_AST = null ; tmp352_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp352_AST ) ; match ( NUM_LONG ) ; constantNumber_AST = ( AST ) currentAST . root ; break ; } case NUM_DOUBLE : { AST tmp353_AST = null ; tmp353_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp353_AST ) ; match ( NUM_DOUBLE ) ; constantNumber_AST = ( AST ) currentAST . root ; break ; } case NUM_BIG_INT : { AST tmp354_AST = null ; tmp354_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp354_AST ) ; match ( NUM_BIG_INT ) ; constantNumber_AST = ( AST ) currentAST . root ; break ; } case NUM_BIG_DECIMAL : { AST tmp355_AST = null ; tmp355_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; astFactory . addASTChild ( currentAST , tmp355_AST ) ; match ( NUM_BIG_DECIMAL ) ; constantNumber_AST = ( AST ) currentAST . root ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = constantNumber_AST ; } public final void balancedBrackets ( ) throws RecognitionException , TokenStreamException { returnAST = null ; ASTPair currentAST = new ASTPair ( ) ; AST balancedBrackets_AST = null ; switch ( LA ( <NUM_LIT:1> ) ) { case LPAREN : { AST tmp356_AST = null ; tmp356_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( LPAREN ) ; balancedTokens ( ) ; AST tmp357_AST = null ; tmp357_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( RPAREN ) ; break ; } case LBRACK : { AST tmp358_AST = null ; tmp358_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( LBRACK ) ; balancedTokens ( ) ; AST tmp359_AST = null ; tmp359_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( RBRACK ) ; break ; } case LCURLY : { AST tmp360_AST = null ; tmp360_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( LCURLY ) ; balancedTokens ( ) ; AST tmp361_AST = null ; tmp361_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( RCURLY ) ; break ; } case STRING_CTOR_START : { AST tmp362_AST = null ; tmp362_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( STRING_CTOR_START ) ; balancedTokens ( ) ; AST tmp363_AST = null ; tmp363_AST = astFactory . create ( LT ( <NUM_LIT:1> ) ) ; match ( STRING_CTOR_END ) ; break ; } default : { throw new NoViableAltException ( LT ( <NUM_LIT:1> ) , getFilename ( ) ) ; } } returnAST = balancedBrackets_AST ; } public static final String [ ] _tokenNames = { "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" } ; protected void buildTokenTypeASTClassMap ( ) { tokenTypeToASTClassMap = null ; } ; private static final long [ ] mk_tokenSet_0 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_0 = new BitSet ( mk_tokenSet_0 ( ) ) ; private static final long [ ] mk_tokenSet_1 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_1 = new BitSet ( mk_tokenSet_1 ( ) ) ; private static final long [ ] mk_tokenSet_2 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT:1L> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_2 = new BitSet ( mk_tokenSet_2 ( ) ) ; private static final long [ ] mk_tokenSet_3 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_3 = new BitSet ( mk_tokenSet_3 ( ) ) ; private static final long [ ] mk_tokenSet_4 ( ) { long [ ] data = new long [ <NUM_LIT:16> ] ; data [ <NUM_LIT:0> ] = - <NUM_LIT> ; for ( int i = <NUM_LIT:1> ; i <= <NUM_LIT:2> ; i ++ ) { data [ i ] = - <NUM_LIT:1L> ; } data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_4 = new BitSet ( mk_tokenSet_4 ( ) ) ; private static final long [ ] mk_tokenSet_5 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_5 = new BitSet ( mk_tokenSet_5 ( ) ) ; private static final long [ ] mk_tokenSet_6 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_6 = new BitSet ( mk_tokenSet_6 ( ) ) ; private static final long [ ] mk_tokenSet_7 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_7 = new BitSet ( mk_tokenSet_7 ( ) ) ; private static final long [ ] mk_tokenSet_8 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_8 = new BitSet ( mk_tokenSet_8 ( ) ) ; private static final long [ ] mk_tokenSet_9 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:2> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_9 = new BitSet ( mk_tokenSet_9 ( ) ) ; private static final long [ ] mk_tokenSet_10 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_10 = new BitSet ( mk_tokenSet_10 ( ) ) ; private static final long [ ] mk_tokenSet_11 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_11 = new BitSet ( mk_tokenSet_11 ( ) ) ; private static final long [ ] mk_tokenSet_12 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_12 = new BitSet ( mk_tokenSet_12 ( ) ) ; private static final long [ ] mk_tokenSet_13 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_13 = new BitSet ( mk_tokenSet_13 ( ) ) ; private static final long [ ] mk_tokenSet_14 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_14 = new BitSet ( mk_tokenSet_14 ( ) ) ; private static final long [ ] mk_tokenSet_15 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_15 = new BitSet ( mk_tokenSet_15 ( ) ) ; private static final long [ ] mk_tokenSet_16 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_16 = new BitSet ( mk_tokenSet_16 ( ) ) ; private static final long [ ] mk_tokenSet_17 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_17 = new BitSet ( mk_tokenSet_17 ( ) ) ; private static final long [ ] mk_tokenSet_18 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_18 = new BitSet ( mk_tokenSet_18 ( ) ) ; private static final long [ ] mk_tokenSet_19 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_19 = new BitSet ( mk_tokenSet_19 ( ) ) ; private static final long [ ] mk_tokenSet_20 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_20 = new BitSet ( mk_tokenSet_20 ( ) ) ; private static final long [ ] mk_tokenSet_21 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_21 = new BitSet ( mk_tokenSet_21 ( ) ) ; private static final long [ ] mk_tokenSet_22 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_22 = new BitSet ( mk_tokenSet_22 ( ) ) ; private static final long [ ] mk_tokenSet_23 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_23 = new BitSet ( mk_tokenSet_23 ( ) ) ; private static final long [ ] mk_tokenSet_24 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_24 = new BitSet ( mk_tokenSet_24 ( ) ) ; private static final long [ ] mk_tokenSet_25 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_25 = new BitSet ( mk_tokenSet_25 ( ) ) ; private static final long [ ] mk_tokenSet_26 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_26 = new BitSet ( mk_tokenSet_26 ( ) ) ; private static final long [ ] mk_tokenSet_27 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_27 = new BitSet ( mk_tokenSet_27 ( ) ) ; private static final long [ ] mk_tokenSet_28 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_28 = new BitSet ( mk_tokenSet_28 ( ) ) ; private static final long [ ] mk_tokenSet_29 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:2> ] = <NUM_LIT:1L> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_29 = new BitSet ( mk_tokenSet_29 ( ) ) ; private static final long [ ] mk_tokenSet_30 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_30 = new BitSet ( mk_tokenSet_30 ( ) ) ; private static final long [ ] mk_tokenSet_31 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_31 = new BitSet ( mk_tokenSet_31 ( ) ) ; private static final long [ ] mk_tokenSet_32 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_32 = new BitSet ( mk_tokenSet_32 ( ) ) ; private static final long [ ] mk_tokenSet_33 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_33 = new BitSet ( mk_tokenSet_33 ( ) ) ; private static final long [ ] mk_tokenSet_34 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_34 = new BitSet ( mk_tokenSet_34 ( ) ) ; private static final long [ ] mk_tokenSet_35 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_35 = new BitSet ( mk_tokenSet_35 ( ) ) ; private static final long [ ] mk_tokenSet_36 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_36 = new BitSet ( mk_tokenSet_36 ( ) ) ; private static final long [ ] mk_tokenSet_37 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:2> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_37 = new BitSet ( mk_tokenSet_37 ( ) ) ; private static final long [ ] mk_tokenSet_38 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT:1L> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_38 = new BitSet ( mk_tokenSet_38 ( ) ) ; private static final long [ ] mk_tokenSet_39 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_39 = new BitSet ( mk_tokenSet_39 ( ) ) ; private static final long [ ] mk_tokenSet_40 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_40 = new BitSet ( mk_tokenSet_40 ( ) ) ; private static final long [ ] mk_tokenSet_41 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_41 = new BitSet ( mk_tokenSet_41 ( ) ) ; private static final long [ ] mk_tokenSet_42 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_42 = new BitSet ( mk_tokenSet_42 ( ) ) ; private static final long [ ] mk_tokenSet_43 ( ) { long [ ] data = new long [ <NUM_LIT:16> ] ; data [ <NUM_LIT:0> ] = - <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT:1L> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_43 = new BitSet ( mk_tokenSet_43 ( ) ) ; private static final long [ ] mk_tokenSet_44 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_44 = new BitSet ( mk_tokenSet_44 ( ) ) ; private static final long [ ] mk_tokenSet_45 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_45 = new BitSet ( mk_tokenSet_45 ( ) ) ; private static final long [ ] mk_tokenSet_46 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_46 = new BitSet ( mk_tokenSet_46 ( ) ) ; private static final long [ ] mk_tokenSet_47 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_47 = new BitSet ( mk_tokenSet_47 ( ) ) ; private static final long [ ] mk_tokenSet_48 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_48 = new BitSet ( mk_tokenSet_48 ( ) ) ; private static final long [ ] mk_tokenSet_49 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_49 = new BitSet ( mk_tokenSet_49 ( ) ) ; private static final long [ ] mk_tokenSet_50 ( ) { long [ ] data = { <NUM_LIT> , - <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_50 = new BitSet ( mk_tokenSet_50 ( ) ) ; private static final long [ ] mk_tokenSet_51 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_51 = new BitSet ( mk_tokenSet_51 ( ) ) ; private static final long [ ] mk_tokenSet_52 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_52 = new BitSet ( mk_tokenSet_52 ( ) ) ; private static final long [ ] mk_tokenSet_53 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_53 = new BitSet ( mk_tokenSet_53 ( ) ) ; private static final long [ ] mk_tokenSet_54 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_54 = new BitSet ( mk_tokenSet_54 ( ) ) ; private static final long [ ] mk_tokenSet_55 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_55 = new BitSet ( mk_tokenSet_55 ( ) ) ; private static final long [ ] mk_tokenSet_56 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_56 = new BitSet ( mk_tokenSet_56 ( ) ) ; private static final long [ ] mk_tokenSet_57 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_57 = new BitSet ( mk_tokenSet_57 ( ) ) ; private static final long [ ] mk_tokenSet_58 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_58 = new BitSet ( mk_tokenSet_58 ( ) ) ; private static final long [ ] mk_tokenSet_59 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_59 = new BitSet ( mk_tokenSet_59 ( ) ) ; private static final long [ ] mk_tokenSet_60 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_60 = new BitSet ( mk_tokenSet_60 ( ) ) ; private static final long [ ] mk_tokenSet_61 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_61 = new BitSet ( mk_tokenSet_61 ( ) ) ; private static final long [ ] mk_tokenSet_62 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_62 = new BitSet ( mk_tokenSet_62 ( ) ) ; private static final long [ ] mk_tokenSet_63 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_63 = new BitSet ( mk_tokenSet_63 ( ) ) ; private static final long [ ] mk_tokenSet_64 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_64 = new BitSet ( mk_tokenSet_64 ( ) ) ; private static final long [ ] mk_tokenSet_65 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_65 = new BitSet ( mk_tokenSet_65 ( ) ) ; private static final long [ ] mk_tokenSet_66 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_66 = new BitSet ( mk_tokenSet_66 ( ) ) ; private static final long [ ] mk_tokenSet_67 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_67 = new BitSet ( mk_tokenSet_67 ( ) ) ; private static final long [ ] mk_tokenSet_68 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT:1L> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_68 = new BitSet ( mk_tokenSet_68 ( ) ) ; private static final long [ ] mk_tokenSet_69 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_69 = new BitSet ( mk_tokenSet_69 ( ) ) ; private static final long [ ] mk_tokenSet_70 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_70 = new BitSet ( mk_tokenSet_70 ( ) ) ; private static final long [ ] mk_tokenSet_71 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT:1L> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_71 = new BitSet ( mk_tokenSet_71 ( ) ) ; private static final long [ ] mk_tokenSet_72 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_72 = new BitSet ( mk_tokenSet_72 ( ) ) ; private static final long [ ] mk_tokenSet_73 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:2> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_73 = new BitSet ( mk_tokenSet_73 ( ) ) ; private static final long [ ] mk_tokenSet_74 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_74 = new BitSet ( mk_tokenSet_74 ( ) ) ; private static final long [ ] mk_tokenSet_75 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:2> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_75 = new BitSet ( mk_tokenSet_75 ( ) ) ; private static final long [ ] mk_tokenSet_76 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_76 = new BitSet ( mk_tokenSet_76 ( ) ) ; private static final long [ ] mk_tokenSet_77 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_77 = new BitSet ( mk_tokenSet_77 ( ) ) ; private static final long [ ] mk_tokenSet_78 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT:1L> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_78 = new BitSet ( mk_tokenSet_78 ( ) ) ; private static final long [ ] mk_tokenSet_79 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:2> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_79 = new BitSet ( mk_tokenSet_79 ( ) ) ; private static final long [ ] mk_tokenSet_80 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_80 = new BitSet ( mk_tokenSet_80 ( ) ) ; private static final long [ ] mk_tokenSet_81 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:2> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_81 = new BitSet ( mk_tokenSet_81 ( ) ) ; private static final long [ ] mk_tokenSet_82 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_82 = new BitSet ( mk_tokenSet_82 ( ) ) ; private static final long [ ] mk_tokenSet_83 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_83 = new BitSet ( mk_tokenSet_83 ( ) ) ; private static final long [ ] mk_tokenSet_84 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_84 = new BitSet ( mk_tokenSet_84 ( ) ) ; private static final long [ ] mk_tokenSet_85 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_85 = new BitSet ( mk_tokenSet_85 ( ) ) ; private static final long [ ] mk_tokenSet_86 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = - <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT:1L> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_86 = new BitSet ( mk_tokenSet_86 ( ) ) ; private static final long [ ] mk_tokenSet_87 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_87 = new BitSet ( mk_tokenSet_87 ( ) ) ; private static final long [ ] mk_tokenSet_88 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:2> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_88 = new BitSet ( mk_tokenSet_88 ( ) ) ; private static final long [ ] mk_tokenSet_89 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_89 = new BitSet ( mk_tokenSet_89 ( ) ) ; private static final long [ ] mk_tokenSet_90 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:2> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_90 = new BitSet ( mk_tokenSet_90 ( ) ) ; private static final long [ ] mk_tokenSet_91 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_91 = new BitSet ( mk_tokenSet_91 ( ) ) ; private static final long [ ] mk_tokenSet_92 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_92 = new BitSet ( mk_tokenSet_92 ( ) ) ; private static final long [ ] mk_tokenSet_93 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT:1L> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_93 = new BitSet ( mk_tokenSet_93 ( ) ) ; private static final long [ ] mk_tokenSet_94 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_94 = new BitSet ( mk_tokenSet_94 ( ) ) ; private static final long [ ] mk_tokenSet_95 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_95 = new BitSet ( mk_tokenSet_95 ( ) ) ; private static final long [ ] mk_tokenSet_96 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_96 = new BitSet ( mk_tokenSet_96 ( ) ) ; private static final long [ ] mk_tokenSet_97 ( ) { long [ ] data = { <NUM_LIT> , - <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_97 = new BitSet ( mk_tokenSet_97 ( ) ) ; private static final long [ ] mk_tokenSet_98 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_98 = new BitSet ( mk_tokenSet_98 ( ) ) ; private static final long [ ] mk_tokenSet_99 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_99 = new BitSet ( mk_tokenSet_99 ( ) ) ; private static final long [ ] mk_tokenSet_100 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_100 = new BitSet ( mk_tokenSet_100 ( ) ) ; private static final long [ ] mk_tokenSet_101 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_101 = new BitSet ( mk_tokenSet_101 ( ) ) ; private static final long [ ] mk_tokenSet_102 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_102 = new BitSet ( mk_tokenSet_102 ( ) ) ; private static final long [ ] mk_tokenSet_103 ( ) { long [ ] data = { <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ; return data ; } public static final BitSet _tokenSet_103 = new BitSet ( mk_tokenSet_103 ( ) ) ; private static final long [ ] mk_tokenSet_104 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_104 = new BitSet ( mk_tokenSet_104 ( ) ) ; private static final long [ ] mk_tokenSet_105 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_105 = new BitSet ( mk_tokenSet_105 ( ) ) ; private static final long [ ] mk_tokenSet_106 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:1> ] = <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_106 = new BitSet ( mk_tokenSet_106 ( ) ) ; private static final long [ ] mk_tokenSet_107 ( ) { long [ ] data = new long [ <NUM_LIT:8> ] ; data [ <NUM_LIT:0> ] = <NUM_LIT> ; data [ <NUM_LIT:1> ] = - <NUM_LIT> ; data [ <NUM_LIT:2> ] = - <NUM_LIT:1L> ; data [ <NUM_LIT:3> ] = <NUM_LIT> ; return data ; } public static final BitSet _tokenSet_107 = new BitSet ( mk_tokenSet_107 ( ) ) ; } </s>
|
<s> package org . codehaus . groovy . antlr ; import java . io . Reader ; import java . util . Collections ; import java . util . List ; import java . util . Map ; import org . codehaus . groovy . control . CompilationFailedException ; import org . codehaus . groovy . control . SourceUnit ; import org . codehaus . groovy . antlr . parser . GroovyLexer ; import org . codehaus . groovy . antlr . parser . GroovyRecognizer ; import org . codehaus . groovy . syntax . SyntaxException ; import antlr . RecognitionException ; import antlr . TokenStreamException ; import antlr . TokenStreamIOException ; import antlr . TokenStreamRecognitionException ; public class ErrorRecoveredCSTParserPlugin extends AntlrParserPlugin { private final ICSTReporter reporter ; ErrorRecoveredCSTParserPlugin ( ICSTReporter reporter ) { this . reporter = reporter ; } @ Override public void transformCSTIntoAST ( final SourceUnit sourceUnit , Reader reader , SourceBuffer sourceBuffer ) throws CompilationFailedException { super . ast = null ; setController ( sourceUnit ) ; UnicodeEscapingReader unicodeReader = new UnicodeEscapingReader ( reader , sourceBuffer ) ; GroovyLexer lexer = new GroovyLexer ( new UnicodeLexerSharedInputState ( unicodeReader ) ) ; unicodeReader . setLexer ( lexer ) ; GroovyRecognizer parser = GroovyRecognizer . make ( lexer ) ; parser . setSourceBuffer ( sourceBuffer ) ; super . tokenNames = parser . getTokenNames ( ) ; parser . setFilename ( sourceUnit . getName ( ) ) ; try { parser . compilationUnit ( ) ; configureLocationSupport ( sourceBuffer ) ; } catch ( TokenStreamRecognitionException tsre ) { configureLocationSupport ( sourceBuffer ) ; RecognitionException e = tsre . recog ; SyntaxException se = new SyntaxException ( e . getMessage ( ) , e , e . getLine ( ) , e . getColumn ( ) ) ; se . setFatal ( true ) ; sourceUnit . addError ( se ) ; } catch ( RecognitionException e ) { configureLocationSupport ( sourceBuffer ) ; int origLine = e . getLine ( ) ; int origColumn = e . getColumn ( ) ; int [ ] newInts = fixLineColumn ( origLine , origColumn ) ; int newLine = newInts [ <NUM_LIT:0> ] ; int newColumn = newInts [ <NUM_LIT:1> ] ; SyntaxException se = new SyntaxException ( e . getMessage ( ) , e , newLine , newColumn ) ; se . setFatal ( true ) ; sourceUnit . addError ( se ) ; } catch ( TokenStreamException e ) { configureLocationSupport ( sourceBuffer ) ; boolean handled = false ; if ( e instanceof TokenStreamIOException ) { TokenStreamIOException tsioe = ( TokenStreamIOException ) e ; String m = e . getMessage ( ) ; if ( m != null && m . startsWith ( "<STR_LIT>" ) ) { try { int linepos = m . indexOf ( "<STR_LIT>" ) ; int colpos = m . indexOf ( "<STR_LIT>" ) ; int line = Integer . valueOf ( m . substring ( linepos + <NUM_LIT:5> , colpos ) . trim ( ) ) ; int col = Integer . valueOf ( m . substring ( colpos + <NUM_LIT:4> ) . trim ( ) ) ; SyntaxException se = new SyntaxException ( e . getMessage ( ) , e , line , col ) ; se . setFatal ( true ) ; sourceUnit . addError ( se ) ; handled = true ; } catch ( Throwable t ) { System . err . println ( m ) ; t . printStackTrace ( System . err ) ; } } } if ( ! handled ) { sourceUnit . addException ( e ) ; } } super . ast = parser . getAST ( ) ; sourceUnit . setComments ( parser . getComments ( ) ) ; reportCST ( sourceUnit , parser ) ; } @ SuppressWarnings ( "<STR_LIT:unchecked>" ) private void reportCST ( final SourceUnit sourceUnit , final GroovyRecognizer parser ) { final List errorList = parser . getErrorList ( ) ; final GroovySourceAST cst = ( GroovySourceAST ) parser . getAST ( ) ; if ( reporter != null ) { if ( cst != null ) reporter . generatedCST ( sourceUnit . getName ( ) , cst ) ; if ( errorList . size ( ) != <NUM_LIT:0> ) reporter . reportErrors ( sourceUnit . getName ( ) , Collections . unmodifiableList ( errorList ) ) ; } else { for ( Map < String , Object > error : ( List < Map < String , Object > > ) errorList ) { int origLine = ( ( Integer ) error . get ( "<STR_LIT>" ) ) . intValue ( ) ; int origColumn = ( ( Integer ) error . get ( "<STR_LIT>" ) ) . intValue ( ) ; int [ ] newInts = fixLineColumn ( origLine , origColumn ) ; int newLine = newInts [ <NUM_LIT:0> ] ; int newColumn = newInts [ <NUM_LIT:1> ] ; SyntaxException se = new SyntaxException ( ( String ) error . get ( "<STR_LIT:error>" ) , newLine , newColumn ) ; sourceUnit . addError ( se ) ; } } } private int [ ] fixLineColumn ( int origLine , int origColumn ) { if ( locations . isPopulated ( ) ) { int offset = locations . findOffset ( origLine , origColumn ) ; if ( offset >= locations . getEnd ( ) - <NUM_LIT:1> ) { return locations . getRowCol ( locations . getEnd ( ) - <NUM_LIT:1> ) ; } } return new int [ ] { origLine , origColumn } ; } } </s>
|
<s> package org . codehaus . groovy . antlr ; import org . codehaus . groovy . control . ParserPlugin ; import org . codehaus . groovy . control . ParserPluginFactory ; public class CSTParserPluginFactory extends ParserPluginFactory { private ICSTReporter cstReporter ; public CSTParserPluginFactory ( ICSTReporter cstReporter ) { this . cstReporter = cstReporter ; } public ParserPlugin createParserPlugin ( ) { return new CSTParserPlugin ( cstReporter ) ; } } </s>
|
<s> package org . codehaus . groovy . antlr ; import java . io . Reader ; import org . codehaus . groovy . control . CompilationFailedException ; import org . codehaus . groovy . control . SourceUnit ; import org . codehaus . groovy . syntax . Reduction ; public class CSTParserPlugin extends AntlrParserPlugin { private ICSTReporter cstReporter ; CSTParserPlugin ( ICSTReporter cstReporter ) { this . cstReporter = cstReporter ; } public Reduction parseCST ( final SourceUnit sourceUnit , Reader reader ) throws CompilationFailedException { Reduction reduction = super . parseCST ( sourceUnit , reader ) ; GroovySourceAST cst = ( GroovySourceAST ) super . ast ; if ( cst != null ) { cstReporter . generatedCST ( sourceUnit . getName ( ) , cst ) ; } return reduction ; } } </s>
|
<s> package org . codehaus . groovy . antlr ; import java . util . List ; import java . util . ArrayList ; public class SourceBuffer { private final List < StringBuilder > lines ; private StringBuilder current ; private final List < Integer > lineEndings ; private UnicodeEscapingReader unescaper ; public SourceBuffer ( ) { lines = new ArrayList < StringBuilder > ( ) ; lineEndings = new ArrayList < Integer > ( ) ; lineEndings . add ( <NUM_LIT:0> ) ; unescaper = new NoEscaper ( ) ; current = new StringBuilder ( ) ; lines . add ( current ) ; } public String getSnippet ( LineColumn start , LineColumn end ) { if ( start == null || end == null ) { return null ; } if ( start . equals ( end ) ) { return null ; } if ( lines . size ( ) == <NUM_LIT:1> && current . length ( ) == <NUM_LIT:0> ) { return null ; } int startLine = start . getLine ( ) ; int startColumn = start . getColumn ( ) ; int endLine = end . getLine ( ) ; int endColumn = end . getColumn ( ) ; if ( startLine < <NUM_LIT:1> ) { startLine = <NUM_LIT:1> ; } if ( endLine < <NUM_LIT:1> ) { endLine = <NUM_LIT:1> ; } if ( startColumn < <NUM_LIT:1> ) { startColumn = <NUM_LIT:1> ; } if ( endColumn < <NUM_LIT:1> ) { endColumn = <NUM_LIT:1> ; } if ( startLine > lines . size ( ) ) { startLine = lines . size ( ) ; } if ( endLine > lines . size ( ) ) { endLine = lines . size ( ) ; } StringBuffer snippet = new StringBuffer ( ) ; for ( int i = startLine - <NUM_LIT:1> ; i < endLine ; i ++ ) { String line = ( lines . get ( i ) ) . toString ( ) ; if ( startLine == endLine ) { if ( startColumn > line . length ( ) ) { startColumn = line . length ( ) ; } if ( startColumn < <NUM_LIT:1> ) { startColumn = <NUM_LIT:1> ; } if ( endColumn > line . length ( ) ) { endColumn = line . length ( ) + <NUM_LIT:1> ; } if ( endColumn < <NUM_LIT:1> ) { endColumn = <NUM_LIT:1> ; } line = line . substring ( startColumn - <NUM_LIT:1> , endColumn - <NUM_LIT:1> ) ; } else { if ( i == startLine - <NUM_LIT:1> ) { if ( startColumn - <NUM_LIT:1> < line . length ( ) ) { line = line . substring ( startColumn - <NUM_LIT:1> ) ; } } if ( i == endLine - <NUM_LIT:1> ) { if ( endColumn - <NUM_LIT:1> < line . length ( ) ) { line = line . substring ( <NUM_LIT:0> , endColumn - <NUM_LIT:1> ) ; } } } snippet . append ( line ) ; } return snippet . toString ( ) ; } public void setUnescaper ( UnicodeEscapingReader unicodeEscapingReader ) { this . unescaper = unicodeEscapingReader ; } private boolean prevWasCarriageReturn = false ; private int col = <NUM_LIT:0> ; public void write ( int c ) { if ( c != - <NUM_LIT:1> ) { col ++ ; current . append ( ( char ) c ) ; } if ( c == '<STR_LIT:\n>' ) { if ( ! prevWasCarriageReturn ) { current = new StringBuilder ( ) ; lines . add ( current ) ; lineEndings . add ( col + unescaper . getUnescapedUnicodeOffsetCount ( ) ) ; } else { current = new StringBuilder ( ) ; lines . get ( lines . size ( ) - <NUM_LIT:1> ) . append ( '<STR_LIT:\n>' ) ; lineEndings . remove ( lineEndings . size ( ) - <NUM_LIT:1> ) ; lineEndings . add ( col + unescaper . getUnescapedUnicodeOffsetCount ( ) ) ; } } if ( c == '<STR_LIT>' ) { current = new StringBuilder ( ) ; lines . add ( current ) ; lineEndings . add ( col + unescaper . getUnescapedUnicodeOffsetCount ( ) ) ; prevWasCarriageReturn = true ; } else { prevWasCarriageReturn = false ; } } public LocationSupport getLocationSupport ( ) { lineEndings . add ( col + unescaper . getUnescapedUnicodeOffsetCount ( ) ) ; int [ ] lineEndingsArray = new int [ lineEndings . size ( ) ] ; for ( int i = <NUM_LIT:0> , max = lineEndings . size ( ) ; i < max ; i ++ ) { lineEndingsArray [ i ] = lineEndings . get ( i ) . intValue ( ) ; } return new LocationSupport ( lineEndingsArray ) ; } } </s>
|
<s> package org . codehaus . groovy . antlr ; import org . codehaus . groovy . ast . ClassHelper ; import org . codehaus . groovy . ast . ClassNode ; import org . codehaus . groovy . ast . FieldNode ; import org . codehaus . groovy . ast . GenericsType ; import org . codehaus . groovy . ast . InnerClassNode ; import org . codehaus . groovy . ast . MixinNode ; import org . codehaus . groovy . ast . expr . Expression ; import org . codehaus . groovy . ast . expr . ListExpression ; import org . objectweb . asm . Opcodes ; public class EnumHelper { private static final int FS = Opcodes . ACC_FINAL | Opcodes . ACC_STATIC ; private static final int PUBLIC_FS = Opcodes . ACC_PUBLIC | FS ; public static ClassNode makeEnumNode ( String name , int modifiers , ClassNode [ ] interfaces , ClassNode outerClass ) { modifiers = modifiers | Opcodes . ACC_FINAL | Opcodes . ACC_ENUM ; ClassNode enumClass ; if ( outerClass == null ) { enumClass = new ClassNode ( name , modifiers , null , interfaces , MixinNode . EMPTY_ARRAY ) ; } else { name = outerClass . getName ( ) + "<STR_LIT:$>" + name ; enumClass = new InnerClassNode ( outerClass , name , modifiers , null , interfaces , MixinNode . EMPTY_ARRAY ) ; } GenericsType gt = new GenericsType ( enumClass ) ; ClassNode superClass = ClassHelper . makeWithoutCaching ( "<STR_LIT>" ) ; superClass . setGenericsTypes ( new GenericsType [ ] { gt } ) ; enumClass . setSuperClass ( superClass ) ; superClass . setRedirect ( ClassHelper . Enum_Type ) ; return enumClass ; } public static FieldNode addEnumConstant ( ClassNode enumClassType , ClassNode enumClassOwner , String name , Expression init ) { int modifiers = PUBLIC_FS | Opcodes . ACC_ENUM ; if ( init != null && ! ( init instanceof ListExpression ) ) { ListExpression list = new ListExpression ( ) ; list . addExpression ( init ) ; init = list ; } FieldNode fn = new FieldNode ( name , modifiers , enumClassType . getPlainNodeReference ( ) , enumClassOwner , init ) ; enumClassOwner . addField ( fn ) ; return fn ; } } </s>
|
<s> package org . codehaus . groovy . antlr ; import antlr . RecognitionException ; import antlr . TokenStreamException ; import antlr . TokenStreamRecognitionException ; import antlr . collections . AST ; import org . codehaus . groovy . GroovyBugError ; import org . codehaus . groovy . antlr . parser . GroovyLexer ; import org . codehaus . groovy . antlr . parser . GroovyRecognizer ; import org . codehaus . groovy . antlr . parser . GroovyTokenTypes ; import org . codehaus . groovy . antlr . treewalker . * ; import org . codehaus . groovy . ast . * ; import org . codehaus . groovy . ast . expr . * ; import org . codehaus . groovy . ast . stmt . * ; import org . codehaus . groovy . control . CompilationFailedException ; import org . codehaus . groovy . control . ParserPlugin ; import org . codehaus . groovy . control . SourceUnit ; import org . codehaus . groovy . syntax . * ; import org . objectweb . asm . Opcodes ; import java . io . FileNotFoundException ; import java . io . FileOutputStream ; import java . io . FileWriter ; import java . io . PrintStream ; import java . io . Reader ; import java . security . AccessController ; import java . security . PrivilegedAction ; import java . util . ArrayList ; import java . util . HashSet ; import java . util . Iterator ; import java . util . LinkedList ; import java . util . List ; import java . util . Set ; public class AntlrParserPlugin extends ASTHelper implements ParserPlugin , GroovyTokenTypes { private static class AnonymousInnerClassCarrier extends Expression { ClassNode innerClass ; public Expression transformExpression ( ExpressionTransformer transformer ) { return null ; } @ Override public void setSourcePosition ( final ASTNode node ) { super . setSourcePosition ( node ) ; innerClass . setSourcePosition ( node ) ; } @ Override public void setColumnNumber ( final int columnNumber ) { super . setColumnNumber ( columnNumber ) ; innerClass . setColumnNumber ( columnNumber ) ; } @ Override public void setLineNumber ( final int lineNumber ) { super . setLineNumber ( lineNumber ) ; innerClass . setLineNumber ( lineNumber ) ; } @ Override public void setLastColumnNumber ( final int columnNumber ) { super . setLastColumnNumber ( columnNumber ) ; innerClass . setLastColumnNumber ( columnNumber ) ; } @ Override public void setLastLineNumber ( final int lineNumber ) { super . setLastLineNumber ( lineNumber ) ; innerClass . setLastLineNumber ( lineNumber ) ; } } protected AST ast ; private ClassNode classNode ; private MethodNode methodNode ; protected String [ ] tokenNames ; private int innerClassCounter = <NUM_LIT:1> ; private boolean enumConstantBeingDef = false ; private boolean forStatementBeingDef = false ; private boolean firstParamIsVarArg = false ; private boolean firstParam = false ; protected LocationSupport locations = LocationSupport . NO_LOCATIONS ; public Reduction parseCST ( final SourceUnit sourceUnit , Reader reader ) throws CompilationFailedException { final SourceBuffer sourceBuffer = new SourceBuffer ( ) ; transformCSTIntoAST ( sourceUnit , reader , sourceBuffer ) ; processAST ( ) ; return outputAST ( sourceUnit , sourceBuffer ) ; } protected void transformCSTIntoAST ( SourceUnit sourceUnit , Reader reader , SourceBuffer sourceBuffer ) throws CompilationFailedException { ast = null ; setController ( sourceUnit ) ; UnicodeEscapingReader unicodeReader = new UnicodeEscapingReader ( reader , sourceBuffer ) ; UnicodeLexerSharedInputState inputState = new UnicodeLexerSharedInputState ( unicodeReader ) ; GroovyLexer lexer = new GroovyLexer ( inputState ) ; unicodeReader . setLexer ( lexer ) ; GroovyRecognizer parser = GroovyRecognizer . make ( lexer ) ; parser . setSourceBuffer ( sourceBuffer ) ; tokenNames = parser . getTokenNames ( ) ; parser . setFilename ( sourceUnit . getName ( ) ) ; try { parser . compilationUnit ( ) ; } catch ( TokenStreamRecognitionException tsre ) { RecognitionException e = tsre . recog ; SyntaxException se = new SyntaxException ( e . getMessage ( ) , e , e . getLine ( ) , e . getColumn ( ) ) ; se . setFatal ( true ) ; sourceUnit . addError ( se ) ; } catch ( RecognitionException e ) { SyntaxException se = new SyntaxException ( e . getMessage ( ) , e , e . getLine ( ) , e . getColumn ( ) ) ; se . setFatal ( true ) ; sourceUnit . addError ( se ) ; } catch ( TokenStreamException e ) { sourceUnit . addException ( e ) ; } configureLocationSupport ( sourceBuffer ) ; ast = parser . getAST ( ) ; } protected void configureLocationSupport ( SourceBuffer sourceBuffer ) { locations = sourceBuffer . getLocationSupport ( ) ; } protected void processAST ( ) { AntlrASTProcessor snippets = new AntlrASTProcessSnippets ( ) ; ast = snippets . process ( ast ) ; } public Reduction outputAST ( final SourceUnit sourceUnit , final SourceBuffer sourceBuffer ) { AccessController . doPrivileged ( new PrivilegedAction ( ) { public Object run ( ) { outputASTInVariousFormsIfNeeded ( sourceUnit , sourceBuffer ) ; return null ; } } ) ; return null ; } protected void outputASTInVariousFormsIfNeeded ( SourceUnit sourceUnit , SourceBuffer sourceBuffer ) { if ( "<STR_LIT>" . equals ( System . getProperty ( "<STR_LIT>" ) ) ) { try { PrintStream out = new PrintStream ( new FileOutputStream ( sourceUnit . getName ( ) + "<STR_LIT>" ) ) ; Visitor visitor = new SourcePrinter ( out , tokenNames ) ; AntlrASTProcessor treewalker = new SourceCodeTraversal ( visitor ) ; treewalker . process ( ast ) ; } catch ( FileNotFoundException e ) { System . out . println ( "<STR_LIT>" + sourceUnit . getName ( ) + "<STR_LIT>" ) ; } } if ( "<STR_LIT>" . equals ( System . getProperty ( "<STR_LIT>" ) ) ) { try { PrintStream out = new PrintStream ( new FileOutputStream ( sourceUnit . getName ( ) + "<STR_LIT>" ) ) ; Visitor visitor = new MindMapPrinter ( out , tokenNames ) ; AntlrASTProcessor treewalker = new PreOrderTraversal ( visitor ) ; treewalker . process ( ast ) ; } catch ( FileNotFoundException e ) { System . out . println ( "<STR_LIT>" + sourceUnit . getName ( ) + "<STR_LIT>" ) ; } } if ( "<STR_LIT>" . equals ( System . getProperty ( "<STR_LIT>" ) ) ) { try { PrintStream out = new PrintStream ( new FileOutputStream ( sourceUnit . getName ( ) + "<STR_LIT>" ) ) ; Visitor visitor = new MindMapPrinter ( out , tokenNames , sourceBuffer ) ; AntlrASTProcessor treewalker = new PreOrderTraversal ( visitor ) ; treewalker . process ( ast ) ; } catch ( FileNotFoundException e ) { System . out . println ( "<STR_LIT>" + sourceUnit . getName ( ) + "<STR_LIT>" ) ; } } if ( "<STR_LIT>" . equals ( System . getProperty ( "<STR_LIT>" ) ) ) { try { PrintStream out = new PrintStream ( new FileOutputStream ( sourceUnit . getName ( ) + "<STR_LIT>" ) ) ; List < VisitorAdapter > v = new ArrayList < VisitorAdapter > ( ) ; v . add ( new NodeAsHTMLPrinter ( out , tokenNames ) ) ; v . add ( new SourcePrinter ( out , tokenNames ) ) ; Visitor visitors = new CompositeVisitor ( v ) ; AntlrASTProcessor treewalker = new SourceCodeTraversal ( visitors ) ; treewalker . process ( ast ) ; } catch ( FileNotFoundException e ) { System . out . println ( "<STR_LIT>" + sourceUnit . getName ( ) + "<STR_LIT>" ) ; } } } public ModuleNode buildAST ( SourceUnit sourceUnit , ClassLoader classLoader , Reduction cst ) throws ParserException { setClassLoader ( classLoader ) ; makeModule ( ) ; try { innerClassCounter = <NUM_LIT:1> ; convertGroovy ( ast ) ; boolean hasNoMethods = output . getMethods ( ) . isEmpty ( ) ; if ( hasNoMethods && sourceUnit . getErrorCollector ( ) . hasErrors ( ) && looksBroken ( output ) ) { output . setEncounteredUnrecoverableError ( true ) ; } if ( output . getStatementBlock ( ) . isEmpty ( ) && hasNoMethods && output . getClasses ( ) . isEmpty ( ) ) { if ( ast == null && sourceUnit . getErrorCollector ( ) . hasErrors ( ) ) { output . setEncounteredUnrecoverableError ( true ) ; } output . addStatement ( ReturnStatement . RETURN_NULL_OR_VOID ) ; } ClassNode scriptClassNode = output . getScriptClassDummy ( ) ; if ( scriptClassNode != null ) { List < Statement > statements = output . getStatementBlock ( ) . getStatements ( ) ; if ( statements . size ( ) > <NUM_LIT:0> ) { Statement firstStatement = statements . get ( <NUM_LIT:0> ) ; Statement lastStatement = statements . get ( statements . size ( ) - <NUM_LIT:1> ) ; scriptClassNode . setSourcePosition ( firstStatement ) ; scriptClassNode . setLastColumnNumber ( lastStatement . getLastColumnNumber ( ) ) ; scriptClassNode . setLastLineNumber ( lastStatement . getLastLineNumber ( ) ) ; } } fixModuleNodeLocations ( ) ; } catch ( ASTRuntimeException e ) { throw new ASTParserException ( e . getMessage ( ) + "<STR_LIT>" + sourceUnit . getName ( ) , e ) ; } return output ; } private boolean looksBroken ( ModuleNode moduleNode ) { List < ClassNode > classes = moduleNode . getClasses ( ) ; if ( classes . size ( ) != <NUM_LIT:1> || ! classes . get ( <NUM_LIT:0> ) . isScript ( ) ) { return false ; } BlockStatement statementBlock = moduleNode . getStatementBlock ( ) ; if ( statementBlock . isEmpty ( ) ) { return true ; } List < Statement > statements = statementBlock . getStatements ( ) ; if ( statements != null && statements . size ( ) == <NUM_LIT:1> ) { Statement statement = statements . get ( <NUM_LIT:0> ) ; if ( statement instanceof ExpressionStatement ) { Expression expression = ( ( ExpressionStatement ) statement ) . getExpression ( ) ; if ( expression instanceof ConstantExpression ) { if ( expression . toString ( ) . equals ( "<STR_LIT>" ) ) { return true ; } } } } return false ; } protected void convertGroovy ( AST node ) { while ( node != null ) { int type = node . getType ( ) ; switch ( type ) { case PACKAGE_DEF : packageDef ( node ) ; break ; case STATIC_IMPORT : case IMPORT : importDef ( node ) ; break ; case CLASS_DEF : classDef ( node ) ; break ; case INTERFACE_DEF : interfaceDef ( node ) ; break ; case METHOD_DEF : methodDef ( node ) ; break ; case ENUM_DEF : enumDef ( node ) ; break ; case ANNOTATION_DEF : annotationDef ( node ) ; break ; default : { Statement statement = statement ( node ) ; output . addStatement ( statement ) ; } } node = node . getNextSibling ( ) ; } } protected void packageDef ( AST packageDef ) { List < AnnotationNode > annotations = new ArrayList < AnnotationNode > ( ) ; AST node = packageDef . getFirstChild ( ) ; if ( isType ( ANNOTATIONS , node ) ) { processAnnotations ( annotations , node ) ; node = node . getNextSibling ( ) ; } if ( node == null ) { return ; } String name = qualifiedName ( node ) ; setPackageName ( name ) ; if ( name != null && name . length ( ) > <NUM_LIT:0> ) { name += '<CHAR_LIT:.>' ; } PackageNode packageNode = new PackageNode ( name ) ; packageNode . addAnnotations ( annotations ) ; output . setPackage ( packageNode ) ; configureAST ( packageNode , node ) ; } protected void importDef ( AST importNode ) { boolean isStatic = importNode . getType ( ) == STATIC_IMPORT ; List < AnnotationNode > annotations = new ArrayList < AnnotationNode > ( ) ; AST node = importNode . getFirstChild ( ) ; if ( isType ( ANNOTATIONS , node ) ) { processAnnotations ( annotations , node ) ; node = node . getNextSibling ( ) ; } String alias = null ; AST aliasNode = null ; if ( isType ( LITERAL_as , node ) ) { node = node . getFirstChild ( ) ; aliasNode = node . getNextSibling ( ) ; alias = identifier ( aliasNode ) ; } if ( node == null ) { if ( isStatic ) { addStaticImport ( ClassHelper . OBJECT_TYPE , "<STR_LIT>" , null , annotations ) ; } else { addImport ( ClassHelper . OBJECT_TYPE , "<STR_LIT>" , null , annotations ) ; } return ; } if ( node . getNumberOfChildren ( ) == <NUM_LIT:0> ) { String name = identifier ( node ) ; ClassNode type = ClassHelper . make ( name ) ; configureAST ( type , importNode ) ; addImport ( type , name , alias , annotations ) ; return ; } AST packageNode = node . getFirstChild ( ) ; String packageName = qualifiedName ( packageNode ) ; AST nameNode = packageNode . getNextSibling ( ) ; if ( isType ( STAR , nameNode ) ) { if ( isStatic ) { ClassNode type = ClassHelper . make ( packageName ) ; configureAST ( type , packageNode ) ; addStaticStarImport ( type , packageName , annotations ) ; ASTNode imp = ( ASTNode ) output . getStaticStarImports ( ) . get ( packageName ) ; configureAST ( imp , importNode ) ; } else { addStarImport ( packageName , annotations ) ; ASTNode imp = ( ASTNode ) output . getStarImports ( ) . get ( output . getStarImports ( ) . size ( ) - <NUM_LIT:1> ) ; configureAST ( imp , importNode ) ; } if ( alias != null ) throw new GroovyBugError ( "<STR_LIT>" + "<STR_LIT>" ) ; } else { ImportNode imp ; String name = identifier ( nameNode ) ; if ( isStatic ) { ClassNode type = ClassHelper . make ( packageName ) ; configureAST ( type , packageNode ) ; addStaticImport ( type , name , alias , annotations ) ; imp = output . getStaticImports ( ) . get ( alias == null ? name : alias ) ; configureAST ( imp , importNode ) ; ConstantExpression nameExpr = new ConstantExpression ( name ) ; configureAST ( nameExpr , nameNode ) ; imp . setFieldNameExpr ( nameExpr ) ; } else { ClassNode type = ClassHelper . make ( packageName + "<STR_LIT:.>" + name ) ; configureAST ( type , nameNode ) ; addImport ( type , name , alias , annotations ) ; imp = output . getImport ( alias == null ? name : alias ) ; configureAST ( imp , importNode ) ; } if ( alias != null ) { ConstantExpression aliasExpr = new ConstantExpression ( alias ) ; configureAST ( aliasExpr , aliasNode ) ; imp . setAliasExpr ( aliasExpr ) ; } } } private void processAnnotations ( List < AnnotationNode > annotations , AST node ) { AST child = node . getFirstChild ( ) ; while ( child != null ) { if ( isType ( ANNOTATION , child ) ) annotations . add ( annotation ( child ) ) ; child = child . getNextSibling ( ) ; } } protected void annotationDef ( AST classDef ) { List < AnnotationNode > annotations = new ArrayList < AnnotationNode > ( ) ; AST node = classDef . getFirstChild ( ) ; int modifiers = Opcodes . ACC_PUBLIC ; if ( isType ( MODIFIERS , node ) ) { modifiers = modifiers ( node , annotations , modifiers ) ; checkNoInvalidModifier ( classDef , "<STR_LIT>" , modifiers , Opcodes . ACC_SYNCHRONIZED , "<STR_LIT>" ) ; node = node . getNextSibling ( ) ; } modifiers |= Opcodes . ACC_ABSTRACT | Opcodes . ACC_INTERFACE | Opcodes . ACC_ANNOTATION ; String name = identifier ( node ) ; GroovySourceAST groovySourceAST = ( GroovySourceAST ) node ; int nameStart = locations . findOffset ( groovySourceAST . getLine ( ) , groovySourceAST . getColumn ( ) ) ; int nameEnd = locations . findOffset ( groovySourceAST . getLineLast ( ) , groovySourceAST . getColumnLast ( ) ) - <NUM_LIT:1> ; node = node . getNextSibling ( ) ; ClassNode superClass = ClassHelper . OBJECT_TYPE ; GenericsType [ ] genericsType = null ; if ( isType ( TYPE_PARAMETERS , node ) ) { genericsType = makeGenericsType ( node ) ; node = node . getNextSibling ( ) ; } ClassNode [ ] interfaces = ClassNode . EMPTY_ARRAY ; if ( isType ( EXTENDS_CLAUSE , node ) ) { interfaces = interfaces ( node ) ; node = node . getNextSibling ( ) ; } boolean syntheticPublic = ( ( modifiers & Opcodes . ACC_SYNTHETIC ) != <NUM_LIT:0> ) ; modifiers &= ~ Opcodes . ACC_SYNTHETIC ; classNode = new ClassNode ( dot ( getPackageName ( ) , name ) , modifiers , superClass , interfaces , null ) ; classNode . setSyntheticPublic ( syntheticPublic ) ; classNode . addAnnotations ( annotations ) ; classNode . setGenericsTypes ( genericsType ) ; classNode . addInterface ( ClassHelper . Annotation_TYPE ) ; classNode . setNameStart ( nameStart ) ; classNode . setNameEnd ( nameEnd ) ; configureAST ( classNode , classDef ) ; assertNodeType ( OBJBLOCK , node ) ; objectBlock ( node ) ; output . addClass ( classNode ) ; classNode = null ; } protected void interfaceDef ( AST classDef ) { int oldInnerClassCounter = innerClassCounter ; innerInterfaceDef ( classDef ) ; classNode = null ; innerClassCounter = oldInnerClassCounter ; } protected void innerInterfaceDef ( AST classDef ) { List < AnnotationNode > annotations = new ArrayList < AnnotationNode > ( ) ; AST node = classDef . getFirstChild ( ) ; int modifiers = Opcodes . ACC_PUBLIC ; if ( isType ( MODIFIERS , node ) ) { modifiers = modifiers ( node , annotations , modifiers ) ; checkNoInvalidModifier ( classDef , "<STR_LIT>" , modifiers , Opcodes . ACC_SYNCHRONIZED , "<STR_LIT>" ) ; node = node . getNextSibling ( ) ; } modifiers |= Opcodes . ACC_ABSTRACT | Opcodes . ACC_INTERFACE ; String name = identifier ( node ) ; GroovySourceAST groovySourceAST = ( GroovySourceAST ) node ; int nameStart = locations . findOffset ( groovySourceAST . getLine ( ) , groovySourceAST . getColumn ( ) ) ; int nameEnd = locations . findOffset ( groovySourceAST . getLineLast ( ) , groovySourceAST . getColumnLast ( ) ) - <NUM_LIT:1> ; node = node . getNextSibling ( ) ; ClassNode superClass = ClassHelper . OBJECT_TYPE ; GenericsType [ ] genericsType = null ; if ( isType ( TYPE_PARAMETERS , node ) ) { genericsType = makeGenericsType ( node ) ; node = node . getNextSibling ( ) ; } ClassNode [ ] interfaces = ClassNode . EMPTY_ARRAY ; if ( isType ( EXTENDS_CLAUSE , node ) ) { interfaces = interfaces ( node ) ; node = node . getNextSibling ( ) ; } ClassNode outerClass = classNode ; boolean syntheticPublic = ( ( modifiers & Opcodes . ACC_SYNTHETIC ) != <NUM_LIT:0> ) ; modifiers &= ~ Opcodes . ACC_SYNTHETIC ; if ( classNode != null ) { name = classNode . getNameWithoutPackage ( ) + "<STR_LIT:$>" + name ; String fullName = dot ( classNode . getPackageName ( ) , name ) ; classNode = new InnerClassNode ( classNode , fullName , modifiers , superClass , interfaces , null ) ; } else { classNode = new ClassNode ( dot ( getPackageName ( ) , name ) , modifiers , superClass , interfaces , null ) ; } classNode . setSyntheticPublic ( syntheticPublic ) ; classNode . addAnnotations ( annotations ) ; classNode . setGenericsTypes ( genericsType ) ; configureAST ( classNode , classDef ) ; classNode . setNameStart ( nameStart ) ; classNode . setNameEnd ( nameEnd ) ; int oldClassCount = innerClassCounter ; assertNodeType ( OBJBLOCK , node ) ; objectBlock ( node ) ; output . addClass ( classNode ) ; classNode = outerClass ; innerClassCounter = oldClassCount ; } protected void classDef ( AST classDef ) { int oldInnerClassCounter = innerClassCounter ; innerClassDef ( classDef ) ; classNode = null ; innerClassCounter = oldInnerClassCounter ; } private ClassNode getClassOrScript ( ClassNode node ) { if ( node != null ) return node ; return output . getScriptClassDummy ( ) ; } protected Expression anonymousInnerClassDef ( AST node ) { ClassNode oldNode = classNode ; ClassNode outerClass = getClassOrScript ( oldNode ) ; String fullName = outerClass . getName ( ) + '<CHAR_LIT>' + innerClassCounter ; innerClassCounter ++ ; if ( enumConstantBeingDef ) { classNode = new EnumConstantClassNode ( outerClass , fullName , Opcodes . ACC_PUBLIC , ClassHelper . OBJECT_TYPE ) ; } else { classNode = new InnerClassNode ( outerClass , fullName , Opcodes . ACC_PUBLIC , ClassHelper . OBJECT_TYPE ) ; } ( ( InnerClassNode ) classNode ) . setAnonymous ( true ) ; classNode . setEnclosingMethod ( methodNode ) ; assertNodeType ( OBJBLOCK , node ) ; objectBlock ( node ) ; output . addClass ( classNode ) ; AnonymousInnerClassCarrier ret = new AnonymousInnerClassCarrier ( ) ; ret . innerClass = classNode ; configureAST ( classNode , node ) ; classNode = oldNode ; return ret ; } protected void innerClassDef ( AST classDef ) { List < AnnotationNode > annotations = new ArrayList < AnnotationNode > ( ) ; AST node = classDef . getFirstChild ( ) ; int modifiers = Opcodes . ACC_PUBLIC ; if ( isType ( MODIFIERS , node ) ) { modifiers = modifiers ( node , annotations , modifiers ) ; checkNoInvalidModifier ( classDef , "<STR_LIT>" , modifiers , Opcodes . ACC_SYNCHRONIZED , "<STR_LIT>" ) ; node = node . getNextSibling ( ) ; } String name = identifier ( node ) ; GroovySourceAST groovySourceAST = ( GroovySourceAST ) node ; int nameStart = locations . findOffset ( groovySourceAST . getLine ( ) , groovySourceAST . getColumn ( ) ) ; int nameEnd = nameStart + name . length ( ) - <NUM_LIT:1> ; node = node . getNextSibling ( ) ; GenericsType [ ] genericsType = null ; if ( isType ( TYPE_PARAMETERS , node ) ) { genericsType = makeGenericsType ( node ) ; node = node . getNextSibling ( ) ; } ClassNode superClass = null ; if ( isType ( EXTENDS_CLAUSE , node ) ) { superClass = makeTypeWithArguments ( node ) ; node = node . getNextSibling ( ) ; } ClassNode [ ] interfaces = ClassNode . EMPTY_ARRAY ; if ( isType ( IMPLEMENTS_CLAUSE , node ) ) { interfaces = interfaces ( node ) ; node = node . getNextSibling ( ) ; } MixinNode [ ] mixins = { } ; ClassNode outerClass = classNode ; boolean syntheticPublic = ( ( modifiers & Opcodes . ACC_SYNTHETIC ) != <NUM_LIT:0> ) ; modifiers &= ~ Opcodes . ACC_SYNTHETIC ; if ( classNode != null ) { name = classNode . getNameWithoutPackage ( ) + "<STR_LIT:$>" + name ; String fullName = dot ( classNode . getPackageName ( ) , name ) ; classNode = new InnerClassNode ( classNode , fullName , modifiers , superClass , interfaces , mixins ) ; } else { classNode = new ClassNode ( dot ( getPackageName ( ) , name ) , modifiers , superClass , interfaces , mixins ) ; } classNode . addAnnotations ( annotations ) ; classNode . setGenericsTypes ( genericsType ) ; classNode . setSyntheticPublic ( syntheticPublic ) ; configureAST ( classNode , classDef ) ; classNode . setNameStart ( nameStart ) ; classNode . setNameEnd ( nameEnd ) ; output . addClass ( classNode ) ; int oldClassCount = innerClassCounter ; if ( node != null ) { assertNodeType ( OBJBLOCK , node ) ; objectBlock ( node ) ; } classNode = outerClass ; innerClassCounter = oldClassCount ; } protected void objectBlock ( AST objectBlock ) { for ( AST node = objectBlock . getFirstChild ( ) ; node != null ; node = node . getNextSibling ( ) ) { int type = node . getType ( ) ; switch ( type ) { case OBJBLOCK : objectBlock ( node ) ; break ; case ANNOTATION_FIELD_DEF : case METHOD_DEF : methodDef ( node ) ; break ; case CTOR_IDENT : constructorDef ( node ) ; break ; case VARIABLE_DEF : fieldDef ( node ) ; break ; case STATIC_INIT : staticInit ( node ) ; break ; case INSTANCE_INIT : objectInit ( node ) ; break ; case ENUM_DEF : enumDef ( node ) ; break ; case ENUM_CONSTANT_DEF : enumConstantDef ( node ) ; break ; case CLASS_DEF : innerClassDef ( node ) ; break ; case INTERFACE_DEF : innerInterfaceDef ( node ) ; break ; default : unknownAST ( node ) ; } } } protected void enumDef ( AST enumNode ) { assertNodeType ( ENUM_DEF , enumNode ) ; List < AnnotationNode > annotations = new ArrayList < AnnotationNode > ( ) ; AST node = enumNode . getFirstChild ( ) ; int modifiers = Opcodes . ACC_PUBLIC ; if ( isType ( MODIFIERS , node ) ) { modifiers = modifiers ( node , annotations , modifiers ) ; node = node . getNextSibling ( ) ; } GroovySourceAST groovySourceAST = ( GroovySourceAST ) node ; int nameStart = locations . findOffset ( groovySourceAST . getLine ( ) , groovySourceAST . getColumn ( ) ) ; int nameEnd = locations . findOffset ( groovySourceAST . getLineLast ( ) , groovySourceAST . getColumnLast ( ) ) - <NUM_LIT:1> ; String name = identifier ( node ) ; node = node . getNextSibling ( ) ; ClassNode [ ] interfaces = interfaces ( node ) ; node = node . getNextSibling ( ) ; boolean syntheticPublic = ( ( modifiers & Opcodes . ACC_SYNTHETIC ) != <NUM_LIT:0> ) ; modifiers &= ~ Opcodes . ACC_SYNTHETIC ; String enumName = ( classNode != null ? name : dot ( getPackageName ( ) , name ) ) ; ClassNode enumClass = EnumHelper . makeEnumNode ( enumName , modifiers , interfaces , classNode ) ; enumClass . setSyntheticPublic ( syntheticPublic ) ; ClassNode oldNode = classNode ; enumClass . addAnnotations ( annotations ) ; classNode = enumClass ; assertNodeType ( OBJBLOCK , node ) ; objectBlock ( node ) ; classNode . setNameStart ( nameStart ) ; classNode . setNameEnd ( nameEnd ) ; configureAST ( classNode , enumNode ) ; classNode = oldNode ; output . addClass ( enumClass ) ; } protected void enumConstantDef ( AST node ) { enumConstantBeingDef = true ; assertNodeType ( ENUM_CONSTANT_DEF , node ) ; AST element = node . getFirstChild ( ) ; if ( isType ( ANNOTATIONS , element ) ) { element = element . getNextSibling ( ) ; } String identifier = identifier ( element ) ; Expression init = null ; element = element . getNextSibling ( ) ; if ( element != null ) { init = expression ( element ) ; ClassNode innerClass = getAnonymousInnerClassNode ( init ) ; if ( innerClass != null ) { innerClass . setSuperClass ( classNode . getPlainNodeReference ( ) ) ; innerClass . setModifiers ( classNode . getModifiers ( ) | Opcodes . ACC_FINAL ) ; init = new ClassExpression ( innerClass ) ; classNode . setModifiers ( classNode . getModifiers ( ) & ~ Opcodes . ACC_FINAL ) ; } else if ( isType ( ELIST , element ) ) { if ( init instanceof ListExpression && ! ( ( ListExpression ) init ) . isWrapped ( ) ) { ListExpression le = new ListExpression ( ) ; le . addExpression ( init ) ; init = le ; } } } GroovySourceAST groovySourceAST = ( GroovySourceAST ) node ; int nameStart = locations . findOffset ( groovySourceAST . getLine ( ) , groovySourceAST . getColumn ( ) ) ; int nameEnd = nameStart + identifier . length ( ) - <NUM_LIT:1> ; ClassNode fakeNodeToRepresentTheNonDeclaredTypeOfEnumValue = ClassHelper . make ( classNode . getName ( ) ) ; fakeNodeToRepresentTheNonDeclaredTypeOfEnumValue . setRedirect ( classNode ) ; FieldNode fn = EnumHelper . addEnumConstant ( fakeNodeToRepresentTheNonDeclaredTypeOfEnumValue , classNode , identifier , init ) ; configureAST ( fn , node ) ; fn . setNameStart ( nameStart ) ; fn . setNameEnd ( nameEnd ) ; fn . setStart ( nameStart ) ; fn . setEnd ( nameEnd ) ; enumConstantBeingDef = false ; } protected void throwsList ( AST node , List < ClassNode > list ) { String name ; if ( isType ( DOT , node ) ) { name = qualifiedName ( node ) ; } else { name = identifier ( node ) ; } ClassNode exception = ClassHelper . make ( name ) ; configureAST ( exception , node ) ; list . add ( exception ) ; AST next = node . getNextSibling ( ) ; if ( next != null ) throwsList ( next , list ) ; } protected void methodDef ( AST methodDef ) { MethodNode oldNode = methodNode ; List < AnnotationNode > annotations = new ArrayList < AnnotationNode > ( ) ; AST node = methodDef . getFirstChild ( ) ; GenericsType [ ] generics = null ; if ( isType ( TYPE_PARAMETERS , node ) ) { generics = makeGenericsType ( node ) ; node = node . getNextSibling ( ) ; } int modifiers = Opcodes . ACC_PUBLIC ; if ( isType ( MODIFIERS , node ) ) { modifiers = modifiers ( node , annotations , modifiers ) ; checkNoInvalidModifier ( methodDef , "<STR_LIT>" , modifiers , Opcodes . ACC_VOLATILE , "<STR_LIT>" ) ; node = node . getNextSibling ( ) ; } if ( isAnInterface ( ) ) { modifiers |= Opcodes . ACC_ABSTRACT ; } ClassNode returnType = null ; if ( isType ( TYPE , node ) ) { returnType = makeTypeWithArguments ( node ) ; node = node . getNextSibling ( ) ; } String name = identifier ( node ) ; if ( classNode != null && ! classNode . isAnnotationDefinition ( ) ) { if ( classNode . getNameWithoutPackage ( ) . equals ( name ) ) { if ( isAnInterface ( ) ) { throw new ASTRuntimeException ( methodDef , "<STR_LIT>" ) ; } throw new ASTRuntimeException ( methodDef , "<STR_LIT>" + returnType . getName ( ) + "<STR_LIT>" ) ; } } GroovySourceAST groovySourceAST = ( GroovySourceAST ) node ; int nameStart = locations . findOffset ( groovySourceAST . getLine ( ) , groovySourceAST . getColumn ( ) ) ; int nameEnd = locations . findOffset ( groovySourceAST . getLine ( ) , groovySourceAST . getColumnLast ( ) ) - <NUM_LIT:1> ; node = node . getNextSibling ( ) ; Parameter [ ] parameters = Parameter . EMPTY_ARRAY ; ClassNode [ ] exceptions = ClassNode . EMPTY_ARRAY ; if ( classNode == null || ! classNode . isAnnotationDefinition ( ) ) { assertNodeType ( PARAMETERS , node ) ; parameters = parameters ( node ) ; if ( parameters == null ) parameters = Parameter . EMPTY_ARRAY ; node = node . getNextSibling ( ) ; if ( isType ( LITERAL_throws , node ) ) { AST throwsNode = node . getFirstChild ( ) ; List < ClassNode > exceptionList = new ArrayList < ClassNode > ( ) ; throwsList ( throwsNode , exceptionList ) ; exceptions = exceptionList . toArray ( exceptions ) ; node = node . getNextSibling ( ) ; } } boolean hasAnnotationDefault = false ; Statement code = null ; boolean syntheticPublic = ( ( modifiers & Opcodes . ACC_SYNTHETIC ) != <NUM_LIT:0> ) ; modifiers &= ~ Opcodes . ACC_SYNTHETIC ; methodNode = new MethodNode ( name , modifiers , returnType , parameters , exceptions , code ) ; if ( ( modifiers & Opcodes . ACC_ABSTRACT ) == <NUM_LIT:0> ) { if ( node == null ) { SyntaxException se = new SyntaxException ( "<STR_LIT>" , methodDef . getLine ( ) , methodDef . getColumn ( ) ) ; getController ( ) . addError ( se ) ; code = statementListNoChild ( null , methodDef ) ; } else { assertNodeType ( SLIST , node ) ; code = statementList ( node ) ; } } else if ( node != null && classNode . isAnnotationDefinition ( ) ) { code = statement ( node ) ; hasAnnotationDefault = true ; } else if ( ( modifiers & Opcodes . ACC_ABSTRACT ) > <NUM_LIT:0> ) { if ( node != null ) { throw new ASTRuntimeException ( methodDef , "<STR_LIT>" ) ; } } methodNode . setCode ( code ) ; methodNode . addAnnotations ( annotations ) ; methodNode . setGenericsTypes ( generics ) ; methodNode . setAnnotationDefault ( hasAnnotationDefault ) ; methodNode . setSyntheticPublic ( syntheticPublic ) ; configureAST ( methodNode , methodDef ) ; methodNode . setNameStart ( nameStart ) ; methodNode . setNameEnd ( nameEnd ) ; if ( classNode != null ) { classNode . addMethod ( methodNode ) ; } else { output . addMethod ( methodNode ) ; } methodNode = oldNode ; } private void checkNoInvalidModifier ( AST node , String nodeType , int modifiers , int modifier , String modifierText ) { if ( ( modifiers & modifier ) != <NUM_LIT:0> ) { throw new ASTRuntimeException ( node , nodeType + "<STR_LIT>" + modifierText + "<STR_LIT>" ) ; } } private boolean isAnInterface ( ) { return classNode != null && ( classNode . getModifiers ( ) & Opcodes . ACC_INTERFACE ) > <NUM_LIT:0> ; } protected void staticInit ( AST staticInit ) { BlockStatement code = ( BlockStatement ) statementList ( staticInit ) ; classNode . addStaticInitializerStatements ( code . getStatements ( ) , false ) ; } protected void objectInit ( AST init ) { BlockStatement code = ( BlockStatement ) statementList ( init ) ; classNode . addObjectInitializerStatements ( code ) ; } protected void constructorDef ( AST constructorDef ) { List < AnnotationNode > annotations = new ArrayList < AnnotationNode > ( ) ; AST node = constructorDef . getFirstChild ( ) ; int modifiers = Opcodes . ACC_PUBLIC ; GroovySourceAST groovySourceAST = ( GroovySourceAST ) node ; int nameStart = locations . findOffset ( groovySourceAST . getLineLast ( ) , groovySourceAST . getColumnLast ( ) ) ; if ( isType ( MODIFIERS , node ) ) { modifiers = modifiers ( node , annotations , modifiers ) ; checkNoInvalidModifier ( constructorDef , "<STR_LIT>" , modifiers , Opcodes . ACC_STATIC , "<STR_LIT>" ) ; checkNoInvalidModifier ( constructorDef , "<STR_LIT>" , modifiers , Opcodes . ACC_FINAL , "<STR_LIT>" ) ; checkNoInvalidModifier ( constructorDef , "<STR_LIT>" , modifiers , Opcodes . ACC_ABSTRACT , "<STR_LIT>" ) ; checkNoInvalidModifier ( constructorDef , "<STR_LIT>" , modifiers , Opcodes . ACC_NATIVE , "<STR_LIT>" ) ; node = node . getNextSibling ( ) ; } assertNodeType ( PARAMETERS , node ) ; Parameter [ ] parameters = parameters ( node ) ; if ( parameters == null ) parameters = Parameter . EMPTY_ARRAY ; int nameEnd = locations . findOffset ( node . getLine ( ) , node . getColumn ( ) ) - <NUM_LIT:2> ; node = node . getNextSibling ( ) ; ClassNode [ ] exceptions = ClassNode . EMPTY_ARRAY ; if ( isType ( LITERAL_throws , node ) ) { AST throwsNode = node . getFirstChild ( ) ; List < ClassNode > exceptionList = new ArrayList < ClassNode > ( ) ; throwsList ( throwsNode , exceptionList ) ; exceptions = exceptionList . toArray ( exceptions ) ; node = node . getNextSibling ( ) ; } assertNodeType ( SLIST , node ) ; boolean syntheticPublic = ( ( modifiers & Opcodes . ACC_SYNTHETIC ) != <NUM_LIT:0> ) ; modifiers &= ~ Opcodes . ACC_SYNTHETIC ; ConstructorNode constructorNode = classNode . addConstructor ( modifiers , parameters , exceptions , null ) ; MethodNode oldMethod = methodNode ; methodNode = constructorNode ; Statement code = statementList ( node ) ; methodNode = oldMethod ; constructorNode . setCode ( code ) ; constructorNode . setSyntheticPublic ( syntheticPublic ) ; constructorNode . addAnnotations ( annotations ) ; configureAST ( constructorNode , constructorDef ) ; constructorNode . setNameStart ( nameStart ) ; constructorNode . setNameEnd ( nameEnd ) ; } protected void fieldDef ( AST fieldDef ) { List < AnnotationNode > annotations = new ArrayList < AnnotationNode > ( ) ; AST node = fieldDef . getFirstChild ( ) ; int modifiers = <NUM_LIT:0> ; if ( isType ( MODIFIERS , node ) ) { modifiers = modifiers ( node , annotations , modifiers ) ; node = node . getNextSibling ( ) ; } if ( classNode . isInterface ( ) ) { modifiers |= Opcodes . ACC_STATIC | Opcodes . ACC_FINAL ; if ( ( modifiers & ( Opcodes . ACC_PRIVATE | Opcodes . ACC_PROTECTED ) ) == <NUM_LIT:0> ) { modifiers |= Opcodes . ACC_PUBLIC ; } } ClassNode type = null ; if ( isType ( TYPE , node ) ) { type = makeTypeWithArguments ( node ) ; node = node . getNextSibling ( ) ; } String name = identifier ( node ) ; GroovySourceAST groovySourceAST = ( GroovySourceAST ) node ; int nameStart = locations . findOffset ( groovySourceAST . getLine ( ) , groovySourceAST . getColumn ( ) ) ; int nameEnd = nameStart + name . length ( ) - <NUM_LIT:1> ; node = node . getNextSibling ( ) ; Expression initialValue = null ; if ( node != null ) { assertNodeType ( ASSIGN , node ) ; initialValue = expression ( node . getFirstChild ( ) ) ; } if ( classNode . isInterface ( ) && initialValue == null && type != null ) { if ( type == ClassHelper . int_TYPE ) { initialValue = new ConstantExpression ( <NUM_LIT:0> ) ; } else if ( type == ClassHelper . long_TYPE ) { initialValue = new ConstantExpression ( <NUM_LIT> ) ; } else if ( type == ClassHelper . double_TYPE ) { initialValue = new ConstantExpression ( <NUM_LIT:0.0> ) ; } else if ( type == ClassHelper . float_TYPE ) { initialValue = new ConstantExpression ( <NUM_LIT> ) ; } else if ( type == ClassHelper . boolean_TYPE ) { initialValue = ConstantExpression . FALSE ; } else if ( type == ClassHelper . short_TYPE ) { initialValue = new ConstantExpression ( ( short ) <NUM_LIT:0> ) ; } else if ( type == ClassHelper . byte_TYPE ) { initialValue = new ConstantExpression ( ( byte ) <NUM_LIT:0> ) ; } else if ( type == ClassHelper . char_TYPE ) { initialValue = new ConstantExpression ( ( char ) <NUM_LIT:0> ) ; } } FieldNode fieldNode = new FieldNode ( name , modifiers , type , classNode , initialValue ) ; fieldNode . addAnnotations ( annotations ) ; configureAST ( fieldNode , fieldDef ) ; fieldNode . setNameStart ( nameStart ) ; fieldNode . setNameEnd ( nameEnd ) ; if ( ! hasVisibility ( modifiers ) ) { int fieldModifiers = <NUM_LIT:0> ; int flags = Opcodes . ACC_STATIC | Opcodes . ACC_TRANSIENT | Opcodes . ACC_VOLATILE | Opcodes . ACC_FINAL ; if ( ! hasVisibility ( modifiers ) ) { modifiers |= Opcodes . ACC_PUBLIC ; fieldModifiers |= Opcodes . ACC_PRIVATE ; } fieldModifiers |= ( modifiers & flags ) ; fieldNode . setModifiers ( fieldModifiers ) ; fieldNode . setSynthetic ( true ) ; FieldNode storedNode = classNode . getDeclaredField ( fieldNode . getName ( ) ) ; if ( storedNode != null && ! classNode . hasProperty ( name ) ) { fieldNode = storedNode ; classNode . getFields ( ) . remove ( storedNode ) ; } PropertyNode propertyNode = new PropertyNode ( fieldNode , modifiers , null , null ) ; configureAST ( propertyNode , fieldDef ) ; classNode . addProperty ( propertyNode ) ; } else { fieldNode . setModifiers ( modifiers ) ; PropertyNode pn = classNode . getProperty ( name ) ; if ( pn != null && pn . getField ( ) . isSynthetic ( ) ) { classNode . getFields ( ) . remove ( pn . getField ( ) ) ; pn . setField ( fieldNode ) ; } classNode . addField ( fieldNode ) ; } } protected ClassNode [ ] interfaces ( AST node ) { List < ClassNode > interfaceList = new ArrayList < ClassNode > ( ) ; for ( AST implementNode = node . getFirstChild ( ) ; implementNode != null ; implementNode = implementNode . getNextSibling ( ) ) { ClassNode cn = makeTypeWithArguments ( implementNode ) ; configureAST ( cn , implementNode ) ; interfaceList . add ( cn ) ; } ClassNode [ ] interfaces = ClassNode . EMPTY_ARRAY ; if ( ! interfaceList . isEmpty ( ) ) { interfaces = new ClassNode [ interfaceList . size ( ) ] ; interfaceList . toArray ( interfaces ) ; } return interfaces ; } protected Parameter [ ] parameters ( AST parametersNode ) { AST node = parametersNode . getFirstChild ( ) ; firstParam = false ; firstParamIsVarArg = false ; if ( node == null ) { if ( isType ( IMPLICIT_PARAMETERS , parametersNode ) ) return Parameter . EMPTY_ARRAY ; return null ; } else { List < Parameter > parameters = new ArrayList < Parameter > ( ) ; AST firstParameterNode = null ; do { firstParam = ( firstParameterNode == null ) ; if ( firstParameterNode == null ) firstParameterNode = node ; parameters . add ( parameter ( node ) ) ; node = node . getNextSibling ( ) ; } while ( node != null ) ; verifyParameters ( parameters , firstParameterNode ) ; Parameter [ ] answer = new Parameter [ parameters . size ( ) ] ; parameters . toArray ( answer ) ; return answer ; } } private void verifyParameters ( List < Parameter > parameters , AST firstParameterNode ) { if ( parameters . size ( ) <= <NUM_LIT:1> ) return ; Parameter first = parameters . get ( <NUM_LIT:0> ) ; if ( firstParamIsVarArg ) { throw new ASTRuntimeException ( firstParameterNode , "<STR_LIT>" + first . getName ( ) + "<STR_LIT>" ) ; } } protected Parameter parameter ( AST paramNode ) { List < AnnotationNode > annotations = new ArrayList < AnnotationNode > ( ) ; boolean variableParameterDef = isType ( VARIABLE_PARAMETER_DEF , paramNode ) ; AST node = paramNode . getFirstChild ( ) ; int modifiers = <NUM_LIT:0> ; if ( isType ( MODIFIERS , node ) ) { modifiers = modifiers ( node , annotations , modifiers ) ; node = node . getNextSibling ( ) ; } ClassNode type = ClassHelper . DYNAMIC_TYPE ; if ( isType ( TYPE , node ) ) { type = makeTypeWithArguments ( node ) ; if ( variableParameterDef ) type = type . makeArray ( ) ; node = node . getNextSibling ( ) ; } String name = identifier ( node ) ; GroovySourceAST groovySourceAST = ( GroovySourceAST ) node ; int nameStart = locations . findOffset ( groovySourceAST . getLine ( ) , groovySourceAST . getColumn ( ) ) ; int nameEnd = nameStart + name . length ( ) ; node = node . getNextSibling ( ) ; VariableExpression leftExpression = new VariableExpression ( name , type ) ; leftExpression . setModifiers ( modifiers ) ; configureAST ( leftExpression , paramNode ) ; Parameter parameter = null ; if ( node != null ) { assertNodeType ( ASSIGN , node ) ; Expression rightExpression = expression ( node . getFirstChild ( ) ) ; if ( isAnInterface ( ) ) { throw new ASTRuntimeException ( node , "<STR_LIT>" + name + "<STR_LIT:U+0020=U+0020>" + rightExpression . getText ( ) + "<STR_LIT>" ) ; } parameter = new Parameter ( type , name , rightExpression ) ; } else parameter = new Parameter ( type , name ) ; if ( firstParam ) firstParamIsVarArg = variableParameterDef ; configureAST ( parameter , paramNode ) ; parameter . setNameStart ( nameStart ) ; parameter . setNameEnd ( nameEnd ) ; parameter . addAnnotations ( annotations ) ; parameter . setModifiers ( modifiers ) ; return parameter ; } protected int modifiers ( AST modifierNode , List < AnnotationNode > annotations , int defaultModifiers ) { assertNodeType ( MODIFIERS , modifierNode ) ; boolean access = false ; int answer = <NUM_LIT:0> ; for ( AST node = modifierNode . getFirstChild ( ) ; node != null ; node = node . getNextSibling ( ) ) { int type = node . getType ( ) ; switch ( type ) { case STATIC_IMPORT : break ; case ANNOTATION : annotations . add ( annotation ( node ) ) ; break ; case LITERAL_private : answer = setModifierBit ( node , answer , Opcodes . ACC_PRIVATE ) ; access = setAccessTrue ( node , access ) ; break ; case LITERAL_protected : answer = setModifierBit ( node , answer , Opcodes . ACC_PROTECTED ) ; access = setAccessTrue ( node , access ) ; break ; case LITERAL_public : answer = setModifierBit ( node , answer , Opcodes . ACC_PUBLIC ) ; access = setAccessTrue ( node , access ) ; break ; case ABSTRACT : answer = setModifierBit ( node , answer , Opcodes . ACC_ABSTRACT ) ; break ; case FINAL : answer = setModifierBit ( node , answer , Opcodes . ACC_FINAL ) ; break ; case LITERAL_native : answer = setModifierBit ( node , answer , Opcodes . ACC_NATIVE ) ; break ; case LITERAL_static : answer = setModifierBit ( node , answer , Opcodes . ACC_STATIC ) ; break ; case STRICTFP : answer = setModifierBit ( node , answer , Opcodes . ACC_STRICT ) ; break ; case LITERAL_synchronized : answer = setModifierBit ( node , answer , Opcodes . ACC_SYNCHRONIZED ) ; break ; case LITERAL_transient : answer = setModifierBit ( node , answer , Opcodes . ACC_TRANSIENT ) ; break ; case LITERAL_volatile : answer = setModifierBit ( node , answer , Opcodes . ACC_VOLATILE ) ; break ; default : unknownAST ( node ) ; } } if ( ! access ) { answer |= defaultModifiers ; if ( defaultModifiers == Opcodes . ACC_PUBLIC ) answer |= Opcodes . ACC_SYNTHETIC ; } return answer ; } protected boolean setAccessTrue ( AST node , boolean access ) { if ( ! access ) { return true ; } else { throw new ASTRuntimeException ( node , "<STR_LIT>" + node . getText ( ) + "<STR_LIT>" ) ; } } protected int setModifierBit ( AST node , int answer , int bit ) { if ( ( answer & bit ) != <NUM_LIT:0> ) { throw new ASTRuntimeException ( node , "<STR_LIT>" + node . getText ( ) ) ; } return answer | bit ; } protected AnnotationNode annotation ( AST annotationNode ) { AST node = annotationNode . getFirstChild ( ) ; String name = qualifiedName ( node ) ; AnnotationNode annotatedNode = new AnnotationNode ( ClassHelper . make ( name ) ) ; configureAnnotationAST ( annotatedNode , annotationNode ) ; while ( true ) { node = node . getNextSibling ( ) ; if ( isType ( ANNOTATION_MEMBER_VALUE_PAIR , node ) ) { AST memberNode = node . getFirstChild ( ) ; String param = identifier ( memberNode ) ; Expression expression = expression ( memberNode . getNextSibling ( ) ) ; if ( annotatedNode . getMember ( param ) != null ) { throw new ASTRuntimeException ( memberNode , "<STR_LIT>" + param + "<STR_LIT>" ) ; } annotatedNode . setMember ( param , expression ) ; } else { break ; } } return annotatedNode ; } protected Statement statement ( AST node ) { if ( node == null ) { return new EmptyStatement ( ) ; } Statement statement = null ; int type = node . getType ( ) ; switch ( type ) { case SLIST : case LITERAL_finally : statement = statementList ( node ) ; break ; case METHOD_CALL : statement = methodCall ( node ) ; break ; case VARIABLE_DEF : statement = variableDef ( node ) ; break ; case LABELED_STAT : return labelledStatement ( node ) ; case LITERAL_assert : statement = assertStatement ( node ) ; break ; case LITERAL_break : statement = breakStatement ( node ) ; break ; case LITERAL_continue : statement = continueStatement ( node ) ; break ; case LITERAL_if : statement = ifStatement ( node ) ; break ; case LITERAL_for : statement = forStatement ( node ) ; break ; case LITERAL_return : statement = returnStatement ( node ) ; break ; case LITERAL_synchronized : statement = synchronizedStatement ( node ) ; break ; case LITERAL_switch : statement = switchStatement ( node ) ; break ; case LITERAL_try : statement = tryStatement ( node ) ; break ; case LITERAL_throw : statement = throwStatement ( node ) ; break ; case LITERAL_while : statement = whileStatement ( node ) ; break ; default : statement = new ExpressionStatement ( expression ( node ) ) ; } if ( statement != null ) { configureAST ( statement , node ) ; } return statement ; } protected Statement statementList ( AST code ) { return statementListNoChild ( code . getFirstChild ( ) , code ) ; } protected Statement statementListNoChild ( AST node , AST alternativeConfigureNode ) { BlockStatement block = new BlockStatement ( ) ; if ( alternativeConfigureNode != null ) { configureAST ( block , alternativeConfigureNode ) ; } else if ( node != null ) { configureAST ( block , node ) ; } for ( ; node != null ; node = node . getNextSibling ( ) ) { block . addStatement ( statement ( node ) ) ; } return block ; } protected Statement assertStatement ( AST assertNode ) { AST node = assertNode . getFirstChild ( ) ; BooleanExpression booleanExpression = booleanExpression ( node ) ; Expression messageExpression = null ; node = node . getNextSibling ( ) ; if ( node != null ) { messageExpression = expression ( node ) ; } else { messageExpression = ConstantExpression . NULL ; } AssertStatement assertStatement = new AssertStatement ( booleanExpression , messageExpression ) ; configureAST ( assertStatement , assertNode ) ; return assertStatement ; } protected Statement breakStatement ( AST node ) { BreakStatement breakStatement = new BreakStatement ( label ( node ) ) ; configureAST ( breakStatement , node ) ; return breakStatement ; } protected Statement continueStatement ( AST node ) { ContinueStatement continueStatement = new ContinueStatement ( label ( node ) ) ; configureAST ( continueStatement , node ) ; return continueStatement ; } protected Statement forStatement ( AST forNode ) { AST inNode = forNode . getFirstChild ( ) ; Expression collectionExpression ; Parameter forParameter ; if ( isType ( CLOSURE_LIST , inNode ) ) { forStatementBeingDef = true ; ClosureListExpression clist = closureListExpression ( inNode ) ; forStatementBeingDef = false ; int size = clist . getExpressions ( ) . size ( ) ; if ( size != <NUM_LIT:3> ) { throw new ASTRuntimeException ( inNode , "<STR_LIT>" + size ) ; } collectionExpression = clist ; forParameter = ForStatement . FOR_LOOP_DUMMY ; } else { AST variableNode = inNode . getFirstChild ( ) ; AST collectionNode = variableNode . getNextSibling ( ) ; ClassNode type = ClassHelper . OBJECT_TYPE ; if ( isType ( VARIABLE_DEF , variableNode ) ) { AST node = variableNode . getFirstChild ( ) ; if ( isType ( MODIFIERS , node ) ) { int modifiersMask = modifiers ( node , new ArrayList < AnnotationNode > ( ) , <NUM_LIT:0> ) ; if ( ( modifiersMask & ~ Opcodes . ACC_FINAL ) != <NUM_LIT:0> ) { throw new ASTRuntimeException ( node , "<STR_LIT>" ) ; } node = node . getNextSibling ( ) ; } type = makeTypeWithArguments ( node ) ; variableNode = node . getNextSibling ( ) ; } String variable = identifier ( variableNode ) ; collectionExpression = expression ( collectionNode ) ; forParameter = new Parameter ( type , variable ) ; configureAST ( forParameter , variableNode ) ; forParameter . setNameStart ( forParameter . getStart ( ) ) ; forParameter . setNameEnd ( forParameter . getEnd ( ) ) ; } final AST node = inNode . getNextSibling ( ) ; Statement block ; if ( isType ( SEMI , node ) ) { block = EmptyStatement . INSTANCE ; } else { block = statement ( node ) ; } ForStatement forStatement = new ForStatement ( forParameter , collectionExpression , block ) ; configureAST ( forStatement , forNode ) ; return forStatement ; } protected Statement ifStatement ( AST ifNode ) { AST node = ifNode . getFirstChild ( ) ; assertNodeType ( EXPR , node ) ; BooleanExpression booleanExpression = booleanExpression ( node ) ; node = node . getNextSibling ( ) ; Statement ifBlock = statement ( node ) ; Statement elseBlock = EmptyStatement . INSTANCE ; if ( node != null ) { node = node . getNextSibling ( ) ; if ( node != null ) { elseBlock = statement ( node ) ; } } IfStatement ifStatement = new IfStatement ( booleanExpression , ifBlock , elseBlock ) ; configureAST ( ifStatement , ifNode ) ; return ifStatement ; } protected Statement labelledStatement ( AST labelNode ) { AST node = labelNode . getFirstChild ( ) ; String label = identifier ( node ) ; Statement statement = statement ( node . getNextSibling ( ) ) ; if ( statement . getStatementLabel ( ) == null ) statement . setStatementLabel ( label ) ; return statement ; } protected Statement methodCall ( AST code ) { Expression expression = methodCallExpression ( code ) ; ExpressionStatement expressionStatement = new ExpressionStatement ( expression ) ; configureAST ( expressionStatement , code ) ; return expressionStatement ; } protected Expression declarationExpression ( AST variableDef ) { AST node = variableDef . getFirstChild ( ) ; ClassNode type = null ; List < AnnotationNode > annotations = new ArrayList < AnnotationNode > ( ) ; int modifiers = <NUM_LIT:0> ; if ( isType ( MODIFIERS , node ) ) { modifiers = modifiers ( node , annotations , <NUM_LIT:0> ) ; node = node . getNextSibling ( ) ; } if ( isType ( TYPE , node ) ) { type = makeTypeWithArguments ( node ) ; node = node . getNextSibling ( ) ; } Expression leftExpression ; Expression rightExpression = EmptyExpression . INSTANCE ; AST right ; if ( isType ( ASSIGN , node ) ) { node = node . getFirstChild ( ) ; AST left = node . getFirstChild ( ) ; ArgumentListExpression alist = new ArgumentListExpression ( ) ; for ( AST varDef = left ; varDef != null ; varDef = varDef . getNextSibling ( ) ) { assertNodeType ( VARIABLE_DEF , varDef ) ; DeclarationExpression de = ( DeclarationExpression ) declarationExpression ( varDef ) ; alist . addExpression ( de . getVariableExpression ( ) ) ; } leftExpression = alist ; right = node . getNextSibling ( ) ; if ( right != null ) rightExpression = expression ( right ) ; } else { String name = identifier ( node ) ; VariableExpression ve = new VariableExpression ( name , type ) ; ve . setModifiers ( modifiers ) ; leftExpression = ve ; right = node . getNextSibling ( ) ; if ( right != null ) { assertNodeType ( ASSIGN , right ) ; rightExpression = expression ( right . getFirstChild ( ) ) ; } } configureAST ( leftExpression , node ) ; Token token = makeToken ( Types . ASSIGN , variableDef ) ; DeclarationExpression expression = new DeclarationExpression ( leftExpression , token , rightExpression ) ; expression . addAnnotations ( annotations ) ; configureAST ( expression , variableDef ) ; ExpressionStatement expressionStatement = new ExpressionStatement ( expression ) ; configureAST ( expressionStatement , variableDef ) ; return expression ; } protected Statement variableDef ( AST variableDef ) { ExpressionStatement expressionStatement = new ExpressionStatement ( declarationExpression ( variableDef ) ) ; configureAST ( expressionStatement , variableDef ) ; return expressionStatement ; } protected Statement returnStatement ( AST node ) { AST exprNode = node . getFirstChild ( ) ; Expression expression = exprNode == null ? ConstantExpression . NULL : expression ( exprNode ) ; ReturnStatement returnStatement = new ReturnStatement ( expression ) ; configureAST ( returnStatement , node ) ; return returnStatement ; } protected Statement switchStatement ( AST switchNode ) { AST node = switchNode . getFirstChild ( ) ; Expression expression = expression ( node ) ; Statement defaultStatement = EmptyStatement . INSTANCE ; List list = new ArrayList ( ) ; for ( node = node . getNextSibling ( ) ; isType ( CASE_GROUP , node ) ; node = node . getNextSibling ( ) ) { Statement tmpDefaultStatement ; AST child = node . getFirstChild ( ) ; if ( isType ( LITERAL_case , child ) ) { List cases = new LinkedList ( ) ; tmpDefaultStatement = caseStatements ( child , cases ) ; list . addAll ( cases ) ; } else { tmpDefaultStatement = statement ( child . getNextSibling ( ) ) ; } if ( tmpDefaultStatement != EmptyStatement . INSTANCE ) { if ( defaultStatement == EmptyStatement . INSTANCE ) { defaultStatement = tmpDefaultStatement ; } else { throw new ASTRuntimeException ( switchNode , "<STR_LIT>" ) ; } } } if ( node != null ) { unknownAST ( node ) ; } SwitchStatement switchStatement = new SwitchStatement ( expression , list , defaultStatement ) ; configureAST ( switchStatement , switchNode ) ; return switchStatement ; } protected Statement caseStatements ( AST node , List cases ) { List < Expression > expressions = new LinkedList < Expression > ( ) ; Statement statement = EmptyStatement . INSTANCE ; Statement defaultStatement = EmptyStatement . INSTANCE ; AST nextSibling = node ; do { Expression expression = expression ( nextSibling . getFirstChild ( ) ) ; expressions . add ( expression ) ; nextSibling = nextSibling . getNextSibling ( ) ; } while ( isType ( LITERAL_case , nextSibling ) ) ; if ( nextSibling != null ) { if ( isType ( LITERAL_default , nextSibling ) ) { defaultStatement = statement ( nextSibling . getNextSibling ( ) ) ; statement = EmptyStatement . INSTANCE ; } else { statement = statement ( nextSibling ) ; } } Iterator iterator = expressions . iterator ( ) ; while ( iterator . hasNext ( ) ) { Expression expr = ( Expression ) iterator . next ( ) ; Statement stmt ; if ( iterator . hasNext ( ) ) { stmt = new CaseStatement ( expr , EmptyStatement . INSTANCE ) ; } else { stmt = new CaseStatement ( expr , statement ) ; } configureAST ( stmt , node ) ; cases . add ( stmt ) ; } return defaultStatement ; } protected Statement synchronizedStatement ( AST syncNode ) { AST node = syncNode . getFirstChild ( ) ; Expression expression = expression ( node ) ; Statement code = statement ( node . getNextSibling ( ) ) ; SynchronizedStatement synchronizedStatement = new SynchronizedStatement ( expression , code ) ; configureAST ( synchronizedStatement , syncNode ) ; return synchronizedStatement ; } protected Statement throwStatement ( AST node ) { AST expressionNode = node . getFirstChild ( ) ; if ( expressionNode == null ) { expressionNode = node . getNextSibling ( ) ; } if ( expressionNode == null ) { throw new ASTRuntimeException ( node , "<STR_LIT>" ) ; } ThrowStatement throwStatement = new ThrowStatement ( expression ( expressionNode ) ) ; configureAST ( throwStatement , node ) ; return throwStatement ; } protected Statement tryStatement ( AST tryStatementNode ) { AST tryNode = tryStatementNode . getFirstChild ( ) ; Statement tryStatement = statement ( tryNode ) ; Statement finallyStatement = EmptyStatement . INSTANCE ; AST node = tryNode . getNextSibling ( ) ; List < CatchStatement > catches = new ArrayList < CatchStatement > ( ) ; for ( ; node != null && isType ( LITERAL_catch , node ) ; node = node . getNextSibling ( ) ) { final List < CatchStatement > catchStatements = catchStatement ( node ) ; catches . addAll ( catchStatements ) ; } if ( isType ( LITERAL_finally , node ) ) { finallyStatement = statement ( node ) ; node = node . getNextSibling ( ) ; } if ( finallyStatement instanceof EmptyStatement && catches . size ( ) == <NUM_LIT:0> ) { throw new ASTRuntimeException ( tryStatementNode , "<STR_LIT>" ) ; } TryCatchStatement tryCatchStatement = new TryCatchStatement ( tryStatement , finallyStatement ) ; configureAST ( tryCatchStatement , tryStatementNode ) ; for ( CatchStatement statement : catches ) { tryCatchStatement . addCatch ( statement ) ; } return tryCatchStatement ; } protected List < CatchStatement > catchStatement ( AST catchNode ) { AST node = catchNode . getFirstChild ( ) ; List < CatchStatement > catches = new LinkedList < CatchStatement > ( ) ; Statement code = statement ( node . getNextSibling ( ) ) ; if ( MULTICATCH == node . getType ( ) ) { AST variableNode = node . getNextSibling ( ) ; final AST multicatches = node . getFirstChild ( ) ; if ( multicatches . getType ( ) != MULTICATCH_TYPES ) { String variable = identifier ( multicatches ) ; Parameter catchParameter = new Parameter ( ClassHelper . DYNAMIC_TYPE , variable ) ; configureAST ( catchParameter , multicatches ) ; CatchStatement answer = new CatchStatement ( catchParameter , code ) ; configureAST ( answer , catchNode ) ; catches . add ( answer ) ; } else { AST exceptionNodes = multicatches . getFirstChild ( ) ; String variable = identifier ( multicatches . getNextSibling ( ) ) ; while ( exceptionNodes != null ) { ClassNode exceptionType = buildName ( exceptionNodes ) ; Parameter catchParameter = new Parameter ( exceptionType , variable ) ; configureAST ( catchParameter , multicatches ) ; GroovySourceAST paramAST = ( GroovySourceAST ) multicatches . getNextSibling ( ) ; int lastLine = paramAST . getLineLast ( ) ; catchParameter . setLastLineNumber ( lastLine ) ; int lastCol = paramAST . getColumnLast ( ) ; catchParameter . setLastColumnNumber ( lastCol ) ; catchParameter . setEnd ( locations . findOffset ( lastLine , lastCol ) ) ; CatchStatement answer = new CatchStatement ( catchParameter , code ) ; configureAST ( answer , catchNode ) ; catches . add ( answer ) ; exceptionNodes = exceptionNodes . getNextSibling ( ) ; } } } return catches ; } protected Statement whileStatement ( AST whileNode ) { AST node = whileNode . getFirstChild ( ) ; assertNodeType ( EXPR , node ) ; if ( isType ( VARIABLE_DEF , node . getFirstChild ( ) ) ) { throw new ASTRuntimeException ( whileNode , "<STR_LIT>" ) ; } BooleanExpression booleanExpression = booleanExpression ( node ) ; node = node . getNextSibling ( ) ; Statement block ; if ( isType ( SEMI , node ) ) { block = EmptyStatement . INSTANCE ; } else { block = statement ( node ) ; } WhileStatement whileStatement = new WhileStatement ( booleanExpression , block ) ; configureAST ( whileStatement , whileNode ) ; return whileStatement ; } protected Expression expression ( AST node ) { return expression ( node , false ) ; } protected Expression expression ( AST node , boolean convertToConstant ) { if ( node == null ) { return new ConstantExpression ( "<STR_LIT>" ) ; } Expression expression = expressionSwitch ( node ) ; if ( convertToConstant && expression instanceof VariableExpression ) { VariableExpression ve = ( VariableExpression ) expression ; if ( ! ve . isThisExpression ( ) && ! ve . isSuperExpression ( ) ) { expression = new ConstantExpression ( ve . getName ( ) ) ; } } configureAST ( expression , node ) ; return expression ; } protected Expression expressionSwitch ( AST node ) { int type = node . getType ( ) ; switch ( type ) { case EXPR : Expression expression = expression ( node . getFirstChild ( ) ) ; if ( expression instanceof BinaryExpression ) { configureAST ( expression , node ) ; } return expression ; case ELIST : return expressionList ( node ) ; case SLIST : return blockExpression ( node ) ; case CLOSABLE_BLOCK : return closureExpression ( node ) ; case SUPER_CTOR_CALL : return specialConstructorCallExpression ( node , ClassNode . SUPER ) ; case METHOD_CALL : return methodCallExpression ( node ) ; case LITERAL_new : return constructorCallExpression ( node ) ; case CTOR_CALL : return specialConstructorCallExpression ( node , ClassNode . THIS ) ; case QUESTION : case ELVIS_OPERATOR : return ternaryExpression ( node ) ; case OPTIONAL_DOT : case SPREAD_DOT : case DOT : return dotExpression ( node ) ; case IDENT : case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_double : case LITERAL_float : case LITERAL_int : case LITERAL_long : case LITERAL_short : case LITERAL_void : case LITERAL_this : case LITERAL_super : return variableExpression ( node ) ; case LIST_CONSTRUCTOR : return listExpression ( node ) ; case MAP_CONSTRUCTOR : return mapExpression ( node ) ; case LABELED_ARG : return mapEntryExpression ( node ) ; case SPREAD_ARG : return spreadExpression ( node ) ; case SPREAD_MAP_ARG : return spreadMapExpression ( node ) ; case MEMBER_POINTER : return methodPointerExpression ( node ) ; case INDEX_OP : return indexExpression ( node ) ; case LITERAL_instanceof : return instanceofExpression ( node ) ; case LITERAL_as : return asExpression ( node ) ; case TYPECAST : return castExpression ( node ) ; case LITERAL_true : return literalExpression ( node , Boolean . TRUE ) ; case LITERAL_false : return literalExpression ( node , Boolean . FALSE ) ; case LITERAL_null : return literalExpression ( node , null ) ; case STRING_LITERAL : return literalExpression ( node , node . getText ( ) ) ; case STRING_CONSTRUCTOR : return gstring ( node ) ; case NUM_DOUBLE : case NUM_FLOAT : case NUM_BIG_DECIMAL : return decimalExpression ( node ) ; case NUM_BIG_INT : case NUM_INT : case NUM_LONG : return integerExpression ( node ) ; case LNOT : NotExpression notExpression = new NotExpression ( expression ( node . getFirstChild ( ) ) ) ; configureAST ( notExpression , node ) ; return notExpression ; case UNARY_MINUS : return unaryMinusExpression ( node ) ; case BNOT : BitwiseNegationExpression bitwiseNegationExpression = new BitwiseNegationExpression ( expression ( node . getFirstChild ( ) ) ) ; configureAST ( bitwiseNegationExpression , node ) ; return bitwiseNegationExpression ; case UNARY_PLUS : return unaryPlusExpression ( node ) ; case INC : return prefixExpression ( node , Types . PLUS_PLUS ) ; case DEC : return prefixExpression ( node , Types . MINUS_MINUS ) ; case POST_INC : return postfixExpression ( node , Types . PLUS_PLUS ) ; case POST_DEC : return postfixExpression ( node , Types . MINUS_MINUS ) ; case ASSIGN : return binaryExpression ( Types . ASSIGN , node ) ; case EQUAL : return binaryExpression ( Types . COMPARE_EQUAL , node ) ; case IDENTICAL : return binaryExpression ( Types . COMPARE_IDENTICAL , node ) ; case NOT_EQUAL : return binaryExpression ( Types . COMPARE_NOT_EQUAL , node ) ; case NOT_IDENTICAL : return binaryExpression ( Types . COMPARE_NOT_IDENTICAL , node ) ; case COMPARE_TO : return binaryExpression ( Types . COMPARE_TO , node ) ; case LE : return binaryExpression ( Types . COMPARE_LESS_THAN_EQUAL , node ) ; case LT : return binaryExpression ( Types . COMPARE_LESS_THAN , node ) ; case GT : return binaryExpression ( Types . COMPARE_GREATER_THAN , node ) ; case GE : return binaryExpression ( Types . COMPARE_GREATER_THAN_EQUAL , node ) ; case LAND : return binaryExpression ( Types . LOGICAL_AND , node ) ; case LOR : return binaryExpression ( Types . LOGICAL_OR , node ) ; case BAND : return binaryExpression ( Types . BITWISE_AND , node ) ; case BAND_ASSIGN : return binaryExpression ( Types . BITWISE_AND_EQUAL , node ) ; case BOR : return binaryExpression ( Types . BITWISE_OR , node ) ; case BOR_ASSIGN : return binaryExpression ( Types . BITWISE_OR_EQUAL , node ) ; case BXOR : return binaryExpression ( Types . BITWISE_XOR , node ) ; case BXOR_ASSIGN : return binaryExpression ( Types . BITWISE_XOR_EQUAL , node ) ; case PLUS : return binaryExpression ( Types . PLUS , node ) ; case PLUS_ASSIGN : return binaryExpression ( Types . PLUS_EQUAL , node ) ; case MINUS : return binaryExpression ( Types . MINUS , node ) ; case MINUS_ASSIGN : return binaryExpression ( Types . MINUS_EQUAL , node ) ; case STAR : return binaryExpression ( Types . MULTIPLY , node ) ; case STAR_ASSIGN : return binaryExpression ( Types . MULTIPLY_EQUAL , node ) ; case STAR_STAR : return binaryExpression ( Types . POWER , node ) ; case STAR_STAR_ASSIGN : return binaryExpression ( Types . POWER_EQUAL , node ) ; case DIV : return binaryExpression ( Types . DIVIDE , node ) ; case DIV_ASSIGN : return binaryExpression ( Types . DIVIDE_EQUAL , node ) ; case MOD : return binaryExpression ( Types . MOD , node ) ; case MOD_ASSIGN : return binaryExpression ( Types . MOD_EQUAL , node ) ; case SL : return binaryExpression ( Types . LEFT_SHIFT , node ) ; case SL_ASSIGN : return binaryExpression ( Types . LEFT_SHIFT_EQUAL , node ) ; case SR : return binaryExpression ( Types . RIGHT_SHIFT , node ) ; case SR_ASSIGN : return binaryExpression ( Types . RIGHT_SHIFT_EQUAL , node ) ; case BSR : return binaryExpression ( Types . RIGHT_SHIFT_UNSIGNED , node ) ; case BSR_ASSIGN : return binaryExpression ( Types . RIGHT_SHIFT_UNSIGNED_EQUAL , node ) ; case VARIABLE_DEF : return declarationExpression ( node ) ; case REGEX_FIND : return binaryExpression ( Types . FIND_REGEX , node ) ; case REGEX_MATCH : return binaryExpression ( Types . MATCH_REGEX , node ) ; case RANGE_INCLUSIVE : return rangeExpression ( node , true ) ; case RANGE_EXCLUSIVE : return rangeExpression ( node , false ) ; case DYNAMIC_MEMBER : return dynamicMemberExpression ( node ) ; case LITERAL_in : return binaryExpression ( Types . KEYWORD_IN , node ) ; case ANNOTATION : return new AnnotationConstantExpression ( annotation ( node ) ) ; case CLOSURE_LIST : return closureListExpression ( node ) ; case LBRACK : case LPAREN : return tupleExpression ( node ) ; case OBJBLOCK : return anonymousInnerClassDef ( node ) ; default : return unknownAST ( node ) ; } } private TupleExpression tupleExpression ( AST node ) { TupleExpression exp = new TupleExpression ( ) ; configureAST ( exp , node ) ; node = node . getFirstChild ( ) ; while ( node != null ) { assertNodeType ( VARIABLE_DEF , node ) ; AST nameNode = node . getFirstChild ( ) . getNextSibling ( ) ; VariableExpression varExp = new VariableExpression ( nameNode . getText ( ) ) ; configureAST ( varExp , nameNode ) ; exp . addExpression ( varExp ) ; node = node . getNextSibling ( ) ; } return exp ; } private ClosureListExpression closureListExpression ( AST node ) { isClosureListExpressionAllowedHere ( node ) ; AST exprNode = node . getFirstChild ( ) ; List < Expression > list = new LinkedList < Expression > ( ) ; while ( exprNode != null ) { if ( isType ( EXPR , exprNode ) ) { Expression expr = expression ( exprNode ) ; configureAST ( expr , exprNode ) ; list . add ( expr ) ; } else { assertNodeType ( EMPTY_STAT , exprNode ) ; list . add ( EmptyExpression . INSTANCE ) ; } exprNode = exprNode . getNextSibling ( ) ; } ClosureListExpression cle = new ClosureListExpression ( list ) ; configureAST ( cle , node ) ; return cle ; } private void isClosureListExpressionAllowedHere ( AST node ) { if ( ! forStatementBeingDef ) { throw new ASTRuntimeException ( node , "<STR_LIT>" ) ; } } protected Expression dynamicMemberExpression ( AST dynamicMemberNode ) { AST node = dynamicMemberNode . getFirstChild ( ) ; return expression ( node ) ; } protected Expression ternaryExpression ( AST ternaryNode ) { AST node = ternaryNode . getFirstChild ( ) ; Expression base = expression ( node ) ; node = node . getNextSibling ( ) ; Expression left = expression ( node ) ; node = node . getNextSibling ( ) ; Expression ret ; if ( node == null ) { ret = new ElvisOperatorExpression ( base , left ) ; } else { Expression right = expression ( node ) ; BooleanExpression booleanExpression = new BooleanExpression ( base ) ; booleanExpression . setSourcePosition ( base ) ; ret = new TernaryExpression ( booleanExpression , left , right ) ; } configureAST ( ret , ternaryNode ) ; return ret ; } protected Expression variableExpression ( AST node ) { String text = node . getText ( ) ; VariableExpression variableExpression = new VariableExpression ( text ) ; configureAST ( variableExpression , node ) ; return variableExpression ; } protected Expression literalExpression ( AST node , Object value ) { ConstantExpression constantExpression = new ConstantExpression ( value , value instanceof Boolean ) ; configureAST ( constantExpression , node ) ; return constantExpression ; } protected Expression rangeExpression ( AST rangeNode , boolean inclusive ) { AST node = rangeNode . getFirstChild ( ) ; Expression left = expression ( node ) ; Expression right = expression ( node . getNextSibling ( ) ) ; RangeExpression rangeExpression = new RangeExpression ( left , right , inclusive ) ; configureAST ( rangeExpression , rangeNode ) ; return rangeExpression ; } protected Expression spreadExpression ( AST node ) { AST exprNode = node . getFirstChild ( ) ; AST listNode = exprNode . getFirstChild ( ) ; Expression right = expression ( listNode ) ; SpreadExpression spreadExpression = new SpreadExpression ( right ) ; configureAST ( spreadExpression , node ) ; return spreadExpression ; } protected Expression spreadMapExpression ( AST node ) { AST exprNode = node . getFirstChild ( ) ; Expression expr = expression ( exprNode ) ; SpreadMapExpression spreadMapExpression = new SpreadMapExpression ( expr ) ; configureAST ( spreadMapExpression , node ) ; return spreadMapExpression ; } protected Expression methodPointerExpression ( AST node ) { AST exprNode = node . getFirstChild ( ) ; Expression objectExpression = expression ( exprNode ) ; AST mNode = exprNode . getNextSibling ( ) ; Expression methodName ; if ( isType ( DYNAMIC_MEMBER , mNode ) ) { methodName = expression ( mNode ) ; } else { methodName = new ConstantExpression ( identifier ( mNode ) ) ; } configureAST ( methodName , mNode ) ; MethodPointerExpression methodPointerExpression = new MethodPointerExpression ( objectExpression , methodName ) ; configureAST ( methodPointerExpression , node ) ; return methodPointerExpression ; } protected Expression listExpression ( AST listNode ) { List < Expression > expressions = new ArrayList < Expression > ( ) ; AST elist = listNode . getFirstChild ( ) ; assertNodeType ( ELIST , elist ) ; for ( AST node = elist . getFirstChild ( ) ; node != null ; node = node . getNextSibling ( ) ) { switch ( node . getType ( ) ) { case LABELED_ARG : assertNodeType ( COMMA , node ) ; break ; case SPREAD_MAP_ARG : assertNodeType ( SPREAD_ARG , node ) ; break ; } expressions . add ( expression ( node ) ) ; } ListExpression listExpression = new ListExpression ( expressions ) ; configureAST ( listExpression , listNode ) ; return listExpression ; } protected Expression mapExpression ( AST mapNode ) { List expressions = new ArrayList ( ) ; AST elist = mapNode . getFirstChild ( ) ; if ( elist != null ) { assertNodeType ( ELIST , elist ) ; for ( AST node = elist . getFirstChild ( ) ; node != null ; node = node . getNextSibling ( ) ) { switch ( node . getType ( ) ) { case LABELED_ARG : case SPREAD_MAP_ARG : break ; case SPREAD_ARG : assertNodeType ( SPREAD_MAP_ARG , node ) ; break ; default : assertNodeType ( LABELED_ARG , node ) ; break ; } expressions . add ( mapEntryExpression ( node ) ) ; } } MapExpression mapExpression = new MapExpression ( expressions ) ; configureAST ( mapExpression , mapNode ) ; if ( expressions . size ( ) == <NUM_LIT:0> && mapExpression . getLength ( ) <= <NUM_LIT:1> ) { mapExpression . setEnd ( mapExpression . getStart ( ) + <NUM_LIT:3> ) ; mapExpression . setLastColumnNumber ( mapExpression . getColumnNumber ( ) + <NUM_LIT:3> ) ; } return mapExpression ; } protected MapEntryExpression mapEntryExpression ( AST node ) { if ( node . getType ( ) == SPREAD_MAP_ARG ) { AST rightNode = node . getFirstChild ( ) ; Expression keyExpression = spreadMapExpression ( node ) ; Expression rightExpression = expression ( rightNode ) ; MapEntryExpression mapEntryExpression = new MapEntryExpression ( keyExpression , rightExpression ) ; configureAST ( mapEntryExpression , node ) ; return mapEntryExpression ; } else { AST keyNode = node . getFirstChild ( ) ; Expression keyExpression = expression ( keyNode ) ; AST valueNode = keyNode . getNextSibling ( ) ; Expression valueExpression = expression ( valueNode ) ; MapEntryExpression mapEntryExpression = new MapEntryExpression ( keyExpression , valueExpression ) ; mapEntryExpression . setStart ( keyExpression . getStart ( ) ) ; mapEntryExpression . setLineNumber ( keyExpression . getLineNumber ( ) ) ; mapEntryExpression . setColumnNumber ( keyExpression . getColumnNumber ( ) ) ; mapEntryExpression . setEnd ( valueExpression . getEnd ( ) ) ; mapEntryExpression . setLastLineNumber ( valueExpression . getLastLineNumber ( ) ) ; mapEntryExpression . setLastColumnNumber ( valueExpression . getLastColumnNumber ( ) ) ; configureAST ( mapEntryExpression , node ) ; return mapEntryExpression ; } } protected Expression instanceofExpression ( AST node ) { AST leftNode = node . getFirstChild ( ) ; Expression leftExpression = expression ( leftNode ) ; AST rightNode = leftNode . getNextSibling ( ) ; ClassNode type = buildName ( rightNode ) ; assertTypeNotNull ( type , rightNode ) ; Expression rightExpression = new ClassExpression ( type ) ; configureAST ( rightExpression , rightNode ) ; BinaryExpression binaryExpression = new BinaryExpression ( leftExpression , makeToken ( Types . KEYWORD_INSTANCEOF , node ) , rightExpression ) ; configureAST ( binaryExpression , node ) ; return binaryExpression ; } protected void assertTypeNotNull ( ClassNode type , AST rightNode ) { if ( type == null ) { throw new ASTRuntimeException ( rightNode , "<STR_LIT>" + qualifiedName ( rightNode ) ) ; } } protected Expression asExpression ( AST node ) { AST leftNode = node . getFirstChild ( ) ; Expression leftExpression = expression ( leftNode ) ; AST rightNode = leftNode . getNextSibling ( ) ; ClassNode type = makeTypeWithArguments ( rightNode ) ; CastExpression asExpr = CastExpression . asExpression ( type , leftExpression ) ; asExpr . setStart ( leftExpression . getStart ( ) ) ; asExpr . setLineNumber ( leftExpression . getLineNumber ( ) ) ; asExpr . setColumnNumber ( leftExpression . getColumnNumber ( ) ) ; asExpr . setEnd ( type . getEnd ( ) ) ; asExpr . setLastLineNumber ( type . getLastLineNumber ( ) ) ; asExpr . setLastColumnNumber ( type . getLastColumnNumber ( ) ) ; return asExpr ; } protected Expression castExpression ( AST castNode ) { AST node = castNode . getFirstChild ( ) ; ClassNode type = makeTypeWithArguments ( node ) ; assertTypeNotNull ( type , node ) ; AST expressionNode = node . getNextSibling ( ) ; Expression expression = expression ( expressionNode ) ; CastExpression castExpression = new CastExpression ( type , expression ) ; configureAST ( castExpression , castNode ) ; return castExpression ; } protected Expression indexExpression ( AST indexNode ) { AST bracket = indexNode . getFirstChild ( ) ; AST leftNode = bracket . getNextSibling ( ) ; Expression leftExpression = expression ( leftNode ) ; AST rightNode = leftNode . getNextSibling ( ) ; Expression rightExpression = expression ( rightNode ) ; BinaryExpression binaryExpression = new BinaryExpression ( leftExpression , makeToken ( Types . LEFT_SQUARE_BRACKET , bracket ) , rightExpression ) ; configureAST ( binaryExpression , indexNode ) ; return binaryExpression ; } protected Expression binaryExpression ( int type , AST node ) { Token token = makeToken ( type , node ) ; AST leftNode = node . getFirstChild ( ) ; Expression leftExpression = expression ( leftNode ) ; AST rightNode = leftNode . getNextSibling ( ) ; if ( rightNode == null ) { return leftExpression ; } if ( Types . ofType ( type , Types . ASSIGNMENT_OPERATOR ) ) { if ( leftExpression instanceof VariableExpression || leftExpression . getClass ( ) == PropertyExpression . class || leftExpression instanceof FieldExpression || leftExpression instanceof AttributeExpression || leftExpression instanceof DeclarationExpression || leftExpression instanceof TupleExpression ) { } else if ( leftExpression instanceof ConstantExpression ) { throw new ASTRuntimeException ( node , "<STR_LIT>" + ( ( ConstantExpression ) leftExpression ) . getValue ( ) + "<STR_LIT>" ) ; } else if ( leftExpression instanceof BinaryExpression ) { Expression leftexp = ( ( BinaryExpression ) leftExpression ) . getLeftExpression ( ) ; int lefttype = ( ( BinaryExpression ) leftExpression ) . getOperation ( ) . getType ( ) ; if ( ! Types . ofType ( lefttype , Types . ASSIGNMENT_OPERATOR ) && lefttype != Types . LEFT_SQUARE_BRACKET ) { throw new ASTRuntimeException ( node , "<STR_LIT:n>" + ( ( BinaryExpression ) leftExpression ) . getText ( ) + "<STR_LIT>" ) ; } } else if ( leftExpression instanceof GStringExpression ) { throw new ASTRuntimeException ( node , "<STR_LIT>" + ( ( GStringExpression ) leftExpression ) . getText ( ) + "<STR_LIT>" ) ; } else if ( leftExpression instanceof MethodCallExpression ) { throw new ASTRuntimeException ( node , "<STR_LIT>" + ( ( MethodCallExpression ) leftExpression ) . getText ( ) + "<STR_LIT>" ) ; } else if ( leftExpression instanceof MapExpression ) { throw new ASTRuntimeException ( node , "<STR_LIT>" + ( ( MapExpression ) leftExpression ) . getText ( ) + "<STR_LIT>" ) ; } else { throw new ASTRuntimeException ( node , "<STR_LIT:n>" + leftExpression . getClass ( ) + "<STR_LIT>" + leftExpression . getText ( ) + "<STR_LIT>" ) ; } } Expression rightExpression = expression ( rightNode ) ; BinaryExpression binaryExpression = new BinaryExpression ( leftExpression , token , rightExpression ) ; binaryExpression . setStart ( leftExpression . getStart ( ) ) ; binaryExpression . setLineNumber ( leftExpression . getLineNumber ( ) ) ; binaryExpression . setColumnNumber ( leftExpression . getColumnNumber ( ) ) ; binaryExpression . setEnd ( rightExpression . getEnd ( ) ) ; binaryExpression . setLastLineNumber ( rightExpression . getLastLineNumber ( ) ) ; binaryExpression . setLastColumnNumber ( rightExpression . getLastColumnNumber ( ) ) ; return binaryExpression ; } protected Expression prefixExpression ( AST node , int token ) { Expression expression = expression ( node . getFirstChild ( ) ) ; PrefixExpression prefixExpression = new PrefixExpression ( makeToken ( token , node ) , expression ) ; configureAST ( prefixExpression , node ) ; return prefixExpression ; } protected Expression postfixExpression ( AST node , int token ) { Expression expression = expression ( node . getFirstChild ( ) ) ; PostfixExpression postfixExpression = new PostfixExpression ( expression , makeToken ( token , node ) ) ; configureAST ( postfixExpression , node ) ; return postfixExpression ; } protected BooleanExpression booleanExpression ( AST node ) { BooleanExpression booleanExpression = new BooleanExpression ( expression ( node ) ) ; configureAST ( booleanExpression , node ) ; return booleanExpression ; } protected Expression dotExpression ( AST node ) { AST leftNode = node . getFirstChild ( ) ; if ( leftNode != null ) { AST identifierNode = leftNode . getNextSibling ( ) ; if ( identifierNode != null ) { Expression leftExpression = expression ( leftNode ) ; if ( isType ( SELECT_SLOT , identifierNode ) ) { Expression field = expression ( identifierNode . getFirstChild ( ) , true ) ; AttributeExpression attributeExpression = new AttributeExpression ( leftExpression , field , node . getType ( ) != DOT ) ; if ( node . getType ( ) == SPREAD_DOT ) { attributeExpression . setSpreadSafe ( true ) ; } configureAST ( attributeExpression , node ) ; return attributeExpression ; } if ( isType ( SLIST , identifierNode ) ) { Statement code = statementList ( identifierNode ) ; ClosureExpression closureExpression = new ClosureExpression ( Parameter . EMPTY_ARRAY , code ) ; configureAST ( closureExpression , identifierNode ) ; final PropertyExpression propertyExpression = new PropertyExpression ( leftExpression , closureExpression ) ; if ( node . getType ( ) == SPREAD_DOT ) { propertyExpression . setSpreadSafe ( true ) ; } configureAST ( propertyExpression , node ) ; return propertyExpression ; } Expression property = expression ( identifierNode , true ) ; if ( property instanceof VariableExpression ) { VariableExpression ve = ( VariableExpression ) property ; property = new ConstantExpression ( ve . getName ( ) ) ; } PropertyExpression propertyExpression = new PropertyExpression ( leftExpression , property , node . getType ( ) != DOT ) ; if ( node . getType ( ) == SPREAD_DOT ) { propertyExpression . setSpreadSafe ( true ) ; } configureAST ( propertyExpression , node ) ; return propertyExpression ; } } return methodCallExpression ( node ) ; } protected Expression specialConstructorCallExpression ( AST methodCallNode , ClassNode special ) { AST node = methodCallNode . getFirstChild ( ) ; Expression arguments = arguments ( node ) ; ConstructorCallExpression expression = new ConstructorCallExpression ( special , arguments ) ; configureAST ( expression , methodCallNode ) ; return expression ; } private int getTypeInParenthesis ( AST node ) { if ( ! isType ( EXPR , node ) ) node = node . getFirstChild ( ) ; while ( node != null && isType ( EXPR , node ) && node . getNextSibling ( ) == null ) { node = node . getFirstChild ( ) ; } if ( node == null ) return - <NUM_LIT:1> ; return node . getType ( ) ; } protected Expression methodCallExpression ( AST methodCallNode ) { AST node = methodCallNode . getFirstChild ( ) ; Expression objectExpression ; AST selector ; AST elist = node . getNextSibling ( ) ; List < GenericsType > typeArgumentList = null ; boolean implicitThis = false ; boolean safe = isType ( OPTIONAL_DOT , node ) ; boolean spreadSafe = isType ( SPREAD_DOT , node ) ; if ( isType ( DOT , node ) || safe || spreadSafe ) { AST objectNode = node . getFirstChild ( ) ; objectExpression = expression ( objectNode ) ; selector = objectNode . getNextSibling ( ) ; } else { implicitThis = true ; objectExpression = VariableExpression . THIS_EXPRESSION ; selector = node ; } if ( isType ( TYPE_ARGUMENTS , selector ) ) { typeArgumentList = getTypeArgumentsList ( selector ) ; selector = selector . getNextSibling ( ) ; } Expression name = null ; if ( isType ( LITERAL_super , selector ) ) { implicitThis = true ; name = new ConstantExpression ( "<STR_LIT>" ) ; if ( objectExpression instanceof VariableExpression && ( ( VariableExpression ) objectExpression ) . isThisExpression ( ) ) { objectExpression = VariableExpression . SUPER_EXPRESSION ; } } else if ( isPrimitiveTypeLiteral ( selector ) ) { throw new ASTRuntimeException ( selector , "<STR_LIT>" + selector . getText ( ) + "<STR_LIT>" ) ; } else if ( isType ( SELECT_SLOT , selector ) ) { Expression field = expression ( selector . getFirstChild ( ) , true ) ; AttributeExpression attributeExpression = new AttributeExpression ( objectExpression , field , node . getType ( ) != DOT ) ; configureAST ( attributeExpression , node ) ; Expression arguments = arguments ( elist ) ; MethodCallExpression expression = new MethodCallExpression ( attributeExpression , "<STR_LIT>" , arguments ) ; setTypeArgumentsOnMethodCallExpression ( expression , typeArgumentList ) ; configureAST ( expression , methodCallNode ) ; return expression ; } else if ( ! implicitThis || isType ( DYNAMIC_MEMBER , selector ) || isType ( IDENT , selector ) || isType ( STRING_CONSTRUCTOR , selector ) || isType ( STRING_LITERAL , selector ) ) { name = expression ( selector , true ) ; } else { implicitThis = false ; name = new ConstantExpression ( "<STR_LIT>" ) ; objectExpression = expression ( selector , true ) ; } if ( selector . getText ( ) . equals ( "<STR_LIT>" ) || selector . getText ( ) . equals ( "<STR_LIT>" ) ) { throw new ASTRuntimeException ( elist , "<STR_LIT>" ) ; } Expression arguments = arguments ( elist ) ; MethodCallExpression expression = new MethodCallExpression ( objectExpression , name , arguments ) ; expression . setSafe ( safe ) ; expression . setSpreadSafe ( spreadSafe ) ; expression . setImplicitThis ( implicitThis ) ; setTypeArgumentsOnMethodCallExpression ( expression , typeArgumentList ) ; Expression ret = expression ; if ( implicitThis && "<STR_LIT>" . equals ( expression . getMethodAsString ( ) ) ) { ret = new ConstructorCallExpression ( this . classNode , arguments ) ; } if ( ! implicitThis && methodCallNode . getText ( ) . equals ( "<STR_LIT>" ) ) { ret . setStart ( objectExpression . getStart ( ) ) ; ret . setLineNumber ( objectExpression . getLineNumber ( ) ) ; ret . setColumnNumber ( objectExpression . getColumnNumber ( ) ) ; ret . setEnd ( arguments . getEnd ( ) ) ; ret . setLastLineNumber ( arguments . getLastLineNumber ( ) ) ; ret . setLastColumnNumber ( arguments . getLastColumnNumber ( ) ) ; } configureAST ( ret , methodCallNode ) ; return ret ; } private void setTypeArgumentsOnMethodCallExpression ( MethodCallExpression expression , List < GenericsType > typeArgumentList ) { if ( typeArgumentList != null && typeArgumentList . size ( ) > <NUM_LIT:0> ) { expression . setGenericsTypes ( typeArgumentList . toArray ( new GenericsType [ typeArgumentList . size ( ) ] ) ) ; } } protected Expression constructorCallExpression ( AST node ) { AST constructorCallNode = node ; ClassNode type = makeTypeWithArguments ( constructorCallNode ) ; if ( isType ( CTOR_CALL , node ) || isType ( LITERAL_new , node ) ) { node = node . getFirstChild ( ) ; } if ( node == null ) { return new ConstructorCallExpression ( ClassHelper . OBJECT_TYPE , new ArgumentListExpression ( ) ) ; } AST elist = node . getNextSibling ( ) ; if ( elist == null && isType ( ELIST , node ) ) { elist = node ; if ( "<STR_LIT:(>" . equals ( type . getName ( ) ) ) { type = classNode ; } } if ( isType ( ARRAY_DECLARATOR , elist ) ) { AST expressionNode = elist . getFirstChild ( ) ; if ( expressionNode == null ) { throw new ASTRuntimeException ( elist , "<STR_LIT>" ) ; } List size = arraySizeExpression ( expressionNode ) ; ArrayExpression arrayExpression = new ArrayExpression ( type , null , size ) ; configureAST ( arrayExpression , constructorCallNode ) ; return arrayExpression ; } Expression arguments = arguments ( elist ) ; ClassNode innerClass = getAnonymousInnerClassNode ( arguments ) ; ConstructorCallExpression ret = new ConstructorCallExpression ( type , arguments ) ; if ( innerClass != null ) { ret . setType ( innerClass ) ; ret . setUsingAnonymousInnerClass ( true ) ; innerClass . setUnresolvedSuperClass ( type ) ; } configureAST ( ret , constructorCallNode ) ; return ret ; } private ClassNode getAnonymousInnerClassNode ( Expression arguments ) { if ( arguments instanceof TupleExpression ) { TupleExpression te = ( TupleExpression ) arguments ; List < Expression > expressions = te . getExpressions ( ) ; if ( expressions . size ( ) == <NUM_LIT:0> ) return null ; Expression last = ( Expression ) expressions . remove ( expressions . size ( ) - <NUM_LIT:1> ) ; if ( last instanceof AnonymousInnerClassCarrier ) { AnonymousInnerClassCarrier carrier = ( AnonymousInnerClassCarrier ) last ; return carrier . innerClass ; } else { expressions . add ( last ) ; } } else if ( arguments instanceof AnonymousInnerClassCarrier ) { AnonymousInnerClassCarrier carrier = ( AnonymousInnerClassCarrier ) arguments ; return carrier . innerClass ; } return null ; } protected List arraySizeExpression ( AST node ) { List list ; Expression size = null ; if ( isType ( ARRAY_DECLARATOR , node ) ) { AST right = node . getNextSibling ( ) ; if ( right != null ) { size = expression ( right ) ; } else { size = ConstantExpression . EMPTY_EXPRESSION ; } AST child = node . getFirstChild ( ) ; if ( child == null ) { throw new ASTRuntimeException ( node , "<STR_LIT>" ) ; } list = arraySizeExpression ( child ) ; } else { size = expression ( node ) ; list = new ArrayList ( ) ; } list . add ( size ) ; return list ; } protected Expression arguments ( AST elist ) { List expressionList = new ArrayList ( ) ; boolean namedArguments = false ; for ( AST node = elist ; node != null ; node = node . getNextSibling ( ) ) { if ( isType ( ELIST , node ) ) { for ( AST child = node . getFirstChild ( ) ; child != null ; child = child . getNextSibling ( ) ) { namedArguments |= addArgumentExpression ( child , expressionList ) ; } } else { namedArguments |= addArgumentExpression ( node , expressionList ) ; } } if ( namedArguments ) { if ( ! expressionList . isEmpty ( ) ) { List < Expression > argumentList = new ArrayList < Expression > ( ) ; for ( Object next : expressionList ) { Expression expression = ( Expression ) next ; if ( ! ( expression instanceof MapEntryExpression ) ) { argumentList . add ( expression ) ; } } if ( ! argumentList . isEmpty ( ) ) { expressionList . removeAll ( argumentList ) ; checkDuplicateNamedParams ( elist , expressionList ) ; MapExpression mapExpression = new MapExpression ( expressionList ) ; configureAST ( mapExpression , elist ) ; argumentList . add ( <NUM_LIT:0> , mapExpression ) ; ArgumentListExpression argumentListExpression = new ArgumentListExpression ( argumentList ) ; configureAST ( argumentListExpression , elist ) ; return argumentListExpression ; } } checkDuplicateNamedParams ( elist , expressionList ) ; NamedArgumentListExpression namedArgumentListExpression = new NamedArgumentListExpression ( expressionList ) ; configureAST ( namedArgumentListExpression , elist ) ; return namedArgumentListExpression ; } else { ArgumentListExpression argumentListExpression = new ArgumentListExpression ( expressionList ) ; if ( elist != null ) { configureAST ( argumentListExpression , elist ) ; } return argumentListExpression ; } } private void checkDuplicateNamedParams ( AST elist , List expressionList ) { if ( expressionList . isEmpty ( ) ) return ; Set < String > namedArgumentNames = new HashSet < String > ( ) ; for ( Object expression : expressionList ) { MapEntryExpression meExp = ( MapEntryExpression ) expression ; if ( meExp . getKeyExpression ( ) instanceof ConstantExpression ) { String argName = meExp . getKeyExpression ( ) . getText ( ) ; if ( ! namedArgumentNames . contains ( argName ) ) { namedArgumentNames . add ( argName ) ; } else { throw new ASTRuntimeException ( elist , "<STR_LIT>" + argName + "<STR_LIT>" ) ; } } } } protected boolean addArgumentExpression ( AST node , List < Expression > expressionList ) { if ( node . getType ( ) == SPREAD_MAP_ARG ) { AST rightNode = node . getFirstChild ( ) ; Expression keyExpression = spreadMapExpression ( node ) ; Expression rightExpression = expression ( rightNode ) ; MapEntryExpression mapEntryExpression = new MapEntryExpression ( keyExpression , rightExpression ) ; expressionList . add ( mapEntryExpression ) ; return true ; } else { Expression expression = expression ( node ) ; expressionList . add ( expression ) ; return expression instanceof MapEntryExpression ; } } protected Expression expressionList ( AST node ) { List < Expression > expressionList = new ArrayList < Expression > ( ) ; for ( AST child = node . getFirstChild ( ) ; child != null ; child = child . getNextSibling ( ) ) { expressionList . add ( expression ( child ) ) ; } if ( expressionList . size ( ) == <NUM_LIT:1> ) { return expressionList . get ( <NUM_LIT:0> ) ; } else { ListExpression listExpression = new ListExpression ( expressionList ) ; listExpression . setWrapped ( true ) ; configureAST ( listExpression , node ) ; return listExpression ; } } protected ClosureExpression closureExpression ( AST node ) { AST paramNode = node . getFirstChild ( ) ; Parameter [ ] parameters = null ; AST codeNode = paramNode ; if ( isType ( PARAMETERS , paramNode ) || isType ( IMPLICIT_PARAMETERS , paramNode ) ) { parameters = parameters ( paramNode ) ; codeNode = paramNode . getNextSibling ( ) ; } Statement code = statementListNoChild ( codeNode , node ) ; ClosureExpression closureExpression = new ClosureExpression ( parameters , code ) ; configureAST ( closureExpression , node ) ; return closureExpression ; } protected Expression blockExpression ( AST node ) { AST codeNode = node . getFirstChild ( ) ; if ( codeNode == null ) return ConstantExpression . NULL ; if ( codeNode . getType ( ) == EXPR && codeNode . getNextSibling ( ) == null ) { return expression ( codeNode ) ; } Parameter [ ] parameters = Parameter . EMPTY_ARRAY ; Statement code = statementListNoChild ( codeNode , node ) ; ClosureExpression closureExpression = new ClosureExpression ( parameters , code ) ; configureAST ( closureExpression , node ) ; String callName = "<STR_LIT>" ; Expression noArguments = new ArgumentListExpression ( ) ; MethodCallExpression call = new MethodCallExpression ( closureExpression , callName , noArguments ) ; configureAST ( call , node ) ; return call ; } protected Expression unaryMinusExpression ( AST unaryMinusExpr ) { AST node = unaryMinusExpr . getFirstChild ( ) ; String text = node . getText ( ) ; switch ( node . getType ( ) ) { case NUM_DOUBLE : case NUM_FLOAT : case NUM_BIG_DECIMAL : ConstantExpression constantExpression = new ConstantExpression ( Numbers . parseDecimal ( "<STR_LIT:->" + text ) ) ; configureAST ( constantExpression , unaryMinusExpr ) ; return constantExpression ; case NUM_BIG_INT : case NUM_INT : case NUM_LONG : ConstantExpression constantLongExpression = new ConstantExpression ( Numbers . parseInteger ( "<STR_LIT:->" + text ) ) ; configureAST ( constantLongExpression , unaryMinusExpr ) ; return constantLongExpression ; default : UnaryMinusExpression unaryMinusExpression = new UnaryMinusExpression ( expression ( node ) ) ; configureAST ( unaryMinusExpression , unaryMinusExpr ) ; return unaryMinusExpression ; } } protected Expression unaryPlusExpression ( AST unaryPlusExpr ) { AST node = unaryPlusExpr . getFirstChild ( ) ; switch ( node . getType ( ) ) { case NUM_DOUBLE : case NUM_FLOAT : case NUM_BIG_DECIMAL : case NUM_BIG_INT : case NUM_INT : case NUM_LONG : return expression ( node ) ; default : UnaryPlusExpression unaryPlusExpression = new UnaryPlusExpression ( expression ( node ) ) ; configureAST ( unaryPlusExpression , unaryPlusExpr ) ; return unaryPlusExpression ; } } protected ConstantExpression decimalExpression ( AST node ) { String text = node . getText ( ) ; Object number = Numbers . parseDecimal ( text ) ; ConstantExpression constantExpression = new ConstantExpression ( number , number instanceof Double || number instanceof Float ) ; configureAST ( constantExpression , node ) ; return constantExpression ; } protected ConstantExpression integerExpression ( AST node ) { String text = node . getText ( ) ; Object number = Numbers . parseInteger ( text ) ; boolean keepPrimitive = number instanceof Integer || number instanceof Long ; ConstantExpression constantExpression = new ConstantExpression ( number , keepPrimitive ) ; configureAST ( constantExpression , node ) ; return constantExpression ; } protected Expression gstring ( AST gstringNode ) { List strings = new ArrayList ( ) ; List values = new ArrayList ( ) ; StringBuffer buffer = new StringBuffer ( ) ; boolean isPrevString = false ; for ( AST node = gstringNode . getFirstChild ( ) ; node != null ; node = node . getNextSibling ( ) ) { int type = node . getType ( ) ; String text = null ; switch ( type ) { case STRING_LITERAL : if ( isPrevString ) assertNodeType ( IDENT , node ) ; isPrevString = true ; text = node . getText ( ) ; ConstantExpression constantExpression = new ConstantExpression ( text ) ; configureAST ( constantExpression , node ) ; strings . add ( constantExpression ) ; buffer . append ( text ) ; break ; default : { if ( ! isPrevString ) assertNodeType ( IDENT , node ) ; isPrevString = false ; Expression expression = expression ( node ) ; values . add ( expression ) ; buffer . append ( "<STR_LIT:$>" ) ; buffer . append ( expression . getText ( ) ) ; } break ; } } GStringExpression gStringExpression = new GStringExpression ( buffer . toString ( ) , strings , values ) ; configureAST ( gStringExpression , gstringNode ) ; return gStringExpression ; } protected ClassNode type ( AST typeNode ) { return buildName ( typeNode . getFirstChild ( ) ) ; } public static String qualifiedName ( AST qualifiedNameNode ) { if ( isType ( IDENT , qualifiedNameNode ) ) { return qualifiedNameNode . getText ( ) ; } if ( isType ( DOT , qualifiedNameNode ) ) { AST node = qualifiedNameNode . getFirstChild ( ) ; StringBuffer buffer = new StringBuffer ( ) ; boolean first = true ; for ( ; node != null && ! isType ( TYPE_ARGUMENTS , node ) ; node = node . getNextSibling ( ) ) { if ( first ) { first = false ; } else { buffer . append ( "<STR_LIT:.>" ) ; } buffer . append ( qualifiedName ( node ) ) ; } return buffer . toString ( ) ; } else { return qualifiedNameNode . getText ( ) ; } } private static AST getTypeArgumentsNode ( AST root ) { while ( root != null && ! isType ( TYPE_ARGUMENTS , root ) ) { root = root . getNextSibling ( ) ; } return root ; } private int getBoundType ( AST node ) { if ( node == null ) return - <NUM_LIT:1> ; if ( isType ( TYPE_UPPER_BOUNDS , node ) ) return TYPE_UPPER_BOUNDS ; if ( isType ( TYPE_LOWER_BOUNDS , node ) ) return TYPE_LOWER_BOUNDS ; throw new ASTRuntimeException ( node , "<STR_LIT>" + getTokenName ( node ) + "<STR_LIT>" + getTokenName ( TYPE_UPPER_BOUNDS ) + "<STR_LIT>" + getTokenName ( TYPE_LOWER_BOUNDS ) ) ; } private GenericsType makeGenericsArgumentType ( AST typeArgument ) { GenericsType gt ; AST rootNode = typeArgument . getFirstChild ( ) ; if ( isType ( WILDCARD_TYPE , rootNode ) ) { ClassNode base = ClassHelper . makeWithoutCaching ( "<STR_LIT:?>" ) ; if ( rootNode . getNextSibling ( ) != null ) { int boundType = getBoundType ( rootNode . getNextSibling ( ) ) ; ClassNode [ ] gts = makeGenericsBounds ( rootNode , boundType ) ; if ( boundType == TYPE_UPPER_BOUNDS ) { gt = new GenericsType ( base , gts , null ) ; } else { gt = new GenericsType ( base , null , gts [ <NUM_LIT:0> ] ) ; } } else { gt = new GenericsType ( base , null , null ) ; } gt . setName ( "<STR_LIT:?>" ) ; gt . setWildcard ( true ) ; } else { ClassNode argument = makeTypeWithArguments ( rootNode ) ; gt = new GenericsType ( argument ) ; } configureAST ( gt , typeArgument ) ; return gt ; } protected ClassNode makeTypeWithArguments ( AST rootNode ) { ClassNode basicType = makeType ( rootNode ) ; AST node = rootNode . getFirstChild ( ) ; if ( node == null || isType ( INDEX_OP , node ) || isType ( ARRAY_DECLARATOR , node ) ) return basicType ; if ( ! isType ( DOT , node ) ) { node = node . getFirstChild ( ) ; if ( node == null ) return basicType ; return addTypeArguments ( basicType , node ) ; } else { node = node . getFirstChild ( ) ; while ( node != null && ! isType ( TYPE_ARGUMENTS , node ) ) node = node . getNextSibling ( ) ; return node == null ? basicType : addTypeArguments ( basicType , node ) ; } } private ClassNode addTypeArguments ( ClassNode basicType , AST node ) { List < GenericsType > typeArgumentList = getTypeArgumentsList ( node ) ; basicType . setGenericsTypes ( typeArgumentList . toArray ( new GenericsType [ typeArgumentList . size ( ) ] ) ) ; return basicType ; } private List < GenericsType > getTypeArgumentsList ( AST node ) { assertNodeType ( TYPE_ARGUMENTS , node ) ; List < GenericsType > typeArgumentList = new LinkedList < GenericsType > ( ) ; AST typeArgument = node . getFirstChild ( ) ; while ( typeArgument != null ) { assertNodeType ( TYPE_ARGUMENT , typeArgument ) ; GenericsType gt = makeGenericsArgumentType ( typeArgument ) ; typeArgumentList . add ( gt ) ; typeArgument = typeArgument . getNextSibling ( ) ; } return typeArgumentList ; } private ClassNode [ ] makeGenericsBounds ( AST rn , int boundType ) { AST boundsRoot = rn . getNextSibling ( ) ; if ( boundsRoot == null ) return null ; assertNodeType ( boundType , boundsRoot ) ; LinkedList bounds = new LinkedList ( ) ; for ( AST boundsNode = boundsRoot . getFirstChild ( ) ; boundsNode != null ; boundsNode = boundsNode . getNextSibling ( ) ) { ClassNode bound = null ; bound = makeTypeWithArguments ( boundsNode ) ; configureAST ( bound , boundsNode ) ; bounds . add ( bound ) ; } if ( bounds . size ( ) == <NUM_LIT:0> ) return null ; return ( ClassNode [ ] ) bounds . toArray ( new ClassNode [ bounds . size ( ) ] ) ; } protected GenericsType [ ] makeGenericsType ( AST rootNode ) { AST typeParameter = rootNode . getFirstChild ( ) ; LinkedList ret = new LinkedList ( ) ; assertNodeType ( TYPE_PARAMETER , typeParameter ) ; while ( isType ( TYPE_PARAMETER , typeParameter ) ) { AST typeNode = typeParameter . getFirstChild ( ) ; ClassNode type = makeType ( typeParameter ) ; GenericsType gt = new GenericsType ( type , makeGenericsBounds ( typeNode , TYPE_UPPER_BOUNDS ) , null ) ; configureAST ( gt , typeParameter ) ; ret . add ( gt ) ; typeParameter = typeParameter . getNextSibling ( ) ; } return ( GenericsType [ ] ) ret . toArray ( new GenericsType [ <NUM_LIT:0> ] ) ; } protected ClassNode makeType ( AST typeNode ) { ClassNode answer = ClassHelper . DYNAMIC_TYPE ; AST node = typeNode . getFirstChild ( ) ; if ( node != null ) { if ( isType ( INDEX_OP , node ) || isType ( ARRAY_DECLARATOR , node ) ) { answer = makeType ( node ) . makeArray ( ) ; } else { answer = ClassHelper . make ( qualifiedName ( node ) ) ; if ( answer . isUsingGenerics ( ) ) { ClassNode newAnswer = ClassHelper . makeWithoutCaching ( answer . getName ( ) ) ; newAnswer . setRedirect ( answer ) ; answer = newAnswer ; } } configureAST ( answer , node ) ; } return answer ; } protected ClassNode buildName ( AST node ) { if ( isType ( TYPE , node ) ) { node = node . getFirstChild ( ) ; } ClassNode answer = null ; if ( isType ( DOT , node ) || isType ( OPTIONAL_DOT , node ) ) { answer = ClassHelper . make ( qualifiedName ( node ) ) ; } else if ( isPrimitiveTypeLiteral ( node ) ) { answer = ClassHelper . make ( node . getText ( ) ) ; } else if ( isType ( INDEX_OP , node ) || isType ( ARRAY_DECLARATOR , node ) ) { AST child = node . getFirstChild ( ) ; answer = buildName ( child ) . makeArray ( ) ; configureAST ( answer , node ) ; return answer ; } else { String identifier = node . getText ( ) ; answer = ClassHelper . make ( identifier ) ; } AST nextSibling = node . getNextSibling ( ) ; if ( isType ( INDEX_OP , nextSibling ) || isType ( ARRAY_DECLARATOR , node ) ) { answer = answer . makeArray ( ) ; configureAST ( answer , node ) ; return answer ; } else { configureAST ( answer , node ) ; return answer ; } } protected boolean isPrimitiveTypeLiteral ( AST node ) { int type = node . getType ( ) ; switch ( type ) { case LITERAL_boolean : case LITERAL_byte : case LITERAL_char : case LITERAL_double : case LITERAL_float : case LITERAL_int : case LITERAL_long : case LITERAL_short : return true ; default : return false ; } } protected String identifier ( AST node ) { assertNodeType ( IDENT , node ) ; return node . getText ( ) ; } protected String label ( AST labelNode ) { AST node = labelNode . getFirstChild ( ) ; if ( node == null ) { return null ; } return identifier ( node ) ; } protected boolean hasVisibility ( int modifiers ) { return ( modifiers & ( Opcodes . ACC_PRIVATE | Opcodes . ACC_PROTECTED | Opcodes . ACC_PUBLIC ) ) != <NUM_LIT:0> ; } protected void configureAST ( ASTNode node , AST ast ) { if ( ast == null ) throw new ASTRuntimeException ( ast , "<STR_LIT>" + node . getClass ( ) . getName ( ) + "<STR_LIT>" ) ; int startcol = ast . getColumn ( ) ; int startline = ast . getLine ( ) ; int startoffset = locations . findOffset ( startline , startcol ) ; int lastcol ; int lastline ; int endoffset ; if ( ast instanceof GroovySourceAST ) { GroovySourceAST groovySourceAST = ( GroovySourceAST ) ast ; lastcol = groovySourceAST . getColumnLast ( ) ; lastline = groovySourceAST . getLineLast ( ) ; endoffset = locations . findOffset ( lastline , lastcol ) ; if ( ( node instanceof BinaryExpression || node instanceof MapEntryExpression || node instanceof MapExpression || node instanceof CastExpression || node instanceof MethodCallExpression ) && ( node . getStart ( ) <= startoffset && node . getEnd ( ) >= endoffset ) ) { return ; } if ( ( node instanceof VariableExpression || node instanceof ConstantExpression ) && node . getEnd ( ) > <NUM_LIT:0> && ( startoffset <= node . getStart ( ) && endoffset >= node . getEnd ( ) ) ) { return ; } node . setLastColumnNumber ( lastcol ) ; node . setLastLineNumber ( lastline ) ; node . setEnd ( endoffset ) ; } node . setColumnNumber ( startcol ) ; node . setLineNumber ( startline ) ; node . setStart ( startoffset ) ; } protected static Token makeToken ( int typeCode , AST node ) { return Token . newSymbol ( typeCode , node . getLine ( ) , node . getColumn ( ) ) ; } protected String getFirstChildText ( AST node ) { AST child = node . getFirstChild ( ) ; return child != null ? child . getText ( ) : null ; } public static boolean isType ( int typeCode , AST node ) { return node != null && node . getType ( ) == typeCode ; } private String getTokenName ( int token ) { if ( tokenNames == null ) return "<STR_LIT>" + token ; return tokenNames [ token ] ; } private String getTokenName ( AST node ) { if ( node == null ) return "<STR_LIT:null>" ; return getTokenName ( node . getType ( ) ) ; } protected void assertNodeType ( int type , AST node ) { if ( node == null ) { throw new ASTRuntimeException ( node , "<STR_LIT>" + getTokenName ( type ) ) ; } if ( node . getType ( ) != type ) { throw new ASTRuntimeException ( node , "<STR_LIT>" + getTokenName ( node ) + "<STR_LIT>" + getTokenName ( type ) ) ; } } protected void notImplementedYet ( AST node ) { throw new ASTRuntimeException ( node , "<STR_LIT>" + getTokenName ( node ) ) ; } protected Expression unknownAST ( AST node ) { if ( node . getType ( ) == CLASS_DEF ) { throw new ASTRuntimeException ( node , "<STR_LIT>" ) ; } if ( node . getType ( ) == METHOD_DEF ) { throw new ASTRuntimeException ( node , "<STR_LIT>" ) ; } return new ConstantExpression ( "<STR_LIT>" ) ; } protected void dumpTree ( AST ast ) { for ( AST node = ast . getFirstChild ( ) ; node != null ; node = node . getNextSibling ( ) ) { dump ( node ) ; } } protected void dump ( AST node ) { System . out . println ( "<STR_LIT>" + getTokenName ( node ) + "<STR_LIT>" + node . getText ( ) ) ; } private void fixModuleNodeLocations ( ) { output . setStart ( <NUM_LIT:0> ) ; output . setEnd ( locations . getEnd ( ) ) ; output . setLineNumber ( <NUM_LIT:1> ) ; output . setColumnNumber ( <NUM_LIT:1> ) ; output . setLastColumnNumber ( locations . getEndColumn ( ) ) ; output . setLastLineNumber ( locations . getEndLine ( ) ) ; BlockStatement statements = output . getStatementBlock ( ) ; List < MethodNode > methods = output . getMethods ( ) ; if ( hasScriptMethodsOrStatements ( statements , methods ) ) { ASTNode first = getFirst ( statements , methods ) ; ASTNode last = getLast ( statements , methods ) ; if ( hasScriptStatements ( statements ) ) { statements . setStart ( first . getStart ( ) ) ; statements . setLineNumber ( first . getLineNumber ( ) ) ; statements . setColumnNumber ( first . getColumnNumber ( ) ) ; statements . setEnd ( last . getEnd ( ) ) ; statements . setLastLineNumber ( last . getLastLineNumber ( ) ) ; statements . setLastColumnNumber ( last . getLastColumnNumber ( ) ) ; } if ( output . getClasses ( ) . size ( ) > <NUM_LIT:0> ) { ClassNode scriptClass = output . getClasses ( ) . get ( <NUM_LIT:0> ) ; scriptClass . setStart ( first . getStart ( ) ) ; scriptClass . setLineNumber ( first . getLineNumber ( ) ) ; scriptClass . setColumnNumber ( first . getColumnNumber ( ) ) ; scriptClass . setEnd ( last . getEnd ( ) ) ; scriptClass . setLastLineNumber ( last . getLastLineNumber ( ) ) ; scriptClass . setLastColumnNumber ( last . getLastColumnNumber ( ) ) ; MethodNode runMethod = scriptClass . getDeclaredMethod ( "<STR_LIT>" , new Parameter [ <NUM_LIT:0> ] ) ; runMethod . setStart ( first . getStart ( ) ) ; runMethod . setLineNumber ( first . getLineNumber ( ) ) ; runMethod . setColumnNumber ( first . getColumnNumber ( ) ) ; runMethod . setEnd ( last . getEnd ( ) ) ; runMethod . setLastLineNumber ( last . getLastLineNumber ( ) ) ; runMethod . setLastColumnNumber ( last . getLastColumnNumber ( ) ) ; } } } private ASTNode getFirst ( BlockStatement statements , List < MethodNode > methods ) { Statement firstStatement = hasScriptStatements ( statements ) ? statements . getStatements ( ) . get ( <NUM_LIT:0> ) : null ; MethodNode firstMethod = hasScriptMethods ( methods ) ? methods . get ( <NUM_LIT:0> ) : null ; if ( firstMethod == null && ( firstStatement == null || ( firstStatement . getStart ( ) == <NUM_LIT:0> && firstStatement . getLength ( ) == <NUM_LIT:0> ) ) ) { firstStatement = createSyntheticAfterImports ( ) ; } int statementStart = firstStatement != null ? firstStatement . getStart ( ) : Integer . MAX_VALUE ; int methodStart = firstMethod != null ? firstMethod . getStart ( ) : Integer . MAX_VALUE ; return statementStart <= methodStart ? firstStatement : firstMethod ; } private ASTNode getLast ( BlockStatement statements , List < MethodNode > methods ) { Statement lastStatement = hasScriptStatements ( statements ) ? statements . getStatements ( ) . get ( statements . getStatements ( ) . size ( ) - <NUM_LIT:1> ) : null ; MethodNode lastMethod = hasScriptMethods ( methods ) ? methods . get ( methods . size ( ) - <NUM_LIT:1> ) : null ; if ( lastMethod == null && ( lastStatement == null || ( lastStatement . getStart ( ) == <NUM_LIT:0> && lastStatement . getLength ( ) == <NUM_LIT:0> ) ) ) { lastStatement = createSyntheticAfterImports ( ) ; } int statementStart = lastStatement != null ? lastStatement . getEnd ( ) : Integer . MIN_VALUE ; int methodStart = lastMethod != null ? lastMethod . getStart ( ) : Integer . MIN_VALUE ; return statementStart >= methodStart ? lastStatement : lastMethod ; } private Statement createSyntheticAfterImports ( ) { ASTNode target = null ; Statement synthetic = ReturnStatement . RETURN_NULL_OR_VOID ; if ( output . getImports ( ) != null && output . getImports ( ) . size ( ) > <NUM_LIT:0> ) { target = output . getImports ( ) . get ( output . getImports ( ) . size ( ) - <NUM_LIT:1> ) ; } else if ( output . hasPackage ( ) ) { target = output . getPackage ( ) ; } if ( target != null ) { synthetic = new ReturnStatement ( ConstantExpression . NULL ) ; synthetic . setStart ( target . getEnd ( ) + <NUM_LIT:1> ) ; synthetic . setEnd ( target . getEnd ( ) + <NUM_LIT:1> ) ; synthetic . setLineNumber ( target . getLastLineNumber ( ) ) ; synthetic . setLastLineNumber ( target . getLineNumber ( ) ) ; synthetic . setColumnNumber ( target . getLastColumnNumber ( ) + <NUM_LIT:1> ) ; synthetic . setLastColumnNumber ( target . getColumnNumber ( ) + <NUM_LIT:1> ) ; } return synthetic ; } private boolean hasScriptMethodsOrStatements ( BlockStatement statements , List < MethodNode > methods ) { return hasScriptStatements ( statements ) || hasScriptMethods ( methods ) ; } private boolean hasScriptMethods ( List < MethodNode > methods ) { return methods != null && methods . size ( ) > <NUM_LIT:0> ; } private boolean hasScriptStatements ( BlockStatement statements ) { return statements != null && statements . getStatements ( ) != null && statements . getStatements ( ) . size ( ) > <NUM_LIT:0> ; } protected void configureAnnotationAST ( ASTNode node , AST ast ) { if ( ast == null ) { throw new ASTRuntimeException ( ast , "<STR_LIT>" + node . getClass ( ) . getName ( ) + "<STR_LIT>" ) ; } if ( ast instanceof GroovySourceAST ) { GroovySourceAST correctAst = ( GroovySourceAST ) ast ; correctAst = ( GroovySourceAST ) correctAst . getFirstChild ( ) ; setPositions ( node , correctAst . getColumn ( ) , correctAst . getLine ( ) , correctAst . getColumnLast ( ) , correctAst . getLineLast ( ) ) ; if ( node instanceof AnnotationNode ) { setPositions ( ( ( AnnotationNode ) node ) . getClassNode ( ) , correctAst . getColumn ( ) , correctAst . getLine ( ) , correctAst . getColumnLast ( ) + <NUM_LIT:1> , correctAst . getLineLast ( ) ) ; } } else { int startcol = ast . getColumn ( ) ; int startline = ast . getLine ( ) ; node . setColumnNumber ( startcol ) ; node . setLineNumber ( startline ) ; int startoffset = locations . findOffset ( startline , startcol ) ; node . setStart ( startoffset ) ; } } private void configureClassNodeForClassDefAST ( ASTNode node , AST ast ) { if ( ast == null ) { throw new ASTRuntimeException ( ast , "<STR_LIT>" + node . getClass ( ) . getName ( ) + "<STR_LIT>" ) ; } if ( ast instanceof GroovySourceAST ) { GroovySourceAST theAst = ( GroovySourceAST ) ast ; theAst = ( GroovySourceAST ) theAst . getFirstChild ( ) . getNextSibling ( ) ; setPositions ( node , theAst . getColumn ( ) , theAst . getLine ( ) , theAst . getColumnLast ( ) , theAst . getLineLast ( ) ) ; } else { int startcol = ast . getColumn ( ) ; int startline = ast . getLine ( ) ; node . setColumnNumber ( startcol ) ; node . setLineNumber ( startline ) ; int startoffset = locations . findOffset ( startline , startcol ) ; node . setStart ( startoffset ) ; } } private void setPositions ( ASTNode node , int scol , int sline , int ecol , int eline ) { node . setColumnNumber ( scol ) ; node . setLineNumber ( sline ) ; node . setStart ( locations . findOffset ( sline , scol ) ) ; node . setLastColumnNumber ( ecol ) ; node . setLastLineNumber ( eline ) ; node . setEnd ( locations . findOffset ( eline , ecol ) - <NUM_LIT:1> ) ; } } </s>
|
<s> package org . codehaus . groovy . antlr ; import org . codehaus . groovy . control . ParserPlugin ; import org . codehaus . groovy . control . ParserPluginFactory ; public class ErrorRecoveredCSTParserPluginFactory extends ParserPluginFactory { private ICSTReporter cstReporter ; public ErrorRecoveredCSTParserPluginFactory ( ICSTReporter cstReporter ) { this . cstReporter = cstReporter ; } public ErrorRecoveredCSTParserPluginFactory ( ) { this . cstReporter = null ; } public ParserPlugin createParserPlugin ( ) { return new ErrorRecoveredCSTParserPlugin ( cstReporter ) ; } } </s>
|
<s> package org . codehaus . groovy . classgen . asm ; import groovy . lang . GroovyRuntimeException ; import java . lang . reflect . Constructor ; import java . util . Map ; import org . codehaus . groovy . GroovyBugError ; import org . codehaus . groovy . ast . ClassHelper ; import org . codehaus . groovy . ast . ClassNode ; import org . codehaus . groovy . ast . ConstructorNode ; import org . codehaus . groovy . ast . InnerClassNode ; import org . codehaus . groovy . ast . InterfaceHelperClassNode ; import org . codehaus . groovy . ast . MethodNode ; import org . codehaus . groovy . classgen . AsmClassGenerator ; import org . codehaus . groovy . classgen . GeneratorContext ; import org . codehaus . groovy . control . SourceUnit ; import org . objectweb . asm . ClassVisitor ; import org . objectweb . asm . MethodVisitor ; import org . objectweb . asm . Opcodes ; public class WriterController { private static Constructor indyWriter ; static { try { Class indyClass = WriterController . class . getClassLoader ( ) . loadClass ( "<STR_LIT>" ) ; indyWriter = indyClass . getConstructor ( WriterController . class ) ; } catch ( Exception e ) { indyWriter = null ; } } private AsmClassGenerator acg ; private MethodVisitor methodVisitor ; private CompileStack compileStack ; private OperandStack operandStack ; private ClassNode classNode ; private CallSiteWriter callSiteWriter ; private ClassVisitor cv ; private ClosureWriter closureWriter ; private String internalClassName ; private InvocationWriter invocationWriter ; private BinaryExpressionHelper binaryExpHelper , fastPathBinaryExpHelper ; private UnaryExpressionHelper unaryExpressionHelper , fastPathUnaryExpressionHelper ; private AssertionWriter assertionWriter ; private String internalBaseClassName ; private ClassNode outermostClass ; private MethodNode methodNode ; private SourceUnit sourceUnit ; private ConstructorNode constructorNode ; private GeneratorContext context ; private InterfaceHelperClassNode interfaceClassLoadingClass ; public boolean optimizeForInt = true ; private StatementWriter statementWriter ; private boolean fastPath = false ; private TypeChooser typeChooser ; private int bytecodeVersion = Opcodes . V1_5 ; private int lineNumber = - <NUM_LIT:1> ; public void init ( AsmClassGenerator asmClassGenerator , GeneratorContext gcon , ClassVisitor cv , ClassNode cn ) { Map < String , Boolean > optOptions = cn . getCompileUnit ( ) . getConfig ( ) . getOptimizationOptions ( ) ; boolean invokedynamic = false ; if ( optOptions . isEmpty ( ) ) { } else if ( Boolean . FALSE . equals ( optOptions . get ( "<STR_LIT:all>" ) ) ) { optimizeForInt = false ; } else { if ( Boolean . TRUE . equals ( optOptions . get ( "<STR_LIT>" ) ) ) invokedynamic = true ; if ( Boolean . FALSE . equals ( optOptions . get ( "<STR_LIT:int>" ) ) ) optimizeForInt = false ; if ( invokedynamic ) optimizeForInt = false ; } this . classNode = cn ; this . outermostClass = null ; this . internalClassName = BytecodeHelper . getClassInternalName ( classNode ) ; this . callSiteWriter = new CallSiteWriter ( this ) ; if ( invokedynamic ) { bytecodeVersion = Opcodes . V1_7 ; try { this . invocationWriter = ( InvocationWriter ) indyWriter . newInstance ( this ) ; } catch ( Exception e ) { throw new GroovyRuntimeException ( "<STR_LIT>" ) ; } } else { this . invocationWriter = new InvocationWriter ( this ) ; } this . binaryExpHelper = new BinaryExpressionHelper ( this ) ; this . unaryExpressionHelper = new UnaryExpressionHelper ( this ) ; if ( optimizeForInt ) { this . fastPathBinaryExpHelper = new BinaryExpressionMultiTypeDispatcher ( this ) ; this . fastPathUnaryExpressionHelper = new UnaryExpressionHelper ( this ) ; } else { this . fastPathBinaryExpHelper = this . binaryExpHelper ; this . fastPathUnaryExpressionHelper = new UnaryExpressionHelper ( this ) ; } this . operandStack = new OperandStack ( this ) ; this . assertionWriter = new AssertionWriter ( this ) ; this . closureWriter = new ClosureWriter ( this ) ; this . internalBaseClassName = BytecodeHelper . getClassInternalName ( classNode . getSuperClass ( ) ) ; this . acg = asmClassGenerator ; this . sourceUnit = acg . getSourceUnit ( ) ; this . context = gcon ; this . compileStack = new CompileStack ( this ) ; this . cv = cv ; if ( optimizeForInt && sourceUnit != null && ! sourceUnit . isReconcile ) { this . statementWriter = new OptimizingStatementWriter ( this ) ; } else { this . statementWriter = new StatementWriter ( this ) ; } this . typeChooser = new StatementMetaTypeChooser ( ) ; } public AsmClassGenerator getAcg ( ) { return acg ; } public void setMethodVisitor ( MethodVisitor methodVisitor ) { this . methodVisitor = methodVisitor ; } public MethodVisitor getMethodVisitor ( ) { return methodVisitor ; } public CompileStack getCompileStack ( ) { return compileStack ; } public OperandStack getOperandStack ( ) { return operandStack ; } public ClassNode getClassNode ( ) { return classNode ; } public CallSiteWriter getCallSiteWriter ( ) { return callSiteWriter ; } public ClassVisitor getClassVisitor ( ) { return cv ; } public ClosureWriter getClosureWriter ( ) { return closureWriter ; } public ClassVisitor getCv ( ) { return cv ; } public String getInternalClassName ( ) { return internalClassName ; } public InvocationWriter getInvocationWriter ( ) { return invocationWriter ; } public BinaryExpressionHelper getBinaryExpressionHelper ( ) { if ( fastPath ) { return fastPathBinaryExpHelper ; } else { return binaryExpHelper ; } } public UnaryExpressionHelper getUnaryExpressionHelper ( ) { if ( fastPath ) { return fastPathUnaryExpressionHelper ; } else { return unaryExpressionHelper ; } } public AssertionWriter getAssertionWriter ( ) { return assertionWriter ; } public TypeChooser getTypeChooser ( ) { return typeChooser ; } public String getInternalBaseClassName ( ) { return internalBaseClassName ; } public MethodNode getMethodNode ( ) { return methodNode ; } public void setMethodNode ( MethodNode mn ) { methodNode = mn ; constructorNode = null ; } public ConstructorNode getConstructorNode ( ) { return constructorNode ; } public void setConstructorNode ( ConstructorNode cn ) { constructorNode = cn ; methodNode = null ; } public boolean isNotClinit ( ) { return methodNode == null || ! methodNode . getName ( ) . equals ( "<STR_LIT>" ) ; } public SourceUnit getSourceUnit ( ) { return sourceUnit ; } public boolean isStaticContext ( ) { if ( compileStack != null && compileStack . getScope ( ) != null ) { return compileStack . getScope ( ) . isInStaticContext ( ) ; } if ( ! isInClosure ( ) ) return false ; if ( constructorNode != null ) return false ; return classNode . isStaticClass ( ) || methodNode . isStatic ( ) ; } public boolean isInClosure ( ) { return classNode . getOuterClass ( ) != null && classNode . getSuperClass ( ) == ClassHelper . CLOSURE_TYPE ; } public boolean isInClosureConstructor ( ) { return constructorNode != null && classNode . getOuterClass ( ) != null && classNode . getSuperClass ( ) == ClassHelper . CLOSURE_TYPE ; } public boolean isNotExplicitThisInClosure ( boolean implicitThis ) { return implicitThis || ! isInClosure ( ) ; } public boolean isStaticMethod ( ) { return methodNode != null && methodNode . isStatic ( ) ; } public ClassNode getReturnType ( ) { if ( methodNode != null ) { return methodNode . getReturnType ( ) ; } else if ( constructorNode != null ) { return constructorNode . getReturnType ( ) ; } else { throw new GroovyBugError ( "<STR_LIT>" ) ; } } public boolean isStaticConstructor ( ) { return methodNode != null && methodNode . getName ( ) . equals ( "<STR_LIT>" ) ; } public boolean isConstructor ( ) { return constructorNode != null ; } public boolean isInScriptBody ( ) { if ( classNode . isScriptBody ( ) ) { return true ; } else { return classNode . isScript ( ) && methodNode != null && methodNode . getName ( ) . equals ( "<STR_LIT>" ) ; } } public String getClassName ( ) { String className ; if ( ! classNode . isInterface ( ) || interfaceClassLoadingClass == null ) { className = internalClassName ; } else { className = BytecodeHelper . getClassInternalName ( interfaceClassLoadingClass ) ; } return className ; } public ClassNode getOutermostClass ( ) { if ( outermostClass == null ) { outermostClass = classNode ; while ( outermostClass instanceof InnerClassNode ) { outermostClass = outermostClass . getOuterClass ( ) ; } } return outermostClass ; } public GeneratorContext getContext ( ) { return context ; } public void setInterfaceClassLoadingClass ( InterfaceHelperClassNode ihc ) { interfaceClassLoadingClass = ihc ; } public InterfaceHelperClassNode getInterfaceClassLoadingClass ( ) { return interfaceClassLoadingClass ; } public boolean shouldOptimizeForInt ( ) { return optimizeForInt ; } public StatementWriter getStatementWriter ( ) { return statementWriter ; } public void switchToFastPath ( ) { fastPath = true ; resetLineNumber ( ) ; } public void switchToSlowPath ( ) { fastPath = false ; resetLineNumber ( ) ; } public boolean isFastPath ( ) { return fastPath ; } public int getBytecodeVersion ( ) { return bytecodeVersion ; } public int getLineNumber ( ) { return lineNumber ; } public void setLineNumber ( int n ) { lineNumber = n ; } public void resetLineNumber ( ) { setLineNumber ( - <NUM_LIT:1> ) ; } } </s>
|
<s> package org . codehaus . groovy . classgen . asm ; import org . codehaus . groovy . ast . * ; import org . codehaus . groovy . reflection . ReflectionCache ; import org . codehaus . groovy . runtime . typehandling . DefaultTypeTransformation ; import org . objectweb . asm . Label ; import org . objectweb . asm . MethodVisitor ; import org . objectweb . asm . Opcodes ; import java . lang . reflect . Modifier ; public class BytecodeHelper implements Opcodes { private static String DTT_CLASSNAME = BytecodeHelper . getClassInternalName ( DefaultTypeTransformation . class . getName ( ) ) ; public static String getClassInternalName ( ClassNode t ) { if ( t . isPrimaryClassNode ( ) ) { if ( t . isArray ( ) ) return "<STR_LIT>" + getClassInternalName ( t . getComponentType ( ) ) + "<STR_LIT:;>" ; return getClassInternalName ( t . getName ( ) ) ; } String name = t . getClassInternalName ( ) ; if ( name == null ) { if ( t . hasClass ( ) ) { name = getClassInternalName ( t . getTypeClass ( ) ) ; } else { name = getClassInternalName ( t . getName ( ) ) ; } } return name ; } public static String getClassInternalName ( Class t ) { return org . objectweb . asm . Type . getInternalName ( t ) ; } public static String getClassInternalName ( String name ) { return name . replace ( '<CHAR_LIT:.>' , '<CHAR_LIT:/>' ) ; } public static String getMethodDescriptor ( ClassNode returnType , Parameter [ ] parameters ) { StringBuffer buffer = new StringBuffer ( "<STR_LIT:(>" ) ; for ( int i = <NUM_LIT:0> ; i < parameters . length ; i ++ ) { buffer . append ( getTypeDescription ( parameters [ i ] . getType ( ) ) ) ; } buffer . append ( "<STR_LIT:)>" ) ; buffer . append ( getTypeDescription ( returnType ) ) ; return buffer . toString ( ) ; } public static String getMethodDescriptor ( Class returnType , Class [ ] paramTypes ) { StringBuffer buffer = new StringBuffer ( "<STR_LIT:(>" ) ; for ( int i = <NUM_LIT:0> ; i < paramTypes . length ; i ++ ) { buffer . append ( getTypeDescription ( paramTypes [ i ] ) ) ; } buffer . append ( "<STR_LIT:)>" ) ; buffer . append ( getTypeDescription ( returnType ) ) ; return buffer . toString ( ) ; } public static String getTypeDescription ( Class c ) { return org . objectweb . asm . Type . getDescriptor ( c ) ; } public static String getClassLoadingTypeDescription ( ClassNode c ) { StringBuffer buf = new StringBuffer ( ) ; boolean array = false ; while ( true ) { if ( c . isArray ( ) ) { buf . append ( '<CHAR_LIT:[>' ) ; c = c . getComponentType ( ) ; array = true ; } else { if ( ClassHelper . isPrimitiveType ( c ) ) { buf . append ( getTypeDescription ( c ) ) ; } else { if ( array ) buf . append ( '<CHAR_LIT>' ) ; buf . append ( c . getName ( ) ) ; if ( array ) buf . append ( '<CHAR_LIT:;>' ) ; } return buf . toString ( ) ; } } } public static String getTypeDescription ( ClassNode c ) { return getTypeDescription ( c , true ) ; } private static String getTypeDescription ( ClassNode c , boolean end ) { StringBuffer buf = new StringBuffer ( ) ; ClassNode d = c ; while ( true ) { if ( ClassHelper . isPrimitiveType ( d ) ) { char car ; if ( d == ClassHelper . int_TYPE ) { car = '<CHAR_LIT>' ; } else if ( d == ClassHelper . VOID_TYPE ) { car = '<CHAR_LIT>' ; } else if ( d == ClassHelper . boolean_TYPE ) { car = '<CHAR_LIT:Z>' ; } else if ( d == ClassHelper . byte_TYPE ) { car = '<CHAR_LIT>' ; } else if ( d == ClassHelper . char_TYPE ) { car = '<CHAR_LIT>' ; } else if ( d == ClassHelper . short_TYPE ) { car = '<CHAR_LIT>' ; } else if ( d == ClassHelper . double_TYPE ) { car = '<CHAR_LIT>' ; } else if ( d == ClassHelper . float_TYPE ) { car = '<CHAR_LIT>' ; } else { car = '<CHAR_LIT>' ; } buf . append ( car ) ; return buf . toString ( ) ; } else if ( d . isArray ( ) ) { buf . append ( '<CHAR_LIT:[>' ) ; d = d . getComponentType ( ) ; } else { buf . append ( '<CHAR_LIT>' ) ; String name = d . getName ( ) ; int len = name . length ( ) ; for ( int i = <NUM_LIT:0> ; i < len ; ++ i ) { char car = name . charAt ( i ) ; buf . append ( car == '<CHAR_LIT:.>' ? '<CHAR_LIT:/>' : car ) ; } if ( end ) buf . append ( '<CHAR_LIT:;>' ) ; return buf . toString ( ) ; } } } public static String [ ] getClassInternalNames ( ClassNode [ ] names ) { int size = names . length ; String [ ] answer = new String [ size ] ; for ( int i = <NUM_LIT:0> ; i < size ; i ++ ) { answer [ i ] = getClassInternalName ( names [ i ] ) ; } return answer ; } public static void pushConstant ( MethodVisitor mv , int value ) { switch ( value ) { case <NUM_LIT:0> : mv . visitInsn ( ICONST_0 ) ; break ; case <NUM_LIT:1> : mv . visitInsn ( ICONST_1 ) ; break ; case <NUM_LIT:2> : mv . visitInsn ( ICONST_2 ) ; break ; case <NUM_LIT:3> : mv . visitInsn ( ICONST_3 ) ; break ; case <NUM_LIT:4> : mv . visitInsn ( ICONST_4 ) ; break ; case <NUM_LIT:5> : mv . visitInsn ( ICONST_5 ) ; break ; default : if ( value >= Byte . MIN_VALUE && value <= Byte . MAX_VALUE ) { mv . visitIntInsn ( BIPUSH , value ) ; } else if ( value >= Short . MIN_VALUE && value <= Short . MAX_VALUE ) { mv . visitIntInsn ( SIPUSH , value ) ; } else { mv . visitLdcInsn ( Integer . valueOf ( value ) ) ; } } } public static void negateBoolean ( MethodVisitor mv ) { Label endLabel = new Label ( ) ; Label falseLabel = new Label ( ) ; mv . visitJumpInsn ( IFNE , falseLabel ) ; mv . visitInsn ( ICONST_1 ) ; mv . visitJumpInsn ( GOTO , endLabel ) ; mv . visitLabel ( falseLabel ) ; mv . visitInsn ( ICONST_0 ) ; mv . visitLabel ( endLabel ) ; } public static String formatNameForClassLoading ( String name ) { if ( name . equals ( "<STR_LIT:int>" ) || name . equals ( "<STR_LIT:long>" ) || name . equals ( "<STR_LIT>" ) || name . equals ( "<STR_LIT:float>" ) || name . equals ( "<STR_LIT:double>" ) || name . equals ( "<STR_LIT>" ) || name . equals ( "<STR_LIT>" ) || name . equals ( "<STR_LIT:boolean>" ) || name . equals ( "<STR_LIT>" ) ) { return name ; } if ( name == null ) { return "<STR_LIT>" ; } if ( name . startsWith ( "<STR_LIT:[>" ) ) { return name . replace ( '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ; } if ( name . startsWith ( "<STR_LIT>" ) ) { name = name . substring ( <NUM_LIT:1> ) ; if ( name . endsWith ( "<STR_LIT:;>" ) ) { name = name . substring ( <NUM_LIT:0> , name . length ( ) - <NUM_LIT:1> ) ; } return name . replace ( '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ; } String prefix = "<STR_LIT>" ; if ( name . endsWith ( "<STR_LIT:[]>" ) ) { prefix = "<STR_LIT:[>" ; name = name . substring ( <NUM_LIT:0> , name . length ( ) - <NUM_LIT:2> ) ; if ( name . equals ( "<STR_LIT:int>" ) ) { return prefix + "<STR_LIT:I>" ; } else if ( name . equals ( "<STR_LIT:long>" ) ) { return prefix + "<STR_LIT>" ; } else if ( name . equals ( "<STR_LIT>" ) ) { return prefix + "<STR_LIT:S>" ; } else if ( name . equals ( "<STR_LIT:float>" ) ) { return prefix + "<STR_LIT:F>" ; } else if ( name . equals ( "<STR_LIT:double>" ) ) { return prefix + "<STR_LIT:D>" ; } else if ( name . equals ( "<STR_LIT>" ) ) { return prefix + "<STR_LIT:B>" ; } else if ( name . equals ( "<STR_LIT>" ) ) { return prefix + "<STR_LIT:C>" ; } else if ( name . equals ( "<STR_LIT:boolean>" ) ) { return prefix + "<STR_LIT:Z>" ; } else { return prefix + "<STR_LIT>" + name . replace ( '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) + "<STR_LIT:;>" ; } } return name . replace ( '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ; } public static void doReturn ( MethodVisitor mv , ClassNode returnType ) { if ( returnType == ClassHelper . double_TYPE ) { mv . visitInsn ( DRETURN ) ; } else if ( returnType == ClassHelper . float_TYPE ) { mv . visitInsn ( FRETURN ) ; } else if ( returnType == ClassHelper . long_TYPE ) { mv . visitInsn ( LRETURN ) ; } else if ( returnType == ClassHelper . boolean_TYPE || returnType == ClassHelper . char_TYPE || returnType == ClassHelper . byte_TYPE || returnType == ClassHelper . int_TYPE || returnType == ClassHelper . short_TYPE ) { mv . visitInsn ( IRETURN ) ; } else if ( returnType == ClassHelper . VOID_TYPE ) { mv . visitInsn ( RETURN ) ; } else { mv . visitInsn ( ARETURN ) ; } } private static boolean hasGenerics ( Parameter [ ] param ) { if ( param . length == <NUM_LIT:0> ) return false ; for ( int i = <NUM_LIT:0> ; i < param . length ; i ++ ) { ClassNode type = param [ i ] . getType ( ) ; if ( hasGenerics ( type ) ) return true ; } return false ; } private static boolean hasGenerics ( ClassNode type ) { return type . isArray ( ) ? hasGenerics ( type . getComponentType ( ) ) : type . getGenericsTypes ( ) != null ; } public static String getGenericsMethodSignature ( MethodNode node ) { GenericsType [ ] generics = node . getGenericsTypes ( ) ; Parameter [ ] param = node . getParameters ( ) ; ClassNode returnType = node . getReturnType ( ) ; if ( generics == null && ! hasGenerics ( param ) && ! hasGenerics ( returnType ) ) return null ; StringBuffer ret = new StringBuffer ( <NUM_LIT:100> ) ; getGenericsTypeSpec ( ret , generics ) ; GenericsType [ ] paramTypes = new GenericsType [ param . length ] ; for ( int i = <NUM_LIT:0> ; i < param . length ; i ++ ) { ClassNode pType = param [ i ] . getType ( ) ; if ( pType . getGenericsTypes ( ) == null || ! pType . isGenericsPlaceHolder ( ) ) { paramTypes [ i ] = new GenericsType ( pType ) ; } else { paramTypes [ i ] = pType . getGenericsTypes ( ) [ <NUM_LIT:0> ] ; } } addSubTypes ( ret , paramTypes , "<STR_LIT:(>" , "<STR_LIT:)>" ) ; addSubTypes ( ret , new GenericsType [ ] { new GenericsType ( returnType ) } , "<STR_LIT>" , "<STR_LIT>" ) ; return ret . toString ( ) ; } private static boolean usesGenericsInClassSignature ( ClassNode node ) { if ( ! node . isUsingGenerics ( ) ) return false ; if ( hasGenerics ( node ) ) return true ; ClassNode sclass = node . getUnresolvedSuperClass ( false ) ; if ( sclass . isUsingGenerics ( ) ) return true ; ClassNode [ ] interfaces = node . getInterfaces ( ) ; if ( interfaces != null ) { for ( int i = <NUM_LIT:0> ; i < interfaces . length ; i ++ ) { if ( interfaces [ i ] . isUsingGenerics ( ) ) return true ; } } return false ; } public static String getGenericsSignature ( ClassNode node ) { if ( ! usesGenericsInClassSignature ( node ) ) return null ; GenericsType [ ] genericsTypes = node . getGenericsTypes ( ) ; StringBuffer ret = new StringBuffer ( <NUM_LIT:100> ) ; getGenericsTypeSpec ( ret , genericsTypes ) ; GenericsType extendsPart = new GenericsType ( node . getUnresolvedSuperClass ( false ) ) ; writeGenericsBounds ( ret , extendsPart , true ) ; ClassNode [ ] interfaces = node . getInterfaces ( ) ; for ( int i = <NUM_LIT:0> ; i < interfaces . length ; i ++ ) { GenericsType interfacePart = new GenericsType ( interfaces [ i ] ) ; writeGenericsBounds ( ret , interfacePart , false ) ; } return ret . toString ( ) ; } private static void getGenericsTypeSpec ( StringBuffer ret , GenericsType [ ] genericsTypes ) { if ( genericsTypes == null ) return ; ret . append ( '<CHAR_LIT>' ) ; for ( int i = <NUM_LIT:0> ; i < genericsTypes . length ; i ++ ) { String name = genericsTypes [ i ] . getName ( ) ; ret . append ( name ) ; ret . append ( '<CHAR_LIT::>' ) ; writeGenericsBounds ( ret , genericsTypes [ i ] , true ) ; } ret . append ( '<CHAR_LIT:>>' ) ; } public static String getGenericsBounds ( ClassNode type ) { GenericsType [ ] genericsTypes = type . getGenericsTypes ( ) ; if ( genericsTypes == null ) return null ; StringBuffer ret = new StringBuffer ( <NUM_LIT:100> ) ; if ( type . isGenericsPlaceHolder ( ) ) { addSubTypes ( ret , type . getGenericsTypes ( ) , "<STR_LIT>" , "<STR_LIT>" ) ; } else { GenericsType gt = new GenericsType ( type ) ; writeGenericsBounds ( ret , gt , false ) ; } return ret . toString ( ) ; } private static void writeGenericsBoundType ( StringBuffer ret , ClassNode printType , boolean writeInterfaceMarker ) { if ( writeInterfaceMarker && printType . isInterface ( ) ) ret . append ( "<STR_LIT::>" ) ; if ( printType . equals ( ClassHelper . OBJECT_TYPE ) && printType . getGenericsTypes ( ) != null ) { ret . append ( "<STR_LIT:T>" ) ; ret . append ( printType . getGenericsTypes ( ) [ <NUM_LIT:0> ] . getName ( ) ) ; ret . append ( "<STR_LIT:;>" ) ; } else { ret . append ( getTypeDescription ( printType , false ) ) ; addSubTypes ( ret , printType . getGenericsTypes ( ) , "<STR_LIT:<>" , "<STR_LIT:>>" ) ; if ( ! ClassHelper . isPrimitiveType ( printType ) ) ret . append ( "<STR_LIT:;>" ) ; } } private static void writeGenericsBounds ( StringBuffer ret , GenericsType type , boolean writeInterfaceMarker ) { if ( type . getUpperBounds ( ) != null ) { ClassNode [ ] bounds = type . getUpperBounds ( ) ; for ( int i = <NUM_LIT:0> ; i < bounds . length ; i ++ ) { writeGenericsBoundType ( ret , bounds [ i ] , writeInterfaceMarker ) ; } } else if ( type . getLowerBound ( ) != null ) { writeGenericsBoundType ( ret , type . getLowerBound ( ) , writeInterfaceMarker ) ; } else { writeGenericsBoundType ( ret , type . getType ( ) , writeInterfaceMarker ) ; } } private static void addSubTypes ( StringBuffer ret , GenericsType [ ] types , String start , String end ) { if ( types == null ) return ; ret . append ( start ) ; for ( int i = <NUM_LIT:0> ; i < types . length ; i ++ ) { if ( types [ i ] . getType ( ) . isArray ( ) ) { ret . append ( "<STR_LIT:[>" ) ; addSubTypes ( ret , new GenericsType [ ] { new GenericsType ( types [ i ] . getType ( ) . getComponentType ( ) ) } , "<STR_LIT>" , "<STR_LIT>" ) ; } else { if ( types [ i ] . isPlaceholder ( ) ) { ret . append ( '<CHAR_LIT>' ) ; String name = types [ i ] . getName ( ) ; ret . append ( name ) ; ret . append ( '<CHAR_LIT:;>' ) ; } else if ( types [ i ] . isWildcard ( ) ) { if ( types [ i ] . getUpperBounds ( ) != null ) { ret . append ( '<CHAR_LIT>' ) ; writeGenericsBounds ( ret , types [ i ] , false ) ; } else if ( types [ i ] . getLowerBound ( ) != null ) { ret . append ( '<CHAR_LIT:->' ) ; writeGenericsBounds ( ret , types [ i ] , false ) ; } else { ret . append ( '<CHAR_LIT>' ) ; } } else { writeGenericsBounds ( ret , types [ i ] , false ) ; } } } ret . append ( end ) ; } public static void load ( MethodVisitor mv , ClassNode type , int idx ) { if ( type == ClassHelper . double_TYPE ) { mv . visitVarInsn ( DLOAD , idx ) ; } else if ( type == ClassHelper . float_TYPE ) { mv . visitVarInsn ( FLOAD , idx ) ; } else if ( type == ClassHelper . long_TYPE ) { mv . visitVarInsn ( LLOAD , idx ) ; } else if ( type == ClassHelper . boolean_TYPE || type == ClassHelper . char_TYPE || type == ClassHelper . byte_TYPE || type == ClassHelper . int_TYPE || type == ClassHelper . short_TYPE ) { mv . visitVarInsn ( ILOAD , idx ) ; } else { mv . visitVarInsn ( ALOAD , idx ) ; } } public static void doCast ( MethodVisitor mv , ClassNode type ) { if ( type == ClassHelper . OBJECT_TYPE ) return ; if ( ClassHelper . isPrimitiveType ( type ) && type != ClassHelper . VOID_TYPE ) { unbox ( mv , type ) ; } else { mv . visitTypeInsn ( CHECKCAST , type . isArray ( ) ? BytecodeHelper . getTypeDescription ( type ) : BytecodeHelper . getClassInternalName ( type . getName ( ) ) ) ; } } public static void doCastToPrimitive ( MethodVisitor mv , ClassNode sourceType , ClassNode targetType ) { mv . visitMethodInsn ( INVOKEVIRTUAL , BytecodeHelper . getClassInternalName ( sourceType ) , targetType . getName ( ) + "<STR_LIT>" , "<STR_LIT>" + BytecodeHelper . getTypeDescription ( targetType ) ) ; } public static void doCastToWrappedType ( MethodVisitor mv , ClassNode sourceType , ClassNode targetType ) { mv . visitMethodInsn ( INVOKESTATIC , getClassInternalName ( targetType ) , "<STR_LIT>" , "<STR_LIT:(>" + getTypeDescription ( sourceType ) + "<STR_LIT:)>" + getTypeDescription ( targetType ) ) ; } public static void doCast ( MethodVisitor mv , Class type ) { if ( type == Object . class ) return ; if ( type . isPrimitive ( ) && type != Void . TYPE ) { unbox ( mv , type ) ; } else { mv . visitTypeInsn ( CHECKCAST , type . isArray ( ) ? BytecodeHelper . getTypeDescription ( type ) : BytecodeHelper . getClassInternalName ( type . getName ( ) ) ) ; } } public static void unbox ( MethodVisitor mv , Class type ) { if ( type . isPrimitive ( ) && type != Void . TYPE ) { String returnString = "<STR_LIT>" + BytecodeHelper . getTypeDescription ( type ) ; mv . visitMethodInsn ( INVOKESTATIC , DTT_CLASSNAME , type . getName ( ) + "<STR_LIT>" , returnString ) ; } } public static void unbox ( MethodVisitor mv , ClassNode type ) { if ( type . isPrimaryClassNode ( ) ) return ; if ( type . isPrimitive ( ) ) unbox ( mv , type . getTypeClass ( ) ) ; } public static boolean box ( MethodVisitor mv , ClassNode type ) { if ( type . isPrimaryClassNode ( ) ) return false ; if ( ! type . isPrimitive ( ) ) return false ; return box ( mv , type . getTypeClass ( ) ) ; } public static boolean box ( MethodVisitor mv , Class type ) { if ( ReflectionCache . getCachedClass ( type ) . isPrimitive && type != void . class ) { String returnString = "<STR_LIT:(>" + BytecodeHelper . getTypeDescription ( type ) + "<STR_LIT>" ; mv . visitMethodInsn ( INVOKESTATIC , DTT_CLASSNAME , "<STR_LIT>" , returnString ) ; return true ; } return false ; } public static void visitClassLiteral ( MethodVisitor mv , ClassNode classNode ) { if ( ClassHelper . isPrimitiveType ( classNode ) ) { mv . visitFieldInsn ( GETSTATIC , getClassInternalName ( ClassHelper . getWrapper ( classNode ) ) , "<STR_LIT>" , "<STR_LIT>" ) ; } else { mv . visitLdcInsn ( org . objectweb . asm . Type . getType ( getTypeDescription ( classNode ) ) ) ; } } public static boolean isClassLiteralPossible ( ClassNode classNode ) { return Modifier . isPublic ( classNode . getModifiers ( ) ) ; } public static boolean isSameCompilationUnit ( ClassNode a , ClassNode b ) { CompileUnit cu1 = a . getCompileUnit ( ) ; CompileUnit cu2 = b . getCompileUnit ( ) ; return cu1 != null && cu2 != null && cu1 == cu2 ; } } </s>
|
<s> package org . codehaus . groovy . classgen . asm ; import java . util . Iterator ; import java . util . List ; import org . codehaus . groovy . ast . ClassHelper ; import org . codehaus . groovy . ast . ClassNode ; import org . codehaus . groovy . ast . Parameter ; import org . codehaus . groovy . ast . expr . ArgumentListExpression ; import org . codehaus . groovy . ast . expr . ClosureListExpression ; import org . codehaus . groovy . ast . expr . ConstantExpression ; import org . codehaus . groovy . ast . expr . EmptyExpression ; import org . codehaus . groovy . ast . expr . Expression ; import org . codehaus . groovy . ast . expr . MethodCallExpression ; import org . codehaus . groovy . ast . stmt . AssertStatement ; import org . codehaus . groovy . ast . stmt . BlockStatement ; import org . codehaus . groovy . ast . stmt . BreakStatement ; import org . codehaus . groovy . ast . stmt . CaseStatement ; import org . codehaus . groovy . ast . stmt . CatchStatement ; import org . codehaus . groovy . ast . stmt . ContinueStatement ; import org . codehaus . groovy . ast . stmt . DoWhileStatement ; import org . codehaus . groovy . ast . stmt . EmptyStatement ; import org . codehaus . groovy . ast . stmt . ExpressionStatement ; import org . codehaus . groovy . ast . stmt . ForStatement ; import org . codehaus . groovy . ast . stmt . IfStatement ; import org . codehaus . groovy . ast . stmt . ReturnStatement ; import org . codehaus . groovy . ast . stmt . Statement ; import org . codehaus . groovy . ast . stmt . SwitchStatement ; import org . codehaus . groovy . ast . stmt . SynchronizedStatement ; import org . codehaus . groovy . ast . stmt . ThrowStatement ; import org . codehaus . groovy . ast . stmt . TryCatchStatement ; import org . codehaus . groovy . ast . stmt . WhileStatement ; import org . codehaus . groovy . classgen . asm . CompileStack . BlockRecorder ; import org . objectweb . asm . Label ; import org . objectweb . asm . MethodVisitor ; import static org . objectweb . asm . Opcodes . * ; public class StatementWriter { private static final MethodCaller iteratorNextMethod = MethodCaller . newInterface ( Iterator . class , "<STR_LIT>" ) ; private static final MethodCaller iteratorHasNextMethod = MethodCaller . newInterface ( Iterator . class , "<STR_LIT>" ) ; private WriterController controller ; public StatementWriter ( WriterController controller ) { this . controller = controller ; } protected void writeStatementLabel ( Statement statement ) { String name = statement . getStatementLabel ( ) ; if ( name != null ) { Label label = controller . getCompileStack ( ) . createLocalLabel ( name ) ; controller . getMethodVisitor ( ) . visitLabel ( label ) ; } } public void writeBlockStatement ( BlockStatement block ) { CompileStack compileStack = controller . getCompileStack ( ) ; writeStatementLabel ( block ) ; int mark = controller . getOperandStack ( ) . getStackLength ( ) ; compileStack . pushVariableScope ( block . getVariableScope ( ) ) ; for ( Statement statement : block . getStatements ( ) ) { statement . visit ( controller . getAcg ( ) ) ; } compileStack . pop ( ) ; controller . getOperandStack ( ) . popDownTo ( mark ) ; } public void writeForStatement ( ForStatement loop ) { Parameter loopVar = loop . getVariable ( ) ; if ( loopVar == ForStatement . FOR_LOOP_DUMMY ) { writeForLoopWithClosureList ( loop ) ; } else { writeForInLoop ( loop ) ; } } protected void writeIteratorHasNext ( MethodVisitor mv ) { iteratorHasNextMethod . call ( mv ) ; } protected void writeIteratorNext ( MethodVisitor mv ) { iteratorNextMethod . call ( mv ) ; } protected void writeForInLoop ( ForStatement loop ) { controller . getAcg ( ) . onLineNumber ( loop , "<STR_LIT>" ) ; writeStatementLabel ( loop ) ; CompileStack compileStack = controller . getCompileStack ( ) ; MethodVisitor mv = controller . getMethodVisitor ( ) ; OperandStack operandStack = controller . getOperandStack ( ) ; compileStack . pushLoop ( loop . getVariableScope ( ) , loop . getStatementLabel ( ) ) ; BytecodeVariable variable = compileStack . defineVariable ( loop . getVariable ( ) , false ) ; MethodCallExpression iterator = new MethodCallExpression ( loop . getCollectionExpression ( ) , "<STR_LIT>" , new ArgumentListExpression ( ) ) ; iterator . visit ( controller . getAcg ( ) ) ; operandStack . doGroovyCast ( ClassHelper . Iterator_TYPE ) ; final int iteratorIdx = compileStack . defineTemporaryVariable ( "<STR_LIT>" , ClassHelper . Iterator_TYPE , true ) ; Label continueLabel = compileStack . getContinueLabel ( ) ; Label breakLabel = compileStack . getBreakLabel ( ) ; mv . visitLabel ( continueLabel ) ; mv . visitVarInsn ( ALOAD , iteratorIdx ) ; writeIteratorHasNext ( mv ) ; mv . visitJumpInsn ( IFEQ , breakLabel ) ; mv . visitVarInsn ( ALOAD , iteratorIdx ) ; writeIteratorNext ( mv ) ; operandStack . push ( ClassHelper . OBJECT_TYPE ) ; operandStack . storeVar ( variable ) ; loop . getLoopBlock ( ) . visit ( controller . getAcg ( ) ) ; mv . visitJumpInsn ( GOTO , continueLabel ) ; mv . visitLabel ( breakLabel ) ; compileStack . pop ( ) ; } protected void writeForLoopWithClosureList ( ForStatement loop ) { controller . getAcg ( ) . onLineNumber ( loop , "<STR_LIT>" ) ; writeStatementLabel ( loop ) ; MethodVisitor mv = controller . getMethodVisitor ( ) ; controller . getCompileStack ( ) . pushLoop ( loop . getVariableScope ( ) , loop . getStatementLabel ( ) ) ; ClosureListExpression clExpr = ( ClosureListExpression ) loop . getCollectionExpression ( ) ; controller . getCompileStack ( ) . pushVariableScope ( clExpr . getVariableScope ( ) ) ; List expressions = clExpr . getExpressions ( ) ; int size = expressions . size ( ) ; int condIndex = ( size - <NUM_LIT:1> ) / <NUM_LIT:2> ; for ( int i = <NUM_LIT:0> ; i < condIndex ; i ++ ) { visitExpressionOrStatement ( expressions . get ( i ) ) ; } Label continueLabel = controller . getCompileStack ( ) . getContinueLabel ( ) ; Label breakLabel = controller . getCompileStack ( ) . getBreakLabel ( ) ; Label cond = new Label ( ) ; mv . visitLabel ( cond ) ; { Expression condExpr = ( Expression ) expressions . get ( condIndex ) ; int mark = controller . getOperandStack ( ) . getStackLength ( ) ; condExpr . visit ( controller . getAcg ( ) ) ; controller . getOperandStack ( ) . castToBool ( mark , true ) ; } controller . getOperandStack ( ) . jump ( IFEQ , breakLabel ) ; loop . getLoopBlock ( ) . visit ( controller . getAcg ( ) ) ; mv . visitLabel ( continueLabel ) ; controller . getAcg ( ) . onLineNumber ( loop , "<STR_LIT>" ) ; for ( int i = condIndex + <NUM_LIT:1> ; i < size ; i ++ ) { visitExpressionOrStatement ( expressions . get ( i ) ) ; } mv . visitJumpInsn ( GOTO , cond ) ; mv . visitLabel ( breakLabel ) ; controller . getCompileStack ( ) . pop ( ) ; controller . getCompileStack ( ) . pop ( ) ; } private void visitExpressionOrStatement ( Object o ) { if ( o == EmptyExpression . INSTANCE ) return ; if ( o instanceof Expression ) { Expression expr = ( Expression ) o ; int mark = controller . getOperandStack ( ) . getStackLength ( ) ; expr . visit ( controller . getAcg ( ) ) ; controller . getOperandStack ( ) . popDownTo ( mark ) ; } else { ( ( Statement ) o ) . visit ( controller . getAcg ( ) ) ; } } public void writeWhileLoop ( WhileStatement loop ) { controller . getAcg ( ) . onLineNumber ( loop , "<STR_LIT>" ) ; writeStatementLabel ( loop ) ; MethodVisitor mv = controller . getMethodVisitor ( ) ; controller . getCompileStack ( ) . pushLoop ( loop . getStatementLabel ( ) ) ; Label continueLabel = controller . getCompileStack ( ) . getContinueLabel ( ) ; Label breakLabel = controller . getCompileStack ( ) . getBreakLabel ( ) ; mv . visitLabel ( continueLabel ) ; Expression bool = loop . getBooleanExpression ( ) ; boolean boolHandled = false ; if ( bool instanceof ConstantExpression ) { ConstantExpression constant = ( ConstantExpression ) bool ; if ( constant . getValue ( ) == Boolean . TRUE ) { boolHandled = true ; } else if ( constant . getValue ( ) == Boolean . FALSE ) { boolHandled = true ; mv . visitJumpInsn ( GOTO , breakLabel ) ; } } if ( ! boolHandled ) { bool . visit ( controller . getAcg ( ) ) ; controller . getOperandStack ( ) . jump ( IFEQ , breakLabel ) ; } loop . getLoopBlock ( ) . visit ( controller . getAcg ( ) ) ; mv . visitJumpInsn ( GOTO , continueLabel ) ; mv . visitLabel ( breakLabel ) ; controller . getCompileStack ( ) . pop ( ) ; } public void writeDoWhileLoop ( DoWhileStatement loop ) { controller . getAcg ( ) . onLineNumber ( loop , "<STR_LIT>" ) ; writeStatementLabel ( loop ) ; MethodVisitor mv = controller . getMethodVisitor ( ) ; controller . getCompileStack ( ) . pushLoop ( loop . getStatementLabel ( ) ) ; Label breakLabel = controller . getCompileStack ( ) . getBreakLabel ( ) ; Label continueLabel = controller . getCompileStack ( ) . getContinueLabel ( ) ; mv . visitLabel ( continueLabel ) ; loop . getLoopBlock ( ) . visit ( controller . getAcg ( ) ) ; loop . getBooleanExpression ( ) . visit ( controller . getAcg ( ) ) ; controller . getOperandStack ( ) . jump ( IFEQ , continueLabel ) ; mv . visitLabel ( breakLabel ) ; controller . getCompileStack ( ) . pop ( ) ; } public void writeIfElse ( IfStatement ifElse ) { controller . getAcg ( ) . onLineNumber ( ifElse , "<STR_LIT>" ) ; writeStatementLabel ( ifElse ) ; MethodVisitor mv = controller . getMethodVisitor ( ) ; ifElse . getBooleanExpression ( ) . visit ( controller . getAcg ( ) ) ; Label l0 = controller . getOperandStack ( ) . jump ( IFEQ ) ; controller . getCompileStack ( ) . pushBooleanExpression ( ) ; ifElse . getIfBlock ( ) . visit ( controller . getAcg ( ) ) ; controller . getCompileStack ( ) . pop ( ) ; if ( ifElse . getElseBlock ( ) == EmptyStatement . INSTANCE ) { mv . visitLabel ( l0 ) ; } else { Label l1 = new Label ( ) ; mv . visitJumpInsn ( GOTO , l1 ) ; mv . visitLabel ( l0 ) ; controller . getCompileStack ( ) . pushBooleanExpression ( ) ; ifElse . getElseBlock ( ) . visit ( controller . getAcg ( ) ) ; controller . getCompileStack ( ) . pop ( ) ; mv . visitLabel ( l1 ) ; } } public void writeTryCatchFinally ( TryCatchStatement statement ) { controller . getAcg ( ) . onLineNumber ( statement , "<STR_LIT>" ) ; writeStatementLabel ( statement ) ; MethodVisitor mv = controller . getMethodVisitor ( ) ; CompileStack compileStack = controller . getCompileStack ( ) ; OperandStack operandStack = controller . getOperandStack ( ) ; Statement tryStatement = statement . getTryStatement ( ) ; final Statement finallyStatement = statement . getFinallyStatement ( ) ; Label tryStart = new Label ( ) ; mv . visitLabel ( tryStart ) ; BlockRecorder tryBlock = makeBlockRecorder ( finallyStatement ) ; tryBlock . startRange ( tryStart ) ; tryStatement . visit ( controller . getAcg ( ) ) ; Label finallyStart = new Label ( ) ; mv . visitJumpInsn ( GOTO , finallyStart ) ; Label tryEnd = new Label ( ) ; mv . visitLabel ( tryEnd ) ; tryBlock . closeRange ( tryEnd ) ; controller . getCompileStack ( ) . pop ( ) ; BlockRecorder catches = makeBlockRecorder ( finallyStatement ) ; for ( CatchStatement catchStatement : statement . getCatchStatements ( ) ) { ClassNode exceptionType = catchStatement . getExceptionType ( ) ; String exceptionTypeInternalName = BytecodeHelper . getClassInternalName ( exceptionType ) ; Label catchStart = new Label ( ) ; mv . visitLabel ( catchStart ) ; catches . startRange ( catchStart ) ; Parameter exceptionVariable = catchStatement . getVariable ( ) ; compileStack . pushState ( ) ; compileStack . defineVariable ( exceptionVariable , true ) ; catchStatement . visit ( controller . getAcg ( ) ) ; mv . visitInsn ( NOP ) ; controller . getCompileStack ( ) . pop ( ) ; Label catchEnd = new Label ( ) ; mv . visitLabel ( catchEnd ) ; catches . closeRange ( catchEnd ) ; mv . visitJumpInsn ( GOTO , finallyStart ) ; compileStack . writeExceptionTable ( tryBlock , catchStart , exceptionTypeInternalName ) ; } Label catchAny = new Label ( ) ; compileStack . writeExceptionTable ( tryBlock , catchAny , null ) ; compileStack . writeExceptionTable ( catches , catchAny , null ) ; compileStack . pop ( ) ; mv . visitLabel ( finallyStart ) ; finallyStatement . visit ( controller . getAcg ( ) ) ; mv . visitInsn ( NOP ) ; Label skipCatchAll = new Label ( ) ; mv . visitJumpInsn ( GOTO , skipCatchAll ) ; mv . visitLabel ( catchAny ) ; operandStack . push ( ClassHelper . OBJECT_TYPE ) ; int anyExceptionIndex = compileStack . defineTemporaryVariable ( "<STR_LIT>" , true ) ; finallyStatement . visit ( controller . getAcg ( ) ) ; mv . visitVarInsn ( ALOAD , anyExceptionIndex ) ; mv . visitInsn ( ATHROW ) ; mv . visitLabel ( skipCatchAll ) ; } private BlockRecorder makeBlockRecorder ( final Statement finallyStatement ) { final BlockRecorder block = new BlockRecorder ( ) ; Runnable tryRunner = new Runnable ( ) { public void run ( ) { controller . getCompileStack ( ) . pushBlockRecorderVisit ( block ) ; finallyStatement . visit ( controller . getAcg ( ) ) ; controller . getCompileStack ( ) . popBlockRecorderVisit ( block ) ; } } ; block . excludedStatement = tryRunner ; controller . getCompileStack ( ) . pushBlockRecorder ( block ) ; return block ; } public void writeSwitch ( SwitchStatement statement ) { controller . getAcg ( ) . onLineNumber ( statement , "<STR_LIT>" ) ; writeStatementLabel ( statement ) ; statement . getExpression ( ) . visit ( controller . getAcg ( ) ) ; Label breakLabel = controller . getCompileStack ( ) . pushSwitch ( ) ; int switchVariableIndex = controller . getCompileStack ( ) . defineTemporaryVariable ( "<STR_LIT>" , true ) ; List caseStatements = statement . getCaseStatements ( ) ; int caseCount = caseStatements . size ( ) ; Label [ ] labels = new Label [ caseCount + <NUM_LIT:1> ] ; for ( int i = <NUM_LIT:0> ; i < caseCount ; i ++ ) { labels [ i ] = new Label ( ) ; } int i = <NUM_LIT:0> ; for ( Iterator iter = caseStatements . iterator ( ) ; iter . hasNext ( ) ; i ++ ) { CaseStatement caseStatement = ( CaseStatement ) iter . next ( ) ; writeCaseStatement ( caseStatement , switchVariableIndex , labels [ i ] , labels [ i + <NUM_LIT:1> ] ) ; } statement . getDefaultStatement ( ) . visit ( controller . getAcg ( ) ) ; controller . getMethodVisitor ( ) . visitLabel ( breakLabel ) ; controller . getCompileStack ( ) . pop ( ) ; } protected void writeCaseStatement ( CaseStatement statement , int switchVariableIndex , Label thisLabel , Label nextLabel ) { controller . getAcg ( ) . onLineNumber ( statement , "<STR_LIT>" ) ; MethodVisitor mv = controller . getMethodVisitor ( ) ; OperandStack operandStack = controller . getOperandStack ( ) ; mv . visitVarInsn ( ALOAD , switchVariableIndex ) ; statement . getExpression ( ) . visit ( controller . getAcg ( ) ) ; operandStack . box ( ) ; controller . getBinaryExpressionHelper ( ) . getIsCaseMethod ( ) . call ( mv ) ; operandStack . replace ( ClassHelper . boolean_TYPE ) ; Label l0 = controller . getOperandStack ( ) . jump ( IFEQ ) ; mv . visitLabel ( thisLabel ) ; statement . getCode ( ) . visit ( controller . getAcg ( ) ) ; if ( nextLabel != null ) { mv . visitJumpInsn ( GOTO , nextLabel ) ; } mv . visitLabel ( l0 ) ; } public void writeBreak ( BreakStatement statement ) { controller . getAcg ( ) . onLineNumber ( statement , "<STR_LIT>" ) ; writeStatementLabel ( statement ) ; String name = statement . getLabel ( ) ; Label breakLabel = controller . getCompileStack ( ) . getNamedBreakLabel ( name ) ; controller . getCompileStack ( ) . applyFinallyBlocks ( breakLabel , true ) ; controller . getMethodVisitor ( ) . visitJumpInsn ( GOTO , breakLabel ) ; } public void writeContinue ( ContinueStatement statement ) { controller . getAcg ( ) . onLineNumber ( statement , "<STR_LIT>" ) ; writeStatementLabel ( statement ) ; String name = statement . getLabel ( ) ; Label continueLabel = controller . getCompileStack ( ) . getContinueLabel ( ) ; if ( name != null ) continueLabel = controller . getCompileStack ( ) . getNamedContinueLabel ( name ) ; controller . getCompileStack ( ) . applyFinallyBlocks ( continueLabel , false ) ; controller . getMethodVisitor ( ) . visitJumpInsn ( GOTO , continueLabel ) ; } public void writeSynchronized ( SynchronizedStatement statement ) { controller . getAcg ( ) . onLineNumber ( statement , "<STR_LIT>" ) ; writeStatementLabel ( statement ) ; final MethodVisitor mv = controller . getMethodVisitor ( ) ; CompileStack compileStack = controller . getCompileStack ( ) ; statement . getExpression ( ) . visit ( controller . getAcg ( ) ) ; controller . getOperandStack ( ) . box ( ) ; final int index = compileStack . defineTemporaryVariable ( "<STR_LIT>" , ClassHelper . OBJECT_TYPE , true ) ; final Label synchronizedStart = new Label ( ) ; final Label synchronizedEnd = new Label ( ) ; final Label catchAll = new Label ( ) ; mv . visitVarInsn ( ALOAD , index ) ; mv . visitInsn ( MONITORENTER ) ; mv . visitLabel ( synchronizedStart ) ; mv . visitInsn ( NOP ) ; Runnable finallyPart = new Runnable ( ) { public void run ( ) { mv . visitVarInsn ( ALOAD , index ) ; mv . visitInsn ( MONITOREXIT ) ; } } ; BlockRecorder fb = new BlockRecorder ( finallyPart ) ; fb . startRange ( synchronizedStart ) ; compileStack . pushBlockRecorder ( fb ) ; statement . getCode ( ) . visit ( controller . getAcg ( ) ) ; fb . closeRange ( catchAll ) ; compileStack . writeExceptionTable ( fb , catchAll , null ) ; compileStack . pop ( ) ; finallyPart . run ( ) ; mv . visitJumpInsn ( GOTO , synchronizedEnd ) ; mv . visitLabel ( catchAll ) ; finallyPart . run ( ) ; mv . visitInsn ( ATHROW ) ; mv . visitLabel ( synchronizedEnd ) ; } public void writeAssert ( AssertStatement statement ) { controller . getAcg ( ) . onLineNumber ( statement , "<STR_LIT>" ) ; writeStatementLabel ( statement ) ; controller . getAssertionWriter ( ) . writeAssertStatement ( statement ) ; } public void writeThrow ( ThrowStatement statement ) { controller . getAcg ( ) . onLineNumber ( statement , "<STR_LIT>" ) ; writeStatementLabel ( statement ) ; MethodVisitor mv = controller . getMethodVisitor ( ) ; statement . getExpression ( ) . visit ( controller . getAcg ( ) ) ; mv . visitTypeInsn ( CHECKCAST , "<STR_LIT>" ) ; mv . visitInsn ( ATHROW ) ; controller . getOperandStack ( ) . remove ( <NUM_LIT:1> ) ; } public void writeReturn ( ReturnStatement statement ) { controller . getAcg ( ) . onLineNumber ( statement , "<STR_LIT>" ) ; writeStatementLabel ( statement ) ; MethodVisitor mv = controller . getMethodVisitor ( ) ; OperandStack operandStack = controller . getOperandStack ( ) ; ClassNode returnType = controller . getReturnType ( ) ; if ( returnType == ClassHelper . VOID_TYPE ) { if ( ! ( statement . isReturningNullOrVoid ( ) ) ) { controller . getAcg ( ) . throwException ( "<STR_LIT>" ) ; } controller . getCompileStack ( ) . applyBlockRecorder ( ) ; mv . visitInsn ( RETURN ) ; return ; } Expression expression = statement . getExpression ( ) ; expression . visit ( controller . getAcg ( ) ) ; if ( controller . getCompileStack ( ) . hasBlockRecorder ( ) ) { ClassNode type = operandStack . getTopOperand ( ) ; int returnValueIdx = controller . getCompileStack ( ) . defineTemporaryVariable ( "<STR_LIT>" , type , true ) ; controller . getCompileStack ( ) . applyBlockRecorder ( ) ; operandStack . load ( type , returnValueIdx ) ; } operandStack . doGroovyCast ( returnType ) ; BytecodeHelper . doReturn ( mv , returnType ) ; operandStack . remove ( <NUM_LIT:1> ) ; } public void writeExpressionStatement ( ExpressionStatement statement ) { controller . getAcg ( ) . onLineNumber ( statement , "<STR_LIT>" + statement . getExpression ( ) . getClass ( ) . getName ( ) ) ; writeStatementLabel ( statement ) ; Expression expression = statement . getExpression ( ) ; int mark = controller . getOperandStack ( ) . getStackLength ( ) ; expression . visit ( controller . getAcg ( ) ) ; controller . getOperandStack ( ) . popDownTo ( mark ) ; } } </s>
|
<s> package org . codehaus . groovy . classgen . asm ; import org . codehaus . groovy . GroovyBugError ; import org . codehaus . groovy . ast . ClassHelper ; import org . codehaus . groovy . ast . ClassNode ; import org . codehaus . groovy . ast . Parameter ; import org . codehaus . groovy . ast . Variable ; import org . codehaus . groovy . ast . VariableScope ; import org . objectweb . asm . Label ; import org . objectweb . asm . MethodVisitor ; import org . objectweb . asm . Opcodes ; import java . util . * ; public class CompileStack implements Opcodes { private boolean clear = true ; private VariableScope scope ; private Label continueLabel ; private Label breakLabel ; private Map stackVariables = new HashMap ( ) ; private int currentVariableIndex = <NUM_LIT:1> ; private int nextVariableIndex = <NUM_LIT:1> ; private final LinkedList temporaryVariables = new LinkedList ( ) ; private final LinkedList usedVariables = new LinkedList ( ) ; private Map superBlockNamedLabels = new HashMap ( ) ; private Map currentBlockNamedLabels = new HashMap ( ) ; private LinkedList < BlockRecorder > finallyBlocks = new LinkedList < BlockRecorder > ( ) ; private LinkedList < BlockRecorder > visitedBlocks = new LinkedList < BlockRecorder > ( ) ; private Label thisStartLabel , thisEndLabel ; private final LinkedList stateStack = new LinkedList ( ) ; private LinkedList < Boolean > implicitThisStack = new LinkedList ( ) ; private LinkedList < Boolean > lhsStack = new LinkedList ( ) ; { implicitThisStack . add ( false ) ; lhsStack . add ( false ) ; } private int localVariableOffset ; private final Map namedLoopBreakLabel = new HashMap ( ) ; private final Map namedLoopContinueLabel = new HashMap ( ) ; private String className ; private LinkedList < ExceptionTableEntry > typedExceptions = new LinkedList < ExceptionTableEntry > ( ) ; private LinkedList < ExceptionTableEntry > untypedExceptions = new LinkedList < ExceptionTableEntry > ( ) ; private boolean lhs ; private boolean implicitThis ; private WriterController controller ; private boolean inSpecialConstructallCall ; protected static class LabelRange { public Label start ; public Label end ; } public static class BlockRecorder { private boolean isEmpty = true ; public Runnable excludedStatement ; public LinkedList < LabelRange > ranges ; public BlockRecorder ( ) { ranges = new LinkedList < LabelRange > ( ) ; } public BlockRecorder ( Runnable excludedStatement ) { this ( ) ; this . excludedStatement = excludedStatement ; } public void startRange ( Label start ) { LabelRange range = new LabelRange ( ) ; range . start = start ; ranges . add ( range ) ; isEmpty = false ; } public void closeRange ( Label end ) { ranges . getLast ( ) . end = end ; } } private class ExceptionTableEntry { Label start , end , goal ; String sig ; } private class StateStackElement { final VariableScope scope ; final Label continueLabel ; final Label breakLabel ; final Map stackVariables ; final Map currentBlockNamedLabels ; final LinkedList < BlockRecorder > finallyBlocks ; final boolean inSpecialConstructallCall ; StateStackElement ( ) { scope = CompileStack . this . scope ; continueLabel = CompileStack . this . continueLabel ; breakLabel = CompileStack . this . breakLabel ; stackVariables = CompileStack . this . stackVariables ; currentBlockNamedLabels = CompileStack . this . currentBlockNamedLabels ; finallyBlocks = CompileStack . this . finallyBlocks ; inSpecialConstructallCall = CompileStack . this . inSpecialConstructallCall ; } } public CompileStack ( WriterController wc ) { this . controller = wc ; } public void pushState ( ) { stateStack . add ( new StateStackElement ( ) ) ; stackVariables = new HashMap ( stackVariables ) ; finallyBlocks = new LinkedList ( finallyBlocks ) ; } private void popState ( ) { if ( stateStack . size ( ) == <NUM_LIT:0> ) { throw new GroovyBugError ( "<STR_LIT>" ) ; } StateStackElement element = ( StateStackElement ) stateStack . removeLast ( ) ; scope = element . scope ; continueLabel = element . continueLabel ; breakLabel = element . breakLabel ; stackVariables = element . stackVariables ; finallyBlocks = element . finallyBlocks ; inSpecialConstructallCall = element . inSpecialConstructallCall ; } public Label getContinueLabel ( ) { return continueLabel ; } public Label getBreakLabel ( ) { return breakLabel ; } public void removeVar ( int tempIndex ) { final BytecodeVariable head = ( BytecodeVariable ) temporaryVariables . removeFirst ( ) ; if ( head . getIndex ( ) != tempIndex ) { temporaryVariables . addFirst ( head ) ; throw new GroovyBugError ( "<STR_LIT>" + "<STR_LIT>" + tempIndex + "<STR_LIT>" + "<STR_LIT>" + temporaryVariables ) ; } } private void setEndLabels ( ) { Label endLabel = new Label ( ) ; controller . getMethodVisitor ( ) . visitLabel ( endLabel ) ; for ( Iterator iter = stackVariables . values ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { BytecodeVariable var = ( BytecodeVariable ) iter . next ( ) ; var . setEndLabel ( endLabel ) ; } thisEndLabel = endLabel ; } public void pop ( ) { setEndLabels ( ) ; popState ( ) ; } public VariableScope getScope ( ) { return scope ; } public int defineTemporaryVariable ( org . codehaus . groovy . ast . Variable var , boolean store ) { return defineTemporaryVariable ( var . getName ( ) , var . getType ( ) , store ) ; } public BytecodeVariable getVariable ( String variableName ) { return getVariable ( variableName , true ) ; } public BytecodeVariable getVariable ( String variableName , boolean mustExist ) { if ( variableName . equals ( "<STR_LIT>" ) ) return BytecodeVariable . THIS_VARIABLE ; if ( variableName . equals ( "<STR_LIT>" ) ) return BytecodeVariable . SUPER_VARIABLE ; BytecodeVariable v = ( BytecodeVariable ) stackVariables . get ( variableName ) ; if ( v == null && mustExist ) throw new GroovyBugError ( "<STR_LIT>" + variableName + "<STR_LIT>" ) ; return v ; } public int defineTemporaryVariable ( String name , boolean store ) { return defineTemporaryVariable ( name , ClassHelper . DYNAMIC_TYPE , store ) ; } public int defineTemporaryVariable ( String name , ClassNode node , boolean store ) { BytecodeVariable answer = defineVar ( name , node , false , false ) ; temporaryVariables . addFirst ( answer ) ; usedVariables . removeLast ( ) ; if ( store ) controller . getOperandStack ( ) . storeVar ( answer ) ; return answer . getIndex ( ) ; } private void resetVariableIndex ( boolean isStatic ) { temporaryVariables . clear ( ) ; if ( ! isStatic ) { currentVariableIndex = <NUM_LIT:1> ; nextVariableIndex = <NUM_LIT:1> ; } else { currentVariableIndex = <NUM_LIT:0> ; nextVariableIndex = <NUM_LIT:0> ; } } public void clear ( ) { if ( stateStack . size ( ) > <NUM_LIT:1> ) { int size = stateStack . size ( ) - <NUM_LIT:1> ; throw new GroovyBugError ( "<STR_LIT>" + size + "<STR_LIT>" + ( size == <NUM_LIT:1> ? "<STR_LIT>" : "<STR_LIT:s>" ) + "<STR_LIT>" ) ; } if ( lhsStack . size ( ) > <NUM_LIT:1> ) { int size = lhsStack . size ( ) - <NUM_LIT:1> ; throw new GroovyBugError ( "<STR_LIT>" + size + "<STR_LIT>" ) ; } if ( implicitThisStack . size ( ) > <NUM_LIT:1> ) { int size = implicitThisStack . size ( ) - <NUM_LIT:1> ; throw new GroovyBugError ( "<STR_LIT>" + size + "<STR_LIT>" ) ; } clear = true ; MethodVisitor mv = controller . getMethodVisitor ( ) ; if ( true ) { if ( thisEndLabel == null ) setEndLabels ( ) ; if ( ! scope . isInStaticContext ( ) ) { mv . visitLocalVariable ( "<STR_LIT>" , className , null , thisStartLabel , thisEndLabel , <NUM_LIT:0> ) ; } for ( Iterator iterator = usedVariables . iterator ( ) ; iterator . hasNext ( ) ; ) { BytecodeVariable v = ( BytecodeVariable ) iterator . next ( ) ; ClassNode t = v . getType ( ) ; if ( v . isHolder ( ) ) t = ClassHelper . REFERENCE_TYPE ; String type = BytecodeHelper . getTypeDescription ( t ) ; Label start = v . getStartLabel ( ) ; Label end = v . getEndLabel ( ) ; if ( start != null && end != null ) mv . visitLocalVariable ( v . getName ( ) , type , null , start , end , v . getIndex ( ) ) ; } } for ( ExceptionTableEntry ep : typedExceptions ) { mv . visitTryCatchBlock ( ep . start , ep . end , ep . goal , ep . sig ) ; } for ( ExceptionTableEntry ep : untypedExceptions ) { mv . visitTryCatchBlock ( ep . start , ep . end , ep . goal , ep . sig ) ; } pop ( ) ; typedExceptions . clear ( ) ; untypedExceptions . clear ( ) ; stackVariables . clear ( ) ; usedVariables . clear ( ) ; scope = null ; finallyBlocks . clear ( ) ; mv = null ; resetVariableIndex ( false ) ; superBlockNamedLabels . clear ( ) ; currentBlockNamedLabels . clear ( ) ; namedLoopBreakLabel . clear ( ) ; namedLoopContinueLabel . clear ( ) ; continueLabel = null ; breakLabel = null ; thisStartLabel = null ; thisEndLabel = null ; mv = null ; } public void addExceptionBlock ( Label start , Label end , Label goal , String sig ) { ExceptionTableEntry ep = new ExceptionTableEntry ( ) ; ep . start = start ; ep . end = end ; ep . sig = sig ; ep . goal = goal ; if ( sig == null ) { untypedExceptions . add ( ep ) ; } else { typedExceptions . add ( ep ) ; } } public void init ( VariableScope el , Parameter [ ] parameters ) { if ( ! clear ) throw new GroovyBugError ( "<STR_LIT>" ) ; clear = false ; pushVariableScope ( el ) ; defineMethodVariables ( parameters , el . isInStaticContext ( ) ) ; this . className = BytecodeHelper . getTypeDescription ( controller . getClassNode ( ) ) ; } public void pushVariableScope ( VariableScope el ) { pushState ( ) ; scope = el ; superBlockNamedLabels = new HashMap ( superBlockNamedLabels ) ; superBlockNamedLabels . putAll ( currentBlockNamedLabels ) ; currentBlockNamedLabels = new HashMap ( ) ; } public void pushLoop ( VariableScope el , String labelName ) { pushVariableScope ( el ) ; initLoopLabels ( labelName ) ; } private void initLoopLabels ( String labelName ) { continueLabel = new Label ( ) ; breakLabel = new Label ( ) ; if ( labelName != null ) { namedLoopBreakLabel . put ( labelName , breakLabel ) ; namedLoopContinueLabel . put ( labelName , continueLabel ) ; } } public void pushLoop ( String labelName ) { pushState ( ) ; initLoopLabels ( labelName ) ; } public Label getNamedBreakLabel ( String name ) { Label label = getBreakLabel ( ) ; Label endLabel = null ; if ( name != null ) endLabel = ( Label ) namedLoopBreakLabel . get ( name ) ; if ( endLabel != null ) label = endLabel ; return label ; } public Label getNamedContinueLabel ( String name ) { Label label = getLabel ( name ) ; Label endLabel = null ; if ( name != null ) endLabel = ( Label ) namedLoopContinueLabel . get ( name ) ; if ( endLabel != null ) label = endLabel ; return label ; } public Label pushSwitch ( ) { pushState ( ) ; breakLabel = new Label ( ) ; return breakLabel ; } public void pushBooleanExpression ( ) { pushState ( ) ; } private BytecodeVariable defineVar ( String name , ClassNode type , boolean holder , boolean useReferenceDirectly ) { int prevCurrent = currentVariableIndex ; makeNextVariableID ( type , useReferenceDirectly ) ; int index = currentVariableIndex ; if ( holder && ! useReferenceDirectly ) index = localVariableOffset ++ ; BytecodeVariable answer = new BytecodeVariable ( index , type , name , prevCurrent ) ; usedVariables . add ( answer ) ; answer . setHolder ( holder ) ; return answer ; } private void makeLocalVariablesOffset ( Parameter [ ] paras , boolean isInStaticContext ) { resetVariableIndex ( isInStaticContext ) ; for ( int i = <NUM_LIT:0> ; i < paras . length ; i ++ ) { makeNextVariableID ( paras [ i ] . getType ( ) , false ) ; } localVariableOffset = nextVariableIndex ; resetVariableIndex ( isInStaticContext ) ; } private void defineMethodVariables ( Parameter [ ] paras , boolean isInStaticContext ) { Label startLabel = new Label ( ) ; thisStartLabel = startLabel ; controller . getMethodVisitor ( ) . visitLabel ( startLabel ) ; makeLocalVariablesOffset ( paras , isInStaticContext ) ; for ( int i = <NUM_LIT:0> ; i < paras . length ; i ++ ) { String name = paras [ i ] . getName ( ) ; BytecodeVariable answer ; ClassNode type = paras [ i ] . getType ( ) ; if ( paras [ i ] . isClosureSharedVariable ( ) ) { boolean useExistingReference = paras [ i ] . getNodeMetaData ( ClosureWriter . UseExistingReference . class ) != null ; answer = defineVar ( name , paras [ i ] . getOriginType ( ) , true , useExistingReference ) ; answer . setStartLabel ( startLabel ) ; if ( ! useExistingReference ) { controller . getOperandStack ( ) . load ( type , currentVariableIndex ) ; controller . getOperandStack ( ) . box ( ) ; Label newStart = new Label ( ) ; controller . getMethodVisitor ( ) . visitLabel ( newStart ) ; BytecodeVariable var = new BytecodeVariable ( currentVariableIndex , paras [ i ] . getOriginType ( ) , name , currentVariableIndex ) ; var . setStartLabel ( startLabel ) ; var . setEndLabel ( newStart ) ; usedVariables . add ( var ) ; answer . setStartLabel ( newStart ) ; createReference ( answer ) ; } } else { answer = defineVar ( name , type , false , false ) ; answer . setStartLabel ( startLabel ) ; } stackVariables . put ( name , answer ) ; } nextVariableIndex = localVariableOffset ; } private void createReference ( BytecodeVariable reference ) { MethodVisitor mv = controller . getMethodVisitor ( ) ; mv . visitTypeInsn ( NEW , "<STR_LIT>" ) ; mv . visitInsn ( DUP_X1 ) ; mv . visitInsn ( SWAP ) ; mv . visitMethodInsn ( INVOKESPECIAL , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitVarInsn ( ASTORE , reference . getIndex ( ) ) ; } private void pushInitValue ( ClassNode type , MethodVisitor mv ) { if ( ClassHelper . isPrimitiveType ( type ) ) { if ( type == ClassHelper . long_TYPE ) { mv . visitInsn ( LCONST_0 ) ; } else if ( type == ClassHelper . double_TYPE ) { mv . visitInsn ( DCONST_0 ) ; } else if ( type == ClassHelper . float_TYPE ) { mv . visitInsn ( FCONST_0 ) ; } else { mv . visitLdcInsn ( <NUM_LIT:0> ) ; } } else { mv . visitInsn ( ACONST_NULL ) ; } } public BytecodeVariable defineVariable ( Variable v , boolean initFromStack ) { return defineVariable ( v , v . getOriginType ( ) , initFromStack ) ; } public BytecodeVariable defineVariable ( Variable v , ClassNode variableType , boolean initFromStack ) { String name = v . getName ( ) ; BytecodeVariable answer = defineVar ( name , variableType , v . isClosureSharedVariable ( ) , v . isClosureSharedVariable ( ) ) ; stackVariables . put ( name , answer ) ; MethodVisitor mv = controller . getMethodVisitor ( ) ; Label startLabel = new Label ( ) ; answer . setStartLabel ( startLabel ) ; ClassNode type = answer . getType ( ) . redirect ( ) ; OperandStack operandStack = controller . getOperandStack ( ) ; if ( ! initFromStack ) pushInitValue ( type , mv ) ; operandStack . push ( answer . getType ( ) ) ; if ( answer . isHolder ( ) ) { operandStack . box ( ) ; operandStack . remove ( <NUM_LIT:1> ) ; createReference ( answer ) ; } else { operandStack . storeVar ( answer ) ; } mv . visitLabel ( startLabel ) ; return answer ; } public boolean containsVariable ( String name ) { return stackVariables . containsKey ( name ) ; } private void makeNextVariableID ( ClassNode type , boolean useReferenceDirectly ) { currentVariableIndex = nextVariableIndex ; if ( ( type == ClassHelper . long_TYPE || type == ClassHelper . double_TYPE ) && ! useReferenceDirectly ) { nextVariableIndex ++ ; } nextVariableIndex ++ ; } public Label getLabel ( String name ) { if ( name == null ) return null ; Label l = ( Label ) superBlockNamedLabels . get ( name ) ; if ( l == null ) l = createLocalLabel ( name ) ; return l ; } public Label createLocalLabel ( String name ) { Label l = ( Label ) currentBlockNamedLabels . get ( name ) ; if ( l == null ) { l = new Label ( ) ; currentBlockNamedLabels . put ( name , l ) ; } return l ; } public void applyFinallyBlocks ( Label label , boolean isBreakLabel ) { StateStackElement result = null ; for ( ListIterator iter = stateStack . listIterator ( stateStack . size ( ) ) ; iter . hasPrevious ( ) ; ) { StateStackElement element = ( StateStackElement ) iter . previous ( ) ; if ( ! element . currentBlockNamedLabels . values ( ) . contains ( label ) ) { if ( isBreakLabel && element . breakLabel != label ) { result = element ; break ; } if ( ! isBreakLabel && element . continueLabel != label ) { result = element ; break ; } } } List < BlockRecorder > blocksToRemove ; if ( result == null ) { blocksToRemove = ( List < BlockRecorder > ) Collections . EMPTY_LIST ; } else { blocksToRemove = result . finallyBlocks ; } List < BlockRecorder > blocks = new LinkedList < BlockRecorder > ( finallyBlocks ) ; blocks . removeAll ( blocksToRemove ) ; applyBlockRecorder ( blocks ) ; } private void applyBlockRecorder ( List < BlockRecorder > blocks ) { if ( blocks . size ( ) == <NUM_LIT:0> || blocks . size ( ) == visitedBlocks . size ( ) ) return ; MethodVisitor mv = controller . getMethodVisitor ( ) ; Label end = new Label ( ) ; mv . visitInsn ( NOP ) ; mv . visitLabel ( end ) ; Label newStart = new Label ( ) ; for ( BlockRecorder fb : blocks ) { if ( visitedBlocks . contains ( fb ) ) continue ; fb . closeRange ( end ) ; fb . excludedStatement . run ( ) ; fb . startRange ( newStart ) ; } mv . visitInsn ( NOP ) ; mv . visitLabel ( newStart ) ; } public void applyBlockRecorder ( ) { applyBlockRecorder ( finallyBlocks ) ; } public boolean hasBlockRecorder ( ) { return ! finallyBlocks . isEmpty ( ) ; } public void pushBlockRecorder ( BlockRecorder recorder ) { pushState ( ) ; finallyBlocks . addFirst ( recorder ) ; } public void pushBlockRecorderVisit ( BlockRecorder finallyBlock ) { visitedBlocks . add ( finallyBlock ) ; } public void popBlockRecorderVisit ( BlockRecorder finallyBlock ) { visitedBlocks . remove ( finallyBlock ) ; } public void writeExceptionTable ( BlockRecorder block , Label goal , String sig ) { if ( block . isEmpty ) return ; MethodVisitor mv = controller . getMethodVisitor ( ) ; for ( LabelRange range : block . ranges ) { mv . visitTryCatchBlock ( range . start , range . end , goal , sig ) ; } } public boolean isLHS ( ) { return lhs ; } public void pushLHS ( boolean lhs ) { lhsStack . add ( lhs ) ; this . lhs = lhs ; } public void popLHS ( ) { lhsStack . removeLast ( ) ; this . lhs = lhsStack . getLast ( ) ; } public void pushImplicitThis ( boolean implicitThis ) { implicitThisStack . add ( implicitThis ) ; this . implicitThis = implicitThis ; } public boolean isImplicitThis ( ) { return implicitThis ; } public void popImplicitThis ( ) { implicitThisStack . removeLast ( ) ; this . implicitThis = implicitThisStack . getLast ( ) ; } public boolean isInSpecialConstructorCall ( ) { return inSpecialConstructallCall ; } public void pushInSpecialConstructorCall ( ) { pushState ( ) ; inSpecialConstructallCall = true ; } } </s>
|
<s> package org . codehaus . groovy . classgen . asm . sc ; import org . codehaus . groovy . GroovyBugError ; import org . codehaus . groovy . ast . * ; import org . codehaus . groovy . ast . expr . * ; import org . codehaus . groovy . ast . stmt . EmptyStatement ; import org . codehaus . groovy . classgen . BytecodeExpression ; import org . codehaus . groovy . classgen . asm . * ; import org . codehaus . groovy . runtime . MetaClassHelper ; import org . codehaus . groovy . syntax . SyntaxException ; import org . codehaus . groovy . transform . sc . StaticCompilationMetadataKeys ; import org . codehaus . groovy . transform . stc . StaticTypeCheckingSupport ; import org . codehaus . groovy . transform . stc . StaticTypesMarker ; import org . objectweb . asm . Label ; import org . objectweb . asm . MethodVisitor ; import org . objectweb . asm . Opcodes ; import java . lang . reflect . Modifier ; import java . util . * ; import static org . codehaus . groovy . ast . ClassHelper . * ; import static org . codehaus . groovy . transform . stc . StaticTypeCheckingSupport . chooseBestMethod ; import static org . codehaus . groovy . transform . stc . StaticTypeCheckingSupport . findDGMMethodsByNameAndArguments ; public class StaticTypesCallSiteWriter extends CallSiteWriter implements Opcodes { private static final MethodNode GROOVYOBJECT_GETPROPERTY_METHOD = GROOVY_OBJECT_TYPE . getMethod ( "<STR_LIT>" , new Parameter [ ] { new Parameter ( STRING_TYPE , "<STR_LIT>" ) } ) ; private static final ClassNode COLLECTION_TYPE = make ( Collection . class ) ; private static final MethodNode COLLECTION_SIZE_METHOD = COLLECTION_TYPE . getMethod ( "<STR_LIT:size>" , Parameter . EMPTY_ARRAY ) ; private WriterController controller ; public StaticTypesCallSiteWriter ( final StaticTypesWriterController controller ) { super ( controller ) ; this . controller = controller ; } @ Override public void makeCallSite ( final Expression receiver , final String message , final Expression arguments , final boolean safe , final boolean implicitThis , final boolean callCurrent , final boolean callStatic ) { } @ Override public void makeGetPropertySite ( Expression receiver , final String methodName , final boolean safe , final boolean implicitThis ) { TypeChooser typeChooser = controller . getTypeChooser ( ) ; ClassNode classNode = controller . getClassNode ( ) ; ClassNode receiverType = typeChooser . resolveType ( receiver , classNode ) ; Object type = receiver . getNodeMetaData ( StaticTypesMarker . INFERRED_TYPE ) ; if ( type == null && receiver instanceof VariableExpression ) { Variable variable = ( ( VariableExpression ) receiver ) . getAccessedVariable ( ) ; if ( variable instanceof Expression ) { type = ( ( Expression ) variable ) . getNodeMetaData ( StaticTypesMarker . INFERRED_TYPE ) ; } } if ( type != null ) { receiverType = ( ClassNode ) type ; } boolean isClassReceiver = false ; if ( receiverType . equals ( CLASS_Type ) && receiverType . getGenericsTypes ( ) != null && ! receiverType . getGenericsTypes ( ) [ <NUM_LIT:0> ] . isPlaceholder ( ) ) { isClassReceiver = true ; receiverType = receiverType . getGenericsTypes ( ) [ <NUM_LIT:0> ] . getType ( ) ; } MethodVisitor mv = controller . getMethodVisitor ( ) ; if ( receiverType . isArray ( ) && methodName . equals ( "<STR_LIT>" ) ) { receiver . visit ( controller . getAcg ( ) ) ; ClassNode arrayGetReturnType = typeChooser . resolveType ( receiver , classNode ) ; controller . getOperandStack ( ) . doGroovyCast ( arrayGetReturnType ) ; mv . visitInsn ( ARRAYLENGTH ) ; controller . getOperandStack ( ) . replace ( int_TYPE ) ; return ; } else if ( ( receiverType . implementsInterface ( COLLECTION_TYPE ) || COLLECTION_TYPE . equals ( receiverType ) ) && ( "<STR_LIT:size>" . equals ( methodName ) || "<STR_LIT>" . equals ( methodName ) ) ) { MethodCallExpression expr = new MethodCallExpression ( receiver , "<STR_LIT:size>" , ArgumentListExpression . EMPTY_ARGUMENTS ) ; expr . setMethodTarget ( COLLECTION_SIZE_METHOD ) ; expr . setImplicitThis ( implicitThis ) ; expr . setSafe ( safe ) ; expr . visit ( controller . getAcg ( ) ) ; return ; } if ( makeGetPropertyWithGetter ( receiver , receiverType , methodName , safe , implicitThis ) ) return ; if ( makeGetField ( receiver , receiverType , methodName , implicitThis , samePackages ( receiverType . getPackageName ( ) , classNode . getPackageName ( ) ) ) ) return ; if ( receiverType . isEnum ( ) ) { mv . visitFieldInsn ( GETSTATIC , BytecodeHelper . getClassInternalName ( receiverType ) , methodName , BytecodeHelper . getTypeDescription ( receiverType ) ) ; controller . getOperandStack ( ) . push ( receiverType ) ; return ; } if ( receiver instanceof ClassExpression ) { if ( makeGetField ( receiver , receiver . getType ( ) , methodName , implicitThis , samePackages ( receiver . getType ( ) . getPackageName ( ) , classNode . getPackageName ( ) ) ) ) return ; if ( makeGetPropertyWithGetter ( receiver , receiver . getType ( ) , methodName , safe , implicitThis ) ) return ; } if ( isClassReceiver ) { if ( makeGetPropertyWithGetter ( receiver , CLASS_Type , methodName , safe , implicitThis ) ) return ; if ( makeGetField ( receiver , CLASS_Type , methodName , false , true ) ) return ; } if ( makeGetPrivateFieldWithBridgeMethod ( receiver , receiverType , methodName , safe , implicitThis ) ) return ; String getterName = "<STR_LIT:get>" + MetaClassHelper . capitalize ( methodName ) ; if ( receiverType . isInterface ( ) ) { Set < ClassNode > allInterfaces = receiverType . getAllInterfaces ( ) ; MethodNode getterMethod = null ; for ( ClassNode anInterface : allInterfaces ) { getterMethod = anInterface . getGetterMethod ( getterName ) ; if ( getterMethod != null ) break ; } if ( getterMethod == null ) { getterMethod = OBJECT_TYPE . getGetterMethod ( getterName ) ; } if ( getterMethod != null ) { MethodCallExpression call = new MethodCallExpression ( receiver , getterName , ArgumentListExpression . EMPTY_ARGUMENTS ) ; call . setMethodTarget ( getterMethod ) ; call . setImplicitThis ( false ) ; call . setSourcePosition ( receiver ) ; call . visit ( controller . getAcg ( ) ) ; return ; } } List < MethodNode > methods = findDGMMethodsByNameAndArguments ( receiverType , getterName , ClassNode . EMPTY_ARRAY ) ; if ( ! methods . isEmpty ( ) ) { List < MethodNode > methodNodes = chooseBestMethod ( receiverType , methods , ClassNode . EMPTY_ARRAY ) ; if ( methodNodes . size ( ) == <NUM_LIT:1> ) { MethodNode getter = methodNodes . get ( <NUM_LIT:0> ) ; MethodCallExpression call = new MethodCallExpression ( receiver , getterName , ArgumentListExpression . EMPTY_ARGUMENTS ) ; call . setMethodTarget ( getter ) ; call . setImplicitThis ( false ) ; call . setSourcePosition ( receiver ) ; call . visit ( controller . getAcg ( ) ) ; return ; } } boolean isStaticProperty = receiver instanceof ClassExpression && ( receiverType . isDerivedFrom ( receiver . getType ( ) ) || receiverType . implementsInterface ( receiver . getType ( ) ) ) ; if ( ! isStaticProperty ) { if ( receiverType . implementsInterface ( MAP_TYPE ) || MAP_TYPE . equals ( receiverType ) ) { writeMapDotProperty ( receiver , methodName , mv ) ; return ; } if ( receiverType . implementsInterface ( LIST_TYPE ) || LIST_TYPE . equals ( receiverType ) ) { writeListDotProperty ( receiver , methodName , mv ) ; return ; } } controller . getSourceUnit ( ) . addError ( new SyntaxException ( "<STR_LIT>" + ( receiver instanceof ClassExpression ? receiver . getType ( ) : receiverType ) . toString ( false ) + "<STR_LIT:#>" + methodName + "<STR_LIT>" , receiver . getLineNumber ( ) , receiver . getColumnNumber ( ) , receiver . getLastLineNumber ( ) , receiver . getLastColumnNumber ( ) ) ) ; controller . getMethodVisitor ( ) . visitInsn ( ACONST_NULL ) ; controller . getOperandStack ( ) . push ( OBJECT_TYPE ) ; } private void writeMapDotProperty ( final Expression receiver , final String methodName , final MethodVisitor mv ) { receiver . visit ( controller . getAcg ( ) ) ; mv . visitLdcInsn ( methodName ) ; mv . visitMethodInsn ( INVOKEINTERFACE , "<STR_LIT>" , "<STR_LIT:get>" , "<STR_LIT>" ) ; controller . getOperandStack ( ) . replace ( OBJECT_TYPE ) ; } private void writeListDotProperty ( final Expression receiver , final String methodName , final MethodVisitor mv ) { ClassNode componentType = ( ClassNode ) receiver . getNodeMetaData ( StaticCompilationMetadataKeys . COMPONENT_TYPE ) ; if ( componentType == null ) { componentType = OBJECT_TYPE ; } CompileStack compileStack = controller . getCompileStack ( ) ; Variable tmpList = new VariableExpression ( "<STR_LIT>" , make ( ArrayList . class ) ) ; int var = compileStack . defineTemporaryVariable ( tmpList , false ) ; Variable iterator = new VariableExpression ( "<STR_LIT>" , Iterator_TYPE ) ; int it = compileStack . defineTemporaryVariable ( iterator , false ) ; Variable nextVar = new VariableExpression ( "<STR_LIT>" , componentType ) ; final int next = compileStack . defineTemporaryVariable ( nextVar , false ) ; mv . visitTypeInsn ( NEW , "<STR_LIT>" ) ; mv . visitInsn ( DUP ) ; receiver . visit ( controller . getAcg ( ) ) ; mv . visitMethodInsn ( INVOKEINTERFACE , "<STR_LIT>" , "<STR_LIT:size>" , "<STR_LIT>" ) ; controller . getOperandStack ( ) . remove ( <NUM_LIT:1> ) ; mv . visitMethodInsn ( INVOKESPECIAL , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitVarInsn ( ASTORE , var ) ; Label l1 = new Label ( ) ; mv . visitLabel ( l1 ) ; receiver . visit ( controller . getAcg ( ) ) ; mv . visitMethodInsn ( INVOKEINTERFACE , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; controller . getOperandStack ( ) . remove ( <NUM_LIT:1> ) ; mv . visitVarInsn ( ASTORE , it ) ; Label l2 = new Label ( ) ; mv . visitLabel ( l2 ) ; mv . visitVarInsn ( ALOAD , it ) ; mv . visitMethodInsn ( INVOKEINTERFACE , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; Label l3 = new Label ( ) ; mv . visitJumpInsn ( IFEQ , l3 ) ; mv . visitVarInsn ( ALOAD , it ) ; mv . visitMethodInsn ( INVOKEINTERFACE , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitTypeInsn ( CHECKCAST , BytecodeHelper . getClassInternalName ( componentType ) ) ; mv . visitVarInsn ( ASTORE , next ) ; Label l4 = new Label ( ) ; mv . visitLabel ( l4 ) ; mv . visitVarInsn ( ALOAD , var ) ; final ClassNode finalComponentType = componentType ; PropertyExpression pexp = new PropertyExpression ( new BytecodeExpression ( ) { @ Override public void visit ( final MethodVisitor mv ) { mv . visitVarInsn ( ALOAD , next ) ; } @ Override public ClassNode getType ( ) { return finalComponentType ; } } , methodName ) ; pexp . visit ( controller . getAcg ( ) ) ; controller . getOperandStack ( ) . box ( ) ; controller . getOperandStack ( ) . remove ( <NUM_LIT:1> ) ; mv . visitMethodInsn ( INVOKEINTERFACE , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitInsn ( POP ) ; Label l5 = new Label ( ) ; mv . visitLabel ( l5 ) ; mv . visitJumpInsn ( GOTO , l2 ) ; mv . visitLabel ( l3 ) ; mv . visitVarInsn ( ALOAD , var ) ; controller . getOperandStack ( ) . push ( make ( ArrayList . class ) ) ; controller . getCompileStack ( ) . removeVar ( next ) ; controller . getCompileStack ( ) . removeVar ( it ) ; controller . getCompileStack ( ) . removeVar ( var ) ; } @ SuppressWarnings ( "<STR_LIT:unchecked>" ) private boolean makeGetPrivateFieldWithBridgeMethod ( final Expression receiver , final ClassNode receiverType , final String fieldName , final boolean safe , final boolean implicitThis ) { FieldNode field = receiverType . getField ( fieldName ) ; ClassNode classNode = controller . getClassNode ( ) ; if ( field != null && Modifier . isPrivate ( field . getModifiers ( ) ) && ( StaticInvocationWriter . isPrivateBridgeMethodsCallAllowed ( receiverType , classNode ) || StaticInvocationWriter . isPrivateBridgeMethodsCallAllowed ( classNode , receiverType ) ) && ! receiverType . equals ( classNode ) ) { Map < String , MethodNode > accessors = ( Map < String , MethodNode > ) receiverType . redirect ( ) . getNodeMetaData ( StaticCompilationMetadataKeys . PRIVATE_FIELDS_ACCESSORS ) ; if ( accessors != null ) { MethodNode methodNode = accessors . get ( fieldName ) ; if ( methodNode != null ) { MethodCallExpression mce = new MethodCallExpression ( receiver , methodNode . getName ( ) , ArgumentListExpression . EMPTY_ARGUMENTS ) ; mce . setMethodTarget ( methodNode ) ; mce . setSafe ( safe ) ; mce . setImplicitThis ( implicitThis ) ; mce . visit ( controller . getAcg ( ) ) ; return true ; } } } return false ; } @ Override public void makeGroovyObjectGetPropertySite ( final Expression receiver , final String methodName , final boolean safe , final boolean implicitThis ) { TypeChooser typeChooser = controller . getTypeChooser ( ) ; ClassNode classNode = controller . getClassNode ( ) ; ClassNode receiverType = typeChooser . resolveType ( receiver , classNode ) ; if ( receiver instanceof VariableExpression && ( ( VariableExpression ) receiver ) . isThisExpression ( ) && ! controller . isInClosure ( ) ) { receiverType = classNode ; } String property = methodName ; if ( classNode . getNodeMetaData ( StaticCompilationMetadataKeys . WITH_CLOSURE ) != null && "<STR_LIT>" . equals ( property ) ) { property = "<STR_LIT>" ; } if ( makeGetPropertyWithGetter ( receiver , receiverType , property , safe , implicitThis ) ) return ; if ( makeGetField ( receiver , receiverType , property , implicitThis , samePackages ( receiverType . getPackageName ( ) , classNode . getPackageName ( ) ) ) ) return ; MethodCallExpression call = new MethodCallExpression ( receiver , "<STR_LIT>" , new ArgumentListExpression ( new ConstantExpression ( property ) ) ) ; call . setImplicitThis ( implicitThis ) ; call . setSafe ( safe ) ; call . setMethodTarget ( GROOVYOBJECT_GETPROPERTY_METHOD ) ; call . visit ( controller . getAcg ( ) ) ; return ; } @ Override public void makeCallSiteArrayInitializer ( ) { } private boolean makeGetPropertyWithGetter ( final Expression receiver , final ClassNode receiverType , final String methodName , final boolean safe , final boolean implicitThis ) { String getterName = "<STR_LIT:get>" + MetaClassHelper . capitalize ( methodName ) ; MethodNode getterNode = receiverType . getGetterMethod ( getterName ) ; if ( getterNode == null ) { getterName = "<STR_LIT>" + MetaClassHelper . capitalize ( methodName ) ; getterNode = receiverType . getGetterMethod ( getterName ) ; } PropertyNode propertyNode = receiverType . getProperty ( methodName ) ; if ( propertyNode != null ) { String prefix = "<STR_LIT:get>" ; if ( boolean_TYPE . equals ( propertyNode . getOriginType ( ) ) ) { prefix = "<STR_LIT>" ; } getterName = prefix + MetaClassHelper . capitalize ( methodName ) ; getterNode = new MethodNode ( getterName , ACC_PUBLIC , propertyNode . getOriginType ( ) , Parameter . EMPTY_ARRAY , ClassNode . EMPTY_ARRAY , EmptyStatement . INSTANCE ) ; getterNode . setDeclaringClass ( receiverType ) ; if ( propertyNode . isStatic ( ) ) getterNode . setModifiers ( ACC_PUBLIC + ACC_STATIC ) ; } if ( getterNode != null ) { MethodCallExpression call = new MethodCallExpression ( receiver , getterName , ArgumentListExpression . EMPTY_ARGUMENTS ) ; call . setSourcePosition ( receiver ) ; call . setMethodTarget ( getterNode ) ; call . setImplicitThis ( implicitThis ) ; call . setSafe ( safe ) ; call . visit ( controller . getAcg ( ) ) ; return true ; } ClassNode superClass = receiverType . getSuperClass ( ) ; if ( superClass != null ) { return makeGetPropertyWithGetter ( receiver , superClass , methodName , safe , implicitThis ) ; } return false ; } boolean makeGetField ( final Expression receiver , final ClassNode receiverType , final String fieldName , final boolean implicitThis , final boolean samePackage ) { FieldNode field = receiverType . getField ( fieldName ) ; if ( field != null && isDirectAccessAllowed ( field , controller . getClassNode ( ) , samePackage ) ) { CompileStack compileStack = controller . getCompileStack ( ) ; MethodVisitor mv = controller . getMethodVisitor ( ) ; if ( field . isStatic ( ) ) { mv . visitFieldInsn ( GETSTATIC , BytecodeHelper . getClassInternalName ( field . getOwner ( ) ) , fieldName , BytecodeHelper . getTypeDescription ( field . getOriginType ( ) ) ) ; controller . getOperandStack ( ) . push ( field . getOriginType ( ) ) ; } else { if ( implicitThis ) { compileStack . pushImplicitThis ( implicitThis ) ; } receiver . visit ( controller . getAcg ( ) ) ; if ( implicitThis ) compileStack . popImplicitThis ( ) ; if ( ! controller . getOperandStack ( ) . getTopOperand ( ) . isDerivedFrom ( field . getOwner ( ) ) ) { mv . visitTypeInsn ( CHECKCAST , BytecodeHelper . getClassInternalName ( field . getOwner ( ) ) ) ; } mv . visitFieldInsn ( GETFIELD , BytecodeHelper . getClassInternalName ( field . getOwner ( ) ) , fieldName , BytecodeHelper . getTypeDescription ( field . getOriginType ( ) ) ) ; } controller . getOperandStack ( ) . replace ( field . getOriginType ( ) ) ; return true ; } ClassNode superClass = receiverType . getSuperClass ( ) ; if ( superClass != null ) { return makeGetField ( receiver , superClass , fieldName , implicitThis , false ) ; } return false ; } private static boolean samePackages ( final String pkg1 , final String pkg2 ) { return ( ( pkg1 == null && pkg2 == null ) || pkg1 != null && pkg1 . equals ( pkg2 ) ) ; } private static boolean isDirectAccessAllowed ( FieldNode a , ClassNode receiver , boolean isSamePackage ) { ClassNode declaringClass = a . getDeclaringClass ( ) . redirect ( ) ; ClassNode receiverType = receiver . redirect ( ) ; if ( declaringClass . equals ( receiverType ) ) return true ; if ( receiverType instanceof InnerClassNode ) { while ( receiverType != null && receiverType instanceof InnerClassNode ) { if ( declaringClass . equals ( receiverType ) ) return true ; receiverType = receiverType . getOuterClass ( ) ; } } return a . isPublic ( ) || ( a . isProtected ( ) && isSamePackage ) ; } @ Override public void makeSiteEntry ( ) { } @ Override public void prepareCallSite ( final String message ) { } @ Override public void makeSingleArgumentCall ( final Expression receiver , final String message , final Expression arguments ) { TypeChooser typeChooser = controller . getTypeChooser ( ) ; ClassNode classNode = controller . getClassNode ( ) ; ClassNode rType = typeChooser . resolveType ( receiver , classNode ) ; ClassNode aType = typeChooser . resolveType ( arguments , classNode ) ; if ( getWrapper ( rType ) . isDerivedFrom ( Number_TYPE ) && getWrapper ( aType ) . isDerivedFrom ( Number_TYPE ) ) { if ( "<STR_LIT>" . equals ( message ) || "<STR_LIT>" . equals ( message ) || "<STR_LIT>" . equals ( message ) || "<STR_LIT>" . equals ( message ) ) { writeNumberNumberCall ( receiver , message , arguments ) ; return ; } else if ( "<STR_LIT>" . equals ( message ) ) { writePowerCall ( receiver , arguments , rType , aType ) ; return ; } } else if ( STRING_TYPE . equals ( rType ) && "<STR_LIT>" . equals ( message ) ) { writeStringPlusCall ( receiver , message , arguments ) ; return ; } else if ( rType . isArray ( ) && "<STR_LIT>" . equals ( message ) ) { writeArrayGet ( receiver , arguments , rType , aType ) ; return ; } ClassNode current = rType ; MethodNode getAtNode = null ; while ( current != null && getAtNode == null ) { getAtNode = current . getMethod ( "<STR_LIT>" , new Parameter [ ] { new Parameter ( aType , "<STR_LIT:index>" ) } ) ; current = current . getSuperClass ( ) ; } if ( getAtNode != null ) { MethodCallExpression call = new MethodCallExpression ( receiver , "<STR_LIT>" , arguments ) ; call . setSourcePosition ( arguments ) ; call . setImplicitThis ( false ) ; call . setMethodTarget ( getAtNode ) ; call . visit ( controller . getAcg ( ) ) ; return ; } ClassNode [ ] args = { aType } ; boolean acceptAnyMethod = MAP_TYPE . equals ( rType ) || rType . implementsInterface ( MAP_TYPE ) || LIST_TYPE . equals ( rType ) || rType . implementsInterface ( LIST_TYPE ) ; List < MethodNode > nodes = StaticTypeCheckingSupport . findDGMMethodsByNameAndArguments ( rType , message , args ) ; nodes = StaticTypeCheckingSupport . chooseBestMethod ( rType , nodes , args ) ; if ( nodes . size ( ) == <NUM_LIT:1> || nodes . size ( ) > <NUM_LIT:1> && acceptAnyMethod ) { MethodNode methodNode = nodes . get ( <NUM_LIT:0> ) ; MethodCallExpression call = new MethodCallExpression ( receiver , message , arguments ) ; call . setSourcePosition ( arguments ) ; call . setImplicitThis ( false ) ; call . setMethodTarget ( methodNode ) ; call . visit ( controller . getAcg ( ) ) ; return ; } throw new GroovyBugError ( "<STR_LIT>" + receiver . getLineNumber ( ) + "<STR_LIT>" + receiver . getColumnNumber ( ) + "<STR_LIT:n>" + "<STR_LIT>" + receiver . getText ( ) + "<STR_LIT>" + message + "<STR_LIT>" + arguments . getText ( ) + "<STR_LIT:n>" + "<STR_LIT>" + "<STR_LIT>" ) ; } private void writeArrayGet ( final Expression receiver , final Expression arguments , final ClassNode rType , final ClassNode aType ) { OperandStack operandStack = controller . getOperandStack ( ) ; int m1 = operandStack . getStackLength ( ) ; receiver . visit ( controller . getAcg ( ) ) ; arguments . visit ( controller . getAcg ( ) ) ; operandStack . doGroovyCast ( int_TYPE ) ; int m2 = operandStack . getStackLength ( ) ; controller . getMethodVisitor ( ) . visitInsn ( AALOAD ) ; operandStack . replace ( rType . getComponentType ( ) , m2 - m1 ) ; } private void writePowerCall ( Expression receiver , Expression arguments , final ClassNode rType , ClassNode aType ) { OperandStack operandStack = controller . getOperandStack ( ) ; int m1 = operandStack . getStackLength ( ) ; prepareSiteAndReceiver ( receiver , "<STR_LIT>" , false , controller . getCompileStack ( ) . isLHS ( ) ) ; visitBoxedArgument ( arguments ) ; int m2 = operandStack . getStackLength ( ) ; MethodVisitor mv = controller . getMethodVisitor ( ) ; if ( BigDecimal_TYPE . equals ( rType ) && Integer_TYPE . equals ( getWrapper ( aType ) ) ) { mv . visitMethodInsn ( INVOKESTATIC , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; } else if ( BigInteger_TYPE . equals ( rType ) && Integer_TYPE . equals ( getWrapper ( aType ) ) ) { mv . visitMethodInsn ( INVOKESTATIC , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; } else if ( Long_TYPE . equals ( getWrapper ( rType ) ) && Integer_TYPE . equals ( getWrapper ( aType ) ) ) { mv . visitMethodInsn ( INVOKESTATIC , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; } else if ( Integer_TYPE . equals ( getWrapper ( rType ) ) && Integer_TYPE . equals ( getWrapper ( aType ) ) ) { mv . visitMethodInsn ( INVOKESTATIC , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; } else { mv . visitMethodInsn ( INVOKESTATIC , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; } controller . getOperandStack ( ) . replace ( Number_TYPE , m2 - m1 ) ; } private void writeStringPlusCall ( final Expression receiver , final String message , final Expression arguments ) { OperandStack operandStack = controller . getOperandStack ( ) ; int m1 = operandStack . getStackLength ( ) ; prepareSiteAndReceiver ( receiver , message , false , controller . getCompileStack ( ) . isLHS ( ) ) ; visitBoxedArgument ( arguments ) ; int m2 = operandStack . getStackLength ( ) ; MethodVisitor mv = controller . getMethodVisitor ( ) ; mv . visitMethodInsn ( INVOKESTATIC , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; controller . getOperandStack ( ) . replace ( STRING_TYPE , m2 - m1 ) ; } private void writeNumberNumberCall ( final Expression receiver , final String message , final Expression arguments ) { OperandStack operandStack = controller . getOperandStack ( ) ; int m1 = operandStack . getStackLength ( ) ; prepareSiteAndReceiver ( receiver , message , false , controller . getCompileStack ( ) . isLHS ( ) ) ; controller . getOperandStack ( ) . doGroovyCast ( Number_TYPE ) ; visitBoxedArgument ( arguments ) ; controller . getOperandStack ( ) . doGroovyCast ( Number_TYPE ) ; int m2 = operandStack . getStackLength ( ) ; MethodVisitor mv = controller . getMethodVisitor ( ) ; mv . visitMethodInsn ( INVOKESTATIC , "<STR_LIT>" + MetaClassHelper . capitalize ( message ) , message , "<STR_LIT>" ) ; controller . getOperandStack ( ) . replace ( Number_TYPE , m2 - m1 ) ; } } </s>
|
<s> package org . codehaus . groovy . classgen ; import groovy . lang . GroovyRuntimeException ; import org . codehaus . groovy . GroovyBugError ; import org . codehaus . groovy . ast . * ; import org . codehaus . groovy . ast . expr . * ; import org . codehaus . groovy . ast . stmt . * ; import org . codehaus . groovy . classgen . asm . * ; import org . codehaus . groovy . control . SourceUnit ; import org . codehaus . groovy . runtime . MetaClassHelper ; import org . codehaus . groovy . runtime . ScriptBytecodeAdapter ; import org . codehaus . groovy . syntax . RuntimeParserException ; import org . objectweb . asm . AnnotationVisitor ; import org . objectweb . asm . * ; import java . lang . reflect . Modifier ; import java . util . * ; public class AsmClassGenerator extends ClassGenerator { private final ClassVisitor cv ; private GeneratorContext context ; private String sourceFile ; static final MethodCallerMultiAdapter setField = MethodCallerMultiAdapter . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" , false , false ) ; public static final MethodCallerMultiAdapter getField = MethodCallerMultiAdapter . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" , false , false ) ; static final MethodCallerMultiAdapter setGroovyObjectField = MethodCallerMultiAdapter . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" , false , false ) ; public static final MethodCallerMultiAdapter getGroovyObjectField = MethodCallerMultiAdapter . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" , false , false ) ; static final MethodCallerMultiAdapter setFieldOnSuper = MethodCallerMultiAdapter . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" , false , false ) ; static final MethodCallerMultiAdapter getFieldOnSuper = MethodCallerMultiAdapter . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" , false , false ) ; public static final MethodCallerMultiAdapter setProperty = MethodCallerMultiAdapter . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" , false , false ) ; static final MethodCallerMultiAdapter getProperty = MethodCallerMultiAdapter . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" , false , false ) ; static final MethodCallerMultiAdapter setGroovyObjectProperty = MethodCallerMultiAdapter . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" , false , false ) ; static final MethodCallerMultiAdapter getGroovyObjectProperty = MethodCallerMultiAdapter . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" , false , false ) ; static final MethodCallerMultiAdapter setPropertyOnSuper = MethodCallerMultiAdapter . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" , false , false ) ; static final MethodCallerMultiAdapter getPropertyOnSuper = MethodCallerMultiAdapter . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" , false , false ) ; static final MethodCaller spreadMap = MethodCaller . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" ) ; static final MethodCaller despreadList = MethodCaller . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" ) ; static final MethodCaller getMethodPointer = MethodCaller . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" ) ; static final MethodCaller createListMethod = MethodCaller . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" ) ; static final MethodCaller createMapMethod = MethodCaller . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" ) ; static final MethodCaller createRangeMethod = MethodCaller . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" ) ; static final MethodCaller createPojoWrapperMethod = MethodCaller . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" ) ; static final MethodCaller createGroovyObjectWrapperMethod = MethodCaller . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" ) ; static final MethodCaller selectConstructorAndTransformArguments = MethodCaller . newStatic ( ScriptBytecodeAdapter . class , "<STR_LIT>" ) ; private Map < String , ClassNode > referencedClasses = new HashMap < String , ClassNode > ( ) ; private boolean passingParams ; public static final boolean CREATE_DEBUG_INFO = true ; public static final boolean CREATE_LINE_NUMBER_INFO = true ; public static final boolean ASM_DEBUG = false ; private ASTNode currentASTNode = null ; private Map genericParameterNames = null ; private SourceUnit source ; private WriterController controller ; public AsmClassGenerator ( SourceUnit source , GeneratorContext context , ClassVisitor classVisitor , String sourceFile ) { this . source = source ; this . context = context ; this . cv = classVisitor ; this . sourceFile = sourceFile ; genericParameterNames = new HashMap ( ) ; } public SourceUnit getSourceUnit ( ) { return source ; } public WriterController getController ( ) { return controller ; } public void visitClass ( ClassNode classNode ) { referencedClasses . clear ( ) ; WriterControllerFactory factory = ( WriterControllerFactory ) classNode . getNodeMetaData ( WriterControllerFactory . class ) ; WriterController normalController = new WriterController ( ) ; if ( factory != null ) { this . controller = factory . makeController ( normalController ) ; } else { this . controller = normalController ; } this . controller . init ( this , context , cv , classNode ) ; if ( controller . shouldOptimizeForInt ( ) ) { OptimizingStatementWriter . setNodeMeta ( controller . getTypeChooser ( ) , classNode ) ; } try { cv . visit ( controller . getBytecodeVersion ( ) , adjustedClassModifiers ( classNode . getModifiers ( ) ) , controller . getInternalClassName ( ) , BytecodeHelper . getGenericsSignature ( classNode ) , controller . getInternalBaseClassName ( ) , BytecodeHelper . getClassInternalNames ( classNode . getInterfaces ( ) ) ) ; cv . visitSource ( sourceFile , null ) ; if ( classNode . getName ( ) . endsWith ( "<STR_LIT>" ) ) { PackageNode packageNode = classNode . getPackage ( ) ; if ( packageNode != null ) { for ( AnnotationNode an : packageNode . getAnnotations ( ) ) { if ( an . isBuiltIn ( ) ) continue ; if ( an . hasSourceRetention ( ) ) continue ; AnnotationVisitor av = getAnnotationVisitor ( classNode , an , cv ) ; visitAnnotationAttributes ( an , av ) ; av . visitEnd ( ) ; } } cv . visitEnd ( ) ; return ; } else { visitAnnotations ( classNode , cv ) ; } if ( classNode . isInterface ( ) ) { ClassNode owner = classNode ; if ( owner instanceof InnerClassNode ) { owner = owner . getOuterClass ( ) ; } String outerClassName = classNode . getName ( ) ; String name = outerClassName + "<STR_LIT:$>" + context . getNextInnerClassIdx ( ) ; controller . setInterfaceClassLoadingClass ( new InterfaceHelperClassNode ( owner , name , <NUM_LIT> , ClassHelper . OBJECT_TYPE , controller . getCallSiteWriter ( ) . getCallSites ( ) ) ) ; super . visitClass ( classNode ) ; createInterfaceSyntheticStaticFields ( ) ; } else { super . visitClass ( classNode ) ; MopWriter mopWriter = new MopWriter ( controller ) ; mopWriter . createMopMethods ( ) ; controller . getCallSiteWriter ( ) . generateCallSiteArray ( ) ; createSyntheticStaticFields ( ) ; } for ( Iterator < InnerClassNode > iter = classNode . getInnerClasses ( ) ; iter . hasNext ( ) ; ) { InnerClassNode innerClass = iter . next ( ) ; makeInnerClassEntry ( innerClass ) ; } makeInnerClassEntry ( classNode ) ; cv . visitEnd ( ) ; } catch ( GroovyRuntimeException e ) { e . setModule ( classNode . getModule ( ) ) ; throw e ; } catch ( NullPointerException npe ) { throw new GroovyRuntimeException ( "<STR_LIT>" + sourceFile , npe ) ; } } private void makeInnerClassEntry ( ClassNode cn ) { if ( ! ( cn instanceof InnerClassNode ) ) return ; InnerClassNode innerClass = ( InnerClassNode ) cn ; String innerClassName = innerClass . getName ( ) ; String innerClassInternalName = BytecodeHelper . getClassInternalName ( innerClassName ) ; { int index = innerClassName . lastIndexOf ( '<CHAR_LIT>' ) ; if ( index >= <NUM_LIT:0> ) innerClassName = innerClassName . substring ( index + <NUM_LIT:1> ) ; } String outerClassName = BytecodeHelper . getClassInternalName ( innerClass . getOuterClass ( ) . getName ( ) ) ; MethodNode enclosingMethod = innerClass . getEnclosingMethod ( ) ; if ( enclosingMethod != null ) { outerClassName = null ; innerClassName = null ; } int mods = innerClass . getModifiers ( ) ; cv . visitInnerClass ( innerClassInternalName , outerClassName , innerClassName , mods ) ; } private int adjustedClassModifiers ( int modifiers ) { boolean needsSuper = ( modifiers & ACC_INTERFACE ) == <NUM_LIT:0> ; modifiers = needsSuper ? modifiers | ACC_SUPER : modifiers ; modifiers = modifiers & ~ ACC_STATIC ; return modifiers ; } public void visitGenericType ( GenericsType genericsType ) { ClassNode type = genericsType . getType ( ) ; genericParameterNames . put ( type . getName ( ) , genericsType ) ; } private String [ ] buildExceptions ( ClassNode [ ] exceptions ) { if ( exceptions == null ) return null ; String [ ] ret = new String [ exceptions . length ] ; for ( int i = <NUM_LIT:0> ; i < exceptions . length ; i ++ ) { ret [ i ] = BytecodeHelper . getClassInternalName ( exceptions [ i ] ) ; } return ret ; } protected void visitConstructorOrMethod ( MethodNode node , boolean isConstructor ) { controller . resetLineNumber ( ) ; Parameter [ ] parameters = node . getParameters ( ) ; String methodType = BytecodeHelper . getMethodDescriptor ( node . getReturnType ( ) , parameters ) ; String signature = BytecodeHelper . getGenericsMethodSignature ( node ) ; int modifiers = node . getModifiers ( ) ; if ( isVargs ( node . getParameters ( ) ) ) modifiers |= Opcodes . ACC_VARARGS ; MethodVisitor mv = cv . visitMethod ( modifiers , node . getName ( ) , methodType , signature , buildExceptions ( node . getExceptions ( ) ) ) ; controller . setMethodVisitor ( mv ) ; visitAnnotations ( node , mv ) ; for ( int i = <NUM_LIT:0> ; i < parameters . length ; i ++ ) { visitParameterAnnotations ( parameters [ i ] , i , mv ) ; } if ( controller . getClassNode ( ) . isAnnotationDefinition ( ) && ! node . isStaticConstructor ( ) ) { visitAnnotationDefault ( node , mv ) ; } else if ( ! node . isAbstract ( ) ) { Statement code = node . getCode ( ) ; mv . visitCode ( ) ; if ( code instanceof BytecodeSequence && ( ( BytecodeSequence ) code ) . getInstructions ( ) . size ( ) == <NUM_LIT:1> && ( ( BytecodeSequence ) code ) . getInstructions ( ) . get ( <NUM_LIT:0> ) instanceof BytecodeInstruction ) { ( ( BytecodeInstruction ) ( ( BytecodeSequence ) code ) . getInstructions ( ) . get ( <NUM_LIT:0> ) ) . visit ( mv ) ; } else { visitStdMethod ( node , isConstructor , parameters , code ) ; } mv . visitMaxs ( <NUM_LIT:0> , <NUM_LIT:0> ) ; } mv . visitEnd ( ) ; } private void visitStdMethod ( MethodNode node , boolean isConstructor , Parameter [ ] parameters , Statement code ) { MethodVisitor mv = controller . getMethodVisitor ( ) ; final ClassNode superClass = controller . getClassNode ( ) . getSuperClass ( ) ; if ( isConstructor && ( code == null || ! ( ( ConstructorNode ) node ) . firstStatementIsSpecialConstructorCall ( ) ) ) { boolean hasCallToSuper = false ; if ( code != null && controller . getClassNode ( ) instanceof InnerClassNode ) { if ( code instanceof BlockStatement ) { for ( Statement statement : ( ( BlockStatement ) code ) . getStatements ( ) ) { if ( statement instanceof ExpressionStatement ) { final Expression expression = ( ( ExpressionStatement ) statement ) . getExpression ( ) ; if ( expression instanceof ConstructorCallExpression ) { ConstructorCallExpression call = ( ConstructorCallExpression ) expression ; if ( call . isSuperCall ( ) ) { hasCallToSuper = true ; break ; } } } } } } if ( ! hasCallToSuper ) { mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; mv . visitMethodInsn ( INVOKESPECIAL , BytecodeHelper . getClassInternalName ( superClass ) , "<STR_LIT>" , "<STR_LIT>" ) ; } } controller . getCompileStack ( ) . init ( node . getVariableScope ( ) , parameters ) ; controller . getCallSiteWriter ( ) . makeSiteEntry ( ) ; super . visitConstructorOrMethod ( node , isConstructor ) ; controller . getCompileStack ( ) . clear ( ) ; if ( node . isVoidMethod ( ) ) { mv . visitInsn ( RETURN ) ; } else { ClassNode type = node . getReturnType ( ) . redirect ( ) ; if ( ClassHelper . isPrimitiveType ( type ) ) { mv . visitLdcInsn ( <NUM_LIT:0> ) ; controller . getOperandStack ( ) . push ( ClassHelper . int_TYPE ) ; controller . getOperandStack ( ) . doGroovyCast ( type ) ; BytecodeHelper . doReturn ( mv , type ) ; controller . getOperandStack ( ) . remove ( <NUM_LIT:1> ) ; } else { mv . visitInsn ( ACONST_NULL ) ; BytecodeHelper . doReturn ( mv , type ) ; } } } void visitAnnotationDefaultExpression ( AnnotationVisitor av , ClassNode type , Expression exp ) { if ( exp instanceof ClosureExpression ) { ClassNode closureClass = controller . getClosureWriter ( ) . getOrAddClosureClass ( ( ClosureExpression ) exp , ACC_PUBLIC ) ; Type t = Type . getType ( BytecodeHelper . getTypeDescription ( closureClass ) ) ; av . visit ( null , t ) ; } else if ( type . isArray ( ) ) { ListExpression list = ( ListExpression ) exp ; AnnotationVisitor avl = av . visitArray ( null ) ; ClassNode componentType = type . getComponentType ( ) ; for ( Expression lExp : list . getExpressions ( ) ) { visitAnnotationDefaultExpression ( avl , componentType , lExp ) ; } } else if ( ClassHelper . isPrimitiveType ( type ) || type . equals ( ClassHelper . STRING_TYPE ) ) { ConstantExpression constExp = ( ConstantExpression ) exp ; av . visit ( null , constExp . getValue ( ) ) ; } else if ( ClassHelper . CLASS_Type . equals ( type ) ) { ClassNode clazz = exp . getType ( ) ; Type t = Type . getType ( BytecodeHelper . getTypeDescription ( clazz ) ) ; av . visit ( null , t ) ; } else if ( type . isDerivedFrom ( ClassHelper . Enum_Type ) ) { PropertyExpression pExp = ( PropertyExpression ) exp ; ClassExpression cExp = ( ClassExpression ) pExp . getObjectExpression ( ) ; String desc = BytecodeHelper . getTypeDescription ( cExp . getType ( ) ) ; String name = pExp . getPropertyAsString ( ) ; av . visitEnum ( null , desc , name ) ; } else if ( type . implementsInterface ( ClassHelper . Annotation_TYPE ) ) { AnnotationConstantExpression avExp = ( AnnotationConstantExpression ) exp ; AnnotationNode value = ( AnnotationNode ) avExp . getValue ( ) ; AnnotationVisitor avc = av . visitAnnotation ( null , BytecodeHelper . getTypeDescription ( avExp . getType ( ) ) ) ; visitAnnotationAttributes ( value , avc ) ; } else { throw new GroovyBugError ( "<STR_LIT>" + type . getName ( ) ) ; } av . visitEnd ( ) ; } private void visitAnnotationDefault ( MethodNode node , MethodVisitor mv ) { if ( ! node . hasAnnotationDefault ( ) ) return ; Expression exp = ( ( ReturnStatement ) node . getCode ( ) ) . getExpression ( ) ; AnnotationVisitor av = mv . visitAnnotationDefault ( ) ; visitAnnotationDefaultExpression ( av , node . getReturnType ( ) , exp ) ; } private static boolean isVargs ( Parameter [ ] p ) { if ( p . length == <NUM_LIT:0> ) return false ; ClassNode clazz = p [ p . length - <NUM_LIT:1> ] . getType ( ) ; return ( clazz . isArray ( ) ) ; } public void visitConstructor ( ConstructorNode node ) { controller . setConstructorNode ( node ) ; super . visitConstructor ( node ) ; } public void visitMethod ( MethodNode node ) { controller . setMethodNode ( node ) ; super . visitMethod ( node ) ; } public void visitField ( FieldNode fieldNode ) { onLineNumber ( fieldNode , "<STR_LIT>" + fieldNode . getName ( ) ) ; ClassNode t = fieldNode . getType ( ) ; String signature = BytecodeHelper . getGenericsBounds ( t ) ; Expression initialValueExpression = fieldNode . getInitialValueExpression ( ) ; ConstantExpression cexp = initialValueExpression instanceof ConstantExpression ? ( ConstantExpression ) initialValueExpression : null ; if ( cexp != null ) { cexp = Verifier . transformToPrimitiveConstantIfPossible ( cexp ) ; } Object value = cexp != null && ClassHelper . isStaticConstantInitializerType ( cexp . getType ( ) ) && cexp . getType ( ) . equals ( t ) && fieldNode . isStatic ( ) && fieldNode . isFinal ( ) ? cexp . getValue ( ) : null ; if ( value != null ) { if ( ClassHelper . byte_TYPE . equals ( t ) || ClassHelper . short_TYPE . equals ( t ) ) { value = ( ( Number ) value ) . intValue ( ) ; } else if ( ClassHelper . char_TYPE . equals ( t ) ) { value = Integer . valueOf ( ( Character ) value ) ; } } FieldVisitor fv = cv . visitField ( fieldNode . getModifiers ( ) , fieldNode . getName ( ) , BytecodeHelper . getTypeDescription ( t ) , signature , value ) ; visitAnnotations ( fieldNode , fv ) ; fv . visitEnd ( ) ; } public void visitProperty ( PropertyNode statement ) { onLineNumber ( statement , "<STR_LIT>" + statement . getField ( ) . getName ( ) ) ; controller . setMethodNode ( null ) ; } protected void visitStatement ( Statement statement ) { throw new GroovyBugError ( "<STR_LIT>" ) ; } @ Override public void visitCatchStatement ( CatchStatement statement ) { statement . getCode ( ) . visit ( this ) ; } public void visitBlockStatement ( BlockStatement block ) { controller . getStatementWriter ( ) . writeBlockStatement ( block ) ; } public void visitForLoop ( ForStatement loop ) { controller . getStatementWriter ( ) . writeForStatement ( loop ) ; } public void visitWhileLoop ( WhileStatement loop ) { controller . getStatementWriter ( ) . writeWhileLoop ( loop ) ; } public void visitDoWhileLoop ( DoWhileStatement loop ) { controller . getStatementWriter ( ) . writeDoWhileLoop ( loop ) ; } public void visitIfElse ( IfStatement ifElse ) { controller . getStatementWriter ( ) . writeIfElse ( ifElse ) ; } public void visitAssertStatement ( AssertStatement statement ) { controller . getStatementWriter ( ) . writeAssert ( statement ) ; } public void visitTryCatchFinally ( TryCatchStatement statement ) { controller . getStatementWriter ( ) . writeTryCatchFinally ( statement ) ; } public void visitSwitch ( SwitchStatement statement ) { controller . getStatementWriter ( ) . writeSwitch ( statement ) ; } public void visitCaseStatement ( CaseStatement statement ) { } public void visitBreakStatement ( BreakStatement statement ) { controller . getStatementWriter ( ) . writeBreak ( statement ) ; } public void visitContinueStatement ( ContinueStatement statement ) { controller . getStatementWriter ( ) . writeContinue ( statement ) ; } public void visitSynchronizedStatement ( SynchronizedStatement statement ) { controller . getStatementWriter ( ) . writeSynchronized ( statement ) ; } public void visitThrowStatement ( ThrowStatement statement ) { controller . getStatementWriter ( ) . writeThrow ( statement ) ; } public void visitReturnStatement ( ReturnStatement statement ) { controller . getStatementWriter ( ) . writeReturn ( statement ) ; } public void visitExpressionStatement ( ExpressionStatement statement ) { controller . getStatementWriter ( ) . writeExpressionStatement ( statement ) ; } public void visitTernaryExpression ( TernaryExpression expression ) { onLineNumber ( expression , "<STR_LIT>" ) ; controller . getBinaryExpressionHelper ( ) . evaluateTernary ( expression ) ; } public void visitDeclarationExpression ( DeclarationExpression expression ) { onLineNumber ( expression , "<STR_LIT>" + expression . getText ( ) + "<STR_LIT:\">" ) ; controller . getBinaryExpressionHelper ( ) . evaluateEqual ( expression , true ) ; } public void visitBinaryExpression ( BinaryExpression expression ) { onLineNumber ( expression , "<STR_LIT>" + expression . getOperation ( ) . getText ( ) + "<STR_LIT>" ) ; controller . getBinaryExpressionHelper ( ) . eval ( expression ) ; controller . getAssertionWriter ( ) . record ( expression . getOperation ( ) ) ; } public void visitPostfixExpression ( PostfixExpression expression ) { controller . getBinaryExpressionHelper ( ) . evaluatePostfixMethod ( expression ) ; controller . getAssertionWriter ( ) . record ( expression ) ; } public void throwException ( String s ) { throw new RuntimeParserException ( s , currentASTNode ) ; } public void visitPrefixExpression ( PrefixExpression expression ) { controller . getBinaryExpressionHelper ( ) . evaluatePrefixMethod ( expression ) ; controller . getAssertionWriter ( ) . record ( expression ) ; } public void visitClosureExpression ( ClosureExpression expression ) { controller . getClosureWriter ( ) . writeClosure ( expression ) ; } protected void loadThisOrOwner ( ) { if ( isInnerClass ( ) ) { visitFieldExpression ( new FieldExpression ( controller . getClassNode ( ) . getDeclaredField ( "<STR_LIT>" ) ) ) ; } else { loadThis ( ) ; } } public void visitConstantExpression ( ConstantExpression expression ) { final String constantName = expression . getConstantName ( ) ; if ( controller . isStaticConstructor ( ) || constantName == null ) { controller . getOperandStack ( ) . pushConstant ( expression ) ; } else { controller . getMethodVisitor ( ) . visitFieldInsn ( GETSTATIC , controller . getInternalClassName ( ) , constantName , BytecodeHelper . getTypeDescription ( expression . getType ( ) ) ) ; controller . getOperandStack ( ) . push ( expression . getType ( ) ) ; } } public void visitSpreadExpression ( SpreadExpression expression ) { throw new GroovyBugError ( "<STR_LIT>" ) ; } public void visitSpreadMapExpression ( SpreadMapExpression expression ) { Expression subExpression = expression . getExpression ( ) ; controller . getAssertionWriter ( ) . disableTracker ( ) ; subExpression . visit ( this ) ; controller . getOperandStack ( ) . box ( ) ; spreadMap . call ( controller . getMethodVisitor ( ) ) ; controller . getAssertionWriter ( ) . reenableTracker ( ) ; controller . getOperandStack ( ) . replace ( ClassHelper . OBJECT_TYPE ) ; } public void visitMethodPointerExpression ( MethodPointerExpression expression ) { Expression subExpression = expression . getExpression ( ) ; subExpression . visit ( this ) ; controller . getOperandStack ( ) . box ( ) ; controller . getOperandStack ( ) . pushDynamicName ( expression . getMethodName ( ) ) ; getMethodPointer . call ( controller . getMethodVisitor ( ) ) ; controller . getOperandStack ( ) . replace ( ClassHelper . CLOSURE_TYPE , <NUM_LIT:2> ) ; } public void visitUnaryMinusExpression ( UnaryMinusExpression expression ) { controller . getUnaryExpressionHelper ( ) . writeUnaryMinus ( expression ) ; } public void visitUnaryPlusExpression ( UnaryPlusExpression expression ) { controller . getUnaryExpressionHelper ( ) . writeUnaryPlus ( expression ) ; } public void visitBitwiseNegationExpression ( BitwiseNegationExpression expression ) { controller . getUnaryExpressionHelper ( ) . writeBitwiseNegate ( expression ) ; } public void visitCastExpression ( CastExpression castExpression ) { ClassNode type = castExpression . getType ( ) ; Expression subExpression = castExpression . getExpression ( ) ; subExpression . visit ( this ) ; if ( castExpression . isCoerce ( ) ) { controller . getOperandStack ( ) . doAsType ( type ) ; } else { if ( isNullConstant ( subExpression ) ) { controller . getOperandStack ( ) . replace ( type ) ; } else { controller . getOperandStack ( ) . doGroovyCast ( type ) ; } } } public void visitNotExpression ( NotExpression expression ) { controller . getUnaryExpressionHelper ( ) . writeNotExpression ( expression ) ; } public void visitBooleanExpression ( BooleanExpression expression ) { controller . getCompileStack ( ) . pushBooleanExpression ( ) ; int mark = controller . getOperandStack ( ) . getStackLength ( ) ; Expression inner = expression . getExpression ( ) ; inner . visit ( this ) ; controller . getOperandStack ( ) . castToBool ( mark , true ) ; controller . getCompileStack ( ) . pop ( ) ; } public void visitMethodCallExpression ( MethodCallExpression call ) { onLineNumber ( call , "<STR_LIT>" + call . getMethod ( ) + "<STR_LIT>" ) ; controller . getInvocationWriter ( ) . writeInvokeMethod ( call ) ; controller . getAssertionWriter ( ) . record ( call . getMethod ( ) ) ; } protected boolean emptyArguments ( Expression arguments ) { return argumentSize ( arguments ) == <NUM_LIT:0> ; } public static boolean containsSpreadExpression ( Expression arguments ) { List args = null ; if ( arguments instanceof TupleExpression ) { TupleExpression tupleExpression = ( TupleExpression ) arguments ; args = tupleExpression . getExpressions ( ) ; } else if ( arguments instanceof ListExpression ) { ListExpression le = ( ListExpression ) arguments ; args = le . getExpressions ( ) ; } else { return arguments instanceof SpreadExpression ; } for ( Iterator iter = args . iterator ( ) ; iter . hasNext ( ) ; ) { if ( iter . next ( ) instanceof SpreadExpression ) return true ; } return false ; } public static int argumentSize ( Expression arguments ) { if ( arguments instanceof TupleExpression ) { TupleExpression tupleExpression = ( TupleExpression ) arguments ; int size = tupleExpression . getExpressions ( ) . size ( ) ; return size ; } return <NUM_LIT:1> ; } public void visitStaticMethodCallExpression ( StaticMethodCallExpression call ) { onLineNumber ( call , "<STR_LIT>" + call . getMethod ( ) + "<STR_LIT>" ) ; controller . getInvocationWriter ( ) . writeInvokeStaticMethod ( call ) ; controller . getAssertionWriter ( ) . record ( call ) ; } private void visitSpecialConstructorCall ( ConstructorCallExpression call ) { if ( controller . getClosureWriter ( ) . addGeneratedClosureConstructorCall ( call ) ) return ; ClassNode callNode = controller . getClassNode ( ) ; if ( call . isSuperCall ( ) ) callNode = callNode . getSuperClass ( ) ; List < ConstructorNode > constructors = sortConstructors ( call , callNode ) ; if ( ! makeDirectConstructorCall ( constructors , call , callNode ) ) { makeMOPBasedConstructorCall ( constructors , call , callNode ) ; } } private static ConstructorNode getMatchingConstructor ( List < ConstructorNode > constructors , List < Expression > argumentList ) { ConstructorNode lastMatch = null ; for ( int i = <NUM_LIT:0> ; i < constructors . size ( ) ; i ++ ) { ConstructorNode cn = constructors . get ( i ) ; Parameter [ ] params = cn . getParameters ( ) ; if ( argumentList . size ( ) != params . length ) continue ; if ( lastMatch == null ) { lastMatch = cn ; } else { return null ; } } return lastMatch ; } private boolean makeDirectConstructorCall ( List < ConstructorNode > constructors , ConstructorCallExpression call , ClassNode callNode ) { if ( ! controller . isConstructor ( ) ) return false ; Expression arguments = call . getArguments ( ) ; List < Expression > argumentList ; if ( arguments instanceof TupleExpression ) { argumentList = ( ( TupleExpression ) arguments ) . getExpressions ( ) ; } else { argumentList = new ArrayList ( ) ; argumentList . add ( arguments ) ; } for ( Expression expression : argumentList ) { if ( expression instanceof SpreadExpression ) return false ; } ConstructorNode cn = getMatchingConstructor ( constructors , argumentList ) ; if ( cn == null ) return false ; MethodVisitor mv = controller . getMethodVisitor ( ) ; OperandStack operandStack = controller . getOperandStack ( ) ; Parameter [ ] params = cn . getParameters ( ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; for ( int i = <NUM_LIT:0> ; i < params . length ; i ++ ) { Expression expression = argumentList . get ( i ) ; expression . visit ( this ) ; if ( ! isNullConstant ( expression ) ) { operandStack . doGroovyCast ( params [ i ] . getType ( ) ) ; } operandStack . remove ( <NUM_LIT:1> ) ; } String descriptor = BytecodeHelper . getMethodDescriptor ( ClassHelper . VOID_TYPE , params ) ; mv . visitMethodInsn ( INVOKESPECIAL , BytecodeHelper . getClassInternalName ( callNode ) , "<STR_LIT>" , descriptor ) ; return true ; } private static boolean isNullConstant ( Expression expr ) { return expr instanceof ConstantExpression && ( ( ConstantExpression ) expr ) . getValue ( ) == null ; } private void makeMOPBasedConstructorCall ( List < ConstructorNode > constructors , ConstructorCallExpression call , ClassNode callNode ) { MethodVisitor mv = controller . getMethodVisitor ( ) ; OperandStack operandStack = controller . getOperandStack ( ) ; call . getArguments ( ) . visit ( this ) ; mv . visitInsn ( DUP ) ; BytecodeHelper . pushConstant ( mv , constructors . size ( ) ) ; visitClassExpression ( new ClassExpression ( callNode ) ) ; operandStack . remove ( <NUM_LIT:1> ) ; selectConstructorAndTransformArguments . call ( mv ) ; mv . visitInsn ( DUP_X1 ) ; mv . visitInsn ( ICONST_1 ) ; mv . visitInsn ( IAND ) ; Label afterIf = new Label ( ) ; mv . visitJumpInsn ( IFEQ , afterIf ) ; mv . visitInsn ( ICONST_0 ) ; mv . visitInsn ( AALOAD ) ; mv . visitTypeInsn ( CHECKCAST , "<STR_LIT>" ) ; mv . visitLabel ( afterIf ) ; mv . visitInsn ( SWAP ) ; if ( controller . isConstructor ( ) ) { mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; } else { mv . visitTypeInsn ( NEW , BytecodeHelper . getClassInternalName ( callNode ) ) ; } mv . visitInsn ( SWAP ) ; mv . visitIntInsn ( BIPUSH , <NUM_LIT:8> ) ; mv . visitInsn ( ISHR ) ; Label [ ] targets = new Label [ constructors . size ( ) ] ; int [ ] indices = new int [ constructors . size ( ) ] ; for ( int i = <NUM_LIT:0> ; i < targets . length ; i ++ ) { targets [ i ] = new Label ( ) ; indices [ i ] = i ; } Label defaultLabel = new Label ( ) ; Label afterSwitch = new Label ( ) ; mv . visitLookupSwitchInsn ( defaultLabel , indices , targets ) ; for ( int i = <NUM_LIT:0> ; i < targets . length ; i ++ ) { mv . visitLabel ( targets [ i ] ) ; if ( controller . isConstructor ( ) ) { mv . visitInsn ( SWAP ) ; mv . visitInsn ( DUP_X1 ) ; } else { mv . visitInsn ( DUP_X1 ) ; mv . visitInsn ( DUP2_X1 ) ; mv . visitInsn ( POP ) ; } ConstructorNode cn = constructors . get ( i ) ; String descriptor = BytecodeHelper . getMethodDescriptor ( ClassHelper . VOID_TYPE , cn . getParameters ( ) ) ; Parameter [ ] parameters = cn . getParameters ( ) ; for ( int p = <NUM_LIT:0> ; p < parameters . length ; p ++ ) { operandStack . push ( ClassHelper . OBJECT_TYPE ) ; mv . visitInsn ( DUP ) ; BytecodeHelper . pushConstant ( mv , p ) ; mv . visitInsn ( AALOAD ) ; operandStack . push ( ClassHelper . OBJECT_TYPE ) ; ClassNode type = parameters [ p ] . getType ( ) ; operandStack . doGroovyCast ( type ) ; operandStack . swap ( ) ; operandStack . remove ( <NUM_LIT:2> ) ; } mv . visitInsn ( POP ) ; mv . visitMethodInsn ( INVOKESPECIAL , BytecodeHelper . getClassInternalName ( callNode ) , "<STR_LIT>" , descriptor ) ; mv . visitJumpInsn ( GOTO , afterSwitch ) ; } mv . visitLabel ( defaultLabel ) ; mv . visitTypeInsn ( NEW , "<STR_LIT>" ) ; mv . visitInsn ( DUP ) ; mv . visitLdcInsn ( "<STR_LIT>" ) ; mv . visitMethodInsn ( INVOKESPECIAL , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitInsn ( ATHROW ) ; mv . visitLabel ( afterSwitch ) ; if ( ! controller . isConstructor ( ) ) { mv . visitInsn ( SWAP ) ; operandStack . push ( callNode ) ; } mv . visitInsn ( POP ) ; } private List < ConstructorNode > sortConstructors ( ConstructorCallExpression call , ClassNode callNode ) { List < ConstructorNode > constructors = new ArrayList < ConstructorNode > ( callNode . getDeclaredConstructors ( ) ) ; Comparator comp = new Comparator ( ) { public int compare ( Object arg0 , Object arg1 ) { ConstructorNode c0 = ( ConstructorNode ) arg0 ; ConstructorNode c1 = ( ConstructorNode ) arg1 ; String descriptor0 = BytecodeHelper . getMethodDescriptor ( ClassHelper . VOID_TYPE , c0 . getParameters ( ) ) ; String descriptor1 = BytecodeHelper . getMethodDescriptor ( ClassHelper . VOID_TYPE , c1 . getParameters ( ) ) ; return descriptor0 . compareTo ( descriptor1 ) ; } } ; Collections . sort ( constructors , comp ) ; return constructors ; } public void visitConstructorCallExpression ( ConstructorCallExpression call ) { onLineNumber ( call , "<STR_LIT>" + call . getType ( ) . getName ( ) + "<STR_LIT>" ) ; if ( call . isSpecialCall ( ) ) { controller . getCompileStack ( ) . pushInSpecialConstructorCall ( ) ; visitSpecialConstructorCall ( call ) ; controller . getCompileStack ( ) . pop ( ) ; return ; } controller . getInvocationWriter ( ) . writeInvokeConstructor ( call ) ; controller . getAssertionWriter ( ) . record ( call ) ; } private static String makeFieldClassName ( ClassNode type ) { String internalName = BytecodeHelper . getClassInternalName ( type ) ; StringBuffer ret = new StringBuffer ( internalName . length ( ) ) ; for ( int i = <NUM_LIT:0> ; i < internalName . length ( ) ; i ++ ) { char c = internalName . charAt ( i ) ; if ( c == '<CHAR_LIT:/>' ) { ret . append ( '<CHAR_LIT>' ) ; } else if ( c == '<CHAR_LIT:;>' ) { } else { ret . append ( c ) ; } } return ret . toString ( ) ; } private static String getStaticFieldName ( ClassNode type ) { ClassNode componentType = type ; String prefix = "<STR_LIT>" ; for ( ; componentType . isArray ( ) ; componentType = componentType . getComponentType ( ) ) { prefix += "<STR_LIT:$>" ; } if ( prefix . length ( ) != <NUM_LIT:0> ) prefix = "<STR_LIT>" + prefix ; String name = prefix + "<STR_LIT>" + makeFieldClassName ( componentType ) ; return name ; } private void visitAttributeOrProperty ( PropertyExpression expression , MethodCallerMultiAdapter adapter ) { MethodVisitor mv = controller . getMethodVisitor ( ) ; Expression objectExpression = expression . getObjectExpression ( ) ; ClassNode classNode = controller . getClassNode ( ) ; if ( isThisOrSuper ( objectExpression ) ) { String name = expression . getPropertyAsString ( ) ; if ( name != null ) { FieldNode field = null ; boolean privateSuperField = false ; if ( isSuperExpression ( objectExpression ) ) { field = classNode . getSuperClass ( ) . getDeclaredField ( name ) ; if ( field != null && ( ( field . getModifiers ( ) & ACC_PRIVATE ) != <NUM_LIT:0> ) ) { privateSuperField = true ; } } else { if ( controller . isNotExplicitThisInClosure ( expression . isImplicitThis ( ) ) ) { field = classNode . getDeclaredField ( name ) ; if ( field == null && classNode instanceof InnerClassNode ) { ClassNode outer = classNode . getOuterClass ( ) ; FieldNode outerClassField ; while ( outer != null ) { outerClassField = outer . getDeclaredField ( name ) ; if ( outerClassField != null && outerClassField . isStatic ( ) && outerClassField . isFinal ( ) ) { if ( outer != classNode . getOuterClass ( ) && Modifier . isPrivate ( outerClassField . getModifiers ( ) ) ) { throw new GroovyBugError ( "<STR_LIT>" + outerClassField . getDeclaringClass ( ) + "<STR_LIT:#>" + outerClassField . getName ( ) + "<STR_LIT>" ) ; } PropertyExpression pexp = new PropertyExpression ( new ClassExpression ( outer ) , expression . getProperty ( ) ) ; pexp . visit ( controller . getAcg ( ) ) ; return ; } outer = outer . getSuperClass ( ) ; } } } } if ( field != null && ! privateSuperField ) { visitFieldExpression ( new FieldExpression ( field ) ) ; return ; } } if ( isSuperExpression ( objectExpression ) ) { String prefix ; if ( controller . getCompileStack ( ) . isLHS ( ) ) { prefix = "<STR_LIT>" ; } else { prefix = "<STR_LIT:get>" ; } String propName = prefix + MetaClassHelper . capitalize ( name ) ; visitMethodCallExpression ( new MethodCallExpression ( objectExpression , propName , MethodCallExpression . NO_ARGUMENTS ) ) ; return ; } } final String propName = expression . getPropertyAsString ( ) ; if ( expression . getObjectExpression ( ) instanceof ClassExpression && propName != null && propName . equals ( "<STR_LIT>" ) ) { ClassNode type = objectExpression . getType ( ) ; ClassNode iterType = classNode ; mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; while ( ! iterType . equals ( type ) ) { String ownerName = BytecodeHelper . getClassInternalName ( iterType ) ; if ( iterType . getOuterClass ( ) == null ) break ; iterType = iterType . getOuterClass ( ) ; String typeName = BytecodeHelper . getTypeDescription ( iterType ) ; mv . visitFieldInsn ( GETFIELD , ownerName , "<STR_LIT>" , typeName ) ; } controller . getOperandStack ( ) . push ( type ) ; return ; } if ( adapter == getProperty && ! expression . isSpreadSafe ( ) && propName != null ) { controller . getCallSiteWriter ( ) . makeGetPropertySite ( objectExpression , propName , expression . isSafe ( ) , expression . isImplicitThis ( ) ) ; } else if ( adapter == getGroovyObjectProperty && ! expression . isSpreadSafe ( ) && propName != null ) { controller . getCallSiteWriter ( ) . makeGroovyObjectGetPropertySite ( objectExpression , propName , expression . isSafe ( ) , expression . isImplicitThis ( ) ) ; } else { if ( controller . getCompileStack ( ) . isLHS ( ) ) controller . getOperandStack ( ) . box ( ) ; controller . getInvocationWriter ( ) . makeCall ( expression , objectExpression , new CastExpression ( ClassHelper . STRING_TYPE , expression . getProperty ( ) ) , MethodCallExpression . NO_ARGUMENTS , adapter , expression . isSafe ( ) , expression . isSpreadSafe ( ) , expression . isImplicitThis ( ) ) ; } } public void visitPropertyExpression ( PropertyExpression expression ) { Expression objectExpression = expression . getObjectExpression ( ) ; OperandStack operandStack = controller . getOperandStack ( ) ; int mark = operandStack . getStackLength ( ) - <NUM_LIT:1> ; MethodCallerMultiAdapter adapter ; if ( controller . getCompileStack ( ) . isLHS ( ) ) { adapter = setProperty ; if ( isGroovyObject ( objectExpression ) ) adapter = setGroovyObjectProperty ; if ( controller . isStaticContext ( ) && isThisOrSuper ( objectExpression ) ) adapter = setProperty ; } else { adapter = getProperty ; if ( isGroovyObject ( objectExpression ) ) adapter = getGroovyObjectProperty ; if ( controller . isStaticContext ( ) && isThisOrSuper ( objectExpression ) ) adapter = getProperty ; } visitAttributeOrProperty ( expression , adapter ) ; if ( controller . getCompileStack ( ) . isLHS ( ) ) { operandStack . remove ( operandStack . getStackLength ( ) - mark ) ; } else { controller . getAssertionWriter ( ) . record ( expression . getProperty ( ) ) ; } } public void visitAttributeExpression ( AttributeExpression expression ) { Expression objectExpression = expression . getObjectExpression ( ) ; MethodCallerMultiAdapter adapter ; if ( controller . getCompileStack ( ) . isLHS ( ) ) { adapter = setField ; if ( isGroovyObject ( objectExpression ) ) adapter = setGroovyObjectField ; if ( usesSuper ( expression ) ) adapter = setFieldOnSuper ; } else { adapter = getField ; if ( isGroovyObject ( objectExpression ) ) adapter = getGroovyObjectField ; if ( usesSuper ( expression ) ) adapter = getFieldOnSuper ; } visitAttributeOrProperty ( expression , adapter ) ; if ( ! controller . getCompileStack ( ) . isLHS ( ) ) { controller . getAssertionWriter ( ) . record ( expression . getProperty ( ) ) ; } else { controller . getOperandStack ( ) . remove ( <NUM_LIT:2> ) ; } } private static boolean usesSuper ( PropertyExpression pe ) { Expression expression = pe . getObjectExpression ( ) ; if ( expression instanceof VariableExpression ) { VariableExpression varExp = ( VariableExpression ) expression ; String variable = varExp . getName ( ) ; return variable . equals ( "<STR_LIT>" ) ; } return false ; } private static boolean isGroovyObject ( Expression objectExpression ) { return isThisExpression ( objectExpression ) || objectExpression . getType ( ) . isDerivedFromGroovyObject ( ) && ! ( objectExpression instanceof ClassExpression ) ; } public void visitFieldExpression ( FieldExpression expression ) { FieldNode field = expression . getField ( ) ; if ( field . isStatic ( ) ) { if ( controller . getCompileStack ( ) . isLHS ( ) ) { storeStaticField ( expression ) ; } else { loadStaticField ( expression ) ; } } else { if ( controller . getCompileStack ( ) . isLHS ( ) ) { storeThisInstanceField ( expression ) ; } else { loadInstanceField ( expression ) ; } } if ( controller . getCompileStack ( ) . isLHS ( ) ) controller . getAssertionWriter ( ) . record ( expression ) ; } public void loadStaticField ( FieldExpression fldExp ) { MethodVisitor mv = controller . getMethodVisitor ( ) ; FieldNode field = fldExp . getField ( ) ; boolean holder = field . isHolder ( ) && ! controller . isInClosureConstructor ( ) ; ClassNode type = field . getType ( ) ; String ownerName = ( field . getOwner ( ) . equals ( controller . getClassNode ( ) ) ) ? controller . getInternalClassName ( ) : BytecodeHelper . getClassInternalName ( field . getOwner ( ) ) ; if ( holder ) { mv . visitFieldInsn ( GETSTATIC , ownerName , fldExp . getFieldName ( ) , BytecodeHelper . getTypeDescription ( type ) ) ; mv . visitMethodInsn ( INVOKEVIRTUAL , "<STR_LIT>" , "<STR_LIT:get>" , "<STR_LIT>" ) ; controller . getOperandStack ( ) . push ( ClassHelper . OBJECT_TYPE ) ; } else { mv . visitFieldInsn ( GETSTATIC , ownerName , fldExp . getFieldName ( ) , BytecodeHelper . getTypeDescription ( type ) ) ; controller . getOperandStack ( ) . push ( field . getType ( ) ) ; } } public void loadInstanceField ( FieldExpression fldExp ) { MethodVisitor mv = controller . getMethodVisitor ( ) ; FieldNode field = fldExp . getField ( ) ; boolean holder = field . isHolder ( ) && ! controller . isInClosureConstructor ( ) ; ClassNode type = field . getType ( ) ; String ownerName = ( field . getOwner ( ) . equals ( controller . getClassNode ( ) ) ) ? controller . getInternalClassName ( ) : BytecodeHelper . getClassInternalName ( field . getOwner ( ) ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; mv . visitFieldInsn ( GETFIELD , ownerName , fldExp . getFieldName ( ) , BytecodeHelper . getTypeDescription ( type ) ) ; if ( holder ) { mv . visitMethodInsn ( INVOKEVIRTUAL , "<STR_LIT>" , "<STR_LIT:get>" , "<STR_LIT>" ) ; controller . getOperandStack ( ) . push ( ClassHelper . OBJECT_TYPE ) ; } else { controller . getOperandStack ( ) . push ( field . getType ( ) ) ; } } private void storeThisInstanceField ( FieldExpression expression ) { MethodVisitor mv = controller . getMethodVisitor ( ) ; FieldNode field = expression . getField ( ) ; boolean setReferenceFromReference = field . isHolder ( ) && expression . isUseReferenceDirectly ( ) ; String ownerName = ( field . getOwner ( ) . equals ( controller . getClassNode ( ) ) ) ? controller . getInternalClassName ( ) : BytecodeHelper . getClassInternalName ( field . getOwner ( ) ) ; OperandStack operandStack = controller . getOperandStack ( ) ; if ( setReferenceFromReference ) { mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; operandStack . push ( controller . getClassNode ( ) ) ; operandStack . swap ( ) ; mv . visitFieldInsn ( PUTFIELD , ownerName , field . getName ( ) , BytecodeHelper . getTypeDescription ( field . getType ( ) ) ) ; } else if ( field . isHolder ( ) ) { operandStack . doGroovyCast ( field . getOriginType ( ) ) ; operandStack . box ( ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; mv . visitFieldInsn ( GETFIELD , ownerName , expression . getFieldName ( ) , BytecodeHelper . getTypeDescription ( field . getType ( ) ) ) ; mv . visitInsn ( SWAP ) ; mv . visitMethodInsn ( INVOKEVIRTUAL , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; } else { operandStack . doGroovyCast ( field . getOriginType ( ) ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; operandStack . push ( controller . getClassNode ( ) ) ; operandStack . swap ( ) ; mv . visitFieldInsn ( PUTFIELD , ownerName , field . getName ( ) , BytecodeHelper . getTypeDescription ( field . getType ( ) ) ) ; } } private void storeStaticField ( FieldExpression expression ) { MethodVisitor mv = controller . getMethodVisitor ( ) ; FieldNode field = expression . getField ( ) ; boolean holder = field . isHolder ( ) && ! controller . isInClosureConstructor ( ) ; controller . getOperandStack ( ) . doGroovyCast ( field ) ; String ownerName = ( field . getOwner ( ) . equals ( controller . getClassNode ( ) ) ) ? controller . getInternalClassName ( ) : BytecodeHelper . getClassInternalName ( field . getOwner ( ) ) ; if ( holder ) { controller . getOperandStack ( ) . box ( ) ; mv . visitFieldInsn ( GETSTATIC , ownerName , expression . getFieldName ( ) , BytecodeHelper . getTypeDescription ( field . getType ( ) ) ) ; mv . visitInsn ( SWAP ) ; mv . visitMethodInsn ( INVOKEVIRTUAL , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; } else { mv . visitFieldInsn ( PUTSTATIC , ownerName , expression . getFieldName ( ) , BytecodeHelper . getTypeDescription ( field . getType ( ) ) ) ; } controller . getOperandStack ( ) . remove ( <NUM_LIT:1> ) ; } public void visitVariableExpression ( VariableExpression expression ) { String variableName = expression . getName ( ) ; ClassNode classNode = controller . getClassNode ( ) ; if ( variableName . equals ( "<STR_LIT>" ) ) { if ( controller . isStaticMethod ( ) || ( ! controller . getCompileStack ( ) . isImplicitThis ( ) && controller . isStaticContext ( ) ) ) { if ( controller . isInClosure ( ) ) classNode = controller . getOutermostClass ( ) ; visitClassExpression ( new ClassExpression ( classNode ) ) ; } else { loadThis ( ) ; } return ; } if ( variableName . equals ( "<STR_LIT>" ) ) { if ( controller . isStaticMethod ( ) ) { visitClassExpression ( new ClassExpression ( classNode . getSuperClass ( ) ) ) ; } else { loadThis ( ) ; } return ; } BytecodeVariable variable = controller . getCompileStack ( ) . getVariable ( variableName , false ) ; if ( variable == null ) { processClassVariable ( variableName ) ; } else { controller . getOperandStack ( ) . loadOrStoreVariable ( variable , expression . isUseReferenceDirectly ( ) ) ; } if ( ! controller . getCompileStack ( ) . isLHS ( ) ) controller . getAssertionWriter ( ) . record ( expression ) ; } private void loadThis ( ) { MethodVisitor mv = controller . getMethodVisitor ( ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; if ( controller . isInClosure ( ) && ! controller . getCompileStack ( ) . isImplicitThis ( ) ) { mv . visitMethodInsn ( INVOKEVIRTUAL , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; controller . getOperandStack ( ) . push ( ClassHelper . OBJECT_TYPE ) ; } else { controller . getOperandStack ( ) . push ( controller . getClassNode ( ) ) ; } } private void processClassVariable ( String name ) { if ( passingParams && controller . isInScriptBody ( ) ) { MethodVisitor mv = controller . getMethodVisitor ( ) ; mv . visitTypeInsn ( NEW , "<STR_LIT>" ) ; mv . visitInsn ( DUP ) ; loadThisOrOwner ( ) ; mv . visitLdcInsn ( name ) ; mv . visitMethodInsn ( INVOKESPECIAL , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; } else { PropertyExpression pexp = new PropertyExpression ( VariableExpression . THIS_EXPRESSION , name ) ; pexp . setImplicitThis ( true ) ; visitPropertyExpression ( pexp ) ; } } protected void createInterfaceSyntheticStaticFields ( ) { ClassNode icl = controller . getInterfaceClassLoadingClass ( ) ; if ( referencedClasses . isEmpty ( ) ) { controller . getClassNode ( ) . forgetInnerClass ( controller . getInterfaceClassLoadingClass ( ) ) ; return ; } addInnerClass ( icl ) ; for ( String staticFieldName : referencedClasses . keySet ( ) ) { icl . addField ( staticFieldName , ACC_STATIC + ACC_SYNTHETIC , ClassHelper . CLASS_Type . getPlainNodeReference ( ) , new ClassExpression ( referencedClasses . get ( staticFieldName ) ) ) ; } } protected void createSyntheticStaticFields ( ) { MethodVisitor mv ; for ( String staticFieldName : referencedClasses . keySet ( ) ) { FieldNode fn = controller . getClassNode ( ) . getDeclaredField ( staticFieldName ) ; if ( fn != null ) { boolean type = fn . getType ( ) . redirect ( ) == ClassHelper . CLASS_Type ; boolean modifiers = fn . getModifiers ( ) == ACC_STATIC + ACC_SYNTHETIC ; if ( ! type || ! modifiers ) { String text = "<STR_LIT>" ; if ( ! type ) text = "<STR_LIT>" + fn . getType ( ) + "<STR_LIT>" ; if ( ! modifiers ) text = "<STR_LIT>" + fn . getModifiers ( ) + "<STR_LIT:U+0020(>" + ( ACC_STATIC + ACC_SYNTHETIC ) + "<STR_LIT>" ; throwException ( "<STR_LIT>" + staticFieldName + "<STR_LIT>" + controller . getClassNode ( ) . getName ( ) + "<STR_LIT>" + "<STR_LIT>" + text ) ; } } else { cv . visitField ( ACC_PRIVATE + ACC_STATIC + ACC_SYNTHETIC , staticFieldName , "<STR_LIT>" , null , null ) ; } mv = cv . visitMethod ( ACC_PRIVATE + ACC_STATIC + ACC_SYNTHETIC , "<STR_LIT>" + staticFieldName , "<STR_LIT>" , null , null ) ; mv . visitCode ( ) ; mv . visitFieldInsn ( GETSTATIC , controller . getInternalClassName ( ) , staticFieldName , "<STR_LIT>" ) ; mv . visitInsn ( DUP ) ; Label l0 = new Label ( ) ; mv . visitJumpInsn ( IFNONNULL , l0 ) ; mv . visitInsn ( POP ) ; mv . visitLdcInsn ( BytecodeHelper . getClassLoadingTypeDescription ( referencedClasses . get ( staticFieldName ) ) ) ; mv . visitMethodInsn ( INVOKESTATIC , controller . getInternalClassName ( ) , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitInsn ( DUP ) ; mv . visitFieldInsn ( PUTSTATIC , controller . getInternalClassName ( ) , staticFieldName , "<STR_LIT>" ) ; mv . visitLabel ( l0 ) ; mv . visitInsn ( ARETURN ) ; mv . visitMaxs ( <NUM_LIT:0> , <NUM_LIT:0> ) ; mv . visitEnd ( ) ; } mv = cv . visitMethod ( ACC_STATIC + ACC_SYNTHETIC , "<STR_LIT>" , "<STR_LIT>" , null , null ) ; Label l0 = new Label ( ) ; mv . visitLabel ( l0 ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; mv . visitMethodInsn ( INVOKESTATIC , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; Label l1 = new Label ( ) ; mv . visitLabel ( l1 ) ; mv . visitInsn ( ARETURN ) ; Label l2 = new Label ( ) ; mv . visitLabel ( l2 ) ; mv . visitVarInsn ( ASTORE , <NUM_LIT:1> ) ; mv . visitTypeInsn ( NEW , "<STR_LIT>" ) ; mv . visitInsn ( DUP ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:1> ) ; mv . visitMethodInsn ( INVOKEVIRTUAL , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitMethodInsn ( INVOKESPECIAL , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitInsn ( ATHROW ) ; mv . visitTryCatchBlock ( l0 , l2 , l2 , "<STR_LIT>" ) ; mv . visitMaxs ( <NUM_LIT:3> , <NUM_LIT:2> ) ; } public void visitClassExpression ( ClassExpression expression ) { ClassNode type = expression . getType ( ) ; MethodVisitor mv = controller . getMethodVisitor ( ) ; if ( BytecodeHelper . isClassLiteralPossible ( type ) || BytecodeHelper . isSameCompilationUnit ( controller . getClassNode ( ) , type ) ) { if ( controller . getClassNode ( ) . isInterface ( ) ) { InterfaceHelperClassNode interfaceClassLoadingClass = controller . getInterfaceClassLoadingClass ( ) ; if ( BytecodeHelper . isClassLiteralPossible ( interfaceClassLoadingClass ) ) { BytecodeHelper . visitClassLiteral ( mv , interfaceClassLoadingClass ) ; controller . getOperandStack ( ) . push ( ClassHelper . CLASS_Type ) ; return ; } } else { BytecodeHelper . visitClassLiteral ( mv , type ) ; controller . getOperandStack ( ) . push ( ClassHelper . CLASS_Type ) ; return ; } } String staticFieldName = getStaticFieldName ( type ) ; referencedClasses . put ( staticFieldName , type ) ; String internalClassName = controller . getInternalClassName ( ) ; if ( controller . getClassNode ( ) . isInterface ( ) ) { internalClassName = BytecodeHelper . getClassInternalName ( controller . getInterfaceClassLoadingClass ( ) ) ; mv . visitFieldInsn ( GETSTATIC , internalClassName , staticFieldName , "<STR_LIT>" ) ; } else { mv . visitMethodInsn ( INVOKESTATIC , internalClassName , "<STR_LIT>" + staticFieldName , "<STR_LIT>" ) ; } controller . getOperandStack ( ) . push ( ClassHelper . CLASS_Type ) ; } public void visitRangeExpression ( RangeExpression expression ) { OperandStack operandStack = controller . getOperandStack ( ) ; expression . getFrom ( ) . visit ( this ) ; operandStack . box ( ) ; expression . getTo ( ) . visit ( this ) ; operandStack . box ( ) ; operandStack . pushBool ( expression . isInclusive ( ) ) ; createRangeMethod . call ( controller . getMethodVisitor ( ) ) ; operandStack . replace ( ClassHelper . RANGE_TYPE , <NUM_LIT:3> ) ; } public void visitMapEntryExpression ( MapEntryExpression expression ) { throw new GroovyBugError ( "<STR_LIT>" ) ; } public void visitMapExpression ( MapExpression expression ) { MethodVisitor mv = controller . getMethodVisitor ( ) ; List entries = expression . getMapEntryExpressions ( ) ; int size = entries . size ( ) ; BytecodeHelper . pushConstant ( mv , size * <NUM_LIT:2> ) ; mv . visitTypeInsn ( ANEWARRAY , "<STR_LIT>" ) ; int i = <NUM_LIT:0> ; for ( Iterator iter = entries . iterator ( ) ; iter . hasNext ( ) ; ) { Object object = iter . next ( ) ; MapEntryExpression entry = ( MapEntryExpression ) object ; mv . visitInsn ( DUP ) ; BytecodeHelper . pushConstant ( mv , i ++ ) ; entry . getKeyExpression ( ) . visit ( this ) ; controller . getOperandStack ( ) . box ( ) ; mv . visitInsn ( AASTORE ) ; mv . visitInsn ( DUP ) ; BytecodeHelper . pushConstant ( mv , i ++ ) ; entry . getValueExpression ( ) . visit ( this ) ; controller . getOperandStack ( ) . box ( ) ; mv . visitInsn ( AASTORE ) ; controller . getOperandStack ( ) . remove ( <NUM_LIT:2> ) ; } createMapMethod . call ( mv ) ; controller . getOperandStack ( ) . push ( ClassHelper . MAP_TYPE ) ; } public void visitArgumentlistExpression ( ArgumentListExpression ale ) { if ( containsSpreadExpression ( ale ) ) { despreadList ( ale . getExpressions ( ) , true ) ; } else { visitTupleExpression ( ale , true ) ; } } public void despreadList ( List expressions , boolean wrap ) { ArrayList spreadIndexes = new ArrayList ( ) ; ArrayList spreadExpressions = new ArrayList ( ) ; ArrayList normalArguments = new ArrayList ( ) ; for ( int i = <NUM_LIT:0> ; i < expressions . size ( ) ; i ++ ) { Object expr = expressions . get ( i ) ; if ( ! ( expr instanceof SpreadExpression ) ) { normalArguments . add ( expr ) ; } else { spreadIndexes . add ( new ConstantExpression ( Integer . valueOf ( i - spreadExpressions . size ( ) ) , true ) ) ; spreadExpressions . add ( ( ( SpreadExpression ) expr ) . getExpression ( ) ) ; } } visitTupleExpression ( new ArgumentListExpression ( normalArguments ) , wrap ) ; ( new TupleExpression ( spreadExpressions ) ) . visit ( this ) ; ( new ArrayExpression ( ClassHelper . int_TYPE , spreadIndexes , null ) ) . visit ( this ) ; controller . getOperandStack ( ) . remove ( <NUM_LIT:1> ) ; despreadList . call ( controller . getMethodVisitor ( ) ) ; } public void visitTupleExpression ( TupleExpression expression ) { visitTupleExpression ( expression , false ) ; } void visitTupleExpression ( TupleExpression expression , boolean useWrapper ) { MethodVisitor mv = controller . getMethodVisitor ( ) ; int size = expression . getExpressions ( ) . size ( ) ; BytecodeHelper . pushConstant ( mv , size ) ; mv . visitTypeInsn ( ANEWARRAY , "<STR_LIT>" ) ; for ( int i = <NUM_LIT:0> ; i < size ; i ++ ) { mv . visitInsn ( DUP ) ; BytecodeHelper . pushConstant ( mv , i ) ; Expression argument = expression . getExpression ( i ) ; argument . visit ( this ) ; controller . getOperandStack ( ) . box ( ) ; if ( useWrapper && argument instanceof CastExpression ) loadWrapper ( argument ) ; mv . visitInsn ( AASTORE ) ; controller . getOperandStack ( ) . remove ( <NUM_LIT:1> ) ; } } public void loadWrapper ( Expression argument ) { MethodVisitor mv = controller . getMethodVisitor ( ) ; ClassNode goalClass = argument . getType ( ) ; visitClassExpression ( new ClassExpression ( goalClass ) ) ; if ( goalClass . isDerivedFromGroovyObject ( ) ) { createGroovyObjectWrapperMethod . call ( mv ) ; } else { createPojoWrapperMethod . call ( mv ) ; } controller . getOperandStack ( ) . remove ( <NUM_LIT:1> ) ; } public void visitArrayExpression ( ArrayExpression expression ) { MethodVisitor mv = controller . getMethodVisitor ( ) ; ClassNode elementType = expression . getElementType ( ) ; String arrayTypeName = BytecodeHelper . getClassInternalName ( elementType ) ; List sizeExpression = expression . getSizeExpression ( ) ; int size = <NUM_LIT:0> ; int dimensions = <NUM_LIT:0> ; if ( sizeExpression != null ) { for ( Iterator iter = sizeExpression . iterator ( ) ; iter . hasNext ( ) ; ) { Expression element = ( Expression ) iter . next ( ) ; if ( element == ConstantExpression . EMPTY_EXPRESSION ) break ; dimensions ++ ; element . visit ( this ) ; controller . getOperandStack ( ) . doGroovyCast ( ClassHelper . int_TYPE ) ; } controller . getOperandStack ( ) . remove ( dimensions ) ; } else { size = expression . getExpressions ( ) . size ( ) ; BytecodeHelper . pushConstant ( mv , size ) ; } int storeIns = AASTORE ; if ( sizeExpression != null ) { arrayTypeName = BytecodeHelper . getTypeDescription ( expression . getType ( ) ) ; mv . visitMultiANewArrayInsn ( arrayTypeName , dimensions ) ; } else if ( ClassHelper . isPrimitiveType ( elementType ) ) { int primType = <NUM_LIT:0> ; if ( elementType == ClassHelper . boolean_TYPE ) { primType = T_BOOLEAN ; storeIns = BASTORE ; } else if ( elementType == ClassHelper . char_TYPE ) { primType = T_CHAR ; storeIns = CASTORE ; } else if ( elementType == ClassHelper . float_TYPE ) { primType = T_FLOAT ; storeIns = FASTORE ; } else if ( elementType == ClassHelper . double_TYPE ) { primType = T_DOUBLE ; storeIns = DASTORE ; } else if ( elementType == ClassHelper . byte_TYPE ) { primType = T_BYTE ; storeIns = BASTORE ; } else if ( elementType == ClassHelper . short_TYPE ) { primType = T_SHORT ; storeIns = SASTORE ; } else if ( elementType == ClassHelper . int_TYPE ) { primType = T_INT ; storeIns = IASTORE ; } else if ( elementType == ClassHelper . long_TYPE ) { primType = T_LONG ; storeIns = LASTORE ; } mv . visitIntInsn ( NEWARRAY , primType ) ; } else { mv . visitTypeInsn ( ANEWARRAY , arrayTypeName ) ; } for ( int i = <NUM_LIT:0> ; i < size ; i ++ ) { mv . visitInsn ( DUP ) ; BytecodeHelper . pushConstant ( mv , i ) ; Expression elementExpression = expression . getExpression ( i ) ; if ( elementExpression == null ) { ConstantExpression . NULL . visit ( this ) ; } else { if ( ! elementType . equals ( elementExpression . getType ( ) ) ) { visitCastExpression ( new CastExpression ( elementType , elementExpression , true ) ) ; } else { elementExpression . visit ( this ) ; } } mv . visitInsn ( storeIns ) ; controller . getOperandStack ( ) . remove ( <NUM_LIT:1> ) ; } controller . getOperandStack ( ) . push ( expression . getType ( ) ) ; } public void visitClosureListExpression ( ClosureListExpression expression ) { MethodVisitor mv = controller . getMethodVisitor ( ) ; controller . getCompileStack ( ) . pushVariableScope ( expression . getVariableScope ( ) ) ; List < Expression > expressions = expression . getExpressions ( ) ; final int size = expressions . size ( ) ; LinkedList < DeclarationExpression > declarations = new LinkedList < DeclarationExpression > ( ) ; for ( int i = <NUM_LIT:0> ; i < size ; i ++ ) { Expression expr = expressions . get ( i ) ; if ( expr instanceof DeclarationExpression ) { declarations . add ( ( DeclarationExpression ) expr ) ; DeclarationExpression de = ( DeclarationExpression ) expr ; BinaryExpression be = new BinaryExpression ( de . getLeftExpression ( ) , de . getOperation ( ) , de . getRightExpression ( ) ) ; expressions . set ( i , be ) ; de . setRightExpression ( ConstantExpression . NULL ) ; visitDeclarationExpression ( de ) ; } } LinkedList instructions = new LinkedList ( ) ; BytecodeSequence seq = new BytecodeSequence ( instructions ) ; BlockStatement bs = new BlockStatement ( ) ; bs . addStatement ( seq ) ; Parameter closureIndex = new Parameter ( ClassHelper . int_TYPE , "<STR_LIT>" ) ; ClosureExpression ce = new ClosureExpression ( new Parameter [ ] { closureIndex } , bs ) ; ce . setVariableScope ( expression . getVariableScope ( ) ) ; instructions . add ( ConstantExpression . NULL ) ; final Label dflt = new Label ( ) ; final Label tableEnd = new Label ( ) ; final Label [ ] labels = new Label [ size ] ; instructions . add ( new BytecodeInstruction ( ) { public void visit ( MethodVisitor mv ) { mv . visitVarInsn ( ILOAD , <NUM_LIT:1> ) ; mv . visitTableSwitchInsn ( <NUM_LIT:0> , size - <NUM_LIT:1> , dflt , labels ) ; } } ) ; for ( int i = <NUM_LIT:0> ; i < size ; i ++ ) { final Label label = new Label ( ) ; Object expr = expressions . get ( i ) ; final boolean isStatement = expr instanceof Statement ; labels [ i ] = label ; instructions . add ( new BytecodeInstruction ( ) { public void visit ( MethodVisitor mv ) { mv . visitLabel ( label ) ; if ( ! isStatement ) mv . visitInsn ( POP ) ; } } ) ; instructions . add ( expr ) ; instructions . add ( new BytecodeInstruction ( ) { public void visit ( MethodVisitor mv ) { mv . visitJumpInsn ( GOTO , tableEnd ) ; } } ) ; } { instructions . add ( new BytecodeInstruction ( ) { public void visit ( MethodVisitor mv ) { mv . visitLabel ( dflt ) ; } } ) ; ConstantExpression text = new ConstantExpression ( "<STR_LIT>" ) ; ConstructorCallExpression cce = new ConstructorCallExpression ( ClassHelper . make ( IllegalArgumentException . class ) , text ) ; ThrowStatement ts = new ThrowStatement ( cce ) ; instructions . add ( ts ) ; } instructions . add ( new BytecodeInstruction ( ) { public void visit ( MethodVisitor mv ) { mv . visitLabel ( tableEnd ) ; mv . visitInsn ( ARETURN ) ; } } ) ; visitClosureExpression ( ce ) ; BytecodeHelper . pushConstant ( mv , size ) ; mv . visitTypeInsn ( ANEWARRAY , "<STR_LIT>" ) ; int listArrayVar = controller . getCompileStack ( ) . defineTemporaryVariable ( "<STR_LIT>" , true ) ; for ( int i = <NUM_LIT:0> ; i < size ; i ++ ) { mv . visitTypeInsn ( NEW , "<STR_LIT>" ) ; mv . visitInsn ( DUP2 ) ; mv . visitInsn ( SWAP ) ; mv . visitInsn ( ICONST_1 ) ; mv . visitTypeInsn ( ANEWARRAY , "<STR_LIT>" ) ; mv . visitInsn ( DUP ) ; mv . visitInsn ( ICONST_0 ) ; mv . visitLdcInsn ( i ) ; mv . visitMethodInsn ( INVOKESTATIC , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitInsn ( AASTORE ) ; mv . visitMethodInsn ( INVOKESPECIAL , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitVarInsn ( ALOAD , listArrayVar ) ; mv . visitInsn ( SWAP ) ; BytecodeHelper . pushConstant ( mv , i ) ; mv . visitInsn ( SWAP ) ; mv . visitInsn ( AASTORE ) ; } mv . visitInsn ( POP ) ; mv . visitVarInsn ( ALOAD , listArrayVar ) ; createListMethod . call ( mv ) ; controller . getCompileStack ( ) . removeVar ( listArrayVar ) ; controller . getOperandStack ( ) . pop ( ) ; } public void visitBytecodeSequence ( BytecodeSequence bytecodeSequence ) { MethodVisitor mv = controller . getMethodVisitor ( ) ; List instructions = bytecodeSequence . getInstructions ( ) ; int mark = controller . getOperandStack ( ) . getStackLength ( ) ; for ( Iterator iterator = instructions . iterator ( ) ; iterator . hasNext ( ) ; ) { Object part = iterator . next ( ) ; if ( part == EmptyExpression . INSTANCE ) { mv . visitInsn ( ACONST_NULL ) ; } else if ( part instanceof Expression ) { ( ( Expression ) part ) . visit ( this ) ; } else if ( part instanceof Statement ) { Statement stm = ( Statement ) part ; stm . visit ( this ) ; mv . visitInsn ( ACONST_NULL ) ; } else { BytecodeInstruction runner = ( BytecodeInstruction ) part ; runner . visit ( mv ) ; } } controller . getOperandStack ( ) . remove ( mark - controller . getOperandStack ( ) . getStackLength ( ) ) ; } public void visitListExpression ( ListExpression expression ) { onLineNumber ( expression , "<STR_LIT>" ) ; int size = expression . getExpressions ( ) . size ( ) ; boolean containsSpreadExpression = containsSpreadExpression ( expression ) ; boolean containsOnlyConstants = ! containsSpreadExpression && containsOnlyConstants ( expression ) ; OperandStack operandStack = controller . getOperandStack ( ) ; if ( ! containsSpreadExpression ) { MethodVisitor mv = controller . getMethodVisitor ( ) ; BytecodeHelper . pushConstant ( mv , size ) ; mv . visitTypeInsn ( ANEWARRAY , "<STR_LIT>" ) ; int maxInit = <NUM_LIT:1000> ; if ( size < maxInit || ! containsOnlyConstants ) { for ( int i = <NUM_LIT:0> ; i < size ; i ++ ) { mv . visitInsn ( DUP ) ; BytecodeHelper . pushConstant ( mv , i ) ; expression . getExpression ( i ) . visit ( this ) ; operandStack . box ( ) ; mv . visitInsn ( AASTORE ) ; } controller . getOperandStack ( ) . remove ( size ) ; } else { List < Expression > expressions = expression . getExpressions ( ) ; List < String > methods = new ArrayList ( ) ; MethodVisitor oldMv = mv ; int index = <NUM_LIT:0> ; int methodIndex = <NUM_LIT:0> ; while ( index < size ) { methodIndex ++ ; String methodName = "<STR_LIT>" + methodIndex ; methods . add ( methodName ) ; mv = controller . getClassVisitor ( ) . visitMethod ( ACC_PRIVATE + ACC_STATIC + ACC_SYNTHETIC , methodName , "<STR_LIT>" , null , null ) ; controller . setMethodVisitor ( mv ) ; mv . visitCode ( ) ; int methodBlockSize = Math . min ( size - index , maxInit ) ; int methodBlockEnd = index + methodBlockSize ; for ( ; index < methodBlockEnd ; index ++ ) { mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; mv . visitLdcInsn ( index ) ; expressions . get ( index ) . visit ( this ) ; operandStack . box ( ) ; mv . visitInsn ( AASTORE ) ; } operandStack . remove ( methodBlockSize ) ; mv . visitInsn ( RETURN ) ; mv . visitMaxs ( <NUM_LIT:0> , <NUM_LIT:0> ) ; mv . visitEnd ( ) ; } mv = oldMv ; controller . setMethodVisitor ( mv ) ; for ( String methodName : methods ) { mv . visitInsn ( DUP ) ; mv . visitMethodInsn ( INVOKESTATIC , controller . getInternalClassName ( ) , methodName , "<STR_LIT>" ) ; } } } else { despreadList ( expression . getExpressions ( ) , false ) ; } createListMethod . call ( controller . getMethodVisitor ( ) ) ; operandStack . push ( ClassHelper . LIST_TYPE ) ; } private boolean containsOnlyConstants ( ListExpression list ) { for ( Expression exp : list . getExpressions ( ) ) { if ( exp instanceof ConstantExpression ) continue ; return false ; } return true ; } public void visitGStringExpression ( GStringExpression expression ) { MethodVisitor mv = controller . getMethodVisitor ( ) ; mv . visitTypeInsn ( NEW , "<STR_LIT>" ) ; mv . visitInsn ( DUP ) ; int size = expression . getValues ( ) . size ( ) ; BytecodeHelper . pushConstant ( mv , size ) ; mv . visitTypeInsn ( ANEWARRAY , "<STR_LIT>" ) ; for ( int i = <NUM_LIT:0> ; i < size ; i ++ ) { mv . visitInsn ( DUP ) ; BytecodeHelper . pushConstant ( mv , i ) ; expression . getValue ( i ) . visit ( this ) ; controller . getOperandStack ( ) . box ( ) ; mv . visitInsn ( AASTORE ) ; } controller . getOperandStack ( ) . remove ( size ) ; List strings = expression . getStrings ( ) ; size = strings . size ( ) ; BytecodeHelper . pushConstant ( mv , size ) ; mv . visitTypeInsn ( ANEWARRAY , "<STR_LIT>" ) ; for ( int i = <NUM_LIT:0> ; i < size ; i ++ ) { mv . visitInsn ( DUP ) ; BytecodeHelper . pushConstant ( mv , i ) ; controller . getOperandStack ( ) . pushConstant ( ( ConstantExpression ) strings . get ( i ) ) ; controller . getOperandStack ( ) . box ( ) ; mv . visitInsn ( AASTORE ) ; } controller . getOperandStack ( ) . remove ( size ) ; mv . visitMethodInsn ( INVOKESPECIAL , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; controller . getOperandStack ( ) . push ( ClassHelper . GSTRING_TYPE ) ; } public void visitAnnotations ( AnnotatedNode node ) { } private void visitAnnotations ( AnnotatedNode targetNode , Object visitor ) { for ( AnnotationNode an : targetNode . getAnnotations ( ) ) { if ( an . isBuiltIn ( ) ) continue ; if ( an . hasSourceRetention ( ) ) continue ; AnnotationVisitor av = getAnnotationVisitor ( targetNode , an , visitor ) ; visitAnnotationAttributes ( an , av ) ; av . visitEnd ( ) ; } } private void visitParameterAnnotations ( Parameter parameter , int paramNumber , MethodVisitor mv ) { for ( AnnotationNode an : parameter . getAnnotations ( ) ) { if ( an . isBuiltIn ( ) ) continue ; if ( an . hasSourceRetention ( ) ) continue ; final String annotationDescriptor = BytecodeHelper . getTypeDescription ( an . getClassNode ( ) ) ; AnnotationVisitor av = mv . visitParameterAnnotation ( paramNumber , annotationDescriptor , an . hasRuntimeRetention ( ) ) ; visitAnnotationAttributes ( an , av ) ; av . visitEnd ( ) ; } } private AnnotationVisitor getAnnotationVisitor ( AnnotatedNode targetNode , AnnotationNode an , Object visitor ) { final String annotationDescriptor = BytecodeHelper . getTypeDescription ( an . getClassNode ( ) ) ; if ( targetNode instanceof MethodNode ) { return ( ( MethodVisitor ) visitor ) . visitAnnotation ( annotationDescriptor , an . hasRuntimeRetention ( ) ) ; } else if ( targetNode instanceof FieldNode ) { return ( ( FieldVisitor ) visitor ) . visitAnnotation ( annotationDescriptor , an . hasRuntimeRetention ( ) ) ; } else if ( targetNode instanceof ClassNode ) { return ( ( ClassVisitor ) visitor ) . visitAnnotation ( annotationDescriptor , an . hasRuntimeRetention ( ) ) ; } throwException ( "<STR_LIT>" ) ; return null ; } private void visitAnnotationAttributes ( AnnotationNode an , AnnotationVisitor av ) { Map < String , Object > constantAttrs = new HashMap < String , Object > ( ) ; Map < String , PropertyExpression > enumAttrs = new HashMap < String , PropertyExpression > ( ) ; Map < String , Object > atAttrs = new HashMap < String , Object > ( ) ; Map < String , ListExpression > arrayAttrs = new HashMap < String , ListExpression > ( ) ; for ( String name : an . getMembers ( ) . keySet ( ) ) { Expression expr = an . getMember ( name ) ; if ( expr instanceof AnnotationConstantExpression ) { atAttrs . put ( name , ( ( AnnotationConstantExpression ) expr ) . getValue ( ) ) ; } else if ( expr instanceof ConstantExpression ) { constantAttrs . put ( name , ( ( ConstantExpression ) expr ) . getValue ( ) ) ; } else if ( expr instanceof ClassExpression ) { constantAttrs . put ( name , Type . getType ( BytecodeHelper . getTypeDescription ( ( expr . getType ( ) ) ) ) ) ; } else if ( expr instanceof PropertyExpression ) { enumAttrs . put ( name , ( PropertyExpression ) expr ) ; } else if ( expr instanceof ListExpression ) { arrayAttrs . put ( name , ( ListExpression ) expr ) ; } else if ( expr instanceof ClosureExpression ) { ClassNode closureClass = controller . getClosureWriter ( ) . getOrAddClosureClass ( ( ClosureExpression ) expr , ACC_PUBLIC ) ; constantAttrs . put ( name , Type . getType ( BytecodeHelper . getTypeDescription ( closureClass ) ) ) ; } } for ( Map . Entry entry : constantAttrs . entrySet ( ) ) { av . visit ( ( String ) entry . getKey ( ) , entry . getValue ( ) ) ; } for ( Map . Entry entry : enumAttrs . entrySet ( ) ) { PropertyExpression propExp = ( PropertyExpression ) entry . getValue ( ) ; av . visitEnum ( ( String ) entry . getKey ( ) , BytecodeHelper . getTypeDescription ( propExp . getObjectExpression ( ) . getType ( ) ) , String . valueOf ( ( ( ConstantExpression ) propExp . getProperty ( ) ) . getValue ( ) ) ) ; } for ( Map . Entry entry : atAttrs . entrySet ( ) ) { AnnotationNode atNode = ( AnnotationNode ) entry . getValue ( ) ; AnnotationVisitor av2 = av . visitAnnotation ( ( String ) entry . getKey ( ) , BytecodeHelper . getTypeDescription ( atNode . getClassNode ( ) ) ) ; visitAnnotationAttributes ( atNode , av2 ) ; av2 . visitEnd ( ) ; } visitArrayAttributes ( an , arrayAttrs , av ) ; } private void visitArrayAttributes ( AnnotationNode an , Map < String , ListExpression > arrayAttr , AnnotationVisitor av ) { if ( arrayAttr . isEmpty ( ) ) return ; for ( Map . Entry entry : arrayAttr . entrySet ( ) ) { AnnotationVisitor av2 = av . visitArray ( ( String ) entry . getKey ( ) ) ; List < Expression > values = ( ( ListExpression ) entry . getValue ( ) ) . getExpressions ( ) ; if ( ! values . isEmpty ( ) ) { int arrayElementType = determineCommonArrayType ( values ) ; for ( Expression exprChild : values ) { visitAnnotationArrayElement ( exprChild , arrayElementType , av2 ) ; } } av2 . visitEnd ( ) ; } } private int determineCommonArrayType ( List values ) { Expression expr = ( Expression ) values . get ( <NUM_LIT:0> ) ; int arrayElementType = - <NUM_LIT:1> ; if ( expr instanceof AnnotationConstantExpression ) { arrayElementType = <NUM_LIT:1> ; } else if ( expr instanceof ConstantExpression ) { arrayElementType = <NUM_LIT:2> ; } else if ( expr instanceof ClassExpression ) { arrayElementType = <NUM_LIT:3> ; } else if ( expr instanceof PropertyExpression ) { arrayElementType = <NUM_LIT:4> ; } return arrayElementType ; } private void visitAnnotationArrayElement ( Expression expr , int arrayElementType , AnnotationVisitor av ) { switch ( arrayElementType ) { case <NUM_LIT:1> : AnnotationNode atAttr = ( AnnotationNode ) ( ( AnnotationConstantExpression ) expr ) . getValue ( ) ; AnnotationVisitor av2 = av . visitAnnotation ( null , BytecodeHelper . getTypeDescription ( atAttr . getClassNode ( ) ) ) ; visitAnnotationAttributes ( atAttr , av2 ) ; av2 . visitEnd ( ) ; break ; case <NUM_LIT:2> : av . visit ( null , ( ( ConstantExpression ) expr ) . getValue ( ) ) ; break ; case <NUM_LIT:3> : av . visit ( null , Type . getType ( BytecodeHelper . getTypeDescription ( expr . getType ( ) ) ) ) ; break ; case <NUM_LIT:4> : PropertyExpression propExpr = ( PropertyExpression ) expr ; av . visitEnum ( null , BytecodeHelper . getTypeDescription ( propExpr . getObjectExpression ( ) . getType ( ) ) , String . valueOf ( ( ( ConstantExpression ) propExpr . getProperty ( ) ) . getValue ( ) ) ) ; break ; } } public void visitBytecodeExpression ( BytecodeExpression cle ) { cle . visit ( controller . getMethodVisitor ( ) ) ; controller . getOperandStack ( ) . push ( cle . getType ( ) ) ; } public static boolean isThisExpression ( Expression expression ) { if ( expression instanceof VariableExpression ) { VariableExpression varExp = ( VariableExpression ) expression ; return varExp . getName ( ) . equals ( "<STR_LIT>" ) ; } return false ; } private static boolean isSuperExpression ( Expression expression ) { if ( expression instanceof VariableExpression ) { VariableExpression varExp = ( VariableExpression ) expression ; return varExp . getName ( ) . equals ( "<STR_LIT>" ) ; } return false ; } private static boolean isThisOrSuper ( Expression expression ) { return isThisExpression ( expression ) || isSuperExpression ( expression ) ; } public void onLineNumber ( ASTNode statement , String message ) { MethodVisitor mv = controller . getMethodVisitor ( ) ; if ( statement == null ) return ; int line = statement . getLineNumber ( ) ; this . currentASTNode = statement ; if ( line < <NUM_LIT:0> ) return ; if ( ! ASM_DEBUG && line == controller . getLineNumber ( ) ) return ; controller . setLineNumber ( line ) ; if ( mv != null ) { Label l = new Label ( ) ; mv . visitLabel ( l ) ; mv . visitLineNumber ( line , l ) ; } } private boolean isInnerClass ( ) { return controller . getClassNode ( ) instanceof InnerClassNode ; } protected CompileUnit getCompileUnit ( ) { CompileUnit answer = controller . getClassNode ( ) . getCompileUnit ( ) ; if ( answer == null ) { answer = context . getCompileUnit ( ) ; } return answer ; } public boolean addInnerClass ( ClassNode innerClass ) { ModuleNode mn = controller . getClassNode ( ) . getModule ( ) ; innerClass . setModule ( mn ) ; mn . getUnit ( ) . addGeneratedInnerClass ( ( InnerClassNode ) innerClass ) ; return innerClasses . add ( innerClass ) ; } } </s>
|
<s> package org . codehaus . groovy . classgen ; import java . lang . annotation . Target ; import org . codehaus . groovy . ast . * ; import org . codehaus . groovy . ast . stmt . ReturnStatement ; import org . codehaus . groovy . control . CompilerConfiguration ; import org . codehaus . groovy . control . ErrorCollector ; import org . codehaus . groovy . control . SourceUnit ; import org . codehaus . groovy . control . messages . SyntaxErrorMessage ; import org . codehaus . groovy . syntax . PreciseSyntaxException ; import org . codehaus . groovy . syntax . SyntaxException ; import org . objectweb . asm . Opcodes ; public class ExtendedVerifier implements GroovyClassVisitor { public static final String JVM_ERROR_MESSAGE = "<STR_LIT>" ; private SourceUnit source ; private ClassNode currentClass ; public ExtendedVerifier ( SourceUnit sourceUnit ) { this . source = sourceUnit ; } public void visitClass ( ClassNode node ) { this . currentClass = node ; if ( node . isAnnotationDefinition ( ) ) { visitAnnotations ( node , AnnotationNode . ANNOTATION_TARGET ) ; } else { visitAnnotations ( node , AnnotationNode . TYPE_TARGET ) ; } PackageNode packageNode = node . getPackage ( ) ; if ( packageNode != null ) { visitAnnotations ( packageNode , AnnotationNode . PACKAGE_TARGET ) ; } node . visitContents ( this ) ; } public void visitField ( FieldNode node ) { visitAnnotations ( node , AnnotationNode . FIELD_TARGET ) ; } public void visitConstructor ( ConstructorNode node ) { visitConstructorOrMethod ( node , AnnotationNode . CONSTRUCTOR_TARGET ) ; } public void visitMethod ( MethodNode node ) { visitConstructorOrMethod ( node , AnnotationNode . METHOD_TARGET ) ; } private void visitConstructorOrMethod ( MethodNode node , int methodTarget ) { visitAnnotations ( node , methodTarget ) ; for ( int i = <NUM_LIT:0> ; i < node . getParameters ( ) . length ; i ++ ) { Parameter parameter = node . getParameters ( ) [ i ] ; visitAnnotations ( parameter , AnnotationNode . PARAMETER_TARGET ) ; } if ( this . currentClass . isAnnotationDefinition ( ) && ! node . isStaticConstructor ( ) ) { ErrorCollector errorCollector = new ErrorCollector ( this . source . getConfiguration ( ) ) ; AnnotationVisitor visitor = new AnnotationVisitor ( this . source , errorCollector ) ; visitor . setReportClass ( currentClass ) ; visitor . checkReturnType ( node . getReturnType ( ) , node ) ; if ( node . getParameters ( ) . length > <NUM_LIT:0> ) { addError ( "<STR_LIT>" , node . getParameters ( ) [ <NUM_LIT:0> ] ) ; } if ( node . getExceptions ( ) . length > <NUM_LIT:0> ) { addError ( "<STR_LIT>" , node . getExceptions ( ) [ <NUM_LIT:0> ] ) ; } ReturnStatement code = ( ReturnStatement ) node . getCode ( ) ; if ( code != null ) { visitor . visitExpression ( node . getName ( ) , code . getExpression ( ) , node . getReturnType ( ) ) ; visitor . checkCircularReference ( currentClass , node . getReturnType ( ) , code . getExpression ( ) ) ; } this . source . getErrorCollector ( ) . addCollectorContents ( errorCollector ) ; } } public void visitProperty ( PropertyNode node ) { } protected void visitAnnotations ( AnnotatedNode node , int target ) { if ( node . getAnnotations ( ) . isEmpty ( ) ) { return ; } this . currentClass . setAnnotated ( true ) ; if ( ! isAnnotationCompatible ( ) ) { addError ( "<STR_LIT>" + JVM_ERROR_MESSAGE , node ) ; return ; } for ( AnnotationNode unvisited : node . getAnnotations ( ) ) { AnnotationNode visited = visitAnnotation ( unvisited ) ; boolean isTargetAnnotation = visited . getClassNode ( ) . isResolved ( ) && visited . getClassNode ( ) . getName ( ) . equals ( "<STR_LIT>" ) ; if ( ! isTargetAnnotation && ! visited . isTargetAllowed ( target ) ) { addError ( "<STR_LIT>" + visited . getClassNode ( ) . getName ( ) + "<STR_LIT>" + AnnotationNode . targetToName ( target ) , visited ) ; } visitDeprecation ( node , visited ) ; } } private void visitDeprecation ( AnnotatedNode node , AnnotationNode visited ) { if ( visited . getClassNode ( ) . isResolved ( ) && visited . getClassNode ( ) . getName ( ) . equals ( "<STR_LIT>" ) ) { if ( node instanceof MethodNode ) { MethodNode mn = ( MethodNode ) node ; mn . setModifiers ( mn . getModifiers ( ) | Opcodes . ACC_DEPRECATED ) ; } else if ( node instanceof FieldNode ) { FieldNode fn = ( FieldNode ) node ; fn . setModifiers ( fn . getModifiers ( ) | Opcodes . ACC_DEPRECATED ) ; } else if ( node instanceof ClassNode ) { ClassNode cn = ( ClassNode ) node ; cn . setModifiers ( cn . getModifiers ( ) | Opcodes . ACC_DEPRECATED ) ; } } } private AnnotationNode visitAnnotation ( AnnotationNode unvisited ) { ErrorCollector errorCollector = new ErrorCollector ( this . source . getConfiguration ( ) ) ; AnnotationVisitor visitor = new AnnotationVisitor ( this . source , errorCollector ) ; AnnotationNode visited = visitor . visit ( unvisited ) ; this . source . getErrorCollector ( ) . addCollectorContents ( errorCollector ) ; return visited ; } protected boolean isAnnotationCompatible ( ) { return CompilerConfiguration . POST_JDK5 . equals ( this . source . getConfiguration ( ) . getTargetBytecode ( ) ) ; } protected void addError ( String msg , ASTNode expr ) { if ( expr instanceof AnnotationNode ) { AnnotationNode aNode = ( AnnotationNode ) expr ; this . source . getErrorCollector ( ) . addErrorAndContinue ( new SyntaxErrorMessage ( new PreciseSyntaxException ( msg + '<STR_LIT:\n>' , expr . getLineNumber ( ) , expr . getColumnNumber ( ) , aNode . getStart ( ) , aNode . getEnd ( ) ) , this . source ) ) ; } else { this . source . getErrorCollector ( ) . addErrorAndContinue ( new SyntaxErrorMessage ( new SyntaxException ( msg + '<STR_LIT:\n>' , expr . getLineNumber ( ) , expr . getColumnNumber ( ) , expr . getLastLineNumber ( ) , expr . getLastColumnNumber ( ) ) , this . source ) ) ; } } public void visitGenericType ( GenericsType genericsType ) { } } </s>
|
<s> package org . codehaus . groovy . classgen ; import org . codehaus . groovy . GroovyBugError ; import org . codehaus . groovy . ast . * ; import org . codehaus . groovy . ast . expr . * ; import org . codehaus . groovy . ast . stmt . BlockStatement ; import org . codehaus . groovy . ast . stmt . CatchStatement ; import org . codehaus . groovy . ast . stmt . ForStatement ; import org . codehaus . groovy . ast . stmt . IfStatement ; import org . codehaus . groovy . ast . stmt . Statement ; import org . codehaus . groovy . control . SourceUnit ; import org . codehaus . groovy . syntax . Types ; import java . util . Iterator ; import java . util . LinkedList ; import java . util . List ; import java . util . Map ; import static java . lang . reflect . Modifier . isFinal ; public class VariableScopeVisitor extends ClassCodeVisitorSupport { private VariableScope currentScope = null ; private VariableScope headScope = new VariableScope ( ) ; private ClassNode currentClass = null ; private SourceUnit source ; private boolean inPropertyExpression = false ; private boolean isSpecialConstructorCall = false ; private boolean inConstructor = false ; private LinkedList stateStack = new LinkedList ( ) ; private class StateStackElement { VariableScope scope ; ClassNode clazz ; boolean inConstructor ; StateStackElement ( ) { scope = VariableScopeVisitor . this . currentScope ; clazz = VariableScopeVisitor . this . currentClass ; inConstructor = VariableScopeVisitor . this . inConstructor ; } } public VariableScopeVisitor ( SourceUnit source ) { this . source = source ; currentScope = headScope ; } private void pushState ( boolean isStatic ) { stateStack . add ( new StateStackElement ( ) ) ; currentScope = new VariableScope ( currentScope ) ; currentScope . setInStaticContext ( isStatic ) ; } private void pushState ( ) { pushState ( currentScope . isInStaticContext ( ) ) ; } private void popState ( ) { StateStackElement element = ( StateStackElement ) stateStack . removeLast ( ) ; currentScope = element . scope ; currentClass = element . clazz ; inConstructor = element . inConstructor ; } private void declare ( Parameter [ ] parameters , ASTNode node ) { for ( Parameter parameter : parameters ) { if ( parameter . hasInitialExpression ( ) ) { parameter . getInitialExpression ( ) . visit ( this ) ; } declare ( parameter , node ) ; } } private void declare ( VariableExpression vex ) { vex . setInStaticContext ( currentScope . isInStaticContext ( ) ) ; declare ( vex , vex ) ; vex . setAccessedVariable ( vex ) ; } private void declare ( Variable var , ASTNode expr ) { String scopeType = "<STR_LIT>" ; String variableType = "<STR_LIT>" ; if ( expr . getClass ( ) == FieldNode . class ) { scopeType = "<STR_LIT:class>" ; variableType = "<STR_LIT:field>" ; } else if ( expr . getClass ( ) == PropertyNode . class ) { scopeType = "<STR_LIT:class>" ; variableType = "<STR_LIT>" ; } StringBuilder msg = new StringBuilder ( ) ; msg . append ( "<STR_LIT>" ) . append ( scopeType ) ; msg . append ( "<STR_LIT>" ) . append ( variableType ) ; msg . append ( "<STR_LIT>" ) . append ( var . getName ( ) ) ; if ( currentScope . getDeclaredVariable ( var . getName ( ) ) != null ) { addError ( msg . toString ( ) , expr ) ; return ; } for ( VariableScope scope = currentScope . getParent ( ) ; scope != null ; scope = scope . getParent ( ) ) { if ( scope . getClassScope ( ) != null ) break ; if ( scope . getDeclaredVariable ( var . getName ( ) ) != null ) { addError ( msg . toString ( ) , expr ) ; break ; } } currentScope . putDeclaredVariable ( var ) ; } protected SourceUnit getSourceUnit ( ) { return source ; } private Variable findClassMember ( ClassNode cn , String name ) { if ( cn == null ) return null ; if ( cn . isScript ( ) ) { return new DynamicVariable ( name , false ) ; } for ( FieldNode fn : cn . getFields ( ) ) { if ( fn . getName ( ) . equals ( name ) ) return fn ; } for ( MethodNode mn : cn . getMethods ( ) ) { String pName = getPropertyName ( mn ) ; if ( pName != null && pName . equals ( name ) ) { PropertyNode property = new PropertyNode ( pName , mn . getModifiers ( ) , getPropertyType ( mn ) , cn , null , null , null ) ; property . setDeclaringClass ( cn ) ; property . getField ( ) . setDeclaringClass ( cn ) ; return property ; } } for ( PropertyNode pn : cn . getProperties ( ) ) { if ( pn . getName ( ) . equals ( name ) ) return pn ; } Variable ret = findClassMember ( cn . getSuperClass ( ) , name ) ; if ( ret != null ) return ret ; return findClassMember ( cn . getOuterClass ( ) , name ) ; } private ClassNode getPropertyType ( MethodNode m ) { if ( m . getReturnType ( ) != ClassHelper . VOID_TYPE ) { return m . getReturnType ( ) ; } return m . getParameters ( ) [ <NUM_LIT:0> ] . getType ( ) ; } private String getPropertyName ( MethodNode m ) { String name = m . getName ( ) ; if ( ! ( name . startsWith ( "<STR_LIT>" ) || name . startsWith ( "<STR_LIT:get>" ) ) ) return null ; String pname = name . substring ( <NUM_LIT:3> ) ; if ( pname . length ( ) == <NUM_LIT:0> ) return null ; pname = java . beans . Introspector . decapitalize ( pname ) ; if ( name . startsWith ( "<STR_LIT:get>" ) && ( m . getReturnType ( ) == ClassHelper . VOID_TYPE || m . getParameters ( ) . length != <NUM_LIT:0> ) ) { return null ; } if ( name . startsWith ( "<STR_LIT>" ) && m . getParameters ( ) . length != <NUM_LIT:1> ) { return null ; } return pname ; } private Variable checkVariableNameForDeclaration ( String name , Expression expression ) { if ( "<STR_LIT>" . equals ( name ) || "<STR_LIT>" . equals ( name ) ) return null ; VariableScope scope = currentScope ; Variable var = new DynamicVariable ( name , currentScope . isInStaticContext ( ) ) ; while ( true ) { Variable var1 ; var1 = scope . getDeclaredVariable ( var . getName ( ) ) ; if ( var1 != null ) { var = var1 ; break ; } var1 = scope . getReferencedLocalVariable ( var . getName ( ) ) ; if ( var1 != null ) { var = var1 ; break ; } var1 = scope . getReferencedClassVariable ( var . getName ( ) ) ; if ( var1 != null ) { var = var1 ; break ; } ClassNode classScope = scope . getClassScope ( ) ; if ( classScope != null ) { Variable member = findClassMember ( classScope , var . getName ( ) ) ; if ( member != null ) { boolean staticScope = currentScope . isInStaticContext ( ) || isSpecialConstructorCall ; boolean staticMember = member . isInStaticContext ( ) ; if ( ! ( staticScope && ! staticMember ) ) var = member ; } break ; } scope = scope . getParent ( ) ; } VariableScope end = scope ; scope = currentScope ; while ( scope != end ) { if ( end . isClassScope ( ) || ( end . isReferencedClassVariable ( name ) && end . getDeclaredVariable ( name ) == null ) ) { scope . putReferencedClassVariable ( var ) ; } else { scope . putReferencedLocalVariable ( var ) ; } scope = scope . getParent ( ) ; } return var ; } private void checkPropertyOnExplicitThis ( PropertyExpression pe ) { if ( ! currentScope . isInStaticContext ( ) ) return ; Expression object = pe . getObjectExpression ( ) ; if ( ! ( object instanceof VariableExpression ) ) return ; VariableExpression ve = ( VariableExpression ) object ; if ( ! ve . getName ( ) . equals ( "<STR_LIT>" ) ) return ; String name = pe . getPropertyAsString ( ) ; if ( name == null || name . equals ( "<STR_LIT:class>" ) ) return ; Variable member = findClassMember ( currentClass , name ) ; if ( member == null ) return ; checkVariableContextAccess ( member , pe ) ; } private void checkVariableContextAccess ( Variable v , Expression expr ) { if ( inPropertyExpression || v . isInStaticContext ( ) || ! currentScope . isInStaticContext ( ) ) return ; String msg = v . getName ( ) + "<STR_LIT>" + "<STR_LIT>" ; addError ( msg , expr ) ; DynamicVariable v2 = new DynamicVariable ( v . getName ( ) , currentScope . isInStaticContext ( ) ) ; currentScope . putDeclaredVariable ( v2 ) ; } public void visitBlockStatement ( BlockStatement block ) { pushState ( ) ; block . setVariableScope ( currentScope ) ; super . visitBlockStatement ( block ) ; popState ( ) ; } public void visitForLoop ( ForStatement forLoop ) { pushState ( ) ; forLoop . setVariableScope ( currentScope ) ; Parameter p = forLoop . getVariable ( ) ; p . setInStaticContext ( currentScope . isInStaticContext ( ) ) ; if ( p != ForStatement . FOR_LOOP_DUMMY ) declare ( p , forLoop ) ; super . visitForLoop ( forLoop ) ; popState ( ) ; } public void visitIfElse ( IfStatement ifElse ) { ifElse . getBooleanExpression ( ) . visit ( this ) ; pushState ( ) ; ifElse . getIfBlock ( ) . visit ( this ) ; popState ( ) ; pushState ( ) ; ifElse . getElseBlock ( ) . visit ( this ) ; popState ( ) ; } public void visitDeclarationExpression ( DeclarationExpression expression ) { expression . getRightExpression ( ) . visit ( this ) ; if ( expression . isMultipleAssignmentDeclaration ( ) ) { TupleExpression list = expression . getTupleExpression ( ) ; for ( Expression e : list . getExpressions ( ) ) { declare ( ( VariableExpression ) e ) ; } } else { declare ( expression . getVariableExpression ( ) ) ; } } @ Override public void visitBinaryExpression ( BinaryExpression be ) { super . visitBinaryExpression ( be ) ; switch ( be . getOperation ( ) . getType ( ) ) { case Types . EQUAL : case Types . BITWISE_AND_EQUAL : case Types . BITWISE_OR_EQUAL : case Types . BITWISE_XOR_EQUAL : case Types . PLUS_EQUAL : case Types . MINUS_EQUAL : case Types . MULTIPLY_EQUAL : case Types . DIVIDE_EQUAL : case Types . INTDIV_EQUAL : case Types . MOD_EQUAL : case Types . POWER_EQUAL : case Types . LEFT_SHIFT_EQUAL : case Types . RIGHT_SHIFT_EQUAL : case Types . RIGHT_SHIFT_UNSIGNED_EQUAL : checkFinalFieldAccess ( be . getLeftExpression ( ) ) ; break ; default : break ; } } private void checkFinalFieldAccess ( Expression expression ) { if ( ! ( expression instanceof VariableExpression ) && ! ( expression instanceof TupleExpression ) ) return ; if ( expression instanceof TupleExpression ) { TupleExpression list = ( TupleExpression ) expression ; for ( Expression e : list . getExpressions ( ) ) { checkForFinal ( expression , ( VariableExpression ) e ) ; } } else { checkForFinal ( expression , ( VariableExpression ) expression ) ; } } private void checkForFinal ( final Expression expression , VariableExpression ve ) { Variable v = ve . getAccessedVariable ( ) ; boolean isFinal = isFinal ( v . getModifiers ( ) ) ; boolean isParameter = v instanceof Parameter ; if ( isFinal && isParameter ) { addError ( "<STR_LIT>" + v . getName ( ) + "<STR_LIT:'>" , expression ) ; } } public void visitVariableExpression ( VariableExpression expression ) { String name = expression . getName ( ) ; Variable v = checkVariableNameForDeclaration ( name , expression ) ; if ( v == null ) return ; expression . setAccessedVariable ( v ) ; checkVariableContextAccess ( v , expression ) ; } public void visitPropertyExpression ( PropertyExpression expression ) { boolean ipe = inPropertyExpression ; inPropertyExpression = true ; expression . getObjectExpression ( ) . visit ( this ) ; inPropertyExpression = false ; expression . getProperty ( ) . visit ( this ) ; checkPropertyOnExplicitThis ( expression ) ; inPropertyExpression = ipe ; } public void visitClosureExpression ( ClosureExpression expression ) { pushState ( ) ; expression . setVariableScope ( currentScope ) ; if ( expression . isParameterSpecified ( ) ) { Parameter [ ] parameters = expression . getParameters ( ) ; for ( Parameter parameter : parameters ) { parameter . setInStaticContext ( currentScope . isInStaticContext ( ) ) ; if ( parameter . hasInitialExpression ( ) ) { parameter . getInitialExpression ( ) . visit ( this ) ; } declare ( parameter , expression ) ; } } else if ( expression . getParameters ( ) != null ) { Parameter var = new Parameter ( ClassHelper . OBJECT_TYPE , "<STR_LIT>" ) ; var . setInStaticContext ( currentScope . isInStaticContext ( ) ) ; currentScope . putDeclaredVariable ( var ) ; } super . visitClosureExpression ( expression ) ; markClosureSharedVariables ( ) ; popState ( ) ; } private void markClosureSharedVariables ( ) { VariableScope scope = currentScope ; for ( Iterator < Variable > it = scope . getReferencedLocalVariablesIterator ( ) ; it . hasNext ( ) ; ) { it . next ( ) . setClosureSharedVariable ( true ) ; } } public void visitCatchStatement ( CatchStatement statement ) { pushState ( ) ; Parameter p = statement . getVariable ( ) ; p . setInStaticContext ( currentScope . isInStaticContext ( ) ) ; declare ( p , statement ) ; super . visitCatchStatement ( statement ) ; popState ( ) ; } public void visitFieldExpression ( FieldExpression expression ) { String name = expression . getFieldName ( ) ; Variable v = checkVariableNameForDeclaration ( name , expression ) ; checkVariableContextAccess ( v , expression ) ; } public void visitClass ( ClassNode node ) { if ( node instanceof InnerClassNode ) { InnerClassNode in = ( InnerClassNode ) node ; if ( in . isAnonymous ( ) ) return ; } pushState ( ) ; prepareVisit ( node ) ; super . visitClass ( node ) ; popState ( ) ; } public void prepareVisit ( ClassNode node ) { currentClass = node ; currentScope . setClassScope ( node ) ; } protected void visitConstructorOrMethod ( MethodNode node , boolean isConstructor ) { pushState ( node . isStatic ( ) ) ; inConstructor = isConstructor ; node . setVariableScope ( currentScope ) ; visitAnnotations ( node ) ; Parameter [ ] parameters = node . getParameters ( ) ; for ( Parameter parameter : parameters ) { visitAnnotations ( parameter ) ; } declare ( node . getParameters ( ) , node ) ; visitClassCodeContainer ( node . getCode ( ) ) ; popState ( ) ; } public void visitMethodCallExpression ( MethodCallExpression call ) { if ( call . isImplicitThis ( ) && call . getMethod ( ) instanceof ConstantExpression ) { ConstantExpression methodNameConstant = ( ConstantExpression ) call . getMethod ( ) ; Object value = methodNameConstant . getText ( ) ; if ( ! ( value instanceof String ) ) { throw new GroovyBugError ( "<STR_LIT>" ) ; } String methodName = ( String ) value ; Variable v = checkVariableNameForDeclaration ( methodName , call ) ; if ( v != null && ! ( v instanceof DynamicVariable ) ) { checkVariableContextAccess ( v , call ) ; } if ( v instanceof VariableExpression || v instanceof Parameter ) { VariableExpression object = new VariableExpression ( v ) ; object . setSourcePosition ( methodNameConstant ) ; call . setObjectExpression ( object ) ; ConstantExpression method = new ConstantExpression ( "<STR_LIT>" ) ; method . setSourcePosition ( methodNameConstant ) ; call . setMethod ( method ) ; } } super . visitMethodCallExpression ( call ) ; } public void visitConstructorCallExpression ( ConstructorCallExpression call ) { isSpecialConstructorCall = call . isSpecialCall ( ) ; super . visitConstructorCallExpression ( call ) ; isSpecialConstructorCall = false ; if ( ! call . isUsingAnonymousInnerClass ( ) ) return ; pushState ( ) ; InnerClassNode innerClass = ( InnerClassNode ) call . getType ( ) ; innerClass . setVariableScope ( currentScope ) ; for ( MethodNode method : innerClass . getMethods ( ) ) { Parameter [ ] parameters = method . getParameters ( ) ; if ( parameters . length == <NUM_LIT:0> ) parameters = null ; ClosureExpression cl = new ClosureExpression ( parameters , method . getCode ( ) ) ; visitClosureExpression ( cl ) ; } for ( FieldNode field : innerClass . getFields ( ) ) { final Expression expression = field . getInitialExpression ( ) ; if ( expression != null ) { expression . visit ( this ) ; } } for ( Statement statement : innerClass . getObjectInitializerStatements ( ) ) { statement . visit ( this ) ; } markClosureSharedVariables ( ) ; popState ( ) ; } public void visitProperty ( PropertyNode node ) { pushState ( node . isStatic ( ) ) ; super . visitProperty ( node ) ; popState ( ) ; } public void visitField ( FieldNode node ) { pushState ( node . isStatic ( ) ) ; super . visitField ( node ) ; popState ( ) ; } public void visitAnnotations ( AnnotatedNode node ) { List < AnnotationNode > annotations = node . getAnnotations ( ) ; if ( annotations . isEmpty ( ) ) return ; for ( AnnotationNode an : annotations ) { if ( an . isBuiltIn ( ) ) continue ; for ( Map . Entry < String , Expression > member : an . getMembers ( ) . entrySet ( ) ) { Expression annMemberValue = member . getValue ( ) ; annMemberValue . visit ( this ) ; } } } } </s>
|
<s> package org . codehaus . groovy . classgen ; import java . util . List ; import org . codehaus . groovy . ast . * ; import org . codehaus . groovy . ast . expr . BinaryExpression ; import org . codehaus . groovy . ast . expr . ConstantExpression ; import org . codehaus . groovy . ast . expr . DeclarationExpression ; import org . codehaus . groovy . ast . expr . Expression ; import org . codehaus . groovy . ast . expr . GStringExpression ; import org . codehaus . groovy . ast . expr . MapEntryExpression ; import org . codehaus . groovy . ast . expr . MethodCallExpression ; import org . codehaus . groovy . ast . expr . PropertyExpression ; import org . codehaus . groovy . ast . expr . TupleExpression ; import org . codehaus . groovy . ast . expr . VariableExpression ; import org . codehaus . groovy . ast . stmt . CatchStatement ; import org . codehaus . groovy . control . SourceUnit ; import org . codehaus . groovy . runtime . MetaClassHelper ; import org . codehaus . groovy . syntax . Types ; import static java . lang . reflect . Modifier . * ; import static org . objectweb . asm . Opcodes . * ; public class ClassCompletionVerifier extends ClassCodeVisitorSupport { private ClassNode currentClass ; private SourceUnit source ; private boolean inConstructor = false ; private boolean inStaticConstructor = false ; public ClassCompletionVerifier ( SourceUnit source ) { this . source = source ; } public ClassNode getClassNode ( ) { return currentClass ; } public void visitClass ( ClassNode node ) { ClassNode oldClass = currentClass ; currentClass = node ; checkImplementsAndExtends ( node ) ; if ( source != null && ! source . getErrorCollector ( ) . hasErrors ( ) ) { checkClassForIncorrectModifiers ( node ) ; checkInterfaceMethodVisibility ( node ) ; checkClassForOverwritingFinal ( node ) ; checkMethodsForIncorrectModifiers ( node ) ; checkMethodsForWeakerAccess ( node ) ; checkMethodsForOverridingFinal ( node ) ; checkNoAbstractMethodsNonabstractClass ( node ) ; checkGenericsUsage ( node , node . getUnresolvedInterfaces ( ) ) ; checkGenericsUsage ( node , node . getUnresolvedSuperClass ( ) ) ; } super . visitClass ( node ) ; currentClass = oldClass ; } private void checkInterfaceMethodVisibility ( ClassNode node ) { if ( ! node . isInterface ( ) ) return ; for ( MethodNode method : node . getMethods ( ) ) { if ( method . isPrivate ( ) ) { addError ( "<STR_LIT>" + method . getName ( ) + "<STR_LIT>" + getDescription ( currentClass ) + "<STR_LIT:.>" , method ) ; } else if ( method . isProtected ( ) ) { addError ( "<STR_LIT>" + method . getName ( ) + "<STR_LIT>" + getDescription ( currentClass ) + "<STR_LIT:.>" , method ) ; } } } private void checkNoAbstractMethodsNonabstractClass ( ClassNode node ) { if ( isAbstract ( node . getModifiers ( ) ) ) return ; List < MethodNode > abstractMethods = node . getAbstractMethods ( ) ; if ( abstractMethods == null ) return ; for ( MethodNode method : abstractMethods ) { addTypeError ( "<STR_LIT>" + "<STR_LIT>" + getDescription ( node ) + "<STR_LIT>" + "<STR_LIT>" + getDescription ( method ) + "<STR_LIT>" , node ) ; } } private void checkClassForIncorrectModifiers ( ClassNode node ) { checkClassForAbstractAndFinal ( node ) ; checkClassForOtherModifiers ( node ) ; } private void checkClassForAbstractAndFinal ( ClassNode node ) { if ( ! isAbstract ( node . getModifiers ( ) ) ) return ; if ( ! isFinal ( node . getModifiers ( ) ) ) return ; if ( node . isInterface ( ) ) { addError ( "<STR_LIT>" + getDescription ( node ) + "<STR_LIT>" , node ) ; } else { addError ( "<STR_LIT>" + getDescription ( node ) + "<STR_LIT>" , node ) ; } } private void checkClassForOtherModifiers ( ClassNode node ) { checkClassForModifier ( node , isTransient ( node . getModifiers ( ) ) , "<STR_LIT>" ) ; checkClassForModifier ( node , isVolatile ( node . getModifiers ( ) ) , "<STR_LIT>" ) ; checkClassForModifier ( node , isNative ( node . getModifiers ( ) ) , "<STR_LIT>" ) ; if ( ! ( node instanceof InnerClassNode ) ) { checkClassForModifier ( node , isStatic ( node . getModifiers ( ) ) , "<STR_LIT>" ) ; checkClassForModifier ( node , isPrivate ( node . getModifiers ( ) ) , "<STR_LIT>" ) ; } } private void checkMethodForModifier ( MethodNode node , boolean condition , String modifierName ) { if ( ! condition ) return ; addError ( "<STR_LIT>" + getDescription ( node ) + "<STR_LIT>" + modifierName + "<STR_LIT:.>" , node ) ; } private void checkClassForModifier ( ClassNode node , boolean condition , String modifierName ) { if ( ! condition ) return ; addError ( "<STR_LIT>" + getDescription ( node ) + "<STR_LIT>" + modifierName + "<STR_LIT:.>" , node ) ; } private String getDescription ( ClassNode node ) { return ( node . isInterface ( ) ? "<STR_LIT>" : "<STR_LIT:class>" ) + "<STR_LIT>" + node . getName ( ) + "<STR_LIT:'>" ; } private String getDescription ( MethodNode node ) { return "<STR_LIT>" + node . getTypeDescriptor ( ) + "<STR_LIT:'>" ; } private String getDescription ( FieldNode node ) { return "<STR_LIT>" + node . getName ( ) + "<STR_LIT:'>" ; } private void checkAbstractDeclaration ( MethodNode methodNode ) { if ( ! methodNode . isAbstract ( ) ) return ; if ( isAbstract ( currentClass . getModifiers ( ) ) ) return ; addError ( "<STR_LIT>" + "<STR_LIT>" + getDescription ( currentClass ) + "<STR_LIT>" + methodNode . getTypeDescriptor ( ) + "<STR_LIT>" , methodNode ) ; } private void checkClassForOverwritingFinal ( ClassNode cn ) { ClassNode superCN = cn . getSuperClass ( ) ; if ( superCN == null ) return ; if ( ! isFinal ( superCN . getModifiers ( ) ) ) return ; StringBuilder msg = new StringBuilder ( ) ; msg . append ( "<STR_LIT>" ) ; msg . append ( getDescription ( superCN ) ) ; msg . append ( "<STR_LIT:.>" ) ; addError ( msg . toString ( ) , cn ) ; } private void checkImplementsAndExtends ( ClassNode node ) { ClassNode cn = node . getSuperClass ( ) ; if ( cn . isInterface ( ) && ! node . isInterface ( ) ) { addTypeError ( "<STR_LIT>" + getDescription ( cn ) + "<STR_LIT>" , node ) ; } for ( ClassNode anInterface : node . getInterfaces ( ) ) { cn = anInterface ; if ( ! cn . isInterface ( ) ) { addTypeError ( "<STR_LIT>" + getDescription ( cn ) + "<STR_LIT>" , node ) ; } } } private void checkMethodsForIncorrectModifiers ( ClassNode cn ) { if ( ! cn . isInterface ( ) ) return ; for ( MethodNode method : cn . getMethods ( ) ) { if ( method . isFinal ( ) ) { addError ( "<STR_LIT>" + getDescription ( method ) + "<STR_LIT>" + getDescription ( cn ) + "<STR_LIT>" , method ) ; } if ( method . isStatic ( ) && ! isConstructor ( method ) ) { addError ( "<STR_LIT>" + getDescription ( method ) + "<STR_LIT>" + getDescription ( cn ) + "<STR_LIT>" , method ) ; } } } private void checkMethodsForWeakerAccess ( ClassNode cn ) { for ( MethodNode method : cn . getMethods ( ) ) { checkMethodForWeakerAccessPrivileges ( method , cn ) ; } } private boolean isConstructor ( MethodNode method ) { return method . getName ( ) . equals ( "<STR_LIT>" ) ; } private void checkMethodsForOverridingFinal ( ClassNode cn ) { for ( MethodNode method : cn . getMethods ( ) ) { Parameter [ ] params = method . getParameters ( ) ; for ( MethodNode superMethod : cn . getSuperClass ( ) . getMethods ( method . getName ( ) ) ) { Parameter [ ] superParams = superMethod . getParameters ( ) ; if ( ! hasEqualParameterTypes ( params , superParams ) ) continue ; if ( ! superMethod . isFinal ( ) ) break ; addInvalidUseOfFinalError ( method , params , superMethod . getDeclaringClass ( ) ) ; return ; } } } private void addInvalidUseOfFinalError ( MethodNode method , Parameter [ ] parameters , ClassNode superCN ) { StringBuilder msg = new StringBuilder ( ) ; msg . append ( "<STR_LIT>" ) . append ( method . getName ( ) ) ; msg . append ( "<STR_LIT:(>" ) ; boolean needsComma = false ; for ( Parameter parameter : parameters ) { if ( needsComma ) { msg . append ( "<STR_LIT:U+002C>" ) ; } else { needsComma = true ; } msg . append ( parameter . getType ( ) ) ; } msg . append ( "<STR_LIT>" ) . append ( getDescription ( superCN ) ) ; msg . append ( "<STR_LIT:.>" ) ; addError ( msg . toString ( ) , method ) ; } private void addWeakerAccessError ( ClassNode cn , MethodNode method , Parameter [ ] parameters , MethodNode superMethod ) { StringBuilder msg = new StringBuilder ( ) ; msg . append ( method . getName ( ) ) ; msg . append ( "<STR_LIT:(>" ) ; boolean needsComma = false ; for ( Parameter parameter : parameters ) { if ( needsComma ) { msg . append ( "<STR_LIT:U+002C>" ) ; } else { needsComma = true ; } msg . append ( parameter . getType ( ) ) ; } msg . append ( "<STR_LIT>" ) ; msg . append ( cn . getName ( ) ) ; msg . append ( "<STR_LIT>" ) ; msg . append ( superMethod . getName ( ) ) ; msg . append ( "<STR_LIT>" ) ; msg . append ( superMethod . getDeclaringClass ( ) . getName ( ) ) ; msg . append ( "<STR_LIT>" ) ; msg . append ( superMethod . isPublic ( ) ? "<STR_LIT>" : "<STR_LIT>" ) ; addError ( msg . toString ( ) , method ) ; } private boolean hasEqualParameterTypes ( Parameter [ ] first , Parameter [ ] second ) { if ( first . length != second . length ) return false ; for ( int i = <NUM_LIT:0> ; i < first . length ; i ++ ) { String ft = first [ i ] . getType ( ) . getName ( ) ; String st = second [ i ] . getType ( ) . getName ( ) ; if ( ft . equals ( st ) ) continue ; return false ; } return true ; } protected SourceUnit getSourceUnit ( ) { return source ; } public void visitMethod ( MethodNode node ) { inConstructor = false ; inStaticConstructor = node . isStaticConstructor ( ) ; checkAbstractDeclaration ( node ) ; checkRepetitiveMethod ( node ) ; checkOverloadingPrivateAndPublic ( node ) ; checkMethodModifiers ( node ) ; checkGenericsUsage ( node , node . getParameters ( ) ) ; checkGenericsUsage ( node , node . getReturnType ( ) ) ; super . visitMethod ( node ) ; } private void checkMethodModifiers ( MethodNode node ) { if ( ( this . currentClass . getModifiers ( ) & ACC_INTERFACE ) != <NUM_LIT:0> ) { checkMethodForModifier ( node , isStrict ( node . getModifiers ( ) ) , "<STR_LIT>" ) ; checkMethodForModifier ( node , isSynchronized ( node . getModifiers ( ) ) , "<STR_LIT>" ) ; checkMethodForModifier ( node , isNative ( node . getModifiers ( ) ) , "<STR_LIT>" ) ; } } private void checkMethodForWeakerAccessPrivileges ( MethodNode mn , ClassNode cn ) { Parameter [ ] params = mn . getParameters ( ) ; for ( MethodNode superMethod : cn . getSuperClass ( ) . getMethods ( mn . getName ( ) ) ) { Parameter [ ] superParams = superMethod . getParameters ( ) ; if ( ! hasEqualParameterTypes ( params , superParams ) ) continue ; if ( ( mn . isPrivate ( ) && ! superMethod . isPrivate ( ) ) || ( mn . isProtected ( ) && superMethod . isPublic ( ) ) ) { addWeakerAccessError ( cn , mn , params , superMethod ) ; return ; } } } private void checkOverloadingPrivateAndPublic ( MethodNode node ) { if ( isConstructor ( node ) ) return ; boolean hasPrivate = node . isPrivate ( ) ; boolean hasPublic = node . isPublic ( ) ; for ( MethodNode method : currentClass . getMethods ( node . getName ( ) ) ) { if ( method == node ) continue ; if ( ! method . getDeclaringClass ( ) . equals ( node . getDeclaringClass ( ) ) ) continue ; if ( method . isPublic ( ) || method . isProtected ( ) ) { hasPublic = true ; } else { hasPrivate = true ; } } if ( hasPrivate && hasPublic ) { addError ( "<STR_LIT>" , node ) ; } } private void checkRepetitiveMethod ( MethodNode node ) { if ( isConstructor ( node ) ) return ; for ( MethodNode method : currentClass . getMethods ( node . getName ( ) ) ) { if ( method == node ) continue ; if ( ! method . getDeclaringClass ( ) . equals ( node . getDeclaringClass ( ) ) ) continue ; Parameter [ ] p1 = node . getParameters ( ) ; Parameter [ ] p2 = method . getParameters ( ) ; if ( p1 . length != p2 . length ) continue ; addErrorIfParamsAndReturnTypeEqual ( p2 , p1 , node , method ) ; } } private void addErrorIfParamsAndReturnTypeEqual ( Parameter [ ] p2 , Parameter [ ] p1 , MethodNode node , MethodNode element ) { boolean isEqual = true ; for ( int i = <NUM_LIT:0> ; i < p2 . length ; i ++ ) { isEqual &= p1 [ i ] . getType ( ) . equals ( p2 [ i ] . getType ( ) ) ; } isEqual &= node . getReturnType ( ) . equals ( element . getReturnType ( ) ) ; if ( isEqual ) { addError ( "<STR_LIT>" + getDescription ( node ) + "<STR_LIT>" + getDescription ( currentClass ) + "<STR_LIT:.>" , node ) ; } } public void visitField ( FieldNode node ) { if ( currentClass . getDeclaredField ( node . getName ( ) ) != node ) { addError ( "<STR_LIT>" + getDescription ( node ) + "<STR_LIT>" , node ) ; } checkInterfaceFieldModifiers ( node ) ; checkGenericsUsage ( node , node . getType ( ) ) ; super . visitField ( node ) ; } public void visitProperty ( PropertyNode node ) { checkDuplicateProperties ( node ) ; checkGenericsUsage ( node , node . getType ( ) ) ; super . visitProperty ( node ) ; } private void checkDuplicateProperties ( PropertyNode node ) { ClassNode cn = node . getDeclaringClass ( ) ; String name = node . getName ( ) ; String getterName = "<STR_LIT:get>" + MetaClassHelper . capitalize ( name ) ; if ( Character . isUpperCase ( name . charAt ( <NUM_LIT:0> ) ) ) { for ( PropertyNode propNode : cn . getProperties ( ) ) { String otherName = propNode . getField ( ) . getName ( ) ; String otherGetterName = "<STR_LIT:get>" + MetaClassHelper . capitalize ( otherName ) ; if ( node != propNode && getterName . equals ( otherGetterName ) ) { String msg = "<STR_LIT>" + name + "<STR_LIT:U+0020andU+0020>" + otherName + "<STR_LIT>" + cn . getName ( ) + "<STR_LIT>" ; addError ( msg , node ) ; } } } } private void checkInterfaceFieldModifiers ( FieldNode node ) { if ( ! currentClass . isInterface ( ) ) return ; if ( ( node . getModifiers ( ) & ( ACC_PUBLIC | ACC_STATIC | ACC_FINAL ) ) == <NUM_LIT:0> || ( node . getModifiers ( ) & ( ACC_PRIVATE | ACC_PROTECTED ) ) != <NUM_LIT:0> ) { addError ( "<STR_LIT>" + getDescription ( node ) + "<STR_LIT>" + getDescription ( currentClass ) + "<STR_LIT:.>" , node ) ; } } public void visitBinaryExpression ( BinaryExpression expression ) { if ( expression . getOperation ( ) . getType ( ) == Types . LEFT_SQUARE_BRACKET && expression . getRightExpression ( ) instanceof MapEntryExpression ) { addError ( "<STR_LIT>" + "<STR_LIT>" , expression . getRightExpression ( ) ) ; } super . visitBinaryExpression ( expression ) ; switch ( expression . getOperation ( ) . getType ( ) ) { case Types . EQUAL : case Types . BITWISE_AND_EQUAL : case Types . BITWISE_OR_EQUAL : case Types . BITWISE_XOR_EQUAL : case Types . PLUS_EQUAL : case Types . MINUS_EQUAL : case Types . MULTIPLY_EQUAL : case Types . DIVIDE_EQUAL : case Types . INTDIV_EQUAL : case Types . MOD_EQUAL : case Types . POWER_EQUAL : case Types . LEFT_SHIFT_EQUAL : case Types . RIGHT_SHIFT_EQUAL : case Types . RIGHT_SHIFT_UNSIGNED_EQUAL : checkFinalFieldAccess ( expression . getLeftExpression ( ) ) ; break ; default : break ; } } private void checkFinalFieldAccess ( Expression expression ) { if ( ! ( expression instanceof VariableExpression ) && ! ( expression instanceof PropertyExpression ) ) return ; Variable v = null ; if ( expression instanceof VariableExpression ) { VariableExpression ve = ( VariableExpression ) expression ; v = ve . getAccessedVariable ( ) ; } else { PropertyExpression propExp = ( ( PropertyExpression ) expression ) ; Expression objectExpression = propExp . getObjectExpression ( ) ; if ( objectExpression instanceof VariableExpression ) { VariableExpression varExp = ( VariableExpression ) objectExpression ; if ( varExp . isThisExpression ( ) ) { v = currentClass . getDeclaredField ( propExp . getPropertyAsString ( ) ) ; } } } if ( v instanceof FieldNode ) { FieldNode fn = ( FieldNode ) v ; boolean isFinal = fn . isFinal ( ) ; boolean isStatic = fn . isStatic ( ) ; boolean error = isFinal && ( ( isStatic && ! inStaticConstructor ) || ( ! isStatic && ! inConstructor ) ) ; if ( error ) addError ( "<STR_LIT>" + ( isStatic ? "<STR_LIT>" : "<STR_LIT>" ) + "<STR_LIT>" + fn . getName ( ) + "<STR_LIT>" + ( isStatic ? "<STR_LIT>" : "<STR_LIT>" ) , expression ) ; } } public void visitConstructor ( ConstructorNode node ) { inConstructor = true ; inStaticConstructor = node . isStaticConstructor ( ) ; checkGenericsUsage ( node , node . getParameters ( ) ) ; super . visitConstructor ( node ) ; } public void visitCatchStatement ( CatchStatement cs ) { if ( ! ( cs . getExceptionType ( ) . isDerivedFrom ( ClassHelper . make ( Throwable . class ) ) ) ) { addError ( "<STR_LIT>" , cs ) ; } super . visitCatchStatement ( cs ) ; } public void visitMethodCallExpression ( MethodCallExpression mce ) { super . visitMethodCallExpression ( mce ) ; Expression aexp = mce . getArguments ( ) ; if ( aexp instanceof TupleExpression ) { TupleExpression arguments = ( TupleExpression ) aexp ; for ( Expression e : arguments . getExpressions ( ) ) { checkForInvalidDeclaration ( e ) ; } } else { checkForInvalidDeclaration ( aexp ) ; } } @ Override public void visitDeclarationExpression ( DeclarationExpression expression ) { super . visitDeclarationExpression ( expression ) ; if ( expression . isMultipleAssignmentDeclaration ( ) ) return ; checkInvalidDeclarationModifier ( expression , ACC_ABSTRACT , "<STR_LIT>" ) ; checkInvalidDeclarationModifier ( expression , ACC_NATIVE , "<STR_LIT>" ) ; checkInvalidDeclarationModifier ( expression , ACC_PRIVATE , "<STR_LIT>" ) ; checkInvalidDeclarationModifier ( expression , ACC_PROTECTED , "<STR_LIT>" ) ; checkInvalidDeclarationModifier ( expression , ACC_PUBLIC , "<STR_LIT>" ) ; checkInvalidDeclarationModifier ( expression , ACC_STATIC , "<STR_LIT>" ) ; checkInvalidDeclarationModifier ( expression , ACC_STRICT , "<STR_LIT>" ) ; checkInvalidDeclarationModifier ( expression , ACC_SYNCHRONIZED , "<STR_LIT>" ) ; checkInvalidDeclarationModifier ( expression , ACC_TRANSIENT , "<STR_LIT>" ) ; checkInvalidDeclarationModifier ( expression , ACC_VOLATILE , "<STR_LIT>" ) ; } private void checkInvalidDeclarationModifier ( DeclarationExpression expression , int modifier , String modName ) { if ( ( expression . getVariableExpression ( ) . getModifiers ( ) & modifier ) != <NUM_LIT:0> ) { addError ( "<STR_LIT>" + modName + "<STR_LIT>" , expression ) ; } } private void checkForInvalidDeclaration ( Expression exp ) { if ( ! ( exp instanceof DeclarationExpression ) ) return ; addError ( "<STR_LIT>" , exp ) ; } public void visitConstantExpression ( ConstantExpression expression ) { super . visitConstantExpression ( expression ) ; checkStringExceedingMaximumLength ( expression ) ; } public void visitGStringExpression ( GStringExpression expression ) { super . visitGStringExpression ( expression ) ; for ( ConstantExpression ce : expression . getStrings ( ) ) { checkStringExceedingMaximumLength ( ce ) ; } } private void checkStringExceedingMaximumLength ( ConstantExpression expression ) { Object value = expression . getValue ( ) ; if ( value instanceof String ) { String s = ( String ) value ; if ( s . length ( ) > <NUM_LIT> ) { addError ( "<STR_LIT>" + s . length ( ) + "<STR_LIT>" , expression ) ; } } } private void checkGenericsUsage ( ASTNode ref , ClassNode [ ] nodes ) { for ( ClassNode node : nodes ) { checkGenericsUsage ( ref , node ) ; } } private void checkGenericsUsage ( ASTNode ref , Parameter [ ] params ) { for ( Parameter p : params ) { checkGenericsUsage ( ref , p . getType ( ) ) ; } } private void checkGenericsUsage ( ASTNode ref , ClassNode node ) { if ( node . isArray ( ) ) { checkGenericsUsage ( ref , node . getComponentType ( ) ) ; } else if ( ! node . isRedirectNode ( ) && node . isUsingGenerics ( ) ) { addError ( "<STR_LIT>" + node + "<STR_LIT:U+0020>" + "<STR_LIT>" + getRefDescriptor ( ref ) + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" , ref ) ; } } private String getRefDescriptor ( ASTNode ref ) { if ( ref instanceof FieldNode ) { FieldNode f = ( FieldNode ) ref ; return "<STR_LIT>" + f . getName ( ) + "<STR_LIT:U+0020>" ; } else if ( ref instanceof PropertyNode ) { PropertyNode p = ( PropertyNode ) ref ; return "<STR_LIT>" + p . getName ( ) + "<STR_LIT:U+0020>" ; } else if ( ref instanceof ConstructorNode ) { return "<STR_LIT>" + ref . getText ( ) + "<STR_LIT:U+0020>" ; } else if ( ref instanceof MethodNode ) { return "<STR_LIT>" + ref . getText ( ) + "<STR_LIT:U+0020>" ; } else if ( ref instanceof ClassNode ) { return "<STR_LIT>" + ref + "<STR_LIT:U+0020>" ; } return "<STR_LIT>" + ref . getClass ( ) + "<STR_LIT>" ; } } </s>
|
<s> package org . codehaus . groovy . classgen ; import groovy . lang . GroovyClassLoader ; import groovy . lang . GroovyObject ; import groovy . lang . MetaClass ; import org . codehaus . groovy . ast . * ; import org . codehaus . groovy . ast . expr . * ; import org . codehaus . groovy . ast . stmt . * ; import org . codehaus . groovy . classgen . asm . BytecodeHelper ; import org . codehaus . groovy . classgen . asm . MopWriter ; import org . codehaus . groovy . classgen . asm . OptimizingStatementWriter . ClassNodeSkip ; import org . codehaus . groovy . classgen . asm . WriterController ; import org . codehaus . groovy . classgen . asm . WriterControllerFactory ; import org . codehaus . groovy . runtime . MetaClassHelper ; import org . codehaus . groovy . syntax . RuntimeParserException ; import org . codehaus . groovy . syntax . Token ; import org . codehaus . groovy . syntax . Types ; import org . codehaus . groovy . reflection . ClassInfo ; import org . objectweb . asm . Label ; import org . objectweb . asm . MethodVisitor ; import org . objectweb . asm . Opcodes ; import org . objectweb . asm . Type ; import java . lang . reflect . Field ; import java . lang . reflect . Modifier ; import java . util . * ; public class Verifier implements GroovyClassVisitor , Opcodes { public static final String STATIC_METACLASS_BOOL = "<STR_LIT>" ; public static final String SWAP_INIT = "<STR_LIT>" ; public static final String INITIAL_EXPRESSION = "<STR_LIT>" ; public static final String __TIMESTAMP = "<STR_LIT>" ; public static final String __TIMESTAMP__ = "<STR_LIT>" ; private static final Parameter [ ] INVOKE_METHOD_PARAMS = new Parameter [ ] { new Parameter ( ClassHelper . STRING_TYPE , "<STR_LIT>" ) , new Parameter ( ClassHelper . OBJECT_TYPE , "<STR_LIT>" ) } ; private static final Parameter [ ] SET_PROPERTY_PARAMS = new Parameter [ ] { new Parameter ( ClassHelper . STRING_TYPE , "<STR_LIT>" ) , new Parameter ( ClassHelper . OBJECT_TYPE , "<STR_LIT:value>" ) } ; private static final Parameter [ ] GET_PROPERTY_PARAMS = new Parameter [ ] { new Parameter ( ClassHelper . STRING_TYPE , "<STR_LIT>" ) } ; private static final Parameter [ ] SET_METACLASS_PARAMS = new Parameter [ ] { new Parameter ( ClassHelper . METACLASS_TYPE , "<STR_LIT>" ) } ; private ClassNode classNode ; private MethodNode methodNode ; public boolean inlineStaticFieldInitializersIntoClinit = true ; public boolean inlineFieldInitializersIntoInit = true ; public ClassNode getClassNode ( ) { return classNode ; } public MethodNode getMethodNode ( ) { return methodNode ; } private FieldNode setMetaClassFieldIfNotExists ( ClassNode node , FieldNode metaClassField ) { if ( metaClassField != null ) return metaClassField ; final String classInternalName = BytecodeHelper . getClassInternalName ( node ) ; metaClassField = node . addField ( "<STR_LIT>" , ACC_PRIVATE | ACC_TRANSIENT | ACC_SYNTHETIC , ClassHelper . METACLASS_TYPE , new BytecodeExpression ( ClassHelper . METACLASS_TYPE ) { public void visit ( MethodVisitor mv ) { mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; mv . visitMethodInsn ( INVOKEVIRTUAL , classInternalName , "<STR_LIT>" , "<STR_LIT>" ) ; } } ) ; metaClassField . setSynthetic ( true ) ; return metaClassField ; } private FieldNode getMetaClassField ( ClassNode node ) { FieldNode ret = node . getDeclaredField ( "<STR_LIT>" ) ; if ( ret != null ) { ClassNode mcFieldType = ret . getType ( ) ; if ( ! mcFieldType . equals ( ClassHelper . METACLASS_TYPE ) ) { throw new RuntimeParserException ( "<STR_LIT>" + node . getName ( ) + "<STR_LIT>" + mcFieldType . getName ( ) + "<STR_LIT>" + "<STR_LIT>" + ClassHelper . METACLASS_TYPE . getName ( ) + "<STR_LIT>" , ret ) ; } return ret ; } ClassNode current = node . getSuperClass ( ) ; while ( current != null && ! current . equals ( ClassHelper . OBJECT_TYPE ) ) { ret = current . getDeclaredField ( "<STR_LIT>" ) ; if ( ret != null && ! Modifier . isPrivate ( ret . getModifiers ( ) ) ) return ret ; current = current . getSuperClass ( ) ; } return null ; } public void visitClass ( final ClassNode node ) { this . classNode = node ; if ( ( classNode . getModifiers ( ) & Opcodes . ACC_INTERFACE ) > <NUM_LIT:0> ) { ConstructorNode dummy = new ConstructorNode ( <NUM_LIT:0> , null ) ; addInitialization ( node , dummy ) ; node . visitContents ( this ) ; if ( classNode . getNodeMetaData ( ClassNodeSkip . class ) == null ) { classNode . setNodeMetaData ( ClassNodeSkip . class , true ) ; } return ; } ClassNode [ ] classNodes = classNode . getInterfaces ( ) ; List < String > interfaces = new ArrayList < String > ( ) ; for ( ClassNode classNode : classNodes ) { interfaces . add ( classNode . getName ( ) ) ; } Set < String > interfaceSet = new HashSet < String > ( interfaces ) ; if ( interfaceSet . size ( ) != interfaces . size ( ) ) { throw new RuntimeParserException ( "<STR_LIT>" + interfaces , classNode ) ; } addDefaultParameterMethods ( node ) ; addDefaultParameterConstructors ( node ) ; final String classInternalName = BytecodeHelper . getClassInternalName ( node ) ; addStaticMetaClassField ( node , classInternalName ) ; boolean knownSpecialCase = node . isDerivedFrom ( ClassHelper . GSTRING_TYPE ) || node . isDerivedFrom ( ClassHelper . GROOVY_OBJECT_SUPPORT_TYPE ) ; addFastPathHelperFieldsAndHelperMethod ( node , classInternalName , knownSpecialCase ) ; if ( ! knownSpecialCase ) addGroovyObjectInterfaceAndMethods ( node , classInternalName ) ; addDefaultConstructor ( node ) ; if ( ! ( node instanceof InnerClassNode ) ) addTimeStamp ( node ) ; addInitialization ( node ) ; checkReturnInObjectInitializer ( node . getObjectInitializerStatements ( ) ) ; node . getObjectInitializerStatements ( ) . clear ( ) ; node . visitContents ( this ) ; addCovariantMethods ( node ) ; } private FieldNode checkFieldDoesNotExist ( ClassNode node , String fieldName ) { FieldNode ret = node . getDeclaredField ( fieldName ) ; if ( ret != null ) { if ( Modifier . isPublic ( ret . getModifiers ( ) ) && ret . getType ( ) . redirect ( ) == ClassHelper . boolean_TYPE ) { return ret ; } throw new RuntimeParserException ( "<STR_LIT>" + node . getName ( ) + "<STR_LIT>" + fieldName + "<STR_LIT>" + "<STR_LIT>" , ret ) ; } return null ; } private void addFastPathHelperFieldsAndHelperMethod ( ClassNode node , final String classInternalName , boolean knownSpecialCase ) { if ( node . getNodeMetaData ( ClassNodeSkip . class ) != null ) return ; FieldNode stMCB = checkFieldDoesNotExist ( node , STATIC_METACLASS_BOOL ) ; if ( stMCB == null ) { stMCB = node . addField ( STATIC_METACLASS_BOOL , ACC_PUBLIC | ACC_STATIC | ACC_SYNTHETIC | ACC_TRANSIENT , ClassHelper . boolean_TYPE , null ) ; stMCB . setSynthetic ( true ) ; } } protected void addDefaultConstructor ( ClassNode node ) { if ( ! node . getDeclaredConstructors ( ) . isEmpty ( ) ) return ; BlockStatement empty = new BlockStatement ( ) ; ConstructorNode constructor = new ConstructorNode ( ACC_PUBLIC , empty ) ; constructor . setHasNoRealSourcePosition ( true ) ; node . addConstructor ( constructor ) ; } private static boolean isInnerClassOf ( ClassNode a , ClassNode b ) { if ( a . redirect ( ) == b ) return true ; if ( b . redirect ( ) instanceof InnerClassNode ) return isInnerClassOf ( a , b . redirect ( ) . getOuterClass ( ) ) ; return false ; } private void addStaticMetaClassField ( final ClassNode node , final String classInternalName ) { String _staticClassInfoFieldName = "<STR_LIT>" ; while ( node . getDeclaredField ( _staticClassInfoFieldName ) != null ) _staticClassInfoFieldName = _staticClassInfoFieldName + "<STR_LIT:$>" ; final String staticMetaClassFieldName = _staticClassInfoFieldName ; FieldNode staticMetaClassField = node . addField ( staticMetaClassFieldName , ACC_PRIVATE | ACC_STATIC | ACC_SYNTHETIC , ClassHelper . make ( ClassInfo . class , false ) , null ) ; staticMetaClassField . setSynthetic ( true ) ; node . addSyntheticMethod ( "<STR_LIT>" , ACC_PROTECTED , ClassHelper . make ( MetaClass . class ) , Parameter . EMPTY_ARRAY , ClassNode . EMPTY_ARRAY , new BytecodeSequence ( new BytecodeInstruction ( ) { public void visit ( MethodVisitor mv ) { mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; mv . visitMethodInsn ( INVOKEVIRTUAL , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; if ( BytecodeHelper . isClassLiteralPossible ( node ) || BytecodeHelper . isSameCompilationUnit ( classNode , node ) ) { BytecodeHelper . visitClassLiteral ( mv , node ) ; } else { mv . visitMethodInsn ( INVOKESTATIC , classInternalName , "<STR_LIT>" + classInternalName . replaceAll ( "<STR_LIT>" , "<STR_LIT>" ) , "<STR_LIT>" ) ; } Label l1 = new Label ( ) ; mv . visitJumpInsn ( IF_ACMPEQ , l1 ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; mv . visitMethodInsn ( INVOKESTATIC , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitInsn ( ARETURN ) ; mv . visitLabel ( l1 ) ; mv . visitFieldInsn ( GETSTATIC , classInternalName , staticMetaClassFieldName , "<STR_LIT>" ) ; mv . visitVarInsn ( ASTORE , <NUM_LIT:1> ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:1> ) ; Label l0 = new Label ( ) ; mv . visitJumpInsn ( IFNONNULL , l0 ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; mv . visitMethodInsn ( INVOKEVIRTUAL , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitMethodInsn ( INVOKESTATIC , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitInsn ( DUP ) ; mv . visitVarInsn ( ASTORE , <NUM_LIT:1> ) ; mv . visitFieldInsn ( PUTSTATIC , classInternalName , staticMetaClassFieldName , "<STR_LIT>" ) ; mv . visitLabel ( l0 ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:1> ) ; mv . visitMethodInsn ( INVOKEVIRTUAL , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitInsn ( ARETURN ) ; } } ) ) ; } protected void addGroovyObjectInterfaceAndMethods ( ClassNode node , final String classInternalName ) { if ( ! node . isDerivedFromGroovyObject ( ) ) node . addInterface ( ClassHelper . make ( GroovyObject . class ) ) ; FieldNode metaClassField = getMetaClassField ( node ) ; if ( ! node . hasMethod ( "<STR_LIT>" , Parameter . EMPTY_ARRAY ) ) { metaClassField = setMetaClassFieldIfNotExists ( node , metaClassField ) ; addMethod ( node , ! Modifier . isAbstract ( node . getModifiers ( ) ) , "<STR_LIT>" , ACC_PUBLIC , ClassHelper . METACLASS_TYPE , Parameter . EMPTY_ARRAY , ClassNode . EMPTY_ARRAY , new BytecodeSequence ( new BytecodeInstruction ( ) { public void visit ( MethodVisitor mv ) { Label nullLabel = new Label ( ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; mv . visitFieldInsn ( GETFIELD , classInternalName , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitInsn ( DUP ) ; mv . visitJumpInsn ( IFNULL , nullLabel ) ; mv . visitInsn ( ARETURN ) ; mv . visitLabel ( nullLabel ) ; mv . visitInsn ( POP ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; mv . visitInsn ( DUP ) ; mv . visitMethodInsn ( INVOKEVIRTUAL , classInternalName , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitFieldInsn ( PUTFIELD , classInternalName , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; mv . visitFieldInsn ( GETFIELD , classInternalName , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitInsn ( ARETURN ) ; } } ) ) ; } Parameter [ ] parameters = new Parameter [ ] { new Parameter ( ClassHelper . METACLASS_TYPE , "<STR_LIT>" ) } ; if ( ! node . hasMethod ( "<STR_LIT>" , parameters ) ) { metaClassField = setMetaClassFieldIfNotExists ( node , metaClassField ) ; Statement setMetaClassCode ; if ( Modifier . isFinal ( metaClassField . getModifiers ( ) ) ) { ConstantExpression text = new ConstantExpression ( "<STR_LIT>" ) ; ConstructorCallExpression cce = new ConstructorCallExpression ( ClassHelper . make ( IllegalArgumentException . class ) , text ) ; setMetaClassCode = new ExpressionStatement ( cce ) ; } else { List list = new ArrayList ( ) ; list . add ( new BytecodeInstruction ( ) { public void visit ( MethodVisitor mv ) { mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:1> ) ; mv . visitFieldInsn ( PUTFIELD , classInternalName , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitInsn ( RETURN ) ; } } ) ; setMetaClassCode = new BytecodeSequence ( list ) ; } addMethod ( node , ! Modifier . isAbstract ( node . getModifiers ( ) ) , "<STR_LIT>" , ACC_PUBLIC , ClassHelper . VOID_TYPE , SET_METACLASS_PARAMS , ClassNode . EMPTY_ARRAY , setMetaClassCode ) ; } if ( ! node . hasMethod ( "<STR_LIT>" , INVOKE_METHOD_PARAMS ) ) { VariableExpression vMethods = new VariableExpression ( "<STR_LIT>" ) ; VariableExpression vArguments = new VariableExpression ( "<STR_LIT>" ) ; VariableScope blockScope = new VariableScope ( ) ; blockScope . putReferencedLocalVariable ( vMethods ) ; blockScope . putReferencedLocalVariable ( vArguments ) ; addMethod ( node , ! Modifier . isAbstract ( node . getModifiers ( ) ) , "<STR_LIT>" , ACC_PUBLIC , ClassHelper . OBJECT_TYPE , INVOKE_METHOD_PARAMS , ClassNode . EMPTY_ARRAY , new BytecodeSequence ( new BytecodeInstruction ( ) { public void visit ( MethodVisitor mv ) { mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; mv . visitMethodInsn ( INVOKEVIRTUAL , classInternalName , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:1> ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:2> ) ; mv . visitMethodInsn ( INVOKEINTERFACE , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitInsn ( ARETURN ) ; } } ) ) ; } if ( ! node . hasMethod ( "<STR_LIT>" , GET_PROPERTY_PARAMS ) ) { addMethod ( node , ! Modifier . isAbstract ( node . getModifiers ( ) ) , "<STR_LIT>" , ACC_PUBLIC , ClassHelper . OBJECT_TYPE , GET_PROPERTY_PARAMS , ClassNode . EMPTY_ARRAY , new BytecodeSequence ( new BytecodeInstruction ( ) { public void visit ( MethodVisitor mv ) { mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; mv . visitMethodInsn ( INVOKEVIRTUAL , classInternalName , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:1> ) ; mv . visitMethodInsn ( INVOKEINTERFACE , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitInsn ( ARETURN ) ; } } ) ) ; } if ( ! node . hasMethod ( "<STR_LIT>" , SET_PROPERTY_PARAMS ) ) { addMethod ( node , ! Modifier . isAbstract ( node . getModifiers ( ) ) , "<STR_LIT>" , ACC_PUBLIC , ClassHelper . VOID_TYPE , SET_PROPERTY_PARAMS , ClassNode . EMPTY_ARRAY , new BytecodeSequence ( new BytecodeInstruction ( ) { public void visit ( MethodVisitor mv ) { mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; mv . visitMethodInsn ( INVOKEVIRTUAL , classInternalName , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:1> ) ; mv . visitVarInsn ( ALOAD , <NUM_LIT:2> ) ; mv . visitMethodInsn ( INVOKEINTERFACE , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; mv . visitInsn ( RETURN ) ; } } ) ) ; } } protected void addMethod ( ClassNode node , boolean shouldBeSynthetic , String name , int modifiers , ClassNode returnType , Parameter [ ] parameters , ClassNode [ ] exceptions , Statement code ) { if ( shouldBeSynthetic ) { node . addSyntheticMethod ( name , modifiers , returnType , parameters , exceptions , code ) ; } else { node . addMethod ( name , modifiers & ~ ACC_SYNTHETIC , returnType , parameters , exceptions , code ) ; } } protected void addTimeStamp ( ClassNode node ) { if ( node . getDeclaredField ( Verifier . __TIMESTAMP ) == null ) { } } private void checkReturnInObjectInitializer ( List init ) { CodeVisitorSupport cvs = new CodeVisitorSupport ( ) { @ Override public void visitClosureExpression ( ClosureExpression expression ) { } public void visitReturnStatement ( ReturnStatement statement ) { throw new RuntimeParserException ( "<STR_LIT>" , statement ) ; } } ; for ( Iterator iterator = init . iterator ( ) ; iterator . hasNext ( ) ; ) { Statement stm = ( Statement ) iterator . next ( ) ; stm . visit ( cvs ) ; } } public void visitConstructor ( ConstructorNode node ) { CodeVisitorSupport checkSuper = new CodeVisitorSupport ( ) { boolean firstMethodCall = true ; String type = null ; public void visitMethodCallExpression ( MethodCallExpression call ) { if ( ! firstMethodCall ) return ; firstMethodCall = false ; String name = call . getMethodAsString ( ) ; if ( name == null ) return ; if ( ! name . equals ( "<STR_LIT>" ) && ! name . equals ( "<STR_LIT>" ) ) return ; type = name ; call . getArguments ( ) . visit ( this ) ; type = null ; } public void visitConstructorCallExpression ( ConstructorCallExpression call ) { if ( ! call . isSpecialCall ( ) ) return ; type = call . getText ( ) ; call . getArguments ( ) . visit ( this ) ; type = null ; } public void visitVariableExpression ( VariableExpression expression ) { if ( type == null ) return ; String name = expression . getName ( ) ; if ( ! name . equals ( "<STR_LIT>" ) && ! name . equals ( "<STR_LIT>" ) ) return ; throw new RuntimeParserException ( "<STR_LIT>" + name + "<STR_LIT>" + type + "<STR_LIT>" , expression ) ; } } ; Statement s = node . getCode ( ) ; if ( s == null ) { return ; } else { s . visit ( new VerifierCodeVisitor ( this ) ) ; } s . visit ( checkSuper ) ; } public void visitMethod ( MethodNode node ) { if ( MopWriter . isMopMethod ( node . getName ( ) ) ) { throw new RuntimeParserException ( "<STR_LIT>" + classNode . getName ( ) + "<STR_LIT:(>" + node . getName ( ) + "<STR_LIT:)>" , classNode ) ; } this . methodNode = node ; adjustTypesIfStaticMainMethod ( node ) ; addReturnIfNeeded ( node ) ; Statement statement ; statement = node . getCode ( ) ; if ( statement != null ) statement . visit ( new VerifierCodeVisitor ( this ) ) ; } private void adjustTypesIfStaticMainMethod ( MethodNode node ) { if ( node . getName ( ) . equals ( "<STR_LIT>" ) && node . isStatic ( ) ) { Parameter [ ] params = node . getParameters ( ) ; if ( params . length == <NUM_LIT:1> ) { Parameter param = params [ <NUM_LIT:0> ] ; if ( param . getType ( ) == null || param . getType ( ) == ClassHelper . OBJECT_TYPE ) { param . setType ( ClassHelper . STRING_TYPE . makeArray ( ) ) ; ClassNode returnType = node . getReturnType ( ) ; if ( returnType == ClassHelper . OBJECT_TYPE ) { node . setReturnType ( ClassHelper . VOID_TYPE ) ; } } } } } protected void addReturnIfNeeded ( MethodNode node ) { ReturnAdder adder = new ReturnAdder ( ) ; adder . visitMethod ( node ) ; } public void visitField ( FieldNode node ) { } private boolean methodNeedsReplacement ( MethodNode m ) { if ( m == null ) return true ; if ( m . getDeclaringClass ( ) == this . getClassNode ( ) ) return false ; if ( ( m . getModifiers ( ) & ACC_FINAL ) != <NUM_LIT:0> ) return false ; return true ; } public void visitProperty ( PropertyNode node ) { String name = node . getName ( ) ; FieldNode field = node . getField ( ) ; int propNodeModifiers = node . getModifiers ( ) ; String getterName = "<STR_LIT:get>" + capitalize ( name ) ; String setterName = "<STR_LIT>" + capitalize ( name ) ; if ( ( propNodeModifiers & Modifier . VOLATILE ) != <NUM_LIT:0> ) { propNodeModifiers = propNodeModifiers - Modifier . VOLATILE ; } if ( ( propNodeModifiers & Modifier . TRANSIENT ) != <NUM_LIT:0> ) { propNodeModifiers = propNodeModifiers - Modifier . TRANSIENT ; } Statement getterBlock = node . getGetterBlock ( ) ; if ( getterBlock == null ) { MethodNode getter = classNode . getGetterMethod ( getterName ) ; if ( getter == null && ClassHelper . boolean_TYPE == node . getType ( ) ) { String secondGetterName = "<STR_LIT>" + capitalize ( name ) ; getter = classNode . getGetterMethod ( secondGetterName ) ; } if ( ! node . isPrivate ( ) && methodNeedsReplacement ( getter ) ) { getterBlock = createGetterBlock ( node , field ) ; } } Statement setterBlock = node . getSetterBlock ( ) ; if ( setterBlock == null ) { MethodNode setter = classNode . getSetterMethod ( setterName , false ) ; if ( ! node . isPrivate ( ) && ( propNodeModifiers & ACC_FINAL ) == <NUM_LIT:0> && methodNeedsReplacement ( setter ) ) { setterBlock = createSetterBlock ( node , field ) ; } } if ( getterBlock != null ) { MethodNode getter = new MethodNode ( getterName , propNodeModifiers , node . getType ( ) , Parameter . EMPTY_ARRAY , ClassNode . EMPTY_ARRAY , getterBlock ) ; getter . setSynthetic ( true ) ; addPropertyMethod ( getter ) ; visitMethod ( getter ) ; if ( ClassHelper . boolean_TYPE == node . getType ( ) || ClassHelper . Boolean_TYPE == node . getType ( ) ) { String secondGetterName = "<STR_LIT>" + capitalize ( name ) ; MethodNode secondGetter = new MethodNode ( secondGetterName , propNodeModifiers , node . getType ( ) , Parameter . EMPTY_ARRAY , ClassNode . EMPTY_ARRAY , getterBlock ) ; secondGetter . setSynthetic ( true ) ; addPropertyMethod ( secondGetter ) ; visitMethod ( secondGetter ) ; } } if ( setterBlock != null ) { Parameter [ ] setterParameterTypes = { new Parameter ( node . getType ( ) , "<STR_LIT:value>" ) } ; MethodNode setter = new MethodNode ( setterName , propNodeModifiers , ClassHelper . VOID_TYPE , setterParameterTypes , ClassNode . EMPTY_ARRAY , setterBlock ) ; setter . setSynthetic ( true ) ; addPropertyMethod ( setter ) ; visitMethod ( setter ) ; } } protected void addPropertyMethod ( MethodNode method ) { classNode . addMethod ( method ) ; List < MethodNode > abstractMethods = classNode . getAbstractMethods ( ) ; if ( abstractMethods == null ) return ; String methodName = method . getName ( ) ; Parameter [ ] parameters = method . getParameters ( ) ; ClassNode methodReturnType = method . getReturnType ( ) ; for ( MethodNode node : abstractMethods ) { if ( node . getName ( ) . equals ( methodName ) && node . getParameters ( ) . length == parameters . length ) { if ( parameters . length == <NUM_LIT:1> ) { ClassNode abstractMethodParameterType = node . getParameters ( ) [ <NUM_LIT:0> ] . getType ( ) ; ClassNode methodParameterType = parameters [ <NUM_LIT:0> ] . getType ( ) ; if ( ! methodParameterType . isDerivedFrom ( abstractMethodParameterType ) && ! methodParameterType . implementsInterface ( abstractMethodParameterType ) ) { continue ; } } ClassNode nodeReturnType = node . getReturnType ( ) ; if ( ! methodReturnType . isDerivedFrom ( nodeReturnType ) && ! methodReturnType . implementsInterface ( nodeReturnType ) ) { continue ; } node . setModifiers ( node . getModifiers ( ) ^ ACC_ABSTRACT ) ; node . setCode ( method . getCode ( ) ) ; } } } public interface DefaultArgsAction { void call ( ArgumentListExpression arguments , Parameter [ ] newParams , MethodNode method ) ; } protected void addDefaultParameterMethods ( final ClassNode node ) { List methods = new ArrayList ( node . getMethods ( ) ) ; addDefaultParameters ( methods , new DefaultArgsAction ( ) { public void call ( ArgumentListExpression arguments , Parameter [ ] newParams , MethodNode method ) { MethodCallExpression expression = new MethodCallExpression ( VariableExpression . THIS_EXPRESSION , method . getName ( ) , arguments ) ; expression . setMethodTarget ( method ) ; expression . setImplicitThis ( true ) ; Statement code = null ; if ( method . isVoidMethod ( ) ) { code = new ExpressionStatement ( expression ) ; } else { code = new ReturnStatement ( expression ) ; } MethodNode newMethod = new MethodNode ( method . getName ( ) , method . getModifiers ( ) , method . getReturnType ( ) , newParams , method . getExceptions ( ) , code ) ; for ( Expression argument : arguments . getExpressions ( ) ) { if ( argument instanceof CastExpression ) { argument = ( ( CastExpression ) argument ) . getExpression ( ) ; } if ( argument instanceof ConstructorCallExpression ) { ClassNode type = argument . getType ( ) ; if ( type instanceof InnerClassNode && ( ( InnerClassNode ) type ) . isAnonymous ( ) ) { type . setEnclosingMethod ( newMethod ) ; } } } List < AnnotationNode > annotations = method . getAnnotations ( ) ; if ( annotations != null ) { newMethod . addAnnotations ( annotations ) ; } MethodNode oldMethod = node . getDeclaredMethod ( method . getName ( ) , newParams ) ; if ( oldMethod != null ) { throw new RuntimeParserException ( "<STR_LIT>" + method . getTypeDescriptor ( ) + "<STR_LIT>" + newMethod . getTypeDescriptor ( ) + "<STR_LIT>" , method ) ; } addPropertyMethod ( newMethod ) ; newMethod . setSourcePosition ( method ) ; newMethod . setNameStart ( method . getNameStart ( ) ) ; newMethod . setNameEnd ( method . getNameEnd ( ) ) ; newMethod . setOriginal ( method ) ; newMethod . setGenericsTypes ( method . getGenericsTypes ( ) ) ; } } ) ; } protected void addDefaultParameterConstructors ( final ClassNode node ) { List methods = new ArrayList ( node . getDeclaredConstructors ( ) ) ; addDefaultParameters ( methods , new DefaultArgsAction ( ) { public void call ( ArgumentListExpression arguments , Parameter [ ] newParams , MethodNode method ) { ConstructorNode ctor = ( ConstructorNode ) method ; ConstructorCallExpression expression = new ConstructorCallExpression ( ClassNode . THIS , arguments ) ; Statement code = new ExpressionStatement ( expression ) ; addConstructor ( newParams , ctor , code , node ) ; } } ) ; } protected void addConstructor ( Parameter [ ] newParams , ConstructorNode ctor , Statement code , ClassNode node ) { node . addConstructor ( ctor . getModifiers ( ) , newParams , ctor . getExceptions ( ) , code ) ; } protected void addDefaultParameters ( List methods , DefaultArgsAction action ) { for ( Iterator iter = methods . iterator ( ) ; iter . hasNext ( ) ; ) { MethodNode method = ( MethodNode ) iter . next ( ) ; if ( method . hasDefaultValue ( ) ) { addDefaultParameters ( action , method ) ; } } } protected void addDefaultParameters ( DefaultArgsAction action , MethodNode method ) { Parameter [ ] parameters = method . getParameters ( ) ; int counter = <NUM_LIT:0> ; List paramValues = new ArrayList ( ) ; int size = parameters . length ; for ( int i = size - <NUM_LIT:1> ; i >= <NUM_LIT:0> ; i -- ) { Parameter parameter = parameters [ i ] ; if ( parameter != null && parameter . hasInitialExpression ( ) ) { paramValues . add ( Integer . valueOf ( i ) ) ; paramValues . add ( new CastExpression ( parameter . getType ( ) , parameter . getInitialExpression ( ) ) ) ; counter ++ ; } } for ( int j = <NUM_LIT:1> ; j <= counter ; j ++ ) { Parameter [ ] newParams = new Parameter [ parameters . length - j ] ; ArgumentListExpression arguments = new ArgumentListExpression ( ) ; int index = <NUM_LIT:0> ; int k = <NUM_LIT:1> ; for ( int i = <NUM_LIT:0> ; i < parameters . length ; i ++ ) { if ( k > counter - j && parameters [ i ] != null && parameters [ i ] . hasInitialExpression ( ) ) { arguments . addExpression ( new CastExpression ( parameters [ i ] . getType ( ) , parameters [ i ] . getInitialExpression ( ) ) ) ; k ++ ; } else if ( parameters [ i ] != null && parameters [ i ] . hasInitialExpression ( ) ) { newParams [ index ++ ] = parameters [ i ] ; arguments . addExpression ( new CastExpression ( parameters [ i ] . getType ( ) , new VariableExpression ( parameters [ i ] . getName ( ) ) ) ) ; k ++ ; } else { newParams [ index ++ ] = parameters [ i ] ; arguments . addExpression ( new CastExpression ( parameters [ i ] . getType ( ) , new VariableExpression ( parameters [ i ] . getName ( ) ) ) ) ; } } action . call ( arguments , newParams , method ) ; } for ( Parameter parameter : parameters ) { parameter . putNodeMetaData ( Verifier . INITIAL_EXPRESSION , parameter . getInitialExpression ( ) ) ; parameter . setInitialExpression ( null ) ; } } protected void addClosureCode ( InnerClassNode node ) { } protected void addInitialization ( final ClassNode node ) { boolean addSwapInit = moveOptimizedConstantsInitialization ( node ) ; for ( ConstructorNode cn : node . getDeclaredConstructors ( ) ) { addInitialization ( node , cn ) ; } if ( addSwapInit ) { BytecodeSequence seq = new BytecodeSequence ( new BytecodeInstruction ( ) { @ Override public void visit ( MethodVisitor mv ) { mv . visitMethodInsn ( INVOKESTATIC , BytecodeHelper . getClassInternalName ( node ) , SWAP_INIT , "<STR_LIT>" ) ; } } ) ; List < Statement > swapCall = new ArrayList < Statement > ( <NUM_LIT:1> ) ; swapCall . add ( seq ) ; node . addStaticInitializerStatements ( swapCall , true ) ; } } protected void addInitialization ( ClassNode node , ConstructorNode constructorNode ) { Statement firstStatement = constructorNode . getFirstStatement ( ) ; if ( firstStatement instanceof BytecodeSequence ) return ; ConstructorCallExpression first = getFirstIfSpecialConstructorCall ( firstStatement ) ; if ( first != null && ( first . isThisCall ( ) ) ) return ; List < Statement > statements = new ArrayList < Statement > ( ) ; List < Statement > staticStatements = new ArrayList < Statement > ( ) ; final boolean isEnum = node . isEnum ( ) ; List < Statement > initStmtsAfterEnumValuesInit = new ArrayList < Statement > ( ) ; Set < String > explicitStaticPropsInEnum = new HashSet < String > ( ) ; if ( isEnum ) { for ( PropertyNode propNode : node . getProperties ( ) ) { if ( ! propNode . isSynthetic ( ) && propNode . getField ( ) . isStatic ( ) ) { explicitStaticPropsInEnum . add ( propNode . getField ( ) . getName ( ) ) ; } } for ( FieldNode fieldNode : node . getFields ( ) ) { if ( ! fieldNode . isSynthetic ( ) && fieldNode . isStatic ( ) && fieldNode . getType ( ) != node ) { explicitStaticPropsInEnum . add ( fieldNode . getName ( ) ) ; } } } if ( inlineFieldInitializersIntoInit ) { for ( FieldNode fn : node . getFields ( ) ) { addFieldInitialization ( statements , staticStatements , fn , isEnum , initStmtsAfterEnumValuesInit , explicitStaticPropsInEnum ) ; } } statements . addAll ( node . getObjectInitializerStatements ( ) ) ; Statement code = constructorNode . getCode ( ) ; BlockStatement block = new BlockStatement ( ) ; List < Statement > otherStatements = block . getStatements ( ) ; if ( code instanceof BlockStatement ) { block = ( BlockStatement ) code ; otherStatements = block . getStatements ( ) ; } else if ( code != null ) { otherStatements . add ( code ) ; } if ( ! otherStatements . isEmpty ( ) ) { if ( first != null ) { otherStatements . remove ( <NUM_LIT:0> ) ; statements . add ( <NUM_LIT:0> , firstStatement ) ; } Statement stmtThis$0 = getImplicitThis$0StmtIfInnerClass ( otherStatements ) ; if ( stmtThis$0 != null ) { statements . add ( <NUM_LIT:0> , stmtThis$0 ) ; } statements . addAll ( otherStatements ) ; } BlockStatement newBlock = new BlockStatement ( statements , block . getVariableScope ( ) ) ; newBlock . setSourcePosition ( block ) ; constructorNode . setCode ( newBlock ) ; if ( ! staticStatements . isEmpty ( ) ) { if ( isEnum ) { staticStatements . removeAll ( initStmtsAfterEnumValuesInit ) ; node . addStaticInitializerStatements ( staticStatements , true ) ; if ( ! initStmtsAfterEnumValuesInit . isEmpty ( ) ) { node . positionStmtsAfterEnumInitStmts ( initStmtsAfterEnumValuesInit ) ; } } else { node . addStaticInitializerStatements ( staticStatements , true ) ; } } } private Statement getImplicitThis$0StmtIfInnerClass ( List < Statement > otherStatements ) { if ( ! ( classNode instanceof InnerClassNode ) ) return null ; for ( Statement stmt : otherStatements ) { if ( stmt instanceof BlockStatement ) { List < Statement > stmts = ( ( BlockStatement ) stmt ) . getStatements ( ) ; for ( Statement bstmt : stmts ) { if ( bstmt instanceof ExpressionStatement ) { if ( extractImplicitThis$0StmtIfInnerClassFromExpression ( stmts , bstmt ) ) return bstmt ; } } } else if ( stmt instanceof ExpressionStatement ) { if ( extractImplicitThis$0StmtIfInnerClassFromExpression ( otherStatements , stmt ) ) return stmt ; } } return null ; } private boolean extractImplicitThis$0StmtIfInnerClassFromExpression ( final List < Statement > stmts , final Statement bstmt ) { Expression expr = ( ( ExpressionStatement ) bstmt ) . getExpression ( ) ; if ( expr instanceof BinaryExpression && expr . getClass ( ) == BinaryExpression . class ) { Expression lExpr = ( ( BinaryExpression ) expr ) . getLeftExpression ( ) ; if ( lExpr instanceof FieldExpression ) { if ( "<STR_LIT>" . equals ( ( ( FieldExpression ) lExpr ) . getFieldName ( ) ) ) { stmts . remove ( bstmt ) ; return true ; } } } return false ; } private ConstructorCallExpression getFirstIfSpecialConstructorCall ( Statement code ) { if ( code == null || ! ( code instanceof ExpressionStatement ) ) return null ; Expression expression = ( ( ExpressionStatement ) code ) . getExpression ( ) ; if ( ! ( expression instanceof ConstructorCallExpression ) ) return null ; ConstructorCallExpression cce = ( ConstructorCallExpression ) expression ; if ( cce . isSpecialCall ( ) ) return cce ; return null ; } protected void addFieldInitialization ( List list , List staticList , FieldNode fieldNode , boolean isEnumClassNode , List initStmtsAfterEnumValuesInit , Set explicitStaticPropsInEnum ) { Expression expression = fieldNode . getInitialExpression ( ) ; if ( expression != null ) { final FieldExpression fe = new FieldExpression ( fieldNode ) ; if ( fieldNode . getType ( ) . equals ( ClassHelper . REFERENCE_TYPE ) && ( ( fieldNode . getModifiers ( ) & Opcodes . ACC_SYNTHETIC ) != <NUM_LIT:0> ) ) { fe . setUseReferenceDirectly ( true ) ; } ExpressionStatement statement = new ExpressionStatement ( new BinaryExpression ( fe , Token . newSymbol ( Types . EQUAL , fieldNode . getLineNumber ( ) , fieldNode . getColumnNumber ( ) ) , expression ) ) ; if ( fieldNode . isStatic ( ) ) { if ( inlineStaticFieldInitializersIntoClinit ) { Expression initialValueExpression = fieldNode . getInitialValueExpression ( ) ; if ( initialValueExpression instanceof ConstantExpression ) { ConstantExpression cexp = ( ConstantExpression ) initialValueExpression ; cexp = transformToPrimitiveConstantIfPossible ( cexp ) ; if ( fieldNode . isFinal ( ) && ClassHelper . isStaticConstantInitializerType ( cexp . getType ( ) ) && cexp . getType ( ) . equals ( fieldNode . getType ( ) ) ) { return ; } staticList . add ( <NUM_LIT:0> , statement ) ; } else { staticList . add ( statement ) ; } fieldNode . setInitialValueExpression ( null ) ; } if ( isEnumClassNode && explicitStaticPropsInEnum . contains ( fieldNode . getName ( ) ) ) { initStmtsAfterEnumValuesInit . add ( statement ) ; } } else { list . add ( statement ) ; } } } public static String capitalize ( String name ) { return MetaClassHelper . capitalize ( name ) ; } protected Statement createGetterBlock ( PropertyNode propertyNode , final FieldNode field ) { return new BytecodeSequence ( new BytecodeInstruction ( ) { public void visit ( MethodVisitor mv ) { if ( field . isStatic ( ) ) { mv . visitFieldInsn ( GETSTATIC , BytecodeHelper . getClassInternalName ( classNode ) , field . getName ( ) , BytecodeHelper . getTypeDescription ( field . getType ( ) ) ) ; } else { mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; mv . visitFieldInsn ( GETFIELD , BytecodeHelper . getClassInternalName ( classNode ) , field . getName ( ) , BytecodeHelper . getTypeDescription ( field . getType ( ) ) ) ; } BytecodeHelper . doReturn ( mv , field . getType ( ) ) ; } } ) ; } protected Statement createSetterBlock ( PropertyNode propertyNode , final FieldNode field ) { return new BytecodeSequence ( new BytecodeInstruction ( ) { public void visit ( MethodVisitor mv ) { if ( field . isStatic ( ) ) { BytecodeHelper . load ( mv , field . getType ( ) , <NUM_LIT:0> ) ; mv . visitFieldInsn ( PUTSTATIC , BytecodeHelper . getClassInternalName ( classNode ) , field . getName ( ) , BytecodeHelper . getTypeDescription ( field . getType ( ) ) ) ; } else { mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; BytecodeHelper . load ( mv , field . getType ( ) , <NUM_LIT:1> ) ; mv . visitFieldInsn ( PUTFIELD , BytecodeHelper . getClassInternalName ( classNode ) , field . getName ( ) , BytecodeHelper . getTypeDescription ( field . getType ( ) ) ) ; } mv . visitInsn ( RETURN ) ; } } ) ; } public void visitGenericType ( GenericsType genericsType ) { } public static long getTimestamp ( Class clazz ) { if ( clazz . getClassLoader ( ) instanceof GroovyClassLoader . InnerLoader ) { GroovyClassLoader . InnerLoader innerLoader = ( GroovyClassLoader . InnerLoader ) clazz . getClassLoader ( ) ; return innerLoader . getTimeStamp ( ) ; } final Field [ ] fields = clazz . getFields ( ) ; for ( int i = <NUM_LIT:0> ; i != fields . length ; ++ i ) { if ( Modifier . isStatic ( fields [ i ] . getModifiers ( ) ) ) { final String name = fields [ i ] . getName ( ) ; if ( name . startsWith ( __TIMESTAMP__ ) ) { try { return Long . decode ( name . substring ( __TIMESTAMP__ . length ( ) ) ) . longValue ( ) ; } catch ( NumberFormatException e ) { return Long . MAX_VALUE ; } } } } return Long . MAX_VALUE ; } protected void addCovariantMethods ( ClassNode classNode ) { Map methodsToAdd = new HashMap ( ) ; Map genericsSpec = new HashMap ( ) ; Map abstractMethods = new HashMap ( ) ; Map < String , MethodNode > allInterfaceMethods = new HashMap < String , MethodNode > ( ) ; ClassNode [ ] interfaces = classNode . getInterfaces ( ) ; for ( ClassNode iface : interfaces ) { Map ifaceMethodsMap = iface . getDeclaredMethodsMap ( ) ; abstractMethods . putAll ( ifaceMethodsMap ) ; allInterfaceMethods . putAll ( ifaceMethodsMap ) ; } collectSuperInterfaceMethods ( classNode , allInterfaceMethods ) ; List < MethodNode > declaredMethods = new ArrayList < MethodNode > ( classNode . getMethods ( ) ) ; for ( Iterator methodsIterator = declaredMethods . iterator ( ) ; methodsIterator . hasNext ( ) ; ) { MethodNode m = ( MethodNode ) methodsIterator . next ( ) ; abstractMethods . remove ( m . getTypeDescriptor ( ) ) ; if ( m . isStatic ( ) || ! ( m . isPublic ( ) || m . isProtected ( ) ) ) { methodsIterator . remove ( ) ; } MethodNode intfMethod = allInterfaceMethods . get ( m . getTypeDescriptor ( ) ) ; if ( intfMethod != null && ( ( m . getModifiers ( ) & ACC_SYNTHETIC ) == <NUM_LIT:0> ) && ! m . isPublic ( ) && ! m . isStaticConstructor ( ) ) { throw new RuntimeParserException ( "<STR_LIT>" + m . getName ( ) + "<STR_LIT>" + intfMethod . getDeclaringClass ( ) , m ) ; } } addCovariantMethods ( classNode , declaredMethods , abstractMethods , methodsToAdd , genericsSpec ) ; Map < String , MethodNode > declaredMethodsMap = new HashMap < String , MethodNode > ( ) ; if ( methodsToAdd . size ( ) > <NUM_LIT:0> ) { for ( MethodNode mn : declaredMethods ) { declaredMethodsMap . put ( mn . getTypeDescriptor ( ) , mn ) ; } } for ( Object o : methodsToAdd . entrySet ( ) ) { Map . Entry entry = ( Map . Entry ) o ; MethodNode method = ( MethodNode ) entry . getValue ( ) ; MethodNode mn = declaredMethodsMap . get ( entry . getKey ( ) ) ; if ( mn != null && mn . getDeclaringClass ( ) . equals ( classNode ) ) continue ; addPropertyMethod ( method ) ; } } private void collectSuperInterfaceMethods ( ClassNode cn , Map < String , MethodNode > allInterfaceMethods ) { List cnInterfaces = Arrays . asList ( cn . getInterfaces ( ) ) ; ClassNode sn = cn . getSuperClass ( ) ; while ( sn != null && ! sn . equals ( ClassHelper . OBJECT_TYPE ) ) { ClassNode [ ] interfaces = sn . getInterfaces ( ) ; for ( ClassNode iface : interfaces ) { if ( ! cnInterfaces . contains ( iface ) ) { Map < String , MethodNode > ifaceMethodsMap = iface . getDeclaredMethodsMap ( ) ; allInterfaceMethods . putAll ( ifaceMethodsMap ) ; } } sn = sn . getSuperClass ( ) ; } } private void addCovariantMethods ( ClassNode classNode , List declaredMethods , Map abstractMethods , Map methodsToAdd , Map oldGenericsSpec ) { ClassNode sn = classNode . getUnresolvedSuperClass ( false ) ; if ( sn != null ) { Map genericsSpec = createGenericsSpec ( sn , oldGenericsSpec ) ; List < MethodNode > classMethods = sn . getMethods ( ) ; for ( Object declaredMethod : declaredMethods ) { MethodNode method = ( MethodNode ) declaredMethod ; if ( method . isStatic ( ) ) continue ; storeMissingCovariantMethods ( classMethods , method , methodsToAdd , genericsSpec ) ; } if ( ! abstractMethods . isEmpty ( ) ) { for ( Object classMethod : classMethods ) { MethodNode method = ( MethodNode ) classMethod ; if ( method . isStatic ( ) ) continue ; storeMissingCovariantMethods ( abstractMethods . values ( ) , method , methodsToAdd , Collections . EMPTY_MAP ) ; } } addCovariantMethods ( sn . redirect ( ) , declaredMethods , abstractMethods , methodsToAdd , genericsSpec ) ; } ClassNode [ ] interfaces = classNode . getInterfaces ( ) ; for ( ClassNode anInterface : interfaces ) { List interfacesMethods = anInterface . getMethods ( ) ; Map genericsSpec = createGenericsSpec ( anInterface , oldGenericsSpec ) ; for ( Object declaredMethod : declaredMethods ) { MethodNode method = ( MethodNode ) declaredMethod ; if ( method . isStatic ( ) ) continue ; storeMissingCovariantMethods ( interfacesMethods , method , methodsToAdd , genericsSpec ) ; } addCovariantMethods ( anInterface , declaredMethods , abstractMethods , methodsToAdd , genericsSpec ) ; } } private MethodNode getCovariantImplementation ( final MethodNode oldMethod , final MethodNode overridingMethod , Map genericsSpec ) { if ( ! oldMethod . getName ( ) . equals ( overridingMethod . getName ( ) ) ) return null ; if ( ( overridingMethod . getModifiers ( ) & ACC_BRIDGE ) != <NUM_LIT:0> ) return null ; boolean normalEqualParameters = equalParametersNormal ( overridingMethod , oldMethod ) ; boolean genericEqualParameters = equalParametersWithGenerics ( overridingMethod , oldMethod , genericsSpec ) ; if ( ! normalEqualParameters && ! genericEqualParameters ) return null ; ClassNode mr = overridingMethod . getReturnType ( ) ; ClassNode omr = oldMethod . getReturnType ( ) ; boolean equalReturnType = mr . equals ( omr ) ; if ( equalReturnType && normalEqualParameters ) return null ; ClassNode testmr = correctToGenericsSpec ( genericsSpec , omr ) ; if ( ! isAssignable ( mr , testmr ) ) { throw new RuntimeParserException ( "<STR_LIT>" + overridingMethod . getTypeDescriptor ( ) + "<STR_LIT>" + overridingMethod . getDeclaringClass ( ) . getName ( ) + "<STR_LIT>" + oldMethod . getTypeDescriptor ( ) + "<STR_LIT>" + oldMethod . getDeclaringClass ( ) . getName ( ) , overridingMethod ) ; } if ( ( oldMethod . getModifiers ( ) & ACC_FINAL ) != <NUM_LIT:0> ) { throw new RuntimeParserException ( "<STR_LIT>" + oldMethod . getTypeDescriptor ( ) + "<STR_LIT>" + oldMethod . getDeclaringClass ( ) . getName ( ) , overridingMethod ) ; } if ( oldMethod . isStatic ( ) != overridingMethod . isStatic ( ) ) { throw new RuntimeParserException ( "<STR_LIT>" + oldMethod . getTypeDescriptor ( ) + "<STR_LIT>" + oldMethod . getDeclaringClass ( ) . getName ( ) + "<STR_LIT>" , overridingMethod ) ; } if ( ! equalReturnType ) { boolean oldM = ClassHelper . isPrimitiveType ( oldMethod . getReturnType ( ) ) ; boolean newM = ClassHelper . isPrimitiveType ( overridingMethod . getReturnType ( ) ) ; if ( oldM || newM ) { String message = "<STR_LIT>" ; if ( oldM && newM ) { message = "<STR_LIT>" ; } else if ( newM ) { message = "<STR_LIT>" ; } else if ( oldM ) { message = "<STR_LIT>" ; } throw new RuntimeParserException ( "<STR_LIT>" + oldMethod . getTypeDescriptor ( ) + "<STR_LIT>" + oldMethod . getDeclaringClass ( ) . getName ( ) + message , overridingMethod ) ; } } MethodNode newMethod = new MethodNode ( oldMethod . getName ( ) , overridingMethod . getModifiers ( ) | ACC_SYNTHETIC | ACC_BRIDGE , oldMethod . getReturnType ( ) . getPlainNodeReference ( ) , cleanParameters ( oldMethod . getParameters ( ) ) , oldMethod . getExceptions ( ) , null ) ; List instructions = new ArrayList ( <NUM_LIT:1> ) ; instructions . add ( new BytecodeInstruction ( ) { public void visit ( MethodVisitor mv ) { mv . visitVarInsn ( ALOAD , <NUM_LIT:0> ) ; Parameter [ ] para = oldMethod . getParameters ( ) ; Parameter [ ] goal = overridingMethod . getParameters ( ) ; int doubleSlotOffset = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < para . length ; i ++ ) { ClassNode type = para [ i ] . getType ( ) ; BytecodeHelper . load ( mv , type , i + <NUM_LIT:1> + doubleSlotOffset ) ; if ( type . redirect ( ) == ClassHelper . double_TYPE || type . redirect ( ) == ClassHelper . long_TYPE ) { doubleSlotOffset ++ ; } if ( ! type . equals ( goal [ i ] . getType ( ) ) ) { BytecodeHelper . doCast ( mv , goal [ i ] . getType ( ) ) ; } } mv . visitMethodInsn ( INVOKEVIRTUAL , BytecodeHelper . getClassInternalName ( classNode ) , overridingMethod . getName ( ) , BytecodeHelper . getMethodDescriptor ( overridingMethod . getReturnType ( ) , overridingMethod . getParameters ( ) ) ) ; BytecodeHelper . doReturn ( mv , oldMethod . getReturnType ( ) ) ; } } ) ; newMethod . setCode ( new BytecodeSequence ( instructions ) ) ; return newMethod ; } private boolean isAssignable ( ClassNode node , ClassNode testNode ) { if ( testNode . isInterface ( ) ) { if ( node . equals ( testNode ) || node . implementsInterface ( testNode ) ) return true ; } else { if ( node . isDerivedFrom ( testNode ) ) return true ; } return false ; } private Parameter [ ] cleanParameters ( Parameter [ ] parameters ) { Parameter [ ] params = new Parameter [ parameters . length ] ; for ( int i = <NUM_LIT:0> ; i < params . length ; i ++ ) { params [ i ] = new Parameter ( parameters [ i ] . getType ( ) . getPlainNodeReference ( ) , parameters [ i ] . getName ( ) ) ; } return params ; } private void storeMissingCovariantMethods ( Collection methods , MethodNode method , Map methodsToAdd , Map genericsSpec ) { for ( Object method1 : methods ) { MethodNode toOverride = ( MethodNode ) method1 ; MethodNode bridgeMethod = getCovariantImplementation ( toOverride , method , genericsSpec ) ; if ( bridgeMethod == null ) continue ; methodsToAdd . put ( bridgeMethod . getTypeDescriptor ( ) , bridgeMethod ) ; return ; } } private ClassNode correctToGenericsSpec ( Map genericsSpec , GenericsType type ) { ClassNode ret = null ; if ( type . isPlaceholder ( ) ) { String name = type . getName ( ) ; ret = ( ClassNode ) genericsSpec . get ( name ) ; } if ( ret == null ) ret = type . getType ( ) ; return ret ; } private ClassNode correctToGenericsSpec ( Map genericsSpec , ClassNode type ) { if ( type . isGenericsPlaceHolder ( ) ) { String name = type . getGenericsTypes ( ) [ <NUM_LIT:0> ] . getName ( ) ; type = ( ClassNode ) genericsSpec . get ( name ) ; } if ( type == null ) type = ClassHelper . OBJECT_TYPE ; return type ; } private boolean equalParametersNormal ( MethodNode m1 , MethodNode m2 ) { Parameter [ ] p1 = m1 . getParameters ( ) ; Parameter [ ] p2 = m2 . getParameters ( ) ; if ( p1 . length != p2 . length ) return false ; for ( int i = <NUM_LIT:0> ; i < p2 . length ; i ++ ) { ClassNode type = p2 [ i ] . getType ( ) ; ClassNode parameterType = p1 [ i ] . getType ( ) ; if ( ! parameterType . equals ( type ) ) return false ; } return true ; } private boolean equalParametersWithGenerics ( MethodNode m1 , MethodNode m2 , Map genericsSpec ) { Parameter [ ] p1 = m1 . getParameters ( ) ; Parameter [ ] p2 = m2 . getParameters ( ) ; if ( p1 . length != p2 . length ) return false ; for ( int i = <NUM_LIT:0> ; i < p2 . length ; i ++ ) { ClassNode type = p2 [ i ] . getType ( ) ; ClassNode genericsType = correctToGenericsSpec ( genericsSpec , type ) ; ClassNode parameterType = p1 [ i ] . getType ( ) ; if ( ! parameterType . equals ( genericsType ) ) return false ; } return true ; } private Map createGenericsSpec ( ClassNode current , Map oldSpec ) { Map ret = new HashMap ( oldSpec ) ; GenericsType [ ] sgts = current . getGenericsTypes ( ) ; if ( sgts != null ) { ClassNode [ ] spec = new ClassNode [ sgts . length ] ; for ( int i = <NUM_LIT:0> ; i < spec . length ; i ++ ) { spec [ i ] = correctToGenericsSpec ( ret , sgts [ i ] ) ; } GenericsType [ ] newGts = current . redirect ( ) . getGenericsTypes ( ) ; if ( newGts == null ) return ret ; ret . clear ( ) ; for ( int i = <NUM_LIT:0> ; i < spec . length ; i ++ ) { ret . put ( newGts [ i ] . getName ( ) , spec [ i ] ) ; } } return ret ; } private boolean moveOptimizedConstantsInitialization ( final ClassNode node ) { if ( node . isInterface ( ) ) return false ; final int mods = Opcodes . ACC_STATIC | Opcodes . ACC_SYNTHETIC | Opcodes . ACC_PUBLIC ; String name = SWAP_INIT ; BlockStatement methodCode = new BlockStatement ( ) ; node . addSyntheticMethod ( name , mods , ClassHelper . VOID_TYPE , Parameter . EMPTY_ARRAY , ClassNode . EMPTY_ARRAY , methodCode ) ; methodCode . addStatement ( new SwapInitStatement ( ) ) ; for ( FieldNode fn : node . getFields ( ) ) { if ( ! fn . isStatic ( ) || ! fn . isSynthetic ( ) || ! fn . getName ( ) . startsWith ( "<STR_LIT>" ) ) continue ; if ( fn . getInitialExpression ( ) == null ) continue ; final FieldExpression fe = new FieldExpression ( fn ) ; if ( fn . getType ( ) . equals ( ClassHelper . REFERENCE_TYPE ) ) fe . setUseReferenceDirectly ( true ) ; ConstantExpression init = ( ConstantExpression ) fn . getInitialExpression ( ) ; ExpressionStatement statement = new ExpressionStatement ( new BinaryExpression ( fe , Token . newSymbol ( Types . EQUAL , fn . getLineNumber ( ) , fn . getColumnNumber ( ) ) , init ) ) ; fn . setInitialValueExpression ( null ) ; init . setConstantName ( null ) ; methodCode . addStatement ( statement ) ; } return true ; } public static ConstantExpression transformToPrimitiveConstantIfPossible ( ConstantExpression constantExpression ) { Object value = constantExpression . getValue ( ) ; if ( value == null ) return constantExpression ; ConstantExpression result ; ClassNode type = constantExpression . getType ( ) ; if ( ClassHelper . isPrimitiveType ( type ) ) return constantExpression ; if ( value instanceof String && ( ( String ) value ) . length ( ) == <NUM_LIT:1> ) { result = new ConstantExpression ( ( ( String ) value ) . charAt ( <NUM_LIT:0> ) ) ; result . setType ( ClassHelper . char_TYPE ) ; } else { type = ClassHelper . getUnwrapper ( type ) ; result = new ConstantExpression ( value , true ) ; result . setType ( type ) ; } return result ; } private static class SwapInitStatement extends BytecodeSequence { private WriterController controller ; public SwapInitStatement ( ) { super ( new SwapInitInstruction ( ) ) ; ( ( SwapInitInstruction ) getInstructions ( ) . get ( <NUM_LIT:0> ) ) . statement = this ; } @ Override public void visit ( final GroovyCodeVisitor visitor ) { if ( visitor instanceof AsmClassGenerator ) { AsmClassGenerator generator = ( AsmClassGenerator ) visitor ; controller = generator . getController ( ) ; } super . visit ( visitor ) ; } private static class SwapInitInstruction extends BytecodeInstruction { SwapInitStatement statement ; @ Override public void visit ( final MethodVisitor mv ) { statement . controller . getCallSiteWriter ( ) . makeCallSiteArrayInitializer ( ) ; } } } } </s>
|
<s> package org . codehaus . groovy . classgen ; import java . util . * ; import java . lang . reflect . Field ; import java . lang . reflect . Modifier ; import org . codehaus . groovy . ast . * ; import org . codehaus . groovy . ast . stmt . ReturnStatement ; import org . codehaus . groovy . ast . expr . * ; import org . codehaus . groovy . control . ErrorCollector ; import org . codehaus . groovy . control . SourceUnit ; import org . codehaus . groovy . control . messages . SyntaxErrorMessage ; import org . codehaus . groovy . syntax . SyntaxException ; import org . codehaus . groovy . vmplugin . VMPluginFactory ; public class AnnotationVisitor { private SourceUnit source ; private ErrorCollector errorCollector ; private AnnotationNode annotation ; private ClassNode reportClass ; public AnnotationVisitor ( SourceUnit source , ErrorCollector errorCollector ) { this . source = source ; this . errorCollector = errorCollector ; } public void setReportClass ( ClassNode cn ) { reportClass = cn ; } public AnnotationNode visit ( AnnotationNode node ) { this . annotation = node ; this . reportClass = node . getClassNode ( ) ; if ( ! isValidAnnotationClass ( node . getClassNode ( ) ) ) { addError ( "<STR_LIT>" + node . getClassNode ( ) . getName ( ) + "<STR_LIT>" ) ; return node ; } if ( ! checkIfMandatoryAnnotationValuesPassed ( node ) ) { return node ; } if ( ! checkIfValidEnumConstsAreUsed ( node ) ) { return node ; } Map < String , Expression > attributes = node . getMembers ( ) ; for ( Map . Entry < String , Expression > entry : attributes . entrySet ( ) ) { String attrName = entry . getKey ( ) ; Expression attrExpr = transformInlineConstants ( entry . getValue ( ) ) ; entry . setValue ( attrExpr ) ; ClassNode attrType = getAttributeType ( node , attrName ) ; visitExpression ( attrName , attrExpr , attrType ) ; } VMPluginFactory . getPlugin ( ) . configureAnnotation ( node ) ; return this . annotation ; } private boolean checkIfValidEnumConstsAreUsed ( AnnotationNode node ) { boolean ok = true ; Map < String , Expression > attributes = node . getMembers ( ) ; for ( Map . Entry < String , Expression > entry : attributes . entrySet ( ) ) { ok &= validateEnumConstant ( entry . getValue ( ) ) ; } return ok ; } private boolean validateEnumConstant ( Expression exp ) { if ( exp instanceof PropertyExpression ) { PropertyExpression pe = ( PropertyExpression ) exp ; String name = pe . getPropertyAsString ( ) ; if ( pe . getObjectExpression ( ) instanceof ClassExpression && name != null ) { ClassExpression ce = ( ClassExpression ) pe . getObjectExpression ( ) ; ClassNode type = ce . getType ( ) ; if ( type . isEnum ( ) ) { boolean ok = false ; try { FieldNode enumField = type . getDeclaredField ( name ) ; ok = enumField != null && enumField . getType ( ) . equals ( type ) ; } catch ( Exception ex ) { } if ( ! ok ) { addError ( "<STR_LIT>" + type . getName ( ) + "<STR_LIT:.>" + name , pe ) ; return false ; } } } } return true ; } private Expression transformInlineConstants ( Expression exp ) { if ( exp instanceof PropertyExpression ) { PropertyExpression pe = ( PropertyExpression ) exp ; if ( pe . getObjectExpression ( ) instanceof ClassExpression ) { ClassExpression ce = ( ClassExpression ) pe . getObjectExpression ( ) ; ClassNode type = ce . getType ( ) ; if ( type . isEnum ( ) || ! type . isResolved ( ) ) return exp ; try { type . getFields ( ) ; if ( type . hasClass ( ) ) { Field field = type . getTypeClass ( ) . getField ( pe . getPropertyAsString ( ) ) ; if ( field != null && Modifier . isStatic ( field . getModifiers ( ) ) && Modifier . isFinal ( field . getModifiers ( ) ) ) { return new ConstantExpression ( field . get ( null ) ) ; } } else { FieldNode fieldNode = type . getField ( pe . getPropertyAsString ( ) ) ; if ( fieldNode != null && Modifier . isStatic ( fieldNode . getModifiers ( ) ) && Modifier . isFinal ( fieldNode . getModifiers ( ) ) ) { Expression e = fieldNode . getInitialExpression ( ) ; return ( ConstantExpression ) e ; } } } catch ( Exception e ) { } } } else if ( exp instanceof ListExpression ) { ListExpression le = ( ListExpression ) exp ; ListExpression result = new ListExpression ( ) ; for ( Expression e : le . getExpressions ( ) ) { result . addExpression ( transformInlineConstants ( e ) ) ; } return result ; } return exp ; } private boolean checkIfMandatoryAnnotationValuesPassed ( AnnotationNode node ) { boolean ok = true ; Map attributes = node . getMembers ( ) ; ClassNode classNode = node . getClassNode ( ) ; for ( MethodNode mn : classNode . getMethods ( ) ) { String methodName = mn . getName ( ) ; } return ok ; } private ClassNode getAttributeType ( AnnotationNode node , String attrName ) { ClassNode classNode = node . getClassNode ( ) ; List methods = classNode . getMethods ( attrName ) ; if ( methods . size ( ) == <NUM_LIT:0> ) { addError ( "<STR_LIT:'>" + attrName + "<STR_LIT>" + classNode , node ) ; return ClassHelper . OBJECT_TYPE ; } MethodNode method = ( MethodNode ) methods . get ( <NUM_LIT:0> ) ; return method . getReturnType ( ) ; } private boolean isValidAnnotationClass ( ClassNode node ) { return node . implementsInterface ( ClassHelper . Annotation_TYPE ) ; } protected void visitExpression ( String attrName , Expression attrExp , ClassNode attrType ) { if ( attrType . isArray ( ) ) { if ( attrExp instanceof ListExpression ) { ListExpression le = ( ListExpression ) attrExp ; visitListExpression ( attrName , le , attrType . getComponentType ( ) ) ; } else if ( attrExp instanceof ClosureExpression ) { addError ( "<STR_LIT>" , attrExp ) ; } else { ListExpression listExp = new ListExpression ( ) ; listExp . addExpression ( attrExp ) ; if ( annotation != null ) { annotation . setMember ( attrName , listExp ) ; } visitExpression ( attrName , listExp , attrType ) ; } } else if ( ClassHelper . isPrimitiveType ( attrType ) ) { visitConstantExpression ( attrName , getConstantExpression ( attrExp , attrType ) , ClassHelper . getWrapper ( attrType ) ) ; } else if ( ClassHelper . STRING_TYPE . equals ( attrType ) ) { visitConstantExpression ( attrName , getConstantExpression ( attrExp , attrType ) , ClassHelper . STRING_TYPE ) ; } else if ( ClassHelper . CLASS_Type . equals ( attrType ) ) { if ( ! ( attrExp instanceof ClassExpression || attrExp instanceof ClosureExpression ) ) { addError ( "<STR_LIT>" + attrName + "<STR_LIT:'>" , attrExp ) ; } } else if ( attrType . isDerivedFrom ( ClassHelper . Enum_Type ) ) { if ( attrExp instanceof PropertyExpression ) { visitEnumExpression ( attrName , ( PropertyExpression ) attrExp , attrType ) ; } else { addError ( "<STR_LIT>" + attrName , attrExp ) ; } } else if ( isValidAnnotationClass ( attrType ) ) { if ( attrExp instanceof AnnotationConstantExpression ) { visitAnnotationExpression ( attrName , ( AnnotationConstantExpression ) attrExp , attrType ) ; } else { addError ( "<STR_LIT>" + attrType . getName ( ) + "<STR_LIT>" + attrName , attrExp ) ; } } else { addError ( "<STR_LIT>" + attrType . getName ( ) , attrExp ) ; } } public void checkReturnType ( ClassNode attrType , ASTNode node ) { if ( attrType . isArray ( ) ) { checkReturnType ( attrType . getComponentType ( ) , node ) ; } else if ( ClassHelper . isPrimitiveType ( attrType ) ) { return ; } else if ( ClassHelper . STRING_TYPE . equals ( attrType ) ) { return ; } else if ( ClassHelper . CLASS_Type . equals ( attrType ) ) { return ; } else if ( attrType . isDerivedFrom ( ClassHelper . Enum_Type ) ) { return ; } else if ( isValidAnnotationClass ( attrType ) ) { return ; } else { addError ( "<STR_LIT>" + attrType . getName ( ) , node ) ; } } private ConstantExpression getConstantExpression ( Expression exp , ClassNode attrType ) { if ( exp instanceof ConstantExpression ) { return ( ConstantExpression ) exp ; } else { String base = "<STR_LIT>" + exp . getText ( ) + "<STR_LIT>" + attrType . getName ( ) ; if ( exp instanceof PropertyExpression ) { addError ( base + "<STR_LIT>" , exp ) ; } else if ( exp instanceof VariableExpression && ( ( VariableExpression ) exp ) . getAccessedVariable ( ) instanceof FieldNode ) { addError ( base + "<STR_LIT>" , exp ) ; } else { addError ( base , exp ) ; } return ConstantExpression . EMPTY_EXPRESSION ; } } protected void visitAnnotationExpression ( String attrName , AnnotationConstantExpression expression , ClassNode attrType ) { AnnotationNode annotationNode = ( AnnotationNode ) expression . getValue ( ) ; AnnotationVisitor visitor = new AnnotationVisitor ( this . source , this . errorCollector ) ; visitor . visit ( annotationNode ) ; } protected void visitListExpression ( String attrName , ListExpression listExpr , ClassNode elementType ) { for ( Expression expression : listExpr . getExpressions ( ) ) { visitExpression ( attrName , expression , elementType ) ; } } protected void visitConstantExpression ( String attrName , ConstantExpression constExpr , ClassNode attrType ) { ClassNode type = ClassHelper . getWrapper ( constExpr . getType ( ) ) ; if ( ! type . isDerivedFrom ( attrType ) ) { addError ( "<STR_LIT>" + attrName + "<STR_LIT>" + attrType . getName ( ) + "<STR_LIT>" + "<STR_LIT>" + constExpr . getType ( ) . getName ( ) + "<STR_LIT:'>" , constExpr ) ; } } protected void visitEnumExpression ( String attrName , PropertyExpression propExpr , ClassNode attrType ) { if ( ! propExpr . getObjectExpression ( ) . getType ( ) . isDerivedFrom ( attrType ) ) { addError ( "<STR_LIT>" + attrName + "<STR_LIT>" + attrType . getName ( ) + "<STR_LIT>" + propExpr . getObjectExpression ( ) . getType ( ) . getName ( ) , propExpr ) ; } } protected void addError ( String msg ) { addError ( msg , this . annotation ) ; } protected void addError ( String msg , ASTNode expr ) { this . errorCollector . addErrorAndContinue ( new SyntaxErrorMessage ( new SyntaxException ( msg + "<STR_LIT>" + this . reportClass . getName ( ) + '<STR_LIT:\n>' , expr . getLineNumber ( ) , expr . getColumnNumber ( ) , expr . getLastLineNumber ( ) , expr . getLastColumnNumber ( ) ) , this . source ) ) ; } public void checkCircularReference ( ClassNode searchClass , ClassNode attrType , Expression startExp ) { if ( ! isValidAnnotationClass ( attrType ) ) return ; if ( ! ( startExp instanceof AnnotationConstantExpression ) ) { addError ( "<STR_LIT>" + startExp . getText ( ) + "<STR_LIT>" , startExp ) ; return ; } AnnotationConstantExpression ace = ( AnnotationConstantExpression ) startExp ; AnnotationNode annotationNode = ( AnnotationNode ) ace . getValue ( ) ; if ( annotationNode . getClassNode ( ) . equals ( searchClass ) ) { addError ( "<STR_LIT>" + searchClass . getName ( ) , startExp ) ; return ; } ClassNode cn = annotationNode . getClassNode ( ) ; for ( MethodNode method : cn . getMethods ( ) ) { if ( method . getReturnType ( ) . equals ( searchClass ) ) { addError ( "<STR_LIT>" + cn . getName ( ) , startExp ) ; } ReturnStatement code = ( ReturnStatement ) method . getCode ( ) ; if ( code == null ) continue ; checkCircularReference ( searchClass , method . getReturnType ( ) , code . getExpression ( ) ) ; } } } </s>
|
<s> package org . codehaus . groovy . classgen ; import org . codehaus . groovy . ast . ClassHelper ; import org . codehaus . groovy . ast . ClassNode ; import org . codehaus . groovy . ast . FieldNode ; import org . codehaus . groovy . ast . InnerClassNode ; import org . codehaus . groovy . ast . MethodNode ; import org . codehaus . groovy . ast . Parameter ; import org . codehaus . groovy . ast . PropertyNode ; import org . codehaus . groovy . ast . VariableScope ; import org . codehaus . groovy . ast . expr . ConstructorCallExpression ; import org . codehaus . groovy . ast . expr . Expression ; import org . codehaus . groovy . ast . expr . PropertyExpression ; import org . codehaus . groovy . ast . expr . TupleExpression ; import org . codehaus . groovy . ast . expr . VariableExpression ; import org . codehaus . groovy . ast . stmt . BlockStatement ; import org . codehaus . groovy . ast . stmt . ExpressionStatement ; import org . codehaus . groovy . control . CompilationUnit ; import org . codehaus . groovy . control . SourceUnit ; import org . objectweb . asm . Opcodes ; import java . util . ArrayList ; import java . util . Iterator ; import java . util . List ; public class InnerClassVisitor extends InnerClassVisitorHelper implements Opcodes { private final SourceUnit sourceUnit ; private ClassNode classNode ; private static final int PUBLIC_SYNTHETIC = Opcodes . ACC_PUBLIC + Opcodes . ACC_SYNTHETIC ; private FieldNode thisField = null ; private MethodNode currentMethod ; private FieldNode currentField ; private boolean processingObjInitStatements = false ; public InnerClassVisitor ( CompilationUnit cu , SourceUnit su ) { sourceUnit = su ; } @ Override protected SourceUnit getSourceUnit ( ) { return sourceUnit ; } @ Override public void visitClass ( ClassNode node ) { this . classNode = node ; thisField = null ; InnerClassNode innerClass = null ; if ( ! node . isEnum ( ) && ! node . isInterface ( ) && node instanceof InnerClassNode ) { innerClass = ( InnerClassNode ) node ; if ( ! isStatic ( innerClass ) && innerClass . getVariableScope ( ) == null ) { thisField = innerClass . addField ( "<STR_LIT>" , PUBLIC_SYNTHETIC , node . getOuterClass ( ) . getPlainNodeReference ( ) , null ) ; } } super . visitClass ( node ) ; if ( node . isEnum ( ) || node . isInterface ( ) ) return ; if ( innerClass == null ) return ; if ( node . getSuperClass ( ) . isInterface ( ) ) { node . addInterface ( node . getUnresolvedSuperClass ( ) ) ; node . setUnresolvedSuperClass ( ClassHelper . OBJECT_TYPE ) ; } } @ Override protected void visitObjectInitializerStatements ( ClassNode node ) { processingObjInitStatements = true ; super . visitObjectInitializerStatements ( node ) ; processingObjInitStatements = false ; } private boolean shouldHandleImplicitThisForInnerClass ( ClassNode cn ) { if ( cn . isEnum ( ) || cn . isInterface ( ) ) return false ; if ( ( cn . getModifiers ( ) & Opcodes . ACC_STATIC ) != <NUM_LIT:0> ) return false ; if ( ! ( cn instanceof InnerClassNode ) ) return false ; InnerClassNode innerClass = ( InnerClassNode ) cn ; if ( innerClass . getVariableScope ( ) != null ) return false ; return ( innerClass . getModifiers ( ) & ACC_STATIC ) == <NUM_LIT:0> ; } @ Override protected void visitConstructorOrMethod ( MethodNode node , boolean isConstructor ) { this . currentMethod = node ; visitAnnotations ( node ) ; visitClassCodeContainer ( node . getCode ( ) ) ; for ( Parameter param : node . getParameters ( ) ) { if ( param . hasInitialExpression ( ) ) { param . getInitialExpression ( ) . visit ( this ) ; } visitAnnotations ( param ) ; } this . currentMethod = null ; } @ Override public void visitField ( FieldNode node ) { this . currentField = node ; super . visitField ( node ) ; this . currentField = null ; } @ Override public void visitProperty ( PropertyNode node ) { final FieldNode field = node . getField ( ) ; final Expression init = field . getInitialExpression ( ) ; field . setInitialValueExpression ( null ) ; super . visitProperty ( node ) ; field . setInitialValueExpression ( init ) ; } @ Override public void visitConstructorCallExpression ( ConstructorCallExpression call ) { super . visitConstructorCallExpression ( call ) ; if ( ! call . isUsingAnonymousInnerClass ( ) ) { passThisReference ( call ) ; return ; } InnerClassNode innerClass = ( InnerClassNode ) call . getType ( ) ; if ( ! innerClass . getDeclaredConstructors ( ) . isEmpty ( ) ) return ; if ( ( innerClass . getModifiers ( ) & ACC_STATIC ) != <NUM_LIT:0> ) return ; VariableScope scope = innerClass . getVariableScope ( ) ; if ( scope == null ) return ; boolean isStatic = scope . isInStaticContext ( ) ; List < Expression > expressions = ( ( TupleExpression ) call . getArguments ( ) ) . getExpressions ( ) ; BlockStatement block = new BlockStatement ( ) ; final int additionalParamCount = <NUM_LIT:1> + scope . getReferencedLocalVariablesCount ( ) ; List < Parameter > parameters = new ArrayList < Parameter > ( expressions . size ( ) + additionalParamCount ) ; List < Expression > superCallArguments = new ArrayList < Expression > ( expressions . size ( ) ) ; int pCount = additionalParamCount ; for ( Expression expr : expressions ) { pCount ++ ; Parameter param = new Parameter ( ClassHelper . OBJECT_TYPE , "<STR_LIT:p>" + pCount ) ; parameters . add ( param ) ; superCallArguments . add ( new VariableExpression ( param ) ) ; } ConstructorCallExpression cce = new ConstructorCallExpression ( ClassNode . SUPER , new TupleExpression ( superCallArguments ) ) ; block . addStatement ( new ExpressionStatement ( cce ) ) ; pCount = <NUM_LIT:0> ; expressions . add ( pCount , VariableExpression . THIS_EXPRESSION ) ; ClassNode outerClassType = getClassNode ( innerClass . getOuterClass ( ) , isStatic ) . getPlainNodeReference ( ) ; Parameter thisParameter = new Parameter ( outerClassType , "<STR_LIT:p>" + pCount ) ; parameters . add ( pCount , thisParameter ) ; thisField = innerClass . addField ( "<STR_LIT>" , PUBLIC_SYNTHETIC , outerClassType , null ) ; addFieldInit ( thisParameter , thisField , block ) ; for ( Iterator it = scope . getReferencedLocalVariablesIterator ( ) ; it . hasNext ( ) ; ) { pCount ++ ; org . codehaus . groovy . ast . Variable var = ( org . codehaus . groovy . ast . Variable ) it . next ( ) ; VariableExpression ve = new VariableExpression ( var ) ; ve . setClosureSharedVariable ( true ) ; ve . setUseReferenceDirectly ( true ) ; expressions . add ( pCount , ve ) ; ClassNode rawReferenceType = ClassHelper . REFERENCE_TYPE . getPlainNodeReference ( ) ; Parameter p = new Parameter ( rawReferenceType , "<STR_LIT:p>" + pCount ) ; parameters . add ( pCount , p ) ; p . setOriginType ( var . getOriginType ( ) ) ; final VariableExpression initial = new VariableExpression ( p ) ; initial . setUseReferenceDirectly ( true ) ; final FieldNode pField = innerClass . addFieldFirst ( ve . getName ( ) , PUBLIC_SYNTHETIC , rawReferenceType , initial ) ; pField . setHolder ( true ) ; pField . setOriginType ( ClassHelper . getWrapper ( var . getOriginType ( ) ) ) ; } innerClass . addConstructor ( ACC_SYNTHETIC , parameters . toArray ( new Parameter [ <NUM_LIT:0> ] ) , ClassNode . EMPTY_ARRAY , block ) ; } private void passThisReference ( ConstructorCallExpression call ) { ClassNode cn = call . getType ( ) . redirect ( ) ; if ( ! shouldHandleImplicitThisForInnerClass ( cn ) ) return ; boolean isInStaticContext = true ; if ( currentMethod != null ) isInStaticContext = currentMethod . getVariableScope ( ) . isInStaticContext ( ) ; else if ( currentField != null ) isInStaticContext = currentField . isStatic ( ) ; else if ( processingObjInitStatements ) isInStaticContext = false ; if ( isInStaticContext ) { Expression args = call . getArguments ( ) ; if ( args instanceof TupleExpression && ( ( TupleExpression ) args ) . getExpressions ( ) . isEmpty ( ) ) { addError ( "<STR_LIT>" , call ) ; } return ; } ClassNode parent = classNode ; int level = <NUM_LIT:0> ; for ( ; parent != null && parent != cn . getOuterClass ( ) ; parent = parent . getOuterClass ( ) ) { level ++ ; } if ( parent == null ) return ; Expression argsExp = call . getArguments ( ) ; if ( argsExp instanceof TupleExpression ) { TupleExpression argsListExp = ( TupleExpression ) argsExp ; Expression this0 = VariableExpression . THIS_EXPRESSION ; for ( int i = <NUM_LIT:0> ; i != level ; ++ i ) this0 = new PropertyExpression ( this0 , "<STR_LIT>" ) ; argsListExp . getExpressions ( ) . add ( <NUM_LIT:0> , this0 ) ; } } } </s>
|
<s> package org . codehaus . groovy . syntax ; @ SuppressWarnings ( "<STR_LIT:serial>" ) public class PreciseSyntaxException extends SyntaxException { private int startOffset ; private int endOffset ; public PreciseSyntaxException ( String message , int line , int col , int startOffset , int endOffset ) { super ( message , line , col ) ; this . startOffset = startOffset ; this . endOffset = endOffset ; } public int getStartOffset ( ) { return startOffset ; } public int getEndOffset ( ) { return endOffset ; } } </s>
|
<s> package org . codehaus . groovy . ast ; import groovy . lang . GroovyClassLoader ; import java . security . CodeSource ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . Iterator ; import java . util . List ; import java . util . Map ; import org . codehaus . groovy . control . CompilerConfiguration ; import org . codehaus . groovy . control . SourceUnit ; import org . codehaus . groovy . control . messages . SyntaxErrorMessage ; import org . codehaus . groovy . syntax . SyntaxException ; public class CompileUnit { private final List < ModuleNode > modules = new ArrayList < ModuleNode > ( ) ; private List < ModuleNode > sortedModules ; private Map < String , ClassNode > classes = new HashMap < String , ClassNode > ( ) ; private CompilerConfiguration config ; private GroovyClassLoader classLoader ; private CodeSource codeSource ; private Map < String , ClassNode > classesToCompile = new HashMap < String , ClassNode > ( ) ; private Map < String , SourceUnit > classNameToSource = new HashMap < String , SourceUnit > ( ) ; private Map < String , InnerClassNode > generatedInnerClasses = new HashMap ( ) ; public CompileUnit ( GroovyClassLoader classLoader , CompilerConfiguration config ) { this ( classLoader , null , config ) ; } public CompileUnit ( GroovyClassLoader classLoader , CodeSource codeSource , CompilerConfiguration config ) { this . classLoader = classLoader ; this . config = config ; this . codeSource = codeSource ; } public List < ModuleNode > getModules ( ) { return modules ; } public void addModule ( ModuleNode node ) { if ( node == null ) return ; modules . add ( node ) ; this . sortedModules = null ; node . setUnit ( this ) ; addClasses ( node . getClasses ( ) ) ; } public ClassNode getClass ( String name ) { ClassNode cn = classes . get ( name ) ; if ( cn != null ) return cn ; return classesToCompile . get ( name ) ; } public List getClasses ( ) { List < ClassNode > answer = new ArrayList < ClassNode > ( ) ; for ( ModuleNode module : modules ) { answer . addAll ( module . getClasses ( ) ) ; } return answer ; } public CompilerConfiguration getConfig ( ) { return config ; } public GroovyClassLoader getClassLoader ( ) { return classLoader ; } public CodeSource getCodeSource ( ) { return codeSource ; } void addClasses ( List < ClassNode > classList ) { for ( ClassNode node : classList ) { addClass ( node ) ; } } public void addClass ( ClassNode node ) { node = node . redirect ( ) ; String name = node . getName ( ) ; ClassNode stored = classes . get ( name ) ; if ( stored != null && stored != node ) { SourceUnit nodeSource = node . getModule ( ) . getContext ( ) ; SourceUnit storedSource = stored . getModule ( ) . getContext ( ) ; String txt = "<STR_LIT>" + node . getName ( ) + "<STR_LIT:U+0020:U+0020>" ; if ( nodeSource == storedSource ) { txt += "<STR_LIT>" + nodeSource . getName ( ) + "<STR_LIT>" + node . getName ( ) + "<STR_LIT>" ; if ( node . isScriptBody ( ) || stored . isScriptBody ( ) ) { txt += "<STR_LIT>" + "<STR_LIT>" ; } } else { txt += "<STR_LIT>" + nodeSource . getName ( ) + "<STR_LIT:U+0020andU+0020>" + storedSource . getName ( ) + "<STR_LIT>" + node . getName ( ) + "<STR_LIT>" ; } nodeSource . getErrorCollector ( ) . addErrorAndContinue ( new SyntaxErrorMessage ( new SyntaxException ( txt , node . getLineNumber ( ) , node . getColumnNumber ( ) , node . getLastLineNumber ( ) , node . getLastColumnNumber ( ) ) , nodeSource ) ) ; } classes . put ( name , node ) ; if ( classesToCompile . containsKey ( name ) ) { ClassNode cn = classesToCompile . get ( name ) ; cn . setRedirect ( node ) ; classesToCompile . remove ( name ) ; } } public void addClassNodeToCompile ( ClassNode node , SourceUnit location ) { classesToCompile . put ( node . getName ( ) , node ) ; classNameToSource . put ( node . getName ( ) , location ) ; } public SourceUnit getScriptSourceLocation ( String className ) { return classNameToSource . get ( className ) ; } public boolean hasClassNodeToCompile ( ) { return ! classesToCompile . isEmpty ( ) ; } public Iterator < String > iterateClassNodeToCompile ( ) { return classesToCompile . keySet ( ) . iterator ( ) ; } public InnerClassNode getGeneratedInnerClass ( String name ) { return generatedInnerClasses . get ( name ) ; } public void addGeneratedInnerClass ( InnerClassNode icn ) { generatedInnerClasses . put ( icn . getName ( ) , icn ) ; } public List < ModuleNode > getSortedModules ( ) { return this . sortedModules ; } public void setSortedModules ( List < ModuleNode > sortedModules ) { this . sortedModules = sortedModules ; } } </s>
|
<s> package org . codehaus . groovy . ast ; import org . codehaus . groovy . GroovyBugError ; import org . codehaus . groovy . util . ListHashMap ; public class ASTNode { private int lineNumber = - <NUM_LIT:1> ; private int columnNumber = - <NUM_LIT:1> ; private int lastLineNumber = - <NUM_LIT:1> ; private int lastColumnNumber = - <NUM_LIT:1> ; private ListHashMap metaDataMap = new ListHashMap ( ) ; private int start = <NUM_LIT:0> ; private int end = <NUM_LIT:0> ; public void visit ( GroovyCodeVisitor visitor ) { throw new RuntimeException ( "<STR_LIT>" + getClass ( ) . getName ( ) ) ; } public String getText ( ) { return "<STR_LIT>" + getClass ( ) . getName ( ) + "<STR_LIT:>>" ; } public int getLineNumber ( ) { return lineNumber ; } public void setLineNumber ( int lineNumber ) { this . lineNumber = lineNumber ; } public int getColumnNumber ( ) { return columnNumber ; } public void setColumnNumber ( int columnNumber ) { this . columnNumber = columnNumber ; } public int getLastLineNumber ( ) { return lastLineNumber ; } public void setLastLineNumber ( int lastLineNumber ) { this . lastLineNumber = lastLineNumber ; } public int getLastColumnNumber ( ) { return lastColumnNumber ; } public void setLastColumnNumber ( int lastColumnNumber ) { this . lastColumnNumber = lastColumnNumber ; } public int getStart ( ) { return start ; } public void setStart ( int start ) { this . start = start ; } public int getEnd ( ) { return end ; } public void setEnd ( int end ) { this . end = end ; } public int getLength ( ) { return end >= <NUM_LIT:0> && start >= <NUM_LIT:0> ? end - start : - <NUM_LIT:1> ; } public void setSourcePosition ( ASTNode node ) { this . columnNumber = node . getColumnNumber ( ) ; this . lastLineNumber = node . getLastLineNumber ( ) ; this . lastColumnNumber = node . getLastColumnNumber ( ) ; this . lineNumber = node . getLineNumber ( ) ; this . start = node . getStart ( ) ; this . end = node . getEnd ( ) ; } public Object getNodeMetaData ( Object key ) { return metaDataMap . get ( key ) ; } public void copyNodeMetaData ( ASTNode other ) { metaDataMap . putAll ( other . metaDataMap ) ; } public void setNodeMetaData ( Object key , Object value ) { if ( key == null ) throw new GroovyBugError ( "<STR_LIT>" + this + "<STR_LIT:.>" ) ; Object old = metaDataMap . put ( key , value ) ; if ( old != null ) throw new GroovyBugError ( "<STR_LIT>" + this + "<STR_LIT:.>" ) ; } public Object putNodeMetaData ( Object key , Object value ) { if ( key == null ) throw new GroovyBugError ( "<STR_LIT>" + this + "<STR_LIT:.>" ) ; return metaDataMap . put ( key , value ) ; } public void removeNodeMetaData ( Object key ) { if ( key == null ) throw new GroovyBugError ( "<STR_LIT>" + this + "<STR_LIT:.>" ) ; metaDataMap . remove ( key ) ; } } </s>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.