public Statement(IDebugTracer tracer, string prodName, Expression expression) { _tracer = tracer; _prodName = prodName; _expression = expression; NodeName = "stmt" + ++_counter; }
public TerminalNode(IToken token, IDebugTracer tracer) : base(AstNodeType.Terminal, token, tracer) { Image = '"' + Image + '"'; TermName = token.Image; }
protected AstNode(AstNodeType astNodeType, IToken token, IDebugTracer tracer) { AstNodeType = astNodeType; _tracer = tracer; Location = token.Location; NodeId = $"{AstNodeType}{++NodeIdSuffix[AstNodeType]}"; Image = token.Image; }
private ISyntaxNode BuildTree(IDebugTracer tracer) { using var sb = new SyntaxBuilder(tracer); sb.Syntax("BeforeSyntax", "AfterSyntax", sb.Statement("BeforeStmt", "AfterStmt", "<S>", sb.Expression("BeforeExpr", "AfterExpr", sb.Term( sb.Factor(sb.Terminal("a")), sb.Factor(sb.ProdRef("<T>")) ), sb.Term("BeforeTerm", "AfterTerm", sb.Factor("BeforeFactor", "AfterFactor", sb.Paren( sb.Expression( sb.Term( sb.Factor(sb.ProdRef("<U>")) ) ) ) ) ), sb.Term( sb.Factor( sb.Option( sb.Expression( sb.Term( sb.Factor(sb.ProdRef("<V>")) ) ) ) ) ) ) ), sb.Statement("<S>", sb.Expression( sb.Term( sb.Factor( sb.Kleene( sb.Expression( sb.Term( sb.Factor(sb.ProdRef("<W>")) ) ) ) ) ) ) ) ); return(sb.BuildTree()); }
public AstBuilder(IAstNodeFactory astNodeFactory, IProdInfoFactory prodInfoFactory, Stack <IAstNode> stack, IDebugTracer tracer) { _astNodeFactory = astNodeFactory; _prodInfoFactory = prodInfoFactory; _tracer = tracer; _tokenDefinitions = new List <ITokenDefinition>(); _stack = stack; _tokenDefinitions = new List <ITokenDefinition>(); }
private ISyntaxNode BuildTree(IDebugTracer tracer) { using var sb = new SyntaxBuilder(tracer); sb.Syntax( sb.Statement("<S>", sb.Expression( sb.Term( sb.Factor(sb.Terminal("a")), sb.Factor(sb.ProdRef("<T>")), sb.Factor(sb.ProdRef("<U>")) ) ) ), sb.Statement("<T>", sb.Expression( sb.Term( sb.Factor( sb.Option( sb.Expression( sb.Term( sb.Factor(sb.Terminal("b")) ) ) ) ) ) ) ), sb.Statement("<U>", sb.Expression( sb.Term( sb.Factor( sb.Kleene( sb.Expression( sb.Term( sb.Factor(sb.Terminal("c")) ) ) ) ) ) ) ) ); return(sb.BuildTree()); }
public SyntaxBuilder(IDebugTracer tracer) { _tracer = tracer; }
public SyntaxNode(IToken token, IDebugTracer tracer) : base(AstNodeType.Syntax, token, tracer) { }
public void Setup() { _tracer = new Mock <IDebugTracer>().Object; }
public ActionNode(IToken token, IDebugTracer tracer) : base(AstNodeType.Action, token, tracer) { Image = '#' + Image + '#'; ActionName = token.Image; }
public AstNodeFactory(IDebugTracer tracer) { _tracer = tracer; }
public Factor(IDebugTracer tracer, IFactExpr factExpr) { _tracer = tracer; _factExpr = factExpr; NodeName = "factor" + ++_counter; }
public Expression(IDebugTracer tracer, params Term[] terms) { _tracer = tracer; _terms = terms; NodeName = "expr" + ++_counter; }
public FactorNode(IToken token, IDebugTracer tracer) : base(AstNodeType.Factor, token, tracer) { }
public ProdRefNode(IToken token, IDebugTracer tracer) : base(AstNodeType.ProdRef, token, tracer) { ProdName = token.Image; }
public TermNode(IToken token, IDebugTracer tracer) : base(AstNodeType.Term, token, tracer) { }
public ExpressionNode(IToken token, IDebugTracer tracer) : base(AstNodeType.Expression, token, tracer) { }
public StatementNode(IToken token, IDebugTracer tracer) : base(AstNodeType.Statement, token, tracer) { }
public Syntax(IDebugTracer tracer, params Statement[] statements) { _tracer = tracer; _statements = statements; NodeName = "syntax" + ++_counter; }
public ProdRef(IDebugTracer tracer, string name) { _tracer = tracer; _name = name; NodeName = "prodRef" + ++_counter; }
public AstTraverser(IDebugTracer tracer) { _tracer = tracer; }
public Option(IDebugTracer tracer, Expression expr) { _tracer = tracer; _expr = expr; NodeName = "option" + ++_counter; }
public Term(IDebugTracer tracer, params Factor[] factors) { _tracer = tracer; _factors = factors; NodeName = "term" + ++_counter; }
public ProductionInfo(string name, IDebugTracer tracer) { _tracer = tracer; Name = name; Statement = null; }
public Terminal(string image, IDebugTracer tracer) { _tracer = tracer; _image = image; NodeName = "terminal" + ++_counter; }
public ParenNode(IToken token, IDebugTracer tracer) : base(AstNodeType.Paren, token, tracer) { }
public Paren(IDebugTracer tracer, Expression expr) { _tracer = tracer; _expr = expr; NodeName = "paren" + ++_counter; }
public OptionNode(IToken token, IDebugTracer tracer) : base(AstNodeType.Option, token, tracer) { }
public Kleene(IDebugTracer tracer, Expression expr) { _tracer = tracer; _expr = expr; NodeName = "kleene" + ++_counter; }
public KleeneNode(IToken token, IDebugTracer tracer) : base(AstNodeType.KleeneStar, token, tracer) { }