Package at.bestsolution.efxclipse.tooling.efxbean.serializer

Source Code of at.bestsolution.efxclipse.tooling.efxbean.serializer.FXBeanSyntacticSequencer

package at.bestsolution.efxclipse.tooling.efxbean.serializer;

import at.bestsolution.efxclipse.tooling.efxbean.services.FXBeanGrammarAccess;
import com.google.inject.Inject;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.xtext.IGrammarAccess;
import org.eclipse.xtext.RuleCall;
import org.eclipse.xtext.nodemodel.INode;
import org.eclipse.xtext.serializer.analysis.GrammarAlias.AbstractElementAlias;
import org.eclipse.xtext.serializer.analysis.GrammarAlias.GroupAlias;
import org.eclipse.xtext.serializer.analysis.GrammarAlias.TokenAlias;
import org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynNavigable;
import org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynTransition;
import org.eclipse.xtext.serializer.sequencer.AbstractSyntacticSequencer;

@SuppressWarnings("all")
public class FXBeanSyntacticSequencer extends AbstractSyntacticSequencer {

  protected FXBeanGrammarAccess grammarAccess;
  protected AbstractElementAlias match_XBlockExpression_SemicolonKeyword_2_1_q;
  protected AbstractElementAlias match_XConstructorCall___LeftParenthesisKeyword_4_0_RightParenthesisKeyword_4_2__q;
  protected AbstractElementAlias match_XExpressionInClosure_SemicolonKeyword_1_1_q;
  protected AbstractElementAlias match_XFunctionTypeRef___LeftParenthesisKeyword_0_0_RightParenthesisKeyword_0_2__q;
  protected AbstractElementAlias match_XParenthesizedExpression_LeftParenthesisKeyword_0_a;
  protected AbstractElementAlias match_XParenthesizedExpression_LeftParenthesisKeyword_0_p;
 
  @Inject
  protected void init(IGrammarAccess access) {
    grammarAccess = (FXBeanGrammarAccess) access;
    match_XBlockExpression_SemicolonKeyword_2_1_q = new TokenAlias(false, true, grammarAccess.getXBlockExpressionAccess().getSemicolonKeyword_2_1());
    match_XConstructorCall___LeftParenthesisKeyword_4_0_RightParenthesisKeyword_4_2__q = new GroupAlias(false, true, new TokenAlias(false, false, grammarAccess.getXConstructorCallAccess().getLeftParenthesisKeyword_4_0()), new TokenAlias(false, false, grammarAccess.getXConstructorCallAccess().getRightParenthesisKeyword_4_2()));
    match_XExpressionInClosure_SemicolonKeyword_1_1_q = new TokenAlias(false, true, grammarAccess.getXExpressionInClosureAccess().getSemicolonKeyword_1_1());
    match_XFunctionTypeRef___LeftParenthesisKeyword_0_0_RightParenthesisKeyword_0_2__q = new GroupAlias(false, true, new TokenAlias(false, false, grammarAccess.getXFunctionTypeRefAccess().getLeftParenthesisKeyword_0_0()), new TokenAlias(false, false, grammarAccess.getXFunctionTypeRefAccess().getRightParenthesisKeyword_0_2()));
    match_XParenthesizedExpression_LeftParenthesisKeyword_0_a = new TokenAlias(true, true, grammarAccess.getXParenthesizedExpressionAccess().getLeftParenthesisKeyword_0());
    match_XParenthesizedExpression_LeftParenthesisKeyword_0_p = new TokenAlias(true, false, grammarAccess.getXParenthesizedExpressionAccess().getLeftParenthesisKeyword_0());
  }
 
  @Override
  protected String getUnassignedRuleCallToken(EObject semanticObject, RuleCall ruleCall, INode node) {
    if(ruleCall.getRule() == grammarAccess.getOpSingleAssignRule())
      return getOpSingleAssignToken(semanticObject, ruleCall, node);
    return "";
  }
 
  /**
   * OpSingleAssign:
   *   '='
   * ;
   */
  protected String getOpSingleAssignToken(EObject semanticObject, RuleCall ruleCall, INode node) {
    if (node != null)
      return getTokenText(node);
    return "=";
  }
 
