]> gitweb.factorcode.org Git - factor.git/blob - library/syntax/parse-stream.facts
Fix bootstrap problem
[factor.git] / library / syntax / parse-stream.facts
1 USING: help io parser definitions ;
2
3 HELP: file-vocabs
4 { $description "Installs the initial the vocabulary search path for parsing a file." } ;
5
6 HELP: parse-lines
7 { $values { "lines" "a sequence of strings" } { "quot" "a new quotation" } }
8 { $description "Parses the Factor source code which has been tokenized into lines. The vocabulary search path is taken from the current scope." }
9 { $errors "Throws a parse error if the input is malformed." } ;
10
11 HELP: with-parser
12 { $values { "quot" "a quotation" } }
13 { $description "Calls a quotation, wrapping any errors thrown inside parse errors." } ;
14
15 HELP: parse
16 { $values { "str" "a string" } { "quot" "a new quotation" } }
17 { $description "Parses Factor source code from a string. The current vocabulary search path is used." }
18 { $errors "Throws a parse error if the input is malformed." } ;
19
20 HELP: eval
21 { $values { "str" "a string" } }
22 { $description "Parses Factor source code from a string, and calls the resulting quotation. The current vocabulary search path is used." }
23 { $errors "Throws an error if the input is malformed, or if the quotation throws an error." } ;
24
25 HELP: parse-hook
26 { $var-description "A quotation called by " { $link parse-stream } " after parsing the input stream. The default value recompiles new word definitions; see " { $link "recompile" } " for details." }
27 { $see-also no-parse-hook } ;
28
29 HELP: no-parse-hook
30 { $values { "quot" "a quotation" } }
31 { $description "Runs the quotation in a new dynamic scope where " { $link parse-hook } " is set to " { $link f } ". This disables the default behavior of recompiling changed definitions after a source file is loaded." } ;
32
33 HELP: run-files
34 { $values { "seq" "a sequence of strings" } }
35 { $description "Load a collection of source files."
36 $terpri
37 "If bootstrapping, this word appends the top-level forms to the currently constructing quotation instead." } ;
38
39 HELP: parse-stream
40 { $values { "stream" "an input stream" } { "name" "a file name for error reporting" } { "quot" "a new quotation" } }
41 { $description "Parses Factor source code read from the stream. The initial vocabulary search path is used." }
42 { $errors "Throws an I/O error if there was an error reading from the stream. Throws a parse error if the input is malformed." } ;
43
44 HELP: parse-file
45 { $values { "file" "a path name string" } { "quot" "a new quotation" } }
46 { $description "Parses the Factor source code stored in a file. The initial vocabulary search path is used." }
47 { $errors "Throws an I/O error if there was an error reading from the file. Throws a parse error if the input is malformed." } ;
48
49 HELP: run-file
50 { $values { "file" "a path name string" } }
51 { $description "Parses the Factor source code stored in a file and runs it. The initial vocabulary search path is used." }
52 { $errors "Throws an error if loading the file fails, there input is malformed, or if a runtime error occurs while calling the parsed quotation." }  ;
53
54 HELP: ?run-file
55 { $values { "file" "a path name string" } }
56 { $description "Forgiving variant of " { $link run-file } " which does nothing if the file does not exist, and logs errors to the default stream without re-throwing them." }  ;