diff -r b0a43002dcac -r 41cb5b80416e absyntax/visitor.cc --- a/absyntax/visitor.cc Tue Oct 23 10:33:09 2007 +0200 +++ b/absyntax/visitor.cc Tue Oct 23 10:35:58 2007 +0200 @@ -72,12 +72,21 @@ #define SYM_REF0(class_name_c) \ void *null_visitor_c::visit(class_name_c *symbol) {return NULL;} +#define SYM_REF1(class_name_c, ref1) \ + void *null_visitor_c::visit(class_name_c *symbol) {return NULL;} + #define SYM_REF2(class_name_c, ref1, ref2) \ void *null_visitor_c::visit(class_name_c *symbol) {return NULL;} +#define SYM_REF3(class_name_c, ref1, ref2, ref3) \ + void *null_visitor_c::visit(class_name_c *symbol) {return NULL;} + #define SYM_REF4(class_name_c, ref1, ref2, ref3, ref4) \ void *null_visitor_c::visit(class_name_c *symbol) {return NULL;} +#define SYM_REF5(class_name_c, ref1, ref2, ref3, ref4, ref5) \ + void *null_visitor_c::visit(class_name_c *symbol) {return NULL;} + #define SYM_REF6(class_name_c, ref1, ref2, ref3, ref4, ref5, ref6) \ void *null_visitor_c::visit(class_name_c *symbol) {return NULL;} @@ -90,8 +99,11 @@ #undef SYM_LIST #undef SYM_TOKEN #undef SYM_REF0 +#undef SYM_REF1 #undef SYM_REF2 +#undef SYM_REF3 #undef SYM_REF4 +#undef SYM_REF5 #undef SYM_REF6 @@ -123,6 +135,12 @@ #define SYM_REF0(class_name_c) \ void *iterator_visitor_c::visit(class_name_c *symbol) {return NULL;} +#define SYM_REF1(class_name_c, ref1) \ +void *iterator_visitor_c::visit(class_name_c *symbol) { \ + if (symbol->ref1!=NULL) symbol->ref1->accept(*this); \ + return NULL; \ +} + #define SYM_REF2(class_name_c, ref1, ref2) \ void *iterator_visitor_c::visit(class_name_c *symbol) { \ if (symbol->ref1!=NULL) symbol->ref1->accept(*this); \ @@ -130,6 +148,14 @@ return NULL; \ } +#define SYM_REF3(class_name_c, ref1, ref2, ref3) \ +void *iterator_visitor_c::visit(class_name_c *symbol) { \ + if (symbol->ref1) symbol->ref1->accept(*this); \ + if (symbol->ref2) symbol->ref2->accept(*this); \ + if (symbol->ref3) symbol->ref3->accept(*this); \ + return NULL; \ +} + #define SYM_REF4(class_name_c, ref1, ref2, ref3, ref4) \ void *iterator_visitor_c::visit(class_name_c *symbol) { \ if (symbol->ref1) symbol->ref1->accept(*this); \ @@ -139,6 +165,15 @@ return NULL; \ } +#define SYM_REF5(class_name_c, ref1, ref2, ref3, ref4, ref5) \ +void *iterator_visitor_c::visit(class_name_c *symbol) { \ + if (symbol->ref1) symbol->ref1->accept(*this); \ + if (symbol->ref2) symbol->ref2->accept(*this); \ + if (symbol->ref3) symbol->ref3->accept(*this); \ + if (symbol->ref4) symbol->ref4->accept(*this); \ + if (symbol->ref5) symbol->ref5->accept(*this); \ + return NULL; \ +} #define SYM_REF6(class_name_c, ref1, ref2, ref3, ref4, ref5, ref6) \ void *iterator_visitor_c::visit(class_name_c *symbol) { \ @@ -160,8 +195,11 @@ #undef SYM_LIST #undef SYM_TOKEN #undef SYM_REF0 +#undef SYM_REF1 #undef SYM_REF2 +#undef SYM_REF3 #undef SYM_REF4 +#undef SYM_REF5 #undef SYM_REF6 @@ -199,6 +237,12 @@ #define SYM_REF0(class_name_c) \ void *search_visitor_c::visit(class_name_c *symbol) {return NULL;} +#define SYM_REF1(class_name_c, ref1) \ +void *search_visitor_c::visit(class_name_c *symbol) { \ + if (symbol->ref1) return symbol->ref1->accept(*this); \ + return NULL; \ +} + #define SYM_REF2(class_name_c, ref1, ref2) \ void *search_visitor_c::visit(class_name_c *symbol) { \ void *res = NULL; \ @@ -208,6 +252,17 @@ return NULL; \ } +#define SYM_REF3(class_name_c, ref1, ref2, ref3) \ +void *search_visitor_c::visit(class_name_c *symbol) { \ + void *res = NULL; \ + if (symbol->ref1) res = symbol->ref1->accept(*this); \ + if (res != NULL) return res; \ + if (symbol->ref2) res = symbol->ref2->accept(*this); \ + if (res != NULL) return res; \ + if (symbol->ref3) return symbol->ref3->accept(*this); \ + return NULL; \ +} + #define SYM_REF4(class_name_c, ref1, ref2, ref3, ref4) \ void *search_visitor_c::visit(class_name_c *symbol) { \ void *res = NULL; \ @@ -221,6 +276,20 @@ return NULL; \ } +#define SYM_REF5(class_name_c, ref1, ref2, ref3, ref4, ref5) \ +void *search_visitor_c::visit(class_name_c *symbol) { \ + void *res = NULL; \ + if (symbol->ref1) res = symbol->ref1->accept(*this); \ + if (res != NULL) return res; \ + if (symbol->ref2) res = symbol->ref2->accept(*this); \ + if (res != NULL) return res; \ + if (symbol->ref3) res = symbol->ref3->accept(*this); \ + if (res != NULL) return res; \ + if (symbol->ref4) res = symbol->ref4->accept(*this); \ + if (res != NULL) return res; \ + if (symbol->ref5) return symbol->ref5->accept(*this); \ + return NULL; \ +} #define SYM_REF6(class_name_c, ref1, ref2, ref3, ref4, ref5, ref6) \ void *search_visitor_c::visit(class_name_c *symbol) { \ @@ -248,8 +317,11 @@ #undef SYM_LIST #undef SYM_TOKEN #undef SYM_REF0 +#undef SYM_REF1 #undef SYM_REF2 +#undef SYM_REF3 #undef SYM_REF4 +#undef SYM_REF5 #undef SYM_REF6