Warn on escape sequences
This commit is contained in:
@@ -776,7 +776,10 @@ parse_string (void)
|
|||||||
/* Only single escape character is allowed. */
|
/* Only single escape character is allowed. */
|
||||||
if (LA (1) == 'x' || LA (1) == 'u' || __isdigit (LA (1)))
|
if (LA (1) == 'x' || LA (1) == 'u' || __isdigit (LA (1)))
|
||||||
{
|
{
|
||||||
PARSE_SORRY ("Escape sequences are not supported yet", token_start - buffer_start);
|
PARSE_WARN ("Escape sequences are ignored yet", token_start - buffer_start);
|
||||||
|
consume_char ();
|
||||||
|
consume_char ();
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
if ((LA (1) == '\'' && !is_double_quoted)
|
if ((LA (1) == '\'' && !is_double_quoted)
|
||||||
|| (LA (1) == '"' && is_double_quoted)
|
|| (LA (1) == '"' && is_double_quoted)
|
||||||
|
|||||||
@@ -28,6 +28,11 @@
|
|||||||
__printf ("ERROR: Ln %d, Col %d: %s\n", line + 1, column + 1, MESSAGE); \
|
__printf ("ERROR: Ln %d, Col %d: %s\n", line + 1, column + 1, MESSAGE); \
|
||||||
__exit (-1); \
|
__exit (-1); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
#define PARSE_WARN(MESSAGE, LOCUS) do { \
|
||||||
|
size_t line, column; \
|
||||||
|
lexer_locus_to_line_and_column ((size_t) (LOCUS), &line, &column); \
|
||||||
|
__printf ("WARNING: Ln %d, Col %d: %s\n", line + 1, column + 1, MESSAGE); \
|
||||||
|
} while (0)
|
||||||
#define PARSE_ERROR_VARG(MESSAGE, LOCUS, ...) do { \
|
#define PARSE_ERROR_VARG(MESSAGE, LOCUS, ...) do { \
|
||||||
size_t line, column; \
|
size_t line, column; \
|
||||||
lexer_locus_to_line_and_column ((size_t) (LOCUS), &line, &column); \
|
lexer_locus_to_line_and_column ((size_t) (LOCUS), &line, &column); \
|
||||||
@@ -36,7 +41,7 @@
|
|||||||
for (size_t i = 0; i < column; i++) { \
|
for (size_t i = 0; i < column; i++) { \
|
||||||
__putchar (' '); \
|
__putchar (' '); \
|
||||||
} \
|
} \
|
||||||
__printf ("\n^\n"); \
|
__printf ("^\n"); \
|
||||||
__printf ("ERROR: Ln %d, Col %d: ", line + 1, column + 1); \
|
__printf ("ERROR: Ln %d, Col %d: ", line + 1, column + 1); \
|
||||||
__printf (MESSAGE, __VA_ARGS__); \
|
__printf (MESSAGE, __VA_ARGS__); \
|
||||||
__printf ("\n"); \
|
__printf ("\n"); \
|
||||||
|
|||||||
Reference in New Issue
Block a user