Fix line counts on syntax errors.

This commit is contained in:
Jordan Bancino 2023-04-27 15:54:21 +00:00
parent 72467f6503
commit 6e976a2b8d

View file

@ -171,6 +171,10 @@ HeaderConsumeArg(HeaderExpr * expr)
{
block--;
}
else if (c == '\n')
{
expr->state.lineNo++;
}
}
if (i >= len)
@ -283,6 +287,10 @@ HeaderParse(Stream * stream, HeaderExpr * expr)
i++;
expr->data.text[i] = c;
i++;
if (c == '\n')
{
expr->state.lineNo++;
}
}
}
else
@ -367,6 +375,7 @@ HeaderParse(Stream * stream, HeaderExpr * expr)
if (c == '\n')
{
expr->data.text[i] = '\0';
expr->state.lineNo++;
break;
}
else
@ -439,6 +448,10 @@ HeaderParse(Stream * stream, HeaderExpr * expr)
{
block--;
}
else if (c == '\n')
{
expr->state.lineNo++;
}
if (block <= 0 && c == ';')
{
@ -514,7 +527,8 @@ HeaderParse(Stream * stream, HeaderExpr * expr)
expr->data.declaration.args = ArrayCreate();
do {
do
{
word = HeaderConsumeArg(expr);
ArrayAdd(expr->data.declaration.args, word);
word = NULL;