peg.ebnf: Rename EBNF< to EBNF-MAIN{{

locals-and-roots
Doug Coleman 2016-06-20 14:27:38 -07:00
parent 8c43b1f7d9
commit 80d8b17eaa
3 changed files with 19 additions and 9 deletions

View File

@ -761,15 +761,15 @@ SYMBOLS: $1 $2 $3 $4 ;
! is the getter word for that register with stack effect ! is the getter word for that register with stack effect
! ( cpu -- value ). The second item is the setter word with ! ( cpu -- value ). The second item is the setter word with
! stack effect ( value cpu -- ). ! stack effect ( value cpu -- ).
EBNF< EBNF-MAIN{{
main=("A" | "B" | "C" | "D" | "E" | "H" | "L") => [[ register-lookup ]] main=("A" | "B" | "C" | "D" | "E" | "H" | "L") => [[ register-lookup ]]
EBNF> ; }} ;
: all-flags ( -- parser ) : all-flags ( -- parser )
! A parser for 16-bit flags. ! A parser for 16-bit flags.
EBNF< EBNF-MAIN{{
main=("NZ" | "NC" | "PO" | "PE" | "Z" | "C" | "P" | "M") => [[ flag-lookup ]] main=("NZ" | "NC" | "PO" | "PE" | "Z" | "C" | "P" | "M") => [[ flag-lookup ]]
EBNF> ; }} ;
: 16-bit-registers ( -- parser ) : 16-bit-registers ( -- parser )
! A parser for 16-bit registers. On a successfull parse the ! A parser for 16-bit registers. On a successfull parse the
@ -777,9 +777,9 @@ SYMBOLS: $1 $2 $3 $4 ;
! is the getter word for that register with stack effect ! is the getter word for that register with stack effect
! ( cpu -- value ). The second item is the setter word with ! ( cpu -- value ). The second item is the setter word with
! stack effect ( value cpu -- ). ! stack effect ( value cpu -- ).
EBNF< EBNF-MAIN{{
main=("AF" | "BC" | "DE" | "HL" | "SP") => [[ register-lookup ]] main=("AF" | "BC" | "DE" | "HL" | "SP") => [[ register-lookup ]]
EBNF> ; }} ;
: all-registers ( -- parser ) : all-registers ( -- parser )
! Return a parser that can parse the format ! Return a parser that can parse the format

View File

@ -507,7 +507,7 @@ foo=<foreign any-char> 'd'
] unit-test ] unit-test
[ [
"USING: peg.ebnf ; EBNF< foo='a' foo='b' EBNF>" eval( -- ) drop "USING: peg.ebnf ; EBNF-MAIN{{ foo='a' foo='b' }}" eval( -- ) drop
] must-fail ] must-fail
{ t } [ { t } [

View File

@ -537,8 +537,13 @@ ERROR: could-not-parse-ebnf ;
PRIVATE> PRIVATE>
SYNTAX: \ EBNF< SYNTAX: \ EBNF-MAIN{{
"EBNF>" "}}"
reset-tokenizer parse-multiline-string parse-ebnf main of
suffix! reset-tokenizer ;
SYNTAX: \ EBNF-MAIN((
"))"
reset-tokenizer parse-multiline-string parse-ebnf main of reset-tokenizer parse-multiline-string parse-ebnf main of
suffix! reset-tokenizer ; suffix! reset-tokenizer ;
@ -547,6 +552,11 @@ SYNTAX: \ EBNF{{
reset-tokenizer parse-multiline-string ebnf>quot nip reset-tokenizer parse-multiline-string ebnf>quot nip
suffix! \ call suffix! reset-tokenizer ; suffix! \ call suffix! reset-tokenizer ;
SYNTAX: \ EBNF((
"))"
reset-tokenizer parse-multiline-string ebnf>quot nip
suffix! \ call suffix! reset-tokenizer ;
SYNTAX: \ EBNF: SYNTAX: \ EBNF:
reset-tokenizer scan-new-word dup "EBNF;" parse-multiline-string reset-tokenizer scan-new-word dup "EBNF;" parse-multiline-string
ebnf>quot swapd ebnf>quot swapd