[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[augeas-devel] augeas: master - * src/jmt.c (print_grammar): recurse into L_REC if they are not rec_internal



Gitweb:        http://git.fedorahosted.org/git/augeas.git?p=augeas.git;a=commitdiff;h=f6efcbe9b36e30a58d558a88f868d3f97596b05a
Commit:        f6efcbe9b36e30a58d558a88f868d3f97596b05a
Parent:        4c35fdaf501a9ea88d8b37edc6e52d970019ed50
Author:        David Lutterkort <lutter redhat com>
AuthorDate:    Mon Jan 25 17:03:33 2010 -0800
Committer:     David Lutterkort <lutter redhat com>
CommitterDate: Mon Jan 25 18:06:10 2010 -0800

* src/jmt.c (print_grammar): recurse into L_REC if they are not rec_internal

---
 src/jmt.c |   23 +++++++++++++++--------
 1 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/src/jmt.c b/src/jmt.c
index 1cbba49..33119f4 100644
--- a/src/jmt.c
+++ b/src/jmt.c
@@ -1084,7 +1084,7 @@ static void print_grammar(struct jmt *jmt, struct lens *lens) {
     ind_t l = lens_index(jmt, lens);
     struct state *sA = lens_state(jmt, l);
 
-    if (sA == NULL || lens->tag == L_REC)
+    if (sA == NULL || (lens->tag == L_REC && lens->rec_internal))
         return;
 
     printf("  ");
@@ -1134,6 +1134,11 @@ static void print_grammar(struct jmt *jmt, struct lens *lens) {
         printf("?\n");
         print_grammar(jmt, lens->child);
         break;
+    case L_REC:
+        print_lens_symbol(stdout, jmt, lens->body);
+        printf("\n");
+        print_grammar(jmt, lens->body);
+        break;
     default:
         BUG_ON(true, jmt, "Unexpected lens tag %d", lens->tag);
         break;
@@ -1142,14 +1147,16 @@ static void print_grammar(struct jmt *jmt, struct lens *lens) {
     return;
 }
 
-static void print_grammar_top(struct jmt *jmt, struct lens *rec) {
+static void print_grammar_top(struct jmt *jmt, struct lens *lens) {
     printf("Grammar:\n");
-    printf("  ");
-    print_lens_symbol(stdout, jmt, rec);
-    printf(" := ");
-    print_lens_symbol(stdout, jmt, rec->body);
-    printf("\n");
-    print_grammar(jmt, rec->body);
+    print_grammar(jmt, lens);
+    if (lens->tag == L_REC) {
+        printf("  ");
+        print_lens_symbol(stdout, jmt, lens->alias);
+        printf(" := ");
+        print_lens_symbol(stdout, jmt, lens->alias->body);
+        printf("\n");
+    }
 }
 
 static void index_lenses(struct jmt *jmt, struct lens *lens) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]