lexer: Add #hashtag support.

modern-harvey3-triple
Doug Coleman 2018-08-10 10:42:00 -05:00
parent 9c7fdc3a34
commit 24d266c1f1
1 changed files with 7 additions and 1 deletions

View File

@ -134,16 +134,22 @@ DEFER: parse-token
nip
] if ;
! TODO: combinations of prefix: \$#_:
! suffix: \_:
: unescape-token ( string -- string' )
dup length 1 = [ "\\" ?head drop ] unless ;
: unhashtag-token ( string -- string' )
dup length 1 = [ "#" ?head [ drop f ] when ] unless ;
: unescape-tokens ( seq -- seq' )
[ unescape-token ] map ;
: parse-token ( lexer -- str/f )
dup parse-raw [ skip-comments ] [ drop f ] if* ;
: ?scan-token ( -- str/f ) lexer get parse-token unescape-token ;
: ?scan-token ( -- str/f ) lexer get parse-token unescape-token unhashtag-token ;
PREDICATE: unexpected-eof < unexpected got>> not ;