| 1 | # @(#)yaccpar 1.8 (Berkeley) 01/20/91 (JAKE-P5BP-0.6 04/26/98) | ||
| 2 | package Parser; | ||
| 3 | #line 22 "./Parser.y" | ||
| 4 | package Carp::Datum::Parser; | ||
| 5 | |||
| 6 | use Carp::Datum::Flags; | ||
| 7 | |||
| 8 | BEGIN { | ||
| 9 | |||
| 10 | sub TRUE () {1}; | ||
| 11 | sub FALSE () {0}; | ||
| 12 | } | ||
| 13 | |||
| 14 | #line 14 "Parser.pm" | ||
| 15 | $FLAGS=257; | ||
| 16 | $DEFAULT=258; | ||
| 17 | $FILE=259; | ||
| 18 | $ROUTINE=260; | ||
| 19 | $USE=261; | ||
| 20 | $TYPE=262; | ||
| 21 | $ALIAS=263; | ||
| 22 | $STRING=264; | ||
| 23 | $T_WORD=265; | ||
| 24 | $T_NUM=266; | ||
| 25 | $FLOW=267; | ||
| 26 | $REQUIRE=268; | ||
| 27 | $ASSERT=269; | ||
| 28 | $ENSURE=270; | ||
| 29 | $RETURN=271; | ||
| 30 | $STACK=272; | ||
| 31 | $CLUSTER=273; | ||
| 32 | $PANIC=274; | ||
| 33 | $PROPAGATE=275; | ||
| 34 | $EXEC=276; | ||
| 35 | $TRACE=277; | ||
| 36 | $EMERGENCY=278; | ||
| 37 | $ALERT=279; | ||
| 38 | $CRITICAL=280; | ||
| 39 | $ERROR=281; | ||
| 40 | $AUTOMARK=282; | ||
| 41 | $INVARIANT=283; | ||
| 42 | $WARNING=284; | ||
| 43 | $NOTICE=285; | ||
| 44 | $INFO=286; | ||
| 45 | $DEBUG=287; | ||
| 46 | $TEST=288; | ||
| 47 | $DUMP=289; | ||
| 48 | $ALL=290; | ||
| 49 | $USR1=291; | ||
| 50 | $USR2=292; | ||
| 51 | $MEMORY=293; | ||
| 52 | $OBJECT=294; | ||
| 53 | $STATE=295; | ||
| 54 | $STARTUP=296; | ||
| 55 | $YES=297; | ||
| 56 | $NO=298; | ||
| 57 | $LEQ=299; | ||
| 58 | $GEQ=300; | ||
| 59 | $AS=301; | ||
| 60 | $ARGS=302; | ||
| 61 | $YYERRCODE=256; | ||
| 62 | @yylhs = ( -1, | ||
| 63 | 2, 0, 1, 1, 3, 3, 3, 3, 3, 3, | ||
| 64 | 3, 4, 5, 5, 6, 7, 8, 10, 9, 14, | ||
| 65 | 14, 14, 15, 15, 12, 12, 12, 16, 16, 16, | ||
| 66 | 16, 16, 18, 23, 23, 24, 24, 25, 25, 27, | ||
| 67 | 27, 27, 27, 26, 26, 26, 26, 26, 26, 26, | ||
| 68 | 26, 26, 19, 20, 29, 29, 21, 21, 30, 22, | ||
| 69 | 22, 28, 28, 28, 28, 28, 28, 28, 28, 17, | ||
| 70 | 17, 11, 13, 13, 31, | ||
| 71 | ); | ||
| 72 | @yylen = ( 2, | ||
| 73 | 0, 2, 0, 2, 1, 1, 1, 1, 1, 1, | ||
| 74 | 1, 5, 3, 4, 5, 5, 5, 5, 5, 0, | ||
| 75 | 1, 2, 2, 1, 0, 2, 3, 2, 1, 1, | ||
| 76 | 1, 1, 5, 0, 2, 1, 3, 1, 2, 1, | ||
| 77 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 78 | 1, 1, 4, 4, 1, 1, 1, 3, 4, 1, | ||
| 79 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 80 | 3, 1, 1, 3, 1, | ||
| 81 | ); | ||
| 82 | @yydefred = ( 1, | ||
| 83 | 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 84 | 4, 5, 6, 7, 8, 9, 10, 11, 72, 0, | ||
| 85 | 0, 0, 75, 0, 73, 0, 0, 0, 0, 0, | ||
| 86 | 0, 63, 65, 66, 67, 64, 69, 68, 0, 0, | ||
| 87 | 62, 0, 0, 0, 29, 30, 31, 32, 0, 0, | ||
| 88 | 13, 0, 0, 0, 0, 0, 0, 0, 70, 0, | ||
| 89 | 0, 0, 0, 14, 0, 26, 0, 0, 24, 0, | ||
| 90 | 21, 0, 74, 0, 0, 0, 0, 12, 0, 60, | ||
| 91 | 61, 0, 0, 56, 55, 0, 27, 0, 58, 16, | ||
| 92 | 22, 23, 18, 19, 15, 17, 71, 0, 59, 54, | ||
| 93 | 53, 0, 33, 45, 46, 47, 48, 49, 50, 51, | ||
| 94 | 52, 44, 40, 41, 42, 43, 0, 36, 38, 0, | ||
| 95 | 0, 39, 37, | ||
| 96 | ); | ||
| 97 | @yydgoto = ( 1, | ||
| 98 | 3, 2, 11, 12, 13, 14, 15, 16, 17, 69, | ||
| 99 | 20, 43, 24, 70, 71, 44, 60, 45, 46, 47, | ||
| 100 | 48, 82, 103, 117, 118, 119, 120, 49, 86, 50, | ||
| 101 | 25, | ||
| 102 | ); | ||
| 103 | @yysindex = ( 0, | ||
| 104 | 0, 0, -156, -249, -116, -238, -238, -238, -236, -238, | ||
| 105 | 0, 0, 0, 0, 0, 0, 0, 0, 0, -92, | ||
| 106 | -224, -24, 0, -41, 0, -40, -39, -262, -38, -224, | ||
| 107 | -249, 0, 0, 0, 0, 0, 0, 0, 1, 2, | ||
| 108 | 0, 9, -74, 3, 0, 0, 0, 0, 20, 5, | ||
| 109 | 0, -250, -238, -224, -250, -200, -224, -26, 0, 21, | ||
| 110 | -283, -283, -243, 0, 8, 0, -283, -196, 0, -124, | ||
| 111 | 0, 10, 0, -9, -100, 12, 17, 0, -249, 0, | ||
| 112 | 0, 31, 33, 0, 0, 34, 0, 36, 0, 0, | ||
| 113 | 0, 0, 0, 0, 0, 0, 0, 22, 0, 0, | ||
| 114 | 0, -60, 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 115 | 0, 0, 0, 0, 0, 0, 35, 0, 0, -166, | ||
| 116 | -60, 0, 0, | ||
| 117 | ); | ||
| 118 | @yyrindex = ( 0, | ||
| 119 | 0, 0, 81, 0, 0, 0, 0, 0, 0, 0, | ||
| 120 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 121 | -36, 0, 0, 0, 0, 0, 0, 0, 0, -36, | ||
| 122 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 123 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, | ||
| 124 | 0, -35, 0, -36, -35, 0, -36, 0, 0, 32, | ||
| 125 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 126 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 127 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 128 | 0, 0, 0, 0, 0, 0, 0, 37, 0, 0, | ||
| 129 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 130 | 0, 0, 0, 0, 0, 0, 38, 0, 0, 0, | ||
| 131 | 0, 0, 0, | ||
| 132 | ); | ||
| 133 | @yygindex = ( 0, | ||
| 134 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 91, | ||
| 135 | 7, -21, 49, 43, -62, 18, 0, 0, 0, 0, | ||
| 136 | 0, -33, 0, 0, -16, -20, 0, 0, 0, 0, | ||
| 137 | 55, | ||
| 138 | ); | ||
| 139 | $YYTABLESIZE=319; | ||
| 140 | @yytable = ( 116, | ||
| 141 | 90, 115, 53, 53, 53, 53, 21, 91, 58, 7, | ||
| 142 | 31, 22, 91, 80, 81, 19, 32, 33, 34, 35, | ||
| 143 | 36, 37, 84, 38, 94, 23, 39, 28, 83, 85, | ||
| 144 | 30, 40, 74, 88, 51, 77, 31, 59, 56, 41, | ||
| 145 | 61, 62, 32, 33, 34, 35, 36, 37, 63, 38, | ||
| 146 | 64, 42, 39, 80, 81, 26, 27, 40, 29, 67, | ||
| 147 | 65, 66, 68, 76, 79, 41, 87, 89, 92, 72, | ||
| 148 | 95, 98, 72, 99, 100, 65, 101, 42, 121, 102, | ||
| 149 | 2, 52, 54, 55, 57, 97, 57, 72, 25, 20, | ||
| 150 | 28, 65, 72, 18, 65, 34, 35, 75, 78, 122, | ||
| 151 | 4, 5, 6, 7, 123, 8, 9, 73, 0, 0, | ||
| 152 | 0, 104, 105, 106, 107, 93, 10, 108, 109, 110, | ||
| 153 | 111, 0, 0, 112, 0, 0, 0, 0, 0, 0, | ||
| 154 | 0, 0, 0, 0, 0, 7, 31, 0, 0, 0, | ||
| 155 | 0, 96, 32, 33, 34, 35, 36, 37, 19, 38, | ||
| 156 | 0, 0, 39, 0, 0, 0, 0, 40, 0, 7, | ||
| 157 | 31, 0, 0, 0, 0, 41, 32, 33, 34, 35, | ||
| 158 | 36, 37, 0, 38, 0, 0, 39, 42, 0, 0, | ||
| 159 | 0, 40, 0, 0, 0, 0, 31, 0, 0, 41, | ||
| 160 | 0, 0, 32, 33, 34, 35, 36, 37, 0, 38, | ||
| 161 | 0, 42, 39, 0, 0, 0, 0, 40, 0, 0, | ||
| 162 | 0, 0, 0, 0, 0, 41, 0, 104, 105, 106, | ||
| 163 | 107, 0, 0, 108, 109, 110, 111, 42, 0, 112, | ||
| 164 | 0, 0, 0, 0, 31, 0, 0, 0, 113, 114, | ||
| 165 | 32, 33, 34, 35, 36, 37, 0, 38, 0, 0, | ||
| 166 | 39, 31, 0, 0, 0, 40, 0, 32, 33, 34, | ||
| 167 | 35, 36, 37, 41, 38, 0, 0, 39, 0, 0, | ||
| 168 | 0, 0, 40, 0, 0, 42, 0, 31, 0, 0, | ||
| 169 | 41, 0, 0, 32, 33, 34, 35, 36, 37, 0, | ||
| 170 | 38, 0, 42, 39, 0, 0, 0, 0, 40, 0, | ||
| 171 | 0, 0, 0, 0, 0, 0, 41, 0, 0, 0, | ||
| 172 | 0, 0, 0, 0, 0, 0, 0, 0, 42, | ||
| 173 | ); | ||
| 174 | @yycheck = ( 60, | ||
| 175 | 125, 62, 44, 44, 44, 44, 123, 70, 30, 260, | ||
| 176 | 261, 5, 75, 297, 298, 265, 267, 268, 269, 270, | ||
| 177 | 271, 272, 266, 274, 125, 264, 277, 264, 62, 63, | ||
| 178 | 123, 282, 54, 67, 59, 57, 261, 31, 301, 290, | ||
| 179 | 40, 40, 267, 268, 269, 270, 271, 272, 40, 274, | ||
| 180 | 125, 302, 277, 297, 298, 7, 8, 282, 10, 40, | ||
| 181 | 43, 59, 58, 264, 44, 290, 59, 264, 59, 52, | ||
| 182 | 59, 41, 55, 41, 41, 58, 41, 302, 44, 58, | ||
| 183 | 0, 123, 123, 123, 123, 79, 59, 70, 125, 125, | ||
| 184 | 59, 74, 75, 3, 77, 59, 59, 55, 125, 120, | ||
| 185 | 257, 258, 259, 260, 121, 262, 263, 53, -1, -1, | ||
| 186 | -1, 278, 279, 280, 281, 125, 273, 284, 285, 286, | ||
| 187 | 287, -1, -1, 290, -1, -1, -1, -1, -1, -1, | ||
| 188 | -1, -1, -1, -1, -1, 260, 261, -1, -1, -1, | ||
| 189 | -1, 125, 267, 268, 269, 270, 271, 272, 265, 274, | ||
| 190 | -1, -1, 277, -1, -1, -1, -1, 282, -1, 260, | ||
| 191 | 261, -1, -1, -1, -1, 290, 267, 268, 269, 270, | ||
| 192 | 271, 272, -1, 274, -1, -1, 277, 302, -1, -1, | ||
| 193 | -1, 282, -1, -1, -1, -1, 261, -1, -1, 290, | ||
| 194 | -1, -1, 267, 268, 269, 270, 271, 272, -1, 274, | ||
| 195 | -1, 302, 277, -1, -1, -1, -1, 282, -1, -1, | ||
| 196 | -1, -1, -1, -1, -1, 290, -1, 278, 279, 280, | ||
| 197 | 281, -1, -1, 284, 285, 286, 287, 302, -1, 290, | ||
| 198 | -1, -1, -1, -1, 261, -1, -1, -1, 299, 300, | ||
| 199 | 267, 268, 269, 270, 271, 272, -1, 274, -1, -1, | ||
| 200 | 277, 261, -1, -1, -1, 282, -1, 267, 268, 269, | ||
| 201 | 270, 271, 272, 290, 274, -1, -1, 277, -1, -1, | ||
| 202 | -1, -1, 282, -1, -1, 302, -1, 261, -1, -1, | ||
| 203 | 290, -1, -1, 267, 268, 269, 270, 271, 272, -1, | ||
| 204 | 274, -1, 302, 277, -1, -1, -1, -1, 282, -1, | ||
| 205 | -1, -1, -1, -1, -1, -1, 290, -1, -1, -1, | ||
| 206 | -1, -1, -1, -1, -1, -1, -1, -1, 302, | ||
| 207 | ); | ||
| 208 | $YYFINAL=1; | ||
| 209 | #ifndef YYDEBUG | ||
| 210 | #define YYDEBUG 0 | ||
| 211 | #endif | ||
| 212 | $YYMAXTOKEN=302; | ||
| 213 | #if YYDEBUG | ||
| 214 | @yyname = ( | ||
| 215 | "end-of-file",'','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','', | ||
| 216 | '','','','','','',"'('","')'",'','',"','",'','','','','','','','','','','','','',"':'","';'","'<'",'', | ||
| 217 | "'>'",'','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','', | ||
| 218 | '','','','','','','','','','','','','','','','','','','','','','','',"'{'",'',"'}'",'','','','','','','','','','', | ||
| 219 | '','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','', | ||
| 220 | '','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','', | ||
| 221 | '','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','', | ||
| 222 | '',"FLAGS","DEFAULT","FILE","ROUTINE","USE","TYPE","ALIAS","STRING","T_WORD", | ||
| 223 | "T_NUM","FLOW","REQUIRE","ASSERT","ENSURE","RETURN","STACK","CLUSTER","PANIC", | ||
| 224 | "PROPAGATE","EXEC","TRACE","EMERGENCY","ALERT","CRITICAL","ERROR","AUTOMARK", | ||
| 225 | "INVARIANT","WARNING","NOTICE","INFO","DEBUG","TEST","DUMP","ALL","USR1","USR2", | ||
| 226 | "MEMORY","OBJECT","STATE","STARTUP","YES","NO","LEQ","GEQ","AS","ARGS", | ||
| 227 | ); | ||
| 228 | @yyrule = ( | ||
| 229 | "\$accept : root", | ||
| 230 | "\$\$1 :", | ||
| 231 | "root :\$\$1 statements", | ||
| 232 | "statements :", | ||
| 233 | "statements : statements statement", | ||
| 234 | "statement : flags_definition", | ||
| 235 | "statement : default_setting", | ||
| 236 | "statement : alias_setting", | ||
| 237 | "statement : file_definition", | ||
| 238 | "statement : cluster_definition", | ||
| 239 | "statement : type_definition", | ||
| 240 | "statement : routine_definition", | ||
| 241 | "flags_definition : FLAGS ident '{' flags_list '}'", | ||
| 242 | "default_setting : DEFAULT ident ';'", | ||
| 243 | "default_setting : DEFAULT '{' flags_list '}'", | ||
| 244 | "alias_setting : ALIAS STRING AS STRING ';'", | ||
| 245 | "file_definition : FILE string_list '{' flags_or_routines_list '}'", | ||
| 246 | "cluster_definition : CLUSTER string_list '{' flags_list '}'", | ||
| 247 | "routine_definition : ROUTINE string_list '{' flags_list '}'", | ||
| 248 | "type_definition : TYPE string_list '{' flags_or_routines_list '}'", | ||
| 249 | "flags_or_routines_list :", | ||
| 250 | "flags_or_routines_list : flags_or_routines", | ||
| 251 | "flags_or_routines_list : flags_or_routines_list flags_or_routines", | ||
| 252 | "flags_or_routines : flags_spec ';'", | ||
| 253 | "flags_or_routines : routine_definition", | ||
| 254 | "flags_list :", | ||
| 255 | "flags_list : flags_spec ';'", | ||
| 256 | "flags_list : flags_list flags_spec ';'", | ||
| 257 | "flags_spec : USE ident_list", | ||
| 258 | "flags_spec : trace_spec", | ||
| 259 | "flags_spec : flag_spec", | ||
| 260 | "flags_spec : args_spec", | ||
| 261 | "flags_spec : automark_spec", | ||
| 262 | "trace_spec : TRACE '(' yes_or_no ')' trace_flags", | ||
| 263 | "trace_flags :", | ||
| 264 | "trace_flags : ':' trace_flag_list", | ||
| 265 | "trace_flag_list : trace_flag", | ||
| 266 | "trace_flag_list : trace_flag_list ',' trace_flag", | ||
| 267 | "trace_flag : trace_flag_token", | ||
| 268 | "trace_flag : cmp_tag trace_flag_token", | ||
| 269 | "cmp_tag : LEQ", | ||
| 270 | "cmp_tag : GEQ", | ||
| 271 | "cmp_tag : '>'", | ||
| 272 | "cmp_tag : '<'", | ||
| 273 | "trace_flag_token : ALL", | ||
| 274 | "trace_flag_token : EMERGENCY", | ||
| 275 | "trace_flag_token : ALERT", | ||
| 276 | "trace_flag_token : CRITICAL", | ||
| 277 | "trace_flag_token : ERROR", | ||
| 278 | "trace_flag_token : WARNING", | ||
| 279 | "trace_flag_token : NOTICE", | ||
| 280 | "trace_flag_token : INFO", | ||
| 281 | "trace_flag_token : DEBUG", | ||
| 282 | "flag_spec : flag '(' yes_or_no ')'", | ||
| 283 | "args_spec : ARGS '(' args_level ')'", | ||
| 284 | "args_level : yes_or_no", | ||
| 285 | "args_level : T_NUM", | ||
| 286 | "automark_spec : automark_flag", | ||
| 287 | "automark_spec : automark_flag ':' STRING", | ||
| 288 | "automark_flag : AUTOMARK '(' yes_or_no ')'", | ||
| 289 | "yes_or_no : YES", | ||
| 290 | "yes_or_no : NO", | ||
| 291 | "flag : ALL", | ||
| 292 | "flag : FLOW", | ||
| 293 | "flag : RETURN", | ||
| 294 | "flag : REQUIRE", | ||
| 295 | "flag : ASSERT", | ||
| 296 | "flag : ENSURE", | ||
| 297 | "flag : PANIC", | ||
| 298 | "flag : STACK", | ||
| 299 | "ident_list : ident", | ||
| 300 | "ident_list : ident_list ',' ident", | ||
| 301 | "ident : T_WORD", | ||
| 302 | "string_list : string", | ||
| 303 | "string_list : string_list ',' string", | ||
| 304 | "string : STRING", | ||
| 305 | ); | ||
| 306 | #endif | ||
| 307 | sub yyclearin { | ||
| 308 | my $p; | ||
| 309 | ($p) = @_; | ||
| 310 | $p->{yychar} = -1; | ||
| 311 | } | ||
| 312 | sub yyerrok { | ||
| 313 | my $p; | ||
| 314 | ($p) = @_; | ||
| 315 | $p->{yyerrflag} = 0; | ||
| 316 | } | ||
| 317 | sub new { | ||
| 318 | my $p = bless {}, $_[0]; | ||
| 319 | $p->{yylex} = $_[1]; | ||
| 320 | $p->{yyerror} = $_[2]; | ||
| 321 | $p->{yydebug} = $_[3]; | ||
| 322 | return $p; | ||
| 323 | } | ||
| 324 | sub YYERROR { | ||
| 325 | my $p; | ||
| 326 | ($p) = @_; | ||
| 327 | ++$p->{yynerrs}; | ||
| 328 | $p->yy_err_recover; | ||
| 329 | } | ||
| 330 | sub yy_err_recover { | ||
| 331 | my $p; | ||
| 332 | ($p) = @_; | ||
| 333 | if ($p->{yyerrflag} < 3) | ||
| 334 | { | ||
| 335 | $p->{yyerrflag} = 3; | ||
| 336 | while (1) | ||
| 337 | { | ||
| 338 | if (($p->{yyn} = $yysindex[$p->{yyss}->[$p->{yyssp}]]) && | ||
| 339 | ($p->{yyn} += $YYERRCODE) >= 0 && | ||
| 340 | $p->{yyn} <= $#yycheck && | ||
| 341 | $yycheck[$p->{yyn}] == $YYERRCODE) | ||
| 342 | { | ||
| 343 | warn("yydebug: state " . | ||
| 344 | $p->{yyss}->[$p->{yyssp}] . | ||
| 345 | ", error recovery shifting to state" . | ||
| 346 | $yytable[$p->{yyn}] . "\n") | ||
| 347 | if $p->{yydebug}; | ||
| 348 | $p->{yyss}->[++$p->{yyssp}] = | ||
| 349 | $p->{yystate} = $yytable[$p->{yyn}]; | ||
| 350 | $p->{yyvs}->[++$p->{yyvsp}] = $p->{yylval}; | ||
| 351 | next yyloop; | ||
| 352 | } | ||
| 353 | else | ||
| 354 | { | ||
| 355 | warn("yydebug: error recovery discarding state ". | ||
| 356 | $p->{yyss}->[$p->{yyssp}]. "\n") | ||
| 357 | if $p->{yydebug}; | ||
| 358 | return(undef) if $p->{yyssp} <= 0; | ||
| 359 | --$p->{yyssp}; | ||
| 360 | --$p->{yyvsp}; | ||
| 361 | } | ||
| 362 | } | ||
| 363 | } | ||
| 364 | else | ||
| 365 | { | ||
| 366 | return (undef) if $p->{yychar} == 0; | ||
| 367 | if ($p->{yydebug}) | ||
| 368 | { | ||
| 369 | $p->{yys} = ''; | ||
| 370 | if ($p->{yychar} <= $YYMAXTOKEN) { $p->{yys} = | ||
| 371 | $yyname[$p->{yychar}]; } | ||
| 372 | if (!$p->{yys}) { $p->{yys} = 'illegal-symbol'; } | ||
| 373 | warn("yydebug: state " . $p->{yystate} . | ||
| 374 | ", error recovery discards " . | ||
| 375 | "token " . $p->{yychar} . "(" . | ||
| 376 | $p->{yys} . ")\n"); | ||
| 377 | } | ||
| 378 | $p->{yychar} = -1; | ||
| 379 | next yyloop; | ||
| 380 | } | ||
| 381 | 0; | ||
| 382 | } # yy_err_recover | ||
| 383 | |||
| 384 | sub yyparse { | ||
| 385 | my $p; | ||
| 386 | my $s; | ||
| 387 | ($p, $s) = @_; | ||
| 388 | if ($p->{yys} = $ENV{'YYDEBUG'}) | ||
| 389 | { | ||
| 390 | $p->{yydebug} = int($1) if $p->{yys} =~ /^(\d)/; | ||
| 391 | } | ||
| 392 | |||
| 393 | $p->{yynerrs} = 0; | ||
| 394 | $p->{yyerrflag} = 0; | ||
| 395 | $p->{yychar} = (-1); | ||
| 396 | |||
| 397 | $p->{yyssp} = 0; | ||
| 398 | $p->{yyvsp} = 0; | ||
| 399 | $p->{yyss}->[$p->{yyssp}] = $p->{yystate} = 0; | ||
| 400 | |||
| 401 | yyloop: while(1) | ||
| 402 | { | ||
| 403 | yyreduce: { | ||
| 404 | last yyreduce if ($p->{yyn} = $yydefred[$p->{yystate}]); | ||
| 405 | if ($p->{yychar} < 0) | ||
| 406 | { | ||
| 407 | if ((($p->{yychar}, $p->{yylval}) = | ||
| 408 | &{$p->{yylex}}($s)) < 0) { $p->{yychar} = 0; } | ||
| 409 | if ($p->{yydebug}) | ||
| 410 | { | ||
| 411 | $p->{yys} = ''; | ||
| 412 | if ($p->{yychar} <= $#yyname) | ||
| 413 | { $p->{yys} = $yyname[$p->{yychar}]; } | ||
| 414 | if (!$p->{yys}) { $p->{yys} = 'illegal-symbol'; }; | ||
| 415 | warn("yydebug: state " . $p->{yystate} . | ||
| 416 | ", reading " . $p->{yychar} . " (" . | ||
| 417 | $p->{yys} . ")\n"); | ||
| 418 | } | ||
| 419 | } | ||
| 420 | if (($p->{yyn} = $yysindex[$p->{yystate}]) && | ||
| 421 | ($p->{yyn} += $p->{yychar}) >= 0 && | ||
| 422 | $p->{yyn} <= $#yycheck && | ||
| 423 | $yycheck[$p->{yyn}] == $p->{yychar}) | ||
| 424 | { | ||
| 425 | warn("yydebug: state " . $p->{yystate} . | ||
| 426 | ", shifting to state " . | ||
| 427 | $yytable[$p->{yyn}] . "\n") if $p->{yydebug}; | ||
| 428 | $p->{yyss}->[++$p->{yyssp}] = $p->{yystate} = | ||
| 429 | $yytable[$p->{yyn}]; | ||
| 430 | $p->{yyvs}->[++$p->{yyvsp}] = $p->{yylval}; | ||
| 431 | $p->{yychar} = (-1); | ||
| 432 | --$p->{yyerrflag} if $p->{yyerrflag} > 0; | ||
| 433 | next yyloop; | ||
| 434 | } | ||
| 435 | if (($p->{yyn} = $yyrindex[$p->{yystate}]) && | ||
| 436 | ($p->{yyn} += $p->{'yychar'}) >= 0 && | ||
| 437 | $p->{yyn} <= $#yycheck && | ||
| 438 | $yycheck[$p->{yyn}] == $p->{yychar}) | ||
| 439 | { | ||
| 440 | $p->{yyn} = $yytable[$p->{yyn}]; | ||
| 441 | last yyreduce; | ||
| 442 | } | ||
| 443 | if (! $p->{yyerrflag}) { | ||
| 444 | &{$p->{yyerror}}('syntax error', $s); | ||
| 445 | ++$p->{yynerrs}; | ||
| 446 | } | ||
| 447 | return(undef) if $p->yy_err_recover; | ||
| 448 | } # yyreduce | ||
| 449 | warn("yydebug: state " . $p->{yystate} . | ||
| 450 | ", reducing by rule " . | ||
| 451 | $p->{yyn} . " (" . $yyrule[$p->{yyn}] . | ||
| 452 | ")\n") if $p->{yydebug}; | ||
| 453 | $p->{yym} = $yylen[$p->{yyn}]; | ||
| 454 | $p->{yyval} = $p->{yyvs}->[$p->{yyvsp}+1-$p->{yym}]; | ||
| 455 | if ($p->{yyn} == 1) { | ||
| 456 | #line 52 "./Parser.y" | ||
| 457 | { | ||
| 458 | $expect = yy_top; | ||
| 459 | |||
| 460 | # allocate the object that is gonna be returned | ||
| 461 | $result = {}; | ||
| 462 | } | ||
| 463 | } | ||
| 464 | if ($p->{yyn} == 2) { | ||
| 465 | #line 59 "./Parser.y" | ||
| 466 | { | ||
| 467 | $p->{yyval} = $result; | ||
| 468 | } | ||
| 469 | } | ||
| 470 | if ($p->{yyn} == 11) { | ||
| 471 | #line 79 "./Parser.y" | ||
| 472 | { | ||
| 473 | my $new = $p->{yyvs}->[$p->{yyvsp}-0]; | ||
| 474 | if (defined $result->{routine}) { | ||
| 475 | for my $key (keys %{$new}) { | ||
| 476 | $result->{routine}->{$key} = $new->{$key}; | ||
| 477 | } | ||
| 478 | } | ||
| 479 | else { | ||
| 480 | $result->{routine} = $new; | ||
| 481 | } | ||
| 482 | } | ||
| 483 | } | ||
| 484 | if ($p->{yyn} == 12) { | ||
| 485 | #line 94 "./Parser.y" | ||
| 486 | { | ||
| 487 | if ($p->{yyvs}->[$p->{yyvsp}-1] != 0) { | ||
| 488 | $result->{define}->{$p->{yyvs}->[$p->{yyvsp}-3]} = $p->{yyvs}->[$p->{yyvsp}-1]; | ||
| 489 | } | ||
| 490 | } | ||
| 491 | } | ||
| 492 | if ($p->{yyn} == 13) { | ||
| 493 | #line 103 "./Parser.y" | ||
| 494 | { | ||
| 495 | $result->{default} = {}; | ||
| 496 | if (defined $result->{define}->{$p->{yyvs}->[$p->{yyvsp}-1]}) { | ||
| 497 | merge_flag($result->{default},$result->{define}->{$p->{yyvs}->[$p->{yyvsp}-1]}); | ||
| 498 | } | ||
| 499 | } | ||
| 500 | } | ||
| 501 | if ($p->{yyn} == 14) { | ||
| 502 | #line 110 "./Parser.y" | ||
| 503 | { | ||
| 504 | if ($p->{yyvs}->[$p->{yyvsp}-1] != 0) { | ||
| 505 | $result->{default} = $p->{yyvs}->[$p->{yyvsp}-1]; | ||
| 506 | } | ||
| 507 | } | ||
| 508 | } | ||
| 509 | if ($p->{yyn} == 15) { | ||
| 510 | #line 119 "./Parser.y" | ||
| 511 | { | ||
| 512 | push @{$result->{alias}}, [$p->{yyvs}->[$p->{yyvsp}-3], $p->{yyvs}->[$p->{yyvsp}-1]]; | ||
| 513 | } | ||
| 514 | } | ||
| 515 | if ($p->{yyn} == 16) { | ||
| 516 | #line 126 "./Parser.y" | ||
| 517 | { | ||
| 518 | if ($p->{yyvs}->[$p->{yyvsp}-1] != 0) { | ||
| 519 | for my $string (@{$p->{yyvs}->[$p->{yyvsp}-3]}) { | ||
| 520 | $result->{file}->{$string} = $p->{yyvs}->[$p->{yyvsp}-1]; | ||
| 521 | } | ||
| 522 | } | ||
| 523 | } | ||
| 524 | } | ||
| 525 | if ($p->{yyn} == 17) { | ||
| 526 | #line 137 "./Parser.y" | ||
| 527 | { | ||
| 528 | if ($p->{yyvs}->[$p->{yyvsp}-1] != 0) { | ||
| 529 | for my $string (@{$p->{yyvs}->[$p->{yyvsp}-3]}) { | ||
| 530 | $result->{cluster}->{$string}->{flags} = $p->{yyvs}->[$p->{yyvsp}-1]; | ||
| 531 | } | ||
| 532 | } | ||
| 533 | } | ||
| 534 | } | ||
| 535 | if ($p->{yyn} == 18) { | ||
| 536 | #line 148 "./Parser.y" | ||
| 537 | { | ||
| 538 | my $hash = {}; | ||
| 539 | if ($p->{yyvs}->[$p->{yyvsp}-1] != 0) { | ||
| 540 | for my $string (@{$p->{yyvs}->[$p->{yyvsp}-3]}) { | ||
| 541 | $hash->{$string}->{flags} = $p->{yyvs}->[$p->{yyvsp}-1]; | ||
| 542 | } | ||
| 543 | } | ||
| 544 | $p->{yyval} = $hash; | ||
| 545 | } | ||
| 546 | } | ||
| 547 | if ($p->{yyn} == 19) { | ||
| 548 | #line 161 "./Parser.y" | ||
| 549 | { | ||
| 550 | if ($p->{yyvs}->[$p->{yyvsp}-1] != 0) { | ||
| 551 | for my $string (@{$p->{yyvs}->[$p->{yyvsp}-3]}) { | ||
| 552 | $result->{type}->{$string} = $p->{yyvs}->[$p->{yyvsp}-1]; | ||
| 553 | } | ||
| 554 | } | ||
| 555 | } | ||
| 556 | } | ||
| 557 | if ($p->{yyn} == 20) { | ||
| 558 | #line 171 "./Parser.y" | ||
| 559 | { $p->{yyval} = 0; } | ||
| 560 | } | ||
| 561 | if ($p->{yyn} == 21) { | ||
| 562 | #line 172 "./Parser.y" | ||
| 563 | { $p->{yyval} = $p->{yyvs}->[$p->{yyvsp}-0]; } | ||
| 564 | } | ||
| 565 | if ($p->{yyn} == 22) { | ||
| 566 | #line 174 "./Parser.y" | ||
| 567 | { | ||
| 568 | my $current = $p->{yyvs}->[$p->{yyvsp}-1]; | ||
| 569 | my $new = $p->{yyvs}->[$p->{yyvsp}-0]; | ||
| 570 | |||
| 571 | # | ||
| 572 | # If new node holds flags, merge them. | ||
| 573 | # | ||
| 574 | if (defined $new->{flags}) { | ||
| 575 | if (defined $current->{flags}) { | ||
| 576 | merge_flag($current->{flags}, $new->{flags}); | ||
| 577 | } | ||
| 578 | else { | ||
| 579 | $current->{flags} = $new->{flags}; | ||
| 580 | } | ||
| 581 | } | ||
| 582 | |||
| 583 | # | ||
| 584 | # If new node holds routine, merge them. | ||
| 585 | # | ||
| 586 | if (defined $new->{routine}) { | ||
| 587 | if (defined $current->{routine}) { | ||
| 588 | for my $key (keys %{$new->{routine}}) { | ||
| 589 | $current->{routine}->{$key} = | ||
| 590 | $new->{routine}->{$key}; | ||
| 591 | } | ||
| 592 | } | ||
| 593 | else { | ||
| 594 | $current->{routine} = $new->{routine}; | ||
| 595 | } | ||
| 596 | } | ||
| 597 | |||
| 598 | $p->{yyval} = $current; | ||
| 599 | } | ||
| 600 | } | ||
| 601 | if ($p->{yyn} == 23) { | ||
| 602 | #line 212 "./Parser.y" | ||
| 603 | { | ||
| 604 | my $flag = {}; | ||
| 605 | |||
| 606 | $flag->{flags} = $p->{yyvs}->[$p->{yyvsp}-1]; | ||
| 607 | $p->{yyval} = $flag; | ||
| 608 | } | ||
| 609 | } | ||
| 610 | if ($p->{yyn} == 24) { | ||
| 611 | #line 219 "./Parser.y" | ||
| 612 | { | ||
| 613 | my $routine = {}; | ||
| 614 | |||
| 615 | $routine->{routine} = $p->{yyvs}->[$p->{yyvsp}-0]; | ||
| 616 | $p->{yyval} = $routine; | ||
| 617 | } | ||
| 618 | } | ||
| 619 | if ($p->{yyn} == 25) { | ||
| 620 | #line 228 "./Parser.y" | ||
| 621 | { $p->{yyval} = 0; } | ||
| 622 | } | ||
| 623 | if ($p->{yyn} == 26) { | ||
| 624 | #line 229 "./Parser.y" | ||
| 625 | { $p->{yyval} = $p->{yyvs}->[$p->{yyvsp}-1]; } | ||
| 626 | } | ||
| 627 | if ($p->{yyn} == 27) { | ||
| 628 | #line 231 "./Parser.y" | ||
| 629 | { | ||
| 630 | my $flag = $p->{yyvs}->[$p->{yyvsp}-2]; | ||
| 631 | my $new = $p->{yyvs}->[$p->{yyvsp}-1]; | ||
| 632 | |||
| 633 | merge_flag($flag, $new); | ||
| 634 | $p->{yyval} = $flag; | ||
| 635 | } | ||
| 636 | } | ||
| 637 | if ($p->{yyn} == 28) { | ||
| 638 | #line 242 "./Parser.y" | ||
| 639 | { | ||
| 640 | my $flag = {}; | ||
| 641 | |||
| 642 | for my $ident (@{$p->{yyvs}->[$p->{yyvsp}-0]}) { | ||
| 643 | if (defined $result->{define}->{$ident}) { | ||
| 644 | merge_flag($flag, $result->{define}->{$ident}); | ||
| 645 | } | ||
| 646 | } | ||
| 647 | |||
| 648 | $p->{yyval} = $flag; | ||
| 649 | } | ||
| 650 | } | ||
| 651 | if ($p->{yyn} == 29) { | ||
| 652 | #line 254 "./Parser.y" | ||
| 653 | { | ||
| 654 | my $flag = {}; | ||
| 655 | $flag->{trace} = $p->{yyvs}->[$p->{yyvsp}-0]; | ||
| 656 | |||
| 657 | # If at least one trace flag is set, we need to activate | ||
| 658 | # tracing. If no flag is set and all are clear, we deactivate | ||
| 659 | # tracing alltogether. | ||
| 660 | |||
| 661 | if ($flag->{trace}->[DTM_SET]) { | ||
| 662 | $flag->{debug} = [DBG_TRACE, 0]; | ||
| 663 | } | ||
| 664 | elsif ($flag->{trace}->[DTM_CLEAR] == TRC_ALL) { | ||
| 665 | $flag->{debug} = [0, DBG_TRACE]; | ||
| 666 | } | ||
| 667 | $p->{yyval} = $flag; | ||
| 668 | } | ||
| 669 | } | ||
| 670 | if ($p->{yyn} == 30) { | ||
| 671 | #line 271 "./Parser.y" | ||
| 672 | { | ||
| 673 | my $flag = {}; | ||
| 674 | $flag->{debug} = $p->{yyvs}->[$p->{yyvsp}-0]; | ||
| 675 | |||
| 676 | $p->{yyval} = $flag; | ||
| 677 | } | ||
| 678 | } | ||
| 679 | if ($p->{yyn} == 31) { | ||
| 680 | #line 278 "./Parser.y" | ||
| 681 | { | ||
| 682 | my $flag = {}; | ||
| 683 | $flag->{args} = $p->{yyvs}->[$p->{yyvsp}-0]; | ||
| 684 | |||
| 685 | $p->{yyval} = $flag; | ||
| 686 | } | ||
| 687 | } | ||
| 688 | if ($p->{yyn} == 32) { | ||
| 689 | #line 285 "./Parser.y" | ||
| 690 | { | ||
| 691 | ; | ||
| 692 | } | ||
| 693 | } | ||
| 694 | if ($p->{yyn} == 33) { | ||
| 695 | #line 292 "./Parser.y" | ||
| 696 | { | ||
| 697 | # create a new flag | ||
| 698 | $flag = [0, 0]; | ||
| 699 | if ($p->{yyvs}->[$p->{yyvsp}-2]) { | ||
| 700 | $flag->[DTM_SET] = $p->{yyvs}->[$p->{yyvsp}-0]; | ||
| 701 | } | ||
| 702 | else { | ||
| 703 | $flag->[DTM_CLEAR] = $p->{yyvs}->[$p->{yyvsp}-0]; | ||
| 704 | } | ||
| 705 | $p->{yyval} = $flag; | ||
| 706 | } | ||
| 707 | } | ||
| 708 | if ($p->{yyn} == 34) { | ||
| 709 | #line 306 "./Parser.y" | ||
| 710 | { $p->{yyval} = TRC_ALL; } | ||
| 711 | } | ||
| 712 | if ($p->{yyn} == 35) { | ||
| 713 | #line 307 "./Parser.y" | ||
| 714 | { $p->{yyval} = $p->{yyvs}->[$p->{yyvsp}-0]; } | ||
| 715 | } | ||
| 716 | if ($p->{yyn} == 36) { | ||
| 717 | #line 311 "./Parser.y" | ||
| 718 | { $p->{yyval} = $p->{yyvs}->[$p->{yyvsp}-0]; } | ||
| 719 | } | ||
| 720 | if ($p->{yyn} == 37) { | ||
| 721 | #line 312 "./Parser.y" | ||
| 722 | { $p->{yyval} = $p->{yyvs}->[$p->{yyvsp}-2] | $p->{yyvs}->[$p->{yyvsp}-0]; } | ||
| 723 | } | ||
| 724 | if ($p->{yyn} == 38) { | ||
| 725 | #line 317 "./Parser.y" | ||
| 726 | { $p->{yyval} = $p->{yyvs}->[$p->{yyvsp}-0]; } | ||
| 727 | } | ||
| 728 | if ($p->{yyn} == 39) { | ||
| 729 | #line 318 "./Parser.y" | ||
| 730 | { $p->{yyval} = &{$p->{yyvs}->[$p->{yyvsp}-1]}($p->{yyvs}->[$p->{yyvsp}-0]); } | ||
| 731 | } | ||
| 732 | if ($p->{yyn} == 40) { | ||
| 733 | #line 322 "./Parser.y" | ||
| 734 | { $p->{yyval} = \&less_or_equal; } | ||
| 735 | } | ||
| 736 | if ($p->{yyn} == 41) { | ||
| 737 | #line 323 "./Parser.y" | ||
| 738 | { $p->{yyval} = \&greater_or_equal; } | ||
| 739 | } | ||
| 740 | if ($p->{yyn} == 42) { | ||
| 741 | #line 324 "./Parser.y" | ||
| 742 | { $p->{yyval} = \&greater; } | ||
| 743 | } | ||
| 744 | if ($p->{yyn} == 43) { | ||
| 745 | #line 325 "./Parser.y" | ||
| 746 | { $p->{yyval} = \&less; } | ||
| 747 | } | ||
| 748 | if ($p->{yyn} == 44) { | ||
| 749 | #line 329 "./Parser.y" | ||
| 750 | { $p->{yyval} = TRC_ALL; } | ||
| 751 | } | ||
| 752 | if ($p->{yyn} == 45) { | ||
| 753 | #line 330 "./Parser.y" | ||
| 754 | { $p->{yyval} = TRC_EMERGENCY; } | ||
| 755 | } | ||
| 756 | if ($p->{yyn} == 46) { | ||
| 757 | #line 331 "./Parser.y" | ||
| 758 | { $p->{yyval} = TRC_ALERT; } | ||
| 759 | } | ||
| 760 | if ($p->{yyn} == 47) { | ||
| 761 | #line 332 "./Parser.y" | ||
| 762 | { $p->{yyval} = TRC_CRITICAL; } | ||
| 763 | } | ||
| 764 | if ($p->{yyn} == 48) { | ||
| 765 | #line 333 "./Parser.y" | ||
| 766 | { $p->{yyval} = TRC_ERROR; } | ||
| 767 | } | ||
| 768 | if ($p->{yyn} == 49) { | ||
| 769 | #line 334 "./Parser.y" | ||
| 770 | { $p->{yyval} = TRC_WARNING; } | ||
| 771 | } | ||
| 772 | if ($p->{yyn} == 50) { | ||
| 773 | #line 335 "./Parser.y" | ||
| 774 | { $p->{yyval} = TRC_NOTICE; } | ||
| 775 | } | ||
| 776 | if ($p->{yyn} == 51) { | ||
| 777 | #line 336 "./Parser.y" | ||
| 778 | { $p->{yyval} = TRC_INFO; } | ||
| 779 | } | ||
| 780 | if ($p->{yyn} == 52) { | ||
| 781 | #line 337 "./Parser.y" | ||
| 782 | { $p->{yyval} = TRC_DEBUG; } | ||
| 783 | } | ||
| 784 | if ($p->{yyn} == 53) { | ||
| 785 | #line 342 "./Parser.y" | ||
| 786 | { | ||
| 787 | # create a new flag | ||
| 788 | $flag = [0, 0]; | ||
| 789 | if ($p->{yyvs}->[$p->{yyvsp}-1]) { | ||
| 790 | $flag->[DTM_SET] = $p->{yyvs}->[$p->{yyvsp}-3]; | ||
| 791 | } | ||
| 792 | else { | ||
| 793 | $flag->[DTM_CLEAR] = $p->{yyvs}->[$p->{yyvsp}-3]; | ||
| 794 | } | ||
| 795 | $p->{yyval} = $flag; | ||
| 796 | } | ||
| 797 | } | ||
| 798 | if ($p->{yyn} == 54) { | ||
| 799 | #line 356 "./Parser.y" | ||
| 800 | { $p->{yyval} = $p->{yyvs}->[$p->{yyvsp}-1]; } | ||
| 801 | } | ||
| 802 | if ($p->{yyn} == 55) { | ||
| 803 | #line 360 "./Parser.y" | ||
| 804 | { $p->{yyval} = $p->{yyvs}->[$p->{yyvsp}-0] ? -1 : 0; } | ||
| 805 | } | ||
| 806 | if ($p->{yyn} == 56) { | ||
| 807 | #line 361 "./Parser.y" | ||
| 808 | { $p->{yyval} = $p->{yyvs}->[$p->{yyvsp}-0]; } | ||
| 809 | } | ||
| 810 | if ($p->{yyn} == 57) { | ||
| 811 | #line 367 "./Parser.y" | ||
| 812 | { | ||
| 813 | ; | ||
| 814 | } | ||
| 815 | } | ||
| 816 | if ($p->{yyn} == 58) { | ||
| 817 | #line 371 "./Parser.y" | ||
| 818 | { | ||
| 819 | ; | ||
| 820 | } | ||
| 821 | } | ||
| 822 | if ($p->{yyn} == 59) { | ||
| 823 | #line 378 "./Parser.y" | ||
| 824 | { | ||
| 825 | ; | ||
| 826 | } | ||
| 827 | } | ||
| 828 | if ($p->{yyn} == 60) { | ||
| 829 | #line 384 "./Parser.y" | ||
| 830 | { $p->{yyval} = TRUE; } | ||
| 831 | } | ||
| 832 | if ($p->{yyn} == 61) { | ||
| 833 | #line 385 "./Parser.y" | ||
| 834 | { $p->{yyval} = FALSE; } | ||
| 835 | } | ||
| 836 | if ($p->{yyn} == 62) { | ||
| 837 | #line 389 "./Parser.y" | ||
| 838 | { $p->{yyval} = DBG_ALL; } | ||
| 839 | } | ||
| 840 | if ($p->{yyn} == 63) { | ||
| 841 | #line 390 "./Parser.y" | ||
| 842 | { $p->{yyval} = DBG_FLOW; } | ||
| 843 | } | ||
| 844 | if ($p->{yyn} == 64) { | ||
| 845 | #line 391 "./Parser.y" | ||
| 846 | { $p->{yyval} = DBG_RETURN; } | ||
| 847 | } | ||
| 848 | if ($p->{yyn} == 65) { | ||
| 849 | #line 392 "./Parser.y" | ||
| 850 | { $p->{yyval} = DBG_REQUIRE; } | ||
| 851 | } | ||
| 852 | if ($p->{yyn} == 66) { | ||
| 853 | #line 393 "./Parser.y" | ||
| 854 | { $p->{yyval} = DBG_ASSERT; } | ||
| 855 | } | ||
| 856 | if ($p->{yyn} == 67) { | ||
| 857 | #line 394 "./Parser.y" | ||
| 858 | { $p->{yyval} = DBG_ENSURE; } | ||
| 859 | } | ||
| 860 | if ($p->{yyn} == 68) { | ||
| 861 | #line 395 "./Parser.y" | ||
| 862 | { $p->{yyval} = DBG_PANIC; } | ||
| 863 | } | ||
| 864 | if ($p->{yyn} == 69) { | ||
| 865 | #line 396 "./Parser.y" | ||
| 866 | { $p->{yyval} = DBG_STACK; } | ||
| 867 | } | ||
| 868 | if ($p->{yyn} == 70) { | ||
| 869 | #line 400 "./Parser.y" | ||
| 870 | { $p->{yyval} = [$p->{yyvs}->[$p->{yyvsp}-0]];} | ||
| 871 | } | ||
| 872 | if ($p->{yyn} == 71) { | ||
| 873 | #line 402 "./Parser.y" | ||
| 874 | { | ||
| 875 | push @{$p->{yyvs}->[$p->{yyvsp}-2]}, $p->{yyvs}->[$p->{yyvsp}-0]; | ||
| 876 | $p->{yyval} = $p->{yyvs}->[$p->{yyvsp}-2]; | ||
| 877 | } | ||
| 878 | } | ||
| 879 | if ($p->{yyn} == 72) { | ||
| 880 | #line 409 "./Parser.y" | ||
| 881 | { $p->{yyval} = $p->{yyvs}->[$p->{yyvsp}-0]; } | ||
| 882 | } | ||
| 883 | if ($p->{yyn} == 73) { | ||
| 884 | #line 413 "./Parser.y" | ||
| 885 | { $p->{yyval} = [$p->{yyvs}->[$p->{yyvsp}-0]]; } | ||
| 886 | } | ||
| 887 | if ($p->{yyn} == 74) { | ||
| 888 | #line 415 "./Parser.y" | ||
| 889 | { | ||
| 890 | push @{$p->{yyvs}->[$p->{yyvsp}-2]}, $p->{yyvs}->[$p->{yyvsp}-0]; | ||
| 891 | $p->{yyval} = $p->{yyvs}->[$p->{yyvsp}-2]; | ||
| 892 | } | ||
| 893 | } | ||
| 894 | if ($p->{yyn} == 75) { | ||
| 895 | #line 422 "./Parser.y" | ||
| 896 | { $p->{yyval} = $p->{yyvs}->[$p->{yyvsp}-0]; } | ||
| 897 | } | ||
| 898 | #line 896 "Parser.pm" | ||
| 899 | $p->{yyssp} -= $p->{yym}; | ||
| 900 | $p->{yystate} = $p->{yyss}->[$p->{yyssp}]; | ||
| 901 | $p->{yyvsp} -= $p->{yym}; | ||
| 902 | $p->{yym} = $yylhs[$p->{yyn}]; | ||
| 903 | if ($p->{yystate} == 0 && $p->{yym} == 0) | ||
| 904 | { | ||
| 905 | warn("yydebug: after reduction, shifting from state 0 ", | ||
| 906 | "to state $YYFINAL\n") if $p->{yydebug}; | ||
| 907 | $p->{yystate} = $YYFINAL; | ||
| 908 | $p->{yyss}->[++$p->{yyssp}] = $YYFINAL; | ||
| 909 | $p->{yyvs}->[++$p->{yyvsp}] = $p->{yyval}; | ||
| 910 | if ($p->{yychar} < 0) | ||
| 911 | { | ||
| 912 | if ((($p->{yychar}, $p->{yylval}) = | ||
| 913 | &{$p->{yylex}}($s)) < 0) { $p->{yychar} = 0; } | ||
| 914 | if ($p->{yydebug}) | ||
| 915 | { | ||
| 916 | $p->{yys} = ''; | ||
| 917 | if ($p->{yychar} <= $#yyname) | ||
| 918 | { $p->{yys} = $yyname[$p->{yychar}]; } | ||
| 919 | if (!$p->{yys}) { $p->{yys} = 'illegal-symbol'; } | ||
| 920 | warn("yydebug: state $YYFINAL, reading " . | ||
| 921 | $p->{yychar} . " (" . $p->{yys} . ")\n"); | ||
| 922 | } | ||
| 923 | } | ||
| 924 | return ($p->{yyvs}->[1]) if $p->{yychar} == 0; | ||
| 925 | next yyloop; | ||
| 926 | } | ||
| 927 | if (($p->{yyn} = $yygindex[$p->{yym}]) && | ||
| 928 | ($p->{yyn} += $p->{yystate}) >= 0 && | ||
| 929 | $p->{yyn} <= $#yycheck && | ||
| 930 | $yycheck[$p->{yyn}] == $p->{yystate}) | ||
| 931 | { | ||
| 932 | $p->{yystate} = $yytable[$p->{yyn}]; | ||
| 933 | } else { | ||
| 934 | $p->{yystate} = $yydgoto[$p->{yym}]; | ||
| 935 | } | ||
| 936 | warn("yydebug: after reduction, shifting from state " . | ||
| 937 | $p->{yyss}->[$p->{yyssp}] . " to state " . | ||
| 938 | $p->{yystate} . "\n") if $p->{yydebug}; | ||
| 939 | $p->{yyss}[++$p->{yyssp}] = $p->{yystate}; | ||
| 940 | $p->{yyvs}[++$p->{yyvsp}] = $p->{yyval}; | ||
| 941 | } # yyloop | ||
| 942 | } # yyparse | ||
| 943 | #line 426 "./Parser.y" | ||
| 944 | # Print semantic error | ||
| 945 | sub yywrong { | ||
| 946 | my ($msg) = @_; | ||
| 947 | print STDERR "file $file, line $yylineno: ERROR: $msg\n"; | ||
| 948 | #confess "trace:\n"; | ||
| 949 | yyerror("syntax error"); | ||
| 950 | } | ||
| 951 | |||
| 952 | # Print warning | ||
| 953 | sub yywarn { | ||
| 954 | my ($msg) = @_; | ||
| 955 | print STDERR "file $file line $yylineno: WARNING: $msg\n"; | ||
| 956 | } | ||
| 957 | |||
| 958 | # Print warning without line number | ||
| 959 | sub yytell { | ||
| 960 | my ($msg) = @_; | ||
| 961 | print STDERR "WARNING: $msg\n"; | ||
| 962 | } | ||
| 963 | |||
| 964 | sub yy_lineno { | ||
| 965 | $yylineno += $yylval =~ tr/\n/\n/; | ||
| 966 | } | ||
| 967 | |||
| 968 | # Print parsing error, trying to give at least next two tokens | ||
| 969 | sub yyerror { | ||
| 970 | my ($msg) = @_; | ||
| 971 | my ($near) = /^\s*(\S+[ \t]*\w*)/; | ||
| 972 | ($near) = /^\s*(\w+[ \t]*\w*)/ if $near eq ''; | ||
| 973 | $near =~ tr/\n\t/ /; | ||
| 974 | $near =~ tr/ //s; | ||
| 975 | $near =~ s/\s*$//; | ||
| 976 | print STDERR "$msg at line $yylineno in file $file"; | ||
| 977 | my ($after) = $yylast =~ /(\w+\s+\w+)$/; | ||
| 978 | ($after) = $yylast =~/(\S+\s*\w+)$/ if $after eq ''; | ||
| 979 | ($after) = $yylast =~/(\S+)$/ if $after eq ''; | ||
| 980 | print STDERR " after \"$after\"" unless $after eq ''; | ||
| 981 | print STDERR " near \"$near\"" unless $near eq ''; | ||
| 982 | print STDERR "\n"; | ||
| 983 | die "Abort processing\n"; | ||
| 984 | } | ||
| 985 | |||
| 986 | sub yy_top { | ||
| 987 | &yy_comment if m!/(/|\*)!; # Discard comments | ||
| 988 | my $kw; | ||
| 989 | return $kw if defined ($kw = &yy_keyword); | ||
| 990 | return &yy_dflt; | ||
| 991 | } | ||
| 992 | |||
| 993 | sub yy_skip { | ||
| 994 | my $in_comment = 0; | ||
| 995 | $yylval = ""; | ||
| 996 | |||
| 997 | while ($_ ne '') { | ||
| 998 | |||
| 999 | if (!$in_comment) { | ||
| 1000 | my $sp = ""; | ||
| 1001 | |||
| 1002 | if ($skip_mode == 0) { # leave what matches for next turn | ||
| 1003 | if (s/^(\s*)($skip_to)/$2/) { | ||
| 1004 | $yylval .= $1; | ||
| 1005 | |||
| 1006 | $sp = $yylval; | ||
| 1007 | $sl = $sp =~ tr/\n/\n/; # Count newlines seen | ||
| 1008 | $yylineno += $sl; # Keep track of line number | ||
| 1009 | |||
| 1010 | return $K_FIND; | ||
| 1011 | } | ||
| 1012 | } | ||
| 1013 | elsif (s/^(\s*)($skip_to)//) { | ||
| 1014 | $yylval .= $1; | ||
| 1015 | |||
| 1016 | $sp = $yylval; | ||
| 1017 | $sl = $sp =~ tr/\n/\n/; # Count newlines seen | ||
| 1018 | $yylineno += $sl; # Keep track of line number | ||
| 1019 | |||
| 1020 | return $K_FIND; | ||
| 1021 | } | ||
| 1022 | } | ||
| 1023 | |||
| 1024 | # skip comment | ||
| 1025 | if (s/^(\/\*)//) { | ||
| 1026 | $in_comment = 1; | ||
| 1027 | $yylval .= $1; | ||
| 1028 | } | ||
| 1029 | if (s/^(.*\*\/)//) { | ||
| 1030 | $in_comment = 0; | ||
| 1031 | $yylval .= $1; | ||
| 1032 | } | ||
| 1033 | |||
| 1034 | |||
| 1035 | s/^(.*)//; | ||
| 1036 | $yylval .= $1; | ||
| 1037 | s/^(\s*)//; | ||
| 1038 | $yylval .= $1; | ||
| 1039 | } | ||
| 1040 | |||
| 1041 | return 0; # Should not reach that point, but if we do... | ||
| 1042 | |||
| 1043 | } | ||
| 1044 | |||
| 1045 | |||
| 1046 | # Strip comment on current lines and subsequent ones, updating $yylineno | ||
| 1047 | # This takes care of comments appearing within lexical parts, whilst global | ||
| 1048 | # ones starting at the beginning of a line are taken care of by &yylex. | ||
| 1049 | # The routine handles both // and /* */ comments. | ||
| 1050 | sub yy_comment { | ||
| 1051 | while (s!^(//.*)!! || s!^(/\*(?:.|\n)*?\*/)!!) { | ||
| 1052 | my $com = $1; | ||
| 1053 | print "yylex: tokener stripped '$com' at line $yylineno\n" if $yydebug; | ||
| 1054 | $yylineno += $com =~ tr/\n/\n/; # Count lines | ||
| 1055 | s/^(\s*)//; | ||
| 1056 | my $sl = $1; | ||
| 1057 | $yylineno += $sl =~ tr/\n/\n/; # Count lines | ||
| 1058 | } | ||
| 1059 | } | ||
| 1060 | |||
| 1061 | sub yy_keyword { | ||
| 1062 | |||
| 1063 | |||
| 1064 | %Keyword = ( | ||
| 1065 | 'alert' => $ALERT, | ||
| 1066 | 'alias' => $ALIAS, | ||
| 1067 | 'all' => $ALL, | ||
| 1068 | 'args' => $ARGS, | ||
| 1069 | 'assert' => $ASSERT, | ||
| 1070 | 'automark' => $AUTOMARK, | ||
| 1071 | 'cluster' => $CLUSTER, | ||
| 1072 | 'critical' => $CRITICAL, | ||
| 1073 | 'debug' => $DEBUG, | ||
| 1074 | 'default' => $DEFAULT, | ||
| 1075 | 'dump' => $DUMP, | ||
| 1076 | 'error' => $ERROR, | ||
| 1077 | 'emergency' => $EMERGENCY, | ||
| 1078 | 'ensure' => $ENSURE, | ||
| 1079 | 'exec' => $EXEC, | ||
| 1080 | 'file' => $FILE, | ||
| 1081 | 'flags' => $FLAGS, | ||
| 1082 | 'flow' => $FLOW, | ||
| 1083 | 'info' => $INFO, | ||
| 1084 | 'memory' => $MEMORY, | ||
| 1085 | 'no' => $NO, | ||
| 1086 | 'notice' => $NOTICE, | ||
| 1087 | 'object' => $OBJECT, | ||
| 1088 | 'panic' => $PANIC, | ||
| 1089 | 'propagate' => $PROPAGATE, | ||
| 1090 | 'require' => $REQUIRE, | ||
| 1091 | 'return' => $RETURN, | ||
| 1092 | 'routine' => $ROUTINE, | ||
| 1093 | 'severe' => $SEVERE, | ||
| 1094 | 'stack' => $STACK, | ||
| 1095 | 'startup' => $STARTUP, | ||
| 1096 | 'state' => $STATE, | ||
| 1097 | 'test' => $TEST, | ||
| 1098 | 'trace' => $TRACE, | ||
| 1099 | 'type' => $TYPE, | ||
| 1100 | 'use' => $USE, | ||
| 1101 | 'usr1' => $USR1, | ||
| 1102 | 'usr2' => $USR2, | ||
| 1103 | 'warning' => $WARNING, | ||
| 1104 | 'yes' => $YES | ||
| 1105 | ) unless defined %Keyword; | ||
| 1106 | return undef unless /^(\w+)/ && exists $Keyword{$1}; | ||
| 1107 | my $word = $1; | ||
| 1108 | s/^\w+//; | ||
| 1109 | $yylval = $word; | ||
| 1110 | return $Keyword{$word}; | ||
| 1111 | } | ||
| 1112 | |||
| 1113 | sub yy_dflt { | ||
| 1114 | &yy_comment if m!/(/|\*)!; # Discard comments | ||
| 1115 | |||
| 1116 | if (s/^(>=)//) { return $GEQ; } | ||
| 1117 | if (s/^(<=)//) { return $LEQ; } | ||
| 1118 | if (s/^(=>)//) { return $AS; } | ||
| 1119 | |||
| 1120 | # Characters standing for themselves | ||
| 1121 | if (s/^([{}!<>:=;,()\[\]])//) { | ||
| 1122 | return $yylval = ord($1); | ||
| 1123 | } | ||
| 1124 | |||
| 1125 | # Handle special tokens | ||
| 1126 | if (s/^(\*)//) { $yylval = $1; return $T_POINTER } | ||
| 1127 | |||
| 1128 | # handle string | ||
| 1129 | if (s/^\"(.*?)\"//) { $yylval = $1; return $STRING; } | ||
| 1130 | |||
| 1131 | # Handle numbers | ||
| 1132 | if (s/^(0\d+)\b//) { $yylval = oct($1); return $T_NUM; } | ||
| 1133 | if (s/^(0b[01]+)\b//i) { $yylval = bin($1); return $T_NUM } | ||
| 1134 | if (s/^(0x[\da-f]+)\b//i) { $yylval = hex($1); return $T_NUM } | ||
| 1135 | if (s/^(\d+)\b//) { $yylval = int($1); return $T_NUM } | ||
| 1136 | |||
| 1137 | # Words | ||
| 1138 | if (s/^(\w+)//) { $yylval = $1; return $T_WORD } | ||
| 1139 | |||
| 1140 | # Default action: return whatever character we are facing | ||
| 1141 | s/^(.)// and return $yylval = ord($1); | ||
| 1142 | |||
| 1143 | return 0; # Should not reach that point, but if we do... | ||
| 1144 | } | ||
| 1145 | |||
| 1146 | # Lexical parser of the $_ string, along with line count tracking. In order | ||
| 1147 | # to simplify processing of lines, the parsed string must have a leading | ||
| 1148 | # new-line prepended to it before firing off the gramatical analysis. | ||
| 1149 | sub yylex { | ||
| 1150 | my $sp = ''; # Amount of spaces stripped of | ||
| 1151 | my $sl = 0; # True if at the start of a line | ||
| 1152 | |||
| 1153 | if ($expect ne "yy_skip") { | ||
| 1154 | for (;;) { | ||
| 1155 | s/^(\s*)// and $sp = $1; # Spaces are not significant | ||
| 1156 | $sl = $sp =~ tr/\n/\n/; # Count newlines seen | ||
| 1157 | $yylineno += $sl; # Keep track of line number | ||
| 1158 | next if $sl && s|^\s*\//.*\n|\n|; # Skip comments | ||
| 1159 | last; | ||
| 1160 | } | ||
| 1161 | } | ||
| 1162 | |||
| 1163 | if ($yydebug) { | ||
| 1164 | my ($trace) = /^((?:.*)\n*(?:.*)\n*)/m; # Next two lines at most | ||
| 1165 | my $more = length($trace) < length($_) ? "...more...\n" : ''; | ||
| 1166 | $trace =~ tr/\n/\n/s; # Avoid succession of new-lines | ||
| 1167 | print "yylex: [line $yylineno] $trace$more"; | ||
| 1168 | print "yylex: calling $expect\n"; | ||
| 1169 | } | ||
| 1170 | |||
| 1171 | my $ret = $_ ne '' ? &$expect : 0; # 0 signals EOF to yyparse | ||
| 1172 | |||
| 1173 | # Remember last read token for yyerror. Dont forget that it might be | ||
| 1174 | # an ASCII number and convert it back to a char in that case... | ||
| 1175 | $yylast = $yylval eq $ret ? chr($yylval) : $yylval; | ||
| 1176 | $yylast = '<EOF>' unless $ret; | ||
| 1177 | |||
| 1178 | print "yylex: tokener read '$yylast'\n" if $yydebug; | ||
| 1179 | return ($ret, $yylval); | ||
| 1180 | } | ||
| 1181 | |||
| 1182 | sub init_parser { | ||
| 1183 | my ($p) = shift; | ||
| 1184 | $file = shift; # for error message and to store in attribute card info | ||
| 1185 | $yylineno = 0; | ||
| 1186 | } | ||
| 1187 | |||
| 1188 | |||
| 1189 | ################################################################# | ||
| 1190 | # | ||
| 1191 | # Routines usefull during the parsing | ||
| 1192 | # | ||
| 1193 | ################################################################# | ||
| 1194 | |||
| 1195 | # | ||
| 1196 | # -> merge_flag | ||
| 1197 | # | ||
| 1198 | |||
| 1199 | sub merge_flag { | ||
| 1200 | my ($flag, $new) = @_; | ||
| 1201 | |||
| 1202 | # merge the debug | ||
| 1203 | unless (defined $flag->{debug}) { | ||
| 1204 | $flag->{debug} = [0, 0]; | ||
| 1205 | } | ||
| 1206 | |||
| 1207 | if (defined $new->{debug}) { | ||
| 1208 | |||
| 1209 | my $set = ($flag->{debug}->[DTM_SET] & | ||
| 1210 | ~$new->{debug}->[DTM_CLEAR]) | | ||
| 1211 | $new->{debug}->[DTM_SET]; | ||
| 1212 | my $clear = ($flag->{debug}->[DTM_CLEAR] & | ||
| 1213 | ~$new->{debug}->[DTM_SET]) | | ||
| 1214 | $new->{debug}->[DTM_CLEAR]; | ||
| 1215 | |||
| 1216 | $flag->{debug}->[DTM_SET] = $set; | ||
| 1217 | $flag->{debug}->[DTM_CLEAR] = $clear; | ||
| 1218 | } | ||
| 1219 | |||
| 1220 | # merge the trace | ||
| 1221 | unless (defined $flag->{trace}) { | ||
| 1222 | $flag->{trace} = [0, 0]; | ||
| 1223 | } | ||
| 1224 | |||
| 1225 | if (defined $new->{trace}) { | ||
| 1226 | |||
| 1227 | my $set = ($flag->{trace}->[DTM_SET] & | ||
| 1228 | ~$new->{trace}->[DTM_CLEAR]) | | ||
| 1229 | $new->{trace}->[DTM_SET]; | ||
| 1230 | my $clear = ($flag->{trace}->[DTM_CLEAR] & | ||
| 1231 | ~$new->{trace}->[DTM_SET]) | | ||
| 1232 | $new->{trace}->[DTM_CLEAR]; | ||
| 1233 | |||
| 1234 | $flag->{trace}->[DTM_SET] = $set; | ||
| 1235 | $flag->{trace}->[DTM_CLEAR] = $clear; | ||
| 1236 | } | ||
| 1237 | |||
| 1238 | # merge args level | ||
| 1239 | unless (defined $flag->{args}) { | ||
| 1240 | $flag->{args} = -1; | ||
| 1241 | } | ||
| 1242 | |||
| 1243 | if (defined $new->{args}) { | ||
| 1244 | $flag->{args} = $new->{args}; | ||
| 1245 | } | ||
| 1246 | } | ||
| 1247 | |||
| 1248 | |||
| 1249 | sub less { | ||
| 1250 | my $flag = shift; | ||
| 1251 | return ($flag - 1); | ||
| 1252 | } | ||
| 1253 | |||
| 1254 | sub less_or_equal { | ||
| 1255 | my $flag = shift; | ||
| 1256 | return less($flag) | $flag; | ||
| 1257 | } | ||
| 1258 | |||
| 1259 | sub greater { | ||
| 1260 | return ~(less_or_equal(@_)); | ||
| 1261 | } | ||
| 1262 | |||
| 1263 | sub greater_or_equal { | ||
| 1264 | my $flag = shift; | ||
| 1265 | return greater_or_equal($flag) | $flag; | ||
| 1266 | } | ||
| 1267 | |||
| 1268 | 1; | ||
| 1269 | #line 1267 "Parser.pm" | ||
| 1270 | 1; |