Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想创建一个树顶语法。我创建了规则来匹配文件中我感兴趣的部分。
grammar Sexp rule bodies body+ end rule body commentPortString (ifdef_blocks / interface)+ (!newLine) end ... end
如何在文件上运行它以提取bodies并忽略我不关心的其他部分,或者我是否还需要最终为这些部分编写规则?
bodies
提前致谢
重复匹配.不属于规则的任何字符是PEG 语法中的常见习语!body。像这样的东西:
.
!body
rule bodies ((!body .)* body)+ (!body .)* end