diff --git a/notcl.js b/notcl.js index 512d3ed..082a17c 100644 --- a/notcl.js +++ b/notcl.js @@ -6,7 +6,7 @@ */ var Notcl = (() => { - const { AtLeast, Choose, End, Regex, Sequence, Use, Hint } = Peg; + const { AtLeast, Choose, End, Regex, Sequence, Use } = Peg; const InterCommandWhitespace = Regex(/\s+/y).expects("whitespace"); diff --git a/peg.js b/peg.js index 30cda91..cb5f5b1 100644 --- a/peg.js +++ b/peg.js @@ -198,26 +198,3 @@ Peg.End = () => { }).expects(""); return end; }; - -/** - * Creates a pattern that never succeeds, but reports how far its wrapped pattern could match before failing. - * - * This is a hack, meant to improve error messages after an AtLeast(). Maybe this can be removed by patterns returning both success and failure - * - * Never consumes input, and fails with zero length if the pattern succeeds. - * @param {Peg.Pattern} pattern - * @return {Peg.Pattern} - */ -Peg.Hint = function (pattern) { - return /** @type {Peg.Pattern} */ ( - Peg.WrapPattern(function (source, index) { - const [value, furthest, expected] = pattern(source, index); - if (value) { - console.log("oops match", value, furthest, expected); - return [null, index, pattern.expectLabel]; - } else { - return [value, furthest, expected]; - } - }) - ).expects(pattern.expectLabel); -};