X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=lexer.c;h=247083c399645429fd1efbcd897c27c2865cff10;hb=3c84e06d01aaed7971067d7cc1924f6e20bcd0ba;hp=7cc61aa55487e84355a80e591e6940db69239b19;hpb=6d7d61de445629e1590d3a2ba2990ef7a651368a;p=cparser diff --git a/lexer.c b/lexer.c index 7cc61aa..247083c 100644 --- a/lexer.c +++ b/lexer.c @@ -1766,6 +1766,16 @@ static void parse_preprocessor_directive(void) lexer_token.type = set_type; \ return; +/* must use this as last thing */ +#define MAYBE_MODE(ch, set_type, mode) \ + case ch: \ + if (c_mode & mode) { \ + next_char(); \ + lexer_token.type = set_type; \ + return; \ + } \ + /* fallthrough */ + #define ELSE_CODE(code) \ default: \ code \ @@ -1796,12 +1806,10 @@ void lexer_next_preprocessing_token(void) SYMBOL_CHARS parse_symbol(); /* might be a wide string ( L"string" ) */ - if(lexer_token.type == T_IDENTIFIER && - lexer_token.v.symbol == symbol_L) { - if(c == '"') { - parse_wide_string_literal(); - } else if(c == '\'') { - parse_wide_character_constant(); + if (lexer_token.v.symbol == symbol_L) { + switch (c) { + case '"': parse_wide_string_literal(); break; + case '\'': parse_wide_character_constant(); break; } } return; @@ -1921,6 +1929,7 @@ void lexer_next_preprocessing_token(void) case ':': MAYBE_PROLOG MAYBE('>', ']') + MAYBE_MODE(':', T_COLONCOLON, _CXX) ELSE(':') case '=': MAYBE_PROLOG