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