Inheritance: AttributeResolver
 public LeftRecursiveRule(Grammar g, string name, RuleAST ast)
     : base(g, name, ast, 1)
 {
     originalAST = ast;
     alt = new Alternative[numberOfAlts + 1]; // always just one
     for (int i = 1; i <= numberOfAlts; i++)
         alt[i] = new Alternative(this, i);
 }
Exemple #2
0
 public ActionSniffer(Grammar g, Rule r, Alternative alt, ActionAST node, IToken actionToken)
 {
     this.g = g;
     this.r = r;
     this.alt = alt;
     this.node = node;
     this.actionToken = actionToken;
     this.errMgr = g.tool.errMgr;
 }
 public virtual CodeBlockForAlt Epsilon(Alternative alt, bool outerMost)
 {
     return null;
 }
 public CodeBlockForOuterMostAlt(OutputModelFactory factory, Alternative alt)
     : base(factory)
 {
     this.alt = alt;
     altLabel = alt.ast.altLabel != null ? alt.ast.altLabel.Text : null;
 }
Exemple #5
0
        public int actionIndex = -1; // if lexer; 0..n-1 for n actions in a rule

        public Rule(Grammar g, string name, RuleAST ast, int numberOfAlts)
        {
            this.g = g;
            this.name = name;
            this.ast = ast;
            this.numberOfAlts = numberOfAlts;
            alt = new Alternative[numberOfAlts + 1]; // 1..n
            for (int i = 1; i <= numberOfAlts; i++)
                alt[i] = new Alternative(this, i);
        }
 public virtual void SetCurrentOuterMostAlt(Alternative currentOuterMostAlt)
 {
     this.currentOuterMostAlt = currentOuterMostAlt;
 }
 public virtual CodeBlockForAlt Epsilon(Alternative alt, bool outerMost)
 {
     CodeBlockForAlt blk = @delegate.Epsilon(alt, outerMost);
     foreach (CodeGeneratorExtension ext in extensions)
         blk = ext.Epsilon(blk);
     return blk;
 }
 public virtual CodeBlockForAlt Alternative(Alternative alt, bool outerMost)
 {
     CodeBlockForAlt blk = @delegate.Alternative(alt, outerMost);
     if (outerMost)
     {
         currentOuterMostAlternativeBlock = (CodeBlockForOuterMostAlt)blk;
     }
     foreach (CodeGeneratorExtension ext in extensions)
         blk = ext.Alternative(blk, outerMost);
     return blk;
 }
Exemple #9
0
 public override CodeBlockForAlt Alternative(Alternative alt, bool outerMost)
 {
     if (outerMost)
         return new CodeBlockForOuterMostAlt(this, alt);
     return new CodeBlockForAlt(this);
 }
Exemple #10
0
 public override CodeBlockForAlt Epsilon(Alternative alt, bool outerMost)
 {
     return Alternative(alt, outerMost);
 }