factor/basis/multiline/multiline-docs.factor

67 lines
3.0 KiB
Factor
Raw Normal View History

USING: help.markup help.syntax strings ;
IN: multiline
2007-12-11 01:39:32 -05:00
HELP: STRING:
{ $syntax "STRING: name\nfoo\n;" }
2007-12-11 01:54:16 -05:00
{ $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." } ;
2007-12-11 01:39:32 -05:00
2008-09-04 22:38:23 -04:00
HELP: /*
{ $syntax "/* comment */" }
2012-09-22 19:45:26 -04:00
{ $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." }
{ $examples
{ $example "USING: multiline ;"
2008-09-04 22:38:23 -04:00
"/* I think that I shall never see"
" A poem lovely as a tree. */"
2012-09-22 19:45:26 -04:00
""
}
2008-09-04 22:38:23 -04:00
} ;
2007-12-11 17:23:56 -05:00
HELP: HEREDOC:
{ $syntax "HEREDOC: marker\n...text...\nmarker" }
{ $values { "marker" "a word (token)" } { "text" "arbitrary text" } { "value" string } }
2010-12-22 14:42:56 -05:00
{ $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
2009-08-17 21:47:27 -04:00
{ $example "USING: multiline prettyprint ;"
"HEREDOC: END\nx\nEND\n."
2009-08-17 21:47:27 -04:00
"\"x\\n\""
}
{ $example "USING: multiline prettyprint sequences ;"
"2 5 HEREDOC: zap\nfoo\nbar\nzap\nsubseq ."
2009-08-17 21:47:27 -04:00
"\"o\\nb\""
}
} ;
HELP: DELIMITED:
{ $syntax "DELIMITED: marker\n...text...\nmarker" }
{ $values { "marker" "a word (token)" } { "text" "arbitrary text" } { "value" string } }
2009-08-19 05:41:33 -04:00
{ $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: DELIMITED: } " until the end of the line containing " { $link POSTPONE: DELIMITED: } ". Text is captured until the exact delimiter string is found, regardless of where." }
{ $warning "Whitespace is significant on the " { $link POSTPONE: DELIMITED: } " line." }
{ $examples
{ $example "USING: multiline prettyprint ;"
"DELIMITED: factor blows my mind"
"whoafactor blows my mind ."
"\"whoa\""
}
} ;
2007-12-12 00:33:36 -05:00
HELP: parse-multiline-string
2007-12-11 17:23:56 -05:00
{ $values { "end-text" "a string delineating the end" } { "str" "the parsed string" } }
2008-09-04 22:38:23 -04:00
{ $description "Parses the input stream until the " { $snippet "end-text" } " is reached and returns the parsed text as a string." }
2009-09-22 00:01:28 -04:00
{ $notes "Used to implement " { $link POSTPONE: /* } "." } ;
2008-09-04 22:38:23 -04:00
ARTICLE: "multiline" "Multiline"
"Multiline strings:"
{ $subsections
POSTPONE: STRING:
POSTPONE: HEREDOC:
POSTPONE: DELIMITED:
}
2008-09-04 22:38:23 -04:00
"Multiline comments:"
{ $subsections POSTPONE: /* }
2008-09-04 22:38:23 -04:00
"Writing new multiline parsing words:"
{ $subsections parse-multiline-string }
2008-09-04 22:38:23 -04:00
;
2007-12-11 17:23:56 -05:00
2008-09-04 22:38:23 -04:00
ABOUT: "multiline"