factor: removing STRING: .. ; and HEREDOCS and /* */ etc.

locals-and-roots
Doug Coleman 2016-06-21 16:21:13 -07:00
parent 04a408c7cd
commit b1ed8d1e45
23 changed files with 94 additions and 113 deletions

View File

@ -2,12 +2,12 @@
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays bit-arrays fry kernel kernel.private USING: accessors arrays bit-arrays fry kernel kernel.private
layouts locals math math.functions math.order math.private layouts locals math math.functions math.order math.private
multiline sequences sequences.private typed ; sequences sequences.private typed ;
FROM: math.ranges => [1,b] ; FROM: math.ranges => [1,b] ;
IN: bloom-filters IN: bloom-filters
/* ![[
TODO: TODO:
@ -41,7 +41,7 @@ TODO:
objects the filter is sized for? The filter will continue to objects the filter is sized for? The filter will continue to
work, just not very well. work, just not very well.
*/ ]]
TUPLE: bloom-filter TUPLE: bloom-filter
{ #hashes fixnum read-only } { #hashes fixnum read-only }

View File

@ -1,10 +1,6 @@
USING: help.markup help.syntax strings ; USING: help.markup help.syntax strings ;
in: multiline in: multiline
HELP: \ STRING:
{ $syntax "STRING: name\nfoo\n;" }
{ $description "Forms a multiline string literal, or 'here document' stored in the word called name. A semicolon is used to signify the end, and that semicolon must be on a line by itself, not preceeded or followed by any whitespace. The string will have newlines in between lines but not at the end, unless there is a blank line before the semicolon." } ;
HELP: /* HELP: /*
{ $syntax "/* comment */" } { $syntax "/* comment */" }
{ $description "Provides C-like comments that can span multiple lines. One caveat is that " { $snippet "/*" } " and " { $snippet "*/" } " are still tokens and must not appear in the comment text itself." } { $description "Provides C-like comments that can span multiple lines. One caveat is that " { $snippet "/*" } " and " { $snippet "*/" } " are still tokens and must not appear in the comment text itself." }
@ -40,7 +36,6 @@ HELP: parse-multiline-string
ARTICLE: "multiline" "Multiline" ARTICLE: "multiline" "Multiline"
"Multiline strings:" "Multiline strings:"
{ $subsections { $subsections
postpone\ STRING:
postpone\ HEREDOC: postpone\ HEREDOC:
} }
"Multiline comments:" "Multiline comments:"

View File

@ -1,11 +1,9 @@
USING: eval multiline sequences tools.test ; USING: eval multiline sequences tools.test ;
in: multiline.tests in: multiline.tests
STRING: test-it CONSTANT: test-it [[ foo
foo
bar bar
]] ;
;
{ "foo\nbar\n" } [ test-it ] unit-test { "foo\nbar\n" } [ test-it ] unit-test

View File

@ -32,11 +32,6 @@ ERROR: text-found-before-eol string ;
(parse-here) (parse-here)
] "" make but-last ; ] "" make but-last ;
SYNTAX: \ STRING:
scan-new-word
parse-here 1quotation
( -- string ) define-inline ;
PRIVATE< PRIVATE<
:: (scan-multiline-string) ( i end lexer -- j ) :: (scan-multiline-string) ( i end lexer -- j )

View File

@ -3,7 +3,7 @@ multiline opengl opengl.shaders opengl.capabilities opengl.gl
sequences accessors combinators ; sequences accessors combinators ;
in: bunny.cel-shaded in: bunny.cel-shaded
STRING: vertex-shader-source CONSTANT: vertex-shader-source [[
varying vec3 position, normal, viewer; varying vec3 position, normal, viewer;
void void
@ -15,10 +15,9 @@ main()
normal = gl_Normal; normal = gl_Normal;
viewer = vec3(0, 0, 1) * gl_NormalMatrix; viewer = vec3(0, 0, 1) * gl_NormalMatrix;
} }
]] ;
; CONSTANT: cel-shaded-fragment-shader-lib-source [[
STRING: cel-shaded-fragment-shader-lib-source
varying vec3 position, normal, viewer; varying vec3 position, normal, viewer;
uniform vec3 light_direction; uniform vec3 light_direction;
uniform vec4 color; uniform vec4 color;
@ -46,10 +45,9 @@ cel_light()
float s = cel(pow(max(dot(-reflection, viewer), 0.0), shininess)); float s = cel(pow(max(dot(-reflection, viewer), 0.0), shininess));
return ad * color + vec4(vec3(s), 0); return ad * color + vec4(vec3(s), 0);
} }
]] ;
; CONSTANT: cel-shaded-fragment-shader-main-source [[
STRING: cel-shaded-fragment-shader-main-source
vec4 cel_light(); vec4 cel_light();
void void
@ -57,8 +55,7 @@ main()
{ {
gl_FragColor = cel_light(); gl_FragColor = cel_light();
} }
]] ;
;
TUPLE: bunny-cel-shaded program ; TUPLE: bunny-cel-shaded program ;

