You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't know if this is feasible at all, but for some grammars this could be very well worth it. So, rationale and other incoherent thoughts follow:
Sometimes you need to parse a grammar which is a combination of different grammars. For example, Markdown and Textile include rules for HTML, most grammars include definitions for newlines and white spaces, large grammars could be split into a number of blocks that define various aspects of the grammar in question.
So, perhaps it is possible to give the grammar author the possibility to include relevant rules from external files?
Something along the lines:
main.peg
document <- block1 block2 block3
%% retrieve block2 rule from block2.peg
block1 <- ``block1.peg``
%% assign some_rule definition to block2 from block2.peg
block2 <- ``block2.peg:some_rule``
block3 <- sub_block1 sub_block2
%% retrieve all rule definitions from sub_blocks.peg
``sub_blocks.peg``
block1.peg
block1 <- "some text"
block2.peg
some_rule <- "some other rule"
sub_blocks.peg
sub_block1 <- "rule1"
sub_block2 <- "rule2"
So, when run, Neotoma would work on the following resulting file:
document <- block1 block2 block3
%% retrieve block2 rule from block2.peg
block1 <- "some text"
%% assign some_rule definition to block2 from block2.peg
block2 <- "some other rule"
block3 <- sub_block1 sub_block2
%% retrieve all rule definitions from sub_blocks.peg
sub_block1 <- "rule1"
sub_block2 <- "rule2"
The text was updated successfully, but these errors were encountered:
I don't know if this is feasible at all, but for some grammars this could be very well worth it. So, rationale and other incoherent thoughts follow:
Sometimes you need to parse a grammar which is a combination of different grammars. For example, Markdown and Textile include rules for HTML, most grammars include definitions for newlines and white spaces, large grammars could be split into a number of blocks that define various aspects of the grammar in question.
So, perhaps it is possible to give the grammar author the possibility to include relevant rules from external files?
Something along the lines:
main.peg
block1.peg
block2.peg
sub_blocks.peg
So, when run, Neotoma would work on the following resulting file:
The text was updated successfully, but these errors were encountered: