private static void rewriteIdentifiers(N4JSGrammarAccess ga, ImmutableMap.Builder<AbstractElement, Integer> builder) { ImmutableSet<AbstractRule> identifierRules = ImmutableSet.of( ga.getBindingIdentifierRule(), ga.getIdentifierNameRule(), ga.getIDENTIFIERRule()); for (ParserRule rule : GrammarUtil.allParserRules(ga.getGrammar())) { for (EObject obj : EcoreUtil2.eAllContents(rule.getAlternatives())) { if (obj instanceof Assignment) { Assignment assignment = (Assignment) obj; AbstractElement terminal = assignment.getTerminal(); int type = InternalN4JSParser.RULE_IDENTIFIER; if (terminal instanceof CrossReference) { terminal = ((CrossReference) terminal).getTerminal(); type = IDENTIFIER_REF_TOKEN; } if (terminal instanceof RuleCall) { AbstractRule calledRule = ((RuleCall) terminal).getRule(); if (identifierRules.contains(calledRule)) { builder.put(assignment, type); } } } } } }
@Override public void sequence(ISerializationContext context, EObject semanticObject) { EPackage epackage = semanticObject.eClass().getEPackage(); ParserRule rule = context.getParserRule(); Action action = context.getAssignedAction(); Set<Parameter> parameters = context.getEnabledBooleanParameters(); if (epackage == PkmntcgoPackage.eINSTANCE) switch (semanticObject.eClass().getClassifierID()) { case PkmntcgoPackage.CARD: sequence_Card(context, (Card) semanticObject); return; case PkmntcgoPackage.DECK: sequence_Deck(context, (Deck) semanticObject); return; case PkmntcgoPackage.DECKS: sequence_Decks(context, (Decks) semanticObject); return; case PkmntcgoPackage.ENERGY: sequence_Energy(context, (Energy) semanticObject); return; case PkmntcgoPackage.POKEMON: sequence_Pokemon(context, (Pokemon) semanticObject); return; case PkmntcgoPackage.TRAINER: sequence_Trainer(context, (Trainer) semanticObject); return; } if (errorAcceptor != null) errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context)); }
public ParserRule getTypeAndTypeArgumentsRule() { return getTypeAndTypeArgumentsAccess().getRule(); }
public ParserRule getFeatureCallIDRule() { return getFeatureCallIDAccess().getRule(); }
public ParserRule getLogicalANDExpressionRule() { return getLogicalANDExpressionAccess().getRule(); }
public ParserRule getPropertyGetterDeclarationRule() { return getPropertyGetterDeclarationAccess().getRule(); }
public ParserRule getXCastedExpressionRule() { return getXCastedExpressionAccess().getRule(); }
public ParserRule getParameterizedPropertyAccessExpressionTailRule() { return getParameterizedPropertyAccessExpressionTailAccess().getRule(); }
public ParserRule getParameterizedTypeRefNominalRule() { return getParameterizedTypeRefNominalAccess().getRule(); }
public ParserRule getXBlockExpressionRule() { return getXBlockExpressionAccess().getRule(); }
public ParserRule getXMemberFeatureCallRule() { return getXMemberFeatureCallAccess().getRule(); }
public ParserRule getXImportDeclarationRule() { return getXImportDeclarationAccess().getRule(); }
public ParserRule getArrowFunctionTypeExpressionRule() { return getArrowFunctionTypeExpressionAccess().getRule(); }
public ParserRule getTypeArgInTypeTypeRefRule() { return getTypeArgInTypeTypeRefAccess().getRule(); }
public ParserRule getProductoORule() { return getProductoOAccess().getRule(); }
public ParserRule getIntersectionTypeExpressionOLDRule() { return getIntersectionTypeExpressionOLDAccess().getRule(); }
public ParserRule getArrayBindingPatternRule() { return getArrayBindingPatternAccess().getRule(); }
public ParserRule getReservedWordRule() { return getReservedWordAccess().getRule(); }
public ParserRule getExtensionRule() { return getExtensionAccess().getRule(); }
public ParserRule getTypingStrategyDefSiteOperatorRule() { return getTypingStrategyDefSiteOperatorAccess().getRule(); }
public ParserRule getPercentRule() { return getPercentAccess().getRule(); }
public ParserRule getParameterizedTypeRefStructuralRule() { return getParameterizedTypeRefStructuralAccess().getRule(); }
public ParserRule getScientificIntLiteralRule() { return getScientificIntLiteralAccess().getRule(); }
public ParserRule getXAdditiveExpressionRule() { return getXAdditiveExpressionAccess().getRule(); }
public ParserRule getConditionalExpressionRule() { return getConditionalExpressionAccess().getRule(); }
public ParserRule getTStructSetterRule() { return getTStructSetterAccess().getRule(); }
public ParserRule getBindingIdentifierRule() { return getBindingIdentifierAccess().getRule(); }
public ParserRule getTextOfElementWithCssSelectorToBeRule() { return getTextOfElementWithCssSelectorToBeAccess().getRule(); }
public ParserRule getColonSepTypeRefRule() { return getColonSepTypeRefAccess().getRule(); }
public ParserRule getProductoYRule() { return getProductoYAccess().getRule(); }
public ParserRule getPropertyMethodDeclarationRule() { return getPropertyMethodDeclarationAccess().getRule(); }
public ParserRule getExportDeclarationImplRule() { return getExportDeclarationImplAccess().getRule(); }
public ParserRule getNumberRule() { return getNumberAccess().getRule(); }
public ParserRule getTypeIDRule() { return getTypeIDAccess().getRule(); }
public ParserRule getVariableDeclarationRule() { return getVariableDeclarationAccess().getRule(); }
public ParserRule getNullTypeRule() { return getNullTypeAccess().getRule(); }
public ParserRule getBindingTypesIdentifierRule() { return getBindingTypesIdentifierAccess().getRule(); }
public ParserRule getAnnotationRule() { return getAnnotationAccess().getRule(); }
public ParserRule getVersionRule() { return getVersionAccess().getRule(); }
public ParserRule getTemplateExpressionEndRule() { return getTemplateExpressionEndAccess().getRule(); }