diff --git a/Makefile b/Makefile
index 141c7ea..fa363b5 100644
--- a/Makefile
+++ b/Makefile
@@ -47,7 +47,7 @@ check-fmt: $(SOURCES)
vet:
@go vet
-precommit: fmt build check-full
+precommit: fmt vet build check-full
clean:
@rm -f *.test
diff --git a/boot.go b/boot.go
index def5256..fd31a15 100644
--- a/boot.go
+++ b/boot.go
@@ -13,12 +13,15 @@ func stringToCommitType(s string) CommitType {
switch s {
case "alias":
return Alias
- case "ws":
- return Whitespace
- case "nows":
- return NoWhitespace
- case "failpass":
- return FailPass
+
+ // not used during boot:
+ // case "ws":
+ // return Whitespace
+ // case "nows":
+ // return NoWhitespace
+ // case "failpass":
+ // return FailPass
+
case "root":
return Root
default:
diff --git a/context.go b/context.go
index 8071e93..e575a82 100644
--- a/context.go
+++ b/context.go
@@ -95,25 +95,6 @@ func (c *context) fail(offset int) {
c.matchLast = false
}
-// TODO:
-// - need to know which choice branch the failure happened on because if there is a non-user branch that has the
-// longest failure, it can be reported to an unrelevant user defined choice on another branch
-
-func (c *context) recordFailure(offset int, p parser) {
- if offset < c.failOffset {
- return
- }
-
- if c.failingParser != nil && offset == c.failOffset {
- return
- }
-
- c.failOffset = offset
- if p.commitType()&userDefined != 0 && p.commitType()&Whitespace == 0 {
- c.failingParser = p
- }
-}
-
func findLine(tokens []rune, offset int) (line, column int) {
tokens = tokens[:offset]
for i := range tokens {
diff --git a/errors_test.go b/errors_test.go
index 8c2db9a..a98ea97 100644
--- a/errors_test.go
+++ b/errors_test.go
@@ -267,40 +267,40 @@ func TestErrorMessage(t *testing.T) {
func TestErrorVerbose(t *testing.T) {
t.Skip()
- const expected = `:5:2:parse failed, parsing: string
-
- "c":3,
- }<<<
-
-Parsing error on line: 5, column: 2, while parsing: string. Definition:
-
- string:nows = "\"" ([^\\"\b\f\n\r\t] | "\\" (["\\/bfnrt] | "u" [0-9a-f]{4}))* "\"";
-`
-
- const doc = `{
- "a":1,
- "b":2,
- "c":3,
- }`
-
- s, err := openSyntaxFile("examples/json.treerack")
- if err != nil {
- t.Error(err)
- return
- }
-
- _, err = s.Parse(bytes.NewBufferString(doc))
- perr, ok := err.(*ParseError)
- if !ok {
- t.Error("failed to return parse error")
- return
- }
-
- if perr.Verbose() != expected {
- t.Error("failed to get the right error message")
- t.Log("got: ", perr.Verbose())
- t.Log("expected:", expected)
- }
+ // const expected = `:5:2:parse failed, parsing: string
+ //
+ // "c":3,
+ // }<<<
+ //
+ // Parsing error on line: 5, column: 2, while parsing: string. Definition:
+ //
+ // string:nows = "\"" ([^\\"\b\f\n\r\t] | "\\" (["\\/bfnrt] | "u" [0-9a-f]{4}))* "\"";
+ // `
+ //
+ // const doc = `{
+ // "a":1,
+ // "b":2,
+ // "c":3,
+ // }`
+ //
+ // s, err := openSyntaxFile("examples/json.treerack")
+ // if err != nil {
+ // t.Error(err)
+ // return
+ // }
+ //
+ // _, err = s.Parse(bytes.NewBufferString(doc))
+ // perr, ok := err.(*ParseError)
+ // if !ok {
+ // t.Error("failed to return parse error")
+ // return
+ // }
+ //
+ // if perr.Verbose() != expected {
+ // t.Error("failed to get the right error message")
+ // t.Log("got: ", perr.Verbose())
+ // t.Log("expected:", expected)
+ // }
}
func TestLongestFail(t *testing.T) {
diff --git a/syntax.go b/syntax.go
index 847f731..9428272 100644
--- a/syntax.go
+++ b/syntax.go
@@ -169,9 +169,9 @@ func (pe *ParseError) Error() string {
)
}
-func (pe *ParseError) Verbose() string {
- return ""
-}
+// func (pe *ParseError) Verbose() string {
+// return ""
+// }
func (s *Syntax) applyRoot(d definition) error {
explicitRoot := d.commitType()&Root != 0