absyntax/absyntax.cc
author mjsousa
Thu, 22 Aug 2013 19:12:10 +0100
changeset 845 5fa872f3d073
parent 779 2ed03e0e0e41
child 889 5f380b99e95e
permissions -rwxr-xr-x
Add code to check if an IN_OUT variable is being passed an IL list in formal IL FB/function invocations.
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
 * Definition of the Abstract Syntax data structure components
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    34
 */
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
#include <stdio.h>
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    37
#include <stdlib.h>	/* required for exit() */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    38
#include <string.h>
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    39
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    40
#include "absyntax.hh"
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    41
//#include "../stage1_2/iec.hh" /* required for BOGUS_TOKEN_ID, etc... */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    42
#include "visitor.hh"
596
4efb11e44065 Add ERROR_MSG macro && move extract_XXX() functions to constant_folding.cc
Mario de Sousa <msousa@fe.up.pt>
parents: 569
diff changeset
    43
#include "../main.hh" // required for ERROR() and ERROR_MSG() macros.
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    44
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    45
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
/* The base class of all symbols */
286
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
    48
symbol_c::symbol_c(
287
9df7fcb9bde5 Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents: 286
diff changeset
    49
                   int first_line, int first_column, const char *ffile, long int first_order,
9df7fcb9bde5 Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents: 286
diff changeset
    50
                   int last_line,  int last_column,  const char *lfile, long int last_order ) {
286
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
    51
  this->first_file   = ffile,
69
41cb5b80416e Adding basic error checking.
mario
parents: 15
diff changeset
    52
  this->first_line   = first_line;
41cb5b80416e Adding basic error checking.
mario
parents: 15
diff changeset
    53
  this->first_column = first_column;
287
9df7fcb9bde5 Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents: 286
diff changeset
    54
  this->first_order  = first_order;
286
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
    55
  this->last_file    = lfile,
69
41cb5b80416e Adding basic error checking.
mario
parents: 15
diff changeset
    56
  this->last_line    = last_line;
41cb5b80416e Adding basic error checking.
mario
parents: 15
diff changeset
    57
  this->last_column  = last_column;
287
9df7fcb9bde5 Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents: 286
diff changeset
    58
  this->last_order   = last_order;
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
    59
  this->datatype     = NULL;
612
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 596
diff changeset
    60
  this->const_value._real64.status   = cs_undefined;
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 596
diff changeset
    61
  this->const_value._int64.status    = cs_undefined;
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 596
diff changeset
    62
  this->const_value._uint64.status   = cs_undefined;
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 596
diff changeset
    63
  this->const_value._bool.status     = cs_undefined;
69
41cb5b80416e Adding basic error checking.
mario
parents: 15
diff changeset
    64
}
41cb5b80416e Adding basic error checking.
mario
parents: 15
diff changeset
    65
41cb5b80416e Adding basic error checking.
mario
parents: 15
diff changeset
    66
41cb5b80416e Adding basic error checking.
mario
parents: 15
diff changeset
    67
286
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
    68
token_c::token_c(const char *value, 
287
9df7fcb9bde5 Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents: 286
diff changeset
    69
                 int fl, int fc, const char *ffile, long int forder,
9df7fcb9bde5 Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents: 286
diff changeset
    70
                 int ll, int lc, const char *lfile, long int lorder)
9df7fcb9bde5 Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents: 286
diff changeset
    71
  :symbol_c(fl, fc, ffile, forder, ll, lc, lfile, lorder) {
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    72
  this->value = value;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    73
//  printf("New token: %s\n", value);
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    74
}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    75
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    76
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    77
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    78
654
7421cb63defa list_c: initial capacity. ERROR_MSG(msg,...) supports optional arguments now.
agraeper
parents: 612
diff changeset
    79
# define LIST_CAP_INIT 8
7421cb63defa list_c: initial capacity. ERROR_MSG(msg,...) supports optional arguments now.
agraeper
parents: 612
diff changeset
    80
# define LIST_CAP_INCR 8
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    81
286
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
    82
