API
#text/scanner
Xu 0.8.8 API
import: #text/scanner
counts: 1 fns, 7 methods, 1 types, 8 consts, 0 ifaces
Token scan: Ident/Int/Float/Char/String; source is an owning string.
const eof
Purpose
Tokenizer aligned with `text/scanner` default GoTokens skip whitespace and comments; recognize Ident / Int / Float Char / String / RawString; other bytes are single-char tokens. Source is an owning string (no io.Reader). ASCII column = byte count. Value `-1`.
Parameters
none
const ident
Purpose
Public constant `ident`. Value `-2`.
Parameters
none
const scan_int
Purpose
Public constant `scan_int`. Value `-3`.
Parameters
none
const float
Purpose
Public constant `float`. Value `-4`.
Parameters
none
const char
Purpose
Public constant `char`. Value `-5`.
Parameters
none
const scan_string
pub const scan_string = -6
Purpose
Public constant `scan_string`. Value `-6`.
Parameters
none
const raw_string
pub const raw_string = -7
Purpose
Public constant `raw_string`. Value `-7`.
Parameters
none
struct Scanner
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
Public struct `Scanner`.
Parameters
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
pub fn new(src &string) Scanner
Purpose
Construct a new value of this type.
Parameters
src &string- source (borrowed; caller keeps it; type &string)
Returns
Scanner — a value of this type
(&mut Scanner) peek
pub fn (s &mut Scanner) peek() int
Purpose
Call `peek` on `&mut Scanner`.
Parameters
s &mut Scanner- receiver &mut Scanner (exclusive borrow)
Returns
int — a value of this type
(&mut Scanner) next
pub fn (s &mut Scanner) next() int
Purpose
Method on `&mut Scanner`: take the next item, or end according to this type.
Parameters
s &mut Scanner- receiver &mut Scanner (exclusive borrow)
Returns
int — a value of this type
(&mut Scanner) scan
pub fn (s &mut Scanner) scan() int
Purpose
Call `scan` on `&mut Scanner`.
Parameters
s &mut Scanner- receiver &mut Scanner (exclusive borrow)
Returns
int — a value of this type
(Scanner) token_text
pub fn (s Scanner) token_text() string
Purpose
Method on `Scanner`: token text.
Parameters
s Scanner- receiver Scanner (value receiver)
Returns
string — result string
(Scanner) line
pub fn (s Scanner) line() int
Purpose
Call `line` on `Scanner`.
Parameters
s Scanner- receiver Scanner (value receiver)
Returns
int — a value of this type
(Scanner) column
pub fn (s Scanner) column() int
Purpose
Call `column` on `Scanner`.
Parameters
s Scanner- receiver Scanner (value receiver)
Returns
int — a value of this type
(Scanner) token
pub fn (s Scanner) token() int
Purpose
Call `token` on `Scanner`.
Parameters
s Scanner- receiver Scanner (value receiver)
Returns
int — a value of this type