diff --git a/notcl.js b/notcl.js index 95facf5..cc74a75 100644 --- a/notcl.js +++ b/notcl.js @@ -26,6 +26,19 @@ var Notcl = (() => { ([_, word]) => word ); + const CommandTerminator = Peg.Sequence( + PreWordWhitespace, + Peg.Choose( + /** @type {Peg.Pattern} */ (Peg.Regex(/[\n;]/y)), + Peg.End + ) + ); + + const Command = Peg.Map( + Peg.Sequence(PreCommand, Peg.AtLeast(0, Word), CommandTerminator), + ([_padding, words, _end]) => words + ); + return { /** * Parse out a Notcl script into an easier-to-interpret representation. @@ -39,42 +52,10 @@ var Notcl = (() => { // fold line endings code = code.replace(/(?