Forráskód Böngészése

fix: Fix keyword cache generation

Fix keyword cache generation from removing characters from the lexer keyword
Add main function name as a keyword
Lucas de Souza 2 éve
szülő
commit
1f9ade9944
1 módosított fájl, 7 hozzáadás és 7 törlés
  1. 7 7
      js/util/utils.js

+ 7 - 7
js/util/utils.js

@@ -157,7 +157,7 @@ function fillCache () {
     for (let key = 0; key < mainList.length; ++key) {
       const word = mainList[key];
       const keyword = names[word];
-      cacheMainList.push(keyword.substring(1, keyword.length - 1));
+      cacheMainList.push(keyword);
     }
   }
   if (cacheOp == null) {
@@ -248,7 +248,7 @@ export function getCodeEditorModeConfig () {
   //console.debug(names);
   blockList.forEach((v) => {
     const keyword = names[v];
-    const value = keyword.substring(1, keyword.length - 1);
+    const value = keyword;
     cacheMainList.push(value);
     keywords.push(value);
     blocks.push(value);
@@ -260,19 +260,19 @@ export function getCodeEditorModeConfig () {
   });
   keywordsList.forEach((v) => {
     const keyword = names[v];
-    const value = keyword.substring(1, keyword.length - 1);
+    const value = keyword;
     cacheMainList.push(value);
     keywords.push(value);
   });
   typeList.forEach((v) => {
     const keyword = names[v];
-    const value = keyword.substring(1, keyword.length - 1);
+    const value = keyword;
     cacheMainList.push(value);
     types.push(value);
   });
   atomList.forEach((v) => {
     const keyword = names[v];
-    const value = keyword.substring(1, keyword.length - 1);
+    const value = keyword;
     cacheMainList.push(value);
     atoms.push(value);
   });
@@ -282,11 +282,11 @@ export function getCodeEditorModeConfig () {
 
   logicOpList.forEach((v) => {
     const keyword = names[v];
-    const value = keyword.substring(1, keyword.length - 1);
+    const value = keyword;
     cacheOp.push(value);
     keywords.push(value);
   });
-
+  cacheMainList.push(lexer.getLangFuncs().main_function);
   return {
     case_default: case_default,
     atoms: atoms,