list_c::list_c(
287
9df7fcb9bde5 Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents: 286
diff changeset
    83
               int fl, int fc, const char *ffile, long int forder,
9df7fcb9bde5 Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents: 286
diff changeset
    84
               int ll, int lc, const char *lfile, long int lorder)
655
a77514dd0040 Adjust coding style.
Mario de Sousa <msousa@fe.up.pt>
parents: 654
diff changeset
    85
  :symbol_c(fl, fc, ffile, forder, ll, lc, lfile, lorder),c(LIST_CAP_INIT) {
a77514dd0040 Adjust coding style.
Mario de Sousa <msousa@fe.up.pt>
parents: 654
diff changeset
    86
  n = 0;
a77514dd0040 Adjust coding style.
Mario de Sousa <msousa@fe.up.pt>
parents: 654
diff changeset
    87
  elements = (symbol_c**)malloc(LIST_CAP_INIT*sizeof(symbol_c*));
a77514dd0040 Adjust coding style.
Mario de Sousa <msousa@fe.up.pt>
parents: 654
diff changeset
    88
  if (NULL == elements) ERROR_MSG("out of memory");
a77514dd0040 Adjust coding style.
Mario de Sousa <msousa@fe.up.pt>
parents: 654
diff changeset
    89
}
a77514dd0040 Adjust coding style.
Mario de Sousa <msousa@fe.up.pt>
parents: 654
diff changeset
    90
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    91
286
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
    92
list_c::list_c(symbol_c *elem, 
287
9df7fcb9bde5 Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents: 286
diff changeset
    93
               int fl, int fc, const char *ffile, long int forder,
9df7fcb9bde5 Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents: 286
diff changeset
    94
               int ll, int lc, const char *lfile, long int lorder)
655
a77514dd0040 Adjust coding style.
Mario de Sousa <msousa@fe.up.pt>
parents: 654
diff changeset
    95
  :symbol_c(fl, fc, ffile, forder, ll, lc, lfile, lorder),c(LIST_CAP_INIT) { 
a77514dd0040 Adjust coding style.
Mario de Sousa <msousa@fe.up.pt>
parents: 654
diff changeset
    96
  n = 0;
a77514dd0040 Adjust coding style.
Mario de Sousa <msousa@fe.up.pt>
parents: 654
diff changeset
    97
  elements = (symbol_c**)malloc(LIST_CAP_INIT*sizeof(symbol_c*));
a77514dd0040 Adjust coding style.
Mario de Sousa <msousa@fe.up.pt>
parents: 654
diff changeset
    98
  if (NULL == elements) ERROR_MSG("out of memory");
a77514dd0040 Adjust coding style.
Mario de Sousa <msousa@fe.up.pt>
parents: 654
diff changeset
    99
  add_element(elem); 
a77514dd0040 Adjust coding style.
Mario de Sousa <msousa@fe.up.pt>
parents: 654
diff changeset
   100
}
a77514dd0040 Adjust coding style.
Mario de Sousa <msousa@fe.up.pt>
parents: 654
diff changeset
   101
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   102
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   103
/* append a new element to the end of the 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
   104
void list_c::add_element(symbol_c *elem) {
654
7421cb63defa list_c: initial capacity. ERROR_MSG(msg,...) supports optional arguments now.
agraeper
parents: 612
diff changeset
   105
  // printf("list_c::add_element()\n");
655
a77514dd0040 Adjust coding style.
Mario de Sousa <msousa@fe.up.pt>
parents: 654
diff changeset
   106
  if (c <= n)
a77514dd0040 Adjust coding style.
Mario de Sousa <msousa@fe.up.pt>
parents: 654
diff changeset
   107
    if (!(elements=(symbol_c**)realloc(elements,(c+=LIST_CAP_INCR)*sizeof(symbol_c *))))
a77514dd0040 Adjust coding style.
Mario de Sousa <msousa@fe.up.pt>
parents: 654
diff changeset
   108
      ERROR_MSG("out of memory");
654
7421cb63defa list_c: initial capacity. ERROR_MSG(msg,...) supports optional arguments now.
agraeper
parents: 612
diff changeset
   109
  elements[n++] = elem;
69
41cb5b80416e Adding basic error checking.
mario
parents: 15
diff changeset
   110
 
655
a77514dd0040 Adjust coding style.
Mario de Sousa <msousa@fe.up.pt>
parents: 654
diff changeset
   111
  if (NULL == elem) return;
69
41cb5b80416e Adding basic error checking.
mario
parents: 15
diff changeset
   112
41cb5b80416e Adding basic error checking.
mario
parents: 15
diff changeset
   113
  /* adjust the location parameters, taking into account the new element. */
