Browse Source

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 years ago
parent
commit
1f9ade9944
1 changed files with 7 additions and 7 deletions
  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,