fn build_precedences() []Precedence
fn is_decl(t Kind) bool
fn is_key(key string) bool
fn key_to_token(key string) Kind
enum AtKind {
unknown
fn_name
mod_name
struct_name
vexe_path
file_path
line_nr
column_nr
vhash
vmod_file
}
@FN => will be substituted with the name of the current V function @MOD => will be substituted with the name of the current V module @STRUCT => will be substituted with the name of the current V struct @VEXE => will be substituted with the path to the V compiler @FILE => will be substituted with the path of the V source file @LINE => will be substituted with the V line number where it appears (as a string). @COLUMN => will be substituted with the column where it appears (as a string). @VHASH => will be substituted with the shortened commit hash of the V compiler (as a string). @VMOD_FILE => will be substituted with the contents of the nearest v.mod file (as a string). This allows things like this: println( 'file: ' + @FILE + ' | line: ' + @LINE + ' | fn: ' + @MOD + '.' + @FN) ... which is useful while debugging/tracing @VROOT is special and handled in places like '#include ...' @<type> is allowed for keyword variable names. E.g. 'type'
enum Kind {
unknown
eof
name
number
string
str_inter
chartoken
plus
minus
mul
div
mod
xor
pipe
inc
dec
and
logical_or
not
bit_not
question
comma
semicolon
colon
arrow
amp
hash
dollar
at
str_dollar
left_shift
right_shift
not_in
not_is
assign
decl_assign
plus_assign
minus_assign
div_assign
mult_assign
xor_assign
mod_assign
or_assign
and_assign
right_shift_assign
left_shift_assign
lcbr
rcbr
lpar
rpar
lsbr
rsbr
eq
ne
gt
lt
ge
le
comment
nl
dot
dotdot
ellipsis
keyword_beg
key_as
key_asm
key_assert
key_atomic
key_break
key_const
key_continue
key_defer
key_else
key_enum
key_false
key_for
key_fn
key_global
key_go
key_goto
key_if
key_import
key_in
key_interface
key_is
key_match
key_module
key_mut
key_shared
key_lock
key_rlock
key_none
key_return
key_select
key_sizeof
key_likely
key_unlikely
key_offsetof
key_struct
key_true
key_type
key_typeof
key_orelse
key_union
key_pub
key_static
key_unsafe
keyword_end
_end_
}
fn (t Kind) is_assign() bool
fn (t Kind) str() string
fn (tok Kind) is_relational() bool
fn (k Kind) is_start_of_type() bool
fn (kind Kind) is_prefix() bool
fn (kind Kind) is_infix() bool
enum Precedence {
lowest
cond
in_as
assign
eq
sum
product
prefix
postfix
call
index
}
Representation of highest and lowest precedence
struct Position {
pub:
len int
line_nr int
pos int
pub mut:
last_line int
}
fn (pos Position) str() string
fn (pos Position) extend(end Position) Position
fn (pos Position) extend_with_last_line(end Position, last_line int) Position
struct Token {
pub:
kind Kind
lit string
line_nr int
pos int
len int
tidx int
}
fn (tok &Token) can_start_type(builtin_type_names []string) bool
Pass table.builtin_type_names Note: can't import table here due to circular module dependency
fn (tok Token) is_scalar() bool
is_scalar returns true if the token is a scalar
fn (tok Token) is_unary() bool
is_unary returns true if the token can be in a unary expression
fn (tok &Token) position() Position
fn (tok Token) precedence() int
precedence returns a tokens precedence if defined, otherwise lowest_prec
fn (t Token) str() string