Changeset View
Changeset View
Standalone View
Standalone View
sys/ddb/db_lex.c
Show First 20 Lines • Show All 91 Lines • ▼ Show 20 Lines | |||||
static void | static void | ||||
db_flush_line() | db_flush_line() | ||||
{ | { | ||||
db_lp = db_line; | db_lp = db_line; | ||||
db_endlp = db_line; | db_endlp = db_line; | ||||
} | } | ||||
static int db_look_char = 0; | |||||
static int | static int | ||||
db_read_char(void) | db_read_char(void) | ||||
{ | { | ||||
int c; | int c; | ||||
if (db_look_char != 0) { | if (db_lp >= db_endlp) | ||||
c = db_look_char; | |||||
db_look_char = 0; | |||||
} | |||||
else if (db_lp >= db_endlp) | |||||
c = -1; | c = -1; | ||||
else | else | ||||
c = *db_lp++; | c = *db_lp++; | ||||
return (c); | return (c); | ||||
} | } | ||||
static void | static void | ||||
db_unread_char(c) | db_unread_char(int c) | ||||
markj: Convert to an ANSI definition while here? | |||||
int c; | |||||
{ | { | ||||
db_look_char = c; | |||||
if (c == -1) { | |||||
/* Unread EOL at EOL is okay. */ | |||||
if (db_lp < db_endlp) | |||||
db_error("db_unread_char(-1) before end of line\n"); | |||||
} else { | |||||
if (db_lp > db_line) { | |||||
db_lp--; | |||||
if (*db_lp != c) | |||||
db_error("db_unread_char() wrong char\n"); | |||||
} else { | |||||
db_error("db_unread_char() at beginning of line\n"); | |||||
} | } | ||||
} | |||||
} | |||||
static int db_look_token = 0; | static int db_look_token = 0; | ||||
void | void | ||||
db_unread_token(int t) | db_unread_token(int t) | ||||
{ | { | ||||
db_look_token = t; | db_look_token = t; | ||||
} | } | ||||
Show All 18 Lines | |||||
char db_tok_string[TOK_STRING_SIZE]; | char db_tok_string[TOK_STRING_SIZE]; | ||||
db_expr_t db_radix = 16; | db_expr_t db_radix = 16; | ||||
void | void | ||||
db_flush_lex(void) | db_flush_lex(void) | ||||
{ | { | ||||
db_flush_line(); | db_flush_line(); | ||||
db_look_char = 0; | |||||
db_look_token = 0; | db_look_token = 0; | ||||
} | } | ||||
static int | static int | ||||
db_lex(int flags) | db_lex(int flags) | ||||
{ | { | ||||
int c, n, radix_mode; | int c, n, radix_mode; | ||||
bool lex_wspace, lex_hex_numbers; | bool lex_wspace, lex_hex_numbers; | ||||
▲ Show 20 Lines • Show All 215 Lines • Show Last 20 Lines |
Convert to an ANSI definition while here?