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

Comments are not supported #1

Open
sk- opened this issue Feb 23, 2015 · 0 comments
Open

Comments are not supported #1

sk- opened this issue Feb 23, 2015 · 0 comments

Comments

@sk-
Copy link

sk- commented Feb 23, 2015

Parsing a file with comments is not supported. For the following script:

# A comment
echo "A script with a comment"

The sample program (the one in the README) generates the following error:

Traceback (most recent call last):
  File "sp.py", line 4, in <module>
    parts = bashlex.parse(open(sys.argv[1]).read())
  File "/usr/local/lib/python2.7/dist-packages/bashlex/parser.py", line 582, in parse
    parts = [p.parse()]
  File "/usr/local/lib/python2.7/dist-packages/bashlex/parser.py", line 641, in parse
    tree = theparser.parse(lexer=self.tok, context=self)
  File "/usr/local/lib/python2.7/dist-packages/bashlex/yacc.py", line 277, in parse
    return self.parseopt_notrack(input,lexer,debug,tracking,tokenfunc,context)
  File "/usr/local/lib/python2.7/dist-packages/bashlex/yacc.py", line 1079, in parseopt_notrack
    tok = self.errorfunc(errtoken)
  File "/usr/local/lib/python2.7/dist-packages/bashlex/parser.py", line 539, in p_error
    p.lexer.source, p.lexpos)
bashlex.errors.ParsingError: unexpected token 'echo' (position 12)
mgorny added a commit to mgorny/bashlex that referenced this issue Mar 4, 2020
While the project seems very interesting at first, many people discover
it's not very helpful if it crashes on comments or empty lines.  Given
that the problems are known since 2015 (issues idank#1, idank#2), I think it's
only fair to list them in the 'limitations' section.  Arrays are also
an important missing feature (idank#24).
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

1 participant