factor: allow SYNTAX: to have escaped names.

locals-and-roots
Doug Coleman 2016-06-06 13:17:14 -07:00
parent 153239ada6
commit cb92c8c448
4 changed files with 14 additions and 8 deletions

View File

@ -108,12 +108,18 @@ ERROR: staging-violation word ;
V{ } clone swap execute-parsing first
] when ;
: scan-parsing-word ( -- word )
! Allows HELP: \ { ... ; and SYNTAX: \ { ... ;
: scan-escaped-word-string ( -- string )
?scan-token dup "\\" = [
drop scan-word
] [
parse-word
] if ;
drop ?scan-token
] when ;
: scan-escaped-word ( -- word )
scan-escaped-word-string parse-word ;
: scan-new-escaped ( -- word )
scan-escaped-word-string check-word-name
create-word-in dup reset-generic ;
ERROR: classoid-expected object ;

View File

@ -159,7 +159,7 @@ in: bootstrap.syntax
"@deprecated" [ last-word make-deprecated ] define-core-syntax
"SYNTAX:" [
scan-new-word
scan-new-escaped
mark-top-level-syntax
parse-definition define-syntax
] define-core-syntax

View File

@ -55,4 +55,4 @@ ERROR: bad-storage-string string reason ;
: n>money ( n -- string )
3 10 { "" "K" "M" "B" "T" } reduce-magnitude ;
SYNTAX: STORAGE: scan-token storage>n suffix! ;
SYNTAX: \ STORAGE: scan-token storage>n suffix! ;

View File

@ -5,7 +5,7 @@ help.topics kernel math parser sequences vocabs.parser words ;
in: help.syntax
SYNTAX: HELP:
scan-parsing-word bootstrap-word
scan-escaped-word bootstrap-word
[ >link save-location ]
[ [ \ ; parse-until >array ] dip set-word-help ]
bi ;