Skip to content

Fix 1096, 1131, 1828: Improve error messages for generated tokens #3319

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 22, 2014

Conversation

xixixao
Copy link
Contributor

@xixixao xixixao commented Jan 22, 2014

Ok, here we go. Fixes #1096, #1131, #1828 and hopefully the hundred duplicates out there.

Pointing out errors not handled by this would be welcomed.

# Unexpected interpolation
    [stdin]:1:3: error: unexpected string interpolation
    {"#{key}": val}
      ^^
  # Implicit ends
    [stdin]:1:3: error: unexpected ,
    a:, b
      ^
  # Explicit ends
    [stdin]:1:4: error: unexpected )
    (a:)
       ^
  # Unexpected end of file
    [stdin]:1:3: error: unexpected end of input
    a:
      ^
  # Unexpected implicit object
    [stdin]:1:13: error: unexpected :
    for i in [1]:
                ^

@xixixao
Copy link
Contributor Author

xixixao commented Jan 22, 2014

Maybe object literal or : causing object literal would be better, see the examples:

coffee -bpe '
foo:
  spaces: 2
    spaces: 4
'
[stdin]:4:11: error: unexpected :
    spaces: 4
          ^

coffee -bpe '
foo "a" b:1
'
[stdin]:2:10: error: unexpected :
foo "a" b:1
         ^

coffee -bpe '
object:
  a.property: "value"
'
[stdin]:3:13: error: unexpected :
  a.property: "value"
            ^

coffee -bpe '
{ a: 1
  b: 2 }
'
[stdin]:3:4: error: unexpected :
  b: 2 }
   ^

@jashkenas
Copy link
Owner

Bravo. Very neat approach of adding the origin.

jashkenas added a commit that referenced this pull request Jan 22, 2014
Fix 1096, 1131, 1828: Improve error messages for generated tokens
@jashkenas jashkenas merged commit b3463a1 into jashkenas:master Jan 22, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unexpected { in a::b: ->
2 participants