Skip to content

Commit

Permalink
improve parser for jq compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
itchyny committed Jul 5, 2020
1 parent 2346a5b commit 6cdc968
Show file tree
Hide file tree
Showing 6 changed files with 538 additions and 498 deletions.
2 changes: 1 addition & 1 deletion builtin.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions cli/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2086,6 +2086,23 @@
expected: |
7
- name: condition with optional operator
args:
- 'if . then tonumber end ?'
input: '1'
expected: |
1
- name: condition with suffix
args:
- 'if . then 1 end []'
input: '1'
error: |
invalid query: if . then 1 end []
if . then 1 end []
^ unexpected token "["
exit_code: 3

- name: not function
args:
- 'map(not)'
Expand Down
2 changes: 1 addition & 1 deletion compiler.go
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ func (c *compiler) compileTry(e *Try) error {
setforktrybegin()
if e.Catch != nil {
defer c.newScopeDepth()()
return c.compileTerm(e.Catch)
return c.compileQuery(e.Catch)
}
c.append(&code{op: opbacktrack})
return nil
Expand Down
Loading

0 comments on commit 6cdc968

Please sign in to comment.