diff --git a/notcl.js b/notcl.js index 70c3c3a..a7ed44f 100644 --- a/notcl.js +++ b/notcl.js @@ -8,9 +8,9 @@ var Notcl = (() => { const { AtLeast, Choose, End, Regex, Sequence, Use } = Peg; - const InterCommandWhitespace = Regex(/\s+/y); + const InterCommandWhitespace = Regex(/\s+/y).expects("whitespace"); - const Comment = Regex(/#.*\n/y); + const Comment = Regex(/#.*\n/y).expects("#"); const PreCommand = AtLeast(0, Choose(InterCommandWhitespace, Comment)); @@ -23,7 +23,7 @@ var Notcl = (() => { /** @type {Peg.Pattern} */ const Brace = Sequence( - Regex(/\{/y), + Regex(/\{/y).expects("{"), AtLeast( 0, Choose( @@ -31,7 +31,7 @@ var Notcl = (() => { Regex(/[^{}]+/y).map(([text]) => text) ) ), - Regex(/\}/y) + Regex(/\}/y).expects("}") ).map(([_left, fragments, _right]) => fragments.join("")); const Word = Sequence( @@ -40,7 +40,7 @@ var Notcl = (() => { Brace.map((text) => ({ text })), BasicWord ) - ).map(([_, word]) => word); + ).map(([_padding, word]) => word); const CommandTerminator = Sequence( PreWordWhitespace,