View File

@ -6,7 +6,7 @@ macros locals ;
FROM: opengl.demo-support => rect-vertices ; FROM: opengl.demo-support => rect-vertices ;
in: bunny.outlined in: bunny.outlined
STRING: outlined-pass1-fragment-shader-main-source CONSTANT: outlined-pass1-fragment-shader-main-source [[
varying vec3 normal; varying vec3 normal;
vec4 cel_light(); vec4 cel_light();
@ -16,10 +16,9 @@ main()
gl_FragData[0] = cel_light(); gl_FragData[0] = cel_light();
gl_FragData[1] = vec4(normal, 1); gl_FragData[1] = vec4(normal, 1);
} }
]] ;
; CONSTANT: outlined-pass2-vertex-shader-source [[
STRING: outlined-pass2-vertex-shader-source
varying vec2 coord; varying vec2 coord;
void void
@ -28,10 +27,9 @@ main()
gl_Position = ftransform(); gl_Position = ftransform();
coord = (gl_Vertex * vec4(0.5) + vec4(0.5)).xy; coord = (gl_Vertex * vec4(0.5) + vec4(0.5)).xy;
} }
]] ;
; CONSTANT: outlined-pass2-fragment-shader-source [[
STRING: outlined-pass2-fragment-shader-source
uniform sampler2D colormap, normalmap, depthmap; uniform sampler2D colormap, normalmap, depthmap;
uniform vec4 line_color; uniform vec4 line_color;
varying vec2 coord; varying vec2 coord;
@ -110,8 +108,7 @@ main()
{ {
gl_FragColor = mix(texture2D(colormap, coord), line_color, border_factor(coord)); gl_FragColor = mix(texture2D(colormap, coord), line_color, border_factor(coord));
} }
]] ;
;
TUPLE: bunny-outlined TUPLE: bunny-outlined
gadget gadget

View File

