scanner.c revision 48edc7cf07b5dccc3ad84bf2dafe4150bd666d60
2N/A#include "parser.tab.h"
2N/Astatic int categories[] = {
instring = 0;
escaped = 0;
tokidx = 0;
last_kw = 0;
#define hex(x) \
scanc(void)
nextline++;
unscanc(int c)
nextline--;
scan_hex_byte(void)
scan_dec_byte(void)
scan_oct_byte(void)
add_tok(int c)
tokidx = 0;
toksz = 0;
get_byte(void)
unscanc(c);
return (EOF);
c = scanc();
return (scan_dec_byte());
return (scan_hex_byte());
unscanc(c);
return (scan_oct_byte());
unscanc(c);
return (EOF);
get_escaped(int c)
get_wide(void)
int mbi = 0;
return (T_NULL);
unscanc(c);
return (T_NULL);
return (T_CHAR);
get_symbol(void)
if (escaped) {
escaped = 0;
if (c == esc_char) {
return (T_NULL);
tokidx = 0;
return (last_kw);
toksz = 0;
tokidx = 0;
return (T_SYMBOL);
add_tok(c);
return (EOF);
consume_token(void)
tokidx = 0;
return (T_NULL);
return (T_ELLIPSIS);
for (j = 0; categories[j]; j++) {
char *eptr;
if (*eptr != 0)
return (T_NUMBER);
return (T_CHAR);
toksz = 0;
tokidx = 0;
return (T_NAME);
scan_to_eol(void)
if (c == EOF) {
yylex(void)
if (instring) {
if (escaped) {
escaped = 0;
unscanc(c);
return (get_wide());
return (T_CHAR);
if (c == esc_char) {
return (get_symbol());
return (T_GT);
instring = 0;
return (T_QUOTE);
return (T_CHAR);
if (escaped) {
escaped = 0;
if (tokidx) {
return (T_NULL);
unscanc(c);
return (get_wide());
if (c == esc_char) {
if (c == com_char) {
return (EOF);
if (!hadtok) {
hadtok = 0;
return (T_NL);
unscanc(c);
return (consume_token());
if (!hadtok) {
hadtok = 0;
return (T_NL);
return (T_COMMA);
return (T_SEMI);
return (T_LPAREN);
return (T_RPAREN);
return (T_GT);
return (get_symbol());
return (T_QUOTE);
add_tok(c);
return (EOF);
char *msg;
char *msg;
warnings++;