|
@@ -149,3 +149,69 @@ function fillCache () {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+export function getCodeEditorModeConfig () {
|
|
|
+ const blockList = ["RK_SWITCH", "RK_PROGRAM","RK_CASE","RK_DEFAULT","RK_FOR",
|
|
|
+ "RK_FUNCTION","RK_DO","RK_WHILE","RK_IF","RK_ELSE"]
|
|
|
+ const keywordsList = [,"RK_CONST","RK_RETURN","RK_BREAK"];
|
|
|
+ const typeList = ["RK_REAL","RK_VOID","RK_BOOLEAN","RK_STRING","RK_INTEGER"];
|
|
|
+ const atomList = ["RK_FALSE", "RK_TRUE"];
|
|
|
+
|
|
|
+ const case_default = [];
|
|
|
+ const blocks = [];
|
|
|
+ const keywords = [];
|
|
|
+ const types = [];
|
|
|
+ const atoms = []
|
|
|
+ let switchString = "";
|
|
|
+
|
|
|
+ cacheMainList = [];
|
|
|
+ const lexerClass = LanguageService.getCurrentLexer();
|
|
|
+ const nullLexer = new lexerClass();
|
|
|
+ blockList.forEach( v => {
|
|
|
+ const keyword = nullLexer.literalNames[lexerClass[v]];
|
|
|
+ const value = keyword.substring(1, keyword.length-1);
|
|
|
+ cacheMainList.push(value);
|
|
|
+ keywords.push(value);
|
|
|
+ blocks.push(value);
|
|
|
+ if(v == "RK_SWITCH") {
|
|
|
+ switchString = value;
|
|
|
+ } else if (v == "RK_CASE" || v == "RK_DEFAULT") {
|
|
|
+ case_default.push(value);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ keywordsList.forEach( v => {
|
|
|
+ const keyword = nullLexer.literalNames[lexerClass[v]];
|
|
|
+ const value = keyword.substring(1, keyword.length-1);
|
|
|
+ cacheMainList.push(value);
|
|
|
+ keywords.push(value);
|
|
|
+ });
|
|
|
+ typeList.forEach(v => {
|
|
|
+ const keyword = nullLexer.literalNames[lexerClass[v]];
|
|
|
+ const value = keyword.substring(1, keyword.length-1);
|
|
|
+ cacheMainList.push(value);
|
|
|
+ types.push(value);
|
|
|
+ })
|
|
|
+ atomList.forEach( v => {
|
|
|
+ const keyword = nullLexer.literalNames[lexerClass[v]];
|
|
|
+ const value = keyword.substring(1, keyword.length-1);
|
|
|
+ cacheMainList.push(value);
|
|
|
+ atoms.push(value);
|
|
|
+ })
|
|
|
+
|
|
|
+ cacheOp = []
|
|
|
+ const logicOpList = [Operators.AND.value, Operators.OR.value, Operators.NOT.value];
|
|
|
+ for (let op = 0; op < logicOpList.length; ++op) {
|
|
|
+ const lOp = `logic_operator_${logicOpList[op]}`;
|
|
|
+ const value = LocalizedStrings.getUI(lOp);
|
|
|
+ cacheOp.push(value)
|
|
|
+ keywords.push(value);
|
|
|
+ }
|
|
|
+ return {
|
|
|
+ case_default: case_default,
|
|
|
+ atoms: atoms,
|
|
|
+ keywords: keywords,
|
|
|
+ switchString: switchString,
|
|
|
+ types: types,
|
|
|
+ blocks: blocks
|
|
|
+ }
|
|
|
+}
|