Allow variable names on elements
parent
55a69392fa
commit
ee2194d1dc
|
@ -102,7 +102,7 @@ C: <ebnf> ebnf
|
||||||
"]" syntax ,
|
"]" syntax ,
|
||||||
] seq* [ first >string <ebnf-range> ] action ;
|
] seq* [ first >string <ebnf-range> ] action ;
|
||||||
|
|
||||||
: 'element' ( -- parser )
|
: ('element') ( -- parser )
|
||||||
#! An element of a rule. It can be a terminal or a
|
#! An element of a rule. It can be a terminal or a
|
||||||
#! non-terminal but must not be followed by a "=".
|
#! non-terminal but must not be followed by a "=".
|
||||||
#! The latter indicates that it is the beginning of a
|
#! The latter indicates that it is the beginning of a
|
||||||
|
@ -120,6 +120,12 @@ C: <ebnf> ebnf
|
||||||
] choice* ,
|
] choice* ,
|
||||||
] seq* [ first ] action ;
|
] seq* [ first ] action ;
|
||||||
|
|
||||||
|
: 'element' ( -- parser )
|
||||||
|
[
|
||||||
|
[ ('element') , ":" syntax , "a-zA-Z" range-pattern repeat1 [ >string ] action , ] seq* [ first2 <ebnf-var> ] action ,
|
||||||
|
('element') ,
|
||||||
|
] choice* ;
|
||||||
|
|
||||||
DEFER: 'choice'
|
DEFER: 'choice'
|
||||||
|
|
||||||
: grouped ( quot suffix -- parser )
|
: grouped ( quot suffix -- parser )
|
||||||
|
|
Loading…
Reference in New Issue