changes
[IRC.git] / Robust / src / Lex / Lexer.java
index 2d16e68ad7b35148de9286849c4a8c9049e0e380..a9df52239c309c8bfa705f7323eab14c31720816 100644 (file)
@@ -16,15 +16,21 @@ public class Lexer {
   boolean isJava12;
   boolean isJava14;
   boolean isJava15;
+  boolean taskExt;
   String line = null;
   int line_pos = 1;
-    public int line_num = 0;
+  public int line_num = 0;
   LineList lineL = new LineList(-line_pos, null); // sentinel for line #0
 
   public Lexer(Reader reader) {
+    this(reader, true);
+  }
+
+  public Lexer(Reader reader, boolean task) {
     this.reader = new LineNumberReader(new EscapedUnicodeReader(reader));
     this.isJava12 = true;
     this.isJava14 = true;
+    taskExt=task;
   }
 
   public java_cup.runtime.Symbol nextToken() throws java.io.IOException {
@@ -207,6 +213,7 @@ public class Lexer {
     case ']':
     case ';':
     case ',':
+    case '@':
       return new Separator(consume());
 
       // Operators:
@@ -261,13 +268,13 @@ public class Lexer {
     "else", "enum",
     "extends", "external", "final", "finally",
     "flag", //keyword for failure aware computation
-    "float", "for","getoffset", "global", "goto", "if",
-    //"implements",
+    "float", "for", "genreach", "getoffset", "global", "goto", "if",
+    "implements",
     "import", "instanceof", "int",
-    //"interface",
+    "interface",
     "isavailable",
-    "long",
-    "native", "new", "optional", "package", "private", "protected", "public", 
+    "locdef", "long", 
+    "native", "new", "newflag", "optional", "package", "private", "protected", "public", 
     "rblock", "return",
     "scratch", "sese", "short", "static", "strictfp", "super", "switch", "synchronized",
     "tag", "task", "taskexit", //keywords for failure aware computation
@@ -289,8 +296,14 @@ public class Lexer {
     if (s.equals("false")) return new BooleanLiteral(false);
     // Check against keywords.
     //  pre-java 1.5 compatibility:
-    if (!isJava15 && s.equals("enum")) return new Identifier(s);
+    //if (!isJava15 && s.equals("enum")) return new Identifier(s);
     //  pre-java 1.4 compatibility:
+
+    if (!taskExt && s.equals("taskexit")) return new Identifier(s);
+    if (!taskExt && s.equals("tag")) return new Identifier(s);
+    if (!taskExt && s.equals("flag")) return new Identifier(s);
+    if (!taskExt && s.equals("newflag")) return new Identifier(s);
+
     if (!isJava14 && s.equals("assert")) return new Identifier(s);
     //  pre-java 1.2 compatibility:
     if (!isJava12 && s.equals("strictfp")) return new Identifier(s);