more asserts
[cparser] / lexer.c
diff --git a/lexer.c b/lexer.c
index 74f76c5..699f8ee 100644 (file)
--- a/lexer.c
+++ b/lexer.c
 #define strtold(s, e) strtod(s, e)
 #endif
 
+#define HAS_SIGNED_CHAR
+//#define HAS_UNSIGNED_CHAR
+
+#if defined HAS_SIGNED_CHAR
+typedef signed char char_type;
+#elif defined HAS_UNSIGNED_CHAR
+typedef unsigned char char_type;
+#else
+#      error signedness of char not determined
+#endif
+
 static int         c;
 token_t            lexer_token;
 symbol_t          *symbol_L;
@@ -575,7 +586,7 @@ static int parse_octal_sequence(const int first_digit)
        if (!is_octal_digit(c)) return value;
        value = 8 * value + c - '0';
        next_char();
-       return value;
+       return (char_type)value;
 }
 
 static int parse_hex_sequence(void)
@@ -594,7 +605,7 @@ static int parse_hex_sequence(void)
                next_char();
        }
 
-       return value;
+       return (char_type)value;
 }
 
 static int parse_escape_sequence(void)