@ -5,7 +5,7 @@ generalizations combinators ui.gadgets.worlds
literals ui.pixel-formats ; literals ui.pixel-formats ;
in: spheres in: spheres
STRING: plane-vertex-shader CONSTANT: plane-vertex-shader [[
varying vec3 object_position; varying vec3 object_position;
void void
main() main()
@ -13,9 +13,9 @@ main()
object_position = gl_Vertex.xyz; object_position = gl_Vertex.xyz;
gl_Position = ftransform(); gl_Position = ftransform();
} }
; ]] ;
STRING: plane-fragment-shader CONSTANT: plane-fragment-shader [[
uniform float checker_size_inv; uniform float checker_size_inv;
uniform vec4 checker_color_1, checker_color_2; uniform vec4 checker_color_1, checker_color_2;
varying vec3 object_position; varying vec3 object_position;
@ -37,9 +37,9 @@ main()
? mix(checker_color_1, checker_color_2, distance_factor) ? mix(checker_color_1, checker_color_2, distance_factor)
: mix(checker_color_2, checker_color_1, distance_factor); : mix(checker_color_2, checker_color_1, distance_factor);
} }
; ]] ;
STRING: sphere-vertex-shader CONSTANT: sphere-vertex-shader [[
attribute vec3 center; attribute vec3 center;
attribute float radius; attribute float radius;
attribute vec4 surface_color; attribute vec4 surface_color;
@ -58,9 +58,9 @@ main()
vcolor = surface_color; vcolor = surface_color;
vradius = radius; vradius = radius;
} }
; ]] ;
STRING: sphere-solid-color-fragment-shader CONSTANT: sphere-solid-color-fragment-shader [[
uniform vec3 light_position; uniform vec3 light_position;
varying vec4 vcolor; varying vec4 vcolor;
@ -76,9 +76,9 @@ sphere_color(vec3 point, vec3 normal)
return ambient * vcolor + diffuse * vec4(d * vcolor.rgb, vcolor.a); return ambient * vcolor + diffuse * vec4(d * vcolor.rgb, vcolor.a);
} }
; ]] ;
STRING: sphere-texture-fragment-shader CONSTANT: sphere-texture-fragment-shader [[
uniform samplerCube surface_texture; uniform samplerCube surface_texture;
vec4 vec4
@ -87,9 +87,9 @@ sphere_color(vec3 point, vec3 normal)
vec3 reflect = reflect(normalize(point), normal); vec3 reflect = reflect(normalize(point), normal);
return textureCube(surface_texture, reflect * gl_NormalMatrix); return textureCube(surface_texture, reflect * gl_NormalMatrix);
} }
; ]] ;
STRING: sphere-main-fragment-shader CONSTANT: sphere-main-fragment-shader [[
varying float vradius; varying float vradius;
varying vec3 sphere_position; varying vec3 sphere_position;
varying vec4 world_position; varying vec4 world_position;
@ -109,7 +109,7 @@ main()
gl_FragDepth = (transformed_surface.z/transformed_surface.w + 1.0) * 0.5; gl_FragDepth = (transformed_surface.z/transformed_surface.w + 1.0) * 0.5;
gl_FragColor = sphere_color(world_surface.xyz, surface); gl_FragColor = sphere_color(world_surface.xyz, surface);
} }
; ]] ;
TUPLE: spheres-world < demo-world TUPLE: spheres-world < demo-world
plane-program solid-sphere-program texture-sphere-program plane-program solid-sphere-program texture-sphere-program

View File

