idank / bashlex

Python parser for bash
GNU General Public License v3.0
550 stars 94 forks source link

Airthmetic Command Implementation #68

Open BlankCanvasStudio opened 2 years ago

BlankCanvasStudio commented 2 years ago

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 .value attribute equal to the string, the flags to zero, give the node type cm_arith, and set the redirects to null. Would adding this implementation into the p_arith_command function be an acceptable fix? subst.py would also need to be changed to implement these functions. If you just call _parsedelparen on the airthmetic expression, the parsing seems to work just fine. The parens shouldn't be parsed as nodes and the node type should be 'arith_cmd' but those are easy fixes. Is there something I am missing as to why these aren't implemented?

idank commented 2 years ago

Sounds good to me. It was left empty because I didn't have a need for it at the time. If it's easy to add, go for it.

BlankCanvasStudio commented 2 years ago

So I have the implementation for this finished. I add unit tests and such. I was going to add this to my branch and set a pull request but I realized my previous pull request has been merged. I was just wondering why alphanumeric support (fixing issue #66 ) hasn't been added?

idank commented 2 years ago

I didn't notice that pull request, sorry. See the comment I left there.