Skip to content

Commit 04731ab

Browse files
committed
Fix binding for in, not, and do on/after command calls
1 parent 8cc4eda commit 04731ab

8 files changed

Lines changed: 414 additions & 300 deletions

src/prism.c

Lines changed: 388 additions & 290 deletions
Large diffs are not rendered by default.

test/prism/errors/command_call_in.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ foo 1 in a
22
^~ unexpected 'in', expecting end-of-input
33
^~ unexpected 'in', ignoring it
44
a = foo 2 in b
5+
^~ unexpected 'in', expecting end-of-input
56

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
a = b c and 1
2+
^~~ unexpected 'and', expecting end-of-input
3+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
a = b c or 1
2+
^~ unexpected 'or', expecting end-of-input
3+

test/prism/errors/command_calls_34.txt

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
foo(bar 1 do end, 2)
2-
^ invalid comma
3-
^ unexpected integer; expected a `)` to close the arguments
4-
^ unexpected integer, expecting end-of-input
2+
^~ unexpected 'do'; expected a `)` to close the arguments
3+
^~ unexpected 'do', expecting end-of-input
4+
^~ unexpected 'do', ignoring it
5+
^~~ unexpected 'end', ignoring it
6+
^ unexpected ',', ignoring it
57
^ unexpected ')', expecting end-of-input
68
^ unexpected ')', ignoring it
79

810
foo(bar 1 do end,)
9-
^ invalid comma
11+
^~ unexpected 'do'; expected a `)` to close the arguments
12+
^~ unexpected 'do', expecting end-of-input
13+
^~ unexpected 'do', ignoring it
14+
^~~ unexpected 'end', ignoring it
15+
^ unexpected ',', ignoring it
16+
^ unexpected ')', ignoring it
1017

1118
foo(1, bar 2 do end)
1219
^ unexpected integer; expected a `)` to close the arguments

test/prism/errors/command_calls_35.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ p(p a, &block => value)
1414
^ unexpected ')', ignoring it
1515

1616
p(p a do end => value)
17-
^~ unexpected '=>'; expected a `)` to close the arguments
17+
^~ unexpected 'do'; expected a `)` to close the arguments
18+
^~ unexpected 'do', expecting end-of-input
19+
^~ unexpected 'do', ignoring it
20+
^~~ unexpected 'end', ignoring it
21+
^~ unexpected '=>', ignoring it
1822
^ unexpected ')', expecting end-of-input
1923
^ unexpected ')', ignoring it
2024

test/prism/errors/destroy_call_operator_write_arguments.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ t next&&do end&=
22
^~ unexpected 'do'; expected an expression after the operator
33
^~~~ unexpected void value expression
44
^~~~ unexpected void value expression
5-
^~~~~~~~~~~~~~ unexpected write target
6-
^~ unexpected operator after a call with arguments
7-
^~ unexpected operator after a call with a block
5+
^~ unexpected '&=', expecting end-of-input
6+
^~ unexpected '&=', ignoring it
7+
^~~~ Invalid next
88
''while=
99
^~~~~ expected a predicate expression for the `while` statement
1010
^ unexpected '='; target cannot be written
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
foo(bar baz do end)
2-
31
foo(bar baz, bat)

0 commit comments

Comments
 (0)