| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
2011-09-28 commit which introduced the double var match.
* match.c (match_line): Handle case where modifier is t.
* parser.y (var_op): Produce modifir as (t) rather than t.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* match.c (choose_s, longest_k, shortest_k): New variables.
(match_line, match_files): Introduced choose directive.
(match_init): Initialize new variables.
* match.h (choose_s): Declared.
* parser.l (yybadtoken): Handle CHOOSE.
(CHOOSE): Clause added for returning this token.
* parser.y: Added #include "match.h".
(CHOOSE): New token symbol.
(choose_clause): New nonterminal symbol.
(clause): choose_clause added.
(all_clause, some_clause, none_clause, maybe_clause,
cases_clause): Abstract syntax tree tweaked.
(choose_clause): New syntax.
(elem): Abstract syntax trees tweaked for many clauses.
New CHOOSE clauses.
(out_clause): New error case for choose_clause.
|
|
|
|
|
|
|
|
|
|
| |
none, maybe and cases directives.
(match_files): Recognize horizontal version of these directives
by the presence of the extra symbol t and do not process.
Also, bugfix in the all directive: not resetting the
all_match flag when short circuiting out.
* parser.y (clause_parts_h, additional_parts_h): New nonterminals.
(elem): New clauses added.
|
|
|
|
|
|
|
|
|
|
|
|
| |
(match_line): Keyword arguments in coll implemented.
(match_init): chars_k variable initialized.
* parser.l (COLL): Lexical syntax changed to allow for
argument material.
* parser.y (elem): Coll syntax rewritten for arguments.
* txr.1: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
symbol variables.
(match_lines): Keyword arguments in collect implemented.
(match_init): New function.
* match.h (match_init): Declared.
* parser.l (COLLECT): Lexical syntax changed for COLLECT to
allow for argument material.
* parser.y (%union): obj renamed to val.
(exprs_opt): New nonterminal.
(collect_clause): Rewritten for arguments.
* txr.c (main): Call to match_init introduced.
|
|
|
|
| |
prepend the next_pat to the specline if it is nil.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
regex variables which also have nested variables.
Previously this code was assuming that the cases were
mutually exclusive, and the parser happened to work that way.
Also, added support for a "double var" match which occurs
when an unbound variable is followed by a regex variable.
This case should be allowed because it makes sense.
It's similar to a variable followed by a regex, except
that the regex is also a variable binding.
* parser.y (o_elems_transform): New function.
(o_elems_opt, o_elems_opt2, quasilit): Transform o_elems with new
function. This is needed because subst_vars doesn't
deal with the nested var syntax for consecutive variables.
(var): New syntax case '{' IDENT exprs '}' elem. This
allows consecutive variables to be nested in all cases.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The test for !data should be done after matching,
before incrementing to the next line. Then it is a true
bottom of the loop test. This commit allows
@(skip)
@first_line
@(skip nil 3)
@(eof)
to correctly match the first line of the input, not
the fourth one from the bottom, since the
second skip has an unbounded range.
|
|
|
|
|
|
|
| |
If a hard skip tries to go beyond EOF, then the query
must fail. However, a skip to exactly EOF is fine.
I.e. data can hit nil at the same time as the right
number of skip iterations is performed.
|
|
|
|
|
|
|
|
|
|
|
|
| |
We should try the match at least once even if there is no data
after a hard skip, so that the query has an opportunity
to do an explicit match for no data, as with @(endp).
This commit makes possible queries like:
@fourth_line_from_bottom
@(skip 1 3)
@(eof)
This query depends on @(skip 1 3) not failing when
it runs out of data, because @(eof) checks for htis.
|
|
|
|
|
|
|
|
|
|
|
| |
(obj_init): New variable initialized.
* lib.h (eof_s): Declared.
* match.c (match_files): New @(eof) directive explicitly
matches end of data.
* txr.1: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
chr function inlined.
* filter.c (trie_value_at, trie_lookup_feed_char): Handle function
case.
(build_filter): New parameter, compress_p.
(html_hex_continue, html_hex_handler): New functions.
(filter_init): Add a function-based node to the from_html trie.
* lib.c (chr): Function removed.
(functionp) New function.
* lib.h (chr): Declaration replaced with inline function.
(functionp): Declared.
* match.c (format_field): Bugfix: failed to apply filter
that came in as an argument.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Bugfix in @(throw) when non-symbol is thrown: exception message
referred to the symbol throw rather than the erroneous object.
* filter.c (build_filter_from_list, register_filter): New functions.
* filter.h (register_filter): New function declared.
* lib.c (deffilter_s): New variable defined.
(chain): Function changed from single list argument to variable
argument list to reduce the complexity of use.
(do_and, and): New functions.
(obj_init): deffilter_s initializatio added.
* lib.h (deffilter_s, and): New declarations.
(chain): Declaration updated to new function signature.
(eq): Changed from macro to inline function.
* match.c (do_output_line): Simplified expression involving chain.
(do_output): Likewise.
(match_files): Bugfix in error handling of throw.
Implementation of deffilter.
* txr.1: Documented deffilter.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* filter.c, filter.h: New files.
* Makefile (OBJS): filter.o added.
* gc.c (mark_obj): Mark new alloc field of string objets.
* hash.c (struct hash): New member, userdata.
(hash_mark): Mark new userdata member of hash.
(make_hash): Initialize userdata.
(get_hash_userdata, set_hash_userdata, hashp): New functions.
* hash.h (get_hash_userdata, set_hash_userdata, hashp): New functions
declared.
* lib.c (getplist, string_extend, cobjp): New functions.
(string_own, string, string_utf8): Initialize new alloc field to nil.
(mkstring, mkustring): Initialize new alloc field to actual size.
(length_str): When length is computed and cached, also compute
and cache alloc.
(init): Call filter_init.
* lib.h (string string): New member, alloc.
(num_fast): Macro converted to inline function.
(getplist, string_extend, cobjp): New functions declared.
* match.c (match_line): Follows change of modifier s-exp syntax.
(format_field): New parameter, filter.
New modifier syntax parsed. Filter retrieved, and applied.
(subst_vars): New parameter, filter. Filter is either applied
in this function or passed to format_field, as needed.
(eval_form): Pass nil to new parameter of subst_vars.
(do_output_line): New parameter, filter. Passed down to subst_vars.
(do_output): New parameter, filter. Passed down to do_output_line.
(match_files): Pass nil filter to subst_vars in cat directive.
Output directive refactored to parse keywords, extract the
filter and pass down to do_output.
* parser.y (regex): Generate (sys:regex regex syntax ...)
instead of (regex syntax ...).
(elem, expr): Updated w.r.t. regex syntax change.
(var): Cases '{' IDENT regex '}' and '{' IDENT NUMBER '}'
are removed. new syntax '{' IDENT exprs '}' to handle these
more generally and allow for keywords.
* txr.1: Updated.
|
|
|
|
|
|
| |
lib.h, match.c, match.h, parser.h, parser.l, parser.y, regex.c,
regex.h, stream.c, stream.h, txr.1, txr.c, txr.h, unwind.c, unwind.h,
utf8.c, utf8.h: Updated copyright year.
|
|
|
|
|
|
| |
Leading :nothrow with trailing material is an error now.
* txr.1: Updated. Made note of errors in pipes being asynchronous.
|
|
|
|
| |
features. Support for obsolescent @(next) syntax is gone.
|
|
|
|
|
|
| |
* match.c (match_files): Added a couple of break statements.
* txr.1: Updated.
|
|
|
|
|
|
|
|
| |
a minimum number of lines.
* match.c (match_files): New behavior in skip_s case.
* txr.1: Documented.
|
| |
|
|
|
|
|
| |
lines to match must fail. Extra data lines relative to the spec
are tolerated; extra spec lines unmet by data aren't.
|
|
|
|
|
|
|
|
|
|
| |
If the virtual line is partially matched, the remainder of
the line is folded back into list form. In this case, the
data line number must be incremented. Otherwise the calling
context may conclude that no progress was made, and
skip a line of input. I.e. the unmatched part of the input
is a new line, even if there had originally
been no line break at that point.
|
| |
|
|
|
|
| |
in a code path where it sometimes isn't.
|
|
|
|
|
|
|
| |
discovered on Red Hat EL 4 with gcc 3.4.3.
In the collect loop, set car(success) to nil.
Somehow the generated code hangs on to the last
matching position for a regex, preventing GC.
|
|
|
|
|
|
| |
on 32 bit x86 Fedora. This happens because the lazy list variable
``data'' in the match_files function is optimized to a register,
but a stale value of that variable persists in the backing storage.
|
|
|
|
| |
variable.
|
| |
|
| |
|
|
|
|
| |
in regex module not exposed in header. Etc.
|
| |
|
|
|
|
| |
can be taken advantage of for better diagnostics.
|
|
|
|
| |
have a _s suffix.
|
|
|
|
|
|
|
|
| |
can be converted to a type long and vice versa. The configure
script tries to detect the appropriate type to use. Also,
some run-time checking is performed in the streams module
to detect which conversions specifier strings to use for
printing numbers.
|
|
|
|
|
|
|
|
|
|
| |
a system package instead of being hacked with the $ prefix.
Keyword symbols are provided. In the matcher, evaluation
is tightened up. Keywords, nil and t are not bindeable, and
errors are thrown if attempts are made to bind them.
Destructuring in dest_bind is strict in the number of items.
String streams are exploited to print bindings to objects
that are not strings or characters. Numerous bugfixes.
|
|
|
|
|
|
| |
we have an unhandled exception too early in initialization.
Use C stream to print an error message and abort.
Using the nil stream variable will just cause a recursion bomb.
|
|
|
|
|
|
|
| |
by using eval_form rather than direct symbol binding lookups.
False positive return fixed.
(match_line): Fixed merge to use eval_from
rather than direct symbol binding.
|
|
|
|
|
| |
we wouldn't have to declare object variables at all, so why
use an obtuse syntax to do so?)
|
|
|
|
| |
that doesn't match anything.
|
|
|
|
| |
of standard conformance.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
abstraction instead of directly using C standard I/O,
to eliminate most uses of C formatted I/O,
and fix numerous bugs, such variadic argument lists which
lack a terminating ``nao'' sentinel.
Bug 28033 is addressed by this patch, since streams no longer provide
printf-compatible formatting. The native formatter is extended with
some additional capabilities to take over.
The work on literal objects is expanded and they are now used
throughout the code base.
Fixed bad realloc in string output stream: reallocating by number
of wide chars rather than bytes.
|
|
|
|
|
| |
use wide character functions so that there is no illicit
mixing. (But the goal is to replace this usage with txr streams).
|
|
|
|
|
|
|
|
|
| |
This is incomplete. There are too many dependencies on
wide character support from the C stream I/O library,
and implicit use of some encoding which may not be UTF-8.
The regex code does not handle wide characters properly.
Character type is still int in some places, rather than wchar_t.
Test suite passes though.
|
|
|
|
|
|
|
|
| |
unboxed. If the lowest bit of the obj_t * pointer is 1, then
the remaining bits are a number. A lot of assumptions are made:
- the long type can be converted to and from a pointer
- two's complement.
- behavior of << and >> operators when the sign bit is involved.
|
|
|
|
|
|
| |
is needed for pipes that terminate abnormally or return failed
termination. Pipe and stdio streams have an extra description field
so they are printed in a readable way.
|
|
|
|
|
|
| |
Regexps can be bound to variables.
New freeform directive.
|
|
|
|
| |
rather than separation.
|
|
|
|
| |
Bugfixes.
|