diff --git a/notcl.js b/notcl.js index 726b71c..c1f2308 100644 --- a/notcl.js +++ b/notcl.js @@ -47,10 +47,16 @@ var Notcl = (() => { Choose(/** @type {Peg.Pattern} */ (Regex(/[\n;]/y)), End) ); + /** @type {Peg.Pattern} */ const Command = Sequence(PreCommand, AtLeast(0, Word), CommandTerminator).map( ([_padding, words, _end]) => words ); + /** @type {Peg.Pattern} */ + const Script = Sequence(AtLeast(0, Command), End).map( + ([commands, _eof]) => commands + ); + return { /** * Parse out a Notcl script into an easier-to-interpret representation. @@ -64,19 +70,10 @@ var Notcl = (() => { // fold line endings code = code.replace(/(?