  @Override
  protected void emitUnassignedTokens(EObject semanticObject, ISynTransition transition, INode fromNode, INode toNode) {
    if (transition.getAmbiguousSyntaxes().isEmpty()) return;
    List<INode> transitionNodes = collectNodes(fromNode, toNode);
    for (AbstractElementAlias syntax : transition.getAmbiguousSyntaxes()) {
      List<INode> syntaxNodes = getNodesFor(transitionNodes, syntax);
      if(match_XBlockExpression_SemicolonKeyword_2_1_q.equals(syntax))
        emit_XBlockExpression_SemicolonKeyword_2_1_q(semanticObject, getLastNavigableState(), syntaxNodes);
      else if(match_XConstructorCall___LeftParenthesisKeyword_4_0_RightParenthesisKeyword_4_2__q.equals(syntax))
        emit_XConstructorCall___LeftParenthesisKeyword_4_0_RightParenthesisKeyword_4_2__q(semanticObject, getLastNavigableState(), syntaxNodes);
      else if(match_XExpressionInClosure_SemicolonKeyword_1_1_q.equals(syntax))
        emit_XExpressionInClosure_SemicolonKeyword_1_1_q(semanticObject, getLastNavigableState(), syntaxNodes);
      else if(match_XFunctionTypeRef___LeftParenthesisKeyword_0_0_RightParenthesisKeyword_0_2__q.equals(syntax))
        emit_XFunctionTypeRef___LeftParenthesisKeyword_0_0_RightParenthesisKeyword_0_2__q(semanticObject, getLastNavigableState(), syntaxNodes);
      else if(match_XParenthesizedExpression_LeftParenthesisKeyword_0_a.equals(syntax))
        emit_XParenthesizedExpression_LeftParenthesisKeyword_0_a(semanticObject, getLastNavigableState(), syntaxNodes);
      else if(match_XParenthesizedExpression_LeftParenthesisKeyword_0_p.equals(syntax))
        emit_XParenthesizedExpression_LeftParenthesisKeyword_0_p(semanticObject, getLastNavigableState(), syntaxNodes);
      else acceptNodes(getLastNavigableState(), syntaxNodes);
    }
  }

  /**
   * Syntax:
   *     ';'?
   */
  protected void emit_XBlockExpression_SemicolonKeyword_2_1_q(EObject semanticObject, ISynNavigable transition, List<INode> nodes) {
    acceptNodes(transition, nodes);
  }
 
  /**
   * Syntax:
   *     ('(' ')')?
   */
  protected void emit_XConstructorCall___LeftParenthesisKeyword_4_0_RightParenthesisKeyword_4_2__q(EObject semanticObject, ISynNavigable transition, List<INode> nodes) {
    acceptNodes(transition, nodes);
  }
 
  /**
   * Syntax:
   *     ';'?
   */
  protected void emit_XExpressionInClosure_SemicolonKeyword_1_1_q(EObject semanticObject, ISynNavigable transition, List<INode> nodes) {
    acceptNodes(transition, nodes);
  }
 
  /**
   * Syntax:
   *     ('(' ')')?
   */
  protected void emit_XFunctionTypeRef___LeftParenthesisKeyword_0_0_RightParenthesisKeyword_0_2__q(EObject semanticObject, ISynNavigable transition, List<INode> nodes) {
    acceptNodes(transition, nodes);
  }
 
  /**
   * Syntax:
   *     '('*
   */
  protected void emit_XParenthesizedExpression_LeftParenthesisKeyword_0_a(EObject semanticObject, ISynNavigable transition, List<INode> nodes) {
    acceptNodes(transition, nodes);
  }
 
  /**
   * Syntax:
   *     '('+
   */
  protected void emit_XParenthesizedExpression_LeftParenthesisKeyword_0_p(EObject semanticObject, ISynNavigable transition, List<INode> nodes) {
    acceptNodes(transition, nodes);
  }
 
}
TOP

Related Classes of at.bestsolution.efxclipse.tooling.efxbean.serializer.FXBeanSyntacticSequencer

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.