factor: fix language syntax words.

locals-and-roots
Doug Coleman 2016-06-06 16:34:23 -07:00
parent a33f643ec9
commit 116c2909c2
2 changed files with 10 additions and 10 deletions

View File

@ -114,7 +114,7 @@ C: <ebnf> ebnf ;
[ [
[ char: \ = ] satisfy [ char: \ = ] satisfy
[ "\"\\" member? ] satisfy 2seq , [ "\"\\" member? ] satisfy 2seq ,
[ char: " = not ] satisfy , [ char: \" = not ] satisfy ,
] choice* repeat1 "\"" "\"" surrounded-by , ] choice* repeat1 "\"" "\"" surrounded-by ,
[ char: ' = not ] satisfy repeat1 "'" "'" surrounded-by , [ char: ' = not ] satisfy repeat1 "'" "'" surrounded-by ,
] choice* [ "" flatten-as unescape-string ] action ; ] choice* [ "" flatten-as unescape-string ] action ;

View File

@ -4,11 +4,11 @@ USING: combinators combinators.smart fry kernel lexer quotations
sequences sequences.generalizations slots words ; sequences sequences.generalizations slots words ;
in: slots.syntax in: slots.syntax
SYNTAX: slots[ SYNTAX: \ slots[
"]" [ reader-word 1quotation ] map-tokens "]" [ reader-word 1quotation ] map-tokens
'[ _ cleave ] append! ; '[ _ cleave ] append! ;
SYNTAX: slots{ SYNTAX: \ slots{
"}" [ reader-word 1quotation ] map-tokens "}" [ reader-word 1quotation ] map-tokens
'[ [ _ cleave ] output>array ] append! ; '[ [ _ cleave ] output>array ] append! ;
@ -18,23 +18,23 @@ SYNTAX: slots{
: writer-word<< ( name -- word ) : writer-word<< ( name -- word )
">>" prepend "accessors" lookup-word ; ">>" prepend "accessors" lookup-word ;
SYNTAX: set-slots[ SYNTAX: \ set-slots[
"]" [ >>writer-word 1quotation ] map-tokens "]" [ >>writer-word 1quotation ] map-tokens
'[ _ spread ] append! ; '[ _ spread ] append! ;
SYNTAX: set-slots{ SYNTAX: \ set-slots{
"}" [ >>writer-word 1quotation ] map-tokens "}" [ >>writer-word 1quotation ] map-tokens
[ length ] [ ] bi [ length ] [ ] bi
'[ _ firstn _ spread ] append! ; '[ _ firstn _ spread ] append! ;
SYNTAX: copy-slots{ SYNTAX: \ copy-slots{
"}" [ "}" [
[ reader-word 1quotation ] [ reader-word 1quotation ]
[ writer-word<< 1quotation ] bi append [ writer-word<< 1quotation ] bi append
] map-tokens ] map-tokens
'[ swap _ cleave ] append! ; '[ swap _ cleave ] append! ;
SYNTAX: get[ postpone\ slots[ ; SYNTAX: \ get[ postpone\ slots[ ;
SYNTAX: get{ postpone\ slots{ ; SYNTAX: \ get{ postpone\ slots{ ;
SYNTAX: set[ postpone\ set-slots[ ; SYNTAX: \ set[ postpone\ set-slots[ ;
SYNTAX: set{ postpone\ set-slots{ ; SYNTAX: \ set{ postpone\ set-slots{ ;