XU XUv0.16.0

#text/scanner

import: #text/scanner

counts: 1 functions, 7 methods, 1 types, 8 constants, 0 method sets

Token scan: Ident/Int/Float/Char/String; source is an owning string.

const EOF

XuAPI
pub const EOF = -1

Purpose

Constant EOF, defining protocol or algorithm parameters.

const IDENT

XuAPI
pub const IDENT = -2

Purpose

Constant IDENT, defining protocol or algorithm parameters.

const SCAN_INT

XuAPI
pub const SCAN_INT = -3

Purpose

Constant SCAN_INT, defining protocol or algorithm parameters.

const FLOAT

XuAPI
pub const FLOAT = -4

Purpose

Constant FLOAT, defining protocol or algorithm parameters.

const CHAR

XuAPI
pub const CHAR = -5

Purpose

Constant CHAR, defining protocol or algorithm parameters.

const SCAN_STRING

XuAPI
pub const SCAN_STRING = -6

Purpose

Constant SCAN_STRING, defining protocol or algorithm parameters.

const RAW_STRING

XuAPI
pub const RAW_STRING = -7

Purpose

Constant RAW_STRING, defining protocol or algorithm parameters.

const COMMENT

XuAPI
pub const COMMENT = -8

Purpose

Constant COMMENT, defining protocol or algorithm parameters.

struct Scanner

XuAPI
pub struct Scanner {
    pub src string
    pub pos int
    pub line int
    pub col int
    pub tok int
    pub text string
    pub tok_line int
    pub tok_col int
}

Purpose

Structure encapsulating src, pos, line, col, tok.

Public fields

src string
source
pos int
field (int)
line int
field (int)
col int
field (int)
tok int
field (int)
text string
text
tok_line int
field (int)
tok_col int
field (int)

new

XuAPI
pub fn new(src &string) Scanner

Purpose

Construct a new value of this type.

Parameters

src &string
source (read-only borrow; caller keeps the original; type &string)

Returns

Scanner — a value of this type

($&Scanner) peek

XuAPI
pub fn (s $&Scanner) peek() int

Purpose

Execute peek on $&Scanner.

Parameters

s $&Scanner
The Scanner instance used by this call (exclusive borrow).

Returns

int — a value of this type

($&Scanner) next

XuAPI
pub fn (s $&Scanner) next() int

Purpose

Operation on $&Scanner: take the next item, or end according to this type.

Parameters

s $&Scanner
The Scanner instance used by this call (exclusive borrow).

Returns

int — a value of this type

($&Scanner) scan

XuAPI
pub fn (s $&Scanner) scan() int

Purpose

Execute scan on $&Scanner.

Parameters

s $&Scanner
The Scanner instance used by this call (exclusive borrow).

Returns

int — a value of this type

(Scanner) token_text

XuAPI
pub fn (s Scanner) token_text() string

Purpose

Operation on Scanner: token text.

Parameters

s Scanner
The Scanner instance used by this call (value receiver).

Returns

string — result string

(Scanner) line

XuAPI
pub fn (s Scanner) line() int

Purpose

Execute line on Scanner.

Parameters

s Scanner
The Scanner instance used by this call (value receiver).

Returns

int — a value of this type

(Scanner) column

XuAPI
pub fn (s Scanner) column() int

Purpose

Execute column on Scanner.

Parameters

s Scanner
The Scanner instance used by this call (value receiver).

Returns

int — a value of this type

(Scanner) token

XuAPI
pub fn (s Scanner) token() int

Purpose

Execute token on Scanner.

Parameters

s Scanner
The Scanner instance used by this call (value receiver).

Returns

int — a value of this type