0
0
mirror of https://github.com/netwide-assembler/nasm.git synced 2025-09-22 10:43:39 -04:00

BR 3392906: error out on bad syntax "db 1 2"

NASM would try to "eat the comma token" in db expressions, even for
cases where the token was not a comma. Fix that and error out
properly.

To give better error messages, track where in the input string a token
starts or ends. This information is only valid as long as the input
string is kept, but that is just fine for error messages during
parsing.

Reported-by: Peter Cordes <pcordes@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
H. Peter Anvin
2023-10-11 12:01:22 -07:00
parent 816f50e5f5
commit 73676357de
5 changed files with 76 additions and 27 deletions

View File

@@ -316,6 +316,8 @@ struct tokenval {
int64_t t_inttwo;
enum token_type t_type;
int8_t t_flag;
const char *t_start; /* Pointer to token in input buffer */
int t_len; /* Length of token in input buffer */
};
typedef int (*scanner)(void *private_data, struct tokenval *tv);