v3.token
fn BindingPower.from #
fn BindingPower.from[W](input W) !BindingPower
fn FileSet.new #
fn FileSet.new() &FileSet
new creates a FileSet value for token.
fn Token.from #
fn Token.from[W](input W) !Token
fn Token.from_string_tinyv #
fn Token.from_string_tinyv(name string) Token
vfmt off
enum BindingPower #
enum BindingPower {
lowest
logical_or // ||
logical_and // &&
compare // ==, !=, <, <=, >, >=, in, !in, is, !is
bit_or // |
bit_xor // ^
shift // <<, >>, >>>
add // +, -
product // *, /, %, &
highest
}
BindingPower lists binding power values used by token.
enum Token #
enum Token {
amp // &
and // &&
and_assign // &=
arrow // <-
assign // =
attribute
bit_not // ~
char // `A` - rune
colon // :
comma // ,
comment
dec // --
decl_assign // :=
div // /
div_assign // /=
dollar // $
dot // .
dotdot // ..
ellipsis // ...
eof
eq // ==
ge // >=
gt // >
hash // #
inc // ++
key_as
key_asm
key_assert
key_atomic
key_break
key_const
key_continue
key_defer
key_dump
key_else
key_enum
key_false
key_fn
key_for
key_global
key_go
key_goto
key_if
key_import
key_in
key_interface
key_is
key_isreftype
key_likely
key_lock
key_match
key_module
key_mut
key_nil
key_none
key_offsetof
key_or
key_pub
key_return
key_rlock
key_select
key_shared
key_sizeof
key_spawn
key_static
key_struct
key_true
key_type
key_typeof
key_union
key_unlikely
key_unsafe
key_volatile
lcbr // {
le // <=
left_shift // <<
left_shift_assign // >>=
logical_or // ||
lpar // (
lsbr // [
lt // <
minus // -
minus_assign // -=
mod // %
mod_assign // %=
mul // *
mul_assign // *=
name // user
ne // !=
not // !
not_in // !in
not_is // !is
number // 123
or_assign // |=
pipe // |
plus // +
plus_assign // +=
question // ?
rcbr // }
right_shift // >>
right_shift_assign // <<=
right_shift_unsigned // >>>
right_shift_unsigned_assign // >>>=
rpar // )
rsbr // ]
semicolon // ;
str_dollar
string // 'foo'
unknown
xor // ^
xor_assign // ^=
}
Token lists token values used by token.
fn (Token) left_binding_power #
fn (t Token) left_binding_power() BindingPower
left_binding_power supports left binding power handling for Token.
fn (Token) right_binding_power #
fn (t Token) right_binding_power() BindingPower
right_binding_power supports right binding power handling for Token.
fn (Token) is_keyword #
fn (t Token) is_keyword() bool
is_keyword reports whether is keyword applies in token.
fn (Token) is_prefix #
fn (t Token) is_prefix() bool
is_prefix reports whether is prefix applies in token.
fn (Token) is_infix #
fn (t Token) is_infix() bool
is_infix reports whether is infix applies in token.
fn (Token) is_postfix #
fn (t Token) is_postfix() bool
is_postfix reports whether is postfix applies in token.
fn (Token) is_assignment #
fn (t Token) is_assignment() bool
is_assignment reports whether is assignment applies in token.
fn (Token) is_overloadable #
fn (t Token) is_overloadable() bool
is_overloadable reports whether is overloadable applies in token.
fn (Token) is_comparison #
fn (t Token) is_comparison() bool
is_comparison reports whether is comparison applies in token.
fn (Token) str #
fn (t Token) str() string
str returns the string form for Token.
struct File #
struct File {
pub:
name string
base int
size int
mut:
line_offsets []int = [0]
id_counter &int = unsafe { nil }
}
File represents file data used by token.
fn (File) add_line #
fn (mut f File) add_line(offset int)
add_line updates add line state for File.
fn (File) line_count #
fn (f &File) line_count() int
line_count supports line count handling for File.
fn (File) line_start #
fn (f &File) line_start(line int) int
line_start supports line start handling for File.
fn (File) line #
fn (f &File) line(pos Pos) int
line supports line handling for File.
fn (File) pos #
fn (mut f File) pos(offset int) Pos
pos supports pos handling for File.
fn (File) position #
fn (f &File) position(pos Pos) Position
position supports position handling for File.
fn (File) find_line_and_column #
fn (f &File) find_line_and_column(pos int) (int, int)
find_line_and_column resolves find line and column information for token.
fn (File) find_line #
fn (f &File) find_line(pos int) int
find_line resolves find line information for token.
struct FileSet #
struct FileSet {
mut:
base int = 1
id_counter int
files []&File
}
FileSet represents file set data used by token.
fn (FileSet) add_file #
fn (mut fs FileSet) add_file(filename string, base_ int, size int) &File
add_file updates add file state for FileSet.
fn (FileSet) file #
fn (mut fs FileSet) file(pos Pos) &File
file supports file handling for FileSet.
struct Pos #
struct Pos {
pub:
offset int
id int
}
Pos represents pos data used by token.
fn (Pos) str #
fn (p Pos) str() string
str returns the string form for Pos.
fn (Pos) is_valid #
fn (p Pos) is_valid() bool
is_valid reports whether is valid applies in token.
struct Position #
struct Position {
pub:
filename string
offset int
line int
column int
}
Position represents position data used by token.
fn (Position) str #
fn (p Position) str() string
str returns the string form for Position.