Add some expects() labels for clarity

This commit is contained in:
Tangent Wantwight 2023-08-04 11:30:41 -04:00
parent 8214f05fe3
commit ee618fa244

View file

@ -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<string>} */
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,