Skip to content

Commit

Permalink
change query parser error message on unexpected EOF
Browse files Browse the repository at this point in the history
  • Loading branch information
itchyny committed May 29, 2022
1 parent 7aafcc9 commit bd9c0ab
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions cli/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2400,7 +2400,7 @@
error: |
invalid query: .?/
.?/
^ unexpected token <EOF>
^ unexpected EOF
exit_code: 3

- name: factorial calculation
Expand Down Expand Up @@ -3242,7 +3242,7 @@
error: |
invalid query: label $x | break
label $x | break
^ unexpected token <EOF>
^ unexpected EOF
exit_code: 3

- name: variable and label name conflict
Expand Down Expand Up @@ -6768,7 +6768,7 @@
error: |
invalid query: .abc[
.abc[
^ unexpected token <EOF>
^ unexpected EOF
exit_code: 3

- name: invalid query
Expand Down Expand Up @@ -7209,7 +7209,7 @@
error: |
invalid query: testdata/7.jq:1
1 | def f: 1 +
^ unexpected token <EOF>
^ unexpected EOF
exit_code: 3

- name: module directive
Expand Down Expand Up @@ -7773,7 +7773,7 @@
error: |
invalid query: --
--
^ unexpected token <EOF>
^ unexpected EOF
exit_code: 3

- name: short clumped options
Expand Down
2 changes: 1 addition & 1 deletion lexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ type parseError struct {
func (err *parseError) Error() string {
switch err.tokenType {
case eof:
return "unexpected token <EOF>"
return "unexpected EOF"
case tokInvalid:
return "invalid token " + jsonMarshal(err.token)
case tokInvalidEscapeSequence:
Expand Down

0 comments on commit bd9c0ab

Please sign in to comment.