factor: fix :foo and :foo{ a b c }

locals-and-roots
Doug Coleman 2016-06-21 16:40:57 -07:00
parent b1ed8d1e45
commit fee7f45206
10 changed files with 29 additions and 26 deletions

View File

@ -1,6 +1,6 @@
USING: accessors effects effects.parser eval kernel prettyprint USING: accessors effects effects.parser eval kernel prettyprint
sequences tools.test math ; sequences tools.test math ;
in: effects.tests IN: effects.tests
{ t } [ { "a" } { "a" } <effect> { "a" "b" } { "a" "b" } <effect> effect<= ] unit-test { t } [ { "a" } { "a" } <effect> { "a" "b" } { "a" "b" } <effect> effect<= ] unit-test
{ f } [ { "a" } { } <effect> { "a" "b" } { "a" "b" } <effect> effect<= ] unit-test { f } [ { "a" } { } <effect> { "a" "b" } { "a" "b" } <effect> effect<= ] unit-test

View File

@ -57,18 +57,19 @@ ERROR: unexpected-end n string ;
f string f f f string f f
] if ; inline ] if ; inline
! ":foo" with partial>> slot broke this
:: lex-til-either ( lexer tokens -- n'/f string' slice/f ch/f ) :: lex-til-either ( lexer tokens -- n'/f string' slice/f ch/f )
lexer >lexer< lexer >lexer<
lexer partial>> :> partial lexer partial>> :> partial
partial [ partial [
[ 1 - ] dip [ dup [ 1 - ] when ] dip
f lexer partial<< f lexer partial<<
] when ] when
tokens slice-til-either :> ( n' string' slice ch ) tokens slice-til-either :> ( n' string' slice ch )
lexer lexer
n' >>n drop n' >>n drop
n' string' n' string'
slice partial [ merge-slices ] when* slice partial 2dup and [ merge-slices ] [ or ] if
ch ; ch ;

View File

@ -381,7 +381,7 @@ ERROR: cannot-nest-upper-colon n string string' ;
{ [ dup [ char: \: = ] all? ] [ read-upper-colon ] } { [ dup [ char: \: = ] all? ] [ read-upper-colon ] }
{ [ dup { [ ":" head? ] [ ":" tail? ] } 1&& ] [ nip make-tag-literal ] } { [ dup { [ ":" head? ] [ ":" tail? ] } 1&& ] [ nip make-tag-literal ] }
{ [ dup ":" tail? ] [ dup top-level-name? [ read-upper-colon ] [ read-lower-colon ] if ] } { [ dup ":" tail? ] [ dup top-level-name? [ read-upper-colon ] [ read-lower-colon ] if ] }
{ [ dup ":" head? ] [ nip make-tag-literal ] } ! :foo( ... ) { [ dup ":" head? ] [ >>partial lex-factor ] } ! :foo( ... )
[ nip make-tag-literal ] [ nip make-tag-literal ]
} cond ; } cond ;

View File

@ -72,3 +72,5 @@ in: modern.out.tests
{ t } [ "![==[]==]" rewrite-same-string ] unit-test { t } [ "![==[]==]" rewrite-same-string ] unit-test
{ t } [ "lol[==[abc]==]" rewrite-same-string ] unit-test { t } [ "lol[==[abc]==]" rewrite-same-string ] unit-test
{ t } [ "![==[abc]==]" rewrite-same-string ] unit-test { t } [ "![==[abc]==]" rewrite-same-string ] unit-test
{ t } [ "( :union{ fixnum bignum } -- )" rewrite-same-string ] unit-test

View File

