vaidik / commentjson

Add JavaScript or Python style comments in JSON.
MIT License
104 stars 25 forks source link

AssertionError caused by lark-parser==0.7.2 #25

Closed jonhammer closed 5 years ago

jonhammer commented 5 years ago

Tested in python 2.7.

>>> from commentjson import commentjson
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/jhammer/Envs/test2/lib/python2.7/site-packages/commentjson/__init__.py", line 1, in <module>
    from .commentjson import dump
  File "/Users/jhammer/Envs/test2/lib/python2.7/site-packages/commentjson/commentjson.py", line 54, in <module>
    ''', start='start')
  File "/Users/jhammer/Envs/test2/lib/python2.7/site-packages/lark/lark.py", line 226, in __init__
    self.parser = self._build_parser()
  File "/Users/jhammer/Envs/test2/lib/python2.7/site-packages/lark/lark.py", line 245, in _build_parser
    parser_conf = ParserConf(self.rules, self._callbacks, self.options.start)
  File "/Users/jhammer/Envs/test2/lib/python2.7/site-packages/lark/common.py", line 23, in __init__
    assert isinstance(start, list)
AssertionError
Sreevalli961 commented 5 years ago

Traceback (most recent call last): File "C:\auto_fat\auto_fat_check.py", line 5, in import commentjson File "C:\Python27\lib\site-packages\commentjson__init.py", line 1, in from .commentjson import dump File "C:\Python27\lib\site-packages\commentjson\commentjson.py", line 54, in ''', start='start') File "C:\Python27\lib\site-packages\lark\lark.py", line 226, in init self.parser = self._build_parser() File "C:\Python27\lib\site-packages\lark\lark.py", line 245, in _build_parser parser_conf = ParserConf(self.rules, self._callbacks, self.options.start) File "C:\Python27\lib\site-packages\lark\common.py", line 23, in init__ assert isinstance(start, list) AssertionError

The same issue i am facing since this morning. I need to resolve this issue as soon as possible . can you help me out with this issue.

Sreevalli961 commented 5 years ago

@jonhammer i resolved this issue . I think this step will resolve your issue also

In the commentjson.py file remove start = 'start'

parser = Lark(''' ?start: value ?value: object | array | string | SIGNED_NUMBER -> number | "true" -> true | "false" -> false | "null" -> null array : "[" [value ("," value)] "]" object : "{" [pair ("," pair)] "}" pair : string ":" value string : ESCAPED_STRING

COMMENT: /(#|\/\/)[^\\n]*/

%import common.ESCAPED_STRING
%import common.SIGNED_NUMBER
%import common.WS
%ignore WS
%ignore COMMENT

''' ,start = 'start')

vaidik commented 5 years ago

Confirm this. lark-parser==0.7.2 broke this. Wasn't a problem with 0.7.1

vaidik commented 5 years ago

Just made a release to fix this issue. Solution suggested by @Sreevalli961 helped. Thanks for that. :)

Sreevalli961 commented 5 years ago

My pleasure

On Fri, Aug 2, 2019, 3:49 PM Vaidik Kapoor notifications@github.com wrote:

Just made a release to fix this issue. Solution suggested by @Sreevalli961 https://github.com/Sreevalli961 helped. Thanks for that. :)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/vaidik/commentjson/issues/25?email_source=notifications&email_token=AF5JTPAE7TYHLYPDYFC6HQ3QCPDILA5CNFSM4IH76PFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3MVTMQ#issuecomment-517560754, or mute the thread https://github.com/notifications/unsubscribe-auth/AF5JTPB5XT7ALDGU7AHCAE3QCPDILANCNFSM4IH76PFA .