pub async fn prepare_input<'s, 'i, 'e, S>(
env: &'i RefCell<&mut Env<S>>,
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, theEofGuarddecorator is applied to the input to implement theIgnoreEofshell option and to protect against accidental exit when there are suspended jobs.
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.