case TOKEN_EOL:
/* ignore */
break;
-
+
default:
con_err("%s", read[feed]->values[itr]);
break;
itr = 0;
con_err("\n");
}
-
+
switch (diagnostic) {
case DIAGNOSTIC_EXPECTED_END:
for (; len < vec_size(vec_last(read)->values); len++)
space += strlen(vec_last(read)->values[len]);
-
+
/* +/- 1 because of the ^ */
len = space - column - 1;
space = column + 1;
break;
-
+
case DIAGNOSTIC_EXPRESSION_CASE:
case DIAGNOSTIC_SEMICOLON:
for (; len < vec_size(vec_last(read)->values); len++)
space += strlen(vec_last(read)->values[len]);
-
+
len = 1;
space -= beg - end;
break;
-
+
case DIAGNOSTIC_EXPECTED:
/*
* use the column number here, it's the EASIEST method yet
space += column;
len = 0;
break;
-
+
+ case DIAGNOSTIC_UNEXPECTED_TOKEN:
+ len = column;
+ break;
+
case DIAGNOSTIC_UNEXPECTED_IDENT:
/*
* TODO: better way to determine the identifier. So far we
linebeg++;
marker = true;
break;
-
+
+ case DIAGNOSTIC_UNEXPECTED_TOKEN:
+ marker = false;
+ break;
+
case DIAGNOSTIC_UNEXPECTED_IDENT:
case DIAGNOSTIC_EXPECTED:
marker = true;
DIAGNOSTIC_SEMICOLON,
DIAGNOSTIC_EXPRESSION_CASE,
DIAGNOSTIC_UNEXPECTED_IDENT,
+ DIAGNOSTIC_UNEXPECTED_TOKEN,
DIAGNOSTIC_EXPECTED,
DIAGNOSTIC_EXPECTED_END
};
vec_push(sy->out, syexp(parser_ctx(parser), var));
return true;
}
- parseerror(parser, "unexpected token `%s`", parser_tokval(parser));
+ parser->diagnostic = DIAGNOSTIC_UNEXPECTED_TOKEN;
+ parseerror(parser, "unexpected token: `%s`", parser_tokval(parser));
return false;
}
}
else
{
+ parser->diagnostic = DIAGNOSTIC_UNEXPECTED_TOKEN;
parseerror(parser, "unexpected token: `%s`", parser->lex->tok.value);
return false;
}