diff options
-rw-r--r-- | ChangeLog | 22 | ||||
-rw-r--r-- | match.c | 22 |
2 files changed, 32 insertions, 12 deletions
@@ -1,3 +1,25 @@ +2011-11-14 Kaz Kylheku <kaz@kylheku.com> + + Bugfix: horizontal directives were being treated as vertical, + and the trailing material silently ignored. + For instance @(bind a 1)@(bind b 2). This was going to v_bind, + v_bind does not check for the trailing material and doe snot + call decline_s. The result was that b was not bound. + Correct behavior is to process these binds in match_line. + + * match.c (match_line): Check if a directive IS found in the vertical + table, and if so report a different error message. The fallback + case is that there is no such function or directive. + (v_next): Do not check for obsolete syntax any more. This case + will not occur any more due to the following changes. + (match_files): Do not defer opening the file if the data starts + with an incorrectly written next directive. + Do not look up and process a vertical directive or function + call if it is followed by more material in the same line. + Thus vertical directives can longer receive trailing material. + This fixes the bug of horizontal directives being treated as + vertical + 2011-11-13 Kaz Kylheku <kaz@kylheku.com> * debug.c (debug): Eliminated duplicate code. @@ -1052,7 +1052,12 @@ static val match_line(match_line_ctx c) c = nc; continue; } else if (result == decline_k) { - sem_error(elem, lit("unknown directive: ~a"), directive, nao); + if (gethash(v_directive_table, directive)) + sem_error(elem, lit("~a only exists as a vertical directive"), + directive, nao); + else + sem_error(elem, lit("no such function or directive: ~a"), + directive, nao); } else { return result; } @@ -1752,13 +1757,6 @@ static val v_next(match_files_ctx *c) { spec_bind (specline, first_spec, c->spec); - if (rest(first_spec) && rest(specline)) - sem_error(specline, lit("invalid combination of old " - "and new next syntax"), nao); - if (rest(specline)) { - sem_error(specline, lit("obsolete next syntax: trailing material"), nao); - } - if ((c->spec = rest(c->spec)) == nil) return cons(c->bindings, cons(c->data, c->data_lineno)); @@ -2945,10 +2943,10 @@ static val match_files(match_files_ctx c) val source_spec = first(c.files); val name = consp(source_spec) ? cdr(source_spec) : source_spec; fpip_t fp = (errno = 0, complex_open(name, nil, nil)); - val first_spec_item = first(first(c.spec)); + spec_bind (specline, first_spec, c.spec); - if (consp(first_spec_item) && eq(first(first_spec_item), next_s)) { - debuglf(first_spec_item, lit("not opening source ~a " + if (consp(first_spec) && eq(first(first_spec), next_s) && !rest(specline)) { + debuglf(first_spec, lit("not opening source ~a " "since query starts with next directive"), name, nao); } else { val spec = first(c.spec); @@ -2983,7 +2981,7 @@ repeat_spec_same_data: { spec_bind (specline, first_spec, c.spec); - if (consp(first_spec)) { + if (consp(first_spec) && !rest(specline)) { val sym = first(first_spec); val entry = gethash(v_directive_table, sym); |