pub fn prepare_input<'s: 'i + 'e, 'i, 'e>(
env: &'i RefCell<&mut Env>,
source: &'s Source,
) -> Result<Lexer<'i>, PrepareInputError<'e>>Expand description
Prepares the input for the shell syntax parser.
This function constructs a lexer from the given source with the following decorators applied to the input object:
- If the source is read with a file descriptor, the
Echodecorator is applied to the input to implement theVerboseshell option. - If the
Interactiveoption is enabled and the source is read with a file descriptor, thePrompterdecorator is applied to the input to show the prompt. - If the
Interactiveoption is enabled, theReporterdecorator is applied to the input to show changes in job status before prompting for the next command. - If the
Interactiveoption is enabled and the source is read with a file descriptor, theIgnoreEofdecorator is applied to the input to implement theIgnoreEofshell option.
The RefCell passed as the first argument should be shared with (and only
with) the read_eval_loop function that
consumes the input and executes the parsed commands.