antlr3 NOT 规则
negExpression : (NOT^)* primitiveElement ;
这是我的规则。我现在有这样的代码:
!!(1==1)
我期望我最终会得到这棵树:
NOT
|
NOT
|
==
/ \
1 1
一样结束
NOT
/ \
NOT ==
/ \
1 1
但是,在 Antlr3 中,这棵树似乎像IE 。我最终得到的第二个节点没有子节点,而是它应该具有的子节点已成为其兄弟节点。
我做错了什么?
negExpression : (NOT^)* primitiveElement ;
Is the rule I have. I now have this code:
!!(1==1)
I expected I would end up with this tree:
NOT
|
NOT
|
==
/ \
1 1
However, in Antlr3, it seems the tree ends up like
NOT
/ \
NOT ==
/ \
1 1
IE. I end up with the second NOT having no children, instead the child node it should have, has become its sibling node.
What am I doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当我写下这个问题时,我意识到我的规则可能是错误的。
事实上,这完全符合我的预期。
And as I wrote the question, it came to me that my rule was perhaps wrong.
And indeed, this one does exactly what I expected.