changes
authorbdemsky <bdemsky>
Tue, 26 Apr 2011 22:15:30 +0000 (22:15 +0000)
committerbdemsky <bdemsky>
Tue, 26 Apr 2011 22:15:30 +0000 (22:15 +0000)
Robust/src/Lex/Lexer.java
Robust/src/Main/Main.java

index f72f9412771ecd3f5d1710d0a490180a06eaaac4..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 {
@@ -292,6 +298,12 @@ public class Lexer {
     //  pre-java 1.5 compatibility:
     //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);
index 6d6a192e37c4bb702e19c06079272ca9d9d5e80d..d1c6c8b90c21f4c2271e45fd69ead09654b1e8b4 100644 (file)
@@ -687,7 +687,7 @@ public class Main {
   public static ParseNode readSourceFile(State state, String sourcefile) {
     try {
       Reader fr= new BufferedReader(new FileReader(sourcefile));
-      Lex.Lexer l = new Lex.Lexer(fr);
+      Lex.Lexer l = new Lex.Lexer(fr, state.TASK);
       java_cup.runtime.lr_parser g;
       g = new Parse.Parser(l);
       ParseNode p=null;