Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 2 | mjames | 1 | |
| 2 | /* A Bison parser, made from hdl.y |
||
| 3 | by GNU Bison version 1.25 |
||
| 4 | */ |
||
| 5 | |||
| 6 | #define YYBISON 1 /* Identify Bison output. */ |
||
| 7 | |||
| 8 | #define NL 258 |
||
| 9 | #define NAME 259 |
||
| 10 | #define NUMBER 260 |
||
| 11 | #define MODULE 261 |
||
| 12 | #define ENDMODULE 262 |
||
| 13 | #define WIRE 263 |
||
| 14 | #define INPUT 264 |
||
| 15 | #define OUTPUT 265 |
||
| 16 | #define INOUT 266 |
||
| 17 | #define NETTYPE 267 |
||
| 18 | #define ASSIGN 268 |
||
| 19 | #define STRENGTH0 269 |
||
| 20 | #define STRENGTH1 270 |
||
| 21 | #define GATETYPE 271 |
||
| 22 | #define INITIAL 272 |
||
| 23 | #define PARAMETER 273 |
||
| 24 | #define REG 274 |
||
| 25 | #define TIME 275 |
||
| 26 | #define INTEGER 276 |
||
| 27 | #define REAL 277 |
||
| 28 | #define EVENT 278 |
||
| 29 | #define DEFPARAM 279 |
||
| 30 | #define BIN_OP 280 |
||
| 31 | #define UNARY_OP 281 |
||
| 32 | #define PRIMITIVE 282 |
||
| 33 | #define ENDPRIM 283 |
||
| 34 | #define TABLE 284 |
||
| 35 | #define ENDTABLE 285 |
||
| 36 | #define OUT_SYM 286 |
||
| 37 | #define LEV_SYM 287 |
||
| 38 | #define EDGE_SYM 288 |
||
| 39 | |||
| 40 | #line 26 "hdl.y" |
||
| 41 | |||
| 42 | #define YYDEBUG 1 |
||
| 43 | #include <ctype.h> |
||
| 44 | #include <errno.h> |
||
| 45 | #include <fcntl.h> |
||
| 46 | #include <stdio.h> |
||
| 47 | #include <string.h> |
||
| 48 | |||
| 49 | #define out(c) putc (c, yyout) |
||
| 50 | #define NCOM 300 |
||
| 51 | |||
| 52 | int bug = 0, ind; |
||
| 53 | FILE *fopen (), *freopen (), *fi, *ft, *fo, *fr; |
||
| 54 | static int i, comment = 0; |
||
| 55 | char *cp, *st, refd[20], part[20]; |
||
| 56 | char ln[80]; |
||
| 57 | |||
| 58 | extern char *strsave (), *malloc (); |
||
| 59 | extern int yyleng, lexval; |
||
| 60 | extern char yytext[]; |
||
| 61 | extern char yysbuf[]; |
||
| 62 | |||
| 63 | typedef struct YYS_TYPE |
||
| 64 | { /* use instead of %union below */ |
||
| 65 | int i; |
||
| 66 | char s[50]; |
||
| 67 | } yys_type; |
||
| 68 | #define YYSTYPE yys_type |
||
| 69 | |||
| 70 | #define YYLMAX 132 |
||
| 71 | |||
| 72 | int yylineno = 0; |
||
| 73 | int yyleng; |
||
| 74 | char yytext[YYLMAX]; |
||
| 75 | char yysbuf[YYLMAX]; |
||
| 76 | char modnam[YYLMAX]; |
||
| 77 | int yysptr = -1, yylast, toklast; |
||
| 78 | FILE *yyout; |
||
| 79 | #define YYNL 10 |
||
| 80 | |||
| 81 | #ifndef YYSTYPE |
||
| 82 | #define YYSTYPE int |
||
| 83 | #endif |
||
| 84 | #ifndef YYDEBUG |
||
| 85 | #define YYDEBUG 1 |
||
| 86 | #endif |
||
| 87 | |||
| 88 | #include <stdio.h> |
||
| 89 | |||
| 90 | #ifndef __cplusplus |
||
| 91 | #ifndef __STDC__ |
||
| 92 | #define const |
||
| 93 | #endif |
||
| 94 | #endif |
||
| 95 | |||
| 96 | #define YYFINAL 270 |
||
| 97 | #define YYFLAG -32768 |
||
| 98 | #define YYNTBASE 53 |
||
| 99 | |||
| 100 | #define YYTRANSLATE(x) ((unsigned) (x) <= 288 ? yytranslate[x] : 112) |
||
| 101 | |||
| 102 | static const char yytranslate[] = { |
||
| 103 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
||
| 104 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 47, 2, 2, 2, 40, 34, 35, 2, 2, 37, 2, |
||
| 105 | 48, 2, 42, 39, 2, 2, 2, 2, 2, 2, 2, 2, 44, 36, 2, 38, 2, 2, 2, 2, 2, 2, 2, |
||
| 106 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 45, |
||
| 107 | 2, 46, 2, 2, 2, 2, 41, 2, 51, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 52, 2, 2, 2, |
||
| 108 | 2, 2, 2, 2, 2, 43, 2, 2, 49, 2, 50, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
||
| 109 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
||
| 110 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
||
| 111 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
||
| 112 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
||
| 113 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
||
| 114 | 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, |
||
| 115 | 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33}; |
||
| 116 | |||
| 117 | #if YYDEBUG != 0 |
||
| 118 | static const short yyprhs[] = { |
||
| 119 | 0, 0, 3, 6, 8, 10, 12, 21, 25, 27, 31, 34, 36, 38, 40, 45, 50, |
||
| 120 | 55, 60, 62, 64, 68, 71, 73, 76, 78, 83, 90, 97, 99, 103, 105, 110, 112, |
||
| 121 | 114, 116, 122, 131, 135, 137, 139, 144, 151, 154, 156, 158, 160, 162, 164, 166, 168, |
||
| 122 | 170, 172, 174, 176, 178, 180, 182, 184, 186, 188, 190, 192, 194, 196, 198, 201, 205, |
||
| 123 | 209, 214, 219, 223, 228, 232, 237, 241, 246, 250, 255, 260, 266, 272, 275, 278, 284, |
||
| 124 | 290, 294, 296, 300, 305, 307, 311, 313, 318, 323, 325, 329, 331, 335, 337, 343, 345, |
||
| 125 | 350, 357, 359, 364, 368, 373, 378, 384, 388, 390, 394, 400, 402, 407, 409, 411, 415, |
||
| 126 | 419, 421, 423, 426, 431, 435, 437, 442, 444, 446, 448, 453, 458}; |
||
| 127 | |||
| 128 | static const short yyrhs[] = { |
||
| 129 | 53, 54, 0, 53, 1, 0, 54, 0, 70, 0, 55, 0, 27, 4, 34, 56, 35, 36, |
||
| 130 | 57, 28, 0, 56, 37, 4, 0, 4, 0, 58, 59, 61, 0, 58, 61, 0, 85, 0, |
||
| 131 | 84, 0, 76, 0, 17, 4, 38, 60, 0, 39, 40, 41, 42, 0, 39, 40, 41, 39, |
||
| 132 | 0, 39, 40, 41, 43, 0, 39, 0, 42, 0, 29, 62, 30, 0, 62, 63, 0, 63, |
||
| 133 | 0, 62, 64, 0, 64, 0, 65, 44, 31, 36, 0, 65, 44, 68, 44, 69, 36, 0, |
||
| 134 | 66, 44, 68, 44, 69, 36, 0, 32, 0, 32, 67, 32, 0, 67, 0, 34, 32, 32, |
||
| 135 | 35, 0, 33, 0, 32, 0, 31, 0, 6, 4, 36, 73, 7, 0, 6, 4, 34, 71, |
||
| 136 | 35, 36, 73, 7, 0, 71, 37, 72, 0, 72, 0, 4, 0, 4, 45, 106, 46, 0, |
||
| 137 | 4, 45, 106, 44, 106, 46, 0, 73, 74, 0, 74, 0, 75, 0, 84, 0, 85, 0, |
||
| 138 | 86, 0, 87, 0, 76, 0, 77, 0, 78, 0, 79, 0, 80, 0, 82, 0, 92, 0, |
||
| 139 | 81, 0, 102, 0, 18, 0, 19, 0, 20, 0, 21, 0, 22, 0, 23, 0, 24, 0, |
||
| 140 | 16, 83, 0, 16, 90, 83, 0, 16, 89, 83, 0, 16, 90, 89, 83, 0, 4, 34, |
||
| 141 | 109, 35, 0, 9, 91, 36, 0, 9, 88, 91, 36, 0, 10, 91, 36, 0, 10, 88, |
||
| 142 | 91, 36, 0, 11, 91, 36, 0, 11, 88, 91, 36, 0, 12, 91, 36, 0, 12, 88, |
||
| 143 | 91, 36, 0, 12, 89, 91, 36, 0, 12, 88, 89, 91, 36, 0, 45, 106, 44, 106, |
||
| 144 | 46, 0, 47, 111, 0, 47, 4, 0, 34, 14, 37, 15, 35, 0, 34, 15, 37, 14, |
||
| 145 | 35, 0, 91, 37, 4, 0, 4, 0, 93, 94, 36, 0, 93, 101, 94, 36, 0, 4, |
||
| 146 | 0, 94, 37, 95, 0, 95, 0, 96, 34, 97, 35, 0, 96, 34, 98, 35, 0, 4, |
||
| 147 | 0, 97, 37, 109, 0, 109, 0, 98, 37, 99, 0, 99, 0, 48, 4, 34, 100, 35, |
||
| 148 | 0, 4, 0, 4, 45, 109, 46, 0, 4, 45, 109, 44, 109, 46, 0, 107, 0, 47, |
||
| 149 | 34, 109, 35, 0, 13, 103, 36, 0, 13, 90, 103, 36, 0, 13, 89, 103, 36, 0, |
||
| 150 | 13, 90, 89, 103, 36, 0, 103, 37, 104, 0, 104, 0, 105, 38, 109, 0, 105, 38, |
||
| 151 | 34, 109, 35, 0, 4, 0, 4, 45, 109, 46, 0, 107, 0, 109, 0, 49, 108, 50, |
||
| 152 | 0, 108, 37, 109, 0, 109, 0, 110, 0, 26, 110, 0, 26, 34, 109, 35, 0, 109, |
||
| 153 | 25, 109, 0, 111, 0, 4, 45, 109, 46, 0, 4, 0, 107, 0, 5, 0, 5, 40, |
||
| 154 | 41, 5, 0, 5, 40, 51, 5, 0, 5, 40, 52, 5, 0}; |
||
| 155 | |||
| 156 | #endif |
||
| 157 | |||
| 158 | #if YYDEBUG != 0 |
||
| 159 | static const short yyrline[] = { |
||
| 160 | 0, 87, 88, 89, 92, 93, 96, 99, 100, 103, 104, 107, 108, 109, 112, 115, 116, |
||
| 161 | 117, 118, 119, 122, 125, 126, 127, 128, 131, 134, 135, 138, 141, 142, 145, 146, 149, |
||
| 162 | 151, 154, 155, 158, 159, 162, 163, 164, 167, 168, 171, 172, 173, 174, 175, 176, 177, |
||
| 163 | 178, 179, 180, 181, 182, 183, 184, 187, 189, 191, 193, 195, 197, 199, 201, 202, 203, |
||
| 164 | 204, 207, 210, 211, 214, 215, 218, 219, 222, 223, 224, 225, 228, 231, 232, 235, 236, |
||
| 165 | 239, 240, 243, 244, 247, 251, 252, 255, 256, 259, 263, 264, 267, 268, 271, 278, 279, |
||
| 166 | 285, 293, 297, 300, 301, 302, 303, 306, 307, 310, 311, 314, 315, 316, 319, 322, 325, |
||
| 167 | 326, 329, 330, 331, 332, 335, 336, 337, 338, 341, 342, 343, 344}; |
||
| 168 | #endif |
||
| 169 | |||
| 170 | #if YYDEBUG != 0 || defined(YYERROR_VERBOSE) |
||
| 171 | |||
| 172 | static const char *const yytname[] = {"$", |
||
| 173 | "error", |
||
| 174 | "$undefined.", |
||
| 175 | "NL", |
||
| 176 | "NAME", |
||
| 177 | "NUMBER", |
||
| 178 | "MODULE", |
||
| 179 | "ENDMODULE", |
||
| 180 | "WIRE", |
||
| 181 | "INPUT", |
||
| 182 | "OUTPUT", |
||
| 183 | "INOUT", |
||
| 184 | "NETTYPE", |
||
| 185 | "ASSIGN", |
||
| 186 | "STRENGTH0", |
||
| 187 | "STRENGTH1", |
||
| 188 | "GATETYPE", |
||
| 189 | "INITIAL", |
||
| 190 | "PARAMETER", |
||
| 191 | "REG", |
||
| 192 | "TIME", |
||
| 193 | "INTEGER", |
||
| 194 | "REAL", |
||
| 195 | "EVENT", |
||
| 196 | "DEFPARAM", |
||
| 197 | "BIN_OP", |
||
| 198 | "UNARY_OP", |
||
| 199 | "PRIMITIVE", |
||
| 200 | "ENDPRIM", |
||
| 201 | "TABLE", |
||
| 202 | "ENDTABLE", |
||
| 203 | "OUT_SYM", |
||
| 204 | "LEV_SYM", |
||
| 205 | "EDGE_SYM", |
||
| 206 | "'('", |
||
| 207 | "')'", |
||
| 208 | "';'", |
||
| 209 | "','", |
||
| 210 | "'='", |
||
| 211 | "'1'", |
||
| 212 | "'''", |
||
| 213 | "'b'", |
||
| 214 | "'0'", |
||
| 215 | "'x'", |
||
| 216 | "':'", |
||
| 217 | "'['", |
||
| 218 | "']'", |
||
| 219 | "'#'", |
||
| 220 | "'.'", |
||
| 221 | "'{'", |
||
| 222 | "'}'", |
||
| 223 | "'d'", |
||
| 224 | "'o'", |
||
| 225 | "modules", |
||
| 226 | "mod_prim", |
||
| 227 | "primitive", |
||
| 228 | "list_of_vars", |
||
| 229 | "prim_body", |
||
| 230 | "UDP_decl", |
||
| 231 | "UDP_init", |
||
| 232 | "init_val", |
||
| 233 | "table_def", |
||
| 234 | "table_entries", |
||
| 235 | "combin_entry", |
||
| 236 | "seq_entry", |
||
| 237 | "level_in_list", |
||
| 238 | "edge_in_list", |
||
| 239 | "edge", |
||
| 240 | "state", |
||
| 241 | "next_state", |
||
| 242 | "module", |
||
| 243 | "list_of_ports", |
||
| 244 | "port", |
||
| 245 | "mod_body", |
||
| 246 | "module_item", |
||
| 247 | "param_decl", |
||
| 248 | "reg_decl", |
||
| 249 | "time_decl", |
||
| 250 | "integer_decl", |
||
| 251 | "real_decl", |
||
| 252 | "event_decl", |
||
| 253 | "defparm_decl", |
||
| 254 | "gate_decl", |
||
| 255 | "gate_instant", |
||
| 256 | "input_decl", |
||
| 257 | "output_decl", |
||
| 258 | "inout_decl", |
||
| 259 | "net_decl", |
||
| 260 | "range", |
||
| 261 | "delay", |
||
| 262 | "dr_strength", |
||
| 263 | "list_vars", |
||
| 264 | "module_instant", |
||
| 265 | "name_mod", |
||
| 266 | "mod_inst_list", |
||
| 267 | "mod_inst", |
||
| 268 | "reference", |
||
| 269 | "list_mod_conn", |
||
| 270 | "list_nam_conn", |
||
| 271 | "nam_conn", |
||
| 272 | "sig_nam", |
||
| 273 | "par_val", |
||
| 274 | "cont_assign", |
||
| 275 | "list_assigns", |
||
| 276 | "assignment", |
||
| 277 | "lvalue", |
||
| 278 | "const_exp", |
||
| 279 | "concatenation", |
||
| 280 | "exp_list", |
||
| 281 | "exp", |
||
| 282 | "primary", |
||
| 283 | "number", |
||
| 284 | NULL}; |
||
| 285 | #endif |
||
| 286 | |||
| 287 | static const short yyr1[] = { |
||
| 288 | 0, 53, 53, 53, 54, 54, 55, 56, 56, 57, 57, 58, 58, 58, 59, 60, 60, |
||
| 289 | 60, 60, 60, 61, 62, 62, 62, 62, 63, 64, 64, 65, 66, 66, 67, 67, 68, |
||
| 290 | 69, 70, 70, 71, 71, 72, 72, 72, 73, 73, 74, 74, 74, 74, 74, 74, 74, |
||
| 291 | 74, 74, 74, 74, 74, 74, 74, 75, 76, 77, 78, 79, 80, 81, 82, 82, 82, |
||
| 292 | 82, 83, 84, 84, 85, 85, 86, 86, 87, 87, 87, 87, 88, 89, 89, 90, 90, |
||
| 293 | 91, 91, 92, 92, 93, 94, 94, 95, 95, 96, 97, 97, 98, 98, 99, 100, 100, |
||
| 294 | 100, 100, 101, 102, 102, 102, 102, 103, 103, 104, 104, 105, 105, 105, 106, 107, 108, |
||
| 295 | 108, 109, 109, 109, 109, 110, 110, 110, 110, 111, 111, 111, 111}; |
||
| 296 | |||
| 297 | static const short yyr2[] = {0, 2, 2, 1, 1, 1, 8, 3, 1, 3, 2, 1, 1, 1, 4, 4, 4, 4, 1, 1, 3, 2, |
||
| 298 | 1, 2, 1, 4, 6, 6, 1, 3, 1, 4, 1, 1, 1, 5, 8, 3, 1, 1, 4, 6, 2, 1, |
||
| 299 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, |
||
| 300 | 3, 3, 4, 4, 3, 4, 3, 4, 3, 4, 3, 4, 4, 5, 5, 2, 2, 5, 5, 3, 1, 3, |
||
| 301 | 4, 1, 3, 1, 4, 4, 1, 3, 1, 3, 1, 5, 1, 4, 6, 1, 4, 3, 4, 4, 5, 3, |
||
| 302 | 1, 3, 5, 1, 4, 1, 1, 3, 3, 1, 1, 2, 4, 3, 1, 4, 1, 1, 1, 4, 4, 4}; |
||
| 303 | |||
| 304 | static const short yydefact[] = { |
||
| 305 | 0, 0, 0, 0, 3, 5, 4, 0, 0, 2, 1, 0, 0, 0, 39, 0, 38, 89, 0, |
||
| 306 | 0, 0, 0, 0, 0, 58, 59, 60, 61, 62, 63, 64, 0, 43, 44, 49, 50, 51, 52, |
||
| 307 | 53, 56, 54, 45, 46, 47, 48, 55, 0, 57, 8, 0, 0, 0, 0, 86, 0, 0, 0, |
||
| 308 | 0, 0, 0, 0, 0, 0, 0, 0, 113, 0, 0, 0, 0, 0, 110, 0, 115, 0, 65, |
||
| 309 | 0, 0, 35, 42, 94, 0, 0, 91, 0, 0, 0, 0, 126, 128, 0, 0, 127, 116, 120, |
||
| 310 | 124, 0, 37, 0, 0, 70, 0, 0, 72, 0, 74, 82, 81, 0, 0, 0, 76, 0, 0, |
||
| 311 | 0, 0, 119, 0, 0, 0, 105, 0, 0, 0, 67, 66, 0, 0, 87, 0, 0, 0, 0, |
||
| 312 | 7, 0, 0, 0, 121, 0, 40, 0, 0, 0, 71, 85, 73, 75, 0, 77, 78, 0, 0, |
||
| 313 | 0, 0, 117, 107, 0, 106, 109, 0, 111, 0, 68, 0, 90, 0, 0, 0, 98, 96, 88, |
||
| 314 | 0, 0, 13, 12, 11, 0, 0, 0, 0, 0, 0, 123, 36, 0, 79, 114, 0, 0, 118, |
||
| 315 | 108, 0, 69, 104, 0, 92, 0, 93, 0, 6, 0, 0, 0, 10, 125, 129, 130, 131, 122, |
||
| 316 | 41, 80, 83, 84, 112, 0, 95, 97, 0, 28, 32, 0, 0, 22, 24, 0, 0, 30, 9, |
||
| 317 | 100, 0, 103, 0, 0, 0, 20, 21, 23, 0, 0, 0, 99, 18, 19, 14, 29, 0, 0, |
||
| 318 | 33, 0, 0, 0, 0, 31, 25, 0, 0, 0, 101, 0, 34, 0, 0, 0, 16, 15, 17, |
||
| 319 | 26, 27, 102, 0, 0}; |
||
| 320 | |||
| 321 | static const short yydefgoto[] = {3, 4, 5, 49, 171, 172, 202, 243, 203, 221, 222, 223, |
||
| 322 | 224, 225, 226, 248, 260, 6, 15, 16, 31, 32, 33, 34, |
||
| 323 | 35, 36, 37, 38, 39, 40, 75, 41, 42, 43, 44, 55, |
||
| 324 | 63, 69, 56, 45, 46, 82, 83, 84, 166, 167, 168, 229, |
||
| 325 | 85, 47, 70, 71, 72, 91, 92, 115, 93, 94, 95}; |
||
| 326 | |||
| 327 | static const short yypact[] = { |
||
| 328 | -3, 39, 91, 92, -32768, -32768, -32768, 107, 66, -32768, -32768, |
||
| 329 | 109, 177, 113, 75, 118, -32768, -32768, 83, 83, 83, 58, |
||
| 330 | 24, 76, -32768, -32768, -32768, -32768, -32768, -32768, -32768, 126, -32768, |
||
| 331 | -32768, -32768, -32768, -32768, -32768, -32768, -32768, -32768, -32768, -32768, -32768, |
||
| 332 | -32768, -32768, 37, -32768, -32768, 127, 33, 104, 109, -32768, 33, |
||
| 333 | 125, -25, 125, 148, 125, 173, 207, 41, 125, 178, 116, |
||
| 334 | 202, 33, 21, 36, 182, -32768, 94, -32768, 139, -32768, 187, |
||
| 335 | 77, -32768, -32768, -32768, 179, 184, -32768, 204, 243, 212, 245, |
||
| 336 | 206, 112, 30, 134, -32768, 225, -32768, -32768, 177, -32768, 208, |
||
| 337 | 186, -32768, 249, 188, -32768, 190, -32768, -32768, -32768, 125, 192, |
||
| 338 | 194, -32768, 33, 217, 218, 57, 225, 196, 21, 198, -32768, |
||
| 339 | 21, 18, 33, -32768, -32768, 187, 33, -32768, 243, 28, 200, |
||
| 340 | 99, -32768, 33, 63, 33, -32768, 33, -32768, 33, 147, 33, |
||
| 341 | -32768, -32768, -32768, -32768, 203, -32768, -32768, -19, 241, 244, 33, |
||
| 342 | -32768, -32768, 205, -32768, -32768, 33, 225, 1, -32768, 81, -32768, |
||
| 343 | 253, 170, 171, -32768, 225, -32768, 231, 72, -32768, -32768, -32768, |
||
| 344 | -7, 255, 256, 257, 87, 219, -32768, -32768, 220, -32768, -32768, |
||
| 345 | 228, 229, 225, -32768, 96, -32768, -32768, 233, -32768, 33, -32768, |
||
| 346 | 221, -32768, 264, 93, 242, -32768, -32768, -32768, -32768, -32768, -32768, |
||
| 347 | -32768, -32768, -32768, -32768, -32768, 26, 225, -32768, 232, 210, -32768, |
||
| 348 | 240, 142, -32768, -32768, 230, 234, -32768, -32768, 235, 238, -32768, |
||
| 349 | -35, 247, 250, -32768, -32768, -32768, 214, 251, 33, -32768, 236, |
||
| 350 | -32768, -32768, -32768, 246, 239, -32768, 248, 252, -15, 254, -32768, |
||
| 351 | -32768, 258, 258, 33, -32768, 140, -32768, 261, 262, -4, -32768, |
||
| 352 | -32768, -32768, -32768, -32768, -32768, 277, -32768}; |
||
| 353 | |||
| 354 | static const short yypgoto[] = { |
||
| 355 | -32768, 281, -32768, -32768, -32768, -32768, -32768, -32768, 84, -32768, |
||
| 356 | 64, 67, -32768, -32768, 69, 52, 38, -32768, -32768, 259, |
||
| 357 | 195, -30, -32768, 162, -32768, -32768, -32768, -32768, -32768, -32768, |
||
| 358 | -60, 167, 168, -32768, -32768, 183, -14, 278, -6, -32768, |
||
| 359 | -32768, 222, 174, -32768, -32768, -32768, 106, -32768, -32768, -32768, |
||
| 360 | -49, 181, -32768, -52, -22, -32768, -62, 215, 260}; |
||
| 361 | |||
| 362 | #define YYLAST 321 |
||
| 363 | |||
| 364 | static const short yytable[] = { |
||
| 365 | 73, 79, 98, 1, 241, 116, 140, 242, 68, 76, 140, 100, 101, 58, 60, 64, 124, 125, |
||
| 366 | 140, 117, 119, 140, 88, 89, 2, 65, 140, 186, 65, 256, 228, 257, 88, 89, 88, 89, |
||
| 367 | 192, 88, 89, 204, 65, 80, 268, 7, 90, 53, 73, 73, 108, 99, 150, 102, 159, 104, |
||
| 368 | 90, 118, 109, 110, 66, 90, 160, 161, 53, 126, 136, 163, 162, 67, 169, 156, 67, 61, |
||
| 369 | 176, 67, 180, 67, 165, 67, 182, 67, 74, 74, 67, 61, 81, 67, 181, 53, 61, 200, |
||
| 370 | 184, 189, 269, 9, 153, 8, 73, 191, 1, 73, 13, 201, 147, 54, 177, 61, 140, 154, |
||
| 371 | 18, 19, 66, 79, 140, 14, 178, 179, 193, 48, 25, 2, 50, 140, 208, 61, 61, 218, |
||
| 372 | 219, 220, 54, 53, 17, 213, 122, 78, 215, 18, 19, 20, 21, 22, 96, 11, 23, 12, |
||
| 373 | 24, 25, 26, 27, 28, 29, 30, 17, 135, 51, 183, 52, 18, 19, 20, 21, 22, 112, |
||
| 374 | 86, 23, 87, 24, 25, 26, 27, 28, 29, 30, 234, 123, 218, 219, 220, 250, 138, 263, |
||
| 375 | 139, 17, 264, 265, 103, 101, 18, 19, 20, 21, 22, 74, 230, 23, 262, 24, 25, 26, |
||
| 376 | 27, 28, 29, 30, 57, 59, 62, 195, 197, 196, 198, 105, 101, 106, 89, 127, 111, 101, |
||
| 377 | 113, 114, 120, 121, 128, 129, 143, 101, 145, 101, 146, 101, 148, 101, 149, 101, 155, 121, |
||
| 378 | 157, 121, 170, 129, 130, 185, 101, 190, 121, 219, 220, 246, 247, 80, 132, 133, 140, 134, |
||
| 379 | 142, 144, 151, 152, 187, 194, 188, 199, 205, 206, 207, 211, 212, 209, 210, 214, 217, 165, |
||
| 380 | 231, 201, 233, 240, 237, 253, 251, 270, 238, 244, 239, 252, 245, 247, 10, 235, 227, 232, |
||
| 381 | 236, 259, 249, 141, 254, 261, 173, 258, 255, 266, 267, 174, 175, 77, 158, 164, 216, 137, |
||
| 382 | 0, 131, 0, 0, 0, 97, 0, 0, 0, 0, 0, 0, 0, 0, 0, 107}; |
||
| 383 | |||
| 384 | static const short yycheck[] = { |
||
| 385 | 22, 31, 54, 6, 39, 67, 25, 42, 22, 23, 25, 36, 37, 19, 20, 21, 76, 77, |
||
| 386 | 25, 68, 69, 25, 4, 5, 27, 4, 25, 46, 4, 44, 4, 46, 4, 5, 4, 5, |
||
| 387 | 35, 4, 5, 46, 4, 4, 46, 4, 26, 4, 68, 69, 62, 55, 112, 57, 34, 59, |
||
| 388 | 26, 69, 62, 63, 34, 26, 122, 123, 4, 77, 34, 127, 126, 49, 130, 118, 49, 47, |
||
| 389 | 134, 49, 136, 49, 48, 49, 140, 49, 4, 4, 49, 47, 47, 49, 138, 4, 47, 17, |
||
| 390 | 142, 153, 0, 1, 37, 4, 118, 159, 6, 121, 34, 29, 108, 45, 41, 47, 25, 50, |
||
| 391 | 9, 10, 34, 141, 25, 4, 51, 52, 35, 4, 19, 27, 45, 25, 35, 47, 47, 32, |
||
| 392 | 33, 34, 45, 4, 4, 35, 38, 7, 196, 9, 10, 11, 12, 13, 36, 34, 16, 36, |
||
| 393 | 18, 19, 20, 21, 22, 23, 24, 4, 40, 35, 7, 37, 9, 10, 11, 12, 13, 45, |
||
| 394 | 35, 16, 37, 18, 19, 20, 21, 22, 23, 24, 30, 34, 32, 33, 34, 239, 44, 39, |
||
| 395 | 46, 4, 42, 43, 36, 37, 9, 10, 11, 12, 13, 4, 214, 16, 256, 18, 19, 20, |
||
| 396 | 21, 22, 23, 24, 19, 20, 21, 35, 35, 37, 37, 36, 37, 4, 5, 34, 36, 37, |
||
| 397 | 14, 15, 36, 37, 36, 37, 36, 37, 36, 37, 36, 37, 36, 37, 36, 37, 36, 37, |
||
| 398 | 36, 37, 36, 37, 34, 36, 37, 36, 37, 33, 34, 31, 32, 4, 36, 4, 25, 45, |
||
| 399 | 44, 4, 37, 37, 15, 4, 14, 28, 5, 5, 5, 35, 35, 46, 46, 34, 4, 48, |
||
| 400 | 38, 29, 32, 35, 44, 36, 40, 0, 44, 32, 45, 35, 32, 32, 3, 221, 202, 218, |
||
| 401 | 221, 31, 238, 96, 44, 255, 132, 41, 44, 36, 36, 132, 132, 23, 121, 129, 198, 90, |
||
| 402 | -1, 85, -1, -1, -1, 52, -1, -1, -1, -1, -1, -1, -1, -1, -1, 61}; |
||
| 403 | /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ |
||
| 404 | #line 3 "/usr/share/bison.simple" |
||
| 405 | |||
| 406 | /* Skeleton output parser for bison, |
||
| 407 | Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. |
||
| 408 | |||
| 409 | This program is free software; you can redistribute it and/or modify |
||
| 410 | it under the terms of the GNU General Public License as published by |
||
| 411 | the Free Software Foundation; either version 2, or (at your option) |
||
| 412 | any later version. |
||
| 413 | |||
| 414 | This program is distributed in the hope that it will be useful, |
||
| 415 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 416 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
| 417 | GNU General Public License for more details. |
||
| 418 | |||
| 419 | You should have received a copy of the GNU General Public License |
||
| 420 | along with this program; if not, write to the Free Software |
||
| 421 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ |
||
| 422 | |||
| 423 | /* As a special exception, when this file is copied by Bison into a |
||
| 424 | Bison output file, you may use that output file without restriction. |
||
| 425 | This special exception was added by the Free Software Foundation |
||
| 426 | in version 1.24 of Bison. */ |
||
| 427 | |||
| 428 | #ifndef alloca |
||
| 429 | #ifdef __GNUC__ |
||
| 430 | #define alloca __builtin_alloca |
||
| 431 | #else /* not GNU C. */ |
||
| 432 | #if (!defined(__STDC__) && defined(sparc)) || defined(__sparc__) || defined(__sparc) || \ |
||
| 433 | defined(__sgi) |
||
| 434 | #include <alloca.h> |
||
| 435 | #else /* not sparc */ |
||
| 436 | #if defined(MSDOS) && !defined(__TURBOC__) |
||
| 437 | #include <malloc.h> |
||
| 438 | #else /* not MSDOS, or __TURBOC__ */ |
||
| 439 | #if defined(_AIX) |
||
| 440 | #include <malloc.h> |
||
| 441 | #pragma alloca |
||
| 442 | #else /* not MSDOS, __TURBOC__, or _AIX */ |
||
| 443 | #ifdef __hpux |
||
| 444 | #ifdef __cplusplus |
||
| 445 | extern "C" |
||
| 446 | { |
||
| 447 | void *alloca (unsigned int); |
||
| 448 | }; |
||
| 449 | #else /* not __cplusplus */ |
||
| 450 | void *alloca (); |
||
| 451 | #endif /* not __cplusplus */ |
||
| 452 | #endif /* __hpux */ |
||
| 453 | #endif /* not _AIX */ |
||
| 454 | #endif /* not MSDOS, or __TURBOC__ */ |
||
| 455 | #endif /* not sparc. */ |
||
| 456 | #endif /* not GNU C. */ |
||
| 457 | #endif /* alloca not defined. */ |
||
| 458 | |||
| 459 | /* This is the parser code that is written into each bison parser |
||
| 460 | when the %semantic_parser declaration is not specified in the grammar. |
||
| 461 | It was written by Richard Stallman by simplifying the hairy parser |
||
| 462 | used when %semantic_parser is specified. */ |
||
| 463 | |||
| 464 | /* Note: there must be only one dollar sign in this file. |
||
| 465 | It is replaced by the list of actions, each action |
||
| 466 | as one case of the switch. */ |
||
| 467 | |||
| 468 | #define yyerrok (yyerrstatus = 0) |
||
| 469 | #define yyclearin (yychar = YYEMPTY) |
||
| 470 | #define YYEMPTY -2 |
||
| 471 | #define YYEOF 0 |
||
| 472 | #define YYACCEPT return (0) |
||
| 473 | #define YYABORT return (1) |
||
| 474 | #define YYERROR goto yyerrlab1 |
||
| 475 | /* Like YYERROR except do call yyerror. |
||
| 476 | This remains here temporarily to ease the |
||
| 477 | transition to the new meaning of YYERROR, for GCC. |
||
| 478 | Once GCC version 2 has supplanted version 1, this can go. */ |
||
| 479 | #define YYFAIL goto yyerrlab |
||
| 480 | #define YYRECOVERING() (!!yyerrstatus) |
||
| 481 | #define YYBACKUP(token, value) \ |
||
| 482 | do \ |
||
| 483 | if (yychar == YYEMPTY && yylen == 1) \ |
||
| 484 | { \ |
||
| 485 | yychar = (token), yylval = (value); \ |
||
| 486 | yychar1 = YYTRANSLATE (yychar); \ |
||
| 487 | YYPOPSTACK; \ |
||
| 488 | goto yybackup; \ |
||
| 489 | } \ |
||
| 490 | else \ |
||
| 491 | { \ |
||
| 492 | yyerror ("syntax error: cannot back up"); \ |
||
| 493 | YYERROR; \ |
||
| 494 | } \ |
||
| 495 | while (0) |
||
| 496 | |||
| 497 | #define YYTERROR 1 |
||
| 498 | #define YYERRCODE 256 |
||
| 499 | |||
| 500 | #ifndef YYPURE |
||
| 501 | #define YYLEX yylex () |
||
| 502 | #endif |
||
| 503 | |||
| 504 | #ifdef YYPURE |
||
| 505 | #ifdef YYLSP_NEEDED |
||
| 506 | #ifdef YYLEX_PARAM |
||
| 507 | #define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) |
||
| 508 | #else |
||
| 509 | #define YYLEX yylex (&yylval, &yylloc) |
||
| 510 | #endif |
||
| 511 | #else /* not YYLSP_NEEDED */ |
||
| 512 | #ifdef YYLEX_PARAM |
||
| 513 | #define YYLEX yylex (&yylval, YYLEX_PARAM) |
||
| 514 | #else |
||
| 515 | #define YYLEX yylex (&yylval) |
||
| 516 | #endif |
||
| 517 | #endif /* not YYLSP_NEEDED */ |
||
| 518 | #endif |
||
| 519 | |||
| 520 | /* If nonreentrant, generate the variables here */ |
||
| 521 | |||
| 522 | #ifndef YYPURE |
||
| 523 | |||
| 524 | int yychar; /* the lookahead symbol */ |
||
| 525 | YYSTYPE yylval; /* the semantic value of the */ |
||
| 526 | /* lookahead symbol */ |
||
| 527 | |||
| 528 | #ifdef YYLSP_NEEDED |
||
| 529 | YYLTYPE yylloc; /* location data for the lookahead */ |
||
| 530 | /* symbol */ |
||
| 531 | #endif |
||
| 532 | |||
| 533 | int yynerrs; /* number of parse errors so far */ |
||
| 534 | #endif /* not YYPURE */ |
||
| 535 | |||
| 536 | #if YYDEBUG != 0 |
||
| 537 | int yydebug; /* nonzero means print parse trace */ |
||
| 538 | /* Since this is uninitialized, it does not stop multiple parsers |
||
| 539 | from coexisting. */ |
||
| 540 | #endif |
||
| 541 | |||
| 542 | /* YYINITDEPTH indicates the initial size of the parser's stacks */ |
||
| 543 | |||
| 544 | #ifndef YYINITDEPTH |
||
| 545 | #define YYINITDEPTH 200 |
||
| 546 | #endif |
||
| 547 | |||
| 548 | /* YYMAXDEPTH is the maximum size the stacks can grow to |
||
| 549 | (effective only if the built-in stack extension method is used). */ |
||
| 550 | |||
| 551 | #if YYMAXDEPTH == 0 |
||
| 552 | #undef YYMAXDEPTH |
||
| 553 | #endif |
||
| 554 | |||
| 555 | #ifndef YYMAXDEPTH |
||
| 556 | #define YYMAXDEPTH 10000 |
||
| 557 | #endif |
||
| 558 | |||
| 559 | /* Prevent warning if -Wstrict-prototypes. */ |
||
| 560 | #ifdef __GNUC__ |
||
| 561 | int yyparse (void); |
||
| 562 | #endif |
||
| 563 | |||
| 564 | #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ |
||
| 565 | #define __yy_memcpy(TO, FROM, COUNT) __builtin_memcpy (TO, FROM, COUNT) |
||
| 566 | #else /* not GNU C or C++ */ |
||
| 567 | #ifndef __cplusplus |
||
| 568 | |||
| 569 | /* This is the most reliable way to avoid incompatibilities |
||
| 570 | in available built-in functions on various systems. */ |
||
| 571 | static void __yy_memcpy (to, from, count) char *to; |
||
| 572 | char *from; |
||
| 573 | int count; |
||
| 574 | { |
||
| 575 | register char *f = from; |
||
| 576 | register char *t = to; |
||
| 577 | register int i = count; |
||
| 578 | |||
| 579 | while (i-- > 0) |
||
| 580 | *t++ = *f++; |
||
| 581 | } |
||
| 582 | |||
| 583 | #else /* __cplusplus */ |
||
| 584 | |||
| 585 | /* This is the most reliable way to avoid incompatibilities |
||
| 586 | in available built-in functions on various systems. */ |
||
| 587 | static void __yy_memcpy (char *to, char *from, int count) |
||
| 588 | { |
||
| 589 | register char *f = from; |
||
| 590 | register char *t = to; |
||
| 591 | register int i = count; |
||
| 592 | |||
| 593 | while (i-- > 0) |
||
| 594 | *t++ = *f++; |
||
| 595 | } |
||
| 596 | |||
| 597 | #endif |
||
| 598 | #endif |
||
| 599 | |||
| 600 | #line 196 "/usr/share/bison.simple" |
||
| 601 | |||
| 602 | /* The user can define YYPARSE_PARAM as the name of an argument to be passed |
||
| 603 | into yyparse. The argument should have type void *. |
||
| 604 | It should actually point to an object. |
||
| 605 | Grammar actions can access the variable by casting it |
||
| 606 | to the proper pointer type. */ |
||
| 607 | |||
| 608 | #ifdef YYPARSE_PARAM |
||
| 609 | #ifdef __cplusplus |
||
| 610 | #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM |
||
| 611 | #define YYPARSE_PARAM_DECL |
||
| 612 | #else /* not __cplusplus */ |
||
| 613 | #define YYPARSE_PARAM_ARG YYPARSE_PARAM |
||
| 614 | #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; |
||
| 615 | #endif /* not __cplusplus */ |
||
| 616 | #else /* not YYPARSE_PARAM */ |
||
| 617 | #define YYPARSE_PARAM_ARG |
||
| 618 | #define YYPARSE_PARAM_DECL |
||
| 619 | #endif /* not YYPARSE_PARAM */ |
||
| 620 | |||
| 621 | int yyparse (YYPARSE_PARAM_ARG) YYPARSE_PARAM_DECL |
||
| 622 | { |
||
| 623 | register int yystate; |
||
| 624 | register int yyn; |
||
| 625 | register short *yyssp; |
||
| 626 | register YYSTYPE *yyvsp; |
||
| 627 | int yyerrstatus; /* number of tokens to shift before error messages enabled */ |
||
| 628 | int yychar1 = 0; /* lookahead token as an internal (translated) token number */ |
||
| 629 | |||
| 630 | short yyssa[YYINITDEPTH]; /* the state stack */ |
||
| 631 | YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ |
||
| 632 | |||
| 633 | short *yyss = yyssa; /* refer to the stacks thru separate pointers */ |
||
| 634 | YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ |
||
| 635 | |||
| 636 | #ifdef YYLSP_NEEDED |
||
| 637 | YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ |
||
| 638 | YYLTYPE *yyls = yylsa; |
||
| 639 | YYLTYPE *yylsp; |
||
| 640 | |||
| 641 | #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) |
||
| 642 | #else |
||
| 643 | #define YYPOPSTACK (yyvsp--, yyssp--) |
||
| 644 | #endif |
||
| 645 | |||
| 646 | int yystacksize = YYINITDEPTH; |
||
| 647 | |||
| 648 | #ifdef YYPURE |
||
| 649 | int yychar; |
||
| 650 | YYSTYPE yylval; |
||
| 651 | int yynerrs; |
||
| 652 | #ifdef YYLSP_NEEDED |
||
| 653 | YYLTYPE yylloc; |
||
| 654 | #endif |
||
| 655 | #endif |
||
| 656 | |||
| 657 | YYSTYPE yyval; /* the variable used to return */ |
||
| 658 | /* semantic values from the action */ |
||
| 659 | /* routines */ |
||
| 660 | |||
| 661 | int yylen; |
||
| 662 | |||
| 663 | #if YYDEBUG != 0 |
||
| 664 | if (yydebug) |
||
| 665 | fprintf (stderr, "Starting parse\n"); |
||
| 666 | #endif |
||
| 667 | |||
| 668 | yystate = 0; |
||
| 669 | yyerrstatus = 0; |
||
| 670 | yynerrs = 0; |
||
| 671 | yychar = YYEMPTY; /* Cause a token to be read. */ |
||
| 672 | |||
| 673 | /* Initialize stack pointers. |
||
| 674 | Waste one element of value and location stack |
||
| 675 | so that they stay on the same level as the state stack. |
||
| 676 | The wasted elements are never initialized. */ |
||
| 677 | |||
| 678 | yyssp = yyss - 1; |
||
| 679 | yyvsp = yyvs; |
||
| 680 | #ifdef YYLSP_NEEDED |
||
| 681 | yylsp = yyls; |
||
| 682 | #endif |
||
| 683 | |||
| 684 | /* Push a new state, which is found in yystate . */ |
||
| 685 | /* In all cases, when you get here, the value and location stacks |
||
| 686 | have just been pushed. so pushing a state here evens the stacks. */ |
||
| 687 | yynewstate: |
||
| 688 | |||
| 689 | *++yyssp = yystate; |
||
| 690 | |||
| 691 | if (yyssp >= yyss + yystacksize - 1) |
||
| 692 | { |
||
| 693 | /* Give user a chance to reallocate the stack */ |
||
| 694 | /* Use copies of these so that the &'s don't force the real ones into memory. |
||
| 695 | */ |
||
| 696 | YYSTYPE *yyvs1 = yyvs; |
||
| 697 | short *yyss1 = yyss; |
||
| 698 | #ifdef YYLSP_NEEDED |
||
| 699 | YYLTYPE *yyls1 = yyls; |
||
| 700 | #endif |
||
| 701 | |||
| 702 | /* Get the current used size of the three stacks, in elements. */ |
||
| 703 | int size = yyssp - yyss + 1; |
||
| 704 | |||
| 705 | #ifdef yyoverflow |
||
| 706 | /* Each stack pointer address is followed by the size of |
||
| 707 | the data in use in that stack, in bytes. */ |
||
| 708 | #ifdef YYLSP_NEEDED |
||
| 709 | /* This used to be a conditional around just the two extra args, |
||
| 710 | but that might be undefined if yyoverflow is a macro. */ |
||
| 711 | yyoverflow ( |
||
| 712 | "parser stack overflow", |
||
| 713 | &yyss1, |
||
| 714 | size * sizeof (*yyssp), |
||
| 715 | &yyvs1, |
||
| 716 | size * sizeof (*yyvsp), |
||
| 717 | &yyls1, |
||
| 718 | size * sizeof (*yylsp), |
||
| 719 | &yystacksize); |
||
| 720 | #else |
||
| 721 | yyoverflow ( |
||
| 722 | "parser stack overflow", |
||
| 723 | &yyss1, |
||
| 724 | size * sizeof (*yyssp), |
||
| 725 | &yyvs1, |
||
| 726 | size * sizeof (*yyvsp), |
||
| 727 | &yystacksize); |
||
| 728 | #endif |
||
| 729 | |||
| 730 | yyss = yyss1; |
||
| 731 | yyvs = yyvs1; |
||
| 732 | #ifdef YYLSP_NEEDED |
||
| 733 | yyls = yyls1; |
||
| 734 | #endif |
||
| 735 | #else /* no yyoverflow */ |
||
| 736 | /* Extend the stack our own way. */ |
||
| 737 | if (yystacksize >= YYMAXDEPTH) |
||
| 738 | { |
||
| 739 | yyerror ("parser stack overflow"); |
||
| 740 | return 2; |
||
| 741 | } |
||
| 742 | yystacksize *= 2; |
||
| 743 | if (yystacksize > YYMAXDEPTH) |
||
| 744 | yystacksize = YYMAXDEPTH; |
||
| 745 | yyss = (short *) alloca (yystacksize * sizeof (*yyssp)); |
||
| 746 | __yy_memcpy ((char *) yyss, (char *) yyss1, size * sizeof (*yyssp)); |
||
| 747 | yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp)); |
||
| 748 | __yy_memcpy ((char *) yyvs, (char *) yyvs1, size * sizeof (*yyvsp)); |
||
| 749 | #ifdef YYLSP_NEEDED |
||
| 750 | yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp)); |
||
| 751 | __yy_memcpy ((char *) yyls, (char *) yyls1, size * sizeof (*yylsp)); |
||
| 752 | #endif |
||
| 753 | #endif /* no yyoverflow */ |
||
| 754 | |||
| 755 | yyssp = yyss + size - 1; |
||
| 756 | yyvsp = yyvs + size - 1; |
||
| 757 | #ifdef YYLSP_NEEDED |
||
| 758 | yylsp = yyls + size - 1; |
||
| 759 | #endif |
||
| 760 | |||
| 761 | #if YYDEBUG != 0 |
||
| 762 | if (yydebug) |
||
| 763 | fprintf (stderr, "Stack size increased to %d\n", yystacksize); |
||
| 764 | #endif |
||
| 765 | |||
| 766 | if (yyssp >= yyss + yystacksize - 1) |
||
| 767 | YYABORT; |
||
| 768 | } |
||
| 769 | |||
| 770 | #if YYDEBUG != 0 |
||
| 771 | if (yydebug) |
||
| 772 | fprintf (stderr, "Entering state %d\n", yystate); |
||
| 773 | #endif |
||
| 774 | |||
| 775 | goto yybackup; |
||
| 776 | yybackup: |
||
| 777 | |||
| 778 | /* Do appropriate processing given the current state. */ |
||
| 779 | /* Read a lookahead token if we need one and don't already have one. */ |
||
| 780 | /* yyresume: */ |
||
| 781 | |||
| 782 | /* First try to decide what to do without reference to lookahead token. */ |
||
| 783 | |||
| 784 | yyn = yypact[yystate]; |
||
| 785 | if (yyn == YYFLAG) |
||
| 786 | goto yydefault; |
||
| 787 | |||
| 788 | /* Not known => get a lookahead token if don't already have one. */ |
||
| 789 | |||
| 790 | /* yychar is either YYEMPTY or YYEOF |
||
| 791 | or a valid token in external form. */ |
||
| 792 | |||
| 793 | if (yychar == YYEMPTY) |
||
| 794 | { |
||
| 795 | #if YYDEBUG != 0 |
||
| 796 | if (yydebug) |
||
| 797 | fprintf (stderr, "Reading a token: "); |
||
| 798 | #endif |
||
| 799 | yychar = YYLEX; |
||
| 800 | } |
||
| 801 | |||
| 802 | /* Convert token to internal form (in yychar1) for indexing tables with */ |
||
| 803 | |||
| 804 | if (yychar <= 0) /* This means end of input. */ |
||
| 805 | { |
||
| 806 | yychar1 = 0; |
||
| 807 | yychar = YYEOF; /* Don't call YYLEX any more */ |
||
| 808 | |||
| 809 | #if YYDEBUG != 0 |
||
| 810 | if (yydebug) |
||
| 811 | fprintf (stderr, "Now at end of input.\n"); |
||
| 812 | #endif |
||
| 813 | } |
||
| 814 | else |
||
| 815 | { |
||
| 816 | yychar1 = YYTRANSLATE (yychar); |
||
| 817 | |||
| 818 | #if YYDEBUG != 0 |
||
| 819 | if (yydebug) |
||
| 820 | { |
||
| 821 | fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); |
||
| 822 | /* Give the individual parser a way to print the precise meaning |
||
| 823 | of a token, for further debugging info. */ |
||
| 824 | #ifdef YYPRINT |
||
| 825 | YYPRINT (stderr, yychar, yylval); |
||
| 826 | #endif |
||
| 827 | fprintf (stderr, ")\n"); |
||
| 828 | } |
||
| 829 | #endif |
||
| 830 | } |
||
| 831 | |||
| 832 | yyn += yychar1; |
||
| 833 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) |
||
| 834 | goto yydefault; |
||
| 835 | |||
| 836 | yyn = yytable[yyn]; |
||
| 837 | |||
| 838 | /* yyn is what to do for this token type in this state. |
||
| 839 | Negative => reduce, -yyn is rule number. |
||
| 840 | Positive => shift, yyn is new state. |
||
| 841 | New state is final state => don't bother to shift, |
||
| 842 | just return success. |
||
| 843 | 0, or most negative number => error. */ |
||
| 844 | |||
| 845 | if (yyn < 0) |
||
| 846 | { |
||
| 847 | if (yyn == YYFLAG) |
||
| 848 | goto yyerrlab; |
||
| 849 | yyn = -yyn; |
||
| 850 | goto yyreduce; |
||
| 851 | } |
||
| 852 | else if (yyn == 0) |
||
| 853 | goto yyerrlab; |
||
| 854 | |||
| 855 | if (yyn == YYFINAL) |
||
| 856 | YYACCEPT; |
||
| 857 | |||
| 858 | /* Shift the lookahead token. */ |
||
| 859 | |||
| 860 | #if YYDEBUG != 0 |
||
| 861 | if (yydebug) |
||
| 862 | fprintf (stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); |
||
| 863 | #endif |
||
| 864 | |||
| 865 | /* Discard the token being shifted unless it is eof. */ |
||
| 866 | if (yychar != YYEOF) |
||
| 867 | yychar = YYEMPTY; |
||
| 868 | |||
| 869 | *++yyvsp = yylval; |
||
| 870 | #ifdef YYLSP_NEEDED |
||
| 871 | *++yylsp = yylloc; |
||
| 872 | #endif |
||
| 873 | |||
| 874 | /* count tokens shifted since error; after three, turn off error status. */ |
||
| 875 | if (yyerrstatus) |
||
| 876 | yyerrstatus--; |
||
| 877 | |||
| 878 | yystate = yyn; |
||
| 879 | goto yynewstate; |
||
| 880 | |||
| 881 | /* Do the default action for the current state. */ |
||
| 882 | yydefault: |
||
| 883 | |||
| 884 | yyn = yydefact[yystate]; |
||
| 885 | if (yyn == 0) |
||
| 886 | goto yyerrlab; |
||
| 887 | |||
| 888 | /* Do a reduction. yyn is the number of a rule to reduce with. */ |
||
| 889 | yyreduce: |
||
| 890 | yylen = yyr2[yyn]; |
||
| 891 | if (yylen > 0) |
||
| 892 | yyval = yyvsp[1 - yylen]; /* implement default value of the action */ |
||
| 893 | |||
| 894 | #if YYDEBUG != 0 |
||
| 895 | if (yydebug) |
||
| 896 | { |
||
| 897 | int i; |
||
| 898 | |||
| 899 | fprintf (stderr, "Reducing via rule %d (line %d), ", yyn, yyrline[yyn]); |
||
| 900 | |||
| 901 | /* Print the symbols being reduced, and their result. */ |
||
| 902 | for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) |
||
| 903 | fprintf (stderr, "%s ", yytname[yyrhs[i]]); |
||
| 904 | fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); |
||
| 905 | } |
||
| 906 | #endif |
||
| 907 | |||
| 908 | switch (yyn) |
||
| 909 | { |
||
| 910 | case 89: |
||
| 911 | #line 248 "hdl.y" |
||
| 912 | { |
||
| 913 | strcpy (part, yytext); |
||
| 914 | ; |
||
| 915 | break; |
||
| 916 | } |
||
| 917 | case 94: |
||
| 918 | #line 260 "hdl.y" |
||
| 919 | { |
||
| 920 | strcpy (refd, yytext); |
||
| 921 | ; |
||
| 922 | break; |
||
| 923 | } |
||
| 924 | case 99: |
||
| 925 | #line 272 "hdl.y" |
||
| 926 | { |
||
| 927 | fprintf ( |
||
| 928 | fo, |
||
| 929 | "%-18s %-22s %-10s %10s %s\n", |
||
| 930 | yyvsp[-1].s, |
||
| 931 | refd, |
||
| 932 | yyvsp[-3].s, |
||
| 933 | part, |
||
| 934 | modnam); |
||
| 935 | ; |
||
| 936 | break; |
||
| 937 | } |
||
| 938 | case 101: |
||
| 939 | #line 280 "hdl.y" |
||
| 940 | { |
||
| 941 | strcpy (yyval.s, yyvsp[-3].s); |
||
| 942 | strcat (yyval.s, "["); |
||
| 943 | strcat (yyval.s, yyvsp[-1].s); |
||
| 944 | strcat (yyval.s, "]"); |
||
| 945 | ; |
||
| 946 | break; |
||
| 947 | } |
||
| 948 | case 102: |
||
| 949 | #line 286 "hdl.y" |
||
| 950 | { |
||
| 951 | strcpy (yyval.s, yyvsp[-5].s); |
||
| 952 | strcat (yyval.s, "["); |
||
| 953 | strcat (yyval.s, yyvsp[-3].s); |
||
| 954 | strcat (yyval.s, ":"); |
||
| 955 | strcat (yyval.s, yyvsp[-1].s); |
||
| 956 | strcat (yyval.s, "]"); |
||
| 957 | ; |
||
| 958 | break; |
||
| 959 | } |
||
| 960 | case 103: |
||
| 961 | #line 294 "hdl.y" |
||
| 962 | { |
||
| 963 | strcpy (yyval.s, "concatenation"); |
||
| 964 | ; |
||
| 965 | break; |
||
| 966 | } |
||
| 967 | } |
||
| 968 | /* the action file gets copied in in place of this dollarsign */ |
||
| 969 | #line 498 "/usr/share/bison.simple" |
||
| 970 | |||
| 971 | yyvsp -= yylen; |
||
| 972 | yyssp -= yylen; |
||
| 973 | #ifdef YYLSP_NEEDED |
||
| 974 | yylsp -= yylen; |
||
| 975 | #endif |
||
| 976 | |||
| 977 | #if YYDEBUG != 0 |
||
| 978 | if (yydebug) |
||
| 979 | { |
||
| 980 | short *ssp1 = yyss - 1; |
||
| 981 | fprintf (stderr, "state stack now"); |
||
| 982 | while (ssp1 != yyssp) |
||
| 983 | fprintf (stderr, " %d", *++ssp1); |
||
| 984 | fprintf (stderr, "\n"); |
||
| 985 | } |
||
| 986 | #endif |
||
| 987 | |||
| 988 | *++yyvsp = yyval; |
||
| 989 | |||
| 990 | #ifdef YYLSP_NEEDED |
||
| 991 | yylsp++; |
||
| 992 | if (yylen == 0) |
||
| 993 | { |
||
| 994 | yylsp->first_line = yylloc.first_line; |
||
| 995 | yylsp->first_column = yylloc.first_column; |
||
| 996 | yylsp->last_line = (yylsp - 1)->last_line; |
||
| 997 | yylsp->last_column = (yylsp - 1)->last_column; |
||
| 998 | yylsp->text = 0; |
||
| 999 | } |
||
| 1000 | else |
||
| 1001 | { |
||
| 1002 | yylsp->last_line = (yylsp + yylen - 1)->last_line; |
||
| 1003 | yylsp->last_column = (yylsp + yylen - 1)->last_column; |
||
| 1004 | } |
||
| 1005 | #endif |
||
| 1006 | |||
| 1007 | /* Now "shift" the result of the reduction. |
||
| 1008 | Determine what state that goes to, |
||
| 1009 | based on the state we popped back to |
||
| 1010 | and the rule number reduced by. */ |
||
| 1011 | |||
| 1012 | yyn = yyr1[yyn]; |
||
| 1013 | |||
| 1014 | yystate = yypgoto[yyn - YYNTBASE] + *yyssp; |
||
| 1015 | if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) |
||
| 1016 | yystate = yytable[yystate]; |
||
| 1017 | else |
||
| 1018 | yystate = yydefgoto[yyn - YYNTBASE]; |
||
| 1019 | |||
| 1020 | goto yynewstate; |
||
| 1021 | |||
| 1022 | yyerrlab: /* here on detecting error */ |
||
| 1023 | |||
| 1024 | if (!yyerrstatus) |
||
| 1025 | /* If not already recovering from an error, report this error. */ |
||
| 1026 | { |
||
| 1027 | ++yynerrs; |
||
| 1028 | |||
| 1029 | #ifdef YYERROR_VERBOSE |
||
| 1030 | yyn = yypact[yystate]; |
||
| 1031 | |||
| 1032 | if (yyn > YYFLAG && yyn < YYLAST) |
||
| 1033 | { |
||
| 1034 | int size = 0; |
||
| 1035 | char *msg; |
||
| 1036 | int x, count; |
||
| 1037 | |||
| 1038 | count = 0; |
||
| 1039 | /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ |
||
| 1040 | for (x = (yyn < 0 ? -yyn : 0); |
||
| 1041 | x < (sizeof (yytname) / sizeof (char *)); |
||
| 1042 | x++) |
||
| 1043 | if (yycheck[x + yyn] == x) |
||
| 1044 | size += strlen (yytname[x]) + 15, count++; |
||
| 1045 | msg = (char *) malloc (size + 15); |
||
| 1046 | if (msg != 0) |
||
| 1047 | { |
||
| 1048 | strcpy (msg, "parse error"); |
||
| 1049 | |||
| 1050 | if (count < 5) |
||
| 1051 | { |
||
| 1052 | count = 0; |
||
| 1053 | for (x = (yyn < 0 ? -yyn : 0); |
||
| 1054 | x < (sizeof (yytname) / sizeof (char *)); |
||
| 1055 | x++) |
||
| 1056 | if (yycheck[x + yyn] == x) |
||
| 1057 | { |
||
| 1058 | strcat ( |
||
| 1059 | msg, |
||
| 1060 | count == 0 ? ", expecting `" |
||
| 1061 | : " or `"); |
||
| 1062 | strcat (msg, yytname[x]); |
||
| 1063 | strcat (msg, "'"); |
||
| 1064 | count++; |
||
| 1065 | } |
||
| 1066 | } |
||
| 1067 | yyerror (msg); |
||
| 1068 | free (msg); |
||
| 1069 | } |
||
| 1070 | else |
||
| 1071 | yyerror ("parse error; also virtual memory exceeded"); |
||
| 1072 | } |
||
| 1073 | else |
||
| 1074 | #endif /* YYERROR_VERBOSE */ |
||
| 1075 | yyerror ("parse error"); |
||
| 1076 | } |
||
| 1077 | |||
| 1078 | goto yyerrlab1; |
||
| 1079 | yyerrlab1: /* here on error raised explicitly by an action */ |
||
| 1080 | |||
| 1081 | if (yyerrstatus == 3) |
||
| 1082 | { |
||
| 1083 | /* if just tried and failed to reuse lookahead token after an error, discard |
||
| 1084 | * it. */ |
||
| 1085 | |||
| 1086 | /* return failure if at end of input */ |
||
| 1087 | if (yychar == YYEOF) |
||
| 1088 | YYABORT; |
||
| 1089 | |||
| 1090 | #if YYDEBUG != 0 |
||
| 1091 | if (yydebug) |
||
| 1092 | fprintf ( |
||
| 1093 | stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); |
||
| 1094 | #endif |
||
| 1095 | |||
| 1096 | yychar = YYEMPTY; |
||
| 1097 | } |
||
| 1098 | |||
| 1099 | /* Else will try to reuse lookahead token |
||
| 1100 | after shifting the error token. */ |
||
| 1101 | |||
| 1102 | yyerrstatus = 3; /* Each real token shifted decrements this */ |
||
| 1103 | |||
| 1104 | goto yyerrhandle; |
||
| 1105 | |||
| 1106 | yyerrdefault: /* current state does not do anything special for the error token. */ |
||
| 1107 | |||
| 1108 | #if 0 |
||
| 1109 | /* This is wrong; only states that explicitly want error tokens |
||
| 1110 | should shift them. */ |
||
| 1111 | yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ |
||
| 1112 | if (yyn) goto yydefault; |
||
| 1113 | #endif |
||
| 1114 | |||
| 1115 | yyerrpop: /* pop the current state because it cannot handle the error token */ |
||
| 1116 | |||
| 1117 | if (yyssp == yyss) |
||
| 1118 | YYABORT; |
||
| 1119 | yyvsp--; |
||
| 1120 | yystate = *--yyssp; |
||
| 1121 | #ifdef YYLSP_NEEDED |
||
| 1122 | yylsp--; |
||
| 1123 | #endif |
||
| 1124 | |||
| 1125 | #if YYDEBUG != 0 |
||
| 1126 | if (yydebug) |
||
| 1127 | { |
||
| 1128 | short *ssp1 = yyss - 1; |
||
| 1129 | fprintf (stderr, "Error: state stack now"); |
||
| 1130 | while (ssp1 != yyssp) |
||
| 1131 | fprintf (stderr, " %d", *++ssp1); |
||
| 1132 | fprintf (stderr, "\n"); |
||
| 1133 | } |
||
| 1134 | #endif |
||
| 1135 | |||
| 1136 | yyerrhandle: |
||
| 1137 | |||
| 1138 | yyn = yypact[yystate]; |
||
| 1139 | if (yyn == YYFLAG) |
||
| 1140 | goto yyerrdefault; |
||
| 1141 | |||
| 1142 | yyn += YYTERROR; |
||
| 1143 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) |
||
| 1144 | goto yyerrdefault; |
||
| 1145 | |||
| 1146 | yyn = yytable[yyn]; |
||
| 1147 | if (yyn < 0) |
||
| 1148 | { |
||
| 1149 | if (yyn == YYFLAG) |
||
| 1150 | goto yyerrpop; |
||
| 1151 | yyn = -yyn; |
||
| 1152 | goto yyreduce; |
||
| 1153 | } |
||
| 1154 | else if (yyn == 0) |
||
| 1155 | goto yyerrpop; |
||
| 1156 | |||
| 1157 | if (yyn == YYFINAL) |
||
| 1158 | YYACCEPT; |
||
| 1159 | |||
| 1160 | #if YYDEBUG != 0 |
||
| 1161 | if (yydebug) |
||
| 1162 | fprintf (stderr, "Shifting error token, "); |
||
| 1163 | #endif |
||
| 1164 | |||
| 1165 | *++yyvsp = yylval; |
||
| 1166 | #ifdef YYLSP_NEEDED |
||
| 1167 | *++yylsp = yylloc; |
||
| 1168 | #endif |
||
| 1169 | |||
| 1170 | yystate = yyn; |
||
| 1171 | goto yynewstate; |
||
| 1172 | } |
||
| 1173 | #line 347 "hdl.y" |
||
| 1174 | /* start of main */ |
||
| 1175 | |||
| 1176 | main (argc, argv) int argc; |
||
| 1177 | char *argv[]; |
||
| 1178 | { |
||
| 1179 | int i, p; |
||
| 1180 | char frnam[60], fsnam[60]; |
||
| 1181 | yyout = stderr; |
||
| 1182 | |||
| 1183 | if (argc == 1) |
||
| 1184 | { |
||
| 1185 | fprintf (stderr, "use:hdl [-ds] file\n"); |
||
| 1186 | exit (1); |
||
| 1187 | } |
||
| 1188 | for (i = 1; i < argc; i++) |
||
| 1189 | if (argv[i][0] == '-') |
||
| 1190 | { |
||
| 1191 | bug = ((argv[i][1] == 'd') || (argv[i][2] == 'd')); |
||
| 1192 | } |
||
| 1193 | else |
||
| 1194 | break; |
||
| 1195 | |||
| 1196 | if (freopen (argv[i], "r", stdin) == NULL) |
||
| 1197 | { |
||
| 1198 | fprintf (stderr, "can't open %s\n", argv[i]); |
||
| 1199 | exit (1); |
||
| 1200 | } |
||
| 1201 | else |
||
| 1202 | { |
||
| 1203 | /* open output */ |
||
| 1204 | for (cp = argv[i], st = fsnam; *cp && *cp != '.';) |
||
| 1205 | *st++ = *cp++; |
||
| 1206 | *st = 0; |
||
| 1207 | strcpy (frnam, fsnam); |
||
| 1208 | strcat (frnam, ".nam"); |
||
| 1209 | strcat (fsnam, ".seq"); |
||
| 1210 | |||
| 1211 | if ((fo = fopen (fsnam, "w")) == NULL) |
||
| 1212 | err ("can't open %s", fsnam); |
||
| 1213 | |||
| 1214 | fprintf (stderr, "reading nets from %s\n", argv[i]); |
||
| 1215 | } |
||
| 1216 | |||
| 1217 | yyparse (); |
||
| 1218 | |||
| 1219 | fclose (fo); |
||
| 1220 | |||
| 1221 | fprintf (stderr, "sorting...\n"); |
||
| 1222 | sprintf (ln, "sort <%s >%s", fsnam, frnam); |
||
| 1223 | system (ln); |
||
| 1224 | } |
||
| 1225 | |||
| 1226 | int yylex () /* Gets the next token from the input stream */ |
||
| 1227 | { |
||
| 1228 | int c, i, j; |
||
| 1229 | static int eline; |
||
| 1230 | extern int bug; |
||
| 1231 | |||
| 1232 | start: |
||
| 1233 | if (yysptr == -1) |
||
| 1234 | { |
||
| 1235 | i = 0; |
||
| 1236 | eline = 1; |
||
| 1237 | yylineno++; |
||
| 1238 | /* get line to yysbuf */ |
||
| 1239 | while (((c = getchar ()) != EOF) && (c != YYNL)) |
||
| 1240 | { |
||
| 1241 | if (c == '\t') |
||
| 1242 | { |
||
| 1243 | c = ' '; |
||
| 1244 | do |
||
| 1245 | yysbuf[i++] = c; |
||
| 1246 | while (i & 7); |
||
| 1247 | } |
||
| 1248 | else |
||
| 1249 | { |
||
| 1250 | if (c != ' ') |
||
| 1251 | eline = 0; |
||
| 1252 | yysbuf[i++] = c; |
||
| 1253 | } |
||
| 1254 | } |
||
| 1255 | yysptr = 0; |
||
| 1256 | yysbuf[i] = '\0'; |
||
| 1257 | yylast = toklast = 0; |
||
| 1258 | } |
||
| 1259 | if (c == EOF) |
||
| 1260 | return (EOF); |
||
| 1261 | |||
| 1262 | while ((c = yysbuf[yysptr]) == ' ') |
||
| 1263 | yysptr++; |
||
| 1264 | |||
| 1265 | if (bug) |
||
| 1266 | { |
||
| 1267 | fprintf (yyout, "%03d:%s\n", yylineno, yysbuf); |
||
| 1268 | for (i = yysptr; i > 0; i--) |
||
| 1269 | out (' '); |
||
| 1270 | } |
||
| 1271 | |||
| 1272 | if (c == YYNL || c == 0) |
||
| 1273 | { |
||
| 1274 | yysptr = -1; |
||
| 1275 | if (bug) |
||
| 1276 | fprintf (yyout, "\n"); |
||
| 1277 | goto start; |
||
| 1278 | } |
||
| 1279 | |||
| 1280 | if (comment) |
||
| 1281 | { |
||
| 1282 | while ((c = yysbuf[yysptr++]) != '*' && c != '/' && c) |
||
| 1283 | ; |
||
| 1284 | if (c == '*' && yysbuf[yysptr] == '/') |
||
| 1285 | comment--; |
||
| 1286 | if (c == '/' && yysbuf[yysptr] == '*') |
||
| 1287 | comment++; |
||
| 1288 | if (c == 0) |
||
| 1289 | yysptr = -1; |
||
| 1290 | if (comment) |
||
| 1291 | goto start; |
||
| 1292 | yysptr++; |
||
| 1293 | goto start; |
||
| 1294 | } |
||
| 1295 | |||
| 1296 | if (c == '/') |
||
| 1297 | { /* comment // ? */ |
||
| 1298 | if (yysbuf[yysptr + 1] == '/') |
||
| 1299 | { |
||
| 1300 | yysptr = -1; |
||
| 1301 | goto start; |
||
| 1302 | } |
||
| 1303 | if (yysbuf[yysptr + 1] == '*') |
||
| 1304 | { |
||
| 1305 | comment++; |
||
| 1306 | yysptr += 2; |
||
| 1307 | goto start; |
||
| 1308 | } |
||
| 1309 | } |
||
| 1310 | if (c == '\\') |
||
| 1311 | { /* escaped name */ |
||
| 1312 | yyleng = 0; |
||
| 1313 | while ((c = yysbuf[++yysptr]) != ' ') |
||
| 1314 | yytext[yyleng++] = c; |
||
| 1315 | yytext[yyleng] = '\0'; |
||
| 1316 | if (bug) |
||
| 1317 | fprintf (yyout, " ^tok:NAME\n"); |
||
| 1318 | if (toklast == MODULE) |
||
| 1319 | { |
||
| 1320 | toklast = 0; |
||
| 1321 | strcpy (modnam, yytext); |
||
| 1322 | fprintf (stderr, "module %s\n", modnam); |
||
| 1323 | } |
||
| 1324 | if (toklast == PRIMITIVE) |
||
| 1325 | { |
||
| 1326 | toklast = 0; |
||
| 1327 | strcpy (modnam, yytext); |
||
| 1328 | fprintf (stderr, "primitive %s\n", modnam); |
||
| 1329 | } |
||
| 1330 | strcpy (yylval.s, yytext); |
||
| 1331 | return (NAME); |
||
| 1332 | } |
||
| 1333 | if (isalpha (c)) |
||
| 1334 | { |
||
| 1335 | if (yylast == '\'') |
||
| 1336 | { /* number base - 1'b0 */ |
||
| 1337 | yysptr++; |
||
| 1338 | if (bug) |
||
| 1339 | if (c < ' ') |
||
| 1340 | fprintf (yyout, " ^CHAR:%d\n", c); |
||
| 1341 | else |
||
| 1342 | fprintf (yyout, " ^CHAR:%c\n", c); |
||
| 1343 | yylast = c; |
||
| 1344 | return (c); |
||
| 1345 | } |
||
| 1346 | if ((j = chktok ()) != 0) |
||
| 1347 | { |
||
| 1348 | toklast = j; |
||
| 1349 | return (j); |
||
| 1350 | } |
||
| 1351 | name: |
||
| 1352 | yyleng = 0; |
||
| 1353 | while (isalpha (c) || isdigit (c) || c == '_') |
||
| 1354 | { |
||
| 1355 | yytext[yyleng++] = c; |
||
| 1356 | c = yysbuf[++yysptr]; |
||
| 1357 | } |
||
| 1358 | yytext[yyleng] = '\0'; |
||
| 1359 | if (bug) |
||
| 1360 | fprintf (yyout, " ^tok:NAME\n"); |
||
| 1361 | if (toklast == MODULE) |
||
| 1362 | { |
||
| 1363 | toklast = 0; |
||
| 1364 | strcpy (modnam, yytext); |
||
| 1365 | fprintf (stderr, "module %s\n", modnam); |
||
| 1366 | } |
||
| 1367 | if (toklast == PRIMITIVE) |
||
| 1368 | { |
||
| 1369 | toklast = 0; |
||
| 1370 | strcpy (modnam, yytext); |
||
| 1371 | fprintf (stderr, "primitive %s\n", modnam); |
||
| 1372 | } |
||
| 1373 | strcpy (yylval.s, yytext); |
||
| 1374 | return (NAME); |
||
| 1375 | } |
||
| 1376 | if (isdigit (c)) |
||
| 1377 | { |
||
| 1378 | yyleng = 0; |
||
| 1379 | while (isdigit (c)) |
||
| 1380 | { |
||
| 1381 | yytext[yyleng++] = c; |
||
| 1382 | c = yysbuf[++yysptr]; |
||
| 1383 | } |
||
| 1384 | yytext[yyleng] = '\0'; |
||
| 1385 | if (bug) |
||
| 1386 | fprintf (yyout, " ^tok:NUMBER\n"); |
||
| 1387 | strcpy (yylval.s, yytext); |
||
| 1388 | return (NUMBER); |
||
| 1389 | } |
||
| 1390 | yysptr++; |
||
| 1391 | yylast = c; |
||
| 1392 | if (c == '+' || c == '-' || c == '&' || c == '|' || c == '^') |
||
| 1393 | { |
||
| 1394 | if (bug) |
||
| 1395 | fprintf (yyout, " ^BIN_OP:%c\n", c); |
||
| 1396 | return (BIN_OP); |
||
| 1397 | } |
||
| 1398 | if (c == '!' || c == '~') |
||
| 1399 | { |
||
| 1400 | if (bug) |
||
| 1401 | fprintf (yyout, " ^UNARY_OP:%c\n", c); |
||
| 1402 | return (UNARY_OP); |
||
| 1403 | } |
||
| 1404 | if (bug) |
||
| 1405 | if (c < ' ') |
||
| 1406 | fprintf (yyout, " ^CHAR:%d\n", c); |
||
| 1407 | else |
||
| 1408 | fprintf (yyout, " ^CHAR:%c\n", c); |
||
| 1409 | return (c); |
||
| 1410 | } /* nexttoken */ |
||
| 1411 | |||
| 1412 | int chktok () |
||
| 1413 | { |
||
| 1414 | static struct |
||
| 1415 | { |
||
| 1416 | char *keyword; |
||
| 1417 | int val, tok; |
||
| 1418 | } key[] = {"module ", 0, MODULE, "endmodule", 0, ENDMODULE, |
||
| 1419 | "primitive ", 0, PRIMITIVE, "endprimitive", 0, ENDPRIM, |
||
| 1420 | "input ", 0, INPUT, "output ", 0, OUTPUT, |
||
| 1421 | "inout ", 0, INOUT, "assign ", 0, ASSIGN, |
||
| 1422 | "wire ", 0, NETTYPE, "triand ", 1, NETTYPE, |
||
| 1423 | "trior ", 2, NETTYPE, "tri1 ", 3, NETTYPE, |
||
| 1424 | "tri ", 4, NETTYPE, "supply0 ", 5, NETTYPE, |
||
| 1425 | "supply1 ", 6, NETTYPE, "wor ", 7, NETTYPE, |
||
| 1426 | "trireg ", 8, NETTYPE, "supply0 ", 0, STRENGTH0, |
||
| 1427 | "strong0 ", 1, STRENGTH0, "pull0 ", 2, STRENGTH0, |
||
| 1428 | "weak0 ", 3, STRENGTH0, "highz0 ", 4, STRENGTH0, |
||
| 1429 | "supply1 ", 0, STRENGTH1, "strong1 ", 1, STRENGTH1, |
||
| 1430 | "pull1 ", 2, STRENGTH1, "weak1 ", 3, STRENGTH1, |
||
| 1431 | "highz1 ", 4, STRENGTH1, "parameter ", 0, PARAMETER, |
||
| 1432 | "reg ", 0, REG, "time ", 0, TIME, |
||
| 1433 | "integer ", 0, INTEGER, "real ", 0, REAL, |
||
| 1434 | "event ", 0, EVENT, "defparam ", 0, DEFPARAM, |
||
| 1435 | "and ", 0, GATETYPE, "nand ", 1, GATETYPE, |
||
| 1436 | "or ", 2, GATETYPE, "nor ", 3, GATETYPE, |
||
| 1437 | "xor ", 4, GATETYPE, "xnor ", 5, GATETYPE, |
||
| 1438 | "buf ", 6, GATETYPE, "tran ", 7, GATETYPE, |
||
| 1439 | "table ", 0, TABLE, "endtable", 0, ENDTABLE, |
||
| 1440 | "initial ", 0, INITIAL, NULL, 0, 0}; |
||
| 1441 | int save, i, j; |
||
| 1442 | char *s; |
||
| 1443 | |||
| 1444 | for (j = 0; (s = key[j].keyword) != NULL; j++) |
||
| 1445 | { |
||
| 1446 | save = yysptr; |
||
| 1447 | yyleng = 0; |
||
| 1448 | while (*s == yysbuf[yysptr++] && *s) |
||
| 1449 | yytext[yyleng++] = *s++; |
||
| 1450 | if (*s == '\0') |
||
| 1451 | { |
||
| 1452 | yytext[yyleng] = '\0'; |
||
| 1453 | yysptr--; |
||
| 1454 | if (bug) |
||
| 1455 | { |
||
| 1456 | for (i = yysptr - 1; i > 0; i--) |
||
| 1457 | out (' '); |
||
| 1458 | fprintf (yyout, " ^tok:%s\n", yytext); |
||
| 1459 | } |
||
| 1460 | yylval.i = key[j].val; |
||
| 1461 | return (key[j].tok); |
||
| 1462 | } |
||
| 1463 | yysptr = save; |
||
| 1464 | } |
||
| 1465 | return (0); |
||
| 1466 | } |
||
| 1467 | |||
| 1468 | yyerror (s) char *s; |
||
| 1469 | { |
||
| 1470 | int i; |
||
| 1471 | |||
| 1472 | fprintf (stderr, "%s error on line %d\n", s, yylineno); |
||
| 1473 | fprintf (stderr, "%s\n", yysbuf); |
||
| 1474 | for (i = yysptr; i > 0; i--) |
||
| 1475 | out (' '); |
||
| 1476 | fprintf (stderr, "^\n"); |
||
| 1477 | } |
||
| 1478 | |||
| 1479 | char *strsave (s) char *s; |
||
| 1480 | { |
||
| 1481 | char *p, *malloc (); |
||
| 1482 | |||
| 1483 | if ((p = malloc (strlen (s) + 1)) != NULL) |
||
| 1484 | strcpy (p, s); |
||
| 1485 | if (p == NULL) |
||
| 1486 | err ("out of malloc space"); |
||
| 1487 | return (p); |
||
| 1488 | } |
||
| 1489 | |||
| 1490 | err (s, t) char *s, *t; |
||
| 1491 | { |
||
| 1492 | fprintf (stderr, s, t); |
||
| 1493 | fprintf (stderr, "\n"); |
||
| 1494 | exit (1); |
||
| 1495 | } |