Add \r to ebnf escape rules

db4
Chris Double 2008-04-07 14:39:18 +12:00
parent 719376e412
commit a641c6d332
1 changed files with 5 additions and 1 deletions

View File

@ -361,7 +361,11 @@ M: ebnf-non-terminal (transform) ( ast -- parser )
[ compiled-parse ] curry [ with-scope ] curry ;
: replace-escapes ( string -- string )
"\\t" token [ drop "\t" ] action "\\n" token [ drop "\n" ] action 2choice replace ;
[
"\\t" token [ drop "\t" ] action ,
"\\n" token [ drop "\n" ] action ,
"\\r" token [ drop "\r" ] action ,
] choice* replace ;
: [EBNF "EBNF]" parse-multiline-string replace-escapes ebnf>quot nip parsed ; parsing