From: Doug Coleman Date: Sun, 26 Jul 2015 05:59:56 +0000 (-0700) Subject: factor: remove """ string syntax for now. there are HEREDOC:, STRING:, escaping ... X-Git-Tag: unmaintained~2270 X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=commitdiff_plain;h=1fcf96cada073790e0db13d594706149f0b6e38c factor: remove """ string syntax for now. there are HEREDOC:, STRING:, escaping \", and something else soon. --- diff --git a/basis/alien/c-types/c-types-docs.factor b/basis/alien/c-types/c-types-docs.factor index 7bc7865455..216a278206 100644 --- a/basis/alien/c-types/c-types-docs.factor +++ b/basis/alien/c-types/c-types-docs.factor @@ -88,8 +88,8 @@ $nl $nl "In " { $link POSTPONE: TYPEDEF: } ", " { $link POSTPONE: FUNCTION: } ", " { $link POSTPONE: CALLBACK: } ", and " { $link POSTPONE: STRUCT: } " definitions, pointer types can be created by suffixing " { $snippet "*" } " to a C type name. Outside of FFI definitions, a pointer C type can be created using the " { $link POSTPONE: pointer: } " syntax word:" { $unchecked-example "FUNCTION: int* foo ( char* bar ) ;" } -{ $unchecked-example """: foo ( bar -- int* ) - pointer: int f \"foo\" { pointer: char } alien-invoke ;""" } } ; +{ $unchecked-example ": foo ( bar -- int* ) + pointer: int f \"foo\" { pointer: char } alien-invoke ;" } } ; ARTICLE: "byte-arrays-gc" "Byte arrays and the garbage collector" "The Factor garbage collector can move byte arrays around, and it is only safe to pass byte arrays to C functions if the garbage collector will not run while C code still has a reference to the data." diff --git a/basis/alien/c-types/c-types-tests.factor b/basis/alien/c-types/c-types-tests.factor index 1417433678..63edbdff50 100644 --- a/basis/alien/c-types/c-types-tests.factor +++ b/basis/alien/c-types/c-types-tests.factor @@ -60,11 +60,11 @@ C-TYPE: opaque { t } [ void* lookup-c-type pointer: opaque lookup-c-type = ] unit-test [ opaque lookup-c-type ] [ no-c-type? ] must-fail-with -[ """ +[ " USING: alien.syntax ; IN: alien.c-types.tests FUNCTION: opaque return_opaque ( ) ; -""" eval( -- ) ] [ no-c-type? ] must-fail-with +" eval( -- ) ] [ no-c-type? ] must-fail-with C-TYPE: forward STRUCT: backward { x forward* } ; @@ -78,19 +78,19 @@ DEFER: struct-redefined { f } [ - """ + " USING: alien.c-types classes.struct ; IN: alien.c-types.tests STRUCT: struct-redefined { x int } ; - """ eval( -- ) + " eval( -- ) - """ + " USING: alien.syntax ; IN: alien.c-types.tests C-TYPE: struct-redefined - """ eval( -- ) + " eval( -- ) \ struct-redefined class? ] unit-test diff --git a/basis/alien/syntax/syntax-docs.factor b/basis/alien/syntax/syntax-docs.factor index 514d1c7faf..6bbd1a52bf 100644 --- a/basis/alien/syntax/syntax-docs.factor +++ b/basis/alien/syntax/syntax-docs.factor @@ -85,9 +85,9 @@ HELP: C-TYPE: { $values { "type" "a new C type" } } { $description "Defines a new, opaque C type. Since it is opaque, " { $snippet "type" } " will not be directly usable as a parameter or return type of a " { $link POSTPONE: FUNCTION: } " or as a slot of a " { $link POSTPONE: STRUCT: } ". However, it can be used as the type of a " { $link pointer } "." $nl { $snippet "C-TYPE:" } " can also be used to forward declare C types, allowing circular dependencies to occur between types. For example:" -{ $code """C-TYPE: forward +{ $code "C-TYPE: forward STRUCT: backward { x forward* } ; -STRUCT: forward { x backward* } ; """ } } +STRUCT: forward { x backward* } ;" } } { $notes "Primitive C types are displayed using " { $snippet "C-TYPE:" } " syntax when they are " { $link see } "n." } ; HELP: CALLBACK: diff --git a/basis/combinators/smart/smart-docs.factor b/basis/combinators/smart/smart-docs.factor index a92067d34d..8d90652dd5 100644 --- a/basis/combinators/smart/smart-docs.factor +++ b/basis/combinators/smart/smart-docs.factor @@ -123,9 +123,9 @@ HELP: dropping { $description "Outputs a quotation that, when called, will have the effect of dropping the number of inputs to the original quotation." } { $examples { $example - """USING: combinators.smart math prettyprint ; -[ + + ] dropping .""" -"""[ 3 ndrop ]""" + "USING: combinators.smart math prettyprint ; +[ + + ] dropping ." +"[ 3 ndrop ]" } } ; @@ -143,8 +143,8 @@ HELP: map-reduce-outputs { $description "Infers the number of outputs from " { $snippet "quot" } " and, treating those outputs as a sequence, calls " { $link map-reduce } " on them." } { $examples { $example -"""USING: math combinators.smart prettyprint ; -[ 1 2 3 ] [ sq ] [ + ] map-reduce-outputs .""" +"USING: math combinators.smart prettyprint ; +[ 1 2 3 ] [ sq ] [ + ] map-reduce-outputs ." "14" } } ; @@ -156,8 +156,8 @@ HELP: nullary { $description "Infers the number of inputs to a quotation and drops them from the stack." } { $examples { $code - """USING: combinators.smart kernel math ; -1 2 [ + ] nullary""" + "USING: combinators.smart kernel math ; +1 2 [ + ] nullary" } } ; @@ -168,11 +168,11 @@ HELP: preserving { $description "Calls a quotation and leaves any consumed inputs on the stack beneath the quotation's outputs." } { $examples { $example - """USING: combinators.smart kernel math prettyprint ; -1 2 [ + ] preserving [ . ] tri@""" -"""1 + "USING: combinators.smart kernel math prettyprint ; +1 2 [ + ] preserving [ . ] tri@" +"1 2 -3""" +3" } } ; @@ -183,10 +183,10 @@ HELP: smart-apply { $description "Applies a quotation to the datastack " { $snippet "n" } " times, starting lower on the stack and working up in increments of the number of inferred inputs to the quotation." } { $examples { $example - """USING: combinators.smart prettyprint math kernel ; -1 2 3 4 [ + ] 2 smart-apply [ . ] bi@""" -"""3 -7""" + "USING: combinators.smart prettyprint math kernel ; +1 2 3 4 [ + ] 2 smart-apply [ . ] bi@" +"3 +7" } } ; diff --git a/basis/command-line/startup/startup.factor b/basis/command-line/startup/startup.factor index 8f4f21a7ae..7881160eba 100644 --- a/basis/command-line/startup/startup.factor +++ b/basis/command-line/startup/startup.factor @@ -5,12 +5,12 @@ sequences system vocabs.loader ; IN: command-line.startup : cli-usage ( -- ) -""" -Usage: """ write vm-path file-name write """ [Factor arguments] [script] [script arguments] +" +Usage: " write vm-path file-name write " [Factor arguments] [script] [script arguments] Common arguments: -help print this message and exit - -i= load Factor image file (default """ write vm-path file-stem write """.image) + -i= load Factor image file (default " write vm-path file-stem write " .image) -run= run the MAIN: entry point of -run=listener run terminal listener -run=ui.tools run Factor development UI @@ -18,10 +18,10 @@ Common arguments: -no-user-init suppress loading of .factor-rc Enter - "command-line" help + \"command-line\" help from within Factor for more information. -""" write ; +" write ; : help? ( -- ? ) "help" get "-help" get or "h" get or diff --git a/basis/compiler/tests/callback-error.factor b/basis/compiler/tests/callback-error.factor index 00c932dae5..482cadc422 100644 --- a/basis/compiler/tests/callback-error.factor +++ b/basis/compiler/tests/callback-error.factor @@ -13,16 +13,16 @@ IN: compiler.tests.callback-error ascii stream-lines ; [ ] [ - """USING: alien alien.c-types alien.syntax kernel ; + " USING: alien alien.c-types alien.syntax kernel ; IN: scratchpad : callback-death ( -- callback ) - void { } cdecl [ "Error!" throw ] alien-callback ; + void { } cdecl [ \"Error!\" throw ] alien-callback ; : callback-invoke ( callback -- ) void { } cdecl alien-indirect ; - callback-death callback-invoke""" + callback-death callback-invoke" callback-error-script ascii set-file-contents ] unit-test @@ -30,17 +30,17 @@ IN: compiler.tests.callback-error [ t ] [ run-vm-with-script "\"Error!\"" swap member? ] unit-test [ ] [ - """USING: alien alien.c-types alien.syntax kernel threads ; + "USING: alien alien.c-types alien.syntax kernel threads ; IN: scratchpad : callback-death ( -- callback ) - void { } cdecl [ "Error!" throw ] alien-callback ; + void { } cdecl [ \"Error!\" throw ] alien-callback ; : callback-invoke ( callback -- ) void { } cdecl alien-indirect ; [ callback-death callback-invoke ] in-thread - stop""" + stop" callback-error-script ascii set-file-contents ] unit-test diff --git a/basis/concurrency/semaphores/semaphores-docs.factor b/basis/concurrency/semaphores/semaphores-docs.factor index c2a7ecfc4a..afed9fca64 100644 --- a/basis/concurrency/semaphores/semaphores-docs.factor +++ b/basis/concurrency/semaphores/semaphores-docs.factor @@ -42,19 +42,19 @@ ARTICLE: "concurrency.semaphores.examples" "Semaphore examples" } "Here is a concrete example which fetches content from 5 different web sites, making no more than 3 requests at a time:" { $code - """USING: concurrency.combinators concurrency.semaphores + "USING: concurrency.combinators concurrency.semaphores fry http.client kernel urls ; { - URL" http://www.apple.com" - URL" http://www.google.com" - URL" http://www.ibm.com" - URL" http://www.hp.com" - URL" http://www.oracle.com" + URL\" http://www.apple.com\" + URL\" http://www.google.com\" + URL\" http://www.ibm.com\" + URL\" http://www.hp.com\" + URL\" http://www.oracle.com\" } 2 '[ _ [ http-get nip ] with-semaphore -] parallel-map""" +] parallel-map" } ; ARTICLE: "concurrency.semaphores" "Counting semaphores" diff --git a/basis/db/db-docs.factor b/basis/db/db-docs.factor index cb697a7db7..e331b97773 100644 --- a/basis/db/db-docs.factor +++ b/basis/db/db-docs.factor @@ -271,21 +271,21 @@ ARTICLE: "db-lowlevel-tutorial" "Low-level database tutorial" { $subsections sql-query } "Here's an example usage where we'll make a book table, insert some objects, and query them." $nl "First, let's set up a custom combinator for using our database. See " { $link "db-custom-database-combinators" } " for more details." -{ $code """USING: db.sqlite db io.files io.files.temp ; +{ $code "USING: db.sqlite db io.files io.files.temp ; : with-book-db ( quot -- ) - "book.db" temp-file swap with-db ; inline""" } + \"book.db\" temp-file swap with-db ; inline" } "Now let's create the table manually:" -{ $code """"create table books +{ $code "\"create table books (id integer primary key, title text, author text, date_published timestamp, - edition integer, cover_price double, condition text)" - [ sql-command ] with-book-db""" } + edition integer, cover_price double, condition text)\" + [ sql-command ] with-book-db" } "Time to insert some books:" -{ $code """"insert into books +{ $code "\"insert into books (title, author, date_published, edition, cover_price, condition) - values('Factor for Sheeple', 'Mister Stacky Pants', date('now'), 1, 13.37, 'mint')" -[ sql-command ] with-book-db""" } + values('Factor for Sheeple', 'Mister Stacky Pants', date('now'), 1, 13.37, 'mint')\" +[ sql-command ] with-book-db" } "Now let's select the book:" -{ $code """"select id, title, cover_price from books;" [ sql-query ] with-book-db""" } +{ $code "\"select id, title, cover_price from books;\" [ sql-query ] with-book-db" } "Notice that the result of this query is a Factor array containing the database rows as arrays of strings. We would have to convert the " { $snippet "cover_price" } " from a string to a number in order to use it in a calculation." $nl "In conclusion, this method of accessing a database is supported, but it is fairly low-level and generally specific to a single database. The " { $vocab-link "db.tuples" } " vocabulary is a good alternative to writing SQL by hand." ; @@ -295,20 +295,20 @@ ARTICLE: "db-custom-database-combinators" "Custom database combinators" "Make a " { $snippet "with-" } " combinator to open and close a database so that resources are not leaked." $nl "SQLite example combinator:" -{ $code """USING: db.sqlite db io.files io.files.temp ; +{ $code "USING: db.sqlite db io.files io.files.temp ; : with-sqlite-db ( quot -- ) - "my-database.db" temp-file swap with-db ; inline""" } + \"my-database.db\" temp-file swap with-db ; inline" } "PostgreSQL example combinator:" -{ $code """USING: db.postgresql db ; +{ $code "USING: db.postgresql db ; : with-postgresql-db ( quot -- ) - "localhost" >>host + \"localhost\" >>host 5432 >>port - "erg" >>username - "secrets?" >>password - "factor-test" >>database - swap with-db ; inline""" + \"erg\" >>username + \"secrets?\" >>password + \"factor-test\" >>database + swap with-db ; inline" } ; ABOUT: "db" diff --git a/basis/db/sqlite/sqlite.factor b/basis/db/sqlite/sqlite.factor index ff9152cc3c..9005b48f17 100644 --- a/basis/db/sqlite/sqlite.factor +++ b/basis/db/sqlite/sqlite.factor @@ -199,65 +199,65 @@ M: sqlite-db-connection persistent-table ( -- assoc ) } ; : insert-trigger ( -- string ) - """ + " CREATE TRIGGER fki_${table-name}_${table-id}_${foreign-table-name}_${foreign-table-id}_id BEFORE INSERT ON ${table-name} FOR EACH ROW BEGIN - SELECT RAISE(ROLLBACK, 'insert on table "${table-name}" violates foreign key constraint "fki_${table-name}_$table-id}_${foreign-table-name}_${foreign-table-id}_id"') + SELECT RAISE(ROLLBACK, 'insert on table \"${table-name}\" violates foreign key constraint \"fki_${table-name}_$table-id}_${foreign-table-name}_${foreign-table-id}_id\"') WHERE (SELECT ${foreign-table-id} FROM ${foreign-table-name} WHERE ${foreign-table-id} = NEW.${table-id}) IS NULL; END; - """ interpolate>string ; + " interpolate>string ; : insert-trigger-not-null ( -- string ) - """ + " CREATE TRIGGER fki_${table-name}_${table-id}_${foreign-table-name}_${foreign-table-id}_id BEFORE INSERT ON ${table-name} FOR EACH ROW BEGIN - SELECT RAISE(ROLLBACK, 'insert on table "${table-name}" violates foreign key constraint "fki_${table-name}_$table-id}_${foreign-table-name}_${foreign-table-id}_id"') + SELECT RAISE(ROLLBACK, 'insert on table \"${table-name}\" violates foreign key constraint \"fki_${table-name}_$table-id}_${foreign-table-name}_${foreign-table-id}_id\"') WHERE NEW.${table-id} IS NOT NULL AND (SELECT ${foreign-table-id} FROM ${foreign-table-name} WHERE ${foreign-table-id} = NEW.${table-id}) IS NULL; END; - """ interpolate>string ; + " interpolate>string ; : update-trigger ( -- string ) - """ + " CREATE TRIGGER fku_${table-name}_${table-id}_${foreign-table-name}_${foreign-table-id}_id BEFORE UPDATE ON ${table-name} FOR EACH ROW BEGIN - SELECT RAISE(ROLLBACK, 'update on table "${table-name}" violates foreign key constraint "fku_${table-name}_$table-id}_${foreign-table-name}_${foreign-table-id}_id"') + SELECT RAISE(ROLLBACK, 'update on table \"${table-name}\" violates foreign key constraint \"fku_${table-name}_$table-id}_${foreign-table-name}_${foreign-table-id}_id\"') WHERE (SELECT ${foreign-table-id} FROM ${foreign-table-name} WHERE ${foreign-table-id} = NEW.${table-id}) IS NULL; END; - """ interpolate>string ; + " interpolate>string ; : update-trigger-not-null ( -- string ) - """ + " CREATE TRIGGER fku_${table-name}_${table-id}_${foreign-table-name}_${foreign-table-id}_id BEFORE UPDATE ON ${table-name} FOR EACH ROW BEGIN - SELECT RAISE(ROLLBACK, 'update on table "${table-name}" violates foreign key constraint "fku_${table-name}_$table-id}_${foreign-table-name}_${foreign-table-id}_id"') + SELECT RAISE(ROLLBACK, 'update on table \"${table-name}\" violates foreign key constraint \"fku_${table-name}_$table-id}_${foreign-table-name}_${foreign-table-id}_id\"') WHERE NEW.${table-id} IS NOT NULL AND (SELECT ${foreign-table-id} FROM ${foreign-table-name} WHERE ${foreign-table-id} = NEW.${table-id}) IS NULL; END; - """ interpolate>string ; + " interpolate>string ; : delete-trigger-restrict ( -- string ) - """ + " CREATE TRIGGER fkd_${table-name}_${table-id}_${foreign-table-name}_${foreign-table-id}_id BEFORE DELETE ON ${foreign-table-name} FOR EACH ROW BEGIN - SELECT RAISE(ROLLBACK, 'delete on table "${foreign-table-name}" violates foreign key constraint "fkd_${table-name}_$table-id}_${foreign-table-name}_${foreign-table-id}_id"') + SELECT RAISE(ROLLBACK, 'delete on table \"${foreign-table-name}\" violates foreign key constraint \"fkd_${table-name}_$table-id}_${foreign-table-name}_${foreign-table-id}_id\"') WHERE (SELECT ${foreign-table-id} FROM ${foreign-table-name} WHERE ${foreign-table-id} = OLD.${foreign-table-id}) IS NOT NULL; END; - """ interpolate>string ; + " interpolate>string ; : delete-trigger-cascade ( -- string ) - """ + " CREATE TRIGGER fkd_${table-name}_${table-id}_${foreign-table-name}_${foreign-table-id}_id BEFORE DELETE ON ${foreign-table-name} FOR EACH ROW BEGIN DELETE from ${table-name} WHERE ${table-id} = OLD.${foreign-table-id}; END; - """ interpolate>string ; + " interpolate>string ; : can-be-null? ( -- ? ) "sql-spec" get modifiers>> [ +not-null+ = ] any? not ; diff --git a/basis/db/tuples/tuples-docs.factor b/basis/db/tuples/tuples-docs.factor index bbda3c3cc8..9006e0cc1c 100644 --- a/basis/db/tuples/tuples-docs.factor +++ b/basis/db/tuples/tuples-docs.factor @@ -213,53 +213,53 @@ ARTICLE: "db-tuples-tutorial" "Tuple database tutorial" "The title, author, and publisher should be strings; the date-published a timestamp; the edition an integer; the cover-price a float. These are the Factor types for which we will need to look up the corresponding " { $link "db.types" } ". " $nl "To actually bind the tuple slots to the database types, we'll use " { $link define-persistent } "." { $code -"""USING: db.tuples db.types ; -book "BOOK" +"USING: db.tuples db.types ; +book \"BOOK\" { - { "id" "ID" +db-assigned-id+ } - { "title" "TITLE" VARCHAR } - { "author" "AUTHOR" VARCHAR } - { "date-published" "DATE_PUBLISHED" TIMESTAMP } - { "edition" "EDITION" INTEGER } - { "cover-price" "COVER_PRICE" DOUBLE } - { "condition" "CONDITION" VARCHAR } -} define-persistent""" } + { \"id\" \"ID\" +db-assigned-id+ } + { \"title\" \"TITLE\" VARCHAR } + { \"author\" \"AUTHOR\" VARCHAR } + { \"date-published\" \"DATE_PUBLISHED\" TIMESTAMP } + { \"edition\" \"EDITION\" INTEGER } + { \"cover-price\" \"COVER_PRICE\" DOUBLE } + { \"condition\" \"CONDITION\" VARCHAR } +} define-persistent" } "That's all we'll have to do with the database for this tutorial. Now let's make a book." -{ $code """USING: calendar namespaces ; +{ $code "USING: calendar namespaces ; T{ book - { title "Factor for Sheeple" } - { author "Mister Stacky Pants" } + { title \"Factor for Sheeple\" } + { author \"Mister Stacky Pants\" } { date-published T{ timestamp { year 2009 } { month 3 } { day 3 } } } { edition 1 } { cover-price 13.37 } -} book set""" } +} book set" } "Now we've created a book. Let's save it to the database." -{ $code """USING: db db.sqlite fry io.files.temp ; +{ $code "USING: db db.sqlite fry io.files.temp ; : with-book-tutorial ( quot -- ) - '[ "book-tutorial.db" temp-file _ with-db ] call ; inline + '[ \"book-tutorial.db\" temp-file _ with-db ] call ; inline [ book recreate-table book get insert-tuple -] with-book-tutorial""" } +] with-book-tutorial" } "Is it really there?" -{ $code """[ - T{ book { title "Factor for Sheeple" } } select-tuples . -] with-book-tutorial""" } +{ $code "[ + T{ book { title \"Factor for Sheeple\" } } select-tuples . +] with-book-tutorial" } "Oops, we spilled some orange juice on the book cover." -{ $code """book get "Small orange juice stain on cover" >>condition""" } +{ $code "book get \"Small orange juice stain on cover\" >>condition" } "Now let's save the modified book." -{ $code """[ +{ $code "[ book get update-tuple -] with-book-tutorial""" } +] with-book-tutorial" } "And select it again. You can query the database by any field -- just set it in the exemplar tuple you pass to " { $link select-tuples } "." -{ $code """[ - T{ book { title "Factor for Sheeple" } } select-tuples -] with-book-tutorial""" } +{ $code "[ + T{ book { title \"Factor for Sheeple\" } } select-tuples +] with-book-tutorial" } "Let's drop the table because we're done." -{ $code """[ +{ $code "[ book drop-table -] with-book-tutorial""" } +] with-book-tutorial" } "To summarize, the steps for using Factor's tuple database are:" { $list "Make a new tuple to represent your data" diff --git a/basis/delegate/delegate-docs.factor b/basis/delegate/delegate-docs.factor index 634683f526..ac82c0004c 100644 --- a/basis/delegate/delegate-docs.factor +++ b/basis/delegate/delegate-docs.factor @@ -18,14 +18,14 @@ HELP: define-consult { $notes "Usually, " { $link POSTPONE: CONSULT: } " should be used instead. This is only for runtime use." } ; HELP: CONSULT: -{ $syntax """CONSULT: group class - code ;""" } +{ $syntax "CONSULT: group class + code ;" } { $values { "group" "a protocol, generic word or tuple class" } { "class" "a class" } { "code" "code to get the object to which the method should be forwarded" } } { $description "Declares that objects of " { $snippet "class" } " will delegate the generic words contained in " { $snippet "group" } " to the object returned by executing " { $snippet "code" } " with the original object as an input." { $snippet "CONSULT:" } " will overwrite any existing methods on " { $snippet "class" } " for the members of " { $snippet "group" } ", but new methods can be added after the " { $snippet "CONSULT:" } " to override the delegation." } ; HELP: BROADCAST: -{ $syntax """BROADCAST: group class - code ;""" } +{ $syntax "BROADCAST: group class + code ;" } { $values { "group" "a protocol, generic word or tuple class" } { "class" "a class" } { "code" "code to get the object to which the method should be forwarded" } } { $description "Declares that objects of " { $snippet "class" } " will delegate the generic words contained in " { $snippet "group" } " to every object in the sequence returned by executing " { $snippet "code" } " with the original object as an input." { $snippet "BROADCAST:" } " will overwrite any existing methods on " { $snippet "class" } " for the members of " { $snippet "group" } ", but new methods can be added after the " { $snippet "BROADCAST:" } " to override the delegation. Every generic word in " { $snippet "group" } " must return no outputs; otherwise, a " { $link broadcast-words-must-have-no-outputs } " error will be raised." } ; diff --git a/basis/eval/eval-docs.factor b/basis/eval/eval-docs.factor index 5ff68665db..e4dcfcebda 100644 --- a/basis/eval/eval-docs.factor +++ b/basis/eval/eval-docs.factor @@ -48,11 +48,11 @@ $nl { $heading "Example" } "In this example, a string is evaluated with a fictional " { $snippet "cad.objects" } " vocabulary in the search path by default, together with the listener's " { $link interactive-vocabs } "; the quotation is expected to produce a sequence on the stack:" { $code - """USING: eval listener vocabs.parser ; + "USING: eval listener vocabs.parser ; [ - "cad.objects" use-vocab + \"cad.objects\" use-vocab ( -- seq ) (eval) -] with-interactive-vocabs""" +] with-interactive-vocabs" } "Note that the search path in the outer code (set by the " { $link POSTPONE: USING: } " form) has no relation to the search path used when parsing the string parameter (this is determined by " { $link with-interactive-vocabs } " and " { $link use-vocab } ")." ; diff --git a/basis/functors/functors-tests.factor b/basis/functors/functors-tests.factor index df6ef434b9..8fc1fda86e 100644 --- a/basis/functors/functors-tests.factor +++ b/basis/functors/functors-tests.factor @@ -144,8 +144,8 @@ SYMBOL: W-symbol ;FUNCTOR [ [ ] ] [ - """IN: functors.tests - << "some" redefine-test >>""" "functors-test" parse-stream + "IN: functors.tests + << \"some\" redefine-test >>" "functors-test" parse-stream ] unit-test test-redefinition diff --git a/basis/furnace/actions/actions-docs.factor b/basis/furnace/actions/actions-docs.factor index ad90dd7568..edf3eb1520 100644 --- a/basis/furnace/actions/actions-docs.factor +++ b/basis/furnace/actions/actions-docs.factor @@ -53,12 +53,12 @@ HELP: validate-params { $examples "A simple validator from " { $vocab-link "webapps.todo" } "; this word is invoked from the " { $slot "validate" } " quotation of action for editing a todo list item:" { $code - """: validate-todo ( -- ) + ": validate-todo ( -- ) { - { "summary" [ v-one-line ] } - { "priority" [ v-integer 0 v-min-value 10 v-max-value ] } - { "description" [ v-required ] } - } validate-params ;""" + { \"summary\" [ v-one-line ] } + { \"priority\" [ v-integer 0 v-min-value 10 v-max-value ] } + { \"description\" [ v-required ] } + } validate-params ;" } } ; diff --git a/basis/furnace/alloy/alloy-docs.factor b/basis/furnace/alloy/alloy-docs.factor index 8e073a12ca..c0c255c1da 100644 --- a/basis/furnace/alloy/alloy-docs.factor +++ b/basis/furnace/alloy/alloy-docs.factor @@ -10,13 +10,13 @@ HELP: { $examples "The " { $vocab-link "webapps.counter" } " vocabulary uses an alloy to configure the counter:" { $code - """: counter-db ( -- db ) "counter.db" ; + ": counter-db ( -- db ) \"counter.db\" ; : run-counter ( -- ) counter-db main-responder set-global - 8080 httpd ;""" + 8080 httpd ;" } } ; diff --git a/basis/furnace/auth/auth-docs.factor b/basis/furnace/auth/auth-docs.factor index 7aa771e37d..49dae0d275 100644 --- a/basis/furnace/auth/auth-docs.factor +++ b/basis/furnace/auth/auth-docs.factor @@ -160,24 +160,24 @@ ARTICLE: "furnace.auth.users" "User profiles" ARTICLE: "furnace.auth.example" "Furnace authentication example" "The " { $vocab-link "webapps.todo" } " vocabulary wraps all of its responders in a protected responder. The " { $slot "description" } " slot is set so that the login page contains the message “You must log in to view your todo list”:" { $code - """ - "view your todo list" >>description""" + " + \"view your todo list\" >>description" } "The " { $vocab-link "webapps.wiki" } " vocabulary defines a mix of protected and unprotected actions. One example of a protected action is that for deleting wiki pages, an action normally reserved for administrators. This action is protected with the following code:" { $code - """ - "delete wiki articles" >>description - { can-delete-wiki-articles? } >>capabilities""" + " + \"delete wiki articles\" >>description + { can-delete-wiki-articles? } >>capabilities" } "The " { $vocab-link "websites.concatenative" } " vocabulary wraps all of its responders, including the wiki, in a login authentication realm:" { $code -""": ( responder -- responder' ) - "Factor website" - "Factor website" >>name +": ( responder -- responder' ) + \"Factor website\" + \"Factor website\" >>name allow-registration allow-password-recovery allow-edit-profile - allow-deactivation ;""" + allow-deactivation ;" } ; ARTICLE: "furnace.auth" "Furnace authentication" diff --git a/basis/help/cookbook/cookbook.factor b/basis/help/cookbook/cookbook.factor index f7a6133d97..724c058825 100644 --- a/basis/help/cookbook/cookbook.factor +++ b/basis/help/cookbook/cookbook.factor @@ -195,22 +195,22 @@ $nl { $heading "Example: ls" } "Here is an example implementing a simplified version of the Unix " { $snippet "ls" } " command in Factor:" { $code - """USING: command-line namespaces io io.files + "USING: command-line namespaces io io.files io.pathnames tools.files sequences kernel ; command-line get [ current-directory get directory. ] [ dup length 1 = [ first directory. ] [ - [ [ nl write ":" print ] [ directory. ] bi ] each + [ [ nl write \":\" print ] [ directory. ] bi ] each ] if -] if-empty""" +] if-empty" } "You can put it in a file named " { $snippet "ls.factor" } ", and then run it, to list the " { $snippet "/usr/bin" } " directory for example:" { $code "./factor ls.factor /usr/bin" } { $heading "Example: grep" } "The following is a more complicated example, implementing something like the Unix " { $snippet "grep" } " command:" -{ $code """USING: kernel fry io io.files io.encodings.ascii sequences +{ $code "USING: kernel fry io io.files io.encodings.ascii sequences regexp command-line namespaces ; IN: grep @@ -221,7 +221,7 @@ IN: grep ascii [ grep-lines ] with-file-reader ; : grep-usage ( -- ) - "Usage: factor grep.factor [...]" print ; + \"Usage: factor grep.factor [...]\" print ; command-line get [ grep-usage @@ -231,7 +231,7 @@ command-line get [ ] [ [ grep-file ] with each ] if-empty -] if-empty""" } +] if-empty" } "You can run it like so," { $code "./factor grep.factor '.*hello.*' myfile.txt" } "You'll notice this script takes a while to start. This is because it is loading and compiling the " { $vocab-link "regexp" } " vocabulary every time. To speed up startup, load the vocabulary into your image, and save the image:" diff --git a/basis/html/templates/fhtml/fhtml-tests.factor b/basis/html/templates/fhtml/fhtml-tests.factor index 7a8fec3022..1637100734 100644 --- a/basis/html/templates/fhtml/fhtml-tests.factor +++ b/basis/html/templates/fhtml/fhtml-tests.factor @@ -20,9 +20,9 @@ IN: html.templates.fhtml.tests [ [ ] [ - """<% + "<% IN: html.templates.fhtml.tests : test-word ( -- ) ; - %>""" parse-template drop + %>" parse-template drop ] unit-test ] with-file-vocabs diff --git a/basis/http/server/cgi/cgi-docs.factor b/basis/http/server/cgi/cgi-docs.factor index 001fa163e1..1bd700c873 100644 --- a/basis/http/server/cgi/cgi-docs.factor +++ b/basis/http/server/cgi/cgi-docs.factor @@ -6,8 +6,8 @@ HELP: enable-cgi { $description "Enables the responder to serve " { $snippet ".cgi" } " scripts by executing them as per the CGI specification." } { $examples { $code - """ - "/var/www/cgi/" enable-cgi "cgi-bin" add-responder""" + " + \"/var/www/cgi/\" enable-cgi \"cgi-bin\" add-responder" } } { $side-effects "responder" } ; diff --git a/basis/http/server/dispatchers/dispatchers-docs.factor b/basis/http/server/dispatchers/dispatchers-docs.factor index d4de6b6de4..3b965574f6 100644 --- a/basis/http/server/dispatchers/dispatchers-docs.factor +++ b/basis/http/server/dispatchers/dispatchers-docs.factor @@ -31,46 +31,46 @@ HELP: add-responder ARTICLE: "http.server.dispatchers.example" "HTTP dispatcher examples" { $heading "Simple pathname dispatcher" } { $code - """ - "new" add-responder - "edit" add-responder - "delete" add-responder - "" add-responder -main-responder set-global""" + " + \"new\" add-responder + \"edit\" add-responder + \"delete\" add-responder + \"\" add-responder +main-responder set-global" } "In the above example, visiting any URL other than " { $snippet "/new" } ", " { $snippet "/edit" } ", " { $snippet "/delete" } ", or " { $snippet "/" } " will result in a 404 error." { $heading "Another pathname dispatcher" } "On the other hand, suppose we wanted to route all unrecognized paths to a “view” action:" { $code - """ - "new" add-responder - "edit" add-responder - "delete" add-responder + " + \"new\" add-responder + \"edit\" add-responder + \"delete\" add-responder >>default -main-responder set-global""" +main-responder set-global" } "The " { $slot "default" } " slot holds a responder to which all unrecognized paths are sent to." { $heading "Dispatcher subclassing example" } { $code - """TUPLE: golf-courses < dispatcher ; + "TUPLE: golf-courses < dispatcher ; : ( -- golf-courses ) golf-courses new-dispatcher ; - "new" add-responder - "edit" add-responder - "delete" add-responder - "" add-responder -main-responder set-global""" + \"new\" add-responder + \"edit\" add-responder + \"delete\" add-responder + \"\" add-responder +main-responder set-global" } "The action templates can now emit links to responder-relative URLs prefixed by " { $snippet "$golf-courses/" } "." { $heading "Virtual hosting example" } { $code - """ - "concatenative-casino.com" add-responder - "raptor-dating.com" add-responder -main-responder set-global""" + " + \"concatenative-casino.com\" add-responder + \"raptor-dating.com\" add-responder +main-responder set-global" } "Note that the virtual host dispatcher strips off a " { $snippet "www." } " prefix, so " { $snippet "www.concatenative-casino.com" } " would be routed to the " { $snippet "" } " responder instead of receiving a 404." ; diff --git a/basis/io/directories/directories-docs.factor b/basis/io/directories/directories-docs.factor index 11ab475f9a..901dda1d71 100644 --- a/basis/io/directories/directories-docs.factor +++ b/basis/io/directories/directories-docs.factor @@ -50,13 +50,13 @@ HELP: with-directory-files { $examples "Print all files in your home directory which are larger than a megabyte:" { $code - """USING: io.directories io.files.info io.pathnames ; + "USING: io.directories io.files.info io.pathnames ; home [ [ dup link-info size>> 20 2^ > [ print ] [ drop ] if ] each -] with-directory-files""" +] with-directory-files" } } ; diff --git a/basis/io/encodings/string/string-docs.factor b/basis/io/encodings/string/string-docs.factor index 8dce520ddb..077a763a33 100644 --- a/basis/io/encodings/string/string-docs.factor +++ b/basis/io/encodings/string/string-docs.factor @@ -17,9 +17,9 @@ HELP: decode { "string" string } } { $description "Converts an array of bytes to a string, interpreting that array of bytes as a string with the given encoding." } { $examples - { $example """USING: io.encodings.string io.encodings.utf8 prettyprint ; -B{ 230 136 145 231 136 177 228 189 160 } utf8 decode .""" -""""我爱你"""" + { $example "USING: io.encodings.string io.encodings.utf8 prettyprint ; +B{ 230 136 145 231 136 177 228 189 160 } utf8 decode ." +"\"我爱你\"" } } ; @@ -27,8 +27,8 @@ HELP: encode { $values { "string" string } { "encoding" "an encoding descriptor" } { "byte-array" byte-array } } { $description "Converts a string into a byte array, interpreting that string with the given encoding." } { $examples - { $example """USING: io.encodings.string io.encodings.utf8 prettyprint ; -"我爱你" utf8 encode .""" + { $example "USING: io.encodings.string io.encodings.utf8 prettyprint ; +\"我爱你\" utf8 encode ." "B{ 230 136 145 231 136 177 228 189 160 }" } } ; diff --git a/basis/io/mmap/mmap-docs.factor b/basis/io/mmap/mmap-docs.factor index b5bfff28ab..22943d3c01 100644 --- a/basis/io/mmap/mmap-docs.factor +++ b/basis/io/mmap/mmap-docs.factor @@ -49,9 +49,9 @@ HELP: with-mapped-array { $unchecked-example "USING: alien.c-types io.mmap prettyprint specialized-arrays ;" "SPECIALIZED-ARRAY: uint" -""""resource:license.txt" uint [ +"resource:license.txt\" uint [ [ . ] each -] with-mapped-array""" +] with-mapped-array" "" } } diff --git a/basis/io/streams/throwing/throwing-docs.factor b/basis/io/streams/throwing/throwing-docs.factor index 4983c014f7..8915a61342 100644 --- a/basis/io/streams/throwing/throwing-docs.factor +++ b/basis/io/streams/throwing/throwing-docs.factor @@ -16,8 +16,8 @@ HELP: stream-throw-on-eof } { $description "Wraps a stream in a " { $link } " tuple and calls the quotation with this stream as the " { $link input-stream } " variable. Causes a " { $link stream-exhausted } " exception to be thrown upon stream exhaustion. The stream is left open after this combinator returns." } "This example will throw a " { $link stream-exhausted } " exception:" -{ $unchecked-example """USING: io.streams.throwing prettyprint ; -"abc" [ 4 read ] stream-throw-on-eof""" +{ $unchecked-example "USING: io.streams.throwing prettyprint ; +\"abc\" [ 4 read ] stream-throw-on-eof" "" } ; @@ -27,8 +27,8 @@ HELP: throw-on-eof } { $description "Wraps the value stored in the " { $link input-stream } " variable and causes a stream read that exhausts the input stream to throw a " { $link stream-exhausted } " exception. The stream is left open after this combinator returns." } $nl "This example will throw a " { $link stream-exhausted } " exception:" -{ $unchecked-example """USING: io.streams.throwing prettyprint ; -"abc" [ [ 4 read ] throw-on-eof ] with-string-reader""" +{ $unchecked-example "USING: io.streams.throwing prettyprint ; +\"abc\" [ [ 4 read ] throw-on-eof ] with-string-reader" "" } ; diff --git a/basis/json/reader/reader-tests.factor b/basis/json/reader/reader-tests.factor index bb5502eefd..798acbec8a 100644 --- a/basis/json/reader/reader-tests.factor +++ b/basis/json/reader/reader-tests.factor @@ -26,42 +26,42 @@ IN: json.reader.tests ! feature to get { -0.0 } [ "-0.0" json> ] unit-test -{ " fuzzy pickles " } [ """ " fuzzy pickles " """ json> ] unit-test -{ "while 1:\n\tpass" } [ """ "while 1:\n\tpass" """ json> ] unit-test +{ " fuzzy pickles " } [ " \" fuzzy pickles \" " json> ] unit-test +{ "while 1:\n\tpass" } [ " \"while 1:\n\tpass\" " json> ] unit-test ! unicode is allowed in json -{ "ß∂¬ƒ˚∆" } [ """ "ß∂¬ƒ˚∆"""" json> ] unit-test -${ { 8 9 10 12 13 34 47 92 } >string } [ """ "\\b\\t\\n\\f\\r\\"\\/\\\\" """ json> ] unit-test -${ { 0xabcd } >string } [ """ "\\uaBCd" """ json> ] unit-test +{ "ß∂¬ƒ˚∆" } [ " \"ß∂¬ƒ˚∆\"" json> ] unit-test +${ { 8 9 10 12 13 34 47 92 } >string } [ " \"\\b\\t\\n\\f\\r\\\"\\/\\\\\" " json> ] unit-test +${ { 0xabcd } >string } [ " \"\\uaBCd\" " json> ] unit-test { "𝄞" } [ "\"\\ud834\\udd1e\"" json> ] unit-test { H{ { "a" { } } { "b" 123 } } } [ "{\"a\":[],\"b\":123}" json> ] unit-test { { } } [ "[]" json> ] unit-test -{ { 1 "two" 3.0 } } [ """ [1, "two", 3.0] """ json> ] unit-test +{ { 1 "two" 3.0 } } [ " [1, \"two\", 3.0] " json> ] unit-test { H{ } } [ "{}" json> ] unit-test ! the returned hashtable should be different every time { H{ } } [ "key" "value" "{}" json> ?set-at "{}" json> nip ] unit-test -{ H{ { "US$" 1.0 } { "EU€" 1.5 } } } [ """ { "US$":1.00, "EU\\u20AC":1.50 } """ json> ] unit-test +{ H{ { "US$" 1.0 } { "EU€" 1.5 } } } [ " { \"US$\":1.00, \"EU\\u20AC\":1.50 } " json> ] unit-test { H{ { "fib" { 1 1 2 3 5 8 H{ { "etc" "etc" } } } } { "prime" { 2 3 5 7 11 13 } } -} } [ """ { - "fib": [1, 1, 2, 3, 5, 8, - { "etc":"etc" } ], - "prime": +} } [ " { + \"fib\": [1, 1, 2, 3, 5, 8, + { \"etc\":\"etc\" } ], + \"prime\": [ 2,3, 5,7, 11, 13 ] } -""" json> ] unit-test +" json> ] unit-test { 0 } [ " 0" json> ] unit-test { 0 } [ "0 " json> ] unit-test { 0 } [ " 0 " json> ] unit-test { V{ H{ { "a" "b" } } H{ { "c" "d" } } } } -[ """{"a": "b"} {"c": "d"}""" [ read-jsons ] with-string-reader ] unit-test +[ "{\"a\": \"b\"} {\"c\": \"d\"}" [ read-jsons ] with-string-reader ] unit-test ! empty objects are allowed as values in objects { H{ { "foo" H{ } } } } [ "{ \"foo\" : {}}" json> ] unit-test diff --git a/basis/json/writer/writer-tests.factor b/basis/json/writer/writer-tests.factor index 3647649f13..c45c23996d 100644 --- a/basis/json/writer/writer-tests.factor +++ b/basis/json/writer/writer-tests.factor @@ -10,12 +10,12 @@ IN: json.writer.tests { "102.0" } [ 102.0 >json ] unit-test { "102.5" } [ 102.5 >json ] unit-test { "0.5" } [ 1/2 >json ] unit-test -{ """\"hello world\"""" } [ "hello world" >json ] unit-test +{ "\"hello world\"" } [ "hello world" >json ] unit-test { "[1,\"two\",3.0]" } [ { 1 "two" 3.0 } >json ] unit-test -{ """{"US$":1.0,"EU€":1.5}""" } [ H{ { "US$" 1.0 } { "EU€" 1.5 } } >json ] unit-test +{ "{\"US$\":1.0,\"EU€\":1.5}" } [ H{ { "US$" 1.0 } { "EU€" 1.5 } } >json ] unit-test -{ """">json"""" } [ \ >json >json ] unit-test +{ "\">json\"" } [ \ >json >json ] unit-test { { 0.5 } } [ { 1/2 } >json json> ] unit-test @@ -35,31 +35,31 @@ TUPLE: person first-name age ; with-variable ] unit-test -{ """{"1":2,"3":4}""" } +{ "{\"1\":2,\"3\":4}" } [ H{ { "1" 2 } { "3" 4 } } >json ] unit-test -{ """{"1":2,"3":4}""" } +{ "{\"1\":2,\"3\":4}" } [ H{ { 1 2 } { 3 4 } } >json ] unit-test -{ """{"":4}""" } +{ "{\"\":4}" } [ H{ { "" 2 } { "" 4 } } >json ] unit-test -{ """{"true":4,"false":2,"":5}""" } +{ "{\"true\":4,\"false\":2,\"\":5}" } [ H{ { f 2 } { t 4 } { "" 5 } } >json ] unit-test -{ """{"3.1":3}""" } +{ "{\"3.1\":3}" } [ H{ { 3.1 3 } } >json ] unit-test -{ """{"null":1}""" } +{ "{\"null\":1}" } [ H{ { json-null 1 } } >json ] unit-test -{ """{"Infinity":1}""" } +{ "{\"Infinity\":1}" } [ t json-allow-fp-special? [ H{ { 1/0. 1 } } >json ] with-variable ] unit-test -{ """{"-Infinity":1}""" } +{ "{\"-Infinity\":1}" } [ t json-allow-fp-special? [ H{ { -1/0. 1 } } >json ] with-variable ] unit-test -{ """{"NaN":1}""" } +{ "{\"NaN\":1}" } [ t json-allow-fp-special? [ H{ { NAN: 333 1 } } >json ] with-variable ] unit-test { diff --git a/basis/locals/locals-docs.factor b/basis/locals/locals-docs.factor index b2275360c7..0ddccd58cc 100644 --- a/basis/locals/locals-docs.factor +++ b/basis/locals/locals-docs.factor @@ -69,24 +69,24 @@ $nl ARTICLE: "locals-examples" "Examples of lexical variables" { $heading "Definitions with lexical variables" } "The following example demonstrates lexical variable bindings in word definitions. The " { $snippet "quadratic-roots" } " word is defined with " { $link POSTPONE: :: } ", so it takes its inputs from the top three elements of the datastack and binds them to the variables " { $snippet "a" } ", " { $snippet "b" } ", and " { $snippet "c" } ". In the body, the " { $snippet "disc" } " variable is bound using " { $link POSTPONE: :> } " and then used in the following line of code." -{ $example """USING: locals math math.functions kernel ; +{ $example "USING: locals math math.functions kernel ; IN: scratchpad :: quadratic-roots ( a b c -- x y ) b sq 4 a c * * - sqrt :> disc b neg disc [ + ] [ - ] 2bi [ 2 a * / ] bi@ ; -1.0 1.0 -6.0 quadratic-roots [ . ] bi@""" -"""2.0 --3.0""" +1.0 1.0 -6.0 quadratic-roots [ . ] bi@" +"2.0 +-3.0" } "If you wanted to perform the quadratic formula interactively from the listener, you could use " { $link POSTPONE: [let } " to provide a scope for the variables:" -{ $example """USING: locals math math.functions kernel ; +{ $example "USING: locals math math.functions kernel ; IN: scratchpad [let 1.0 :> a 1.0 :> b -6.0 :> c b sq 4 a c * * - sqrt :> disc b neg disc [ + ] [ - ] 2bi [ 2 a * / ] bi@ -] [ . ] bi@""" -"""2.0 --3.0""" +] [ . ] bi@" +"2.0 +-3.0" } $nl @@ -114,7 +114,7 @@ $nl { $heading "Mutable bindings" } "This next example demonstrates closures and mutable variable bindings. The " { $snippet "" } " word outputs a tuple containing a pair of quotations that respectively increment and decrement an internal counter in the mutable " { $snippet "value" } " variable and then return the new value. The quotations close over the counter, so each invocation of the word gives new quotations with a new internal counter." { $example -"""USING: locals kernel math ; +"USING: locals kernel math ; IN: scratchpad TUPLE: counter adder subtractor ; @@ -127,15 +127,15 @@ TUPLE: counter adder subtractor ; [ adder>> call . ] [ adder>> call . ] -[ subtractor>> call . ] tri""" -"""1 +[ subtractor>> call . ] tri" +"1 2 -1""" +1" } $nl "The same variable name can be bound multiple times in the same scope. This is different from reassigning the value of a mutable variable. The most recent binding for a variable name will mask previous bindings for that name. However, the old binding referring to the previous value can still persist in closures. The following contrived example demonstrates this:" { $example -"""USING: kernel locals prettyprint ; +"USING: kernel locals prettyprint ; IN: scratchpad :: rebinding-example ( -- quot1 quot2 ) 5 :> a [ a ] @@ -144,22 +144,22 @@ IN: scratchpad 5 :> a! [ a ] 6 a! [ a ] ; rebinding-example [ call . ] bi@ -mutable-example [ call . ] bi@""" -"""5 +mutable-example [ call . ] bi@" +"5 6 6 -6""" +6" } "In " { $snippet "rebinding-example" } ", the binding of " { $snippet "a" } " to " { $snippet "5" } " is closed over in the first quotation, and the binding of " { $snippet "a" } " to " { $snippet "6" } " is closed over in the second, so calling both quotations results in " { $snippet "5" } " and " { $snippet "6" } " respectively. By contrast, in " { $snippet "mutable-example" } ", both quotations close over a single binding of " { $snippet "a" } ". Even though " { $snippet "a" } " is assigned to " { $snippet "6" } " after the first quotation is made, calling either quotation will output the new value of " { $snippet "a" } "." { $heading "Lexical variables in literals" } "Some kinds of literals can include references to lexical variables as described in " { $link "locals-literals" } ". For example, the " { $link 3array } " word could be implemented as follows:" { $example -"""USING: locals prettyprint ; +"USING: locals prettyprint ; IN: scratchpad :: my-3array ( x y z -- array ) { x y z } ; -1 "two" 3.0 my-3array .""" -"""{ 1 "two" 3.0 }""" +1 \"two\" 3.0 my-3array ." +"{ 1 \"two\" 3.0 }" } ; ARTICLE: "locals-literals" "Lexical variables in literals" diff --git a/basis/math/combinatorics/combinatorics-docs.factor b/basis/math/combinatorics/combinatorics-docs.factor index 3657b8662b..7523bffb24 100644 --- a/basis/math/combinatorics/combinatorics-docs.factor +++ b/basis/math/combinatorics/combinatorics-docs.factor @@ -88,14 +88,14 @@ HELP: all-combinations { $examples { $example "USING: math.combinatorics prettyprint ;" "{ \"a\" \"b\" \"c\" \"d\" } 2 all-combinations ." -"""{ - { "a" "b" } - { "a" "c" } - { "a" "d" } - { "b" "c" } - { "b" "d" } - { "c" "d" } -}""" } } ; +"{ + { \"a\" \"b\" } + { \"a\" \"c\" } + { \"a\" \"d\" } + { \"b\" \"c\" } + { \"b\" \"d\" } + { \"c\" \"d\" } +}" } } ; HELP: each-combination { $values { "seq" sequence } { "k" "a non-negative integer" } { "quot" { $quotation ( ... elt -- ... ) } } } diff --git a/basis/math/statistics/statistics-docs.factor b/basis/math/statistics/statistics-docs.factor index 959bea8d09..3958a22d77 100644 --- a/basis/math/statistics/statistics-docs.factor +++ b/basis/math/statistics/statistics-docs.factor @@ -132,7 +132,7 @@ HELP: sorted-histogram { $description "Outputs a " { $link histogram } " of a sequence sorted by number of occurrences from lowest to highest." } { $examples { $example "USING: prettyprint math.statistics ;" - """"abababbbbbbc" sorted-histogram .""" + "\"abababbbbbbc\" sorted-histogram ." "{ { 99 1 } { 97 3 } { 98 8 } }" } } ; diff --git a/basis/math/vectors/conversion/conversion-docs.factor b/basis/math/vectors/conversion/conversion-docs.factor index 7f2a349c52..ec7851010d 100644 --- a/basis/math/vectors/conversion/conversion-docs.factor +++ b/basis/math/vectors/conversion/conversion-docs.factor @@ -37,30 +37,30 @@ HELP: vconvert } { $examples "Conversion between integer and float vectors:" -{ $example """USING: alien.c-types math.vectors.conversion math.vectors.simd +{ $example "USING: alien.c-types math.vectors.conversion math.vectors.simd prettyprint ; int-4{ 0 1 2 3 } int-4 float-4 vconvert . -double-2{ 1.25 3.75 } double-2 longlong-2 vconvert .""" -"""float-4{ 0.0 1.0 2.0 3.0 } -longlong-2{ 1 3 }""" } +double-2{ 1.25 3.75 } double-2 longlong-2 vconvert ." +"float-4{ 0.0 1.0 2.0 3.0 } +longlong-2{ 1 3 }" } "Packing conversions:" -{ $example """USING: alien.c-types math.vectors.conversion math.vectors.simd +{ $example "USING: alien.c-types math.vectors.conversion math.vectors.simd prettyprint ; int-4{ -8 70000 6000 50 } int-4{ 4 3 2 -1 } int-4 ushort-8 vconvert . double-2{ 0.0 1.0e100 } -double-2{ -1.0e100 0.0 } double-2 float-4 vconvert .""" -"""ushort-8{ 0 65535 6000 50 4 3 2 0 } -float-4{ 0.0 1/0. -1/0. 0.0 }""" } +double-2{ -1.0e100 0.0 } double-2 float-4 vconvert ." +"ushort-8{ 0 65535 6000 50 4 3 2 0 } +float-4{ 0.0 1/0. -1/0. 0.0 }" } "Unpacking conversions:" -{ $example """USING: alien.c-types kernel math.vectors.conversion +{ $example "USING: alien.c-types kernel math.vectors.conversion math.vectors.simd prettyprint ; uchar-16{ 8 70 60 50 4 30 200 1 9 10 110 102 133 143 115 0 } -uchar-16 short-8 vconvert [ . ] bi@""" -"""short-8{ 8 70 60 50 4 30 200 1 } -short-8{ 9 10 110 102 133 143 115 0 }""" } +uchar-16 short-8 vconvert [ . ] bi@" +"short-8{ 8 70 60 50 4 30 200 1 } +short-8{ 9 10 110 102 133 143 115 0 }" } } ; ARTICLE: "math.vectors.conversion" "SIMD vector conversion" diff --git a/basis/math/vectors/simd/simd-docs.factor b/basis/math/vectors/simd/simd-docs.factor index 3f35d684cd..d29ddafebd 100644 --- a/basis/math/vectors/simd/simd-docs.factor +++ b/basis/math/vectors/simd/simd-docs.factor @@ -85,7 +85,7 @@ $nl $nl "For example, in the following, no SIMD operations are used at all, because the compiler's propagation pass does not consider dynamic variable usage:" { $code -"""USING: compiler.tree.debugger math.vectors +"USING: compiler.tree.debugger math.vectors math.vectors.simd ; SYMBOLS: x y ; @@ -93,10 +93,10 @@ SYMBOLS: x y ; float-4{ 1.5 2.0 3.7 0.4 } x set float-4{ 1.5 2.0 3.7 0.4 } y set x get y get v+ -] optimizer-report.""" } +] optimizer-report." } "The following word benefits from SIMD optimization, because it begins with an unsafe declaration:" { $code -"""USING: compiler.tree.debugger kernel.private +"USING: compiler.tree.debugger kernel.private math.vectors math.vectors.simd ; IN: simd-demo @@ -104,12 +104,12 @@ IN: simd-demo { float-4 float-4 float-4 } declare [ v* ] [ [ 1.0 ] dip n-v v* ] bi-curry* bi v+ ; -\\ interpolate optimizer-report.""" } +\\ interpolate optimizer-report." } "Note that using " { $link declare } " is not recommended. Safer ways of getting type information for the input parameters to a word include defining methods on a generic word (the value being dispatched upon has a statically known type in the method body), as well as using " { $link "hints" } " and " { $link POSTPONE: inline } " declarations." $nl "Here is a better version of the " { $snippet "interpolate" } " words above that uses hints:" { $code -"""USING: compiler.tree.debugger hints +"USING: compiler.tree.debugger hints math.vectors math.vectors.simd ; IN: simd-demo @@ -118,14 +118,14 @@ IN: simd-demo HINTS: interpolate float-4 float-4 float-4 ; -\\ interpolate optimizer-report. """ } +\\ interpolate optimizer-report. " } "This time, the optimizer report lists calls to both SIMD primitives and high-level vector words, because hints cause two code paths to be generated. The " { $snippet "optimized." } " word can be used to make sure that the fast code path consists entirely of calls to primitives." $nl "If the " { $snippet "interpolate" } " word was to be used in several places with different types of vectors, it would be best to declare it " { $link POSTPONE: inline } "." $nl "In the " { $snippet "interpolate" } " word, there is still a call to the " { $link } " primitive, because the return value at the end is being boxed on the heap. In the next example, no memory allocation occurs at all because the SIMD vectors are stored inside a struct class (see " { $link "classes.struct" } "); also note the use of inlining:" { $code -"""USING: compiler.tree.debugger math.vectors math.vectors.simd ; +"USING: compiler.tree.debugger math.vectors math.vectors.simd ; IN: simd-demo STRUCT: actor @@ -148,13 +148,13 @@ M: actor advance ( dt actor -- ) [ >float ] dip [ update-velocity ] [ update-position ] 2bi ; -M\\ actor advance optimized.""" +M\\ actor advance optimized." } "The " { $vocab-link "compiler.cfg.debugger" } " vocabulary can give a lower-level picture of the generated code, that includes register assignments and other low-level details. To look at low-level optimizer output, call " { $snippet "regs." } " on a word or quotation:" { $code -"""USE: compiler.tree.debugger +"USE: compiler.tree.debugger -M\\ actor advance regs.""" } +M\\ actor advance regs." } "Example of a high-performance algorithms that use SIMD primitives can be found in the following vocabularies:" { $list { $vocab-link "benchmark.nbody-simd" } diff --git a/basis/math/vectors/vectors-docs.factor b/basis/math/vectors/vectors-docs.factor index 9859f643eb..90b9d1a0fc 100644 --- a/basis/math/vectors/vectors-docs.factor +++ b/basis/math/vectors/vectors-docs.factor @@ -135,21 +135,21 @@ ARTICLE: "math-vectors-simd-logic" "Componentwise logic with SIMD vectors" } "For an integer vector, false will manifest as " { $snippet "0" } " and true as " { $snippet "-1" } " (for signed vectors) or the largest representable value of the element type (for unsigned vectors):" { $example -"""USING: math.vectors math.vectors.simd prettyprint alien.c-types ; +"USING: math.vectors math.vectors.simd prettyprint alien.c-types ; int-4{ 1 2 3 0 } int-4{ 1 -2 3 4 } v= uchar-16{ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 } uchar-16{ 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 } v< -[ . ] bi@""" -"""int-4{ -1 0 -1 0 } -uchar-16{ 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 }""" +[ . ] bi@" +"int-4{ -1 0 -1 0 } +uchar-16{ 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 }" } "This differs from Factor's native representation of boolean values, where " { $link f } " is false and every other value (including " { $snippet "0" } " and " { $snippet "0.0" } ") is true. To make it easy to construct literal SIMD masks, " { $link t } " and " { $link f } " are accepted inside SIMD literal syntax and expand to the proper true or false representation for the underlying type:" { $example -"""USING: math.vectors math.vectors.simd prettyprint alien.c-types ; +"USING: math.vectors math.vectors.simd prettyprint alien.c-types ; -int-4{ f f t f } .""" -"""int-4{ 0 0 -1 0 }""" } +int-4{ f f t f } ." +"int-4{ 0 0 -1 0 }" } "However, extracting an element from a boolean SIMD vector with " { $link nth } " will not yield a valid Factor boolean. This is not generally a problem, since the results of vector comparisons are meant to be consumed by subsequent vector logical and test operations, which will accept SIMD values in the native boolean format." $nl "Providing a SIMD boolean vector with element values other than the proper true and false representations as an input to the vector logical or test operations is undefined. Do not count on operations such as " { $link vall? } " or " { $link v? } " using bitwise operations to construct their results." @@ -380,10 +380,10 @@ HELP: vmerge { $values { "u" sequence } { "v" sequence } { "w" sequence } } { $description "Creates a new sequence of the same type as and twice the length of " { $snippet "u" } " and " { $snippet "v" } " by interleaving the elements of " { $snippet "u" } " and " { $snippet "v" } "." } { $examples -{ $example """USING: kernel math.vectors prettyprint ; +{ $example "USING: kernel math.vectors prettyprint ; -{ "A" "B" "C" "D" } { "1" "2" "3" "4" } vmerge .""" -"""{ "A" "1" "B" "2" "C" "3" "D" "4" }""" +{ \"A\" \"B\" \"C\" \"D\" } { \"1\" \"2\" \"3\" \"4\" } vmerge ." +"{ \"A\" \"1\" \"B\" \"2\" \"C\" \"3\" \"D\" \"4\" }" } } ; HELP: (vmerge) @@ -391,11 +391,11 @@ HELP: (vmerge) { $description "Creates two new sequences of the same type and size as " { $snippet "u" } " and " { $snippet "v" } " by interleaving the elements of " { $snippet "u" } " and " { $snippet "v" } "." } { $notes "For hardware-supported SIMD vector types this word compiles to a single instruction per output value." } { $examples -{ $example """USING: kernel math.vectors prettyprint ; +{ $example "USING: kernel math.vectors prettyprint ; -{ "A" "B" "C" "D" } { "1" "2" "3" "4" } (vmerge) [ . ] bi@""" -"""{ "A" "1" "B" "2" } -{ "C" "3" "D" "4" }""" +{ \"A\" \"B\" \"C\" \"D\" } { \"1\" \"2\" \"3\" \"4\" } (vmerge) [ . ] bi@" +"{ \"A\" \"1\" \"B\" \"2\" } +{ \"C\" \"3\" \"D\" \"4\" }" } } ; HELP: (vmerge-head) @@ -403,10 +403,10 @@ HELP: (vmerge-head) { $description "Creates a new sequence of the same type and size as " { $snippet "u" } " and " { $snippet "v" } " by interleaving the elements from the first half of " { $snippet "u" } " and " { $snippet "v" } "." } { $notes "For hardware-supported SIMD vector types this word compiles to a single instruction." } { $examples -{ $example """USING: kernel math.vectors prettyprint ; +{ $example "USING: kernel math.vectors prettyprint ; -{ "A" "B" "C" "D" } { "1" "2" "3" "4" } (vmerge-head) .""" -"""{ "A" "1" "B" "2" }""" +{ \"A\" \"B\" \"C\" \"D\" } { \"1\" \"2\" \"3\" \"4\" } (vmerge-head) ." +"{ \"A\" \"1\" \"B\" \"2\" }" } } ; HELP: (vmerge-tail) @@ -414,10 +414,10 @@ HELP: (vmerge-tail) { $description "Creates a new sequence of the same type and size as " { $snippet "u" } " and " { $snippet "v" } " by interleaving the elements from the tail half of " { $snippet "u" } " and " { $snippet "v" } "." } { $notes "For hardware-supported SIMD vector types this word compiles to a single instruction." } { $examples -{ $example """USING: kernel math.vectors prettyprint ; +{ $example "USING: kernel math.vectors prettyprint ; -{ "A" "B" "C" "D" } { "1" "2" "3" "4" } (vmerge-tail) .""" -"""{ "C" "3" "D" "4" }""" +{ \"A\" \"B\" \"C\" \"D\" } { \"1\" \"2\" \"3\" \"4\" } (vmerge-tail) ." +"{ \"C\" \"3\" \"D\" \"4\" }" } } ; { vmerge (vmerge) (vmerge-head) (vmerge-tail) } related-words diff --git a/basis/opengl/capabilities/capabilities-docs.factor b/basis/opengl/capabilities/capabilities-docs.factor index 159148f46c..015e297fa8 100644 --- a/basis/opengl/capabilities/capabilities-docs.factor +++ b/basis/opengl/capabilities/capabilities-docs.factor @@ -42,10 +42,10 @@ HELP: has-gl-extensions? { $values { "extensions" "A sequence of extension name strings" } { "?" boolean } } { $description "Returns true if the set of " { $snippet "extensions" } " is a subset of the implementation-supported extensions returned by " { $link gl-extensions } ". Elements of " { $snippet "extensions" } " can be sequences, in which case true will be returned if any one of the extensions in the subsequence are available." } { $examples "Testing for framebuffer object and pixel buffer support:" - { $code """{ - { "GL_EXT_framebuffer_object" "GL_ARB_framebuffer_object" } - "GL_ARB_pixel_buffer_object" -} has-gl-extensions?""" } + { $code "{ + { \"GL_EXT_framebuffer_object\" \"GL_ARB_framebuffer_object\" } + \"GL_ARB_pixel_buffer_object\" +} has-gl-extensions?" } } ; HELP: has-gl-version-or-extensions? diff --git a/basis/opengl/debug/debug-docs.factor b/basis/opengl/debug/debug-docs.factor index dfc0d1993b..c1564ff905 100644 --- a/basis/opengl/debug/debug-docs.factor +++ b/basis/opengl/debug/debug-docs.factor @@ -4,11 +4,11 @@ IN: opengl.debug HELP: G { $description "Makes the OpenGL context associated with " { $link G-world } " active for subsequent OpenGL calls. This is intended to be used from the listener, where interactively entered OpenGL calls can be directed to any window. Note that the Factor UI resets the OpenGL context every time a window is updated, so every code snippet entered in the listener must be prefixed with " { $snippet "G" } " in this use case." } -{ $examples { $code """USING: opengl.debug ui ; +{ $examples { $code "USING: opengl.debug ui ; [ drop t ] find-window G-world set G 0.0 0.0 1.0 1.0 glClearColor -G GL_COLOR_BUFFER_BIT glClear""" } } ; +G GL_COLOR_BUFFER_BIT glClear" } } ; HELP: F { $description "Flushes the OpenGL context associated with " { $link G-world } ", thereby committing any outstanding drawing operations." } ; diff --git a/basis/peg/ebnf/ebnf-tests.factor b/basis/peg/ebnf/ebnf-tests.factor index 7af213837f..1b81767333 100644 --- a/basis/peg/ebnf/ebnf-tests.factor +++ b/basis/peg/ebnf/ebnf-tests.factor @@ -569,10 +569,10 @@ Tok = Spaces (Number | Special ) [ "USE: peg.ebnf [EBNF EBNF]" eval( -- ) ] must-fail -[ """USE: peg.ebnf [EBNF +[ "USE: peg.ebnf [EBNF lol = a lol = b - EBNF]""" eval( -- ) + EBNF]" eval( -- ) ] [ error>> [ redefined-rule? ] [ name>> "lol" = ] bi and ] must-fail-with diff --git a/basis/prettyprint/prettyprint-tests.factor b/basis/prettyprint/prettyprint-tests.factor index 13099ab1f9..89f126eaec 100644 --- a/basis/prettyprint/prettyprint-tests.factor +++ b/basis/prettyprint/prettyprint-tests.factor @@ -402,11 +402,11 @@ GENERIC: harhar ( obj -- obj ) M: maybe{ har } harhar ; M: integer harhar M\ integer harhar drop ; { -"""USING: prettyprint.tests ; +"USING: prettyprint.tests ; M: maybe{ har } harhar ; USING: kernel math prettyprint.tests ; -M: integer harhar M\\ integer harhar drop ;\n""" +M: integer harhar M\\ integer harhar drop ;\n" } [ [ \ harhar see-methods ] with-string-writer ] unit-test @@ -415,43 +415,43 @@ TUPLE: mo { a union{ float integer } } ; TUPLE: fo { a intersection{ fixnum integer } } ; { -"""USING: math ; +"USING: math ; IN: prettyprint.tests TUPLE: mo { a union{ integer float } initial: 0 } ; -""" +" } [ [ \ mo see ] with-string-writer ] unit-test { -"""USING: math ; +"USING: math ; IN: prettyprint.tests TUPLE: fo { a intersection{ integer fixnum } initial: 0 } ; -""" +" } [ [ \ fo see ] with-string-writer ] unit-test { -"""union{ intersection{ string hashtable } union{ integer float } }\n""" +"union{ intersection{ string hashtable } union{ integer float } }\n" } [ [ union{ union{ float integer } intersection{ string hashtable } } . ] with-string-writer ] unit-test { -"""intersection{ +"intersection{ intersection{ string hashtable } union{ integer float } } -""" +" } [ [ intersection{ union{ float integer } intersection{ string hashtable } } . ] with-string-writer ] unit-test { -"""maybe{ union{ integer float } }\n""" +"maybe{ union{ integer float } }\n" } [ [ maybe{ union{ float integer } } . ] with-string-writer ] unit-test { -"""maybe{ maybe{ integer } }\n""" +"maybe{ maybe{ integer } }\n" } [ [ maybe{ maybe{ integer } } . ] with-string-writer ] unit-test @@ -472,14 +472,14 @@ TUPLE: fo { a intersection{ integer fixnum } initial: 0 } ; ] with-string-writer ; { -"""aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa b""" +"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa b" } [ margin get 3 - margin-test ] unit-test { -"""aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa b""" +"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa b" } [ margin get 2 - margin-test ] unit-test { -"""aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa -b""" +"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +b" } [ margin get 1 - margin-test ] unit-test diff --git a/basis/quoted-printable/quoted-printable-tests.factor b/basis/quoted-printable/quoted-printable-tests.factor index 2c53d45f3b..d9d8385195 100644 --- a/basis/quoted-printable/quoted-printable-tests.factor +++ b/basis/quoted-printable/quoted-printable-tests.factor @@ -4,21 +4,21 @@ USING: tools.test quoted-printable io.encodings.string sequences splitting kernel io.encodings.8-bit.latin2 ; IN: quoted-printable.tests -{ """José was the +{ "José was the person who knew how to write the letters: ő and ü -and we didn't know hów tö do thât""" } -[ """Jos=E9 was the +and we didn't know hów tö do thât" } +[ "Jos=E9 was the person who knew how to write the letters: =F5 and =FC=20 and w= -e didn't know h=F3w t=F6 do th=E2t""" quoted> latin2 decode ] unit-test +e didn't know h=F3w t=F6 do th=E2t" quoted> latin2 decode ] unit-test -{ """Jos=E9 was the=0Aperson who knew how to write the letters:=0A =F5 and =FC=0Aand we didn't know h=F3w t=F6 do th=E2t""" } -[ """José was the +{ "Jos=E9 was the=0Aperson who knew how to write the letters:=0A =F5 and =FC=0Aand we didn't know h=F3w t=F6 do th=E2t" } +[ "José was the person who knew how to write the letters: ő and ü -and we didn't know hów tö do thât""" latin2 encode >quoted ] unit-test +and we didn't know hów tö do thât" latin2 encode >quoted ] unit-test : message ( -- str ) 55 [ "hello" ] replicate concat ; diff --git a/basis/regexp/regexp-docs.factor b/basis/regexp/regexp-docs.factor index aad796eabc..72f1ff54b9 100644 --- a/basis/regexp/regexp-docs.factor +++ b/basis/regexp/regexp-docs.factor @@ -33,9 +33,9 @@ ARTICLE: "regexp-intro" "A quick introduction to regular expressions" "The " { $snippet "+" } " operator matches one or more occurrences of the previous expression; in this case " { $snippet "o" } ". Another useful feature is alternation. Say we want to do this replacement with fooooo or boooo. Then we could use the code" { $code "R/ (f|b)oo+/ \"bar\" re-replace" } "To search a file for all lines that match a given regular expression, you could use code like this:" -{ $code """"file.txt" ascii file-lines [ R/ (f|b)oo+/ re-contains? ] filter""" } +{ $code "\"file.txt\" ascii file-lines [ R/ (f|b)oo+/ re-contains? ] filter" } "To test if a string in its entirety matches a regular expression, the following can be used:" -{ $example """USE: regexp "fooo" R/ (b|f)oo+/ matches? .""" "t" } +{ $example "USE: regexp \"fooo\" R/ (b|f)oo+/ matches? ." "t" } "Regular expressions can't be used for all parsing tasks. For example, they are not powerful enough to match balancing parentheses." ; ARTICLE: "regexp-construction" "Constructing regular expressions" diff --git a/basis/sequences/complex-components/complex-components-docs.factor b/basis/sequences/complex-components/complex-components-docs.factor index 427279d8f3..adffd71085 100644 --- a/basis/sequences/complex-components/complex-components-docs.factor +++ b/basis/sequences/complex-components/complex-components-docs.factor @@ -13,21 +13,21 @@ ABOUT: "sequences.complex-components" HELP: complex-components { $class-description "Sequence wrapper class that transforms a sequence of " { $link complex } " number values into a sequence of " { $link real } " values, interleaving the real and imaginary parts of the complex values in the original sequence." } -{ $examples { $example """USING: prettyprint sequences arrays sequences.complex-components ; -{ C{ 1.0 -1.0 } -2.0 C{ 3.0 1.0 } } >array .""" +{ $examples { $example "USING: prettyprint sequences arrays sequences.complex-components ; +{ C{ 1.0 -1.0 } -2.0 C{ 3.0 1.0 } } >array ." "{ 1.0 -1.0 -2.0 0 3.0 1.0 }" } } ; HELP: { $values { "sequence" sequence } { "complex-components" complex-components } } { $description "Wraps " { $snippet "sequence" } " in a " { $link complex-components } " wrapper." } { $examples -{ $example """USING: prettyprint sequences arrays +{ $example "USING: prettyprint sequences arrays sequences.complex-components ; -{ C{ 1.0 -1.0 } -2.0 C{ 3.0 1.0 } } third .""" +{ C{ 1.0 -1.0 } -2.0 C{ 3.0 1.0 } } third ." "-2.0" } -{ $example """USING: prettyprint sequences arrays +{ $example "USING: prettyprint sequences arrays sequences.complex-components ; -{ C{ 1.0 -1.0 } -2.0 C{ 3.0 1.0 } } fourth .""" +{ C{ 1.0 -1.0 } -2.0 C{ 3.0 1.0 } } fourth ." "0" } } ; diff --git a/basis/sequences/complex/complex-docs.factor b/basis/sequences/complex/complex-docs.factor index f92d2aa113..df379bd119 100644 --- a/basis/sequences/complex/complex-docs.factor +++ b/basis/sequences/complex/complex-docs.factor @@ -13,19 +13,19 @@ ABOUT: "sequences.complex" HELP: complex-sequence { $class-description "Sequence wrapper class that transforms a sequence of " { $link real } " number values into a sequence of " { $link complex } " values, treating the underlying sequence as pairs of alternating real and imaginary values." } -{ $examples { $example """USING: prettyprint specialized-arrays +{ $examples { $example "USING: prettyprint specialized-arrays sequences.complex sequences alien.c-types arrays ; SPECIALIZED-ARRAY: double -double-array{ 1.0 -1.0 -2.0 2.0 3.0 0.0 } >array .""" +double-array{ 1.0 -1.0 -2.0 2.0 3.0 0.0 } >array ." "{ C{ 1.0 -1.0 } C{ -2.0 2.0 } C{ 3.0 0.0 } }" } } ; HELP: { $values { "sequence" sequence } { "complex-sequence" complex-sequence } } { $description "Wraps " { $snippet "sequence" } " in a " { $link complex-sequence } "." } -{ $examples { $example """USING: prettyprint specialized-arrays +{ $examples { $example "USING: prettyprint specialized-arrays sequences.complex sequences alien.c-types arrays ; SPECIALIZED-ARRAY: double -double-array{ 1.0 -1.0 -2.0 2.0 3.0 0.0 } second .""" +double-array{ 1.0 -1.0 -2.0 2.0 3.0 0.0 } second ." "C{ -2.0 2.0 }" } } ; { complex-sequence } related-words diff --git a/basis/sequences/generalizations/generalizations-tests.factor b/basis/sequences/generalizations/generalizations-tests.factor index ed69e6493e..328f0b7887 100644 --- a/basis/sequences/generalizations/generalizations-tests.factor +++ b/basis/sequences/generalizations/generalizations-tests.factor @@ -42,11 +42,11 @@ IN: sequences.generalizations.tests [ [ 2 - ] [ ] [ 1 - ] tri ] 2 nproduce [ drop ] 2dip ; -{ """A1a! +{ "A1a! B2b@ C3c# D4d$ -""" } [ +" } [ { "A" "B" "C" "D" } { "1" "2" "3" "4" } { "a" "b" "c" "d" } @@ -115,11 +115,11 @@ D4d$ mnmap-1-test ] unit-test -{ """A1a! +{ "A1a! B2b@ C3c# D4d$ -""" } [ +" } [ { "A" "B" "C" "D" } { "1" "2" "3" "4" } { "a" "b" "c" "d" } diff --git a/basis/sequences/product/product-docs.factor b/basis/sequences/product/product-docs.factor index 854911ae18..81349c15fb 100644 --- a/basis/sequences/product/product-docs.factor +++ b/basis/sequences/product/product-docs.factor @@ -5,37 +5,37 @@ IN: sequences.product HELP: product-sequence { $class-description "A class of virtual sequences that present the cartesian product of their underlying set of sequences. Product sequences are constructed with the " { $link } " word." } { $examples -{ $example """USING: arrays prettyprint sequences.product ; -{ { 1 2 3 } { "a" "b" "c" } } >array . -""" """{ - { 1 "a" } - { 2 "a" } - { 3 "a" } - { 1 "b" } - { 2 "b" } - { 3 "b" } - { 1 "c" } - { 2 "c" } - { 3 "c" } -}""" } } ; +{ $example "USING: arrays prettyprint sequences.product ; +{ { 1 2 3 } { \"a\" \"b\" \"c\" } } >array . +" "{ + { 1 \"a\" } + { 2 \"a\" } + { 3 \"a\" } + { 1 \"b\" } + { 2 \"b\" } + { 3 \"b\" } + { 1 \"c\" } + { 2 \"c\" } + { 3 \"c\" } +}" } } ; HELP: { $values { "sequences" sequence } { "product-sequence" product-sequence } } { $description "Constructs a " { $link product-sequence } " over " { $snippet "sequences" } "." } { $examples -{ $example """USING: arrays prettyprint sequences.product ; -{ { 1 2 3 } { "a" "b" "c" } } >array .""" -"""{ - { 1 "a" } - { 2 "a" } - { 3 "a" } - { 1 "b" } - { 2 "b" } - { 3 "b" } - { 1 "c" } - { 2 "c" } - { 3 "c" } -}""" } } ; +{ $example "USING: arrays prettyprint sequences.product ; +{ { 1 2 3 } { \"a\" \"b\" \"c\" } } >array ." +"{ + { 1 \"a\" } + { 2 \"a\" } + { 3 \"a\" } + { 1 \"b\" } + { 2 \"b\" } + { 3 \"b\" } + { 1 \"c\" } + { 2 \"c\" } + { 3 \"c\" } +}" } } ; { product-sequence } related-words diff --git a/basis/smtp/smtp-docs.factor b/basis/smtp/smtp-docs.factor index 62c0f770c9..dfdb681ded 100644 --- a/basis/smtp/smtp-docs.factor +++ b/basis/smtp/smtp-docs.factor @@ -89,11 +89,11 @@ ARTICLE: "smtp-gmail" "Setting up SMTP with gmail" { $code "USING: smtp namespaces io.sockets ;" "" - """default-smtp-config - "smtp.gmail.com" 587 >>server + "default-smtp-config + \"smtp.gmail.com\" 587 >>server t >>tls? - "my.gmail.address@gmail.com" "qwertyuiasdfghjk" >>auth - \\ smtp-config set-global""" + \"my.gmail.address@gmail.com\" \"qwertyuiasdfghjk\" >>auth + \\ smtp-config set-global" } ; diff --git a/basis/specialized-arrays/specialized-arrays-tests.factor b/basis/specialized-arrays/specialized-arrays-tests.factor index 583ec9e8f9..95db87e683 100644 --- a/basis/specialized-arrays/specialized-arrays-tests.factor +++ b/basis/specialized-arrays/specialized-arrays-tests.factor @@ -136,22 +136,22 @@ SPECIALIZED-ARRAY: fixed-string SYMBOL: __does_not_exist__ [ - """ + " IN: specialized-arrays.tests USING: specialized-arrays ; -SPECIALIZED-ARRAY: __does_not_exist__ """ eval( -- ) +SPECIALIZED-ARRAY: __does_not_exist__ " eval( -- ) ] must-fail { } [ - """ + " IN: specialized-arrays.tests USING: alien.c-types classes.struct specialized-arrays ; STRUCT: __does_not_exist__ { x int } ; SPECIALIZED-ARRAY: __does_not_exist__ -""" eval( -- ) +" eval( -- ) ] unit-test { f } [ diff --git a/basis/specialized-vectors/specialized-vectors-docs.factor b/basis/specialized-vectors/specialized-vectors-docs.factor index b5f24f6f62..b3d315734e 100644 --- a/basis/specialized-vectors/specialized-vectors-docs.factor +++ b/basis/specialized-vectors/specialized-vectors-docs.factor @@ -27,15 +27,15 @@ HELP: push-new { $values { "vector" "a specialized vector of structs" } { "new" "a new value of the specialized vector's type" } } { $description "Grows " { $snippet "vector" } ", increasing its length by one, and outputs a " { $link struct } " object wrapping the newly allocated storage." } { $notes "This word allows struct objects to be streamed into a struct vector efficiently without excessive copying. The typical Factor idiom for pushing a new object onto a vector, when used with struct vectors, will allocate and copy a temporary struct object:" -{ $code """foo +{ $code "foo 5 >>a 6 >>b -foo-vector{ } clone push""" } +foo-vector{ } clone push" } "By using " { $snippet "push-new" } ", the new struct can be allocated directly from the vector and the intermediate copy can be avoided:" -{ $code """foo-vector{ } clone push-new +{ $code "foo-vector{ } clone push-new 5 >>a 6 >>b - drop""" } } ; + drop" } } ; ARTICLE: "specialized-vector-c" "Passing specialized vectors to C functions" "Each specialized vector has a " { $slot "underlying" } " slot holding a specialized array, which in turn has an " { $slot "underlying" } " slot holding a " { $link byte-array } " with the raw data. Passing a specialized vector as a parameter to a C function call will automatically extract the underlying data. To get at the underlying data directly, call the " { $link >c-ptr } " word on a specialized vector." ; diff --git a/basis/splitting/monotonic/monotonic-docs.factor b/basis/splitting/monotonic/monotonic-docs.factor index 6af6294842..61db411d31 100644 --- a/basis/splitting/monotonic/monotonic-docs.factor +++ b/basis/splitting/monotonic/monotonic-docs.factor @@ -13,10 +13,10 @@ HELP: monotonic-split-slice { $example "USING: splitting.monotonic math prettyprint ;" "{ 1 2 3 2 3 4 } [ < ] monotonic-split-slice ." - """{ + "{ T{ slice { to 3 } { seq { 1 2 3 2 3 4 } } } T{ slice { from 3 } { to 6 } { seq { 1 2 3 2 3 4 } } } -}""" +}" } } ; @@ -65,7 +65,7 @@ HELP: trends { $example "USING: splitting.monotonic math prettyprint ;" "{ 1 2 3 3 2 1 } trends ." - """{ + "{ T{ upward-slice { to 3 } { seq { 1 2 3 3 2 1 } } } T{ stable-slice { from 2 } @@ -77,7 +77,7 @@ HELP: trends { to 6 } { seq { 1 2 3 3 2 1 } } } -}""" +}" } } ; diff --git a/basis/timers/timers-docs.factor b/basis/timers/timers-docs.factor index aaa6277125..c3a3598c7a 100644 --- a/basis/timers/timers-docs.factor +++ b/basis/timers/timers-docs.factor @@ -24,7 +24,7 @@ HELP: every { $examples { $code "USING: timers io calendar ;" - """[ "Hi Buddy." print flush ] 10 seconds every drop""" + "[ \"Hi Buddy.\" print flush ] 10 seconds every drop" } } ; @@ -34,7 +34,7 @@ HELP: later { $examples { $code "USING: timers io calendar ;" - """[ "Break's over!" print flush ] 15 minutes later drop""" + "[ \"Break's over!\" print flush ] 15 minutes later drop" } } ; @@ -46,7 +46,7 @@ HELP: delayed-every { $examples { $code "USING: timers io calendar ;" - """[ "Hi Buddy." print flush ] 10 seconds every drop""" + "[ \"Hi Buddy.\" print flush ] 10 seconds every drop" } } ; diff --git a/basis/tools/profiler/sampling/sampling-docs.factor b/basis/tools/profiler/sampling/sampling-docs.factor index 1a0a93788e..b38060474e 100644 --- a/basis/tools/profiler/sampling/sampling-docs.factor +++ b/basis/tools/profiler/sampling/sampling-docs.factor @@ -208,8 +208,8 @@ ARTICLE: "tools.profiler.sampling" "Sampling profiler" "Profile data can be saved for future reporting:" { $subsections most-recent-profile-data top-down* top-down-max-depth* cross-section* flat* } "For example, the following will profile a call to the foo word, and generate and display a top-down tree profile from the results:" -{ $code """[ foo ] profile -top-down profile.""" } +{ $code "[ foo ] profile +top-down profile." } ; ABOUT: "tools.profiler.sampling" diff --git a/basis/tools/scaffold/scaffold-docs.factor b/basis/tools/scaffold/scaffold-docs.factor index c070e5ec71..0d0f35a731 100644 --- a/basis/tools/scaffold/scaffold-docs.factor +++ b/basis/tools/scaffold/scaffold-docs.factor @@ -32,18 +32,18 @@ HELP: scaffold-examples "Create docs for the + word:" { $example "USING: math tools.scaffold prettyprint ;" "\\ + scaffold-examples" - """{ $examples - "Example:" - { $example "USING: math prettyprint ;" - "" - "" + "{ $examples + \"Example:\" + { $example \"USING: math prettyprint ;\" + \"\" + \"\" } - "Example:" - { $example "USING: math prettyprint ;" - "" - "" + \"Example:\" + { $example \"USING: math prettyprint ;\" + \"\" + \"\" } -}""" +}" } } ; diff --git a/basis/tools/scaffold/scaffold-tests.factor b/basis/tools/scaffold/scaffold-tests.factor index 713caa3b59..704163be99 100644 --- a/basis/tools/scaffold/scaffold-tests.factor +++ b/basis/tools/scaffold/scaffold-tests.factor @@ -8,13 +8,13 @@ IN: tools.scaffold.tests [ >lower ] [ >upper ] bi* ; { -"""HELP: undocumented-word +"HELP: undocumented-word { $values - { "obj1" object } { "obj2" object } - { "obj3" object } { "obj4" object } + { \"obj1\" object } { \"obj2\" object } + { \"obj3\" object } { \"obj4\" object } } -{ $description "" } ; -""" +{ $description \"\" } ; +" } [ [ \ undocumented-word (help.) ] with-string-writer diff --git a/basis/tools/scaffold/scaffold.factor b/basis/tools/scaffold/scaffold.factor index 884bb9f455..1eb40445fe 100644 --- a/basis/tools/scaffold/scaffold.factor +++ b/basis/tools/scaffold/scaffold.factor @@ -324,12 +324,12 @@ SYMBOL: nested-examples : example-using ( using -- ) " " join "example-using" [ nested-examples get 4 0 ? CHAR: \s "example-indent" [ - """${example-indent}"Example:" -${example-indent}{ $example "USING: ${example-using} ;" -${example-indent} "" -${example-indent} "" + "${example-indent}\"Example:\" +${example-indent}{ $example \"USING: ${example-using} ;\" +${example-indent} \"\" +${example-indent} \"\" ${example-indent}} -""" +" interpolate ] with-variable ] with-variable ; diff --git a/basis/typed/typed-docs.factor b/basis/typed/typed-docs.factor index c6f80a48bc..dc7962c647 100644 --- a/basis/typed/typed-docs.factor +++ b/basis/typed/typed-docs.factor @@ -4,32 +4,32 @@ IN: typed HELP: TYPED: { $syntax -"""TYPED: word ( a b: class ... -- x: class y ... ) - body ;""" } +"TYPED: word ( a b: class ... -- x: class y ... ) + body ;" } { $description "Like " { $link POSTPONE: : } ", defines a new word with a given stack effect in the current vocabulary. The inputs and outputs of the stack effect can additionally be given type annotations in the form " { $snippet "a: class" } ". When invoked, the word will attempt to coerce its input values to the declared input types before executing the body, throwing an " { $link input-mismatch-error } " if the types cannot be made to match. The word will likewise attempt to coerce its outputs to their declared types and throw an " { $link output-mismatch-error } " if the types cannot be made to match." } { $notes "The aforementioned type conversions and checks are structured in such a way that they will be eliminated by the compiler if it can statically determine that the types of the inputs at a call site or of the outputs in the word definition are always correct." } { $examples "A version of " { $link + } " specialized for floats, converting other real number types:" { $example -"""USING: math prettyprint typed ; +"USING: math prettyprint typed ; IN: scratchpad TYPED: add-floats ( a: float b: float -- c: float ) + ; -1 2+1/2 add-floats .""" +1 2+1/2 add-floats ." "3.5" } } ; HELP: TYPED:: { $syntax -"""TYPED:: word ( a b: class ... -- x: class y ... ) - body ;""" } +"TYPED:: word ( a b: class ... -- x: class y ... ) + body ;" } { $description "Like " { $link POSTPONE: :: } ", defines a new word with named inputs in the current vocabulary. The inputs and outputs of the stack effect can additionally be given type annotations in the form " { $snippet "a: class" } ". When invoked, the word will attempt to coerce its input values to the declared input types before executing the body, throwing an " { $link input-mismatch-error } " if the types cannot be made to match. The word will likewise attempt to coerce its outputs to their declared types and throw an " { $link output-mismatch-error } " if the types cannot be made to match." } { $notes "The aforementioned type conversions and checks are structured in such a way that they will be eliminated by the compiler if it can statically determine that the types of the inputs at a call site or of the outputs in the word definition are always correct." } { $examples "A version of the quadratic formula specialized for floats, converting other real number types:" { $example -"""USING: kernel math math.libm prettyprint typed ; +"USING: kernel math math.libm prettyprint typed ; IN: scratchpad TYPED:: quadratic-roots ( a: float b: float c: float -- q1: float q2: float ) @@ -38,9 +38,9 @@ TYPED:: quadratic-roots ( a: float b: float c: float -- q1: float q2: float ) [ + ] [ - ] 2bi [ 2.0 a * / ] bi@ ; -1 0 -9/4 quadratic-roots [ . ] bi@""" -"""1.5 --1.5""" } } ; +1 0 -9/4 quadratic-roots [ . ] bi@" +"1.5 +-1.5" } } ; HELP: define-typed { $values { "word" word } { "def" quotation } { "effect" effect } } diff --git a/basis/typed/typed-tests.factor b/basis/typed/typed-tests.factor index 7fe9e59043..78ec21dc2b 100644 --- a/basis/typed/typed-tests.factor +++ b/basis/typed/typed-tests.factor @@ -65,7 +65,7 @@ TYPED: unboxy ( in: unboxable -- out: unboxable2 ) { 9 } [ -""" +" USING: kernel math ; IN: typed.tests @@ -73,13 +73,13 @@ TUPLE: unboxable { x fixnum read-only } { y fixnum read-only } { z float read-only } ; final -""" eval( -- ) +" eval( -- ) -""" +" USING: accessors kernel math ; IN: typed.tests T{ unboxable f 12 3 4.0 } unboxy xy>> -""" eval( -- xy ) +" eval( -- xy ) ] unit-test TYPED: no-inputs ( -- out: integer ) @@ -185,5 +185,5 @@ TYPED: typed-intersection ( x: intersection{ integer bignum } -- ? ) >boolean ; [ 0 typed-intersection ] [ input-mismatch-error? ] must-fail-with [ - """IN: test123 USE: typed TYPED: foo ( x -- y ) ;""" eval( -- ) + "IN: test123 USE: typed TYPED: foo ( x -- y ) ;" eval( -- ) ] [ error>> no-types-specified? ] must-fail-with diff --git a/basis/ui/pixel-formats/pixel-formats-docs.factor b/basis/ui/pixel-formats/pixel-formats-docs.factor index 684d87d0b5..74a5b682c5 100644 --- a/basis/ui/pixel-formats/pixel-formats-docs.factor +++ b/basis/ui/pixel-formats/pixel-formats-docs.factor @@ -45,7 +45,7 @@ ARTICLE: "ui.pixel-formats-attributes" "Pixel format attributes" } { $examples "The following " { $link world } " subclass will request a double-buffered window with minimum 24-bit color and depth buffers, and will throw an error if the requirements aren't met:" -{ $code """USING: kernel ui.gadgets.worlds ui.pixel-formats ; +{ $code "USING: kernel ui.gadgets.worlds ui.pixel-formats ; IN: ui.pixel-formats.examples TUPLE: picky-depth-buffered-world < world ; @@ -59,10 +59,10 @@ M: picky-depth-buffered-world world-pixel-format-attributes M: picky-depth-buffered-world check-world-pixel-format nip - [ double-buffered pixel-format-attribute 0 = [ "Not double buffered!" throw ] when ] - [ color-bits pixel-format-attribute 24 < [ "Not enough color bits!" throw ] when ] - [ depth-bits pixel-format-attribute 24 < [ "Not enough depth bits!" throw ] when ] - tri ;""" } } + [ double-buffered pixel-format-attribute 0 = [ \"Not double buffered!\" throw ] when ] + [ color-bits pixel-format-attribute 24 < [ \"Not enough color bits!\" throw ] when ] + [ depth-bits pixel-format-attribute 24 < [ \"Not enough depth bits!\" throw ] when ] + tri ;" } } ; HELP: double-buffered diff --git a/basis/ui/tools/listener/listener-docs.factor b/basis/ui/tools/listener/listener-docs.factor index db41fc96d0..4c650d7a15 100644 --- a/basis/ui/tools/listener/listener-docs.factor +++ b/basis/ui/tools/listener/listener-docs.factor @@ -41,20 +41,20 @@ $nl "Then you can run the following code, or add it to your " { $link ".factor-rc" } "." $nl { $code - """USING: accessors assocs kernel sequences sets ui.commands + "USING: accessors assocs kernel sequences sets ui.commands ui.gadgets.editors ui.gestures ui.tools.listener ; -"multiline" multiline-editor get-command-at [ +\"multiline\" multiline-editor get-command-at [ { - { T{ key-down f { C+ } "k" } delete-to-end-of-line } - { T{ key-down f { C+ } "a" } start-of-line } - { T{ key-down f { C+ } "e" } end-of-line } + { T{ key-down f { C+ } \"k\" } delete-to-end-of-line } + { T{ key-down f { C+ } \"a\" } start-of-line } + { T{ key-down f { C+ } \"e\" } end-of-line } } append members ] change-commands drop multiline-editor update-gestures -"interactor" interactor get-command-at [ - [ drop T{ key-down f { C+ } "k" } = ] assoc-reject -] change-commands drop interactor update-gestures""" +\"interactor\" interactor get-command-at [ + [ drop T{ key-down f { C+ } \"k\" } = ] assoc-reject +] change-commands drop interactor update-gestures" } $nl { $heading "Implementation" } diff --git a/basis/ui/ui-docs.factor b/basis/ui/ui-docs.factor index aedf399c3c..7a5a456277 100644 --- a/basis/ui/ui-docs.factor +++ b/basis/ui/ui-docs.factor @@ -343,11 +343,11 @@ HELP: MAIN-WINDOW: { $examples "From the " { $vocab-link "hello-ui" } " vocabulary. Creates a window with the title \"Hi\" containing a label reading \"Hello world\":" { $code -"""USING: accessors ui ui.gadgets.labels ; +"USING: accessors ui ui.gadgets.labels ; IN: hello-ui -MAIN-WINDOW: hello { { title "Hi" } } - "Hello world"