示例#1
0
文件: Tdop.cs 项目: ZiCog/HomeSpun
 public static Expr ParseExpression(Tokenizer Tokenizer, int rbp)
 {
     Token t = Tokenizer.Current;
     Tokenizer.Advance();
     Expr left = t.Nud();
     while (rbp > Tokenizer.Current.Lbp)
     {
         t = Tokenizer.Current;
         Tokenizer.Advance();
         left = t.Led(left);
     }
     return left;
 }
示例#2
0
文件: Tdop.cs 项目: ZiCog/HomeSpun
 public static Stmt ParseStatement(Tokenizer Tokenizer)
 {
     Stmt s;
     if (Tokenizer.Current.Std(out s))
     {
         return s;
     }
     else
     {
         SimpleToken token = Tokenizer.Current;
         Expr e = ParseExpression(Tokenizer, 13);
         s = new ExprStmt(token, Tokenizer.Current.LineNumber, e);
         Tokenizer.Advance("(eol)");
         return s;
     }
 }
示例#3
0
文件: Tdop.cs 项目: ZiCog/HomeSpun
 public static ArrayList ParseArgumentList(Tokenizer Tokenizer)
 {
     ArrayList argList = new ArrayList();
     if (Tokenizer.Current.Text != "(")
         return argList;
     Tokenizer.Advance("(");
     while (true)
     {
         argList.Add(ParseExpression(Tokenizer, 13));
         if (Tokenizer.Current.Text != ",")
             break;
         Tokenizer.Advance(",");
     }
     Tokenizer.Advance(")");
     return argList;
 }