6
6
#include " type.h"
7
7
8
8
void yyerror (char *);
9
+ extern FILE * yyout;
10
+ extern char * yytext;
11
+ extern int yyleng;
9
12
10
13
/*
11
14
* Handling of the variables.
@@ -117,16 +120,11 @@ dump_variables(struct arguments * list)
117
120
dump_variables (list->next );
118
121
119
122
/* Then the current element. */
120
- ECPGdump_a_type (stdout , list->variable ->name , list->variable ->type );
123
+ ECPGdump_a_type (yyout , list->variable ->name , list->variable ->type );
121
124
122
125
/* Then release the list element. */
123
126
free (list);
124
127
}
125
-
126
-
127
- extern FILE * yyout;
128
- extern char * yytext;
129
- extern int yyleng;
130
128
%}
131
129
132
130
%union {
@@ -149,7 +147,7 @@ extern int yyleng;
149
147
%token <tagname> S_LONG S_SHORT S_INT S_CHAR S_FLOAT S_DOUBLE
150
148
%token <tagname> ' [' ' ]' ' ;' ' ,'
151
149
152
- %type <type> type type_detailed varchar_type simple_type
150
+ %type <type> type type_detailed varchar_type simple_type array_type
153
151
%type <symbolname> symbol
154
152
%type <tagname> maybe_storage_clause varchar_tag
155
153
%type <type_enum> simple_tag
@@ -204,7 +202,8 @@ symbol : S_SYMBOL {
204
202
205
203
type : maybe_storage_clause type_detailed { $<type>$ = $<type>2 ; };
206
204
type_detailed : varchar_type { $<type>$ = $<type>1 ; }
207
- | simple_type { $<type>$ = $<type>1 ; };
205
+ | simple_type { $<type>$ = $<type>1 ; }
206
+ | array_type {$<type>$ = $<type>1 ; };
208
207
209
208
varchar_type : varchar_tag symbol index {
210
209
fprintf (yyout, " struct varchar_%s { int len; char arr[%d]; } %s" , $<symbolname>2 , $<indexsize>3 , $<symbolname>2 );
@@ -221,6 +220,12 @@ simple_type : simple_tag symbol {
221
220
$<type>$.typ = ECPGmake_simple_type($<type_enum>1 );
222
221
}
223
222
223
+ array_type : simple_tag symbol index {
224
+ fprintf (yyout, " %s %s [%d]" , ECPGtype_name($<type_enum>1 ), $<symbolname>2, $<indexsize>3);
225
+ $<type>$.name = $<symbolname>2 ;
226
+ $<type>$.typ = ECPGmake_array_type(ECPGmake_simple_type($<type_enum>1 ), $<indexsize>3 );
227
+ }
228
+
224
229
simple_tag : S_CHAR { $<type_enum>$ = ECPGt_char; }
225
230
| S_UNSIGNED S_CHAR { $<type_enum>$ = ECPGt_unsigned_char; }
226
231
| S_SHORT { $<type_enum>$ = ECPGt_short; }
0 commit comments