Esempio n. 1
0
 public KeywordParser()
 {
     Keywords = new HashSet <string>()
     {
         "PRINT", "LENGTH", "READ", "WRITE", "int", "int[]", "if", "endif", "new", "while", "endwhile"
     };
     PrintParser      = Parse.String("PRINT").Text().Token();
     LengthParser     = Parse.String("LENGTH").Text().Token();
     ReadParser       = Parse.String("READ").Text().Token();
     WriteParser      = Parse.String("WRITE").Text().Token();
     IntParser        = Parse.String("int").Text().Token();
     IntArrayParser   = Parse.String("int[]").Text().Token();
     NewParser        = Parse.String("new").Text().Token();
     IfParser         = Parse.String("if").Text().Token();
     EndIfParser      = Parse.String("endif").Text().Token();
     WhileParser      = Parse.String("while").Text().Token();
     EndWhileParser   = Parse.String("endwhile").Text().Token();
     NotKeywordParser = Parse.Not(
         IntParser
         .Or(IfParser)
         .Or(EndIfParser)
         .Or(WhileParser)
         .Or(EndWhileParser)
         .Or(NewParser)
         .Or(PrintParser)
         .Or(LengthParser)
         .Or(ReadParser)
         .Or(WriteParser)
         );
 }