# variables with the name 'nil' to be declared.
PREMISSIVE = false
+ # Enable enhanced diagnostic messages. i.e provides a "did you mean"
+ # <ident> when you accidently typo. Amongst others
+ ENHANCED_DIAGNOSTICS = true
+
# These are all the warnings, usually present via the -W prefix from
# the command line.
[warnings]
opts_set(opts.flags, FTEPP_PREDEFS, false);
opts_set(opts.flags, CORRECT_TERNARY, true);
opts_set(opts.flags, BAIL_ON_WERROR, true);
+ opts_set(opts.flags, ENHANCED_DIAGNOSTICS, true);
}
void opts_init(const char *output, int standard, size_t arraysize) {
GMQCC_DEFINE_FLAG(LOOP_LABELS)
GMQCC_DEFINE_FLAG(UNTYPED_NIL)
GMQCC_DEFINE_FLAG(PERMISSIVE)
+ GMQCC_DEFINE_FLAG(ENHANCED_DIAGNOSTICS)
#endif
/* warning flags */
* We should also consider adding correction tables for
* other things as well.
*/
- for (i = 0; i < vec_size(parser->correct_variables); i++) {
- correct = correct_str(parser->correct_variables[i], parser_tokval(parser));
- if (strcmp(correct, parser_tokval(parser))) {
- break;
- } else if (correct) {
- mem_d(correct);
+ if (OPTS_FLAG(ENHANCED_DIAGNOSTICS)) {
+ for (i = 0; i < vec_size(parser->correct_variables); i++) {
+ correct = correct_str(parser->correct_variables[i], parser_tokval(parser));
+ if (strcmp(correct, parser_tokval(parser))) {
+ break;
+ } else if (correct) {
+ mem_d(correct);
+ }
}
- }
- if (correct) {
- parseerror(parser, "unexpected ident: %s (did you mean %s?)", parser_tokval(parser), correct);
- mem_d(correct);
- } else {
- parseerror(parser, "unexpected ident: %s", parser_tokval(parser));
+ if (correct) {
+ parseerror(parser, "unexpected ident: %s (did you mean %s?)", parser_tokval(parser), correct);
+ mem_d(correct);
+ goto onerr;
+ }
}
-
+ parseerror(parser, "unexpected ident: %s", parser_tokval(parser));
goto onerr;
}
}