81 |
static double put_tokval; |
static double put_tokval; |
82 |
|
|
83 |
static void unexpected_eof (void); |
static void unexpected_eof (void); |
|
static inline int check_id (const char *id, size_t len); |
|
84 |
static void convert_numeric_string_to_char_string (int type); |
static void convert_numeric_string_to_char_string (int type); |
85 |
static int parse_string (int type); |
static int parse_string (int type); |
86 |
|
|
362 |
strncpy (tokid, ds_c_str (&tokstr), 8); |
strncpy (tokid, ds_c_str (&tokstr), 8); |
363 |
tokid[8] = 0; |
tokid[8] = 0; |
364 |
|
|
365 |
token = check_id (ds_c_str (&tokstr), ds_length (&tokstr)); |
token = lex_id_to_token (ds_c_str (&tokstr), ds_length (&tokstr)); |
366 |
break; |
break; |
367 |
|
|
368 |
default: |
default: |
635 |
{ |
{ |
636 |
return lex_id_match_len (kw, strlen (kw), tok, strlen (tok)); |
return lex_id_match_len (kw, strlen (kw), tok, strlen (tok)); |
637 |
} |
} |
638 |
|
|
639 |
|
/* Returns the proper token type, either T_ID or a reserved keyword |
640 |
|
enum, for ID[], which must contain LEN characters. */ |
641 |
|
int |
642 |
|
lex_id_to_token (const char *id, size_t len) |
643 |
|
{ |
644 |
|
const char **kwp; |
645 |
|
|
646 |
|
if (len < 2 || len > 4) |
647 |
|
return T_ID; |
648 |
|
|
649 |
|
for (kwp = keywords; *kwp; kwp++) |
650 |
|
if (!strcasecmp (*kwp, id)) |
651 |
|
return T_FIRST_KEYWORD + (kwp - keywords); |
652 |
|
|
653 |
|
return T_ID; |
654 |
|
} |
655 |
|
|
656 |
/* Weird token functions. */ |
/* Weird token functions. */ |
657 |
|
|
1018 |
msg (FE, _("Unexpected end of file.")); |
msg (FE, _("Unexpected end of file.")); |
1019 |
} |
} |
1020 |
|
|
|
/* Returns the proper token type, either T_ID or a reserved keyword |
|
|
enum, for ID[], which must contain LEN characters. */ |
|
|
static inline int |
|
|
check_id (const char *id, size_t len) |
|
|
{ |
|
|
const char **kwp; |
|
|
|
|
|
if (len < 2 || len > 4) |
|
|
return T_ID; |
|
|
|
|
|
for (kwp = keywords; *kwp; kwp++) |
|
|
if (!strcmp (*kwp, id)) |
|
|
return T_FIRST_KEYWORD + (kwp - keywords); |
|
|
|
|
|
return T_ID; |
|
|
} |
|
|
|
|
1021 |
/* When invoked, tokstr contains a string of binary, octal, or hex |
/* When invoked, tokstr contains a string of binary, octal, or hex |
1022 |
digits, for values of TYPE of 0, 1, or 2, respectively. The string |
digits, for values of TYPE of 0, 1, or 2, respectively. The string |
1023 |
is converted to characters having the specified values. */ |
is converted to characters having the specified values. */ |