Add some expects() labels for clarity
This commit is contained in:
parent
8214f05fe3
commit
ee618fa244
1 changed files with 5 additions and 5 deletions
10
notcl.js
10
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<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,
|
||||
|
|
Loading…
Reference in a new issue