absyntax/visitor.cc
changeset 69 41cb5b80416e
parent 0 fb772792efd1
child 261 db2ad6541d92
equal deleted inserted replaced
68:b0a43002dcac 69:41cb5b80416e
    70   void *null_visitor_c::visit(class_name_c *symbol) {return NULL;}
    70   void *null_visitor_c::visit(class_name_c *symbol) {return NULL;}
    71 
    71 
    72 #define SYM_REF0(class_name_c)	\
    72 #define SYM_REF0(class_name_c)	\
    73   void *null_visitor_c::visit(class_name_c *symbol) {return NULL;}
    73   void *null_visitor_c::visit(class_name_c *symbol) {return NULL;}
    74 
    74 
       
    75 #define SYM_REF1(class_name_c, ref1)	\
       
    76   void *null_visitor_c::visit(class_name_c *symbol) {return NULL;}
       
    77 
    75 #define SYM_REF2(class_name_c, ref1, ref2)	\
    78 #define SYM_REF2(class_name_c, ref1, ref2)	\
    76   void *null_visitor_c::visit(class_name_c *symbol) {return NULL;}
    79   void *null_visitor_c::visit(class_name_c *symbol) {return NULL;}
    77 
    80 
       
    81 #define SYM_REF3(class_name_c, ref1, ref2, ref3)	\
       
    82   void *null_visitor_c::visit(class_name_c *symbol) {return NULL;}
       
    83 
    78 #define SYM_REF4(class_name_c, ref1, ref2, ref3, ref4)	\
    84 #define SYM_REF4(class_name_c, ref1, ref2, ref3, ref4)	\
       
    85   void *null_visitor_c::visit(class_name_c *symbol) {return NULL;}
       
    86 
       
    87 #define SYM_REF5(class_name_c, ref1, ref2, ref3, ref4, ref5)	\
    79   void *null_visitor_c::visit(class_name_c *symbol) {return NULL;}
    88   void *null_visitor_c::visit(class_name_c *symbol) {return NULL;}
    80 
    89 
    81 #define SYM_REF6(class_name_c, ref1, ref2, ref3, ref4, ref5, ref6)	\
    90 #define SYM_REF6(class_name_c, ref1, ref2, ref3, ref4, ref5, ref6)	\
    82   void *null_visitor_c::visit(class_name_c *symbol) {return NULL;}
    91   void *null_visitor_c::visit(class_name_c *symbol) {return NULL;}
    83 
    92 
    88 
    97 
    89 
    98 
    90 #undef SYM_LIST
    99 #undef SYM_LIST
    91 #undef SYM_TOKEN
   100 #undef SYM_TOKEN
    92 #undef SYM_REF0
   101 #undef SYM_REF0
       
   102 #undef SYM_REF1
    93 #undef SYM_REF2
   103 #undef SYM_REF2
       
   104 #undef SYM_REF3
    94 #undef SYM_REF4
   105 #undef SYM_REF4
       
   106 #undef SYM_REF5
    95 #undef SYM_REF6
   107 #undef SYM_REF6
    96 
   108 
    97 
   109 
    98 
   110 
    99 
   111 
   121   void *iterator_visitor_c::visit(class_name_c *symbol) {return NULL;}
   133   void *iterator_visitor_c::visit(class_name_c *symbol) {return NULL;}
   122 
   134 
   123 #define SYM_REF0(class_name_c)	\
   135 #define SYM_REF0(class_name_c)	\
   124   void *iterator_visitor_c::visit(class_name_c *symbol) {return NULL;}
   136   void *iterator_visitor_c::visit(class_name_c *symbol) {return NULL;}
   125 
   137 
       
   138 #define SYM_REF1(class_name_c, ref1)			\
       
   139 void *iterator_visitor_c::visit(class_name_c *symbol) {	\
       
   140   if (symbol->ref1!=NULL) symbol->ref1->accept(*this);	\
       
   141   return NULL;						\
       
   142 }
       
   143 
   126 #define SYM_REF2(class_name_c, ref1, ref2)		\
   144 #define SYM_REF2(class_name_c, ref1, ref2)		\
   127 void *iterator_visitor_c::visit(class_name_c *symbol) {	\
   145 void *iterator_visitor_c::visit(class_name_c *symbol) {	\
   128   if (symbol->ref1!=NULL) symbol->ref1->accept(*this);	\
   146   if (symbol->ref1!=NULL) symbol->ref1->accept(*this);	\
   129   if (symbol->ref2!=NULL) symbol->ref2->accept(*this);	\
   147   if (symbol->ref2!=NULL) symbol->ref2->accept(*this);	\
       
   148   return NULL;						\
       
   149 }
       
   150 
       
   151 #define SYM_REF3(class_name_c, ref1, ref2, ref3)	\
       
   152 void *iterator_visitor_c::visit(class_name_c *symbol) {	\
       
   153   if (symbol->ref1) symbol->ref1->accept(*this);	\
       
   154   if (symbol->ref2) symbol->ref2->accept(*this);	\
       
   155   if (symbol->ref3) symbol->ref3->accept(*this);	\
   130   return NULL;						\
   156   return NULL;						\
   131 }
   157 }
   132 
   158 
   133 #define SYM_REF4(class_name_c, ref1, ref2, ref3, ref4)	\
   159 #define SYM_REF4(class_name_c, ref1, ref2, ref3, ref4)	\
   134 void *iterator_visitor_c::visit(class_name_c *symbol) {	\
   160 void *iterator_visitor_c::visit(class_name_c *symbol) {	\
   137   if (symbol->ref3) symbol->ref3->accept(*this);	\
   163   if (symbol->ref3) symbol->ref3->accept(*this);	\
   138   if (symbol->ref4) symbol->ref4->accept(*this);	\
   164   if (symbol->ref4) symbol->ref4->accept(*this);	\
   139   return NULL;						\
   165   return NULL;						\
   140 }
   166 }
   141 
   167 
       
   168 #define SYM_REF5(class_name_c, ref1, ref2, ref3, ref4, ref5)		\
       
   169 void *iterator_visitor_c::visit(class_name_c *symbol) {			\
       
   170   if (symbol->ref1) symbol->ref1->accept(*this);			\
       
   171   if (symbol->ref2) symbol->ref2->accept(*this);			\
       
   172   if (symbol->ref3) symbol->ref3->accept(*this);			\
       
   173   if (symbol->ref4) symbol->ref4->accept(*this);			\
       
   174   if (symbol->ref5) symbol->ref5->accept(*this);			\
       
   175   return NULL;								\
       
   176 }
   142 
   177 
   143 #define SYM_REF6(class_name_c, ref1, ref2, ref3, ref4, ref5, ref6)	\
   178 #define SYM_REF6(class_name_c, ref1, ref2, ref3, ref4, ref5, ref6)	\
   144 void *iterator_visitor_c::visit(class_name_c *symbol) {			\
   179 void *iterator_visitor_c::visit(class_name_c *symbol) {			\
   145   if (symbol->ref1) symbol->ref1->accept(*this);			\
   180   if (symbol->ref1) symbol->ref1->accept(*this);			\
   146   if (symbol->ref2) symbol->ref2->accept(*this);			\
   181   if (symbol->ref2) symbol->ref2->accept(*this);			\
   158 
   193 
   159 
   194 
   160 #undef SYM_LIST
   195 #undef SYM_LIST
   161 #undef SYM_TOKEN
   196 #undef SYM_TOKEN
   162 #undef SYM_REF0
   197 #undef SYM_REF0
       
   198 #undef SYM_REF1
   163 #undef SYM_REF2
   199 #undef SYM_REF2
       
   200 #undef SYM_REF3
   164 #undef SYM_REF4
   201 #undef SYM_REF4
       
   202 #undef SYM_REF5
   165 #undef SYM_REF6
   203 #undef SYM_REF6
   166 
   204 
   167 
   205 
   168 
   206 
   169 
   207 
   197   void *search_visitor_c::visit(class_name_c *symbol) {return NULL;}
   235   void *search_visitor_c::visit(class_name_c *symbol) {return NULL;}
   198 
   236 
   199 #define SYM_REF0(class_name_c)	\
   237 #define SYM_REF0(class_name_c)	\
   200   void *search_visitor_c::visit(class_name_c *symbol) {return NULL;}
   238   void *search_visitor_c::visit(class_name_c *symbol) {return NULL;}
   201 
   239 
       
   240 #define SYM_REF1(class_name_c, ref1)				\
       
   241 void *search_visitor_c::visit(class_name_c *symbol) {		\
       
   242   if (symbol->ref1) return symbol->ref1->accept(*this);		\
       
   243   return NULL;							\
       
   244 }
       
   245 
   202 #define SYM_REF2(class_name_c, ref1, ref2)			\
   246 #define SYM_REF2(class_name_c, ref1, ref2)			\
   203 void *search_visitor_c::visit(class_name_c *symbol) {		\
   247 void *search_visitor_c::visit(class_name_c *symbol) {		\
   204   void *res = NULL;						\
   248   void *res = NULL;						\
   205   if (symbol->ref1) res =  symbol->ref1->accept(*this);		\
   249   if (symbol->ref1) res =  symbol->ref1->accept(*this);		\
   206   if (res != NULL)  return res;					\
   250   if (res != NULL)  return res;					\
   207   if (symbol->ref2) return symbol->ref2->accept(*this);		\
   251   if (symbol->ref2) return symbol->ref2->accept(*this);		\
   208   return NULL;							\
   252   return NULL;							\
   209 }
   253 }
   210 
   254 
       
   255 #define SYM_REF3(class_name_c, ref1, ref2, ref3)		\
       
   256 void *search_visitor_c::visit(class_name_c *symbol) {		\
       
   257   void *res = NULL;						\
       
   258   if (symbol->ref1) res =  symbol->ref1->accept(*this);		\
       
   259   if (res != NULL)  return res;					\
       
   260   if (symbol->ref2) res =  symbol->ref2->accept(*this);		\
       
   261   if (res != NULL)  return res;					\
       
   262   if (symbol->ref3) return symbol->ref3->accept(*this);		\
       
   263   return NULL;							\
       
   264 }
       
   265 
   211 #define SYM_REF4(class_name_c, ref1, ref2, ref3, ref4)		\
   266 #define SYM_REF4(class_name_c, ref1, ref2, ref3, ref4)		\
   212 void *search_visitor_c::visit(class_name_c *symbol) {		\
   267 void *search_visitor_c::visit(class_name_c *symbol) {		\
   213   void *res = NULL;						\
   268   void *res = NULL;						\
   214   if (symbol->ref1) res =  symbol->ref1->accept(*this);		\
   269   if (symbol->ref1) res =  symbol->ref1->accept(*this);		\
   215   if (res != NULL)  return res;					\
   270   if (res != NULL)  return res;					\
   219   if (res != NULL)  return res;					\
   274   if (res != NULL)  return res;					\
   220   if (symbol->ref4) return symbol->ref4->accept(*this);		\
   275   if (symbol->ref4) return symbol->ref4->accept(*this);		\
   221   return NULL;							\
   276   return NULL;							\
   222 }
   277 }
   223 
   278 
       
   279 #define SYM_REF5(class_name_c, ref1, ref2, ref3, ref4, ref5)		\
       
   280 void *search_visitor_c::visit(class_name_c *symbol) {			\
       
   281   void *res = NULL;							\
       
   282   if (symbol->ref1) res =  symbol->ref1->accept(*this);			\
       
   283   if (res != NULL)  return res;						\
       
   284   if (symbol->ref2) res =  symbol->ref2->accept(*this);			\
       
   285   if (res != NULL)  return res;						\
       
   286   if (symbol->ref3) res =  symbol->ref3->accept(*this);			\
       
   287   if (res != NULL)  return res;						\
       
   288   if (symbol->ref4) res =  symbol->ref4->accept(*this);			\
       
   289   if (res != NULL)  return res;						\
       
   290   if (symbol->ref5) return symbol->ref5->accept(*this);			\
       
   291   return NULL;								\
       
   292 }
   224 
   293 
   225 #define SYM_REF6(class_name_c, ref1, ref2, ref3, ref4, ref5, ref6)	\
   294 #define SYM_REF6(class_name_c, ref1, ref2, ref3, ref4, ref5, ref6)	\
   226 void *search_visitor_c::visit(class_name_c *symbol) {			\
   295 void *search_visitor_c::visit(class_name_c *symbol) {			\
   227   void *res = NULL;							\
   296   void *res = NULL;							\
   228   if (symbol->ref1) res =  symbol->ref1->accept(*this);			\
   297   if (symbol->ref1) res =  symbol->ref1->accept(*this);			\
   246 
   315 
   247 
   316 
   248 #undef SYM_LIST
   317 #undef SYM_LIST
   249 #undef SYM_TOKEN
   318 #undef SYM_TOKEN
   250 #undef SYM_REF0
   319 #undef SYM_REF0
       
   320 #undef SYM_REF1
   251 #undef SYM_REF2
   321 #undef SYM_REF2
       
   322 #undef SYM_REF3
   252 #undef SYM_REF4
   323 #undef SYM_REF4
       
   324 #undef SYM_REF5
   253 #undef SYM_REF6
   325 #undef SYM_REF6
   254 
   326 
   255 
   327 
   256 
   328 
   257 
   329