Module v.eval stdlib

v.eval
Version:
0.3.3
License:
MIT
Dependencies from vmod:
0
Imports:
7
Imported by:
3
Repository:
OS-specific
Show selected OS-specific symbols.
Backend-specific
Show selected Backend-specific symbols.

Dependencies defined in v.mod

This section is empty.

Imports

Aliases

This section is empty.

Constants

This section is empty.

Sum types

This section is empty.

Functions

#fn create

fn create() Eval

Structs

#struct Eval

pub struct Eval {
	pref &pref.Preferences = unsafe { nil }
pub mut:
	table                  &ast.Table = unsafe { nil }
	mods                   map[string]map[string]Symbol
	future_register_consts map[string]map[string]map[string]ast.ConstField // mod:file:name:field
	local_vars             map[string]Var
	local_vars_stack       []map[string]Var
	stack_vals             []Object // host stack popped by host_pop() on interpreted code
	user_files             []string // user additional files
	scope_idx              int      // this is increased when e.open_scope() is called, decreased when e.close_scope() (and all variables with that scope level deleted)
	returning              bool
	return_values          []Object
	cur_mod                string
	cur_file               string
	//
	trace_file_paths     []string
	trace_function_names []string
	back_trace           []EvalTrace
}

#fn new_eval

fn new_eval(table &v.ast.Table, pref_ &v.pref.Preferences) Eval

#fn (&Eval) push_val

fn (mut e &Eval) push_val(val Object)

#fn (&Eval) add_file

fn (mut e &Eval) add_file(filepath string)

#fn (&Eval) run

fn (mut e &Eval) run(expression string, args []Object) ![]Object

#fn (&Eval) eval

fn (mut e &Eval) eval(mut files &[]&v.ast.File)

#fn (&Eval) run_func

fn (mut e &Eval) run_func(func v.ast.FnDecl, _args []Object)

first arg is reciever (if method)

#fn (&Eval) register_symbols

fn (mut e &Eval) register_symbols(mut files &[]&v.ast.File)

#fn (&Eval) register_symbol_stmts

fn (mut e &Eval) register_symbol_stmts(stmts []v.ast.Stmt, mod string, file string)

#fn (&Eval) register_symbol

fn (mut e &Eval) register_symbol(stmt v.ast.Stmt, mod string, file string)

#fn (&Eval) error

fn (e &Eval) error(msg string)

#fn (&Eval) panic

fn (e &Eval) panic(s string)

#fn (&Eval) print_backtrace

fn (e &Eval) print_backtrace()

#fn (&Eval) expr

fn (mut e &Eval) expr(expr v.ast.Expr, expecting v.ast.Type) Object

#fn (&Eval) type_to_size

fn (e &Eval) type_to_size(typ v.ast.Type) u64

#fn (&Eval) get_escape

fn (e &Eval) get_escape(r rune) rune

#fn (&Eval) infix_expr

fn (e &Eval) infix_expr(left Object, right Object, op v.token.Kind, expecting v.ast.Type) Object

#fn (&Eval) stmts

fn (mut e &Eval) stmts(stmts []v.ast.Stmt)

#fn (&Eval) stmt

fn (mut e &Eval) stmt(stmt v.ast.Stmt)

#fn (&Eval) open_scope

fn (mut e &Eval) open_scope()

#fn (&Eval) close_scope

fn (mut e &Eval) close_scope()

#fn (&Eval) set

fn (mut e &Eval) set(expr v.ast.Expr, val Object, init bool, typ v.ast.Type)

#fn (&Eval) add

fn (mut e &Eval) add(expr v.ast.Expr, val Object)

val and expr must be both numeric types, or both string

#struct EvalTrace

pub struct EvalTrace {
	fn_idx   int
	file_idx int
	line     int
}

#struct Int

pub struct Int {
pub mut:
	val  i64
	size i8 // 8/16/32/64
}

#struct Uint

pub struct Uint {
pub mut:
	val  u64
	size i8 // 8/16/32/64
}

#struct Float

pub struct Float {
pub mut:
	val  f64
	size i8 // 8/16/32/64
}

#struct Array

pub struct Array {
pub mut:
	val []Object
}

#struct Ptr

pub struct Ptr {
	val &Object = unsafe { nil }
}

#fn (Ptr) str

fn (p Ptr) str() string

override the autogenerated str, since it does not work

#struct Var

pub struct Var {
pub mut:
	val Object
pub:
	scope_idx int
	typ       ast.Type
}

Interfaces

This section is empty.

Enums

This section is empty.