equal
deleted
inserted
replaced
115 * in iec.hh contains pointers to these classes, so we must include |
115 * in iec.hh contains pointers to these classes, so we must include |
116 * it here. |
116 * it here. |
117 */ |
117 */ |
118 #include "../absyntax/absyntax.hh" |
118 #include "../absyntax/absyntax.hh" |
119 |
119 |
|
120 |
120 /* generated by bison. |
121 /* generated by bison. |
121 * Contains the definition of the token constants, and the |
122 * Contains the definition of the token constants, and the |
122 * token value type YYSTYPE (in our case, a 'const char *') |
123 * token value type YYSTYPE (in our case, a 'const char *') |
123 */ |
124 */ |
124 #include "iec.y.hh" |
125 #include "iec.y.hh" |
|
126 #include "stage1_2_priv.hh" |
|
127 |
125 |
128 |
126 /* Variable defined by the bison parser, |
129 /* Variable defined by the bison parser, |
127 * where the value of the tokens will be stored |
130 * where the value of the tokens will be stored |
128 */ |
131 */ |
129 extern YYSTYPE yylval; |
132 extern YYSTYPE yylval; |
132 * This variable is declared and read from the code generated by bison! |
135 * This variable is declared and read from the code generated by bison! |
133 * Note that flex accesses and updates this global variable |
136 * Note that flex accesses and updates this global variable |
134 * apropriately whenever it comes across an (*#include <filename> *) |
137 * apropriately whenever it comes across an (*#include <filename> *) |
135 * directive... |
138 * directive... |
136 */ |
139 */ |
|
140 /* |
|
141 NOTE: already defined in iec.y.hh |
137 extern const char *current_filename; |
142 extern const char *current_filename; |
|
143 */ |
|
144 |
138 |
145 |
139 /* We will not be using unput() in our flex code... */ |
146 /* We will not be using unput() in our flex code... */ |
140 #define YY_NO_UNPUT |
147 #define YY_NO_UNPUT |
141 |
148 |
142 /* Variable defined by the bison parser. |
149 /* Variable defined by the bison parser. |
178 * Searches first in the variables, and only if not found |
185 * Searches first in the variables, and only if not found |
179 * does it continue searching in the library elements |
186 * does it continue searching in the library elements |
180 */ |
187 */ |
181 //token_id_t get_identifier_token(const char *identifier_str); |
188 //token_id_t get_identifier_token(const char *identifier_str); |
182 int get_identifier_token(const char *identifier_str); |
189 int get_identifier_token(const char *identifier_str); |
183 %} |
|
184 |
|
185 |
|
186 /*********************************************/ |
|
187 /* Change parse state to body definitions... */ |
|
188 /*********************************************/ |
|
189 |
|
190 %{ |
|
191 static int goto_body_state__ = 0; |
|
192 |
|
193 void cmd_goto_body_state(void) {goto_body_state__ = 1;} |
|
194 int get_goto_body_state(void) {return goto_body_state__;} |
|
195 void rst_goto_body_state(void) {goto_body_state__ = 0;} |
|
196 %} |
190 %} |
197 |
191 |
198 |
192 |
199 /***************************************************/ |
193 /***************************************************/ |
200 /* Forward Declaration of functions defined later. */ |
194 /* Forward Declaration of functions defined later. */ |
360 "/usr/lib/iec/", |
354 "/usr/lib/iec/", |
361 LIBDIRECTORY "/", |
355 LIBDIRECTORY "/", |
362 NULL /* must end with NULL!! */ |
356 NULL /* must end with NULL!! */ |
363 }; |
357 }; |
364 |
358 |
365 |
|
366 /* |
|
367 * Join two strings together. Allocate space with malloc(3). |
|
368 */ |
|
369 static char *strdup2(const char *a, const char *b) { |
|
370 char *res = (char *)malloc(strlen(a) + strlen(b) + 1); |
|
371 |
|
372 if (!res) |
|
373 return NULL; |
|
374 return strcat(strcpy(res, a), b); /* safe, actually */ |
|
375 } |
|
376 %} |
359 %} |
377 |
360 |
378 |
361 |
379 |
362 |
380 /*****************************/ |
363 /*****************************/ |
1411 yystype yylval; |
1394 yystype yylval; |
1412 YYLTYPE yylloc; |
1395 YYLTYPE yylloc; |
1413 |
1396 |
1414 const char *current_filename; |
1397 const char *current_filename; |
1415 |
1398 |
|
1399 |
|
1400 |
1416 int get_identifier_token(const char *identifier_str) {return 0;} |
1401 int get_identifier_token(const char *identifier_str) {return 0;} |
1417 |
|
1418 |
|
1419 |
1402 |
1420 |
1403 |
1421 |
1404 |
1422 int main(int argc, char **argv) { |
1405 int main(int argc, char **argv) { |
1423 |
1406 |