779
2ed03e0e0e41 Update symbol_c::first_file/last_file entries in list_c::add_element()
Mario de Sousa <msousa@fe.up.pt>
parents: 655
diff changeset
   114
  if (NULL == first_file) {
2ed03e0e0e41 Update symbol_c::first_file/last_file entries in list_c::add_element()
Mario de Sousa <msousa@fe.up.pt>
parents: 655
diff changeset
   115
    first_file = elem->first_file;
2ed03e0e0e41 Update symbol_c::first_file/last_file entries in list_c::add_element()
Mario de Sousa <msousa@fe.up.pt>
parents: 655
diff changeset
   116
    first_line = elem->first_line;
2ed03e0e0e41 Update symbol_c::first_file/last_file entries in list_c::add_element()
Mario de Sousa <msousa@fe.up.pt>
parents: 655
diff changeset
   117
    first_column = elem->first_column;
2ed03e0e0e41 Update symbol_c::first_file/last_file entries in list_c::add_element()
Mario de Sousa <msousa@fe.up.pt>
parents: 655
diff changeset
   118
  }
2ed03e0e0e41 Update symbol_c::first_file/last_file entries in list_c::add_element()
Mario de Sousa <msousa@fe.up.pt>
parents: 655
diff changeset
   119
  if ((first_line == elem->first_line) && (first_column > elem->first_column)) {
69
41cb5b80416e Adding basic error checking.
mario
parents: 15
diff changeset
   120
    first_column = elem->first_column;
41cb5b80416e Adding basic error checking.
mario
parents: 15
diff changeset
   121
  }
41cb5b80416e Adding basic error checking.
mario
parents: 15
diff changeset
   122
  if (first_line > elem->first_line) {
41cb5b80416e Adding basic error checking.
mario
parents: 15
diff changeset
   123
    first_line = elem->first_line;
41cb5b80416e Adding basic error checking.
mario
parents: 15
diff changeset
   124
    first_column = elem->first_column;
41cb5b80416e Adding basic error checking.
mario
parents: 15
diff changeset
   125
  }
779
2ed03e0e0e41 Update symbol_c::first_file/last_file entries in list_c::add_element()
Mario de Sousa <msousa@fe.up.pt>
parents: 655
diff changeset
   126
  if (NULL == last_file) {
2ed03e0e0e41 Update symbol_c::first_file/last_file entries in list_c::add_element()
Mario de Sousa <msousa@fe.up.pt>
parents: 655
diff changeset
   127
    last_file = elem->last_file;
2ed03e0e0e41 Update symbol_c::first_file/last_file entries in list_c::add_element()
Mario de Sousa <msousa@fe.up.pt>
parents: 655
diff changeset
   128
    last_line = elem->last_line;
2ed03e0e0e41 Update symbol_c::first_file/last_file entries in list_c::add_element()
Mario de Sousa <msousa@fe.up.pt>
parents: 655
diff changeset
   129
    last_column = elem->last_column;
2ed03e0e0e41 Update symbol_c::first_file/last_file entries in list_c::add_element()
Mario de Sousa <msousa@fe.up.pt>
parents: 655
diff changeset
   130
  }
69
41cb5b80416e Adding basic error checking.
mario
parents: 15
diff changeset
   131
  if ((last_line == elem->last_line) &&
41cb5b80416e Adding basic error checking.
mario
parents: 15
diff changeset
   132
      (last_column < elem->last_column)) {
41cb5b80416e Adding basic error checking.
mario
parents: 15
diff changeset
   133
    last_column = elem->last_column;
41cb5b80416e Adding basic error checking.
mario
parents: 15
diff changeset
   134
  }
41cb5b80416e Adding basic error checking.
mario
parents: 15
diff changeset
   135
  if (last_line < elem->last_line) {
41cb5b80416e Adding basic error checking.
mario
parents: 15
diff changeset
   136
    last_line = elem->last_line;
41cb5b80416e Adding basic error checking.
mario
parents: 15
diff changeset
   137
    last_column = elem->last_column;
41cb5b80416e Adding basic error checking.
mario
parents: 15
diff changeset
   138
  }
41cb5b80416e Adding basic error checking.
mario
parents: 15
diff changeset
   139
}
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   140
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   141
/* insert a new element before position pos. */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   142
/* To insert into the begining of list, call with pos=0  */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   143
/* To insert into the end of list, call with pos=list->n */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   144
void list_c::insert_element(symbol_c *elem, int pos) {
654
7421cb63defa list_c: initial capacity. ERROR_MSG(msg,...) supports optional arguments now.
agraeper
parents: 612
diff changeset
   145
  if((pos<0) || (n<pos)) ERROR;
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   146
  
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   147
  /* add new element to end of list. Basically alocate required memory... */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   148
  /* will also increment n by 1 ! */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   149
  add_element(elem);
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   150
  /* if not inserting into end position, shift all elements up one position, to open up a slot in pos for new element */
654
7421cb63defa list_c: initial capacity. ERROR_MSG(msg,...) supports optional arguments now.
agraeper
parents: 612
diff changeset
   151
  if(pos < (n-1)){ 
7421cb63defa list_c: initial capacity. ERROR_MSG(msg,...) supports optional arguments now.
agraeper
parents: 612
diff changeset
   152
    for(int i=n-2 ; i>=pos ; --i) elements[i+1] = elements[i];
7421cb63defa list_c: initial capacity. ERROR_MSG(msg,...) supports optional arguments now.
agraeper
parents: 612
diff changeset
   153
    elements[pos] = elem;
7421cb63defa list_c: initial capacity. ERROR_MSG(msg,...) supports optional arguments now.
agraeper
parents: 612
diff changeset
   154
  }
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   155
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   156
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   157
438
744b125d911e Add support for semantic verification of function calls in IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   158
/* remove element at position pos. */
744b125d911e Add support for semantic verification of function calls in IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   159
void list_c::remove_element(int pos) {
654
7421cb63defa list_c: initial capacity. ERROR_MSG(msg,...) supports optional arguments now.
agraeper
parents: 612
diff changeset
   160
  if((pos<0) || (n<=pos)) ERROR;
438
744b125d911e Add support for semantic verification of function calls in IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   161
  
744b125d911e Add support for semantic verification of function calls in IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   162
  /* Shift all elements down one position, starting at the entry to delete. */
744b125d911e Add support for semantic verification of function calls in IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   163
  for (int i = pos; i < n-1; i++) elements[i] = elements[i+1];
654
7421cb63defa list_c: initial capacity. ERROR_MSG(msg,...) supports optional arguments now.
agraeper
parents: 612
diff changeset
   164
  /* corrent the new size */
438
744b125d911e Add support for semantic verification of function calls in IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   165
  n--;
654
7421cb63defa list_c: initial capacity. ERROR_MSG(msg,...) supports optional arguments now.
agraeper
parents: 612
diff changeset
   166
  /* elements = (symbol_c **)realloc(elements, n * sizeof(symbol_c *)); */
438
744b125d911e Add support for semantic verification of function calls in IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   167
}
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   168
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   169
#define SYM_LIST(class_name_c, ...)								\
286
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   170
class_name_c::class_name_c(									\
287
9df7fcb9bde5 Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents: 286
diff changeset
   171
                           int fl, int fc, const char *ffile, long int forder,			\
9df7fcb9bde5 Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents: 286
diff changeset
   172
                           int ll, int lc, const char *lfile, long int lorder)			\
9df7fcb9bde5 Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents: 286
diff changeset
   173
                        :list_c(fl, fc, ffile, forder, ll, lc, lfile, lorder) {}		\
286
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   174
class_name_c::class_name_c(symbol_c *elem, 							\
287
9df7fcb9bde5 Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents: 286
diff changeset
   175
                           int fl, int fc, const char *ffile, long int forder,			\
9df7fcb9bde5 Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents: 286
diff changeset
   176
                           int ll, int lc, const char *lfile, long int lorder)			\
9df7fcb9bde5 Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents: 286
diff changeset
   177
			:list_c(elem, fl, fc, ffile, forder, ll, lc, lfile, lorder) {}		\
286
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   178
void *class_name_c::accept(visitor_c &visitor) {return visitor.visit(this);}
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   179
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   180
#define SYM_TOKEN(class_name_c, ...)								\
286
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   181
class_name_c::class_name_c(const char *value, 							\
287
9df7fcb9bde5 Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents: 286
diff changeset
   182
                           int fl, int fc, const char *ffile, long int forder,			\
9df7fcb9bde5 Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents: 286
diff changeset
   183
                           int ll, int lc, const char *lfile, long int lorder)			\
9df7fcb9bde5 Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents: 286
diff changeset
   184
			:token_c(value, fl, fc, ffile, forder, ll, lc, lfile, lorder) {}	\
286
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   185
void *class_name_c::accept(visitor_c &visitor) {return visitor.visit(this);}
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   186
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   187
#define SYM_REF0(class_name_c, ...)								\
286
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   188
class_name_c::class_name_c(									\
287
9df7fcb9bde5 Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents: 286
diff changeset
   189
                           int fl, int fc, const char *ffile, long int forder,			\
9df7fcb9bde5 Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents: 286
diff changeset
   190
                           int ll, int lc, const char *lfile, long int lorder)			\
9df7fcb9bde5 Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents: 286
diff changeset
   191
			  :symbol_c(fl, fc, ffile, forder, ll, lc, lfile, lorder) {}		\
286
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   192
void *class_name_c::accept(visitor_c &visitor) {return visitor.visit(this);}
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   193
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   194
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   195
#define SYM_REF1(class_name_c, ref1, ...)							\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   196
class_name_c::class_name_c(symbol_c *ref1,							\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   197
                           int fl, int fc, const char *ffile, long int forder,			\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   198
                           int ll, int lc, const char *lfile, long int lorder)			\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   199
			  :symbol_c(fl, fc, ffile, forder, ll, lc, lfile, lorder) {		\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   200
  this->ref1 = ref1;										\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   201
}												\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   202
void *class_name_c::accept(visitor_c &visitor) {return visitor.visit(this);}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   203
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   204
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   205
#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: 287
diff changeset
   206
class_name_c::class_name_c(symbol_c *ref1,							\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   207
			   symbol_c *ref2,							\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   208
                           int fl, int fc, const char *ffile, long int forder,			\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   209
                           int ll, int lc, const char *lfile, long int lorder)			\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   210
			  :symbol_c(fl, fc, ffile, forder, ll, lc, lfile, lorder) {		\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   211
  this->ref1 = ref1;										\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   212
  this->ref2 = ref2;										\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   213
}												\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   214
void *class_name_c::accept(visitor_c &visitor) {return visitor.visit(this);}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   215
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   216
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   217
#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: 287
diff changeset
   218
class_name_c::class_name_c(symbol_c *ref1,							\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   219
			   symbol_c *ref2,							\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   220
			   symbol_c *ref3,							\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   221
                           int fl, int fc, const char *ffile, long int forder,			\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   222
                           int ll, int lc, const char *lfile, long int lorder)			\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   223
			  :symbol_c(fl, fc, ffile, forder, ll, lc, lfile, lorder) {		\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   224
  this->ref1 = ref1;										\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   225
  this->ref2 = ref2;										\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   226
  this->ref3 = ref3;										\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   227
}												\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   228
void *class_name_c::accept(visitor_c &visitor) {return visitor.visit(this);}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   229
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   230
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   231
#define SYM_REF4(class_name_c, ref1, ref2, ref3, ref4, ...)					\
286
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   232
class_name_c::class_name_c(symbol_c *ref1,							\
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   233
			   symbol_c *ref2,							\
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   234
			   symbol_c *ref3,							\
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   235
			   symbol_c *ref4,							\
287
9df7fcb9bde5 Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents: 286
diff changeset
   236
                           int fl, int fc, const char *ffile, long int forder,			\
9df7fcb9bde5 Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents: 286
diff changeset
   237
                           int ll, int lc, const char *lfile, long int lorder)			\
9df7fcb9bde5 Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents: 286
diff changeset
   238
			  :symbol_c(fl, fc, ffile, forder, ll, lc, lfile, lorder) {		\
286
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   239
  this->ref1 = ref1;										\
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   240
  this->ref2 = ref2;										\
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   241
  this->ref3 = ref3;										\
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   242
  this->ref4 = ref4;										\
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   243
}												\
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   244
void *class_name_c::accept(visitor_c &visitor) {return visitor.visit(this);}
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   245
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   246
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   247
#define SYM_REF5(class_name_c, ref1, ref2, ref3, ref4, ref5, ...)				\
286
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   248
class_name_c::class_name_c(symbol_c *ref1,							\
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   249
			   symbol_c *ref2,							\
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   250
			   symbol_c *ref3,							\
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   251
			   symbol_c *ref4,							\
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   252
			   symbol_c *ref5,							\
287
9df7fcb9bde5 Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents: 286
diff changeset
   253
                           int fl, int fc, const char *ffile, long int forder,			\
9df7fcb9bde5 Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents: 286
diff changeset
   254
                           int ll, int lc, const char *lfile, long int lorder)			\
9df7fcb9bde5 Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents: 286
diff changeset
   255
			  :symbol_c(fl, fc, ffile, forder, ll, lc, lfile, lorder) {		\
286
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   256
  this->ref1 = ref1;										\
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   257
  this->ref2 = ref2;										\
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   258
  this->ref3 = ref3;										\
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   259
  this->ref4 = ref4;										\
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   260
  this->ref5 = ref5;										\
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   261
}												\
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   262
void *class_name_c::accept(visitor_c &visitor) {return visitor.visit(this);}
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   263
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   264
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   265
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 287
diff changeset
   266
#define SYM_REF6(class_name_c, ref1, ref2, ref3, ref4, ref5, ref6, ...)				\
286
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   267
class_name_c::class_name_c(symbol_c *ref1,							\
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   268
			   symbol_c *ref2,							\
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   269
			   symbol_c *ref3,							\
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   270
			   symbol_c *ref4,							\
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   271
			   symbol_c *ref5,							\
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   272
			   symbol_c *ref6,							\
287
9df7fcb9bde5 Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents: 286
diff changeset
   273
                           int fl, int fc, const char *ffile, long int forder,			\
9df7fcb9bde5 Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents: 286
diff changeset
   274
                           int ll, int lc, const char *lfile, long int lorder)			\
9df7fcb9bde5 Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents: 286
diff changeset
   275
			  :symbol_c(fl, fc, ffile, forder, ll, lc, lfile, lorder) {		\
286
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   276
  this->ref1 = ref1;										\
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   277
  this->ref2 = ref2;										\
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   278
  this->ref3 = ref3;										\
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   279
  this->ref4 = ref4;										\
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   280
  this->ref5 = ref5;										\
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   281
  this->ref6 = ref6;										\
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   282
}												\
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   283
void *class_name_c::accept(visitor_c &visitor) {return visitor.visit(this);}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   284
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   285
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   286
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   287
#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
   288
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   289
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   290
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   291
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   292
#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
   293
#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
   294
#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
   295
#undef SYM_REF0
69
41cb5b80416e Adding basic error checking.
mario
parents: 15
diff changeset
   296
#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
   297
#undef SYM_REF2
69
41cb5b80416e Adding basic error checking.
mario
parents: 15
diff changeset
   298
#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
   299
#undef SYM_REF4
69
41cb5b80416e Adding basic error checking.
mario
parents: 15
diff changeset
   300
#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
   301
#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
   302
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   303
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   304
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   305
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   306