internal void HandleLhs(ident i, BekTypes t, bool implicitdefine = false) { SymtabElt e; if (TryGetElt(i.name, out e)) { if (implicitdefine) { throw new BekParseException(i.line, i.pos, string.Format("'{0}' already defined", i.name)); } if (e.type != t) { throw new BekParseException(i.line, i.pos, string.Format("'{0}' inconsistent type", i.name)); } this.symtab[i] = e; } else if (implicitdefine) { e = new SymtabElt(i, t); this.AddElt(i, e); } else { throw new BekParseException(i.line, i.pos, string.Format("'{0}' undefined", i.name)); } }
internal void HandleLhs(ident i, BekTypes t, bool implicitdefine=false) { SymtabElt e; if (TryGetElt(i.name, out e)) { if (implicitdefine) throw new BekParseException(i.line, i.pos, string.Format("'{0}' already defined", i.name)); if (e.type != t) throw new BekParseException(i.line, i.pos, string.Format("'{0}' inconsistent type", i.name)); this.symtab[i] = e; } else if (implicitdefine) { e = new SymtabElt(i, t); this.AddElt(i, e); } else { throw new BekParseException(i.line, i.pos, string.Format("'{0}' undefined", i.name)); } }
internal SymtabElt AddElt(ident i, SymtabElt e) { this.names.Peek()[i.name] = e; this.symtab[i] = e; return e; }
internal bool TryGetElt(string name, out SymtabElt e) { return this.names.Peek().TryGetValue(name, out e); }
internal SymtabElt AddElt(ident i, SymtabElt e) { this.names.Peek()[i.name] = e; this.symtab[i] = e; return(e); }
internal bool TryGetElt(string name, out SymtabElt e) { return(this.names.Peek().TryGetValue(name, out e)); }