bashlex
bashlex copied to clipboard
Cannot parse array initialization statement
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)
Sorry that it doesn't work, I've never tested arrays honestly so not that surprised.