ht *typedefs;
/* same as above but for the spelling corrector */
- ht *correct_variables;
- size_t ***correct_variables_score; /* vector of vector of size_t* */
+ correct_trie_t **correct_variables;
+ size_t ***correct_variables_score; /* vector of vector of size_t* */
/* not to be used directly, we use the hash table */
ast_expression **_locals;
* 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;
}
}
vec_push(parser->_block_ctx, parser_ctx(parser));
/* corrector */
- vec_push(parser->correct_variables, util_htnew(PARSER_HT_SIZE));
+ vec_push(parser->correct_variables, correct_trie_new());
vec_push(parser->correct_variables_score, NULL);
}
ast_delete(cond);
return false;
}
+ if (!ontrue)
+ ontrue = (ast_expression*)ast_block_new(parser_ctx(parser));
/* check for an else */
if (!strcmp(parser_tokval(parser), "else")) {
/* parse into the 'else' branch */