From eca8c6218f088a4cc717487ba422643fd75ccde1 Mon Sep 17 00:00:00 2001 From: Tangent Wantwight Date: Thu, 27 Jul 2023 01:54:06 -0400 Subject: [PATCH] Stub parser for code --- 3x5.js | 9 +++---- index.html | 1 + notcl.js | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 6 deletions(-) create mode 100644 notcl.js diff --git a/3x5.js b/3x5.js index db59db9..7630677 100644 --- a/3x5.js +++ b/3x5.js @@ -24,12 +24,8 @@ * @returns {string} Markup to render / output */ function renderCard(state, code) { - /* Preprocess: fold line endings */ - code = code.replace(/(? + diff --git a/notcl.js b/notcl.js new file mode 100644 index 0000000..6068dbd --- /dev/null +++ b/notcl.js @@ -0,0 +1,73 @@ +/** + * @typedef {Command[]} Script + * @typedef {Word[]} Command + * @typedef {object} Word + * @property {string} text + */ + +/** + * Parse out a Notcl script into an easier-to-interpret representation. + * No script is actually executed yet. + * + * @param {string} code + * @returns Script + */ +function parseNotcl(code) { + /* Preprocess */ + // fold line endings + code = code.replace(/(?