slimit
slimit copied to clipboard
keywords incorrectly disallowed as object property names
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)
This is related to #59