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

Cannot parse array initialization statement #24

Open
konfilios opened this issue Mar 14, 2017 · 1 comment
Open

Cannot parse array initialization statement #24

konfilios opened this issue Mar 14, 2017 · 1 comment

Comments

@konfilios
Copy link

Quoting Bash Guide for Beginners :: 10.2.1. Creating arrays:

Array variables may also be created using compound assignments in this format:

ARRAY=(value1 value2 ... valueN)

I have lots of scripts with such statements:

ARRAY=('value1' 'value2')

However they raise a ParsingError:

  File "/usr/local/lib/python2.7/dist-packages/bashlex/parser.py", line 682, 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 '(' (position 6)
@idank
Copy link
Owner

idank commented Mar 18, 2017

Sorry that it doesn't work, I've never tested arrays honestly so not that surprised.

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

2 participants