]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/parsing/parser/SCLPostLexer.java
Added module header feature to SCL language.
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / internal / parsing / parser / SCLPostLexer.java
index efc799322b3d37c4220a90de6f8061154d3ace35..9cc1ff27b16a288afb11f138b9d8755a84f642d0 100644 (file)
@@ -57,6 +57,7 @@ public class SCLPostLexer {
     int lineStart = 0;
     boolean firstTokenOfLine = true;
     private SCLParserOptions options;
+    private boolean isFirstToken = true;
             
     {
         indentations.add(0);
@@ -151,6 +152,13 @@ public class SCLPostLexer {
                 }
             }
             firstTokenOfLine = false;
+            if(isFirstToken) {
+                isFirstToken = false;
+                if(symbol.id == SCLTerminals.ID && symbol.text.equals("module") && options != null && options.isModule) {
+                    push(new Token(SCLTerminals.MODULE, symbol.location, symbol.text));
+                    return;
+                }
+            }
         }
         
         switch(symbolId) {
@@ -166,8 +174,8 @@ public class SCLPostLexer {
             return;
         case SCLTerminals.THEN:
             /*for(int tt : indentationTokens.toArray())
-                System.out.print(SCLParser.TERMINAL_NAMES[tt] + " ");
-            System.out.println();*/
+                    System.out.print(SCLParser.TERMINAL_NAMES[tt] + " ");
+                System.out.println();*/
             if(prevTokenId == SCLTerminals.COMMA) {
                 // for list comprehension syntax
                 push(symbol);