From 0c90b45d3a4dff9aa0ca98bc17bfea8bc334f367 Mon Sep 17 00:00:00 2001
From: Tangent Wantwight <tangent128@gmail.com>
Date: Fri, 4 Aug 2023 19:25:57 -0400
Subject: [PATCH] Remove Hint hack

---
 notcl.js |  2 +-
 peg.js   | 23 -----------------------
 2 files changed, 1 insertion(+), 24 deletions(-)

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("<eof>");
   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<unknown>} pattern
- * @return {Peg.Pattern<never>}
- */
-Peg.Hint = function (pattern) {
-  return /** @type {Peg.Pattern<never>} */ (
-    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);
-};