More specific error messages
This commit is contained in:
parent
7b098ff98c
commit
dc06b1b6d8
|
@ -76,7 +76,7 @@ static AsmError push_data(char *input, size_t len, ByteVec *out, Token *tok,
|
|||
}
|
||||
out->len += tok->num;
|
||||
} else {
|
||||
return ErrUnexpectedToken;
|
||||
return ErrNeedsDataLiteral;
|
||||
}
|
||||
*tok = token(input, len, tok->start + tok->len);
|
||||
if (tok->kind == TokNewline || tok->kind == TokEOF) {
|
||||
|
@ -85,7 +85,7 @@ static AsmError push_data(char *input, size_t len, ByteVec *out, Token *tok,
|
|||
if (tok->kind == TokComma) {
|
||||
continue;
|
||||
}
|
||||
return ErrInvalidToken;
|
||||
return ErrNeedCommaOrNewline;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,8 @@ typedef enum AsmError_e {
|
|||
ErrStringDataNotByte,
|
||||
ErrAlignNeedsNumber,
|
||||
ErrAlignNeedsPow2,
|
||||
ErrNeedCommaOrNewline,
|
||||
ErrNeedsDataLiteral,
|
||||
} AsmError;
|
||||
char *ERRORS[] = {
|
||||
"Success",
|
||||
|
@ -55,4 +57,6 @@ char *ERRORS[] = {
|
|||
"String literals can be used only in .db directive",
|
||||
".align requires a number",
|
||||
".align requires a power of two as an argument",
|
||||
"Need comma or newline after data literal",
|
||||
"Data literal expects a number or a string",
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue