-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expansions #196
Expansions #196
Conversation
|
I don't think that's valid... |
it's in the examples corpus (bash repo) Fixing some things breaks others, and vice versa 😁 |
The circle of life. |
Maybe you could make expansions start with |
${!##} is doing my head in |
42957cb
to
29d4030
Compare
a56888e
to
53f03b5
Compare
after a few painful hours I think I have a complete solution, would appreciate you trying it out @ObserverOfTime |
Expansions appear to be fine now but there are a few arithmetic issues left.
echo $((- f))
echo $((-f)) Parse tree
|
are test operators allowed in arithmetic expansions? (I'm guessing no) |
Not as far as I can tell. echo $((0 -eq 0))
# bash: 0 -eq 0: syntax error in expression (error token is "0") I assume it parses |
all operators are fielded & should be exposed (incl. unary ops) |
Hmm interesting, token(prec(choice(...))) prevents querying the operators, but not choice(...token(prec())) (no need for aliasing) |
I still can't seem to capture unary operators. |
got a sample query code? this works for me on this branch: (unary_expression "+" @op) |
Does it work with |
damn, the query compiles but doesn't seem to execute properly, I'll bring back the aliases |
I will once again advocate for a |
try now @ObserverOfTime |
No field. :^) |
would you consider ternaries as candidates to be fielded as operator? |
It's fine either way. |
Alright, I don't really care to - so this should be good as is hopefully |
Yeah, finally bash is usable. |
Yeah it was pretty "eh" the few times I used it in the past :^) (and arithmetic expansions broke everything) But writing the parser this language definitely sucks |
What do you mean this language sucks? 💢 |
pfft...it won't suck all that much compared to zsh 😬 🤢 |
Or powershell. |
as if I'd want to touch Windows 😁 |
@amaanq powershell actually runs on Linux and macOS, it's even open source under the MIT license. |
wow, I never knew, that's cool but I wonder if people actually use it on a non-Windows OS (except for cross-platform testing) |
@ObserverOfTime