summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog16
-rw-r--r--lib.c2
-rw-r--r--match.c8
-rw-r--r--regex.c14
-rw-r--r--regex.h6
-rw-r--r--stream.c12
-rw-r--r--txr.12
-rw-r--r--txr.c2
8 files changed, 38 insertions, 24 deletions
diff --git a/ChangeLog b/ChangeLog
index 0e8be57b..756dbdb6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
2009-10-22 Kaz Kylheku <kkylheku@gmail.com>
+ Version 019
+
+ Regexps can be bound to variables.
+
+ New freeform directive.
+
+ * txr.c (version): Bump.
+ * txr.1: Bump version and date.
+
+ * lib.c, match.c, regex.c, regex.h, stream.c: Trailing whitespace
+ removed from lines.
+
+2009-10-22 Kaz Kylheku <kkylheku@gmail.com>
+
* txr.1: Documented freeform.
2009-10-21 Kaz Kylheku <kkylheku@gmail.com>
@@ -80,7 +94,7 @@
* lib.h (type_t): New enum member LSTR, for lazy strings.
(lstr_t, freestyle, type_check3, string_own): Declared.
(string): Parameter changed to const char *.
- (lazy_stringp, split_str, lazy_str, lazy_str_force_upto,
+ (lazy_stringp, split_str, lazy_str, lazy_str_force_upto,
lazy_str_force, lazy_str_get_trailing_list, length_str_gt,
length_str_ge, length_str_lt, length_str_le): Declared.
diff --git a/lib.c b/lib.c
index 8ca4c820..7bf5fb32 100644
--- a/lib.c
+++ b/lib.c
@@ -1404,7 +1404,7 @@ obj_t *lazy_str_force_upto(obj_t *lstr, obj_t *index)
type_check(lstr, LSTR);
lim = cdr(lstr->ls.opts);
- while (gt(index, length_str(lstr->ls.prefix)) && lstr->ls.list &&
+ while (gt(index, length_str(lstr->ls.prefix)) && lstr->ls.list &&
or2(nullp(lim),gt(lim,zero)))
{
obj_t *next = pop(&lstr->ls.list);
diff --git a/match.c b/match.c
index 3df2c08a..15e98a08 100644
--- a/match.c
+++ b/match.c
@@ -888,7 +888,7 @@ obj_t *match_files(obj_t *spec, obj_t *files,
obj_t *first_spec_item = second(first(spec));
if (consp(first_spec_item) && eq(first(first_spec_item), next)) {
- debugf("not opening source ~a since query starts with next directive",
+ debugf("not opening source ~a since query starts with next directive",
name, nao);
} else {
debugf("opening data source ~a", name, nao);
@@ -983,8 +983,8 @@ repeat_spec_same_data:
}
} else if (sym == freeform) {
obj_t *args = rest(first_spec);
- obj_t *vals = mapcar(func_n1(cdr),
- mapcar(bind2other(func_n2(eval_form),
+ obj_t *vals = mapcar(func_n1(cdr),
+ mapcar(bind2other(func_n2(eval_form),
bindings), args));
if ((spec = rest(spec)) == nil) {
@@ -1063,7 +1063,7 @@ repeat_spec_same_data:
else if (eq(first(source), args)) {
obj_t *input_name = string("args");
cons_bind (new_bindings, success,
- match_files(spec, cons(input_name, files),
+ match_files(spec, cons(input_name, files),
bindings, files, one));
if (success)
return cons(new_bindings,
diff --git a/regex.c b/regex.c
index 3ea69eef..630bb012 100644
--- a/regex.c
+++ b/regex.c
@@ -195,7 +195,7 @@ nfa_t nfa_make(nfa_state_t *s, nfa_state_t *acc)
}
/*
- * Combine two NFA's representing regexps that are catenated.
+ * Combine two NFA's representing regexps that are catenated.
* The acceptance state of the predecessor is merged with the start state of
* the successor.
*/
@@ -329,7 +329,7 @@ nfa_t nfa_compile_regex(obj_t *items)
}
return nfa;
- }
+ }
}
int nfa_all_states(nfa_state_t **inout, int num, int visited)
@@ -410,7 +410,7 @@ void nfa_free(nfa_t nfa)
* states which are reachable from that set with empty (epsilon) transitions.
* (Transitions that don't do not consume and match an input character).
*/
-int nfa_closure(nfa_state_t **stack, nfa_state_t **in, int nin,
+int nfa_closure(nfa_state_t **stack, nfa_state_t **in, int nin,
nfa_state_t **out, int visited, int *accept)
{
int i, nout = 0;
@@ -495,7 +495,7 @@ int nfa_move(nfa_state_t **in, int nin, nfa_state_t **out, int ch)
}
/* The state matches the character, so add it to the move set.
- C trick: all character-transitioning state types have the
+ C trick: all character-transitioning state types have the
pointer to the next state in the same position,
among a common set of leading struct members in the union. */
@@ -516,7 +516,7 @@ int nfa_move(nfa_state_t **in, int nin, nfa_state_t **out, int ch)
* Returns the length of the prefix of the string
* which matches the regex. Or, if you will,
* the position of the first mismatching
- * character.
+ * character.
*
* If the regex does not match at all, zero is
* returned.
@@ -565,7 +565,7 @@ long nfa_run(nfa_t nfa, const char *str)
free(stack);
free(clos);
free(move);
-
+
return last_accept_pos ? last_accept_pos - str : -1;
}
@@ -590,7 +590,7 @@ void nfa_machine_reset(nfa_machine_t *nfam)
nfam->move[0] = nfam->nfa.start;
- nfam->nclos = nfa_closure(nfam->stack, nfam->move, nfam->nmove,
+ nfam->nclos = nfa_closure(nfam->stack, nfam->move, nfam->nmove,
nfam->clos, nfam->visited++, &accept);
if (accept)
diff --git a/regex.h b/regex.h
index c69180d7..873682a4 100644
--- a/regex.h
+++ b/regex.h
@@ -42,8 +42,8 @@ void char_set_add(char_set_t *, int);
void char_set_add_range(char_set_t *, int, int); /* inclusive */
int char_set_contains(char_set_t *, int);
-typedef enum {
- nfa_accept, nfa_empty, nfa_wild, nfa_single, nfa_set
+typedef enum {
+ nfa_accept, nfa_empty, nfa_wild, nfa_single, nfa_set
} nfa_kind_t;
typedef union nfa_state nfa_state_t;
@@ -95,7 +95,7 @@ typedef struct nfa {
nfa_state_t *accept;
} nfa_t;
-typedef enum nfam_result {
+typedef enum nfam_result {
NFAM_INCOMPLETE, NFAM_FAIL, NFAM_MATCH
} nfam_result_t;
diff --git a/stream.c b/stream.c
index 90932b0e..6379649e 100644
--- a/stream.c
+++ b/stream.c
@@ -300,7 +300,7 @@ static void string_out_stream_destroy(obj_t *stream)
static obj_t *string_out_put_string(obj_t *stream, const char *s)
{
struct string_output *so = (struct string_output *) stream->co.handle;
-
+
if (so == 0) {
return nil;
} else {
@@ -335,12 +335,12 @@ static obj_t *string_out_put_char(obj_t *stream, int ch)
obj_t *string_out_vcformat(obj_t *stream, const char *fmt, va_list vl)
{
struct string_output *so = (struct string_output *) stream->co.handle;
-
+
if (so == 0) {
return nil;
} else {
int nchars, nchars2;
- char dummy_buf[1];
+ char dummy_buf[1];
size_t old_size = so->size;
size_t required_size;
va_list vl_copy;
@@ -353,7 +353,7 @@ obj_t *string_out_vcformat(obj_t *stream, const char *fmt, va_list vl)
vl_copy = vl;
#endif
- nchars = vsnprintf(dummy_buf, 0, fmt, vl_copy);
+ nchars = vsnprintf(dummy_buf, 0, fmt, vl_copy);
#if defined va_copy || defined __va_copy
va_end (vl_copy);
@@ -373,11 +373,11 @@ obj_t *string_out_vcformat(obj_t *stream, const char *fmt, va_list vl)
}
so->buf = chk_realloc(so->buf, so->size);
- nchars2 = vsnprintf(so->buf + so->fill, so->size-so->fill, fmt, vl);
+ nchars2 = vsnprintf(so->buf + so->fill, so->size-so->fill, fmt, vl);
bug_unless (nchars == nchars2);
so->fill += nchars;
return t;
- }
+ }
}
static struct strm_ops string_out_ops = {
diff --git a/txr.1 b/txr.1
index b0989c05..57adbb64 100644
--- a/txr.1
+++ b/txr.1
@@ -21,7 +21,7 @@
.\"IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
.\"WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-.TH txr 1 2009-10-17 "txr v. 018" "Text Extraction Utility"
+.TH txr 1 2009-10-17 "txr v. 019" "Text Extraction Utility"
.SH NAME
txr \- text extractor
.SH SYNOPSIS
diff --git a/txr.c b/txr.c
index 56032e6f..b2097b82 100644
--- a/txr.c
+++ b/txr.c
@@ -39,7 +39,7 @@
#include "match.h"
#include "txr.h"
-const char *version = "018";
+const char *version = "019";
const char *progname = "txr";
const char *spec_file = "stdin";
obj_t *spec_file_str;