space -= beg - end;
break;
+ case DIAGNOSTIC_UNEXPECTED_IDENT:
+ for (itr = 0; len < vec_size(vec_last(read)->tokens); len++) {
+ if (vec_last(read)->tokens[len] == TOKEN_IDENT)
+ break;
+ space += strlen(vec_last(read)->values[len]);
+ }
+ len = 0;
+ break;
+
default:
break;
}
marker = true;
break;
+ case DIAGNOSTIC_UNEXPECTED_IDENT:
+ marker = true;
+ break;
+
/* Catches the DIAGNOSTIC_NULL and out of range case */
default:
return;
enum {
DIAGNOSTIC_NULL,
DIAGNOSTIC_SEMICOLON,
- DIAGNOSTIC_EXPRESSION_CASE
+ DIAGNOSTIC_EXPRESSION_CASE,
+ DIAGNOSTIC_UNEXPECTED_IDENT
};
void diagnostic_destroy();
correct_free(&corr);
if (correct) {
+ parser->diagnostic = DIAGNOSTIC_UNEXPECTED_IDENT;
parseerror(parser, "unexpected ident: %s (did you mean %s?)", parser_tokval(parser), correct);
mem_d(correct);
return false;
}
}
+ parser->diagnostic = DIAGNOSTIC_UNEXPECTED_IDENT;
parseerror(parser, "unexpected ident: %s", parser_tokval(parser));
return false;
}
abort();
}
- /* skip directories */
if (S_ISDIR(directory.st_mode))
continue;