public TreeIf(TokenIfElse ifToken, TreeFunctional tree) : base() { if (tree.head.type == TokenType.IF || tree.head.type == TokenType.FOR) { var tmp = tree as TreeIf; this.stackVariable = tmp.stackVariable; foreach (var item in tmp.stackVariableLocal) { this.stackVariable.Add(item.Key, item.Value); } } else { this.stackVariable = tree.stackVariable; } this.head = ifToken; this.arichmeticStatementTree = new ArichmetichTree(null); this.stackVariableLocal = new Dictionary <string, TokenVariable>(); }
public TreeFunctional(string name, TokenType type, int startPos, int endPos) { this.name = name; Token token; switch (type) { case TokenType.FUNCTION: token = new TokenFunction(null, startPos, endPos); break; case TokenType.IF: token = new TokenIfElse(startPos, endPos, TokenType.IF); break; default: token = null; break; } this.head = token; this.next = null; this.stackVariable = new Dictionary <string, TokenVariable>(); }