author | Edouard Tisserant |
Tue, 15 Feb 2022 10:34:23 +0100 | |
changeset 1098 | 84bbafb4fb26 |
parent 1087 | d9e47e018320 |
permissions | -rw-r--r-- |
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 |
* Declaration 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 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
37 |
* ABSYNTAX.H |
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 |
* This generates the parse tree structure used to bind the components |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
40 |
* identified by Bison in the correct syntax order. At the end of the |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
41 |
* Bison analysis the tree is walked in a sequential fashion generating |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
42 |
* the relavent code. |
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 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
45 |
#ifndef _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
|
46 |
#define _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
|
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 |
#include <stdio.h> // required for NULL |
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
|
50 |
#include <vector> |
738
e47cc8c954db
Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents:
659
diff
changeset
|
51 |
#include <map> |
564
dabffc3086dc
Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
459
diff
changeset
|
52 |
#include <string> |
565
8acbddf75333
Fix a few bugs of previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
564
diff
changeset
|
53 |
#include <stdint.h> // required for uint64_t, etc... |
607
be9ba3531afb
cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents:
572
diff
changeset
|
54 |
#include "../main.hh" // required for uint8_t, real_64_t, ..., and the macros INT8_MAX, REAL32_MAX, ... */ |
be9ba3531afb
cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents:
572
diff
changeset
|
55 |
|
be9ba3531afb
cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents:
572
diff
changeset
|
56 |
|
568
5f79478142d7
make the compiler platform independent (i.e. no longer assume sizeof(double)==8).
Mario de Sousa <msousa@fe.up.pt>
parents:
565
diff
changeset
|
57 |
|
5f79478142d7
make the compiler platform independent (i.e. no longer assume sizeof(double)==8).
Mario de Sousa <msousa@fe.up.pt>
parents:
565
diff
changeset
|
58 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
59 |
/* Forward declaration of the visitor interface |
564
dabffc3086dc
Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
459
diff
changeset
|
60 |
* declared in the visitor.hh file |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
61 |
* We cannot include the visitor.hh file, as it will |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
62 |
* include this same file first, as it too requires references |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
63 |
* to the abstract syntax classes defined here. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
64 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
65 |
class visitor_c; // forward declaration |
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 |
class symbol_c; // forward declaration |
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 |
|
569
0d1ab9e78574
Add data structure for storing overflow of constant values.
Mario de Sousa <msousa@fe.up.pt>
parents:
568
diff
changeset
|
71 |
|
0d1ab9e78574
Add data structure for storing overflow of constant values.
Mario de Sousa <msousa@fe.up.pt>
parents:
568
diff
changeset
|
72 |
|
0d1ab9e78574
Add data structure for storing overflow of constant values.
Mario de Sousa <msousa@fe.up.pt>
parents:
568
diff
changeset
|
73 |
|
0d1ab9e78574
Add data structure for storing overflow of constant values.
Mario de Sousa <msousa@fe.up.pt>
parents:
568
diff
changeset
|
74 |
|
0d1ab9e78574
Add data structure for storing overflow of constant values.
Mario de Sousa <msousa@fe.up.pt>
parents:
568
diff
changeset
|
75 |
|
738
e47cc8c954db
Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents:
659
diff
changeset
|
76 |
/* Case insensitive string compare */ |
e47cc8c954db
Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents:
659
diff
changeset
|
77 |
/* Case insensitive string compare copied from |
e47cc8c954db
Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents:
659
diff
changeset
|
78 |
* "The C++ Programming Language" - 3rd Edition |
e47cc8c954db
Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents:
659
diff
changeset
|
79 |
* by Bjarne Stroustrup, ISBN 0201889544. |
e47cc8c954db
Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents:
659
diff
changeset
|
80 |
*/ |
e47cc8c954db
Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents:
659
diff
changeset
|
81 |
class nocasecmp_c { |
e47cc8c954db
Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents:
659
diff
changeset
|
82 |
public: |
e47cc8c954db
Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents:
659
diff
changeset
|
83 |
bool operator() (const std::string& x, const std::string& y) const { |
e47cc8c954db
Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents:
659
diff
changeset
|
84 |
std::string::const_iterator ix = x.begin(); |
e47cc8c954db
Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents:
659
diff
changeset
|
85 |
std::string::const_iterator iy = y.begin(); |
e47cc8c954db
Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents:
659
diff
changeset
|
86 |
|
e47cc8c954db
Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents:
659
diff
changeset
|
87 |
for(; (ix != x.end()) && (iy != y.end()) && (toupper(*ix) == toupper(*iy)); ++ix, ++iy); |
e47cc8c954db
Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents:
659
diff
changeset
|
88 |
if (ix == x.end()) return (iy != y.end()); |
e47cc8c954db
Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents:
659
diff
changeset
|
89 |
if (iy == y.end()) return false; |
e47cc8c954db
Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents:
659
diff
changeset
|
90 |
return (toupper(*ix) < toupper(*iy)); |
e47cc8c954db
Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents:
659
diff
changeset
|
91 |
}; |
e47cc8c954db
Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents:
659
diff
changeset
|
92 |
}; |
e47cc8c954db
Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents:
659
diff
changeset
|
93 |
|
e47cc8c954db
Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents:
659
diff
changeset
|
94 |
|
e47cc8c954db
Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents:
659
diff
changeset
|
95 |
|
965
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
96 |
/*** constant folding ***/ |
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
97 |
/* During stage 3 (semantic analysis/checking) we will be doing constant folding. |
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
98 |
* That algorithm will anotate the abstract syntax tree with the result of operations |
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
99 |
* on literals (i.e. 44 + 55 will store the result 99). |
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
100 |
* Since the same source code (e.g. 1 + 0) may actually be a BOOL or an ANY_INT, |
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
101 |
* or an ANY_BIT, we need to handle all possibilities, and determine the result of the |
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
102 |
* operation assuming each type. |
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
103 |
* For this reason, we have one entry for each possible type, with some expressions |
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
104 |
* having more than one entry filled in! |
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
105 |
*/ |
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
106 |
class const_value_c { |
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
107 |
public: |
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
108 |
typedef enum { cs_undefined, /* not defined/not yet evaluated --> const_value is not valid! */ |
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
109 |
cs_non_const, /* we have determined that expression is not a const value --> const_value is not valid! */ |
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
110 |
cs_const_value, /* const value is valid */ |
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
111 |
cs_overflow /* result produced overflow or underflow --> const_value is not valid! */ |
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
112 |
} const_status_t; |
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
113 |
|
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
114 |
template<typename value_type> class const_value__ { |
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
115 |
const_status_t status; |
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
116 |
value_type value; |
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
117 |
|
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
118 |
public: |
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
119 |
const_value__(void): status(cs_undefined), value(0) {}; |
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
120 |
|
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
121 |
value_type get(void) {return value;} |
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
122 |
void set(value_type value_) {status = cs_const_value; value = value_;} |
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
123 |
void set_overflow(void) {status = cs_overflow ;} |
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
124 |
void set_nonconst(void) {status = cs_non_const ;} |
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
125 |
bool is_valid (void) {return (status == cs_const_value);} |
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
126 |
bool is_overflow (void) {return (status == cs_overflow );} |
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
127 |
bool is_nonconst (void) {return (status == cs_non_const );} |
978 | 128 |
bool is_undefined(void) {return (status == cs_undefined );} |
965
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
129 |
bool is_zero (void) {return (is_valid() && (get() == 0));} |
983
ead554e12195
Add check whether the same constant var_external variable is initialised with two (or more) different constant values.
mjsousa
parents:
978
diff
changeset
|
130 |
|
ead554e12195
Add check whether the same constant var_external variable is initialised with two (or more) different constant values.
mjsousa
parents:
978
diff
changeset
|
131 |
/* comparison operator */ |
ead554e12195
Add check whether the same constant var_external variable is initialised with two (or more) different constant values.
mjsousa
parents:
978
diff
changeset
|
132 |
bool operator==(const const_value__ cv) { |
ead554e12195
Add check whether the same constant var_external variable is initialised with two (or more) different constant values.
mjsousa
parents:
978
diff
changeset
|
133 |
return ( ((status!=cs_const_value) && (status==cv.status)) |
ead554e12195
Add check whether the same constant var_external variable is initialised with two (or more) different constant values.
mjsousa
parents:
978
diff
changeset
|
134 |
|| ((status==cs_const_value) && (value ==cv.value ))); |
ead554e12195
Add check whether the same constant var_external variable is initialised with two (or more) different constant values.
mjsousa
parents:
978
diff
changeset
|
135 |
} |
ead554e12195
Add check whether the same constant var_external variable is initialised with two (or more) different constant values.
mjsousa
parents:
978
diff
changeset
|
136 |
|
965
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
137 |
}; |
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
138 |
|
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
139 |
const_value__< int64_t> _int64; /* status is initialised to UNDEFINED */ |
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
140 |
const_value__<uint64_t> _uint64; /* status is initialised to UNDEFINED */ |
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
141 |
const_value__<real64_t> _real64; /* status is initialised to UNDEFINED */ |
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
142 |
const_value__<bool > _bool; /* status is initialised to UNDEFINED */ |
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
143 |
|
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
144 |
/* default constructor and destructor */ |
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
145 |
const_value_c(void) {}; |
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
146 |
~const_value_c(void) {}; |
983
ead554e12195
Add check whether the same constant var_external variable is initialised with two (or more) different constant values.
mjsousa
parents:
978
diff
changeset
|
147 |
|
ead554e12195
Add check whether the same constant var_external variable is initialised with two (or more) different constant values.
mjsousa
parents:
978
diff
changeset
|
148 |
/* comparison operator */ |
ead554e12195
Add check whether the same constant var_external variable is initialised with two (or more) different constant values.
mjsousa
parents:
978
diff
changeset
|
149 |
bool operator==(const const_value_c cv) |
ead554e12195
Add check whether the same constant var_external variable is initialised with two (or more) different constant values.
mjsousa
parents:
978
diff
changeset
|
150 |
{return ((_int64==cv._int64) && (_uint64==cv._uint64) && (_real64==cv._real64) && (_bool==cv._bool));} |
1000
556b74055518
Add check for repeated elements in a CASE statement. Emit warnings (and not errors) if found.
mjsousa
parents:
983
diff
changeset
|
151 |
|
556b74055518
Add check for repeated elements in a CASE statement. Emit warnings (and not errors) if found.
mjsousa
parents:
983
diff
changeset
|
152 |
/* return true if at least one of the const values (int, real, ...) is a valid const value */ |
556b74055518
Add check for repeated elements in a CASE statement. Emit warnings (and not errors) if found.
mjsousa
parents:
983
diff
changeset
|
153 |
bool is_const(void) |
556b74055518
Add check for repeated elements in a CASE statement. Emit warnings (and not errors) if found.
mjsousa
parents:
983
diff
changeset
|
154 |
{return (_int64.is_valid() || _uint64.is_valid() || _real64.is_valid() || _bool.is_valid());} |
965
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
155 |
}; |
569
0d1ab9e78574
Add data structure for storing overflow of constant values.
Mario de Sousa <msousa@fe.up.pt>
parents:
568
diff
changeset
|
156 |
|
1043
4165b7189c32
Add token reference to all symbol_c, and add list_c::find_element()
Mario de Sousa <msousa@fe.up.pt>
parents:
1041
diff
changeset
|
157 |
// A forward declaration |
4165b7189c32
Add token reference to all symbol_c, and add list_c::find_element()
Mario de Sousa <msousa@fe.up.pt>
parents:
1041
diff
changeset
|
158 |
class token_c; |
569
0d1ab9e78574
Add data structure for storing overflow of constant values.
Mario de Sousa <msousa@fe.up.pt>
parents:
568
diff
changeset
|
159 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
160 |
/* The base class of all symbols */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
161 |
class symbol_c { |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
162 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
163 |
public: |
659
165aa7b87e0d
add method for printing class_name. USE ONLY FOR DEBUGING!
Mario de Sousa <msousa@fe.up.pt>
parents:
655
diff
changeset
|
164 |
/* WARNING: only use this method for debugging purposes!! */ |
165aa7b87e0d
add method for printing class_name. USE ONLY FOR DEBUGING!
Mario de Sousa <msousa@fe.up.pt>
parents:
655
diff
changeset
|
165 |
virtual const char *absyntax_cname(void) {return "symbol_c";}; |
165aa7b87e0d
add method for printing class_name. USE ONLY FOR DEBUGING!
Mario de Sousa <msousa@fe.up.pt>
parents:
655
diff
changeset
|
166 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
167 |
/* |
913
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
889
diff
changeset
|
168 |
* Annotations produced during stage 1_2 |
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
889
diff
changeset
|
169 |
*/ |
936
0f7bcc160568
Fix bug: Add support for de-referencing pointers to struct (struct_ptr^.elem1) when used inside FB.
mjsousa
parents:
913
diff
changeset
|
170 |
/* Points to the parent symbol in the AST, i.e. the symbol in the AST that will contain the current symbol */ |
1043
4165b7189c32
Add token reference to all symbol_c, and add list_c::find_element()
Mario de Sousa <msousa@fe.up.pt>
parents:
1041
diff
changeset
|
171 |
symbol_c *parent; |
4165b7189c32
Add token reference to all symbol_c, and add list_c::find_element()
Mario de Sousa <msousa@fe.up.pt>
parents:
1041
diff
changeset
|
172 |
/* Some symbols may not be tokens, but may be clearly identified by a token. |
4165b7189c32
Add token reference to all symbol_c, and add list_c::find_element()
Mario de Sousa <msousa@fe.up.pt>
parents:
1041
diff
changeset
|
173 |
* For e.g., a FUNCTION declaration is not itself a token, but may be clearly identified by the |
4165b7189c32
Add token reference to all symbol_c, and add list_c::find_element()
Mario de Sousa <msousa@fe.up.pt>
parents:
1041
diff
changeset
|
174 |
* token_c object that contains it's name. Another example is an element in a STRUCT declaration, |
4165b7189c32
Add token reference to all symbol_c, and add list_c::find_element()
Mario de Sousa <msousa@fe.up.pt>
parents:
1041
diff
changeset
|
175 |
* where the structure_element_declaration_c is not itself a token, but can be clearly identified |
4165b7189c32
Add token reference to all symbol_c, and add list_c::find_element()
Mario de Sousa <msousa@fe.up.pt>
parents:
1041
diff
changeset
|
176 |
* by the structure_element_name |
4165b7189c32
Add token reference to all symbol_c, and add list_c::find_element()
Mario de Sousa <msousa@fe.up.pt>
parents:
1041
diff
changeset
|
177 |
* To make it easier to find these tokens from the top level object, we will have the stage1_2 populate this |
4165b7189c32
Add token reference to all symbol_c, and add list_c::find_element()
Mario de Sousa <msousa@fe.up.pt>
parents:
1041
diff
changeset
|
178 |
* token_c *token wherever it makes sense. |
4165b7189c32
Add token reference to all symbol_c, and add list_c::find_element()
Mario de Sousa <msousa@fe.up.pt>
parents:
1041
diff
changeset
|
179 |
* NOTE: This was a late addition to the AST. Not all objects may be currently so populated. |
4165b7189c32
Add token reference to all symbol_c, and add list_c::find_element()
Mario de Sousa <msousa@fe.up.pt>
parents:
1041
diff
changeset
|
180 |
* If you need this please make sure the bison code is populating it correctly for your use case. |
4165b7189c32
Add token reference to all symbol_c, and add list_c::find_element()
Mario de Sousa <msousa@fe.up.pt>
parents:
1041
diff
changeset
|
181 |
*/ |
4165b7189c32
Add token reference to all symbol_c, and add list_c::find_element()
Mario de Sousa <msousa@fe.up.pt>
parents:
1041
diff
changeset
|
182 |
token_c *token; |
936
0f7bcc160568
Fix bug: Add support for de-referencing pointers to struct (struct_ptr^.elem1) when used inside FB.
mjsousa
parents:
913
diff
changeset
|
183 |
|
913
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
889
diff
changeset
|
184 |
/* Line number for the purposes of error checking. */ |
69 | 185 |
int first_line; |
186 |
int first_column; |
|
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
187 |
const char *first_file; /* filename referenced by first line/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
|
188 |
long int first_order; /* relative order in which it is read by lexcial analyser */ |
69 | 189 |
int last_line; |
190 |
int last_column; |
|
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
191 |
const char *last_file; /* filename referenced by last line/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
|
192 |
long int last_order; /* relative order in which it is read by lexcial analyser */ |
569
0d1ab9e78574
Add data structure for storing overflow of constant values.
Mario de Sousa <msousa@fe.up.pt>
parents:
568
diff
changeset
|
193 |
|
0d1ab9e78574
Add data structure for storing overflow of constant values.
Mario de Sousa <msousa@fe.up.pt>
parents:
568
diff
changeset
|
194 |
|
0d1ab9e78574
Add data structure for storing overflow of constant values.
Mario de Sousa <msousa@fe.up.pt>
parents:
568
diff
changeset
|
195 |
/* |
0d1ab9e78574
Add data structure for storing overflow of constant values.
Mario de Sousa <msousa@fe.up.pt>
parents:
568
diff
changeset
|
196 |
* Annotations produced during stage 3 |
738
e47cc8c954db
Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents:
659
diff
changeset
|
197 |
*/ |
569
0d1ab9e78574
Add data structure for storing overflow of constant values.
Mario de Sousa <msousa@fe.up.pt>
parents:
568
diff
changeset
|
198 |
/*** Data type analysis ***/ |
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
|
199 |
std::vector <symbol_c *> candidate_datatypes; /* All possible data types the expression/literal/etc. may take. Filled in stage3 by fill_candidate_datatypes_c class */ |
459
01f6664bf8c5
Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents:
438
diff
changeset
|
200 |
/* Data type of the expression/literal/etc. Filled in stage3 by narrow_candidate_datatypes_c |
01f6664bf8c5
Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents:
438
diff
changeset
|
201 |
* If set to NULL, it means it has not yet been evaluated. |
01f6664bf8c5
Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents:
438
diff
changeset
|
202 |
* If it points to an object of type invalid_type_name_c, it means it is invalid. |
01f6664bf8c5
Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents:
438
diff
changeset
|
203 |
* Otherwise, it points to an object of the apropriate data type (e.g. int_type_name_c, bool_type_name_c, ...) |
01f6664bf8c5
Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents:
438
diff
changeset
|
204 |
*/ |
564
dabffc3086dc
Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
459
diff
changeset
|
205 |
symbol_c *datatype; |
889
5f380b99e95e
Correctly handle structured variables that include FB and external FBs (example: FB1.FB2.extFB3.FB4.extFB5.extFB6.structvar.field1 := 42;) (this commit fixes only ST code. TODO: IL and SFC)
mjsousa
parents:
775
diff
changeset
|
206 |
/* The POU in which the symbolic variable (or structured variable, or array variable, or located variable, - any more?) |
5f380b99e95e
Correctly handle structured variables that include FB and external FBs (example: FB1.FB2.extFB3.FB4.extFB5.extFB6.structvar.field1 := 42;) (this commit fixes only ST code. TODO: IL and SFC)
mjsousa
parents:
775
diff
changeset
|
207 |
* was declared. This will point to a Configuration, Resource, Program, FB, or Function. |
938
31e3b3f2eff1
Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents:
936
diff
changeset
|
208 |
* This is set in stage 3 by the datatype analyser algorithm (fill/narrow) for the symbols: |
31e3b3f2eff1
Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents:
936
diff
changeset
|
209 |
* symbolic_variable_c, array_variable_c, structured_variable_c |
889
5f380b99e95e
Correctly handle structured variables that include FB and external FBs (example: FB1.FB2.extFB3.FB4.extFB5.extFB6.structvar.field1 := 42;) (this commit fixes only ST code. TODO: IL and SFC)
mjsousa
parents:
775
diff
changeset
|
210 |
*/ |
5f380b99e95e
Correctly handle structured variables that include FB and external FBs (example: FB1.FB2.extFB3.FB4.extFB5.extFB6.structvar.field1 := 42;) (this commit fixes only ST code. TODO: IL and SFC)
mjsousa
parents:
775
diff
changeset
|
211 |
symbol_c *scope; |
564
dabffc3086dc
Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
459
diff
changeset
|
212 |
|
569
0d1ab9e78574
Add data structure for storing overflow of constant values.
Mario de Sousa <msousa@fe.up.pt>
parents:
568
diff
changeset
|
213 |
/*** constant folding ***/ |
965
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
214 |
/* If the symbol has a constant numerical value, this will be set to that value by constant_folding_c */ |
c9eeb67ba939
Small code re-organization of how const values are stored in symbol_c (can now be accessed through member functions, instead of macros)
mjsousa
parents:
958
diff
changeset
|
215 |
const_value_c const_value; |
569
0d1ab9e78574
Add data structure for storing overflow of constant values.
Mario de Sousa <msousa@fe.up.pt>
parents:
568
diff
changeset
|
216 |
|
738
e47cc8c954db
Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents:
659
diff
changeset
|
217 |
/*** Enumeration datatype checking ***/ |
e47cc8c954db
Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents:
659
diff
changeset
|
218 |
/* Not all symbols will contain the following anotations, which is why they are not declared here in symbol_c |
e47cc8c954db
Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents:
659
diff
changeset
|
219 |
* They will be declared only inside the symbols that require them (have a look at absyntax.def) |
e47cc8c954db
Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents:
659
diff
changeset
|
220 |
*/ |
e47cc8c954db
Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents:
659
diff
changeset
|
221 |
typedef std::multimap<std::string, symbol_c *, nocasecmp_c> enumvalue_symtable_t; |
e47cc8c954db
Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents:
659
diff
changeset
|
222 |
|
913
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
889
diff
changeset
|
223 |
/* |
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
889
diff
changeset
|
224 |
* Annotations produced during stage 4 |
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
889
diff
changeset
|
225 |
*/ |
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
889
diff
changeset
|
226 |
/* Since we support several distinct stage_4 implementations, having explicit entries for each |
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
889
diff
changeset
|
227 |
* possible use would quickly get out of hand. |
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
889
diff
changeset
|
228 |
* We therefore simply add a map, that each stage 4 may use for all its needs. |
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
889
diff
changeset
|
229 |
*/ |
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
889
diff
changeset
|
230 |
typedef std::map<std::string, symbol_c *> anotations_map_t; |
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
889
diff
changeset
|
231 |
anotations_map_t anotations_map; |
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
889
diff
changeset
|
232 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
233 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
234 |
public: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
235 |
/* default constructor */ |
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 |
symbol_c(int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, /* order in which it is read by lexcial analyser */ |
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 = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0 /* order in which it is read by lexcial analyser */ |
69 | 238 |
); |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
239 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
240 |
/* default destructor */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
241 |
/* must be virtual so compiler does not complain... */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
242 |
virtual ~symbol_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
|
243 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
244 |
virtual void *accept(visitor_c &visitor) {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
|
245 |
}; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
246 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
247 |
|
738
e47cc8c954db
Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents:
659
diff
changeset
|
248 |
|
e47cc8c954db
Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents:
659
diff
changeset
|
249 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
250 |
class token_c: public symbol_c { |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
251 |
public: |
659
165aa7b87e0d
add method for printing class_name. USE ONLY FOR DEBUGING!
Mario de Sousa <msousa@fe.up.pt>
parents:
655
diff
changeset
|
252 |
/* WARNING: only use this method for debugging purposes!! */ |
165aa7b87e0d
add method for printing class_name. USE ONLY FOR DEBUGING!
Mario de Sousa <msousa@fe.up.pt>
parents:
655
diff
changeset
|
253 |
virtual const char *absyntax_cname(void) {return "token_c";}; |
165aa7b87e0d
add method for printing class_name. USE ONLY FOR DEBUGING!
Mario de Sousa <msousa@fe.up.pt>
parents:
655
diff
changeset
|
254 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
255 |
/* the value of the symbol. */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
256 |
const char *value; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
257 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
258 |
public: |
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
259 |
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
|
260 |
int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, /* order in which it is read by lexcial analyser */ |
9df7fcb9bde5
Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents:
286
diff
changeset
|
261 |
int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0 /* order in which it is read by lexcial analyser */ |
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
262 |
); |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
263 |
}; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
264 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
265 |
|
738
e47cc8c954db
Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents:
659
diff
changeset
|
266 |
|
e47cc8c954db
Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents:
659
diff
changeset
|
267 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
268 |
/* a list of symbols... */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
269 |
class list_c: public symbol_c { |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
270 |
public: |
659
165aa7b87e0d
add method for printing class_name. USE ONLY FOR DEBUGING!
Mario de Sousa <msousa@fe.up.pt>
parents:
655
diff
changeset
|
271 |
/* WARNING: only use this method for debugging purposes!! */ |
165aa7b87e0d
add method for printing class_name. USE ONLY FOR DEBUGING!
Mario de Sousa <msousa@fe.up.pt>
parents:
655
diff
changeset
|
272 |
virtual const char *absyntax_cname(void) {return "list_c";}; |
165aa7b87e0d
add method for printing class_name. USE ONLY FOR DEBUGING!
Mario de Sousa <msousa@fe.up.pt>
parents:
655
diff
changeset
|
273 |
|
655 | 274 |
int c,n; /* c: current capacity of list (malloc'd memory); n: current number of elements in list */ |
1041
56ebe2a31b5b
Access elements[] in list_c through a new get_element() method.
Mario de Sousa <msousa@fe.up.pt>
parents:
1000
diff
changeset
|
275 |
private: |
1043
4165b7189c32
Add token reference to all symbol_c, and add list_c::find_element()
Mario de Sousa <msousa@fe.up.pt>
parents:
1041
diff
changeset
|
276 |
// symbol_c **elements; |
4165b7189c32
Add token reference to all symbol_c, and add list_c::find_element()
Mario de Sousa <msousa@fe.up.pt>
parents:
1041
diff
changeset
|
277 |
typedef struct { |
4165b7189c32
Add token reference to all symbol_c, and add list_c::find_element()
Mario de Sousa <msousa@fe.up.pt>
parents:
1041
diff
changeset
|
278 |
const char *token_value; |
4165b7189c32
Add token reference to all symbol_c, and add list_c::find_element()
Mario de Sousa <msousa@fe.up.pt>
parents:
1041
diff
changeset
|
279 |
symbol_c *symbol; |
4165b7189c32
Add token reference to all symbol_c, and add list_c::find_element()
Mario de Sousa <msousa@fe.up.pt>
parents:
1041
diff
changeset
|
280 |
} element_entry_t; |
4165b7189c32
Add token reference to all symbol_c, and add list_c::find_element()
Mario de Sousa <msousa@fe.up.pt>
parents:
1041
diff
changeset
|
281 |
element_entry_t *elements; |
4165b7189c32
Add token reference to all symbol_c, and add list_c::find_element()
Mario de Sousa <msousa@fe.up.pt>
parents:
1041
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 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
284 |
public: |
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
|
285 |
list_c(int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, /* order in which it is read by lexcial analyser */ |
9df7fcb9bde5
Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents:
286
diff
changeset
|
286 |
int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0 /* order in which it is read by lexcial analyser */ |
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
287 |
); |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
288 |
|
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
289 |
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
|
290 |
int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, /* order in which it is read by lexcial analyser */ |
9df7fcb9bde5
Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents:
286
diff
changeset
|
291 |
int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0 /* order in which it is read by lexcial analyser */ |
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
292 |
); |
1041
56ebe2a31b5b
Access elements[] in list_c through a new get_element() method.
Mario de Sousa <msousa@fe.up.pt>
parents:
1000
diff
changeset
|
293 |
/* get element in position pos of the list */ |
56ebe2a31b5b
Access elements[] in list_c through a new get_element() method.
Mario de Sousa <msousa@fe.up.pt>
parents:
1000
diff
changeset
|
294 |
virtual symbol_c *get_element(int pos); |
1043
4165b7189c32
Add token reference to all symbol_c, and add list_c::find_element()
Mario de Sousa <msousa@fe.up.pt>
parents:
1041
diff
changeset
|
295 |
/* find element associated to token value */ |
4165b7189c32
Add token reference to all symbol_c, and add list_c::find_element()
Mario de Sousa <msousa@fe.up.pt>
parents:
1041
diff
changeset
|
296 |
virtual symbol_c *find_element(symbol_c *token); |
4165b7189c32
Add token reference to all symbol_c, and add list_c::find_element()
Mario de Sousa <msousa@fe.up.pt>
parents:
1041
diff
changeset
|
297 |
virtual symbol_c *find_element(const char *token_value); |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
298 |
/* 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
|
299 |
virtual void add_element(symbol_c *elem); |
1043
4165b7189c32
Add token reference to all symbol_c, and add list_c::find_element()
Mario de Sousa <msousa@fe.up.pt>
parents:
1041
diff
changeset
|
300 |
virtual void add_element(symbol_c *elem, symbol_c *token); |
4165b7189c32
Add token reference to all symbol_c, and add list_c::find_element()
Mario de Sousa <msousa@fe.up.pt>
parents:
1041
diff
changeset
|
301 |
virtual void add_element(symbol_c *elem, const char *token_value); |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
302 |
/* 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
|
303 |
/* 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
|
304 |
/* To insert into the end of list, call with pos=list->n */ |
1043
4165b7189c32
Add token reference to all symbol_c, and add list_c::find_element()
Mario de Sousa <msousa@fe.up.pt>
parents:
1041
diff
changeset
|
305 |
virtual void insert_element(symbol_c *elem, const char *token_value, int pos = 0); |
4165b7189c32
Add token reference to all symbol_c, and add list_c::find_element()
Mario de Sousa <msousa@fe.up.pt>
parents:
1041
diff
changeset
|
306 |
virtual void insert_element(symbol_c *elem, symbol_c *token, int pos = 0); |
4165b7189c32
Add token reference to all symbol_c, and add list_c::find_element()
Mario de Sousa <msousa@fe.up.pt>
parents:
1041
diff
changeset
|
307 |
virtual void insert_element(symbol_c *elem, int pos = 0); |
4165b7189c32
Add token reference to all symbol_c, and add list_c::find_element()
Mario de Sousa <msousa@fe.up.pt>
parents:
1041
diff
changeset
|
308 |
//virtual void insert_element(symbol_c *elem, int pos, std::string map_ref); |
438
744b125d911e
Add support for semantic verification of function calls in IL.
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
309 |
/* 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
|
310 |
virtual void remove_element(int pos = 0); |
958
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
938
diff
changeset
|
311 |
/* remove all elements from list. Does not delete the elements in the list! */ |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
938
diff
changeset
|
312 |
virtual void clear(void); |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
313 |
}; |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
314 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
315 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
316 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
317 |
|
738
e47cc8c954db
Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents:
659
diff
changeset
|
318 |
|
e47cc8c954db
Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents:
659
diff
changeset
|
319 |
|
e47cc8c954db
Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents:
659
diff
changeset
|
320 |
|
e47cc8c954db
Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents:
659
diff
changeset
|
321 |
|
e47cc8c954db
Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents:
659
diff
changeset
|
322 |
|
568
5f79478142d7
make the compiler platform independent (i.e. no longer assume sizeof(double)==8).
Mario de Sousa <msousa@fe.up.pt>
parents:
565
diff
changeset
|
323 |
#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
|
324 |
class class_name_c: public list_c { \ |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
325 |
public: \ |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
326 |
__VA_ARGS__ \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
327 |
public: \ |
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
328 |
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
|
329 |
int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, \ |
9df7fcb9bde5
Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents:
286
diff
changeset
|
330 |
int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \ |
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
331 |
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
|
332 |
int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, \ |
9df7fcb9bde5
Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents:
286
diff
changeset
|
333 |
int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \ |
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
334 |
virtual void *accept(visitor_c &visitor); \ |
659
165aa7b87e0d
add method for printing class_name. USE ONLY FOR DEBUGING!
Mario de Sousa <msousa@fe.up.pt>
parents:
655
diff
changeset
|
335 |
/* WARNING: only use this method for debugging purposes!! */ \ |
165aa7b87e0d
add method for printing class_name. USE ONLY FOR DEBUGING!
Mario de Sousa <msousa@fe.up.pt>
parents:
655
diff
changeset
|
336 |
virtual const char *absyntax_cname(void) {return #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
|
337 |
}; |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
338 |
|
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
339 |
|
568
5f79478142d7
make the compiler platform independent (i.e. no longer assume sizeof(double)==8).
Mario de Sousa <msousa@fe.up.pt>
parents:
565
diff
changeset
|
340 |
#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
|
341 |
class class_name_c: public token_c { \ |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
342 |
public: \ |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
343 |
__VA_ARGS__ \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
344 |
public: \ |
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
345 |
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
|
346 |
int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, \ |
9df7fcb9bde5
Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents:
286
diff
changeset
|
347 |
int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \ |
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
348 |
virtual void *accept(visitor_c &visitor); \ |
659
165aa7b87e0d
add method for printing class_name. USE ONLY FOR DEBUGING!
Mario de Sousa <msousa@fe.up.pt>
parents:
655
diff
changeset
|
349 |
/* WARNING: only use this method for debugging purposes!! */ \ |
165aa7b87e0d
add method for printing class_name. USE ONLY FOR DEBUGING!
Mario de Sousa <msousa@fe.up.pt>
parents:
655
diff
changeset
|
350 |
virtual const char *absyntax_cname(void) {return #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
|
351 |
}; |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
352 |
|
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
353 |
|
568
5f79478142d7
make the compiler platform independent (i.e. no longer assume sizeof(double)==8).
Mario de Sousa <msousa@fe.up.pt>
parents:
565
diff
changeset
|
354 |
#define SYM_REF0(class_name_c, ...) \ |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
355 |
class class_name_c: public symbol_c { \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
356 |
public: \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
357 |
__VA_ARGS__ \ |
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
358 |
public: \ |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
359 |
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
|
360 |
int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, \ |
9df7fcb9bde5
Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents:
286
diff
changeset
|
361 |
int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \ |
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
362 |
virtual void *accept(visitor_c &visitor); \ |
659
165aa7b87e0d
add method for printing class_name. USE ONLY FOR DEBUGING!
Mario de Sousa <msousa@fe.up.pt>
parents:
655
diff
changeset
|
363 |
/* WARNING: only use this method for debugging purposes!! */ \ |
165aa7b87e0d
add method for printing class_name. USE ONLY FOR DEBUGING!
Mario de Sousa <msousa@fe.up.pt>
parents:
655
diff
changeset
|
364 |
virtual const char *absyntax_cname(void) {return #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
|
365 |
}; |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
366 |
|
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
367 |
|
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
368 |
#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
|
369 |
class class_name_c: public symbol_c { \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
370 |
public: \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
371 |
symbol_c *ref1; \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
372 |
__VA_ARGS__ \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
373 |
public: \ |
1087
d9e47e018320
add default NULL value to references (as suggested by anonymous in issue 62)
Mario de Sousa <msousa@fe.up.pt>
parents:
1043
diff
changeset
|
374 |
class_name_c(symbol_c *ref1 = NULL, \ |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
375 |
int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
376 |
int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
377 |
virtual void *accept(visitor_c &visitor); \ |
659
165aa7b87e0d
add method for printing class_name. USE ONLY FOR DEBUGING!
Mario de Sousa <msousa@fe.up.pt>
parents:
655
diff
changeset
|
378 |
/* WARNING: only use this method for debugging purposes!! */ \ |
165aa7b87e0d
add method for printing class_name. USE ONLY FOR DEBUGING!
Mario de Sousa <msousa@fe.up.pt>
parents:
655
diff
changeset
|
379 |
virtual const char *absyntax_cname(void) {return #class_name_c;}; \ |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
380 |
}; |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
381 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
382 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
383 |
#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
|
384 |
class class_name_c: public symbol_c { \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
385 |
public: \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
386 |
symbol_c *ref1; \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
387 |
symbol_c *ref2; \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
388 |
__VA_ARGS__ \ |
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
389 |
public: \ |
1087
d9e47e018320
add default NULL value to references (as suggested by anonymous in issue 62)
Mario de Sousa <msousa@fe.up.pt>
parents:
1043
diff
changeset
|
390 |
class_name_c(symbol_c *ref1 = NULL, \ |
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
391 |
symbol_c *ref2 = NULL, \ |
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
|
392 |
int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, \ |
9df7fcb9bde5
Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents:
286
diff
changeset
|
393 |
int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \ |
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
394 |
virtual void *accept(visitor_c &visitor); \ |
659
165aa7b87e0d
add method for printing class_name. USE ONLY FOR DEBUGING!
Mario de Sousa <msousa@fe.up.pt>
parents:
655
diff
changeset
|
395 |
/* WARNING: only use this method for debugging purposes!! */ \ |
165aa7b87e0d
add method for printing class_name. USE ONLY FOR DEBUGING!
Mario de Sousa <msousa@fe.up.pt>
parents:
655
diff
changeset
|
396 |
virtual const char *absyntax_cname(void) {return #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
|
397 |
}; |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
398 |
|
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
399 |
|
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
400 |
#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
|
401 |
class class_name_c: public symbol_c { \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
402 |
public: \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
403 |
symbol_c *ref1; \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
404 |
symbol_c *ref2; \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
405 |
symbol_c *ref3; \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
406 |
__VA_ARGS__ \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
407 |
public: \ |
1087
d9e47e018320
add default NULL value to references (as suggested by anonymous in issue 62)
Mario de Sousa <msousa@fe.up.pt>
parents:
1043
diff
changeset
|
408 |
class_name_c(symbol_c *ref1 = NULL, \ |
d9e47e018320
add default NULL value to references (as suggested by anonymous in issue 62)
Mario de Sousa <msousa@fe.up.pt>
parents:
1043
diff
changeset
|
409 |
symbol_c *ref2 = NULL, \ |
d9e47e018320
add default NULL value to references (as suggested by anonymous in issue 62)
Mario de Sousa <msousa@fe.up.pt>
parents:
1043
diff
changeset
|
410 |
symbol_c *ref3 = NULL, \ |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
411 |
int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
412 |
int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
413 |
virtual void *accept(visitor_c &visitor); \ |
659
165aa7b87e0d
add method for printing class_name. USE ONLY FOR DEBUGING!
Mario de Sousa <msousa@fe.up.pt>
parents:
655
diff
changeset
|
414 |
/* WARNING: only use this method for debugging purposes!! */ \ |
165aa7b87e0d
add method for printing class_name. USE ONLY FOR DEBUGING!
Mario de Sousa <msousa@fe.up.pt>
parents:
655
diff
changeset
|
415 |
virtual const char *absyntax_cname(void) {return #class_name_c;}; \ |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
416 |
}; |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
417 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
418 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
419 |
#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
|
420 |
class class_name_c: public symbol_c { \ |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
421 |
public: \ |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
422 |
symbol_c *ref1; \ |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
423 |
symbol_c *ref2; \ |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
424 |
symbol_c *ref3; \ |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
425 |
symbol_c *ref4; \ |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
426 |
__VA_ARGS__ \ |
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
427 |
public: \ |
1087
d9e47e018320
add default NULL value to references (as suggested by anonymous in issue 62)
Mario de Sousa <msousa@fe.up.pt>
parents:
1043
diff
changeset
|
428 |
class_name_c(symbol_c *ref1 = NULL, \ |
d9e47e018320
add default NULL value to references (as suggested by anonymous in issue 62)
Mario de Sousa <msousa@fe.up.pt>
parents:
1043
diff
changeset
|
429 |
symbol_c *ref2 = NULL, \ |
d9e47e018320
add default NULL value to references (as suggested by anonymous in issue 62)
Mario de Sousa <msousa@fe.up.pt>
parents:
1043
diff
changeset
|
430 |
symbol_c *ref3 = NULL, \ |
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
431 |
symbol_c *ref4 = NULL, \ |
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
|
432 |
int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, \ |
9df7fcb9bde5
Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents:
286
diff
changeset
|
433 |
int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \ |
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
434 |
virtual void *accept(visitor_c &visitor); \ |
659
165aa7b87e0d
add method for printing class_name. USE ONLY FOR DEBUGING!
Mario de Sousa <msousa@fe.up.pt>
parents:
655
diff
changeset
|
435 |
/* WARNING: only use this method for debugging purposes!! */ \ |
165aa7b87e0d
add method for printing class_name. USE ONLY FOR DEBUGING!
Mario de Sousa <msousa@fe.up.pt>
parents:
655
diff
changeset
|
436 |
virtual const char *absyntax_cname(void) {return #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
|
437 |
}; |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
438 |
|
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
439 |
|
568
5f79478142d7
make the compiler platform independent (i.e. no longer assume sizeof(double)==8).
Mario de Sousa <msousa@fe.up.pt>
parents:
565
diff
changeset
|
440 |
#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
|
441 |
class class_name_c: public symbol_c { \ |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
442 |
public: \ |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
443 |
symbol_c *ref1; \ |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
444 |
symbol_c *ref2; \ |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
445 |
symbol_c *ref3; \ |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
446 |
symbol_c *ref4; \ |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
447 |
symbol_c *ref5; \ |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
448 |
__VA_ARGS__ \ |
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
449 |
public: \ |
1087
d9e47e018320
add default NULL value to references (as suggested by anonymous in issue 62)
Mario de Sousa <msousa@fe.up.pt>
parents:
1043
diff
changeset
|
450 |
class_name_c(symbol_c *ref1 = NULL, \ |
d9e47e018320
add default NULL value to references (as suggested by anonymous in issue 62)
Mario de Sousa <msousa@fe.up.pt>
parents:
1043
diff
changeset
|
451 |
symbol_c *ref2 = NULL, \ |
d9e47e018320
add default NULL value to references (as suggested by anonymous in issue 62)
Mario de Sousa <msousa@fe.up.pt>
parents:
1043
diff
changeset
|
452 |
symbol_c *ref3 = NULL, \ |
d9e47e018320
add default NULL value to references (as suggested by anonymous in issue 62)
Mario de Sousa <msousa@fe.up.pt>
parents:
1043
diff
changeset
|
453 |
symbol_c *ref4 = NULL, \ |
d9e47e018320
add default NULL value to references (as suggested by anonymous in issue 62)
Mario de Sousa <msousa@fe.up.pt>
parents:
1043
diff
changeset
|
454 |
symbol_c *ref5 = NULL, \ |
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
|
455 |
int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, \ |
9df7fcb9bde5
Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents:
286
diff
changeset
|
456 |
int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \ |
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
457 |
virtual void *accept(visitor_c &visitor); \ |
659
165aa7b87e0d
add method for printing class_name. USE ONLY FOR DEBUGING!
Mario de Sousa <msousa@fe.up.pt>
parents:
655
diff
changeset
|
458 |
/* WARNING: only use this method for debugging purposes!! */ \ |
165aa7b87e0d
add method for printing class_name. USE ONLY FOR DEBUGING!
Mario de Sousa <msousa@fe.up.pt>
parents:
655
diff
changeset
|
459 |
virtual const char *absyntax_cname(void) {return #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
|
460 |
}; |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
461 |
|
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
462 |
|
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
463 |
#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
|
464 |
class class_name_c: public symbol_c { \ |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
465 |
public: \ |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
466 |
symbol_c *ref1; \ |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
467 |
symbol_c *ref2; \ |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
468 |
symbol_c *ref3; \ |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
469 |
symbol_c *ref4; \ |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
470 |
symbol_c *ref5; \ |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
471 |
symbol_c *ref6; \ |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
472 |
__VA_ARGS__ \ |
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
473 |
public: \ |
1087
d9e47e018320
add default NULL value to references (as suggested by anonymous in issue 62)
Mario de Sousa <msousa@fe.up.pt>
parents:
1043
diff
changeset
|
474 |
class_name_c(symbol_c *ref1 = NULL, \ |
d9e47e018320
add default NULL value to references (as suggested by anonymous in issue 62)
Mario de Sousa <msousa@fe.up.pt>
parents:
1043
diff
changeset
|
475 |
symbol_c *ref2 = NULL, \ |
d9e47e018320
add default NULL value to references (as suggested by anonymous in issue 62)
Mario de Sousa <msousa@fe.up.pt>
parents:
1043
diff
changeset
|
476 |
symbol_c *ref3 = NULL, \ |
d9e47e018320
add default NULL value to references (as suggested by anonymous in issue 62)
Mario de Sousa <msousa@fe.up.pt>
parents:
1043
diff
changeset
|
477 |
symbol_c *ref4 = NULL, \ |
d9e47e018320
add default NULL value to references (as suggested by anonymous in issue 62)
Mario de Sousa <msousa@fe.up.pt>
parents:
1043
diff
changeset
|
478 |
symbol_c *ref5 = NULL, \ |
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
479 |
symbol_c *ref6 = NULL, \ |
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
|
480 |
int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, \ |
9df7fcb9bde5
Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents:
286
diff
changeset
|
481 |
int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \ |
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
482 |
virtual void *accept(visitor_c &visitor); \ |
659
165aa7b87e0d
add method for printing class_name. USE ONLY FOR DEBUGING!
Mario de Sousa <msousa@fe.up.pt>
parents:
655
diff
changeset
|
483 |
/* WARNING: only use this method for debugging purposes!! */ \ |
165aa7b87e0d
add method for printing class_name. USE ONLY FOR DEBUGING!
Mario de Sousa <msousa@fe.up.pt>
parents:
655
diff
changeset
|
484 |
virtual const char *absyntax_cname(void) {return #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
|
485 |
}; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
486 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
487 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
488 |
#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
|
489 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
490 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
491 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
492 |
#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
|
493 |
#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
|
494 |
#undef SYM_REF0 |
69 | 495 |
#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
|
496 |
#undef SYM_REF2 |
69 | 497 |
#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
|
498 |
#undef SYM_REF4 |
69 | 499 |
#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
|
500 |
#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
|
501 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
502 |
#endif /* _ABSYNTAX_HH */ |