v.parser #

Constants #

const (
	builtin_functions = ['print', 'println', 'eprint', 'eprintln', 'isnil', 'panic', 'exit']

fn parse_comptime #

fn parse_comptime(text string, table &ast.Table, pref &pref.Preferences, scope &ast.Scope) &ast.File

fn parse_file #

fn parse_file(path string, table &ast.Table, comments_mode scanner.CommentsMode, pref &pref.Preferences) &ast.File

fn parse_files #

fn parse_files(paths []string, table &ast.Table, pref &pref.Preferences) []&ast.File

fn parse_stmt #

fn parse_stmt(text string, table &ast.Table, scope &ast.Scope) ast.Stmt

for tests

fn parse_text #

fn parse_text(text string, path string, table &ast.Table, comments_mode scanner.CommentsMode, pref &pref.Preferences) &ast.File

fn parse_vet_file #

fn parse_vet_file(path string, table_ &ast.Table, pref &pref.Preferences) (&ast.File, []vet.Error)

struct Parser #

struct Parser {
	pref &pref.Preferences
	file_base         string
	file_name         string
	file_name_dir     string
	unique_prefix     string
	file_backend_mode ast.Language
	scanner           &scanner.Scanner
	comments_mode     scanner.CommentsMode = .skip_comments

	tok                 token.Token
	prev_tok            token.Token
	peek_tok            token.Token
	table               &ast.Table
	language            ast.Language
	fn_language         ast.Language
	inside_test_file    bool
	inside_if           bool
	inside_if_expr      bool
	inside_ct_if_expr   bool
	inside_or_expr      bool
	inside_for          bool
	inside_fn           bool
	inside_unsafe_fn    bool
	inside_str_interp   bool
	inside_array_lit    bool
	inside_in_array     bool
	or_is_handled       bool
	builtin_mod         bool
	mod                 string
	is_manualfree       bool
	attrs               []ast.Attr
	expr_mod            string
	scope               &ast.Scope
	imports             map[string]string
	ast_imports         []ast.Import
	used_imports        []string
	auto_imports        []string
	imported_symbols    map[string]string
	is_amp              bool
	returns             bool
	inside_match        bool
	inside_select       bool
	inside_match_case   bool
	inside_match_body   bool
	inside_unsafe       bool
	is_stmt_ident       bool
	expecting_type      bool
	errors              []errors.Error
	warnings            []errors.Warning
	notices             []errors.Notice
	vet_errors          []vet.Error
	cur_fn_name         string
	label_names         []string
	in_generic_params   bool
	name_error          bool
	n_asm               int
	inside_asm_template bool
	inside_asm          bool
	global_labels       []string
	inside_defer        bool
	comp_if_cond        bool
	defer_vars          []ast.Ident
	should_abort        bool

fn (Parser) call_args #

fn (mut p Parser) call_args() []ast.CallArg

fn (Parser) call_expr #

fn (mut p Parser) call_expr(language ast.Language, mod string) ast.CallExpr

fn (Parser) check_comment #

fn (mut p Parser) check_comment() ast.Comment

TODO [if vfmt]

fn (Parser) check_expr #

fn (mut p Parser) check_expr(precedence int) ?ast.Expr

fn (Parser) check_for_impure_v #

fn (mut p Parser) check_for_impure_v(language ast.Language, pos token.Position)

fn (Parser) close_scope #

fn (mut p Parser) close_scope()

fn (Parser) comment #

fn (mut p Parser) comment() ast.Comment

fn (Parser) comment_stmt #

fn (mut p Parser) comment_stmt() ast.ExprStmt

fn (Parser) compile_template_file #

fn (mut p Parser) compile_template_file(template_file string, fn_name string) string

compile_file compiles the content of a file by the given path as a template

fn (Parser) eat_comments #

fn (mut p Parser) eat_comments(cfg EatCommentsConfig) []ast.Comment

fn (Parser) error #

fn (mut p Parser) error(s string) ast.NodeError

fn (Parser) error_with_error #

fn (mut p Parser) error_with_error(error errors.Error)

fn (Parser) error_with_pos #

fn (mut p Parser) error_with_pos(s string, pos token.Position) ast.NodeError

fn (Parser) expr #

fn (mut p Parser) expr(precedence int) ast.Expr

fn (Parser) expr_with_left #

fn (mut p Parser) expr_with_left(left ast.Expr, precedence int, is_stmt_ident bool) ast.Expr

fn (Parser) find_type_or_add_placeholder #

fn (mut p Parser) find_type_or_add_placeholder(name string, language ast.Language) ast.Type

fn (Parser) free #

fn (mut p Parser) free()

fn (Parser) init_parse_fns #

fn (mut p Parser) init_parse_fns()

fn (Parser) known_import #

fn (p &Parser) known_import(mod string) bool

return true if file being parsed imports mod

fn (Parser) mark_var_as_used #

fn (mut p Parser) mark_var_as_used(varname string) bool

fn (Parser) name_expr #

fn (mut p Parser) name_expr() ast.Expr

fn (Parser) note #

fn (mut p Parser) note(s string)

fn (Parser) note_with_pos #

fn (mut p Parser) note_with_pos(s string, pos token.Position)

fn (Parser) open_scope #

fn (mut p Parser) open_scope()

fn (Parser) parse #

fn (mut p Parser) parse() &ast.File

fn (Parser) parse_any_type #

fn (mut p Parser) parse_any_type(language ast.Language, is_ptr bool, check_dot bool) ast.Type

fn (Parser) parse_array_type #

fn (mut p Parser) parse_array_type() ast.Type

fn (Parser) parse_block #

fn (mut p Parser) parse_block() []ast.Stmt

fn (Parser) parse_block_no_scope #

fn (mut p Parser) parse_block_no_scope(is_top_level bool) []ast.Stmt

fn (Parser) parse_chan_type #

fn (mut p Parser) parse_chan_type() ast.Type

fn (Parser) parse_fn_type #

fn (mut p Parser) parse_fn_type(name string) ast.Type

given anon name based off signature when name is blank

fn (Parser) parse_generic_inst_type #

fn (mut p Parser) parse_generic_inst_type(name string) ast.Type

fn (Parser) parse_generic_type #

fn (mut p Parser) parse_generic_type(name string) ast.Type

fn (Parser) parse_ident #

fn (mut p Parser) parse_ident(language ast.Language) ast.Ident

fn (Parser) parse_language #

fn (mut p Parser) parse_language() ast.Language

Parses any language indicators on a type.

fn (Parser) parse_map_type #

fn (mut p Parser) parse_map_type() ast.Type

fn (Parser) parse_multi_return_type #

fn (mut p Parser) parse_multi_return_type() ast.Type

fn (Parser) parse_thread_type #

fn (mut p Parser) parse_thread_type() ast.Type

fn (Parser) parse_type #

fn (mut p Parser) parse_type() ast.Type

fn (Parser) parse_type_with_mut #

fn (mut p Parser) parse_type_with_mut(is_mut bool) ast.Type

fn (Parser) peek_token #

fn (p &Parser) peek_token(n int) token.Token

fn (Parser) read_first_token #

fn (mut p Parser) read_first_token()

fn (Parser) set_path #

fn (mut p Parser) set_path(path string)

fn (Parser) stmt #

fn (mut p Parser) stmt(is_top_level bool) ast.Stmt

fn (Parser) top_stmt #

fn (mut p Parser) top_stmt() ast.Stmt

fn (Parser) vet_error #

fn (mut p Parser) vet_error(msg string, line int, fix vet.FixKind, typ vet.ErrorType)

fn (Parser) warn #

fn (mut p Parser) warn(s string)

fn (Parser) warn_with_pos #

fn (mut p Parser) warn_with_pos(s string, pos token.Position)