front-end/complete-program in drscheme:language:language<%>

front-end/complete-program method reads, parses, and optionally compiles a program in the language. The first argument to the method specifies the location of the unparsed input program. The selector drscheme:language:text/pos-text extracts the text% text and the drscheme:language:text/pos-start and drscheme:language:text/pos-end selectors extract the range in the text that should be considered program text. The second argument is the current settings for the language. The front-end/complete-program method is expected to return a thunk that is called repeatedly to get all of the expressions in the program. When all expressions have been read, the thunk is expected to return eof.

This method is only called for programs in the definitions window. Notably, it is not called for programs that are loaded or evaled. See and for those.

This method is expected to raise an appropriate exception if the program is malformed, eg an exn:syntax or exn:read.

This is called on the user's thread, as is the thunk it returns.

Implementations of this method should not return fully expanded expressions, since there are two forms of expansion, using either |expand| or expand-top-level-with-compile-time-evals and the use of the expanded code dictates which applies.

See also front-end/interaction.