class SCANNER
****
Scanner for Sather 1.0. Strategy: a big case statement. Whitespace and comments are passed in tight loops. Keywords are distinguished from identifiers by switching on the first character, followed by verification on the following characters ordered by expected keyword frequency.


Flattened version is here

Ancestors
CS_COMPONENT LEX_CONST



Public


Readable Attributes
attr backed_up: BOOL;
attr buf: FSTR;
attr char_value:CHAR;
**** character token value AS_FLT_LIT_EXPR::flt and AS_FLT_LIT_EXPR::flti also used for integers
attr last_char: CHAR;
attr lex_value:IDENT;
**** ident token value AS_FLT_LIT_EXPR::flt and AS_FLT_LIT_EXPR::flti also used for integers
attr next: CHAR;
attr num_value:RAT;
**** numerical value AS_FLT_LIT_EXPR::flt and AS_FLT_LIT_EXPR::flti also used for integers
attr pSather: BOOL;
attr value_type: INT;
**** one of the five floating_point types (see AS_FLT_LIT_EXPR) AS_FLT_LIT_EXPR::flt and AS_FLT_LIT_EXPR::flti also used for integers

Writable Attributes
attr backed_up: BOOL;
attr buf: FSTR;
attr char_value:CHAR;
**** character token value AS_FLT_LIT_EXPR::flt and AS_FLT_LIT_EXPR::flti also used for integers
attr last_char: CHAR;
attr lex_value:IDENT;
**** ident token value AS_FLT_LIT_EXPR::flt and AS_FLT_LIT_EXPR::flti also used for integers
attr next: CHAR;
attr num_value:RAT;
**** numerical value AS_FLT_LIT_EXPR::flt and AS_FLT_LIT_EXPR::flti also used for integers
attr pSather: BOOL;
attr value_type: INT;
**** one of the five floating_point types (see AS_FLT_LIT_EXPR) AS_FLT_LIT_EXPR::flt and AS_FLT_LIT_EXPR::flti also used for integers

Constants

Features
add_buf_to_sym_table
**** make sure in sym table, and set lex_value to id.
backup
**** Backup one character at most.
character: CHAR
**** value of something preceeded by a backslash
close_file
comment
comment_here
**** Meant to be overridden if desired
create (p: PROG, file: STR, pSather: BOOL):SAME
**** initialize scanner, read f
error (msg:STR)
**** where errors during scanning go
fetch
identifier: TOKEN
**** Find out if ident or keyword.
int_literal (base: INT): INTI
is_class_name (s: STR): BOOL
**** s is a legal identifier
number: TOKEN
skip_whitespace
token: TOKEN
**** next Sather token; eof_tok if at end.