Closed pbiggar closed 8 years ago
This fix is definitely wrong (function definitions no longer parse). Would love advice on how to solve it properly.
Here's where assignments are parsed: https://github.com/knrafto/language-bash/blob/master/src/Language/Bash/Parse/Word.hs#L329
Thanks for the link. I realize I forgot to let you know what I've done so far and to provide context - I didn't mean to imply I was too lazy to look at the code.
I did spend quite a bit of time last week looking at the assignment parser. After minimizing the grammar and playing around with a bunch of different examples, I believe that the assignment parser works just fine, but isn't being used. You can see this by using the code in the PR: if you remove "("
and ")"
from the list of operators, then the assignment parser works perfectly.
However, after that I am stumped. I'm new to Haskell and Parsec and combinator based parsing (previous parsing experience is in Bison, Antlr and Spirit). I feel there might be a precedence issue here, but I really don't know what to do with that.
Any pointers you have would be much appreciated. Thanks!
Hey, just wanted to follow up and see if you had any other thoughts on how to address this issue?
Really sorry for the delay - busy week.
Looks like the issue is that the parser thinks a=()
is trying to define a function named a=
(that's why it says it expects a {
). It's an easy fix, here's a patch (I can't push to your branch): http://pastebin.com/vVwncmuW
Thanks a lot for the unit tests!
Thanks! This should be ready to merge.
Sorry, thought I merged this already. My bad
Assignments where the rvalue was an empty array didn't work. This adds some unit tests, including a test that that works.
I'm not sure if the fix is correct, but I tried lots of things to figure this out. Basically, the grammar for Assign is correct, but the operators stuff has higher precedence. If you have a better fix I'm happy to implement it.