@ -2,50 +2,50 @@ USING: cocoa.messages help.markup help.syntax strings
alien core-foundation ; alien core-foundation ;
in: cocoa in: cocoa
HELP: -> HELP: \ ->
{ $syntax "-> selector" } { $syntax "-> selector" }
{ $values { "selector" "an Objective C method name" } } { $values { "selector" "an Objective C method name" } }
{ $description "A sugared form of the following:" } { $description "A sugared form of the following:" }
{ $code "\"selector\" send" } ; { $code "\"selector\" send" } ;
HELP: send\ HELP: \ send\
{ $syntax "send\ selector" } { $syntax "send\ selector" }
{ $values { "selector" "an Objective C method name" } } { $values { "selector" "an Objective C method name" } }
{ $description "A sugared form of the following:" } { $description "A sugared form of the following:" }
{ $code "\"selector\" send" } ; { $code "\"selector\" send" } ;
HELP: SUPER-> HELP: \ SUPER->
{ $syntax "-> selector" } { $syntax "-> selector" }
{ $values { "selector" "an Objective C method name" } } { $values { "selector" "an Objective C method name" } }
{ $description "A sugared form of the following:" } { $description "A sugared form of the following:" }
{ $code "\"selector\" send-super" } ; { $code "\"selector\" send-super" } ;
HELP: super-send\ HELP: \ super-send\
{ $syntax "-> selector" } { $syntax "-> selector" }
{ $values { "selector" "an Objective C method name" } } { $values { "selector" "an Objective C method name" } }
{ $description "A sugared form of the following:" } { $description "A sugared form of the following:" }
{ $code "\"selector\" send-super" } ; { $code "\"selector\" send-super" } ;
{ send super-send postpone\ -> postpone\ send\ postpone\ SUPER-> postpone\ super-send\ } related-words { send super-send \ -> \ send\ \ SUPER-> \ super-send\ } related-words
HELP: import: HELP: \ IMPORT:
{ $syntax "import: name" } { $syntax "IMPORT: name" }
{ $description "Makes an Objective C class available for use." } { $description "Makes an Objective C class available for use." }
{ $examples { $examples
{ $code "import: QTMovie" "QTMovie \"My Movie.mov\" <NSString> f -> movieWithFile:error:" } { $code "IMPORT: QTMovie" "QTMovie \"My Movie.mov\" <NSString> f -> movieWithFile:error:" }
} ; } ;
ARTICLE: "objc-calling" "Calling Objective C code" ARTICLE: "objc-calling" "Calling Objective C code"
"Before an Objective C class can be used, it must be imported; by default, a small set of common classes are imported automatically, but additional classes can be imported as needed." "Before an Objective C class can be used, it must be imported; by default, a small set of common classes are imported automatically, but additional classes can be imported as needed."
{ $subsections postpone\ import: } { $subsections \ IMPORT: }
"Every imported Objective C class has as corresponding class word in the " { $vocab-link "cocoa.classes" } " vocabulary. Class words push the class object in the stack, allowing class methods to be invoked." "Every imported Objective C class has as corresponding class word in the " { $vocab-link "cocoa.classes" } " vocabulary. Class words push the class object in the stack, allowing class methods to be invoked."
$nl $nl
"Messages can be sent to classes and instances using a pair of parsing words:" "Messages can be sent to classes and instances using a pair of parsing words:"
{ $subsections { $subsections
postpone\ -> \ ->
postpone\ send\ \ send\
postpone\ SUPER-> \ SUPER->
postpone\ super-send\ \ super-send\
} }
"These parsing words are actually syntax sugar for a pair of ordinary words; they can be used instead of the parsing words if the selector name is dynamically computed:" "These parsing words are actually syntax sugar for a pair of ordinary words; they can be used instead of the parsing words if the selector name is dynamically computed:"
{ $subsections { $subsections

View File

@ -38,9 +38,9 @@ frameworks [ V{ } clone ] initialize
[ frameworks get [ load-framework ] each ] "cocoa" add-startup-hook [ frameworks get [ load-framework ] each ] "cocoa" add-startup-hook
SYNTAX: \ framework: scan-token [ load-framework ] [ frameworks get push ] bi ; SYNTAX: \ FRAMEWORK: scan-token [ load-framework ] [ frameworks get push ] bi ;
SYNTAX: \ import: scan-token [ ] import-objc-class ; SYNTAX: \ IMPORT: scan-token [ ] import-objc-class ;
"Importing Cocoa classes..." print "Importing Cocoa classes..." print

View File

@ -3,7 +3,7 @@
USING: help.syntax help.markup peg peg.search words ; USING: help.syntax help.markup peg peg.search words ;
in: peg.ebnf in: peg.ebnf
HELP: EBNF-MAIN{{ HELP: \ EBNF-MAIN{{
{ $syntax "EBNF-MAIN{{ ...ebnf... }}" } { $syntax "EBNF-MAIN{{ ...ebnf... }}" }
{ $values { "...ebnf..." "EBNF DSL text" } } { $values { "...ebnf..." "EBNF DSL text" } }
{ $description { $description
@ -20,7 +20,7 @@ HELP: EBNF-MAIN{{
} }
} ; } ;
HELP: EBNF{{ HELP: \ EBNF{{
{ $syntax "EBNF{{ ...ebnf... }}" } { $syntax "EBNF{{ ...ebnf... }}" }
{ $values { "...ebnf..." "EBNF DSL text" } } { $values { "...ebnf..." "EBNF DSL text" } }
{ $description { $description

View File

@ -1,5 +1,5 @@
USING: help.syntax help.markup kernel prettyprint sequences strings words math ; USING: help.syntax help.markup kernel prettyprint sequences strings words math ;
in: ctags.etags IN: ctags.etags
ARTICLE: "etags" "Etags file" ARTICLE: "etags" "Etags file"
{ $emphasis "Etags" } " generates a index file of every factor word in etags format as supported by emacs and other editors. More information can be found at " { $url "http://en.wikipedia.org/wiki/Ctags#Etags_2" } "." { $emphasis "Etags" } " generates a index file of every factor word in etags format as supported by emacs and other editors. More information can be found at " { $url "http://en.wikipedia.org/wiki/Ctags#Etags_2" } "."
@ -19,4 +19,4 @@ HELP: write-etags
} }
} ; } ;
about: "etags" ; about: "etags"

View File

@ -3,7 +3,7 @@
USING: help.syntax help.markup math math.functions prettyprint locals sequences ; USING: help.syntax help.markup math math.functions prettyprint locals sequences ;
in: infix in: infix
HELP: infix[[ HELP: \ infix[[
{ $syntax "infix[[ ... ]]" } { $syntax "infix[[ ... ]]" }
{ $description "Parses the infix code inside the brackets, converts it to stack code and executes it." } { $description "Parses the infix code inside the brackets, converts it to stack code and executes it." }
{ $examples { $examples

View File

@ -35,7 +35,7 @@ HELP: >url
} }
} ; } ;
HELP: URL" HELP: \ URL"
{ $syntax "URL\" url...\"" } { $syntax "URL\" url...\"" }
{ $description "URL literal syntax." } { $description "URL literal syntax." }
{ $examples { $examples
@ -189,7 +189,7 @@ $nl
"URLs can be converted back to strings using the " { $link present } " word." "URLs can be converted back to strings using the " { $link present } " word."
$nl $nl
"URL literal syntax:" "URL literal syntax:"
{ $subsections postpone\ URL" } { $subsections \ URL" }
"Manipulating URLs:" "Manipulating URLs:"
{ $subsections { $subsections
derive-url derive-url