-
Notifications
You must be signed in to change notification settings - Fork 14
Closed
Description
After #83 this code:
def foo
1,2,3,4]
end
Produces this incorrect label:
DeadEnd: Unmatched `end` detected
This code has an unmatched `end`. Ensure that all `end` lines
in your code have a matching syntax keyword (`def`, `do`, etc.)
and that you don't have any extra `end` lines.
file: /tmp/scratch.rb
simplified:
1 def foo
❯ 2 1,2,3,4]
3 end
Known syntax error variations:
Here are some syntax errors that Ruby will generate for various code:
$ cat <<EOF | ruby -wc
def foo
1,2,3,4]
end
EOF
-:2: syntax error, unexpected ',', expecting `end'
1,2,3,4]
$ cat <<EOF | ruby -wc
def foo
foo = 1,2,3,4]
end
EOF
-:2: syntax error, unexpected ']', expecting `end'
foo = 1,2,3,4]
Fix
This is related to #68 because missing a leading bracket seems to be a general special case. Ideally, we tell the user that they're missing the bracket. If we can't do that, maybe we can avoid outputting an incorrect message.
Metadata
Metadata
Assignees
Labels
No labels