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(/(?