X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.scl.compiler%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Finternal%2Fparsing%2Fparser%2FSCLLexer.java;h=5944d12e1cf288e701348305082a2d101eb07591;hp=5aad5eefe96819eaad19fdf4b9c487743f6029bc;hb=78f577368ba4c71ad6fb3d9f16c03c634585cf7b;hpb=a88529426319d66aa668882d767efb3f58a1a629 diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/parsing/parser/SCLLexer.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/parsing/parser/SCLLexer.java index 5aad5eefe..5944d12e1 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/parsing/parser/SCLLexer.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/parsing/parser/SCLLexer.java @@ -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 * JFlex 1.6.1 - * from the specification file C:/GamsGui/git/platform/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/parsing/parser/SCLLexer.flex + * from the specification file C:/Simugawa.git/git/platform/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/parsing/parser/SCLLexer.flex */ 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: