[augeas-devel] augeas: master - * src/lens.c (ambig_check): distinguish error between concat and iteration

David Lutterkort lutter at fedoraproject.org
Fri Nov 13 19:26:56 UTC 2009


Gitweb:        http://git.fedorahosted.org/git/augeas.git?p=augeas.git;a=commitdiff;h=f4c87e3bf9518720227f097149beeba93dcfa9d1
Commit:        f4c87e3bf9518720227f097149beeba93dcfa9d1
Parent:        a2666e3fb5b0c976735d98f696ca5aeb13edd763
Author:        David Lutterkort <lutter at redhat.com>
AuthorDate:    Thu Nov 12 15:15:40 2009 -0800
Committer:     David Lutterkort <lutter at redhat.com>
CommitterDate: Fri Nov 13 10:46:24 2009 -0800

* src/lens.c (ambig_check): distinguish error between concat and iteration

---
 src/lens.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/lens.c b/src/lens.c
index f1f52e2..723d8f1 100644
--- a/src/lens.c
+++ b/src/lens.c
@@ -502,7 +502,7 @@ static struct value *typecheck_union(struct info *info,
 static struct value *ambig_check(struct info *info,
                                  struct fa *fa1, struct fa *fa2,
                                  struct regexp *r1, struct regexp *r2,
-                                 const char *msg) {
+                                 const char *msg, bool iterated) {
     char *upv, *pv, *v;
     size_t upv_len;
     fa_ambig_example(fa1, fa2, &upv, &upv_len, &pv, &v);
@@ -517,8 +517,12 @@ static struct value *ambig_check(struct info *info,
         char *s1 = regexp_escape(r1);
         char *s2 = regexp_escape(r2);
         exn = make_exn_value(ref(info), "%s", msg);
-        exn_printf_line(exn, "  First regexp: /%s/", s1);
-        exn_printf_line(exn, "  Second regexp: /%s/", s2);
+        if (iterated) {
+            exn_printf_line(exn, "  Iterated regexp: /%s/", s1);
+        } else {
+            exn_printf_line(exn, "  First regexp: /%s/", s1);
+            exn_printf_line(exn, "  Second regexp: /%s/", s2);
+        }
         exn_printf_line(exn, "  '%s' can be split into", e_upv);
         exn_printf_line(exn, "  '%s|=|%s'\n", e_u, e_pv);
         exn_printf_line(exn, " and");
@@ -549,7 +553,7 @@ static struct value *ambig_concat_check(struct info *info, const char *msg,
     if (result != NULL)
         goto done;
 
-    result = ambig_check(info, fa1, fa2, r1, r2, msg);
+    result = ambig_check(info, fa1, fa2, r1, r2, msg, false);
  done:
     fa_free(fa1);
     fa_free(fa2);
@@ -588,7 +592,7 @@ static struct value *ambig_iter_check(struct info *info, const char *msg,
 
     fas = fa_iter(fa, 0, -1);
 
-    result = ambig_check(info, fa, fas, r, r, msg);
+    result = ambig_check(info, fa, fas, r, r, msg, true);
 
  done:
     fa_free(fa);




More information about the augeas-devel mailing list