/// if the variable name is in current table, return Identifier itself, /// which contains the real value. /// else return a reference to ancient identifier tables' identifiers. /// will break if we can't find any. public MRef Search(string name, int line = -1, int column = -1) { if (name == "") { throw new LogicException("Cannot deal with empty string!", line, column); } if (TryGetValue(name, out MRef v)) { return(v); } else { if (parent == null) { throw new LogicException( "Cannot find identifier : " + name, line, column ); } else { return(parent.Search(name, line, column)); } } }
public override MValue Eval(IdentifierTable t) { // This will return the reference of a variable. return(t.Search(identifier, line, col).target); }