예제 #1
0
 private bool isAToken(PieceTokenizer f, bool advance = true)
 {
     bool j = isToken(f, "+", false) || isToken(f, "(", false) || isToken(f, ")", false) || isToken(f, "|", false) || isToken(f, "?", false);
     if (j)
     {
         if (advance)
             f.Progress();
     }
     return j;
 }
예제 #2
0
 public bool isToken(PieceTokenizer f, string tok, bool advance = true)
 {
     int d;
     bool fc = f.CurrentPiece() == tok;
     if (fc && advance)
         f.Progress();
     return fc;
 }
예제 #3
0
 public bool isString(PieceTokenizer f, bool advance = true)
 {
     bool fc = f.CurrentPiece().StartsWith("\"") && f.CurrentPiece().EndsWith("\"");
     if (fc && advance)
         f.Progress();
     return fc;
 }
예제 #4
0
 public bool isNumber(PieceTokenizer f, bool advance = true)
 {
     int d;
     bool fc = int.TryParse(f.CurrentPiece(), out d);
     if (fc && advance)
         f.Progress();
     return fc;
 }
예제 #5
0
 public bool isBool(PieceTokenizer f, bool advance = true)
 {
     bool d;
     bool fc = bool.TryParse(f.CurrentPiece(), out d);
     if (fc && advance)
         f.Progress();
     return fc;
 }
예제 #6
0
 public string getWord(PieceTokenizer f, bool advance = true)
 {
     bool j = !isAToken(f, false) && !isBool(f, false) && !isNumber(f, false) && !isString(f, false);
     if (j)
     {
         string d;
         Console.WriteLine(d = f.CurrentPiece());
         if (advance)
             f.Progress();
         return d;
     }
     return null;
 }