Closed andrewbaxter closed 4 years ago
This is related to the widly reported issue in slimit (first in rspivak/slimit#52, then rspivak/slimit#59, rspivak/slimit#81, rspivak/slimit#90) where slimit fails to parse reserved keywords as bare keys occurring inside objects and as attributes. This was fixed in calmjs.parse
>>> from calmjs.parse import es5
>>> es5('var x = {class: 4};')
<ES5Program @1:1 ?children=[
<VarStatement @1:1 ?children=[
<VarDecl @1:5 identifier=<Identifier ...>, initializer=<Object ...>>
]>
]>
@redapple Would moving to calmjs.parse
be the right move here?
@Gallaecio , I believe so. If someone wants to give a shot at it. I don't know how easy the XmlVisitor
is to rewrite when using calmjs.parse
though.
The "visitor" pattern can still be used, however certain class names for the nodes have changed (e.g. Program
-> ES5Program
), or that new nodes have been introduced. The best way to catch this is to have the generic_visit
method in the xmlvisitor class to raise Exception(repr(node))
instead of returning a string and this will show the node that couldn't be handled.
outputs: