From 5b5600f329b4ae2f2b9c5f35d06c350a629fb671 Mon Sep 17 00:00:00 2001 From: Nilay Majorwar Date: Fri, 18 Feb 2022 18:04:32 +0530 Subject: [PATCH] Minor changes and fixes to add-new-language script --- scripts/add-new-language.js | 4 ++-- scripts/new-lang-template/common.ts | 8 +++----- scripts/new-lang-template/runtime.ts | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/scripts/add-new-language.js b/scripts/add-new-language.js index c3dac16..90b39c9 100644 --- a/scripts/add-new-language.js +++ b/scripts/add-new-language.js @@ -76,8 +76,8 @@ const copyFile = (src, dest) => { const dest = path.resolve(__dirname, `../pages/ide/${langId}.tsx`); const contents = cropFirstLine(fs.readFileSync(src).toString()); const finalContents = contents - .replace("$LANG_ID", langId) - .replace("$LANG_NAME", langName); + .replace(/\$LANG_ID/g, langId) + .replace(/\$LANG_NAME/g, langName); fs.writeFileSync(dest, finalContents); } diff --git a/scripts/new-lang-template/common.ts b/scripts/new-lang-template/common.ts index 67a5c2d..69c1b1c 100644 --- a/scripts/new-lang-template/common.ts +++ b/scripts/new-lang-template/common.ts @@ -7,11 +7,9 @@ export type RS = { }; /** Sample program */ -export const sampleProgram = [ - "Program line 1", - "Program line 2", - "Program line 3", -].join("\n"); +export const sampleProgram = `Program line 1 +Program line 2 +Program line 3`; /** Syntax highlighting */ export const editorTokensProvider: MonacoTokensProvider = { diff --git a/scripts/new-lang-template/runtime.ts b/scripts/new-lang-template/runtime.ts index 94ff01f..0fd4428 100644 --- a/scripts/new-lang-template/runtime.ts +++ b/scripts/new-lang-template/runtime.ts @@ -17,6 +17,6 @@ export default class XYZLanguageEngine implements LanguageEngine { executeStep(): StepExecutionResult { // TODO: Unimplemented - return { rendererState: { value: 0 }, nextStepLocation: { line: 0 } }; + return { rendererState: { value: 0 }, nextStepLocation: { startLine: 0 } }; } }