Skip to content
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

keywords incorrectly disallowed as object property names #90

Open
jason-s opened this issue Jan 13, 2017 · 1 comment
Open

keywords incorrectly disallowed as object property names #90

jason-s opened this issue Jan 13, 2017 · 1 comment

Comments

@jason-s
Copy link

jason-s commented Jan 13, 2017

This works just fine in Javascript:

> keywordobj = {for: 3, if: 7, while: 99, in: 66, function: 33}
Object {for: 3, if: 7, while: 99, in: 66, function: 33}
> keywordobj.for
3
> keywordobj.while
99

but the use of keywords causes slimit to puke:

from slimit import ast
from slimit.parser import Parser
from slimit.visitors import nodevisitor

parser = Parser()
tree = parser.parse("x={a: 3, b: 7, c: 99, d: 66, e: 33}")
print "x read"
tree = parser.parse("y={for: 3, if: 7, while: 99, in: 66, function: 33}")
print "y read"

which reports x read and then

SyntaxError: Unexpected token (FOR, 'for') at 1:3 between LexToken(LBRACE,'{',1,2) and LexToken(COLON,':',1,6)
@metatoaster
Copy link

This is related to #59

metatoaster added a commit to calmjs/calmjs.parse that referenced this issue Jun 8, 2017
- Also note that the following issues were addressed, where applicable
  to the lexer or parser.

  - rspivak/slimit#52
  - rspivak/slimit#54
  - rspivak/slimit#57
  - rspivak/slimit#59
  - rspivak/slimit#62
  - rspivak/slimit#65
  - rspivak/slimit#70
  - rspivak/slimit#73
  - rspivak/slimit#79
  - rspivak/slimit#81
  - rspivak/slimit#82
  - rspivak/slimit#90

- Will get the release out when I get some sleep.
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

No branches or pull requests

2 participants