static utf32 c;
static source_position_t lexer_pos;
token_t lexer_token;
-symbol_t *symbol_L;
+static symbol_t *symbol_L;
static FILE *input;
static utf32 buf[BUF_SIZE + MAX_PUTBACK];
static const utf32 *bufend;
lexer_pos.colno = 1; \
code
-#define eat(c_type) do { assert(c == c_type); next_char(); } while (0)
+#define eat(c_type) (assert(c == c_type), next_char())
static void maybe_concat_lines(void)
{
*/
static bool is_octal_digit(utf32 chr)
{
- switch (chr) {
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- return true;
- default:
- return false;
- }
+ return '0' <= chr && chr <= '7';
}
/**
case '\\': {
utf32 const tc = parse_escape_sequence();
if (tc >= 0x100) {
- warningf(&lexer_pos, "escape sequence out of range");
+ warningf(WARN_OTHER, &lexer_pos, "escape sequence out of range");
}
obstack_1grow(&symbol_obstack, tc);
break;
case '\\': {
utf32 const tc = parse_escape_sequence();
if (tc >= 0x100) {
- warningf(&lexer_pos, "escape sequence out of range");
+ warningf(WARN_OTHER, &lexer_pos, "escape sequence out of range");
}
obstack_1grow(&symbol_obstack, tc);
break;
next_char();
if (c == '*') {
/* nested comment, warn here */
- if (warning.comment) {
- warningf(&lexer_pos, "'/*' within comment");
- }
+ warningf(WARN_COMMENT, &lexer_pos, "'/*' within comment");
}
break;
case '*':
case '\\':
next_char();
if (c == '\n' || c == '\r') {
- if (warning.comment)
- warningf(&lexer_pos, "multi-line comment");
+ warningf(WARN_COMMENT, &lexer_pos, "multi-line comment");
return;
}
break;
unknown_pragma = true;
}
eat_until_newline();
- if (unknown_pragma && warning.unknown_pragmas) {
- warningf(&pp_token.source_position, "encountered unknown #pragma");
+ if (unknown_pragma) {
+ warningf(WARN_UNKNOWN_PRAGMAS, &pp_token.source_position, "encountered unknown #pragma");
}
}
#define ELSE_CODE(code) \
default: \
code \
+ return; \
} \
} /* end of while (true) */ \
- break;
#define ELSE(set_type) \
ELSE_CODE( \
lexer_token.type = set_type; \
- return; \
)
void lexer_next_preprocessing_token(void)
put_back(c);
c = '.';
lexer_token.type = '.';
- return;
)
ELSE('.')
case '&':
put_back(c);
c = '%';
lexer_token.type = '#';
- return;
)
ELSE('#')
ELSE('%')