public void Add(VarDefNode varDef) { string varName = varDef.VarSpec.Name; if (IsDefinedHere(varName)) throw new InterpreterException("Multiple definitions within the same scope for variable: " + varName); Variables[varName] = new IntVariable(varDef); }
private VarDefNode varDef() { EnterRule_varDef(); EnterRule("varDef", 3); TraceIn("varDef", 3); VarDefNode node = default(VarDefNode); VarSpecNode varSpec5 = default(VarSpecNode); try { DebugEnterRule(GrammarFileName, "varDef"); DebugLocation(39, 0); try { // Grammar\\SimpleCTreeWalker.g:39:33: ( ^( VAR_DEF varSpec ) ) DebugEnterAlt(1); // Grammar\\SimpleCTreeWalker.g:40:2: ^( VAR_DEF varSpec ) { DebugLocation(40, 2); DebugLocation(40, 4); Match(input,VAR_DEF,Follow._VAR_DEF_in_varDef113); Match(input, TokenTypes.Down, null); DebugLocation(40, 12); PushFollow(Follow._varSpec_in_varDef115); varSpec5=varSpec(); PopFollow(); Match(input, TokenTypes.Up, null); DebugLocation(40, 21); node = new VarDefNode(varSpec5); } } catch (RecognitionException re) { ReportError(re); Recover(input,re); } finally { TraceOut("varDef", 3); LeaveRule("varDef", 3); LeaveRule_varDef(); } DebugLocation(41, 0); } finally { DebugExitRule(GrammarFileName, "varDef"); } return node; }
public IntVariable(VarDefNode varDef) { Value = 0; }