Пример #1
0
        public bool get(Token t)
        {
            //dump("Searching " + t.ToString());
            for (Env e = this; e != null; e = e.prev)
            {
                if (e.table.Contains(t))
                    return (bool)e.table[t];
            }

            dump("Error: bind for " + t.ToString() + " not found");
            throw new BindNotFoundException("Error: bind for " + t.ToString() + " not found");
        }
Пример #2
0
 public void Put(Token t, bool b)
 {
     table.Add(t, b);
     //dump("Adding " + t.ToString());
 }
Пример #3
0
 public Parser(Tokenizer tokenizer)
 {
     this.tokenizer = tokenizer;
     currToken = this.tokenizer.nextToken();
 }
Пример #4
0
        Token match(TokenType type)
        {
            Token tmp = currToken;
            if (currToken.Type == type)
                currToken = tokenizer.nextToken();
            else
                Error("Error: excepted " + type.ToString() + ", read " + (currToken.Type).ToString() + ".");

            return tmp;
        }