Package org.antlr.v4.codegen.model

Examples of org.antlr.v4.codegen.model.TestSetInline


  }

  @Override
  public List<SrcOp> set(GrammarAST setAST, GrammarAST labelAST, boolean invert) {
    MatchSet matchOp;
    if ( invert ) matchOp = new MatchNotSet(this, setAST);
    else matchOp = new MatchSet(this, setAST);
    if ( labelAST!=null ) {
      String label = labelAST.getText();
      RuleFunction rf = getCurrentRuleFunction();
      if ( labelAST.parent.getType() == ANTLRParser.PLUS_ASSIGN ) {
View Full Code Here


    return new TokenListDecl(this, gen.getTarget().getListLabel(label));
  }

  @Override
  public List<SrcOp> set(GrammarAST setAST, GrammarAST labelAST, boolean invert) {
    MatchSet matchOp;
    if ( invert ) matchOp = new MatchNotSet(this, setAST);
    else matchOp = new MatchSet(this, setAST);
    if ( labelAST!=null ) {
      String label = labelAST.getText();
      RuleFunction rf = getCurrentRuleFunction();
      if ( labelAST.parent.getType() == ANTLRParser.PLUS_ASSIGN ) {
        defineImplicitLabel(setAST, matchOp);
View Full Code Here

    return list(invokeOp, listLabelOp);
  }

  @Override
  public List<SrcOp> tokenRef(GrammarAST ID, GrammarAST labelAST, GrammarAST args) {
    MatchToken matchOp = new MatchToken(this, (TerminalAST) ID);
    if ( labelAST!=null ) {
      String label = labelAST.getText();
      RuleFunction rf = getCurrentRuleFunction();
      if ( labelAST.parent.getType() == ANTLRParser.PLUS_ASSIGN ) {
        // add Token _X and List<Token> X decls
View Full Code Here

    int ebnf = 0;
    if ( ebnfRoot!=null ) ebnf = ebnfRoot.getType();
    Choice c = null;
    switch ( ebnf ) {
      case ANTLRParser.OPTIONAL :
        c = new OptionalBlock(this, ebnfRoot, alts);
        break;
      case ANTLRParser.CLOSURE :
        c = new StarBlock(this, ebnfRoot, alts);
        break;
      case ANTLRParser.POSITIVE_CLOSURE :
View Full Code Here

    return new ParserFile(this, fileName);
  }

  @Override
  public Parser parser(ParserFile file) {
    return new Parser(this, file);
  }
View Full Code Here

public class ParserFactory extends DefaultOutputModelFactory {
  public ParserFactory(CodeGenerator gen) { super(gen); }

  @Override
  public ParserFile parserFile(String fileName) {
    return new ParserFile(this, fileName);
  }
View Full Code Here

        break;
      case ANTLRParser.CLOSURE :
        c = new StarBlock(this, ebnfRoot, alts);
        break;
      case ANTLRParser.POSITIVE_CLOSURE :
        c = new PlusBlock(this, ebnfRoot, alts);
        break;
    }
    return c;
  }
View Full Code Here

  public RuleFunction rule(Rule r) {
    if ( r instanceof LeftRecursiveRule ) {
      return new LeftRecursiveRuleFunction(this, (LeftRecursiveRule)r);
    }
    else {
      RuleFunction rf = new RuleFunction(this, r);
      return rf;
    }
  }
View Full Code Here

  @Override
  public List<SrcOp> tokenRef(GrammarAST ID, GrammarAST labelAST, GrammarAST args) {
    MatchToken matchOp = new MatchToken(this, (TerminalAST) ID);
    if ( labelAST!=null ) {
      String label = labelAST.getText();
      RuleFunction rf = getCurrentRuleFunction();
      if ( labelAST.parent.getType() == ANTLRParser.PLUS_ASSIGN ) {
        // add Token _X and List<Token> X decls
        defineImplicitLabel(ID, matchOp); // adds _X
        TokenListDecl l = getTokenListLabelDecl(label);
        rf.addContextDecl(ID.getAltLabel(), l);
      }
      else {
        Decl d = getTokenLabelDecl(label);
        matchOp.labels.add(d);
        rf.addContextDecl(ID.getAltLabel(), d);
      }

//      Decl d = getTokenLabelDecl(label);
//      ((MatchToken)matchOp).labels.add(d);
//      getCurrentRuleFunction().addContextDecl(ID.getAltLabel(), d);
View Full Code Here

    MatchSet matchOp;
    if ( invert ) matchOp = new MatchNotSet(this, setAST);
    else matchOp = new MatchSet(this, setAST);
    if ( labelAST!=null ) {
      String label = labelAST.getText();
      RuleFunction rf = getCurrentRuleFunction();
      if ( labelAST.parent.getType() == ANTLRParser.PLUS_ASSIGN ) {
        defineImplicitLabel(setAST, matchOp);
        TokenListDecl l = getTokenListLabelDecl(label);
        rf.addContextDecl(setAST.getAltLabel(), l);
      }
      else {
        Decl d = getTokenLabelDecl(label);
        matchOp.labels.add(d);
        rf.addContextDecl(setAST.getAltLabel(), d);
      }
    }
    if ( controller.needsImplicitLabel(setAST, matchOp) ) defineImplicitLabel(setAST, matchOp);
    AddToLabelList listLabelOp = getAddToListOpIfListLabelPresent(matchOp, labelAST);
    return list(matchOp, listLabelOp);
View Full Code Here

TOP

Related Classes of org.antlr.v4.codegen.model.TestSetInline

Copyright © 2018 www.massapicom. 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.