]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/parsing/parser/SCLLexer.java
(refs #7250) CHR rules modularization (first working version)
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / internal / parsing / parser / SCLLexer.java
index 5aad5eefe96819eaad19fdf4b9c487743f6029bc..5944d12e1cf288e701348305082a2d101eb07591 100644 (file)
@@ -2,6 +2,7 @@
 
 package org.simantics.scl.compiler.internal.parsing.parser;
 
+import org.simantics.scl.compiler.compilation.CompilationContext;
 import org.simantics.scl.compiler.internal.parsing.Token;
 import org.simantics.scl.compiler.errors.Locations;
 import org.simantics.scl.compiler.internal.parsing.exceptions.SCLSyntaxErrorException;
@@ -11,7 +12,7 @@ import gnu.trove.list.array.TIntArrayList;
 /**
  * This class is a scanner generated by 
  * <a href="http://www.jflex.de/">JFlex</a> 1.6.1
- * from the specification file <tt>C:/GamsGui/git/platform/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/parsing/parser/SCLLexer.flex</tt>
+ * from the specification file <tt>C:/Simugawa.git/git/platform/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/parsing/parser/SCLLexer.flex</tt>
  */
 public class SCLLexer {
 
@@ -589,6 +590,7 @@ public class SCLLexer {
     TIntArrayList stateStack = new TIntArrayList(2);
 
     StringBuffer string = new StringBuffer();
+    CompilationContext context;
     
     private Token sym(int id) {
         return new Token(id, yychar, yychar+yylength(), yytext());
@@ -596,6 +598,12 @@ public class SCLLexer {
     private Token sym(int id, String text) {
         return new Token(id, yychar, yychar+yylength(), text);
     }
+    public void setCompilationContext(CompilationContext context) {
+        this.context = context;
+    }
+    public boolean supportCHR() {
+        return context.header == null ? false : context.header.chr;
+    }
 
 
   /**
@@ -1196,7 +1204,7 @@ public class SCLLexer {
             }
           case 157: break;
           case 63: 
-            { return sym(SCLTerminals.RULE);
+            { return sym(supportCHR() ? SCLTerminals.ID : SCLTerminals.RULE);
             }
           case 158: break;
           case 64: 
@@ -1276,7 +1284,7 @@ public class SCLLexer {
             }
           case 177: break;
           case 83: 
-            { return sym(SCLTerminals.RULESET);
+            { return sym(supportCHR() ? SCLTerminals.RULESET : SCLTerminals.ID);
             }
           case 178: break;
           case 84: 
@@ -1316,7 +1324,7 @@ public class SCLLexer {
             }
           case 187: break;
           case 93: 
-            { return sym(SCLTerminals.TRANSFORMATION);
+            { return sym(supportCHR() ? SCLTerminals.ID : SCLTerminals.TRANSFORMATION);
             }
           case 188: break;
           case 94: