Created
December 18, 2015 01:04
-
-
Save skids/b4caab210a473a586d51 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
regex ℙ_production { | |
( <ℙ_new-lexical-item-name> ) <ℙ_lexical_separator> | |
'::=' <ℙ_lexical_separator> | |
# This next bit should be producing a prestructured lol-ish thing. | |
# Two things NYI|buggy prevent that: | |
# 1) @<alternatives>=(...)* | |
# 2) /(...) :my $f = $0; ($f)/ | |
# So though it may appear the below several lines would be simpler | |
# put as [ $<a>=a | $<b>=b | $<c>=c ]* % <sep> | |
# they are kept in a future-looking form. | |
[ [ $<ℙ_recursive>=$0 <.ℙ_ident_stopper> | <ℙ_lexical-item> ]* | |
%% <ℙ_lexical_separator> | |
]* | |
% [ $<ℙ_next_alternative>='|' <ℙ_lexical_separator> ] | |
{ @defined-lexical-item-names.push($0); | |
my $r := production_to_rx($/); | |
$r.set_name($0); | |
self.^add_method($0, $r); | |
@defined-lexical-items.push($r); | |
make $r; | |
} | |
} | |
... | |
regex ℙ_defined-lexical-item-name { | |
@defined-lexical-item-names | |
} | |
our @defined-lexical-items = (); | |
regex ℙ_defined-lexical-item { | |
<@defined-lexical-items> | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment