factor: fix :foo and :foo{ a b c }
parent
b1ed8d1e45
commit
fee7f45206
|
@ -1,6 +1,6 @@
|
|||
USING: accessors effects effects.parser eval kernel prettyprint
|
||||
sequences tools.test math ;
|
||||
in: effects.tests
|
||||
IN: effects.tests
|
||||
|
||||
{ t } [ { "a" } { "a" } <effect> { "a" "b" } { "a" "b" } <effect> effect<= ] unit-test
|
||||
{ f } [ { "a" } { } <effect> { "a" "b" } { "a" "b" } <effect> effect<= ] unit-test
|
||||
|
|
|
@ -57,18 +57,19 @@ ERROR: unexpected-end n string ;
|
|||
f string f f
|
||||
] if ; inline
|
||||
|
||||
! ":foo" with partial>> slot broke this
|
||||
:: lex-til-either ( lexer tokens -- n'/f string' slice/f ch/f )
|
||||
lexer >lexer<
|
||||
lexer partial>> :> partial
|
||||
partial [
|
||||
[ 1 - ] dip
|
||||
[ dup [ 1 - ] when ] dip
|
||||
f lexer partial<<
|
||||
] when
|
||||
tokens slice-til-either :> ( n' string' slice ch )
|
||||
lexer
|
||||
n' >>n drop
|
||||
n' string'
|
||||
slice partial [ merge-slices ] when*
|
||||
slice partial 2dup and [ merge-slices ] [ or ] if
|
||||
ch ;
|
||||
|
||||
|
||||
|
|
|
@ -381,7 +381,7 @@ ERROR: cannot-nest-upper-colon n string string' ;
|
|||
{ [ dup [ char: \: = ] all? ] [ read-upper-colon ] }
|
||||
{ [ dup { [ ":" head? ] [ ":" tail? ] } 1&& ] [ nip make-tag-literal ] }
|
||||
{ [ 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 ]
|
||||
} cond ;
|
||||
|
||||
|
|
|
@ -72,3 +72,5 @@ in: modern.out.tests
|
|||
{ t } [ "![==[]==]" rewrite-same-string ] unit-test
|
||||
{ t } [ "lol[==[abc]==]" rewrite-same-string ] unit-test
|
||||
{ t } [ "![==[abc]==]" rewrite-same-string ] unit-test
|
||||
|
||||
{ t } [ "( :union{ fixnum bignum } -- )" rewrite-same-string ] unit-test
|
|
@ -2,50 +2,50 @@ USING: cocoa.messages help.markup help.syntax strings
|
|||
alien core-foundation ;
|
||||
in: cocoa
|
||||
|
||||
HELP: ->
|
||||
HELP: \ ->
|
||||
{ $syntax "-> selector" }
|
||||
{ $values { "selector" "an Objective C method name" } }
|
||||
{ $description "A sugared form of the following:" }
|
||||
{ $code "\"selector\" send" } ;
|
||||
|
||||
HELP: send\
|
||||
HELP: \ send\
|
||||
{ $syntax "send\ selector" }
|
||||
{ $values { "selector" "an Objective C method name" } }
|
||||
{ $description "A sugared form of the following:" }
|
||||
{ $code "\"selector\" send" } ;
|
||||
|
||||
HELP: SUPER->
|
||||
HELP: \ SUPER->
|
||||
{ $syntax "-> selector" }
|
||||
{ $values { "selector" "an Objective C method name" } }
|
||||
{ $description "A sugared form of the following:" }
|
||||
{ $code "\"selector\" send-super" } ;
|
||||
|
||||
HELP: super-send\
|
||||
HELP: \ super-send\
|
||||
{ $syntax "-> selector" }
|
||||
{ $values { "selector" "an Objective C method name" } }
|
||||
{ $description "A sugared form of the following:" }
|
||||
{ $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:
|
||||
{ $syntax "import: name" }
|
||||
HELP: \ IMPORT:
|
||||
{ $syntax "IMPORT: name" }
|
||||
{ $description "Makes an Objective C class available for use." }
|
||||
{ $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"
|
||||
"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."
|
||||
$nl
|
||||
"Messages can be sent to classes and instances using a pair of parsing words:"
|
||||
{ $subsections
|
||||
postpone\ ->
|
||||
postpone\ send\
|
||||
postpone\ SUPER->
|
||||
postpone\ super-send\
|
||||
\ ->
|
||||
\ send\
|
||||
\ SUPER->
|
||||
\ 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:"
|
||||
{ $subsections
|
||||
|
|
|
@ -38,9 +38,9 @@ frameworks [ V{ } clone ] initialize
|
|||
|
||||
[ 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
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
USING: help.syntax help.markup peg peg.search words ;
|
||||
in: peg.ebnf
|
||||
|
||||
HELP: EBNF-MAIN{{
|
||||
HELP: \ EBNF-MAIN{{
|
||||
{ $syntax "EBNF-MAIN{{ ...ebnf... }}" }
|
||||
{ $values { "...ebnf..." "EBNF DSL text" } }
|
||||
{ $description
|
||||
|
@ -20,7 +20,7 @@ HELP: EBNF-MAIN{{
|
|||
}
|
||||
} ;
|
||||
|
||||
HELP: EBNF{{
|
||||
HELP: \ EBNF{{
|
||||
{ $syntax "EBNF{{ ...ebnf... }}" }
|
||||
{ $values { "...ebnf..." "EBNF DSL text" } }
|
||||
{ $description
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
USING: help.syntax help.markup kernel prettyprint sequences strings words math ;
|
||||
in: ctags.etags
|
||||
IN: ctags.etags
|
||||
|
||||
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" } "."
|
||||
|
@ -19,4 +19,4 @@ HELP: write-etags
|
|||
}
|
||||
} ;
|
||||
|
||||
about: "etags" ;
|
||||
about: "etags"
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
USING: help.syntax help.markup math math.functions prettyprint locals sequences ;
|
||||
in: infix
|
||||
|
||||
HELP: infix[[
|
||||
HELP: \ infix[[
|
||||
{ $syntax "infix[[ ... ]]" }
|
||||
{ $description "Parses the infix code inside the brackets, converts it to stack code and executes it." }
|
||||
{ $examples
|
||||
|
|
|
@ -35,7 +35,7 @@ HELP: >url
|
|||
}
|
||||
} ;
|
||||
|
||||
HELP: URL"
|
||||
HELP: \ URL"
|
||||
{ $syntax "URL\" url...\"" }
|
||||
{ $description "URL literal syntax." }
|
||||
{ $examples
|
||||
|
@ -189,7 +189,7 @@ $nl
|
|||
"URLs can be converted back to strings using the " { $link present } " word."
|
||||
$nl
|
||||
"URL literal syntax:"
|
||||
{ $subsections postpone\ URL" }
|
||||
{ $subsections \ URL" }
|
||||
"Manipulating URLs:"
|
||||
{ $subsections
|
||||
derive-url
|
||||
|
|
Loading…
Reference in New Issue