pub struct ContextBuilder { /* private fields */ }
Expand description
Configures an Engine about a specific script to compile, this includes giving input variables
Implementations§
Source§impl ContextBuilder
impl ContextBuilder
Sourcepub fn push_variable<Variable: Into<InputVariable>>(
&mut self,
variable: Variable,
) -> (usize, usize)
pub fn push_variable<Variable: Into<InputVariable>>( &mut self, variable: Variable, ) -> (usize, usize)
Pushes an input variable, if said it’s constant, the AST will have its value inlined
Sourcepub fn with_variable<Variable: Into<InputVariable>>(
self,
variable: Variable,
) -> ContextBuilder
pub fn with_variable<Variable: Into<InputVariable>>( self, variable: Variable, ) -> ContextBuilder
Adds an input variable, if said it’s constant, the AST will have its value inlined
Sourcepub fn start_parsing_position_offset(
&mut self,
line_offset: usize,
column_offset: usize,
)
pub fn start_parsing_position_offset( &mut self, line_offset: usize, column_offset: usize, )
Specifies an starting position for this script, this is useful if you use a file with multiple scripts for managing error.
Example: If you had a file containing multiples scripts, and one was located on the line 100 and had a syntax / AST Parsing on it’s 3rd line, then the error will tell the error happens on line 103, instead of line 3.
Sourcepub fn with_start_parsing_position_offset(
self,
line_offset: usize,
column_offset: usize,
) -> ContextBuilder
pub fn with_start_parsing_position_offset( self, line_offset: usize, column_offset: usize, ) -> ContextBuilder
Specifies an starting position for this script, this is useful if you use a file with multiple scripts for managing error.
Example: If you had a file containing multiples scripts, and one was located on the line 100 and had a syntax / AST Parsing on it’s 3rd line, then the error will tell the error happens on line 103, instead of line 3.
Sourcepub fn parsing_column_fixed(&mut self, parsing_position_column_is_fixed: bool)
pub fn parsing_column_fixed(&mut self, parsing_position_column_is_fixed: bool)
Specifies it the column indicated in Self::with_start_parsing_position_offset is a fixed one or not.
Example: If you had a file containing a script, but it is idented by 4 spaces on every line, setting this to true and setting the column offset as 4 would make that errors happening on colum 4 would appear as they happened on column 0 instead, so if the error its on column 100, it would say the error starts at 96 instead.
Sourcepub fn with_parsing_column_fixed(
self,
parsing_position_column_is_fixed: bool,
) -> ContextBuilder
pub fn with_parsing_column_fixed( self, parsing_position_column_is_fixed: bool, ) -> ContextBuilder
Specifies it the column indicated in Self::with_start_parsing_position_offset is a fixed one or not.
Example: If you had a file containing a script, but it is idented by 4 spaces on every line, setting this to true and setting the column offset as 4 would make that errors happening on colum 4 would appear as they happened on column 0 instead, so if the error its on column 100, it would say the error starts at 96 instead.
Trait Implementations§
Source§impl AsRef<ContextBuilder> for ContextBuilder
impl AsRef<ContextBuilder> for ContextBuilder
Source§fn as_ref(&self) -> &ContextBuilder
fn as_ref(&self) -> &ContextBuilder
Source§impl Clone for ContextBuilder
impl Clone for ContextBuilder
Source§fn clone(&self) -> ContextBuilder
fn clone(&self) -> ContextBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more