lexer: Add char: \' support. Fix ch'\' support

modern-harvey3-triple
Doug Coleman 2018-08-09 16:13:50 -04:00
parent 59f406b64e
commit bd329c7497
2 changed files with 9 additions and 2 deletions

View File

@ -151,8 +151,14 @@ PREDICATE: unexpected-eof < unexpected got>> not ;
: strict-single-quote? ( string -- ? ) : strict-single-quote? ( string -- ? )
"'" split1 "'" split1
[ [ char: ' swap member? not ] [ drop t ] bi and ] [ drop t ]
[ [ length 0 > ] [ "'" tail? not ] bi and ] bi* and ; [
[ length 0 > ]
[
! ch'\'
[ "\\'" tail? ] [ "'" tail? not ] bi or
] bi and
] bi* and ;
: strict-lower-colon? ( string -- ? ) : strict-lower-colon? ( string -- ? )
[ char: \: = ] cut-tail [ char: \: = ] cut-tail

View File

@ -31,6 +31,7 @@ ERROR: bad-escape char ;
{ char: \] char: \] } { char: \] char: \] }
{ char: \} char: \} } { char: \} char: \} }
{ char: \) char: \) } { char: \) char: \) }
{ char: \' char: \' }
} ?at [ bad-escape ] unless ; } ?at [ bad-escape ] unless ;
INITIALIZED-SYMBOL: name>char-hook [ INITIALIZED-SYMBOL: name>char-hook [