lexer: Add #hashtag support.
parent
9c7fdc3a34
commit
24d266c1f1
|
@ -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 ;
|
||||
|
||||
|
|
Loading…
Reference in New Issue