Skip to content

v2.parser #

fn Parser.new #

fn Parser.new(prefs &pref.Preferences) &Parser

struct Parser #

struct Parser {
	pref &pref.Preferences
mut:
	file    &token.File = &token.File{}
	scanner &scanner.Scanner
	// track state
	exp_lcbr bool // expecting `{` parsing `x` in `for|if|match x {` etc
	exp_pt   bool // expecting (p)ossible (t)ype from `p.expr()`
	// token info : start
	line      int
	lit       string
	pos       token.Pos
	tok       token.Token = .unknown
	tok_next_ token.Token = .unknown // DO NOT access directly, use `p.peek()`
	// token info : end
}

fn (Parser) parse_files #

fn (mut p Parser) parse_files(files []string, mut file_set token.FileSet) []ast.File

fn (Parser) parse_file #

fn (mut p Parser) parse_file(filename string, mut file_set token.FileSet) ast.File

fn (Parser) expect_semi #

fn (mut p Parser) expect_semi()