vec_push((*read), datas[feed]);
}
-static void diagnostic_feed(const char *file, size_t line, size_t beg, size_t end, bool marker, size_t diagnostic) {
+static void diagnostic_feed(const char *file, size_t line, size_t column, size_t beg, size_t end, bool marker, size_t diagnostic) {
diagnostic_data_t **read = NULL;
size_t feed = 0;
size_t space = 6;
space -= beg - end;
break;
+ case DIAGNOSTIC_EXPECTED:
+ /*
+ * use the column number here, it's the EASIEST method yet
+ * because it points to the exact space.
+ */
+ space += column;
+ len = 0;
+ break;
+
case DIAGNOSTIC_UNEXPECTED_IDENT:
for (itr = 0; len < vec_size(vec_last(read)->tokens); len++) {
if (vec_last(read)->tokens[len] == TOKEN_IDENT)
util_htrem(diagnostic_table, diagnostic_destory_data);
}
-void diagnostic_calculate(const char *file, size_t line, size_t diagnostic) {
+void diagnostic_calculate(const char *file, size_t line, size_t column, size_t diagnostic) {
size_t linebeg = 1;
size_t linecnt = 1;
bool marker = false;
marker = true;
break;
+ case DIAGNOSTIC_EXPECTED:
+ marker = true;
+ break;
+
case DIAGNOSTIC_UNEXPECTED_IDENT:
marker = true;
break;
return;
}
- diagnostic_feed(file, line, linebeg, linecnt, marker, diagnostic);
+ diagnostic_feed(file, line, column, linebeg, linecnt, marker, diagnostic);
}
DIAGNOSTIC_NULL,
DIAGNOSTIC_SEMICOLON,
DIAGNOSTIC_EXPRESSION_CASE,
- DIAGNOSTIC_UNEXPECTED_IDENT
+ DIAGNOSTIC_UNEXPECTED_IDENT,
+ DIAGNOSTIC_EXPECTED
};
void diagnostic_destroy();
-void diagnostic_calculate(const char *file, size_t line, size_t diagnostic);
+void diagnostic_calculate(const char *file, size_t line, size_t column, size_t diagnostic);
/*===================================================================*/
vcompile_error(parser->lex->tok.ctx, fmt, ap);
va_end(ap);
- diagnostic_calculate(parser->lex->name, parser->lex->line, parser->diagnostic);
+ diagnostic_calculate(parser->lex->name, parser->lex->line, parser->lex->column, parser->diagnostic);
}
/* returns true if it counts as an error */
r = vcompile_warning(parser->lex->tok.ctx, warntype, fmt, ap);
va_end(ap);
- diagnostic_calculate(parser->lex->name, parser->lex->line, parser->diagnostic);
+ diagnostic_calculate(parser->lex->name, parser->lex->line, parser->lex->column, parser->diagnostic);
return r;
}
parser_addglobal(parser, var->name, (ast_expression*)var);
if (!parser_next(parser)) {
+ parser->diagnostic = DIAGNOSTIC_EXPECTED;
parseerror(parser, "expected `=`, `}` or comma after identifier");
goto onerror;
}
if (parser->tok == '}')
break;
if (parser->tok != '=') {
+ parser->diagnostic = DIAGNOSTIC_EXPECTED;
parseerror(parser, "expected `=`, `}` or comma after identifier");
goto onerror;
}
goto failure;
}
- if (value && *value && (*value == ' ' || *value == '\t'))
+ if (value && (*value == ' ' || *value == '\t'))
value++;
/*
exit(EXIT_FAILURE);
vec_push(tmpl->comparematch, util_strdup(value));
+ printf("VALUE: %s\n", value);
break;
}
);
for (; d < vec_size(task_tasks[i].tmpl->comparematch); d++) {
char *select = task_tasks[i].tmpl->comparematch[d];
- size_t length = 40 - strlen(select);
+ size_t length = 60 - strlen(select);
con_out(" Expected: \"%s\"", select);
while (length --)
--- /dev/null
+enum { A B };
--- /dev/null
+I: expected.qc
+D: expected comma after identifier
+T: -diagnostic
+C: -std=gmqcc
+M: expected `=`, `}` or comma after identifier
+M: 1: enum { A B };
+M: ^