multiline: HEREDOC: -> heredoc:
parent
477900b075
commit
7a92c91b6d
|
@ -16,18 +16,18 @@ HELP: /*
|
||||||
}
|
}
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
HELP: HEREDOC:
|
HELP: heredoc:
|
||||||
{ $syntax "HEREDOC: marker\n...text...\nmarker" }
|
{ $syntax "heredoc: marker\n...text...\nmarker" }
|
||||||
{ $values { "marker" "a word (token)" } { "text" "arbitrary text" } { "value" string } }
|
{ $values { "marker" "a word (token)" } { "text" "arbitrary text" } { "value" string } }
|
||||||
{ $description "Returns a string delimited by an arbitrary user-defined token. This delimiter must be exactly the text beginning at the first non-blank character after " { $link postpone: HEREDOC: } " until the end of the line containing " { $link postpone: HEREDOC: } ". Text is captured until a line is found containing exactly this delimiter string." }
|
{ $description "Returns a string delimited by an arbitrary user-defined token. This delimiter must be exactly the text beginning at the first non-blank character after " { $link postpone: heredoc: } " until the end of the line containing " { $link postpone: heredoc: } ". Text is captured until a line is found containing exactly this delimiter string." }
|
||||||
{ $warning "Whitespace is significant." }
|
{ $warning "Whitespace is significant." }
|
||||||
{ $examples
|
{ $examples
|
||||||
{ $example "USING: multiline prettyprint ;"
|
{ $example "USING: multiline prettyprint ;"
|
||||||
"HEREDOC: END\nx\nEND\n."
|
"heredoc: END\nx\nEND\n."
|
||||||
"\"x\\n\""
|
"\"x\\n\""
|
||||||
}
|
}
|
||||||
{ $example "USING: multiline prettyprint sequences ;"
|
{ $example "USING: multiline prettyprint sequences ;"
|
||||||
"2 5 HEREDOC: zap\nfoo\nbar\nzap\nsubseq ."
|
"2 5 heredoc: zap\nfoo\nbar\nzap\nsubseq ."
|
||||||
"\"o\\nb\""
|
"\"o\\nb\""
|
||||||
}
|
}
|
||||||
} ;
|
} ;
|
||||||
|
@ -41,7 +41,7 @@ ARTICLE: "multiline" "Multiline"
|
||||||
"Multiline strings:"
|
"Multiline strings:"
|
||||||
{ $subsections
|
{ $subsections
|
||||||
postpone: STRING:
|
postpone: STRING:
|
||||||
postpone: HEREDOC:
|
postpone: heredoc:
|
||||||
}
|
}
|
||||||
"Multiline comments:"
|
"Multiline comments:"
|
||||||
{ $subsections postpone: /* }
|
{ $subsections postpone: /* }
|
||||||
|
|
|
@ -10,62 +10,62 @@ bar
|
||||||
{ "foo\nbar\n" } [ test-it ] unit-test
|
{ "foo\nbar\n" } [ test-it ] unit-test
|
||||||
|
|
||||||
|
|
||||||
! HEREDOC:
|
! heredoc:
|
||||||
|
|
||||||
{ "foo\nbar\n" } [ HEREDOC: END
|
{ "foo\nbar\n" } [ heredoc: END
|
||||||
foo
|
foo
|
||||||
bar
|
bar
|
||||||
END
|
END
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
{ "" } [ HEREDOC: END
|
{ "" } [ heredoc: END
|
||||||
END
|
END
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
{ " END\n" } [ HEREDOC: END
|
{ " END\n" } [ heredoc: END
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
{ "\n" } [ HEREDOC: END
|
{ "\n" } [ heredoc: END
|
||||||
|
|
||||||
END
|
END
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
{ "x\n" } [ HEREDOC: END
|
{ "x\n" } [ heredoc: END
|
||||||
x
|
x
|
||||||
END
|
END
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
{ "x\n" } [ HEREDOC: END
|
{ "x\n" } [ heredoc: END
|
||||||
x
|
x
|
||||||
END
|
END
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
! there's a space after xyz
|
! there's a space after xyz
|
||||||
{ "xyz \n" } [ HEREDOC: END
|
{ "xyz \n" } [ heredoc: END
|
||||||
xyz
|
xyz
|
||||||
END
|
END
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
{ "} ! * # \" «\n" } [ HEREDOC: END
|
{ "} ! * # \" «\n" } [ heredoc: END
|
||||||
} ! * # " «
|
} ! * # " «
|
||||||
END
|
END
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
{ 21 "foo\nbar\n" " HEREDOC: FOO\n FOO\n" 22 } [ 21 HEREDOC: X
|
{ 21 "foo\nbar\n" " heredoc: FOO\n FOO\n" 22 } [ 21 heredoc: X
|
||||||
foo
|
foo
|
||||||
bar
|
bar
|
||||||
X
|
X
|
||||||
HEREDOC: END
|
heredoc: END
|
||||||
HEREDOC: FOO
|
heredoc: FOO
|
||||||
FOO
|
FOO
|
||||||
END
|
END
|
||||||
22 ] unit-test
|
22 ] unit-test
|
||||||
|
|
||||||
{ "lol\n xyz\n" }
|
{ "lol\n xyz\n" }
|
||||||
[
|
[
|
||||||
HEREDOC: xyz
|
heredoc: xyz
|
||||||
lol
|
lol
|
||||||
xyz
|
xyz
|
||||||
xyz
|
xyz
|
||||||
|
|
|
@ -84,7 +84,7 @@ PRIVATE>
|
||||||
|
|
||||||
SYNTAX: /* "*/" parse-multiline-string drop ;
|
SYNTAX: /* "*/" parse-multiline-string drop ;
|
||||||
|
|
||||||
SYNTAX: HEREDOC:
|
SYNTAX: heredoc:
|
||||||
lexer get {
|
lexer get {
|
||||||
[ skip-blank ]
|
[ skip-blank ]
|
||||||
[ rest-of-line ]
|
[ rest-of-line ]
|
||||||
|
|
Loading…
Reference in New Issue