Recognize '//' line comments - same rules as sys_scanner_comments_hash, triggered by "//" instead...
sys_scanner_flags_t
Flags controlling which tokenization rules sys_scanner_init() applies.
Both quote styles - sys_scanner_quotes_single | _double.
sys_scanner_flags_t flags
flags given to init() (private)
sys_scanner_numbers, plus a fractional part ("3.14") and/or an exponent ("1e10", "1.5e-3").
sys_scanner_keywords, plus '-' allowed within an identifier.
Give ' ' its own sys_scanner_newline class instead of merging it into a sys_scanner_space run - usefu...
one control character (non-whitespace)
Recognize '#' line comments as sys_scanner_comment, running to (not including) the next ' ' or end of...
System abstraction headers and process lifecycle hooks.
whitespace run - see sys_rune_is_space()
Both comment styles - sys_scanner_comments_hash | _slash.
a comment - sys_scanner_comments
sys_scanner_class_t
Classification of a scanned token.
sys_scanner_numbers, plus "0b"/"0B" followed by binary digits, e.g.
struct sys_iostream_t sys_iostream_t
An opaque byte stream.
Recognize [+-]?[0-9]+ as a single sys_scanner_number token instead of a separate sign and digit run...
a -escape sequence - sys_scanner_escapes
bool sys_scanner_next(sys_scanner_t *it)
Advance to the next token.
size_t bytes
length of the current token, in bytes
Recognize [A-Za-z][A-Za-z0-9]* identifiers as a single sys_scanner_keyword token instead of separate ...
sys_scanner_numbers, plus "0x"/"0X" followed by hex digits, e.g.
Scanner state: reads a stream into a sequence of typed tokens.
sys_scanner_keywords, plus '_' allowed within an identifier.
a number - sys_scanner_numbers
size_t runes
number of runes in the current token
Recognize '...'-quoted strings as sys_scanner_string.
ptrdiff_t start
absolute stream position where the current
an identifier - sys_scanner_keywords
a quoted string - sys_scanner_quotes
sys_iostream_t * stream
source (private)
Recognize \" \\ \/ \b \f \n \r \t and \uXXXX as a single sys_scanner_escape token instead of ordinary...
size_t sys_scanner_token(sys_scanner_t *it, char *buf, size_t cap)
Read the current token's text.
struct sys_scanner_t sys_scanner_t
Scanner state: reads a stream into a sequence of typed tokens.
one punctuation character
Recognize "..."-quoted strings - same rules as sys_scanner_quotes_single, triggered by '"' instead...
one ' ' - sys_scanner_newlines
sys_scanner_numbers, plus octal: "0o"/"0O" (Python/Rust/Swift style, self-describing) or a bare leadi...
sys_scanner_class_t isa
classification of the current token
unclassified or malformed
sys_scanner_t sys_scanner_init(sys_iostream_t *stream, sys_scanner_flags_t flags)
Initialize a scanner over a stream.