From fee7f452060ff7c2e723e5266839939e812abf3b Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Tue, 21 Jun 2016 16:40:57 -0700 Subject: [PATCH] factor: fix :foo and :foo{ a b c } --- core/effects/effects-tests.factor | 2 +- core/modern/lexer/lexer.factor | 5 +++-- core/modern/modern.factor | 2 +- core/modern/out/out-tests.factor | 2 ++ ffi/cocoa/cocoa-docs.factor | 26 +++++++++++++------------- ffi/cocoa/cocoa.factor | 4 ++-- language/peg/ebnf/ebnf-docs.factor | 4 ++-- libs/ctags/etags/etags-docs.factor | 4 ++-- libs/infix/infix-docs.factor | 2 +- libs/urls/urls-docs.factor | 4 ++-- 10 files changed, 29 insertions(+), 26 deletions(-) diff --git a/core/effects/effects-tests.factor b/core/effects/effects-tests.factor index 013be90ae3..707396b6ed 100644 --- a/core/effects/effects-tests.factor +++ b/core/effects/effects-tests.factor @@ -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" } { "a" "b" } { "a" "b" } effect<= ] unit-test { f } [ { "a" } { } { "a" "b" } { "a" "b" } effect<= ] unit-test diff --git a/core/modern/lexer/lexer.factor b/core/modern/lexer/lexer.factor index 1b1aceed36..39151fd4d6 100644 --- a/core/modern/lexer/lexer.factor +++ b/core/modern/lexer/lexer.factor @@ -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 ; diff --git a/core/modern/modern.factor b/core/modern/modern.factor index d2bec7050c..e09017ed72 100644 --- a/core/modern/modern.factor +++ b/core/modern/modern.factor @@ -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 ; diff --git a/core/modern/out/out-tests.factor b/core/modern/out/out-tests.factor index caff71860b..9c1ee060e7 100644 --- a/core/modern/out/out-tests.factor +++ b/core/modern/out/out-tests.factor @@ -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 \ No newline at end of file diff --git a/ffi/cocoa/cocoa-docs.factor b/ffi/cocoa/cocoa-docs.factor index 6f11c1a69b..1f535eaf8a 100644 --- a/ffi/cocoa/cocoa-docs.factor +++ b/ffi/cocoa/cocoa-docs.factor @@ -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\" f -> movieWithFile:error:" } + { $code "IMPORT: QTMovie" "QTMovie \"My Movie.mov\" 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 diff --git a/ffi/cocoa/cocoa.factor b/ffi/cocoa/cocoa.factor index 2225c19781..31c8095343 100644 --- a/ffi/cocoa/cocoa.factor +++ b/ffi/cocoa/cocoa.factor @@ -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 diff --git a/language/peg/ebnf/ebnf-docs.factor b/language/peg/ebnf/ebnf-docs.factor index 5d3a5c3e12..88735e0cae 100644 --- a/language/peg/ebnf/ebnf-docs.factor +++ b/language/peg/ebnf/ebnf-docs.factor @@ -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 diff --git a/libs/ctags/etags/etags-docs.factor b/libs/ctags/etags/etags-docs.factor index c84e1e5ff0..8a236fe8d5 100644 --- a/libs/ctags/etags/etags-docs.factor +++ b/libs/ctags/etags/etags-docs.factor @@ -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" diff --git a/libs/infix/infix-docs.factor b/libs/infix/infix-docs.factor index cba44d1385..dc7f725a2f 100644 --- a/libs/infix/infix-docs.factor +++ b/libs/infix/infix-docs.factor @@ -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 diff --git a/libs/urls/urls-docs.factor b/libs/urls/urls-docs.factor index 13fb9e7a55..f644bb398a 100644 --- a/libs/urls/urls-docs.factor +++ b/libs/urls/urls-docs.factor @@ -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