From ee618fa244aa2eddb8a3245d6005f338a1a45d78 Mon Sep 17 00:00:00 2001 From: Tangent Wantwight Date: Fri, 4 Aug 2023 11:30:41 -0400 Subject: [PATCH] Add some expects() labels for clarity --- notcl.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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,