@ -4,7 +4,7 @@ USING: accessors alien io io.streams.string kernel literals macho
multiline sequences strings system tools.test ; multiline sequences strings system tools.test ;
in: macho.tests in: macho.tests
STRING: validation-output CONSTANT: validation-output [[
0000000100000f1c __stub_helper stub helpers 0000000100000f1c __stub_helper stub helpers
0000000100001040 __program_vars _pvars 0000000100001040 __program_vars _pvars
0000000100001068 __data _NXArgc 0000000100001068 __data _NXArgc
@ -18,8 +18,7 @@ STRING: validation-output
0000000000000000 _exit 0000000000000000 _exit
0000000000000000 _printf 0000000000000000 _printf
0000000000000000 dyld_stub_binder 0000000000000000 dyld_stub_binder
]] ;
;
cpu ppc? [ cpu ppc? [
{ $ validation-output } { $ validation-output }

View File

@ -7,7 +7,7 @@ FROM: alien.c-types => float ;
SPECIALIZED-ARRAYS: float void* ; SPECIALIZED-ARRAYS: float void* ;
in: opencl.ffi.tests in: opencl.ffi.tests
STRING: kernel-source CONSTANT: kernel-source [[
__kernel void square( __kernel void square(
__global float* input, __global float* input,
__global float* output, __global float* output,
@ -17,7 +17,7 @@ __kernel void square(
if (i < count) if (i < count)
output[i] = input[i] * input[i]; output[i] = input[i] * input[i];
} }
; ]] ;
ERROR: cl-error err ; ERROR: cl-error err ;
: cl-success ( err -- ) : cl-success ( err -- )

View File

@ -7,7 +7,7 @@ FROM: alien.c-types => float ;
specialized-array: float specialized-array: float
in: opencl.tests in: opencl.tests
STRING: kernel-source CONSTANT: kernel-source [[
__kernel void square( __kernel void square(
__global float* input, __global float* input,
__global float* output, __global float* output,
@ -17,7 +17,7 @@ __kernel void square(
if (i < count) if (i < count)
output[i] = input[i] * input[i]; output[i] = input[i] * input[i];
} }
; ]] ;
:: opencl-square ( in -- out ) :: opencl-square ( in -- out )
[ [

View File

@ -7,11 +7,11 @@ in: furnace.actions.tests
[ "a" param "b" param [ string>number ] bi@ + ] >>display [ "a" param "b" param [ string>number ] bi@ + ] >>display
"action-1" set "action-1" set
STRING: action-request-test-1 CONSTANT: action-request-test-1 [[
GET http://foo/bar?a=12&b=13 HTTP/1.1 GET http://foo/bar?a=12&b=13 HTTP/1.1
blah blah
; ]] ;
{ 25 } [ { 25 } [
action-request-test-1 lf>crlf action-request-test-1 lf>crlf
@ -25,11 +25,11 @@ blah
[ "a" param string>number sq ] >>display [ "a" param string>number sq ] >>display
"action-2" set "action-2" set
STRING: action-request-test-2 CONSTANT: action-request-test-2 [[
GET http://foo/bar/123 HTTP/1.1 GET http://foo/bar/123 HTTP/1.1
blah blah
; ]] ;
{ 25 } [ { 25 } [
action-request-test-2 lf>crlf action-request-test-2 lf>crlf

View File

@ -3,11 +3,11 @@ multiline parser tools.test webapps.counter ;
in: furnace.utilities.tests in: furnace.utilities.tests
COMPILE< COMPILE<
STRING: dummy-vocab CONSTANT: dummy-vocab [[
in: dummy-vocab IN: dummy-vocab
: dummy-word ( -- ) ; : dummy-word ( -- ) ;
; ]] ;
dummy-vocab "dummy.factor" temp-file [ utf8 set-file-contents ] keep run-file dummy-vocab "dummy.factor" temp-file [ utf8 set-file-contents ] keep run-file
COMPILE> COMPILE>

View File

@ -1,7 +1,7 @@
USING: multiline ; USING: multiline ;
in: terrain.shaders in: terrain.shaders
STRING: sky-vertex-shader CONSTANT: sky-vertex-shader [[
uniform float sky_theta; uniform float sky_theta;
varying vec3 direction; varying vec3 direction;
@ -19,9 +19,9 @@ void main()
* (gl_ModelViewMatrixInverse * vec4(p.xyz, 0.0)).xyz; * (gl_ModelViewMatrixInverse * vec4(p.xyz, 0.0)).xyz;
} }
; ]] ;
STRING: sky-pixel-shader CONSTANT: sky-pixel-shader [[
uniform sampler2D sky; uniform sampler2D sky;
uniform float sky_gradient, sky_theta; uniform float sky_gradient, sky_theta;
@ -37,9 +37,9 @@ void main()
gl_FragColor = mix(SKY_COLOR_A, SKY_COLOR_B, sin(6.28*t)); gl_FragColor = mix(SKY_COLOR_A, SKY_COLOR_B, sin(6.28*t));
} }
; ]] ;
STRING: terrain-vertex-shader CONSTANT: terrain-vertex-shader [[
uniform sampler2D heightmap; uniform sampler2D heightmap;
uniform vec4 component_scale; uniform vec4 component_scale;
@ -59,9 +59,9 @@ void main()
heightcoords = gl_Vertex.xz; heightcoords = gl_Vertex.xz;
} }
; ]] ;
STRING: terrain-pixel-shader CONSTANT: terrain-pixel-shader [[
uniform sampler2D heightmap; uniform sampler2D heightmap;
uniform vec4 component_scale; uniform vec4 component_scale;
@ -79,4 +79,4 @@ void main()
gl_FragColor = texture2D(heightmap, heightcoords); gl_FragColor = texture2D(heightmap, heightcoords);
} }
; ]] ;

View File

@ -4,7 +4,7 @@ literals make multiline sequences stack-checker.alien strings ;
in: compiler.cfg.builder.alien in: compiler.cfg.builder.alien
COMPILE< COMPILE<
STRING: ex-caller-return CONSTANT: ex-caller-return [[
USING: compiler.cfg.builder.alien make prettyprint ; USING: compiler.cfg.builder.alien make prettyprint ;
[ [
T{ ##alien-invoke { reg-outputs { { 1 int-rep RAX } } } } , T{ ##alien-invoke { reg-outputs { { 1 int-rep RAX } } } } ,
@ -14,7 +14,7 @@ USING: compiler.cfg.builder.alien make prettyprint ;
T{ ##alien-invoke { reg-outputs { { 1 int-rep RAX } } } } T{ ##alien-invoke { reg-outputs { { 1 int-rep RAX } } } }
T{ ##box-alien { dst 116 } { src 1 } { temp 115 } } T{ ##box-alien { dst 116 } { src 1 } { temp 115 } }
} }
; ]] ;
COMPILE> COMPILE>
HELP: caller-linkage HELP: caller-linkage

View File

@ -3,7 +3,7 @@ help.syntax literals make math multiline quotations sequences ;
in: compiler.cfg.builder.blocks in: compiler.cfg.builder.blocks
COMPILE< COMPILE<
STRING: ex-emit-trivial-block CONSTANT: ex-emit-trivial-block [[
USING: compiler.cfg.builder.blocks make prettyprint ; USING: compiler.cfg.builder.blocks make prettyprint ;
begin-stack-analysis <basic-block> dup set-basic-block [ gensym ##call, drop ] emit-trivial-block predecessors>> first . begin-stack-analysis <basic-block> dup set-basic-block [ gensym ##call, drop ] emit-trivial-block predecessors>> first .
T{ basic-block T{ basic-block
@ -24,7 +24,7 @@ T{ basic-block
} }
} }
} }
; ]] ;
COMPILE> COMPILE>
HELP: begin-basic-block HELP: begin-basic-block

View File

@ -2,12 +2,12 @@ USING: help.markup help.syntax literals multiline sequences splitting ;
in: compiler.cfg.instructions.syntax in: compiler.cfg.instructions.syntax
COMPILE< COMPILE<
STRING: parse-insn-slot-specs-code CONSTANT: parse-insn-slot-specs-code [[
USING: compiler.cfg.instructions.syntax prettyprint splitting ; USING: compiler.cfg.instructions.syntax prettyprint splitting ;
"use: src/int-rep temp: temp/int-rep" " " split parse-insn-slot-specs . "use: src/int-rep temp: temp/int-rep" " " split parse-insn-slot-specs .
; ]] ;
STRING: parse-insn-slot-specs-result CONSTANT: parse-insn-slot-specs-result [[
{ {
T{ insn-slot-spec T{ insn-slot-spec
{ type use } { type use }
@ -20,7 +20,7 @@ STRING: parse-insn-slot-specs-result
{ rep int-rep } { rep int-rep }
} }
} }
; ]] ;
COMPILE> COMPILE>
HELP: parse-insn-slot-specs HELP: parse-insn-slot-specs

View File

@ -2,7 +2,7 @@ USING: help.markup help.syntax literals multiline ;
in: compiler.tree.propagation in: compiler.tree.propagation
COMPILE< COMPILE<
STRING: propagate-ex CONSTANT: propagate-ex [[
USING: compiler.tree.builder compiler.tree.propagation math prettyprint ; USING: compiler.tree.builder compiler.tree.propagation math prettyprint ;
[ 3 + ] build-tree propagate third . [ 3 + ] build-tree propagate third .
T{ #call T{ #call
@ -42,7 +42,7 @@ T{ #call
} }
} }
} }
; ]] ;
COMPILE> COMPILE>
HELP: propagate HELP: propagate

