public FunctionDeclarationStatementNode(LexicalScope scope, string name, ParameterNode[] parameters, ElementNode[] body, SourceSpan sourceSpan) : base(sourceSpan) { this.scope = scope; this.name = name; this.parameters = parameters; this.body = body; }
public BlockNode(LexicalScope scope, ElementNode[] elements, SourceSpan span) : base(span) { this.scope = scope; this.elements = elements; }
public SourceUnitTree BuildSourceTree(ParseTreeNode rootNode, SourceUnit sourceUnit, bool allowSingle, out bool isExpression) { ElementNode[] elements; if (allowSingle && rootNode.Term.Name != "Prog") { // Single statement, not a "valid production", example "6+2" or simply a identifier "b" elements = new ElementNode[] { new FlowControlStatementNode(FlowControlOperations.Return, BuildExpression(rootNode), SourceSpan.None) }; isExpression = true; return new SourceUnitTree(Scope.Build(), elements, SourceSpan.None); } elements = rootNode.ChildNodes[0].ChildNodes.Select(n => BuildElement(n)).ToArray(); isExpression = false; return new SourceUnitTree(Scope.Build(), elements, Span(rootNode)); }
public SourceUnitTree(LexicalScope scope, ElementNode[] elementNodes, SourceSpan sourceSpan) : base(sourceSpan) { this.elementNodes = elementNodes; this.scope = scope; }