multiline: HEREDOC: -> heredoc:

char-rename
Doug Coleman 2017-06-04 16:15:38 -05:00
parent 477900b075
commit 7a92c91b6d
3 changed files with 20 additions and 20 deletions

View File

@ -16,18 +16,18 @@ HELP: /*
}
} ;
HELP: HEREDOC:
{ $syntax "HEREDOC: marker\n...text...\nmarker" }
HELP: heredoc:
{ $syntax "heredoc: marker\n...text...\nmarker" }
{ $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." }
{ $examples
{ $example "USING: multiline prettyprint ;"
"HEREDOC: END\nx\nEND\n."
"heredoc: END\nx\nEND\n."
"\"x\\n\""
}
{ $example "USING: multiline prettyprint sequences ;"
"2 5 HEREDOC: zap\nfoo\nbar\nzap\nsubseq ."
"2 5 heredoc: zap\nfoo\nbar\nzap\nsubseq ."
"\"o\\nb\""
}
} ;
@ -41,7 +41,7 @@ ARTICLE: "multiline" "Multiline"
"Multiline strings:"
{ $subsections
postpone: STRING:
postpone: HEREDOC:
postpone: heredoc:
}
"Multiline comments:"
{ $subsections postpone: /* }

View File

@ -10,62 +10,62 @@ bar
{ "foo\nbar\n" } [ test-it ] unit-test
! HEREDOC:
! heredoc:
{ "foo\nbar\n" } [ HEREDOC: END
{ "foo\nbar\n" } [ heredoc: END
foo
bar
END
] unit-test
{ "" } [ HEREDOC: END
{ "" } [ heredoc: END
END
] unit-test
{ " END\n" } [ HEREDOC: END
{ " END\n" } [ heredoc: END
END
END
] unit-test
{ "\n" } [ HEREDOC: END
{ "\n" } [ heredoc: END
END
] unit-test
{ "x\n" } [ HEREDOC: END
{ "x\n" } [ heredoc: END
x
END
] unit-test
{ "x\n" } [ HEREDOC: END
{ "x\n" } [ heredoc: END
x
END
] unit-test
! there's a space after xyz
{ "xyz \n" } [ HEREDOC: END
{ "xyz \n" } [ heredoc: END
xyz
END
] unit-test
{ "} ! * # \" «\n" } [ HEREDOC: END
{ "} ! * # \" «\n" } [ heredoc: END
} ! * # " «
END
] 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
bar
X
HEREDOC: END
HEREDOC: FOO
heredoc: END
heredoc: FOO
FOO
END
22 ] unit-test
{ "lol\n xyz\n" }
[
HEREDOC: xyz
heredoc: xyz
lol
xyz
xyz

View File

@ -84,7 +84,7 @@ PRIVATE>
SYNTAX: /* "*/" parse-multiline-string drop ;
SYNTAX: HEREDOC:
SYNTAX: heredoc:
lexer get {
[ skip-blank ]
[ rest-of-line ]