//Should it be Func_expr or Func_stmt? public override void EnterFunc_expr([NotNull] GrammarParser.Func_exprContext context) { ScopeNode LocalScope = new ScopeNode(); Scopes.Add(LocalScope); LocalScope.Parent = currentScope; currentScope = LocalScope; base.EnterFunc_expr(context); }
public override void EnterIter_stmt([NotNull] GrammarParser.Iter_stmtContext context) { ScopeNode LocalScope = new ScopeNode(); Scopes.Add(LocalScope); LocalScope.Parent = currentScope; currentScope = LocalScope; base.EnterIter_stmt(context); }
public override void EnterProgram([NotNull] GrammarParser.ProgramContext context) { ScopeNode GlobalScope = new ScopeNode(); Scopes.Add(currentScope); Scopes.Add(GlobalScope); currentScope = GlobalScope; base.EnterProgram(context); }
private bool LookUpScope(string expression) { ScopeNode Scope = currentScope; while (Scope != null) { if (Scope.SymbolTable.ContainsKey(expression)) { return(true); } else { Scope = Scope.Parent; } } return(false); }
public override void ExitFunc_expr([NotNull] GrammarParser.Func_exprContext context) { currentScope = currentScope.Parent; base.ExitFunc_expr(context); }
public override void ExitCond_stmt([NotNull] GrammarParser.Cond_stmtContext context) { currentScope = currentScope.Parent; base.ExitCond_stmt(context); }