如何在树顶钉中定义 {min,max} 匹配
使用 Ruby 的正则表达式,我可以编写 /[0-9]{3,}/ 除了:树顶
rule at_least_three_digit_number
[0-9] [0-9] [0-9]+
end
是否有“匹配[至少|最] n”规则?
With Ruby's regular expressions I could write /[0-9]{3,}/ I can't figure out how to write this in treetop other than:
rule at_least_three_digit_number
[0-9] [0-9] [0-9]+
end
Is there a 'match [at least|most] n' rule for treetop?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看起来 PEG 没有一些 RE 便利运算符,但作为回报,您确实获得了更强大的表达式匹配器。
It looks like PEGs don't have some of the RE convenience operators, but in return you do get a much more powerful expression matcher.
http://treetop.rubyforge.org/syntactic_recognition.html