bashlex
bashlex copied to clipboard
backslash newline fails
The tokenizer fails to parse files with backslashes separating lines properly\
For example:
for hook in \
/etc/* \
/lib/* \
/etc/*
do
echo hook
done
Results in the following exception:
Exception has occurred: ParsingError (note: full exception trace is shown but execution is paused at: <module>)
unexpected token '/etc/*' (position 15)
File "[/bashlex/bashlex/parser.py]()", line 589, in p_error
raise errors.ParsingError('unexpected token %r' % p.value,
File "[/bashlex/bashlex/yacc.py]()", line 1107, in parseopt_notrack
tok = self.errorfunc(errtoken)
File "[/bashlex/bashlex/yacc.py]()", line 277, in parse
return self.parseopt_notrack(input,lexer,debug,tracking,tokenfunc,context)
File "[/bashlex/bashlex/parser.py]()", line 733, in parse
tree = theparser.parse(lexer=self.tok, context=self)
File "[/bashlex/bashlex/parser.py]()", line 652, in parse
parts = [p.parse()]
File "[/bashlex/example.py]()", line 4, in <module> (Current frame)
parts = bashlex.parse(script)