pub struct ParserBuilder { /* private fields */ }
Expand description

Builder for Parser.

Implementations

If true, the emitted syntax tree will be processed by static optimizations. Defaults to false.

If true, the parser will skip script blocks that lack a hat block. This is typically desirable since free floating blocks are never automatically executed, and thus are typically not needed for translation efforts. Defaults to true.

If true, the emitted syntax tree will be automatically adjusted to support convenient translation into languages with zero-based indexing. For instance, with this enabled, an item X of _ block will emit X-1 as the index rather than X, and similar for other list-based blocks. Defaults to false.

All symbol names in the program will be passed through this function, allowing easy conversion of Snap! names to, e.g., valid C-like identifiers. The default operation performs no conversion. Note that non-default transform strategies may also require a custom ParserBuilder::autofill_generator.

A generator used to produce symbol names for auto-fill closure arguments. The function receives a number that can be used to differentiate different generated arguments. It is expected that multiple calls to this function with the same input will produce the same output symbol name. The default is to produce a string of format %n where n is the input number. Note that, after generation, symbol names are still passed through ParserBuilder::name_transformer as usual.

Builds a new Parser.

Errors

If a required field has not been initialized.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.