pub struct Interpreter<'a> { /* private fields */ }Expand description
The AWK interpreter runtime
Implementations§
Source§impl<'a> Interpreter<'a>
impl<'a> Interpreter<'a>
Sourcepub fn call_function<W: Write>(
&mut self,
name: &str,
args: &[Expr],
location: SourceLocation,
output: &mut W,
) -> Result<Value>
pub fn call_function<W: Write>( &mut self, name: &str, args: &[Expr], location: SourceLocation, output: &mut W, ) -> Result<Value>
Call a function with special handling for builtins that need AST access
Source§impl<'a> Interpreter<'a>
impl<'a> Interpreter<'a>
Sourcepub fn eval_expr(&mut self, expr: &Expr) -> Result<Value>
pub fn eval_expr(&mut self, expr: &Expr) -> Result<Value>
Evaluate an expression (for contexts where we don’t have output, like condition checking)
Sourcepub fn eval_expr_with_output<W: Write>(
&mut self,
expr: &Expr,
output: &mut W,
) -> Result<Value>
pub fn eval_expr_with_output<W: Write>( &mut self, expr: &Expr, output: &mut W, ) -> Result<Value>
Evaluate an expression with a writer for function calls that produce output
pub fn assign_to_lvalue(&mut self, target: &Expr, value: Value) -> Result<()>
Source§impl<'a> Interpreter<'a>
impl<'a> Interpreter<'a>
pub fn execute_block<W: Write>( &mut self, block: &Block, output: &mut W, ) -> Result<StmtResult>
pub fn execute_stmt<W: Write>( &mut self, stmt: &Stmt, output: &mut W, ) -> Result<StmtResult>
Source§impl<'a> Interpreter<'a>
impl<'a> Interpreter<'a>
pub fn new(program: &'a Program) -> Self
Sourcepub fn set_posix_mode(&mut self, enabled: bool)
pub fn set_posix_mode(&mut self, enabled: bool)
Set POSIX strict mode
Sourcepub fn set_traditional_mode(&mut self, enabled: bool)
pub fn set_traditional_mode(&mut self, enabled: bool)
Set traditional AWK mode (no gawk extensions)
Sourcepub fn set_variable(&mut self, name: &str, value: &str)
pub fn set_variable(&mut self, name: &str, value: &str)
Set a variable before execution
Sourcepub fn set_filename(&mut self, filename: &str)
pub fn set_filename(&mut self, filename: &str)
Set the current filename (FILENAME)
Auto Trait Implementations§
impl<'a> Freeze for Interpreter<'a>
impl<'a> RefUnwindSafe for Interpreter<'a>
impl<'a> Send for Interpreter<'a>
impl<'a> Sync for Interpreter<'a>
impl<'a> Unpin for Interpreter<'a>
impl<'a> UnwindSafe for Interpreter<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more