Replies: 4 comments
-
Hi @dodumosu. That is due to the way Arpeggio deals with plain string matches. When you have something in your grammar that will always match the same (string match without choice operator), Arpeggio will suppress that node as it carry no additional information to the analysis. You know that terminal must be there or else your visitor wouldn't be called. So in case of That was an early design decision. I'm not sure anymore that it was the right one :) I was sure that this is documented but can't find anything at the moment. If it's not documented please leave this open until the docs are extended to explain this. |
Beta Was this translation helpful? Give feedback.
-
@igordejanovic thanks for your reply. having read the docs again, i've noticed that returning |
Beta Was this translation helpful? Give feedback.
-
Actually, returning If you are asking how can you get |
Beta Was this translation helpful? Give feedback.
-
Thank you. That was what I did, eventually, then in a higher-level visitor, I transformed the value to |
Beta Was this translation helpful? Give feedback.
-
Hello. I'm not quite sure what I'm doing wrong, but I tried to extend your calc example to work with more operators and aid my understanding of how to work with Arpeggio, and everything except the exponent and null rules are working as expected.
I get an
IndexError
when I use 'NULL' in any expression. I also realized that any expression involving '^' didn't work as expected. For example, with the original (commented out) code, the expression '4 ^ 2' would return 4.0.I'm sure this is all my own mistake, but if you could clarify this, I'd be most grateful. Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions