1 | 2 | /* A Bison parser, made from import.y 3 | by GNU Bison version 1.28 */ 4 | 5 | #define YYBISON 1 /* Identify Bison output. */ 6 | 7 | #define yyparse importparse 8 | #define yylex importlex 9 | #define yyerror importerror 10 | #define yylval importlval 11 | #define yychar importchar 12 | #define yydebug importdebug 13 | #define yynerrs importnerrs 14 | #define OP_OR 257 15 | #define OP_AND 258 16 | #define OP_NOT 259 17 | #define OP_MS 260 18 | #define OP_EQUAL 261 19 | #define OP_APPEND 262 20 | #define OP_COMPARE 263 21 | #define KEYW_ANY 264 22 | #define KEYW_PEERAS 265 23 | #define ASPATH_POSTFIX 266 24 | #define TKN_FLTRNAME 267 25 | #define TKN_ASNO 268 26 | #define TKN_RSNAME 269 27 | #define TKN_ASNAME 270 28 | #define TKN_PRFXV4 271 29 | #define TKN_PRFXV4RNG 272 30 | #define TKN_IPV4 273 31 | #define TKN_DNS 274 32 | #define TKN_RTRSNAME 275 33 | #define TKN_PRNGNAME 276 34 | #define KEYW_ACTION 277 35 | #define KEYW_EXCEPT 278 36 | #define TKN_PREF 279 37 | #define TKN_MED 280 38 | #define TKN_DPA 281 39 | #define TKN_ASPATH 282 40 | #define TKN_COMMUNITY 283 41 | #define TKN_NEXT_HOP 284 42 | #define TKN_COST 285 43 | #define TKN_COMM_NO 286 44 | #define KEYW_IGP_COST 287 45 | #define KEYW_SELF 288 46 | #define KEYW_PREPEND 289 47 | #define KEYW_APPEND 290 48 | #define KEYW_DELETE 291 49 | #define KEYW_CONTAINS 292 50 | #define KEYW_AT 293 51 | #define KEYW_INTERNET 294 52 | #define KEYW_NO_EXPORT 295 53 | #define KEYW_NO_ADVERTISE 296 54 | #define KEYW_PROTOCOL 297 55 | #define TKN_PROTOCOL 298 56 | #define KEYW_INTO 299 57 | #define KEYW_REFINE 300 58 | #define KEYW_ACCEPT 301 59 | #define KEYW_FROM 302 60 | #define TKN_INT 303 61 | 62 | #line 1 "import.y" 63 | 64 | /* 65 | filename: import.y 66 | 67 | description: 68 | Defines the grammar for an RPSL import attribute. It was mostly 69 | stolen from the IRRToolSet, simplified by removing ability to parse 70 | things defined by a dictionary (we use XML for extensibility rather 71 | than a dictionary). 72 | 73 | notes: 74 | Defines tokens for the associated lexer, import.l. 75 | */ 76 | 77 | #line 16 "import.y" 78 | typedef union { 79 | char *sval; 80 | } YYSTYPE; 81 | #line 36 "import.y" 82 | 83 | #include <stdio.h> 84 | #include <stdarg.h> 85 | #include <stdlib.h> 86 | 87 | int yyerror(const char *s); 88 | void syntax_error(char *fmt, ...); 89 | 90 | #include <stdio.h> 91 | 92 | #ifndef __cplusplus 93 | #ifndef __STDC__ 94 | #define const 95 | #endif 96 | #endif 97 | 98 | 99 | 100 | #define YYFINAL 213 101 | #define YYFLAG -32768 102 | #define YYNTBASE 68 103 | 104 | #define YYTRANSLATE(x) ((unsigned)(x) <= 303 ? yytranslate[x] : 117) 105 | 106 | static const char yytranslate[] = { 0, 107 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 108 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 109 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 110 | 2, 2, 2, 2, 2, 64, 2, 2, 2, 53, 111 | 54, 60, 62, 56, 67, 55, 2, 2, 2, 2, 112 | 2, 2, 2, 2, 2, 2, 2, 2, 50, 57, 113 | 2, 58, 61, 2, 2, 2, 2, 2, 2, 2, 114 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 115 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 116 | 65, 2, 66, 63, 2, 2, 2, 2, 2, 2, 117 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 118 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 119 | 2, 2, 51, 59, 52, 2, 2, 2, 2, 2, 120 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 121 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 122 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 123 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 124 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 125 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 126 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 127 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 128 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 129 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 130 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 131 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 132 | 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, 133 | 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 134 | 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 135 | 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 136 | 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 137 | 47, 48, 49 138 | }; 139 | 140 | #if YYDEBUG != 0 141 | static const short yyprhs[] = { 0, 142 | 0, 4, 8, 9, 12, 13, 16, 18, 22, 26, 143 | 29, 33, 36, 40, 44, 48, 53, 57, 59, 60, 144 | 63, 67, 69, 73, 77, 79, 83, 85, 87, 89, 145 | 90, 92, 93, 96, 100, 102, 106, 110, 112, 116, 146 | 118, 120, 122, 124, 126, 130, 133, 137, 139, 141, 147 | 143, 145, 147, 149, 151, 155, 159, 163, 167, 174, 148 | 176, 180, 184, 188, 195, 202, 209, 214, 218, 222, 149 | 224, 228, 230, 232, 234, 236, 238, 242, 246, 250, 150 | 254, 257, 259, 263, 265, 268, 272, 274, 276, 280, 151 | 282, 284, 286, 289, 291, 293, 295, 297, 299, 303, 152 | 304, 306, 308, 312, 314, 316, 320, 322, 325, 327, 153 | 330, 333, 336, 339, 341, 343, 345, 349, 351, 353, 154 | 355, 357, 359, 363, 368, 369, 372, 375, 378, 383 155 | }; 156 | 157 | static const short yyrhs[] = { 69, 158 | 70, 71, 0, 69, 70, 74, 0, 0, 43, 44, 159 | 0, 0, 45, 44, 0, 72, 0, 72, 46, 71, 160 | 0, 72, 24, 71, 0, 74, 50, 0, 51, 73, 161 | 52, 0, 74, 50, 0, 73, 74, 50, 0, 75, 162 | 47, 102, 0, 48, 76, 77, 0, 75, 48, 76, 163 | 77, 0, 78, 82, 83, 0, 22, 0, 0, 23, 164 | 89, 0, 78, 3, 79, 0, 79, 0, 79, 4, 165 | 80, 0, 79, 24, 80, 0, 80, 0, 53, 78, 166 | 54, 0, 81, 0, 14, 0, 16, 0, 0, 84, 167 | 0, 0, 39, 84, 0, 84, 3, 85, 0, 85, 168 | 0, 85, 4, 86, 0, 85, 24, 86, 0, 86, 169 | 0, 53, 84, 54, 0, 87, 0, 19, 0, 88, 170 | 0, 21, 0, 20, 0, 88, 55, 20, 0, 90, 171 | 50, 0, 89, 90, 50, 0, 91, 0, 92, 0, 172 | 93, 0, 94, 0, 96, 0, 100, 0, 101, 0, 173 | 25, 7, 49, 0, 26, 7, 49, 0, 26, 7, 174 | 33, 0, 27, 7, 49, 0, 28, 55, 35, 53, 175 | 95, 54, 0, 14, 0, 95, 56, 14, 0, 29, 176 | 7, 97, 0, 29, 8, 97, 0, 29, 55, 36, 177 | 53, 98, 54, 0, 29, 55, 37, 53, 98, 54, 178 | 0, 29, 55, 38, 53, 98, 54, 0, 29, 53, 179 | 98, 54, 0, 29, 9, 97, 0, 51, 98, 52, 180 | 0, 99, 0, 98, 56, 99, 0, 40, 0, 41, 181 | 0, 42, 0, 49, 0, 32, 0, 30, 7, 19, 182 | 0, 30, 7, 34, 0, 31, 7, 49, 0, 102, 183 | 3, 103, 0, 102, 103, 0, 103, 0, 103, 4, 184 | 104, 0, 104, 0, 5, 104, 0, 53, 102, 54, 185 | 0, 105, 0, 10, 0, 57, 111, 58, 0, 90, 186 | 0, 13, 0, 106, 0, 107, 6, 0, 107, 0, 187 | 14, 0, 11, 0, 16, 0, 15, 0, 51, 108, 188 | 52, 0, 0, 109, 0, 110, 0, 109, 56, 110, 189 | 0, 17, 0, 18, 0, 111, 59, 112, 0, 112, 190 | 0, 112, 113, 0, 113, 0, 113, 60, 0, 113, 191 | 61, 0, 113, 62, 0, 113, 12, 0, 114, 0, 192 | 63, 0, 64, 0, 53, 111, 54, 0, 115, 0, 193 | 14, 0, 11, 0, 16, 0, 55, 0, 65, 116, 194 | 66, 0, 65, 63, 116, 66, 0, 0, 116, 14, 195 | 0, 116, 11, 0, 116, 55, 0, 116, 14, 67, 196 | 14, 0, 116, 16, 0 197 | }; 198 | 199 | #endif 200 | 201 | #if YYDEBUG != 0 202 | static const short yyrline[] = { 0, 203 | 48, 49, 52, 53, 56, 57, 60, 61, 62, 65, 204 | 66, 69, 70, 73, 76, 77, 80, 81, 84, 85, 205 | 88, 89, 92, 93, 94, 97, 98, 101, 102, 105, 206 | 106, 109, 110, 113, 114, 117, 118, 119, 122, 123, 207 | 126, 127, 132, 135, 136, 139, 140, 143, 144, 145, 208 | 146, 147, 148, 149, 152, 163, 172, 175, 186, 189, 209 | 190, 193, 194, 195, 196, 197, 198, 199, 202, 205, 210 | 206, 209, 210, 211, 212, 222, 225, 226, 229, 240, 211 | 241, 242, 245, 246, 249, 250, 251, 254, 255, 256, 212 | 257, 258, 261, 262, 265, 266, 267, 268, 269, 272, 213 | 273, 276, 277, 280, 281, 284, 285, 288, 289, 292, 214 | 293, 294, 295, 296, 299, 300, 301, 302, 305, 306, 215 | 307, 308, 309, 310, 313, 314, 315, 316, 317, 318 216 | }; 217 | #endif 218 | 219 | 220 | #if YYDEBUG != 0 || defined (YYERROR_VERBOSE) 221 | 222 | static const char * const yytname[] = { "$","error","$undefined.","OP_OR", 223 | "OP_AND","OP_NOT","OP_MS","OP_EQUAL","OP_APPEND","OP_COMPARE","KEYW_ANY","KEYW_PEERAS", 224 | "ASPATH_POSTFIX","TKN_FLTRNAME","TKN_ASNO","TKN_RSNAME","TKN_ASNAME","TKN_PRFXV4", 225 | "TKN_PRFXV4RNG","TKN_IPV4","TKN_DNS","TKN_RTRSNAME","TKN_PRNGNAME","KEYW_ACTION", 226 | "KEYW_EXCEPT","TKN_PREF","TKN_MED","TKN_DPA","TKN_ASPATH","TKN_COMMUNITY","TKN_NEXT_HOP", 227 | "TKN_COST","TKN_COMM_NO","KEYW_IGP_COST","KEYW_SELF","KEYW_PREPEND","KEYW_APPEND", 228 | "KEYW_DELETE","KEYW_CONTAINS","KEYW_AT","KEYW_INTERNET","KEYW_NO_EXPORT","KEYW_NO_ADVERTISE", 229 | "KEYW_PROTOCOL","TKN_PROTOCOL","KEYW_INTO","KEYW_REFINE","KEYW_ACCEPT","KEYW_FROM", 230 | "TKN_INT","';'","'{'","'}'","'('","')'","'.'","','","'<'","'>'","'|'","'*'", 231 | "'?'","'+'","'^'","'$'","'['","']'","'-'","import_attribute","opt_protocol_from", 232 | "opt_protocol_into","import_expr","import_term","import_factor_list","import_factor", 233 | "import_peering_action_list","peering","opt_action","as_expr","as_expr_term", 234 | "as_expr_factor","as_expr_operand","opt_router_expr","opt_router_expr_with_at", 235 | "router_expr","router_expr_term","router_expr_factor","router_expr_operand", 236 | "domain_name","action","rp_attribute","pref","med","dpa","aspath","asno_list", 237 | "community","community_list","community_elm_list","community_elm","next_hop", 238 | "cost","filter","filter_term","filter_factor","filter_operand","filter_prefix", 239 | "filter_prefix_operand","opt_filter_prefix_list","filter_prefix_list","filter_prefix_list_prefix", 240 | "filter_aspath","filter_aspath_term","filter_aspath_closure","filter_aspath_factor", 241 | "filter_aspath_no","filter_aspath_range", NULL 242 | }; 243 | #endif 244 | 245 | static const short yyr1[] = { 0, 246 | 68, 68, 69, 69, 70, 70, 71, 71, 71, 72, 247 | 72, 73, 73, 74, 75, 75, 76, 76, 77, 77, 248 | 78, 78, 79, 79, 79, 80, 80, 81, 81, 82, 249 | 82, 83, 83, 84, 84, 85, 85, 85, 86, 86, 250 | 87, 87, 87, 88, 88, 89, 89, 90, 90, 90, 251 | 90, 90, 90, 90, 91, 92, 92, 93, 94, 95, 252 | 95, 96, 96, 96, 96, 96, 96, 96, 97, 98, 253 | 98, 99, 99, 99, 99, 99, 100, 100, 101, 102, 254 | 102, 102, 103, 103, 104, 104, 104, 105, 105, 105, 255 | 105, 105, 106, 106, 107, 107, 107, 107, 107, 108, 256 | 108, 109, 109, 110, 110, 111, 111, 112, 112, 113, 257 | 113, 113, 113, 113, 114, 114, 114, 114, 115, 115, 258 | 115, 115, 115, 115, 116, 116, 116, 116, 116, 116 259 | }; 260 | 261 | static const short yyr2[] = { 0, 262 | 3, 3, 0, 2, 0, 2, 1, 3, 3, 2, 263 | 3, 2, 3, 3, 3, 4, 3, 1, 0, 2, 264 | 3, 1, 3, 3, 1, 3, 1, 1, 1, 0, 265 | 1, 0, 2, 3, 1, 3, 3, 1, 3, 1, 266 | 1, 1, 1, 1, 3, 2, 3, 1, 1, 1, 267 | 1, 1, 1, 1, 3, 3, 3, 3, 6, 1, 268 | 3, 3, 3, 6, 6, 6, 4, 3, 3, 1, 269 | 3, 1, 1, 1, 1, 1, 3, 3, 3, 3, 270 | 2, 1, 3, 1, 2, 3, 1, 1, 3, 1, 271 | 1, 1, 2, 1, 1, 1, 1, 1, 3, 0, 272 | 1, 1, 3, 1, 1, 3, 1, 2, 1, 2, 273 | 2, 2, 2, 1, 1, 1, 3, 1, 1, 1, 274 | 1, 1, 3, 4, 0, 2, 2, 2, 4, 2 275 | }; 276 | 277 | static const short yydefact[] = { 3, 278 | 0, 5, 4, 0, 0, 6, 0, 0, 1, 7, 279 | 2, 0, 28, 29, 18, 0, 19, 30, 22, 25, 280 | 27, 0, 0, 0, 0, 10, 0, 0, 0, 0, 281 | 15, 0, 41, 44, 43, 0, 32, 31, 35, 38, 282 | 40, 42, 0, 0, 11, 0, 12, 9, 0, 8, 283 | 0, 88, 96, 91, 95, 98, 97, 0, 0, 0, 284 | 0, 0, 0, 0, 100, 0, 0, 90, 48, 49, 285 | 50, 51, 52, 53, 54, 14, 82, 84, 87, 92, 286 | 94, 19, 26, 20, 0, 21, 0, 0, 17, 0, 287 | 0, 0, 0, 23, 24, 13, 85, 0, 0, 0, 288 | 0, 0, 0, 0, 0, 0, 0, 0, 104, 105, 289 | 0, 101, 102, 0, 120, 119, 121, 0, 122, 115, 290 | 116, 125, 0, 107, 109, 114, 118, 0, 81, 0, 291 | 93, 16, 0, 46, 39, 33, 34, 36, 37, 45, 292 | 55, 57, 56, 58, 0, 0, 62, 63, 68, 76, 293 | 72, 73, 74, 75, 0, 70, 0, 0, 0, 77, 294 | 78, 79, 99, 0, 86, 0, 125, 0, 89, 0, 295 | 108, 113, 110, 111, 112, 80, 83, 47, 0, 0, 296 | 67, 0, 0, 0, 0, 103, 117, 0, 127, 126, 297 | 130, 128, 123, 106, 60, 0, 69, 71, 0, 0, 298 | 0, 124, 0, 59, 0, 64, 65, 66, 129, 61, 299 | 0, 0, 0 300 | }; 301 | 302 | static const short yydefgoto[] = { 211, 303 | 2, 5, 9, 10, 22, 49, 12, 17, 31, 18, 304 | 19, 20, 21, 37, 89, 38, 39, 40, 41, 42, 305 | 84, 68, 69, 70, 71, 72, 196, 73, 147, 155, 306 | 156, 74, 75, 76, 77, 78, 79, 80, 81, 111, 307 | 112, 113, 123, 124, 125, 126, 127, 168 308 | }; 309 | 310 | static const short yypact[] = { -26, 311 | -1, 7,-32768, 30, 86,-32768, -2, 74,-32768, 2, 312 | 78, -16,-32768,-32768,-32768, 85, 132, 66, 26,-32768, 313 | -32768, -7, 89, 86, 86,-32768, 116, -2, 6, 133, 314 | -32768, 85,-32768,-32768,-32768, 83, 126, 173, 87,-32768, 315 | -32768, 127, 85, 85,-32768, 138,-32768,-32768, 78,-32768, 316 | 116,-32768,-32768,-32768,-32768,-32768,-32768, 180, 182, 183, 317 | 136, 20, 185, 186, 96, 116, 52,-32768,-32768,-32768, 318 | -32768,-32768,-32768,-32768,-32768, 67, 190,-32768,-32768,-32768, 319 | 189, 132,-32768, 133, 147, 26, 22, 83,-32768, 83, 320 | 83, 83, 176,-32768,-32768,-32768,-32768, 149, 51, 150, 321 | 165, 151, 151, 151, 108, 115, 91, 152,-32768,-32768, 322 | 153, 148,-32768, 8,-32768,-32768,-32768, 52,-32768,-32768, 323 | -32768, 140, 120, 52, 28,-32768,-32768, 116, 190, 116, 324 | -32768,-32768, 156,-32768,-32768, 173, 87,-32768,-32768,-32768, 325 | -32768,-32768,-32768,-32768, 154, 108,-32768,-32768,-32768,-32768, 326 | -32768,-32768,-32768,-32768, 79,-32768, 155, 157, 158,-32768, 327 | -32768,-32768,-32768, 96,-32768, -10,-32768, -9,-32768, 52, 328 | 28,-32768,-32768,-32768,-32768, 190,-32768,-32768, 195, 56, 329 | -32768, 108, 108, 108, 108,-32768,-32768, -8,-32768, 145, 330 | -32768,-32768,-32768, 52,-32768, 100,-32768,-32768, 112, 118, 331 | 121,-32768, 199,-32768, 200,-32768,-32768,-32768,-32768,-32768, 332 | 215, 216,-32768 333 | }; 334 | 335 | static const short yypgoto[] = {-32768, 336 | -32768,-32768, 146,-32768,-32768, 101,-32768, 191, 135, 202, 337 | 188, 137,-32768,-32768,-32768, -21, 131, 92,-32768,-32768, 338 | -32768, -20,-32768,-32768,-32768,-32768,-32768,-32768, 82, -130, 339 | 40,-32768,-32768, 159, -72, -51,-32768,-32768,-32768,-32768, 340 | -32768, 59, 106, 57, -123,-32768,-32768, 61 341 | }; 342 | 343 | 344 | #define YYLAST 228 345 | 346 | 347 | static const short yytable[] = { 97, 348 | 171, 189, 189, 129, 190, 190, 191, 191, 32, 85, 349 | 128, 13, 51, 14, 87, 180, 1, 52, 53, 15, 350 | 54, 55, 56, 57, 90, 24, 102, 103, 104, 43, 351 | 27, 28, 58, 59, 60, 61, 62, 63, 64, 172, 352 | 7, 129, 3, 187, 45, 192, 192, 25, 170, 44, 353 | 16, 4, 199, 200, 201, 176, 193, 202, 65, 83, 354 | 66, 165, 115, 133, 67, 116, 136, 117, 32, 128, 355 | 171, 51, 105, 6, 106, 135, 52, 53, 177, 54, 356 | 55, 56, 57, 142, 33, 34, 35, 173, 174, 175, 357 | 91, 58, 59, 60, 61, 62, 63, 64, 13, 143, 358 | 14, 33, 34, 35, 118, 11, 119, 197, 23, 160, 359 | 92, 182, 109, 110, 120, 121, 122, 65, 36, 66, 360 | 51, 7, 46, 67, 161, 52, 53, 26, 54, 55, 361 | 56, 57, 181, 7, 182, 36, 8, 16, 47, 150, 362 | 58, 59, 60, 61, 62, 63, 64, 151, 152, 153, 363 | 157, 158, 159, 204, 30, 205, 154, 58, 59, 60, 364 | 61, 62, 63, 64, 88, 206, 65, 182, 66, 48, 365 | 50, 207, 67, 182, 208, 90, 182, 169, 170, 94, 366 | 95, 93, 138, 139, 148, 149, 98, 96, 99, 100, 367 | 101, 107, 108, 130, 131, 140, 134, 141, 144, 145, 368 | 162, 146, 167, 164, 163, 178, 179, 183, 195, 184, 369 | 185, 203, 209, 210, 212, 213, 132, 29, 82, 86, 370 | 137, 198, 186, 166, 114, 0, 194, 188 371 | }; 372 | 373 | static const short yycheck[] = { 51, 374 | 124, 11, 11, 76, 14, 14, 16, 16, 3, 30, 375 | 3, 14, 5, 16, 36, 146, 43, 10, 11, 22, 376 | 13, 14, 15, 16, 3, 24, 7, 8, 9, 4, 377 | 47, 48, 25, 26, 27, 28, 29, 30, 31, 12, 378 | 48, 114, 44, 54, 52, 55, 55, 46, 59, 24, 379 | 53, 45, 183, 184, 185, 128, 66, 66, 51, 54, 380 | 53, 54, 11, 84, 57, 14, 88, 16, 3, 3, 381 | 194, 5, 53, 44, 55, 54, 10, 11, 130, 13, 382 | 14, 15, 16, 33, 19, 20, 21, 60, 61, 62, 383 | 4, 25, 26, 27, 28, 29, 30, 31, 14, 49, 384 | 16, 19, 20, 21, 53, 5, 55, 52, 8, 19, 385 | 24, 56, 17, 18, 63, 64, 65, 51, 53, 53, 386 | 5, 48, 22, 57, 34, 10, 11, 50, 13, 14, 387 | 15, 16, 54, 48, 56, 53, 51, 53, 50, 32, 388 | 25, 26, 27, 28, 29, 30, 31, 40, 41, 42, 389 | 36, 37, 38, 54, 23, 56, 49, 25, 26, 27, 390 | 28, 29, 30, 31, 39, 54, 51, 56, 53, 24, 391 | 25, 54, 57, 56, 54, 3, 56, 58, 59, 43, 392 | 44, 55, 91, 92, 103, 104, 7, 50, 7, 7, 393 | 55, 7, 7, 4, 6, 20, 50, 49, 49, 35, 394 | 49, 51, 63, 56, 52, 50, 53, 53, 14, 53, 395 | 53, 67, 14, 14, 0, 0, 82, 16, 28, 32, 396 | 90, 182, 164, 118, 66, -1, 170, 167 397 | }; 398 | /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ 399 | #line 3 "/usr/local/share/bison.simple" 400 | /* This file comes from bison-1.28. */ 401 | 402 | /* Skeleton output parser for bison, 403 | Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. 404 | 405 | This program is free software; you can redistribute it and/or modify 406 | it under the terms of the GNU General Public License as published by 407 | the Free Software Foundation; either version 2, or (at your option) 408 | any later version. 409 | 410 | This program is distributed in the hope that it will be useful, 411 | but WITHOUT ANY WARRANTY; without even the implied warranty of 412 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 413 | GNU General Public License for more details. 414 | 415 | You should have received a copy of the GNU General Public License 416 | along with this program; if not, write to the Free Software 417 | Foundation, Inc., 59 Temple Place - Suite 330, 418 | Boston, MA 02111-1307, USA. */ 419 | 420 | /* As a special exception, when this file is copied by Bison into a 421 | Bison output file, you may use that output file without restriction. 422 | This special exception was added by the Free Software Foundation 423 | in version 1.24 of Bison. */ 424 | 425 | /* This is the parser code that is written into each bison parser 426 | when the %semantic_parser declaration is not specified in the grammar. 427 | It was written by Richard Stallman by simplifying the hairy parser 428 | used when %semantic_parser is specified. */ 429 | 430 | #ifndef YYSTACK_USE_ALLOCA 431 | #ifdef alloca 432 | #define YYSTACK_USE_ALLOCA 433 | #else /* alloca not defined */ 434 | #ifdef __GNUC__ 435 | #define YYSTACK_USE_ALLOCA 436 | #define alloca __builtin_alloca 437 | #else /* not GNU C. */ 438 | #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) 439 | #define YYSTACK_USE_ALLOCA 440 | #include <alloca.h> 441 | #else /* not sparc */ 442 | /* We think this test detects Watcom and Microsoft C. */ 443 | /* This used to test MSDOS, but that is a bad idea 444 | since that symbol is in the user namespace. */ 445 | #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) 446 | #if 0 /* No need for malloc.h, which pollutes the namespace; 447 | instead, just don't use alloca. */ 448 | #include <malloc.h> 449 | #endif 450 | #else /* not MSDOS, or __TURBOC__ */ 451 | #if defined(_AIX) 452 | /* I don't know what this was needed for, but it pollutes the namespace. 453 | So I turned it off. rms, 2 May 1997. */ 454 | /* #include <malloc.h> */ 455 | #pragma alloca 456 | #define YYSTACK_USE_ALLOCA 457 | #else /* not MSDOS, or __TURBOC__, or _AIX */ 458 | #if 0 459 | #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, 460 | and on HPUX 10. Eventually we can turn this on. */ 461 | #define YYSTACK_USE_ALLOCA 462 | #define alloca __builtin_alloca 463 | #endif /* __hpux */ 464 | #endif 465 | #endif /* not _AIX */ 466 | #endif /* not MSDOS, or __TURBOC__ */ 467 | #endif /* not sparc */ 468 | #endif /* not GNU C */ 469 | #endif /* alloca not defined */ 470 | #endif /* YYSTACK_USE_ALLOCA not defined */ 471 | 472 | #ifdef YYSTACK_USE_ALLOCA 473 | #define YYSTACK_ALLOC alloca 474 | #else 475 | #define YYSTACK_ALLOC malloc 476 | #endif 477 | 478 | /* Note: there must be only one dollar sign in this file. 479 | It is replaced by the list of actions, each action 480 | as one case of the switch. */ 481 | 482 | #define yyerrok (yyerrstatus = 0) 483 | #define yyclearin (yychar = YYEMPTY) 484 | #define YYEMPTY -2 485 | #define YYEOF 0 486 | #define YYACCEPT goto yyacceptlab 487 | #define YYABORT goto yyabortlab 488 | #define YYERROR goto yyerrlab1 489 | /* Like YYERROR except do call yyerror. 490 | This remains here temporarily to ease the 491 | transition to the new meaning of YYERROR, for GCC. 492 | Once GCC version 2 has supplanted version 1, this can go. */ 493 | #define YYFAIL goto yyerrlab 494 | #define YYRECOVERING() (!!yyerrstatus) 495 | #define YYBACKUP(token, value) \ 496 | do \ 497 | if (yychar == YYEMPTY && yylen == 1) \ 498 | { yychar = (token), yylval = (value); \ 499 | yychar1 = YYTRANSLATE (yychar); \ 500 | YYPOPSTACK; \ 501 | goto yybackup; \ 502 | } \ 503 | else \ 504 | { yyerror ("syntax error: cannot back up"); YYERROR; } \ 505 | while (0) 506 | 507 | #define YYTERROR 1 508 | #define YYERRCODE 256 509 | 510 | #ifndef YYPURE 511 | #define YYLEX yylex() 512 | #endif 513 | 514 | #ifdef YYPURE 515 | #ifdef YYLSP_NEEDED 516 | #ifdef YYLEX_PARAM 517 | #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) 518 | #else 519 | #define YYLEX yylex(&yylval, &yylloc) 520 | #endif 521 | #else /* not YYLSP_NEEDED */ 522 | #ifdef YYLEX_PARAM 523 | #define YYLEX yylex(&yylval, YYLEX_PARAM) 524 | #else 525 | #define YYLEX yylex(&yylval) 526 | #endif 527 | #endif /* not YYLSP_NEEDED */ 528 | #endif 529 | 530 | /* If nonreentrant, generate the variables here */ 531 | 532 | #ifndef YYPURE 533 | 534 | int yychar; /* the lookahead symbol */ 535 | YYSTYPE yylval; /* the semantic value of the */ 536 | /* lookahead symbol */ 537 | 538 | #ifdef YYLSP_NEEDED 539 | YYLTYPE yylloc; /* location data for the lookahead */ 540 | /* symbol */ 541 | #endif 542 | 543 | int yynerrs; /* number of parse errors so far */ 544 | #endif /* not YYPURE */ 545 | 546 | #if YYDEBUG != 0 547 | int yydebug; /* nonzero means print parse trace */ 548 | /* Since this is uninitialized, it does not stop multiple parsers 549 | from coexisting. */ 550 | #endif 551 | 552 | /* YYINITDEPTH indicates the initial size of the parser's stacks */ 553 | 554 | #ifndef YYINITDEPTH 555 | #define YYINITDEPTH 200 556 | #endif 557 | 558 | /* YYMAXDEPTH is the maximum size the stacks can grow to 559 | (effective only if the built-in stack extension method is used). */ 560 | 561 | #if YYMAXDEPTH == 0 562 | #undef YYMAXDEPTH 563 | #endif 564 | 565 | #ifndef YYMAXDEPTH 566 | #define YYMAXDEPTH 10000 567 | #endif 568 | 569 | /* Define __yy_memcpy. Note that the size argument 570 | should be passed with type unsigned int, because that is what the non-GCC 571 | definitions require. With GCC, __builtin_memcpy takes an arg 572 | of type size_t, but it can handle unsigned int. */ 573 | 574 | #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ 575 | #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) 576 | #else /* not GNU C or C++ */ 577 | #ifndef __cplusplus 578 | 579 | /* This is the most reliable way to avoid incompatibilities 580 | in available built-in functions on various systems. */ 581 | static void 582 | __yy_memcpy (to, from, count) 583 | char *to; 584 | char *from; 585 | unsigned int count; 586 | { 587 | register char *f = from; 588 | register char *t = to; 589 | register int i = count; 590 | 591 | while (i-- > 0) 592 | *t++ = *f++; 593 | } 594 | 595 | #else /* __cplusplus */ 596 | 597 | /* This is the most reliable way to avoid incompatibilities 598 | in available built-in functions on various systems. */ 599 | static void 600 | __yy_memcpy (char *to, char *from, unsigned int count) 601 | { 602 | register char *t = to; 603 | register char *f = from; 604 | register int i = count; 605 | 606 | while (i-- > 0) 607 | *t++ = *f++; 608 | } 609 | 610 | #endif 611 | #endif 612 | 613 | #line 217 "/usr/local/share/bison.simple" 614 | 615 | /* The user can define YYPARSE_PARAM as the name of an argument to be passed 616 | into yyparse. The argument should have type void *. 617 | It should actually point to an object. 618 | Grammar actions can access the variable by casting it 619 | to the proper pointer type. */ 620 | 621 | #ifdef YYPARSE_PARAM 622 | #ifdef __cplusplus 623 | #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM 624 | #define YYPARSE_PARAM_DECL 625 | #else /* not __cplusplus */ 626 | #define YYPARSE_PARAM_ARG YYPARSE_PARAM 627 | #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; 628 | #endif /* not __cplusplus */ 629 | #else /* not YYPARSE_PARAM */ 630 | #define YYPARSE_PARAM_ARG 631 | #define YYPARSE_PARAM_DECL 632 | #endif /* not YYPARSE_PARAM */ 633 | 634 | /* Prevent warning if -Wstrict-prototypes. */ 635 | #ifdef __GNUC__ 636 | #ifdef YYPARSE_PARAM 637 | int yyparse (void *); 638 | #else 639 | int yyparse (void); 640 | #endif 641 | #endif 642 | 643 | int 644 | yyparse(YYPARSE_PARAM_ARG) 645 | YYPARSE_PARAM_DECL 646 | { 647 | register int yystate; 648 | register int yyn; 649 | register short *yyssp; 650 | register YYSTYPE *yyvsp; 651 | int yyerrstatus; /* number of tokens to shift before error messages enabled */ 652 | int yychar1 = 0; /* lookahead token as an internal (translated) token number */ 653 | 654 | short yyssa[YYINITDEPTH]; /* the state stack */ 655 | YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ 656 | 657 | short *yyss = yyssa; /* refer to the stacks thru separate pointers */ 658 | YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ 659 | 660 | #ifdef YYLSP_NEEDED 661 | YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ 662 | YYLTYPE *yyls = yylsa; 663 | YYLTYPE *yylsp; 664 | 665 | #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) 666 | #else 667 | #define YYPOPSTACK (yyvsp--, yyssp--) 668 | #endif 669 | 670 | int yystacksize = YYINITDEPTH; 671 | int yyfree_stacks = 0; 672 | 673 | #ifdef YYPURE 674 | int yychar; 675 | YYSTYPE yylval; 676 | int yynerrs; 677 | #ifdef YYLSP_NEEDED 678 | YYLTYPE yylloc; 679 | #endif 680 | #endif 681 | 682 | YYSTYPE yyval; /* the variable used to return */ 683 | /* semantic values from the action */ 684 | /* routines */ 685 | 686 | int yylen; 687 | 688 | #if YYDEBUG != 0 689 | if (yydebug) 690 | fprintf(stderr, "Starting parse\n"); 691 | #endif 692 | 693 | yystate = 0; 694 | yyerrstatus = 0; 695 | yynerrs = 0; 696 | yychar = YYEMPTY; /* Cause a token to be read. */ 697 | 698 | /* Initialize stack pointers. 699 | Waste one element of value and location stack 700 | so that they stay on the same level as the state stack. 701 | The wasted elements are never initialized. */ 702 | 703 | yyssp = yyss - 1; 704 | yyvsp = yyvs; 705 | #ifdef YYLSP_NEEDED 706 | yylsp = yyls; 707 | #endif 708 | 709 | /* Push a new state, which is found in yystate . */ 710 | /* In all cases, when you get here, the value and location stacks 711 | have just been pushed. so pushing a state here evens the stacks. */ 712 | yynewstate: 713 | 714 | *++yyssp = yystate; 715 | 716 | if (yyssp >= yyss + yystacksize - 1) 717 | { 718 | /* Give user a chance to reallocate the stack */ 719 | /* Use copies of these so that the &'s don't force the real ones into memory. */ 720 | YYSTYPE *yyvs1 = yyvs; 721 | short *yyss1 = yyss; 722 | #ifdef YYLSP_NEEDED 723 | YYLTYPE *yyls1 = yyls; 724 | #endif 725 | 726 | /* Get the current used size of the three stacks, in elements. */ 727 | int size = yyssp - yyss + 1; 728 | 729 | #ifdef yyoverflow 730 | /* Each stack pointer address is followed by the size of 731 | the data in use in that stack, in bytes. */ 732 | #ifdef YYLSP_NEEDED 733 | /* This used to be a conditional around just the two extra args, 734 | but that might be undefined if yyoverflow is a macro. */ 735 | yyoverflow("parser stack overflow", 736 | &yyss1, size * sizeof (*yyssp), 737 | &yyvs1, size * sizeof (*yyvsp), 738 | &yyls1, size * sizeof (*yylsp), 739 | &yystacksize); 740 | #else 741 | yyoverflow("parser stack overflow", 742 | &yyss1, size * sizeof (*yyssp), 743 | &yyvs1, size * sizeof (*yyvsp), 744 | &yystacksize); 745 | #endif 746 | 747 | yyss = yyss1; yyvs = yyvs1; 748 | #ifdef YYLSP_NEEDED 749 | yyls = yyls1; 750 | #endif 751 | #else /* no yyoverflow */ 752 | /* Extend the stack our own way. */ 753 | if (yystacksize >= YYMAXDEPTH) 754 | { 755 | yyerror("parser stack overflow"); 756 | if (yyfree_stacks) 757 | { 758 | free (yyss); 759 | free (yyvs); 760 | #ifdef YYLSP_NEEDED 761 | free (yyls); 762 | #endif 763 | } 764 | return 2; 765 | } 766 | yystacksize *= 2; 767 | if (yystacksize > YYMAXDEPTH) 768 | yystacksize = YYMAXDEPTH; 769 | #ifndef YYSTACK_USE_ALLOCA 770 | yyfree_stacks = 1; 771 | #endif 772 | yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); 773 | __yy_memcpy ((char *)yyss, (char *)yyss1, 774 | size * (unsigned int) sizeof (*yyssp)); 775 | yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); 776 | __yy_memcpy ((char *)yyvs, (char *)yyvs1, 777 | size * (unsigned int) sizeof (*yyvsp)); 778 | #ifdef YYLSP_NEEDED 779 | yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); 780 | __yy_memcpy ((char *)yyls, (char *)yyls1, 781 | size * (unsigned int) sizeof (*yylsp)); 782 | #endif 783 | #endif /* no yyoverflow */ 784 | 785 | yyssp = yyss + size - 1; 786 | yyvsp = yyvs + size - 1; 787 | #ifdef YYLSP_NEEDED 788 | yylsp = yyls + size - 1; 789 | #endif 790 | 791 | #if YYDEBUG != 0 792 | if (yydebug) 793 | fprintf(stderr, "Stack size increased to %d\n", yystacksize); 794 | #endif 795 | 796 | if (yyssp >= yyss + yystacksize - 1) 797 | YYABORT; 798 | } 799 | 800 | #if YYDEBUG != 0 801 | if (yydebug) 802 | fprintf(stderr, "Entering state %d\n", yystate); 803 | #endif 804 | 805 | goto yybackup; 806 | yybackup: 807 | 808 | /* Do appropriate processing given the current state. */ 809 | /* Read a lookahead token if we need one and don't already have one. */ 810 | /* yyresume: */ 811 | 812 | /* First try to decide what to do without reference to lookahead token. */ 813 | 814 | yyn = yypact[yystate]; 815 | if (yyn == YYFLAG) 816 | goto yydefault; 817 | 818 | /* Not known => get a lookahead token if don't already have one. */ 819 | 820 | /* yychar is either YYEMPTY or YYEOF 821 | or a valid token in external form. */ 822 | 823 | if (yychar == YYEMPTY) 824 | { 825 | #if YYDEBUG != 0 826 | if (yydebug) 827 | fprintf(stderr, "Reading a token: "); 828 | #endif 829 | yychar = YYLEX; 830 | } 831 | 832 | /* Convert token to internal form (in yychar1) for indexing tables with */ 833 | 834 | if (yychar <= 0) /* This means end of input. */ 835 | { 836 | yychar1 = 0; 837 | yychar = YYEOF; /* Don't call YYLEX any more */ 838 | 839 | #if YYDEBUG != 0 840 | if (yydebug) 841 | fprintf(stderr, "Now at end of input.\n"); 842 | #endif 843 | } 844 | else 845 | { 846 | yychar1 = YYTRANSLATE(yychar); 847 | 848 | #if YYDEBUG != 0 849 | if (yydebug) 850 | { 851 | fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); 852 | /* Give the individual parser a way to print the precise meaning 853 | of a token, for further debugging info. */ 854 | #ifdef YYPRINT 855 | YYPRINT (stderr, yychar, yylval); 856 | #endif 857 | fprintf (stderr, ")\n"); 858 | } 859 | #endif 860 | } 861 | 862 | yyn += yychar1; 863 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) 864 | goto yydefault; 865 | 866 | yyn = yytable[yyn]; 867 | 868 | /* yyn is what to do for this token type in this state. 869 | Negative => reduce, -yyn is rule number. 870 | Positive => shift, yyn is new state. 871 | New state is final state => don't bother to shift, 872 | just return success. 873 | 0, or most negative number => error. */ 874 | 875 | if (yyn < 0) 876 | { 877 | if (yyn == YYFLAG) 878 | goto yyerrlab; 879 | yyn = -yyn; 880 | goto yyreduce; 881 | } 882 | else if (yyn == 0) 883 | goto yyerrlab; 884 | 885 | if (yyn == YYFINAL) 886 | YYACCEPT; 887 | 888 | /* Shift the lookahead token. */ 889 | 890 | #if YYDEBUG != 0 891 | if (yydebug) 892 | fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); 893 | #endif 894 | 895 | /* Discard the token being shifted unless it is eof. */ 896 | if (yychar != YYEOF) 897 | yychar = YYEMPTY; 898 | 899 | *++yyvsp = yylval; 900 | #ifdef YYLSP_NEEDED 901 | *++yylsp = yylloc; 902 | #endif 903 | 904 | /* count tokens shifted since error; after three, turn off error status. */ 905 | if (yyerrstatus) yyerrstatus--; 906 | 907 | yystate = yyn; 908 | goto yynewstate; 909 | 910 | /* Do the default action for the current state. */ 911 | yydefault: 912 | 913 | yyn = yydefact[yystate]; 914 | if (yyn == 0) 915 | goto yyerrlab; 916 | 917 | /* Do a reduction. yyn is the number of a rule to reduce with. */ 918 | yyreduce: 919 | yylen = yyr2[yyn]; 920 | if (yylen > 0) 921 | yyval = yyvsp[1-yylen]; /* implement default value of the action */ 922 | 923 | #if YYDEBUG != 0 924 | if (yydebug) 925 | { 926 | int i; 927 | 928 | fprintf (stderr, "Reducing via rule %d (line %d), ", 929 | yyn, yyrline[yyn]); 930 | 931 | /* Print the symbols being reduced, and their result. */ 932 | for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) 933 | fprintf (stderr, "%s ", yytname[yyrhs[i]]); 934 | fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); 935 | } 936 | #endif 937 | 938 | 939 | switch (yyn) { 940 | 941 | case 42: 942 | #line 127 "import.y" 943 | { 944 | if (strlen(yyvsp[0].sval) > 255) { 945 | syntax_error("Domain name \"%s\" is longer than 255 characters", yyvsp[0].sval); 946 | } 947 | ; 948 | break;} 949 | case 55: 950 | #line 152 "import.y" 951 | { 952 | long int val; 953 | char *s, *p; 954 | p = yyvsp[0].sval; 955 | val = strtol(p, &s, 10); 956 | if ((val < 0) || (val > 65535)) { 957 | syntax_error("pref value \"%s\" is not between 0 and 65535", p); 958 | } 959 | ; 960 | break;} 961 | case 56: 962 | #line 163 "import.y" 963 | { 964 | long int val; 965 | char *s, *p; 966 | p = yyvsp[0].sval; 967 | val = strtol(p, &s, 10); 968 | if ((val < 0) || (val > 65535)) { 969 | syntax_error("med value \"%s\" is not between 0 and 65535", p); 970 | } 971 | ; 972 | break;} 973 | case 58: 974 | #line 175 "import.y" 975 | { 976 | long int val; 977 | char *s, *p; 978 | p = yyvsp[0].sval; 979 | val = strtol(p, &s, 10); 980 | if ((val < 0) || (val > 65535)) { 981 | syntax_error("dpa value \"%s\" is not between 0 and 65535", p); 982 | } 983 | ; 984 | break;} 985 | case 75: 986 | #line 212 "import.y" 987 | { 988 | unsigned long int val; 989 | char *s, *p; 990 | p = yyvsp[0].sval; 991 | val = strtoul(p, &s, 10); 992 | if ((val < 1) || (val > 4294967295UL) || (*s != '\0')) { 993 | syntax_error("community element \"%s\" is not between 1 and 4294967295", 994 | p); 995 | } 996 | ; 997 | break;} 998 | case 79: 999 | #line 229 "import.y" 1000 | { 1001 | long int val; 1002 | char *s, *p; 1003 | p = yyvsp[0].sval; 1004 | val = strtol(p, &s, 10); 1005 | if ((val < 0) || (val > 65535)) { 1006 | syntax_error("cost value \"%s\" is not between 0 and 65535", p); 1007 | } 1008 | ; 1009 | break;} 1010 | } 1011 | /* the action file gets copied in in place of this dollarsign */ 1012 | #line 543 "/usr/local/share/bison.simple" 1013 | 1014 | yyvsp -= yylen; 1015 | yyssp -= yylen; 1016 | #ifdef YYLSP_NEEDED 1017 | yylsp -= yylen; 1018 | #endif 1019 | 1020 | #if YYDEBUG != 0 1021 | if (yydebug) 1022 | { 1023 | short *ssp1 = yyss - 1; 1024 | fprintf (stderr, "state stack now"); 1025 | while (ssp1 != yyssp) 1026 | fprintf (stderr, " %d", *++ssp1); 1027 | fprintf (stderr, "\n"); 1028 | } 1029 | #endif 1030 | 1031 | *++yyvsp = yyval; 1032 | 1033 | #ifdef YYLSP_NEEDED 1034 | yylsp++; 1035 | if (yylen == 0) 1036 | { 1037 | yylsp->first_line = yylloc.first_line; 1038 | yylsp->first_column = yylloc.first_column; 1039 | yylsp->last_line = (yylsp-1)->last_line; 1040 | yylsp->last_column = (yylsp-1)->last_column; 1041 | yylsp->text = 0; 1042 | } 1043 | else 1044 | { 1045 | yylsp->last_line = (yylsp+yylen-1)->last_line; 1046 | yylsp->last_column = (yylsp+yylen-1)->last_column; 1047 | } 1048 | #endif 1049 | 1050 | /* Now "shift" the result of the reduction. 1051 | Determine what state that goes to, 1052 | based on the state we popped back to 1053 | and the rule number reduced by. */ 1054 | 1055 | yyn = yyr1[yyn]; 1056 | 1057 | yystate = yypgoto[yyn - YYNTBASE] + *yyssp; 1058 | if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) 1059 | yystate = yytable[yystate]; 1060 | else 1061 | yystate = yydefgoto[yyn - YYNTBASE]; 1062 | 1063 | goto yynewstate; 1064 | 1065 | yyerrlab: /* here on detecting error */ 1066 | 1067 | if (! yyerrstatus) 1068 | /* If not already recovering from an error, report this error. */ 1069 | { 1070 | ++yynerrs; 1071 | 1072 | #ifdef YYERROR_VERBOSE 1073 | yyn = yypact[yystate]; 1074 | 1075 | if (yyn > YYFLAG && yyn < YYLAST) 1076 | { 1077 | int size = 0; 1078 | char *msg; 1079 | int x, count; 1080 | 1081 | count = 0; 1082 | /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ 1083 | for (x = (yyn < 0 ? -yyn : 0); 1084 | x < (sizeof(yytname) / sizeof(char *)); x++) 1085 | if (yycheck[x + yyn] == x) 1086 | size += strlen(yytname[x]) + 15, count++; 1087 | msg = (char *) malloc(size + 15); 1088 | if (msg != 0) 1089 | { 1090 | strcpy(msg, "parse error"); 1091 | 1092 | if (count < 5) 1093 | { 1094 | count = 0; 1095 | for (x = (yyn < 0 ? -yyn : 0); 1096 | x < (sizeof(yytname) / sizeof(char *)); x++) 1097 | if (yycheck[x + yyn] == x) 1098 | { 1099 | strcat(msg, count == 0 ? ", expecting `" : " or `"); 1100 | strcat(msg, yytname[x]); 1101 | strcat(msg, "'"); 1102 | count++; 1103 | } 1104 | } 1105 | yyerror(msg); 1106 | free(msg); 1107 | } 1108 | else 1109 | yyerror ("parse error; also virtual memory exceeded"); 1110 | } 1111 | else 1112 | #endif /* YYERROR_VERBOSE */ 1113 | yyerror("parse error"); 1114 | } 1115 | 1116 | goto yyerrlab1; 1117 | yyerrlab1: /* here on error raised explicitly by an action */ 1118 | 1119 | if (yyerrstatus == 3) 1120 | { 1121 | /* if just tried and failed to reuse lookahead token after an error, discard it. */ 1122 | 1123 | /* return failure if at end of input */ 1124 | if (yychar == YYEOF) 1125 | YYABORT; 1126 | 1127 | #if YYDEBUG != 0 1128 | if (yydebug) 1129 | fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); 1130 | #endif 1131 | 1132 | yychar = YYEMPTY; 1133 | } 1134 | 1135 | /* Else will try to reuse lookahead token 1136 | after shifting the error token. */ 1137 | 1138 | yyerrstatus = 3; /* Each real token shifted decrements this */ 1139 | 1140 | goto yyerrhandle; 1141 | 1142 | yyerrdefault: /* current state does not do anything special for the error token. */ 1143 | 1144 | #if 0 1145 | /* This is wrong; only states that explicitly want error tokens 1146 | should shift them. */ 1147 | yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ 1148 | if (yyn) goto yydefault; 1149 | #endif 1150 | 1151 | yyerrpop: /* pop the current state because it cannot handle the error token */ 1152 | 1153 | if (yyssp == yyss) YYABORT; 1154 | yyvsp--; 1155 | yystate = *--yyssp; 1156 | #ifdef YYLSP_NEEDED 1157 | yylsp--; 1158 | #endif 1159 | 1160 | #if YYDEBUG != 0 1161 | if (yydebug) 1162 | { 1163 | short *ssp1 = yyss - 1; 1164 | fprintf (stderr, "Error: state stack now"); 1165 | while (ssp1 != yyssp) 1166 | fprintf (stderr, " %d", *++ssp1); 1167 | fprintf (stderr, "\n"); 1168 | } 1169 | #endif 1170 | 1171 | yyerrhandle: 1172 | 1173 | yyn = yypact[yystate]; 1174 | if (yyn == YYFLAG) 1175 | goto yyerrdefault; 1176 | 1177 | yyn += YYTERROR; 1178 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) 1179 | goto yyerrdefault; 1180 | 1181 | yyn = yytable[yyn]; 1182 | if (yyn < 0) 1183 | { 1184 | if (yyn == YYFLAG) 1185 | goto yyerrpop; 1186 | yyn = -yyn; 1187 | goto yyreduce; 1188 | } 1189 | else if (yyn == 0) 1190 | goto yyerrpop; 1191 | 1192 | if (yyn == YYFINAL) 1193 | YYACCEPT; 1194 | 1195 | #if YYDEBUG != 0 1196 | if (yydebug) 1197 | fprintf(stderr, "Shifting error token, "); 1198 | #endif 1199 | 1200 | *++yyvsp = yylval; 1201 | #ifdef YYLSP_NEEDED 1202 | *++yylsp = yylloc; 1203 | #endif 1204 | 1205 | yystate = yyn; 1206 | goto yynewstate; 1207 | 1208 | yyacceptlab: 1209 | /* YYACCEPT comes here. */ 1210 | if (yyfree_stacks) 1211 | { 1212 | free (yyss); 1213 | free (yyvs); 1214 | #ifdef YYLSP_NEEDED 1215 | free (yyls); 1216 | #endif 1217 | } 1218 | return 0; 1219 | 1220 | yyabortlab: 1221 | /* YYABORT comes here. */ 1222 | if (yyfree_stacks) 1223 | { 1224 | free (yyss); 1225 | free (yyvs); 1226 | #ifdef YYLSP_NEEDED 1227 | free (yyls); 1228 | #endif 1229 | } 1230 | return 1; 1231 | } 1232 | #line 321 "import.y" 1233 | 1234 | 1235 | #undef importerror 1236 | #undef yyerror 1237 | 1238 | int 1239 | importerror (const char *s) 1240 | { 1241 | yyerror(s); 1242 | return 0; 1243 | } 1244 |