View File

@ -4,7 +4,7 @@ USING: elf.nm io io.streams.string kernel literals multiline strings
system tools.test ; system tools.test ;
in: elf.nm.tests in: elf.nm.tests
STRING: validation-output CONSTANT: validation-output [[
0000000000000000 absolute init.c 0000000000000000 absolute init.c
000000000040046c .text call_gmon_start 000000000040046c .text call_gmon_start
0000000000000000 absolute crtstuff.c 0000000000000000 absolute crtstuff.c
@ -44,7 +44,7 @@ STRING: validation-output
0000000000400524 .text main 0000000000400524 .text main
00000000004003f0 .init _init 00000000004003f0 .init _init
; ]] ;
cpu ppc? [ cpu ppc? [
{ $ validation-output } { $ validation-output }

View File

@ -25,7 +25,7 @@ in: http.tests
{ "localhost:8080" } [ T{ url { protocol "http" } { host "localhost" } { port 8080 } } unparse-host ] unit-test { "localhost:8080" } [ T{ url { protocol "http" } { host "localhost" } { port 8080 } } unparse-host ] unit-test
{ "localhost:8443" } [ T{ url { protocol "https" } { host "localhost" } { port 8443 } } unparse-host ] unit-test { "localhost:8443" } [ T{ url { protocol "https" } { host "localhost" } { port 8443 } } unparse-host ] unit-test
STRING: read-request-test-1 CONSTANT: read-request-test-1 [[
POST /bar HTTP/1.1 POST /bar HTTP/1.1
Some-Header: 1 Some-Header: 1
Some-Header: 2 Some-Header: 2
@ -33,7 +33,7 @@ Content-Length: 4
Content-type: application/octet-stream Content-type: application/octet-stream
blah blah
; ]] ;
{ {
T{ request T{ request
@ -52,14 +52,14 @@ blah
] with-string-reader ] with-string-reader
] unit-test ] unit-test
STRING: read-request-test-1' CONSTANT: read-request-test-1' [[
POST /bar HTTP/1.1 POST /bar HTTP/1.1
content-length: 4 content-length: 4
content-type: application/octet-stream content-type: application/octet-stream
some-header: 1; 2 some-header: 1; 2
blah blah
; ]] ;
${ read-request-test-1' } [ ${ read-request-test-1' } [
read-request-test-1 lf>crlf read-request-test-1 lf>crlf
@ -69,11 +69,11 @@ ${ read-request-test-1' } [
string-lines "\n" join string-lines "\n" join
] unit-test ] unit-test
STRING: read-request-test-2 CONSTANT: read-request-test-2 [[
HEAD /bar HTTP/1.1 HEAD /bar HTTP/1.1
Host: www.sex.com Host: www.sex.com
; ]] ;
{ {
T{ request T{ request
@ -91,11 +91,11 @@ Host: www.sex.com
] with-string-reader ] with-string-reader
] unit-test ] unit-test
STRING: read-request-test-2' CONSTANT: read-request-test-2' [[
HEAD /bar HTTP/1.1 HEAD /bar HTTP/1.1
Host: www.sex.com:101 Host: www.sex.com:101
; ]] ;
{ {
T{ request T{ request
@ -113,15 +113,15 @@ Host: www.sex.com:101
] with-string-reader ] with-string-reader
] unit-test ] unit-test
STRING: read-request-test-3 CONSTANT: read-request-test-3 [[
GET nested HTTP/1.0 GET nested HTTP/1.0
; ]] ;
STRING: read-request-test-4 CONSTANT: read-request-test-4 [[
GET /blah HTTP/1.0 GET /blah HTTP/1.0
Host: "www.amazon.com" Host: "www.amazon.com"
; ]] ;
{ "www.amazon.com" } { "www.amazon.com" }
[ [
@ -129,12 +129,12 @@ Host: "www.amazon.com"
"host" header "host" header
] unit-test ] unit-test
STRING: read-response-test-1 CONSTANT: read-response-test-1 [[
HTTP/1.1 404 not found HTTP/1.1 404 not found
Content-Type: text/html; charset=UTF-8 Content-Type: text/html; charset=UTF-8
blah blah
; ]] ;
{ {
T{ response T{ response
@ -153,11 +153,11 @@ blah
] unit-test ] unit-test
STRING: read-response-test-1' COSTANT: read-response-test-1' [[
HTTP/1.1 404 not found HTTP/1.1 404 not found
content-type: text/html; charset=UTF-8 content-type: text/html; charset=UTF-8
; ]] ;
${ read-response-test-1' } [ ${ read-response-test-1' } [
URL" http://localhost/" url set URL" http://localhost/" url set
@ -178,12 +178,12 @@ ${ read-response-test-1' } [
dup parse-set-cookie first unparse-set-cookie = dup parse-set-cookie first unparse-set-cookie =
] unit-test ] unit-test
STRING: read-response-test-2 CONSTANT: read-response-test-2 [[
HTTP/1.1 200 Content follows HTTP/1.1 200 Content follows
Set-Cookie: oo="bar; a=b"; httponly=yes; sid=123456 Set-Cookie: oo="bar; a=b"; httponly=yes; sid=123456
; ]] ;
{ 2 } [ { 2 } [
read-response-test-2 lf>crlf read-response-test-2 lf>crlf
@ -191,12 +191,12 @@ Set-Cookie: oo="bar; a=b"; httponly=yes; sid=123456
cookies>> length cookies>> length
] unit-test ] unit-test
STRING: read-response-test-3 CONSTANT: read-response-test-3 [[
HTTP/1.1 200 Content follows HTTP/1.1 200 Content follows
Set-Cookie: oo="bar; a=b"; comment="your mom"; httponly=yes Set-Cookie: oo="bar; a=b"; comment="your mom"; httponly=yes
; ]] ;
{ 1 } [ { 1 } [
read-response-test-3 lf>crlf read-response-test-3 lf>crlf

View File

@ -34,7 +34,7 @@ in: http.server.requests.tests
] unit-test ] unit-test
! multipart/form-data ! multipart/form-data
STRING: test-multipart/form-data CONSTANT: test-multipart/form-data [[
POST / HTTP/1.1 POST / HTTP/1.1
Accept: */* Accept: */*
Accept-Encoding: gzip, deflate Accept-Encoding: gzip, deflate
@ -50,7 +50,7 @@ Content-Disposition: form-data; name="text"; filename="upload.txt"
hello hello
--768de80194d942619886d23f1337aa15-- --768de80194d942619886d23f1337aa15--
; ]] ;
{ {
"upload.txt" "upload.txt"
H{ H{
@ -65,7 +65,7 @@ hello
! Error handling ! Error handling
! If the incoming request is not valid, read-request should throw an ! If the incoming request is not valid, read-request should throw an
! appropriate error. ! appropriate error.
STRING: test-multipart/form-data-missing-boundary CONSTANT: test-multipart/form-data-missing-boundary [[
POST / HTTP/1.1 POST / HTTP/1.1
Accept: */* Accept: */*
Accept-Encoding: gzip, deflate Accept-Encoding: gzip, deflate
@ -81,7 +81,7 @@ Content-Disposition: form-data; name="text"; filename="upload.txt"
hello hello
--768de80194d942619886d23f1337aa15-- --768de80194d942619886d23f1337aa15--
; ]] ;
[ test-multipart/form-data-missing-boundary string>request ] [ test-multipart/form-data-missing-boundary string>request ]
[ no-boundary? ] must-fail-with [ no-boundary? ] must-fail-with

View File

@ -103,11 +103,11 @@ ${
" svg-path>array " svg-path>array
] unit-test ] unit-test
STRING: test-svg-string CONSTANT: test-svg-string [[
<svg xmlns="http://www.w3.org/2000/svg"> <svg xmlns="http://www.w3.org/2000/svg">
<path transform="translate(1 2)" d="M -1 -1 l 2 2" /> <path transform="translate(1 2)" d="M -1 -1 l 2 2" />
</svg> </svg>
; ]] ;
: test-svg-path ( -- obj ) : test-svg-path ( -- obj )
test-svg-string string>xml body>> children-tags first ; test-svg-string string>xml body>> children-tags first ;

View File

@ -177,7 +177,7 @@ TUPLE: text-analysis #paragraphs #sentences #chars #words
] ]
[ words-per-sentence 0.0496 * ] bi + ; [ words-per-sentence 0.0496 * ] bi + ;
STRING: text-report-format CONSTANT: text-report-format [[
Number of paragraphs %d Number of paragraphs %d
Number of sentences %d Number of sentences %d
Number of words %d Number of words %d
@ -194,7 +194,7 @@ SMOG grade %2.2f
Automated Readability index %2.2f Automated Readability index %2.2f
Dale-Chall readability %2.2f Dale-Chall readability %2.2f
; ]] ;
PRIVATE> PRIVATE>

View File

@ -20,16 +20,16 @@ M: object (r-ref) drop ;
! Example ! Example
STRING: sample-doc CONSTANT: sample-doc [[
<html xmlns:f='http://littledan.onigirihouse.com/namespaces/replace'> <html xmlns:f='http://littledan.onigirihouse.com/namespaces/replace'>
<body> <body>
<span f:sub='foo'/> <span f:sub='foo'/>
<div f:sub='bar'/> <div f:sub='bar'/>
<p f:sub='baz'>paragraph</p> <p f:sub='baz'>paragraph</p>
</body></html> </body></html>
; ]] ;
STRING: expected-result CONSTANT: expected-result [[
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<html xmlns:f="http://littledan.onigirihouse.com/namespaces/replace"> <html xmlns:f="http://littledan.onigirihouse.com/namespaces/replace">
<body> <body>
@ -43,7 +43,7 @@ STRING: expected-result
<p f:sub="baz"/> <p f:sub="baz"/>
</body> </body>
</html> </html>
; ]] ;
: test-refs ( -- string ) : test-refs ( -- string )
[ [