mirror of
https://github.com/pnx/m16vm
synced 2026-06-16 03:44:55 +02:00
src/as/lexer.c: use error.c
This commit is contained in:
parent
2e66ffb9a5
commit
960d6f2e0d
1 changed files with 3 additions and 3 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include "error.h"
|
||||||
#include "lexer.h"
|
#include "lexer.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -157,7 +158,7 @@ static int parse_number(struct lexer *lex) {
|
||||||
int num;
|
int num;
|
||||||
|
|
||||||
if (read_number(lex->fp, &num) < 0)
|
if (read_number(lex->fp, &num) < 0)
|
||||||
fprintf(stderr, "WARNING: Value truncated on line: %i\n", lex->lineno);
|
asm_warn(lex->lineno, "Value truncated to %i", num);
|
||||||
|
|
||||||
lex->token.value.n = num;
|
lex->token.value.n = num;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -238,8 +239,7 @@ int lexer_get_next(struct lexer *lex) {
|
||||||
if (lex->token.type == TOKEN_LABEL_DECL || lex->token.type == TOKEN_LABEL)
|
if (lex->token.type == TOKEN_LABEL_DECL || lex->token.type == TOKEN_LABEL)
|
||||||
strcpy(lex->token.value.s, buf);
|
strcpy(lex->token.value.s, buf);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "ERROR: Invalid character '%c' on line: %i\n", ch, lex->lineno);
|
return asm_error(lex->lineno, "Invalid character '%c'", ch);
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue