absyntax/visitor.cc
author Mario de Sousa <msousa@fe.up.pt>
Thu, 21 Dec 2017 17:56:12 +0000
changeset 1065 0066fe31a034
parent 1041 56ebe2a31b5b
permissions -rw-r--r--
fix bug: allow variables with names starting with 'var' to be used in the first line of POU body
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
     1
/*
261
db2ad6541d92 Updating licensing information.
Mario de Sousa <msousa@fe.up.pt>
parents: 69
diff changeset
     2
 *  matiec - a compiler for the programming languages defined in IEC 61131-3
db2ad6541d92 Updating licensing information.
Mario de Sousa <msousa@fe.up.pt>
parents: 69
diff changeset
     3
 *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
279
c0453b7f99df Re-generated std lib related code, with updated headers, updated all forgotten headers
Edouard Tisserant
parents: 261
diff changeset
     4
 *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
261
db2ad6541d92 Updating licensing information.
Mario de Sousa <msousa@fe.up.pt>
parents: 69
diff changeset
     5
 *
db2ad6541d92 Updating licensing information.
Mario de Sousa <msousa@fe.up.pt>
parents: 69
diff changeset
     6
 *  This program is free software: you can redistribute it and/or modify
db2ad6541d92 Updating licensing information.
Mario de Sousa <msousa@fe.up.pt>
parents: 69
diff changeset
     7
 *  it under the terms of the GNU General Public License as published by
db2ad6541d92 Updating licensing information.
Mario de Sousa <msousa@fe.up.pt>
parents: 69
diff changeset
     8
 *  the Free Software Foundation, either version 3 of the License, or
db2ad6541d92 Updating licensing information.
Mario de Sousa <msousa@fe.up.pt>
parents: 69
diff changeset
     9
 *  (at your option) any later version.
db2ad6541d92 Updating licensing information.
Mario de Sousa <msousa@fe.up.pt>
parents: 69
diff changeset
    10
 *
db2ad6541d92 Updating licensing information.
Mario de Sousa <msousa@fe.up.pt>
parents: 69
diff changeset
    11
 *  This program is distributed in the hope that it will be useful,
db2ad6541d92 Updating licensing information.
Mario de Sousa <msousa@fe.up.pt>
parents: 69
diff changeset
    12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
db2ad6541d92 Updating licensing information.
Mario de Sousa <msousa@fe.up.pt>
parents: 69
diff changeset
    13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
db2ad6541d92 Updating licensing information.
Mario de Sousa <msousa@fe.up.pt>
parents: 69
diff changeset
    14
 *  GNU General Public License for more details.
db2ad6541d92 Updating licensing information.
Mario de Sousa <msousa@fe.up.pt>
parents: 69
diff changeset
    15
 *
db2ad6541d92 Updating licensing information.
Mario de Sousa <msousa@fe.up.pt>
parents: 69
diff changeset
    16
 *  You should have received a copy of the GNU General Public License
db2ad6541d92 Updating licensing information.
Mario de Sousa <msousa@fe.up.pt>
parents: 69
diff changeset
    17
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
db2ad6541d92 Updating licensing information.
Mario de Sousa <msousa@fe.up.pt>
parents: 69
diff changeset
    18
 *
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    19
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    20
 * This code is made available on the understanding that it will not be
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    21
 * used in safety-critical situations without a full and competent review.
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    22
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    23
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    24
/*
261
db2ad6541d92 Updating licensing information.
Mario de Sousa <msousa@fe.up.pt>
parents: 69
diff changeset
    25
 * An IEC 61131-3 compiler.
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    26
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    27
 * Based on the
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    28
 * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    29
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    30
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    31
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    32
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    33
/*
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    34
 * VISITOR.CC
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    35
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    36
 * Three base implementations of the visitor interface,
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    37
 * that may be later extended to execute a particular algorithm.
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    38
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    39
 * The null (class null_visitor_c) does nothing.
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    40
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    41
 * The iterator (class iterator_visitor_c) iterates through
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    42
 * every object in the syntax tree.
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    43
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    44
 * The search class (class search_visitor_c) iterates through
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    45
 * every object, until one returns a value != NULL.
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    46
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    47
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    48
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    49
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    50
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    51
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    52
#include <unistd.h>
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    53
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    54
#include <stdio.h>  /* required for NULL */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    55
#include "visitor.hh"
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    56
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    57
#include <iostream>
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    58
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    59
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    60
/******************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    61
/* visitor_c      */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    62
/******************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    63
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    64
visitor_c::~visitor_c(void) {return;}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    65
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    66
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    67
/******************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    68
/* null_visitor_c */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    69
/******************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    70
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    71
null_visitor_c::~null_visitor_c(void) {return;}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    72
738
e47cc8c954db Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents: 680
diff changeset
    73
#define SYM_LIST(class_name_c, ...)	\
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    74
  void *null_visitor_c::visit(class_name_c *symbol) {return NULL;}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    75
417
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents: 350
diff changeset
    76
#define SYM_TOKEN(class_name_c, ...)	\
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents: 350
diff changeset
    77
  void *null_visitor_c::visit(class_name_c *symbol) {return NULL;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents: 350
diff changeset
    78
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents: 350
diff changeset
    79
#define SYM_REF0(class_name_c, ...)	\
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents: 350
diff changeset
    80
  void *null_visitor_c::visit(class_name_c *symbol) {return NULL;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents: 350
diff changeset
    81
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents: 350
diff changeset
    82
#define SYM_REF1(class_name_c, ref1, ...)	\
69
41cb5b80416e Adding basic error checking.
mario
parents: 0
diff changeset
    83
  void *null_visitor_c::visit(class_name_c *symbol) {return NULL;}
41cb5b80416e Adding basic error checking.
mario
parents: 0
diff changeset
    84
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
    85
#define SYM_REF2(class_name_c, ref1, ref2, ...)	\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
    86
  void *null_visitor_c::visit(class_name_c *symbol) {return NULL;}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
    87
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
    88
#define SYM_REF3(class_name_c, ref1, ref2, ref3, ...)	\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
    89
  void *null_visitor_c::visit(class_name_c *symbol) {return NULL;}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
    90
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
    91
#define SYM_REF4(class_name_c, ref1, ref2, ref3, ref4, ...)	\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
    92
  void *null_visitor_c::visit(class_name_c *symbol) {return NULL;}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
    93
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
    94
#define SYM_REF5(class_name_c, ref1, ref2, ref3, ref4, ref5, ...)	\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
    95
  void *null_visitor_c::visit(class_name_c *symbol) {return NULL;}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
    96
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
    97
#define SYM_REF6(class_name_c, ref1, ref2, ref3, ref4, ref5, ref6, ...)	\
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    98
  void *null_visitor_c::visit(class_name_c *symbol) {return NULL;}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    99
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   100
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   101
#include "absyntax.def"
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   102
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   103
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   104
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   105
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   106
#undef SYM_LIST
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   107
#undef SYM_TOKEN
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   108
#undef SYM_REF0
69
41cb5b80416e Adding basic error checking.
mario
parents: 0
diff changeset
   109
#undef SYM_REF1
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   110
#undef SYM_REF2
69
41cb5b80416e Adding basic error checking.
mario
parents: 0
diff changeset
   111
#undef SYM_REF3
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   112
#undef SYM_REF4
69
41cb5b80416e Adding basic error checking.
mario
parents: 0
diff changeset
   113
#undef SYM_REF5
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   114
#undef SYM_REF6
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   115
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   116
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   117
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   118
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   119
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   120
680
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   121
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   122
/*******************/
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   123
/* fcall_visitor_c */
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   124
/*******************/
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   125
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   126
//fcall_visitor_c::~fcall_visitor_c(void) {return;};
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   127
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   128
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   129
// void fcall_visitor_c::fcall(symbol_c *symbol) {return;};
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   130
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   131
#define VISIT_METHOD {fcall(symbol); return NULL;}
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   132
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   133
#define SYM_LIST(class_name_c, ...)                                             void *fcall_visitor_c::visit(class_name_c *symbol) VISIT_METHOD;
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   134
#define SYM_TOKEN(class_name_c, ...)                                            void *fcall_visitor_c::visit(class_name_c *symbol) VISIT_METHOD;
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   135
#define SYM_REF0(class_name_c, ...)                                             void *fcall_visitor_c::visit(class_name_c *symbol) VISIT_METHOD;
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   136
#define SYM_REF1(class_name_c, ref1, ...)                                       void *fcall_visitor_c::visit(class_name_c *symbol) VISIT_METHOD;
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   137
#define SYM_REF2(class_name_c, ref1, ref2, ...)                                 void *fcall_visitor_c::visit(class_name_c *symbol) VISIT_METHOD;
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   138
#define SYM_REF3(class_name_c, ref1, ref2, ref3, ...)                           void *fcall_visitor_c::visit(class_name_c *symbol) VISIT_METHOD;
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   139
#define SYM_REF4(class_name_c, ref1, ref2, ref3, ref4, ...)                     void *fcall_visitor_c::visit(class_name_c *symbol) VISIT_METHOD;
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   140
#define SYM_REF5(class_name_c, ref1, ref2, ref3, ref4, ref5, ...)               void *fcall_visitor_c::visit(class_name_c *symbol) VISIT_METHOD;
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   141
#define SYM_REF6(class_name_c, ref1, ref2, ref3, ref4, ref5, ref6, ...)         void *fcall_visitor_c::visit(class_name_c *symbol) VISIT_METHOD;
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   142
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   143
#include "../absyntax/absyntax.def"
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   144
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   145
#undef VISIT_METHOD
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   146
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   147
#undef SYM_LIST
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   148
#undef SYM_TOKEN
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   149
#undef SYM_REF0
69
41cb5b80416e Adding basic error checking.
mario
parents: 0
diff changeset
   150
#undef SYM_REF1
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   151
#undef SYM_REF2
69
41cb5b80416e Adding basic error checking.
mario
parents: 0
diff changeset
   152
#undef SYM_REF3
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   153
#undef SYM_REF4
69
41cb5b80416e Adding basic error checking.
mario
parents: 0
diff changeset
   154
#undef SYM_REF5
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   155
#undef SYM_REF6
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   156
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   157
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   158
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   159
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   160
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   161
680
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   162
/**********************/
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   163
/* iterator_visitor_c */
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   164
/**********************/
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   165
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   166
iterator_visitor_c::~iterator_visitor_c(void) {return;}
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   167
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   168
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   169
void *iterator_visitor_c::visit_list(list_c *list) {
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   170
  for(int i = 0; i < list->n; i++) {
1041
56ebe2a31b5b Access elements[] in list_c through a new get_element() method.
Mario de Sousa <msousa@fe.up.pt>
parents: 738
diff changeset
   171
    list->get_element(i)->accept(*this);
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   172
  }
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   173
  return NULL;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   174
}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   175
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   176
738
e47cc8c954db Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents: 680
diff changeset
   177
#define SYM_LIST(class_name_c, ...)	\
680
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   178
  void *iterator_visitor_c::visit(class_name_c *symbol) {return visit_list(symbol);}
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   179
417
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents: 350
diff changeset
   180
#define SYM_TOKEN(class_name_c, ...)	\
680
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   181
  void *iterator_visitor_c::visit(class_name_c *symbol) {return NULL;}
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   182
417
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents: 350
diff changeset
   183
#define SYM_REF0(class_name_c, ...)	\
680
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   184
  void *iterator_visitor_c::visit(class_name_c *symbol) {return NULL;}
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   185
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   186
#define SYM_REF1(class_name_c, ref1, ...)			\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   187
void *iterator_visitor_c::visit(class_name_c *symbol) {	\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   188
  if (symbol->ref1!=NULL) symbol->ref1->accept(*this);	\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   189
  return NULL;						\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   190
}
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   191
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   192
#define SYM_REF2(class_name_c, ref1, ref2, ...)		\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   193
void *iterator_visitor_c::visit(class_name_c *symbol) {	\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   194
  if (symbol->ref1!=NULL) symbol->ref1->accept(*this);	\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   195
  if (symbol->ref2!=NULL) symbol->ref2->accept(*this);	\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   196
  return NULL;						\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   197
}
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   198
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   199
#define SYM_REF3(class_name_c, ref1, ref2, ref3, ...)			\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   200
void *iterator_visitor_c::visit(class_name_c *symbol) {			\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   201
  if (symbol->ref1) symbol->ref1->accept(*this);			\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   202
  if (symbol->ref2) symbol->ref2->accept(*this);			\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   203
  if (symbol->ref3) symbol->ref3->accept(*this);			\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   204
  return NULL;								\
69
41cb5b80416e Adding basic error checking.
mario
parents: 0
diff changeset
   205
}
41cb5b80416e Adding basic error checking.
mario
parents: 0
diff changeset
   206
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   207
#define SYM_REF4(class_name_c, ref1, ref2, ref3, ref4, ...)		\
680
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   208
void *iterator_visitor_c::visit(class_name_c *symbol) {			\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   209
  if (symbol->ref1) symbol->ref1->accept(*this);			\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   210
  if (symbol->ref2) symbol->ref2->accept(*this);			\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   211
  if (symbol->ref3) symbol->ref3->accept(*this);			\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   212
  if (symbol->ref4) symbol->ref4->accept(*this);			\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   213
  return NULL;								\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   214
}
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   215
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   216
#define SYM_REF5(class_name_c, ref1, ref2, ref3, ref4, ref5, ...)	\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   217
void *iterator_visitor_c::visit(class_name_c *symbol) {			\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   218
  if (symbol->ref1) symbol->ref1->accept(*this);			\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   219
  if (symbol->ref2) symbol->ref2->accept(*this);			\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   220
  if (symbol->ref3) symbol->ref3->accept(*this);			\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   221
  if (symbol->ref4) symbol->ref4->accept(*this);			\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   222
  if (symbol->ref5) symbol->ref5->accept(*this);			\
69
41cb5b80416e Adding basic error checking.
mario
parents: 0
diff changeset
   223
  return NULL;								\
41cb5b80416e Adding basic error checking.
mario
parents: 0
diff changeset
   224
}
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   225
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   226
#define SYM_REF6(class_name_c, ref1, ref2, ref3, ref4, ref5, ref6, ...)	\
680
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   227
void *iterator_visitor_c::visit(class_name_c *symbol) {			\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   228
  if (symbol->ref1) symbol->ref1->accept(*this);			\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   229
  if (symbol->ref2) symbol->ref2->accept(*this);			\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   230
  if (symbol->ref3) symbol->ref3->accept(*this);			\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   231
  if (symbol->ref4) symbol->ref4->accept(*this);			\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   232
  if (symbol->ref5) symbol->ref5->accept(*this);			\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   233
  if (symbol->ref6) symbol->ref6->accept(*this);			\
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   234
  return NULL;								\
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   235
}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   236
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   237
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   238
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   239
#include "absyntax.def"
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   240
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   241
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   242
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   243
#undef SYM_LIST
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   244
#undef SYM_TOKEN
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   245
#undef SYM_REF0
69
41cb5b80416e Adding basic error checking.
mario
parents: 0
diff changeset
   246
#undef SYM_REF1
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   247
#undef SYM_REF2
69
41cb5b80416e Adding basic error checking.
mario
parents: 0
diff changeset
   248
#undef SYM_REF3
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   249
#undef SYM_REF4
69
41cb5b80416e Adding basic error checking.
mario
parents: 0
diff changeset
   250
#undef SYM_REF5
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   251
#undef SYM_REF6
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   252
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   253
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   254
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   255
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   256
680
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   257
/****************************/
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   258
/* fcall_iterator_visitor_c */
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   259
/****************************/
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   260
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   261
fcall_iterator_visitor_c::~fcall_iterator_visitor_c(void) {return;};
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   262
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   263
void fcall_iterator_visitor_c::prefix_fcall(symbol_c *symbol) {return;};
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   264
void fcall_iterator_visitor_c::suffix_fcall(symbol_c *symbol) {return;};
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   265
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   266
#define VISIT_METHOD {\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   267
  prefix_fcall(symbol);                \
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   268
  iterator_visitor_c::visit(symbol);   \
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   269
  suffix_fcall(symbol);                \
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   270
  return NULL;                         \
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   271
}
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   272
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   273
#define SYM_LIST(class_name_c, ...)                                             void *fcall_iterator_visitor_c::visit(class_name_c *symbol) VISIT_METHOD;
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   274
#define SYM_TOKEN(class_name_c, ...)                                            void *fcall_iterator_visitor_c::visit(class_name_c *symbol) VISIT_METHOD;
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   275
#define SYM_REF0(class_name_c, ...)                                             void *fcall_iterator_visitor_c::visit(class_name_c *symbol) VISIT_METHOD;
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   276
#define SYM_REF1(class_name_c, ref1, ...)                                       void *fcall_iterator_visitor_c::visit(class_name_c *symbol) VISIT_METHOD;
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   277
#define SYM_REF2(class_name_c, ref1, ref2, ...)                                 void *fcall_iterator_visitor_c::visit(class_name_c *symbol) VISIT_METHOD;
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   278
#define SYM_REF3(class_name_c, ref1, ref2, ref3, ...)                           void *fcall_iterator_visitor_c::visit(class_name_c *symbol) VISIT_METHOD;
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   279
#define SYM_REF4(class_name_c, ref1, ref2, ref3, ref4, ...)                     void *fcall_iterator_visitor_c::visit(class_name_c *symbol) VISIT_METHOD;
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   280
#define SYM_REF5(class_name_c, ref1, ref2, ref3, ref4, ref5, ...)               void *fcall_iterator_visitor_c::visit(class_name_c *symbol) VISIT_METHOD;
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   281
#define SYM_REF6(class_name_c, ref1, ref2, ref3, ref4, ref5, ref6, ...)         void *fcall_iterator_visitor_c::visit(class_name_c *symbol) VISIT_METHOD;
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   282
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   283
#include "../absyntax/absyntax.def"
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   284
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   285
#undef VISIT_METHOD
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   286
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   287
#undef SYM_LIST
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   288
#undef SYM_TOKEN
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   289
#undef SYM_REF0
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   290
#undef SYM_REF1
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   291
#undef SYM_REF2
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   292
#undef SYM_REF3
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   293
#undef SYM_REF4
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   294
#undef SYM_REF5
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   295
#undef SYM_REF6
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   296
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   297
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   298
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   299
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   300
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   301
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   302
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   303
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   304
/********************/
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   305
/* search_visitor_c */
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   306
/********************/
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   307
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   308
search_visitor_c::~search_visitor_c(void) {return;}
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   309
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   310
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   311
void *search_visitor_c::visit_list(list_c *list) {
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   312
  for(int i = 0; i < list->n; i++) {
1041
56ebe2a31b5b Access elements[] in list_c through a new get_element() method.
Mario de Sousa <msousa@fe.up.pt>
parents: 738
diff changeset
   313
    void *res = list->get_element(i)->accept(*this);
680
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   314
    if (res != NULL)
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   315
      return res;
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   316
  }
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   317
  return NULL;
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   318
}
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   319
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   320
738
e47cc8c954db Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents: 680
diff changeset
   321
#define SYM_LIST(class_name_c, ...)	\
680
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   322
  void *search_visitor_c::visit(class_name_c *symbol) {return visit_list(symbol);}
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   323
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   324
#define SYM_TOKEN(class_name_c, ...)	\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   325
  void *search_visitor_c::visit(class_name_c *symbol) {return NULL;}
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   326
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   327
#define SYM_REF0(class_name_c, ...)	\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   328
  void *search_visitor_c::visit(class_name_c *symbol) {return NULL;}
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   329
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   330
#define SYM_REF1(class_name_c, ref1, ...)				\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   331
void *search_visitor_c::visit(class_name_c *symbol) {		\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   332
  if (symbol->ref1) return symbol->ref1->accept(*this);		\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   333
  return NULL;							\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   334
}
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   335
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   336
#define SYM_REF2(class_name_c, ref1, ref2, ...)			\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   337
void *search_visitor_c::visit(class_name_c *symbol) {		\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   338
  void *res = NULL;						\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   339
  if (symbol->ref1) res =  symbol->ref1->accept(*this);		\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   340
  if (res != NULL)  return res;					\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   341
  if (symbol->ref2) return symbol->ref2->accept(*this);		\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   342
  return NULL;							\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   343
}
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   344
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   345
#define SYM_REF3(class_name_c, ref1, ref2, ref3, ...)		\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   346
void *search_visitor_c::visit(class_name_c *symbol) {		\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   347
  void *res = NULL;						\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   348
  if (symbol->ref1) res =  symbol->ref1->accept(*this);		\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   349
  if (res != NULL)  return res;					\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   350
  if (symbol->ref2) res =  symbol->ref2->accept(*this);		\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   351
  if (res != NULL)  return res;					\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   352
  if (symbol->ref3) return symbol->ref3->accept(*this);		\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   353
  return NULL;							\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   354
}
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   355
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   356
#define SYM_REF4(class_name_c, ref1, ref2, ref3, ref4, ...)		\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   357
void *search_visitor_c::visit(class_name_c *symbol) {		\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   358
  void *res = NULL;						\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   359
  if (symbol->ref1) res =  symbol->ref1->accept(*this);		\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   360
  if (res != NULL)  return res;					\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   361
  if (symbol->ref2) res =  symbol->ref2->accept(*this);		\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   362
  if (res != NULL)  return res;					\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   363
  if (symbol->ref3) res =  symbol->ref3->accept(*this);		\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   364
  if (res != NULL)  return res;					\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   365
  if (symbol->ref4) return symbol->ref4->accept(*this);		\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   366
  return NULL;							\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   367
}
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   368
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   369
#define SYM_REF5(class_name_c, ref1, ref2, ref3, ref4, ref5, ...)		\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   370
void *search_visitor_c::visit(class_name_c *symbol) {			\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   371
  void *res = NULL;							\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   372
  if (symbol->ref1) res =  symbol->ref1->accept(*this);			\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   373
  if (res != NULL)  return res;						\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   374
  if (symbol->ref2) res =  symbol->ref2->accept(*this);			\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   375
  if (res != NULL)  return res;						\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   376
  if (symbol->ref3) res =  symbol->ref3->accept(*this);			\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   377
  if (res != NULL)  return res;						\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   378
  if (symbol->ref4) res =  symbol->ref4->accept(*this);			\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   379
  if (res != NULL)  return res;						\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   380
  if (symbol->ref5) return symbol->ref5->accept(*this);			\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   381
  return NULL;								\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   382
}
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   383
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   384
#define SYM_REF6(class_name_c, ref1, ref2, ref3, ref4, ref5, ref6, ...)	\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   385
void *search_visitor_c::visit(class_name_c *symbol) {			\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   386
  void *res = NULL;							\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   387
  if (symbol->ref1) res =  symbol->ref1->accept(*this);			\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   388
  if (res != NULL)  return res;						\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   389
  if (symbol->ref2) res =  symbol->ref2->accept(*this);			\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   390
  if (res != NULL)  return res;						\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   391
  if (symbol->ref3) res =  symbol->ref3->accept(*this);			\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   392
  if (res != NULL)  return res;						\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   393
  if (symbol->ref4) res =  symbol->ref4->accept(*this);			\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   394
  if (res != NULL)  return res;						\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   395
  if (symbol->ref5) res =  symbol->ref5->accept(*this);			\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   396
  if (res != NULL)  return res;						\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   397
  if (symbol->ref6) return symbol->ref6->accept(*this);			\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   398
  return NULL;								\
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   399
}
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   400
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   401
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   402
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   403
#include "absyntax.def"
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   404
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   405
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   406
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   407
#undef SYM_LIST
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   408
#undef SYM_TOKEN
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   409
#undef SYM_REF0
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   410
#undef SYM_REF1
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   411
#undef SYM_REF2
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   412
#undef SYM_REF3
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   413
#undef SYM_REF4
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   414
#undef SYM_REF5
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   415
#undef SYM_REF6
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   416
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   417
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   418
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   419
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   420
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   421
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   422
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   423
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   424
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   425
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   426
df783da3ebe2 New visitor classes missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   427