bashlex
bashlex copied to clipboard
Python parser for bash
Edits
Made some changes to parser and ast to support case_clauses and patterns. Submitting as a draft PR because I'm not sure if it is correct (it looks correct to me...
This PR fixes two active issues: #79 and #74. It fixes the backslash newline issue by moving the tokenizer forward another index in the case that we see '\' followed...
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...
Working off of the base for PR #71 so this will be relevant after that PR is merged. Multiple new lines at the end of an input triggers an "Unexpected...
If an assign statement is used after local, global, and export it is treated as a word node, not an assignment node.
So currently the p_arith_command and _extractcommandsubst functions pop a NotImplemented errors when an arithmetic expression is found. In bash-master/make_cmd line 430, the make_arith_command function is implemented simply to set the...
https://www.gnu.org/software/bash/manual/html_node/ANSI_002dC-Quoting.html Expected result: ``` >>> list(bashlex.split("echo $'hello'")) ['echo', 'hello'] >>> list(bashlex.split("echo $'hello\\nworld'")) ['echo', 'hello\nworld'] # notice \\n becomes a real newline character \n ``` Actual result (`bashlex` 0.15): ``` >>>...
Could you please also include a wheel when releasing bashlex? Only the classic ".egg" is provided, so this triggers a SDist install (I don't think .egg's are used anymore, setuptools-scm...
I added a failed case, but I am not sure if it a correct way to do it.
``` >>> bashlex.parse('cmd1\ncmd2 \ncmd3\n') Traceback (most recent call last): File "", line 1, in File "bashlex/parser.py", line 614, in parse part = _parser(s[index:], strictmode=strictmode).parse() File "bashlex/parser.py", line 682, in parse...