/*
* This file is part of cparser.
- * Copyright (C) 2007-2008 Matthias Braun <matze@braunis.de>
+ * Copyright (C) 2007-2009 Matthias Braun <matze@braunis.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
#if defined(_WIN32) || defined(__CYGWIN__)
/* No strtold on windows and no replacement yet */
-#define strtold(s, e) strtod(s, e)
-#define strcasecmp(a, b) stricmp(a, b)
+#define strtold(s, e) strtod(s, e)
#endif
typedef unsigned int utf32;
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 \
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;
case ':':
MAYBE_PROLOG
MAYBE('>', ']')
+ MAYBE_MODE(':', T_COLONCOLON, _CXX)
ELSE(':')
case '=':
MAYBE_PROLOG