fix parse error line output for error tokens from scanner
This commit is contained in:
parent
7f47224bd9
commit
5ff31e7d96
@ -149,10 +149,10 @@ static void errorAt(KrkToken * token, const char * message) {
|
||||
message,
|
||||
(int)(token->col - 1),
|
||||
token->linePtr,
|
||||
(int)(token->length),
|
||||
(int)(token->literalWidth),
|
||||
token->linePtr + (token->col - 1),
|
||||
(int)(i - (token->col - 1 + token->length)),
|
||||
token->linePtr + (token->col - 1 + token->length),
|
||||
(int)(i - (token->col - 1 + token->literalWidth)),
|
||||
token->linePtr + (token->col - 1 + token->literalWidth),
|
||||
(int)token->col-1,
|
||||
""
|
||||
);
|
||||
|
@ -43,6 +43,7 @@ static KrkToken makeToken(KrkTokenType type) {
|
||||
.length = (type == TOKEN_EOL) ? 0 : (size_t)(scanner.cur - scanner.start),
|
||||
.line = scanner.line,
|
||||
.linePtr = scanner.linePtr,
|
||||
.literalWidth = (type == TOKEN_EOL) ? 0 : (size_t)(scanner.cur - scanner.start),
|
||||
.col = (scanner.start - scanner.linePtr) + 1,
|
||||
};
|
||||
}
|
||||
@ -54,6 +55,7 @@ static KrkToken errorToken(const char * errorStr) {
|
||||
.length = strlen(errorStr),
|
||||
.line = scanner.line,
|
||||
.linePtr = scanner.linePtr,
|
||||
.literalWidth = (size_t)(scanner.cur - scanner.start),
|
||||
.col = (scanner.start - scanner.linePtr) + 1,
|
||||
};
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user