ROOTPWA
keyParse.cc
Go to the documentation of this file.
1 /* A Bison parser, made by GNU Bison 1.875d. */
2 
3 /* Skeleton parser for Yacc-like parsing with Bison,
4  Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2, or (at your option)
9  any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program; if not, write to the Free Software
18  Foundation, Inc., 59 Temple Place - Suite 330,
19  Boston, MA 02111-1307, USA. */
20 
21 /* As a special exception, when this file is copied by Bison into a
22  Bison output file, you may use that output file without restriction.
23  This special exception was added by the Free Software Foundation
24  in version 1.24 of Bison. */
25 
26 /* Written by Richard Stallman by simplifying the original so called
27  ``semantic'' parser. */
28 
29 /* All symbols defined below should begin with yy or YY, to avoid
30  infringing on user name space. This should be done even for local
31  variables, as they might otherwise be expanded by user macros.
32  There are some unavoidable exceptions within include files to
33  define necessary library symbols; they are noted "INFRINGES ON
34  USER NAME SPACE" below. */
35 
36 /* Identify Bison output. */
37 #define YYBISON 1
38 
39 /* Skeleton name. */
40 #define YYSKELETON_NAME "yacc.c"
41 
42 /* Pure parsers. */
43 #define YYPURE 0
44 
45 /* Using locations. */
46 #define YYLSP_NEEDED 0
47 
48 /* If NAME_PREFIX is specified substitute the variables and functions
49  names. */
50 #define yyparse keyparse
51 #define yylex keylex
52 #define yyerror keyerror
53 #define yylval keylval
54 #define yychar keychar
55 #define yydebug keydebug
56 #define yynerrs keynerrs
57 
58 
59 /* Tokens. */
60 #ifndef YYTOKENTYPE
61 # define YYTOKENTYPE
62 /* Put the tokens into the symbol table, so that GDB and other debuggers
63  know about them. */
65  INT = 258,
66  FLOAT = 259,
67  COMPLEX = 260,
68  SIGN = 261,
69  STRING = 262,
70  PARTICLENAME = 263,
71  DEBUG = 264,
72  CHANNEL = 265,
73  MODE = 266,
74  MASSDEP = 267,
75  HELICITY = 268
76 };
77 #endif
78 #define INT 258
79 #define FLOAT 259
80 #define COMPLEX 260
81 #define SIGN 261
82 #define STRING 262
83 #define PARTICLENAME 263
84 #define DEBUG 264
85 #define CHANNEL 265
86 #define MODE 266
87 #define MASSDEP 267
88 #define HELICITY 268
89 
90 
91 
92 
93 /* Copy the first part of user declarations. */
94 #include <iostream>
95 
96 #include "particle.h"
97 #include "wave.h"
98 #include "event.h"
99 #include "keyfile.h"
100 #include "massDep.h"
101 #define stoi(x) strcmp((x),"+")?-1:1
102 
103 using namespace std;
104 
105 int yylex(void);
106 void yyerror(const char* s);
107 #define YYDEBUG 1
108 
109 int nwave;
110 int debug = 0;
111 string mode;
112 
113 extern int lineno;
115 
117 extern event gEvent;
118 extern bool gSuppressKeyParseOutput;
119 complex<double> gAmplitude;
120 
121 string t_part_init;
123 
124 
125 
126 /* Enabling traces. */
127 #ifndef YYDEBUG
128 # define YYDEBUG 0
129 #endif
130 
131 /* Enabling verbose error messages. */
132 #ifdef YYERROR_VERBOSE
133 # undef YYERROR_VERBOSE
134 # define YYERROR_VERBOSE 1
135 #else
136 # define YYERROR_VERBOSE 0
137 #endif
138 
139 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
140 typedef union YYSTYPE {
141  int num;
142  std::complex<double>* Cnum;
143  double Fnum;
144  char string[100];
147 } YYSTYPE;
148 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
149 # define YYSTYPE_IS_DECLARED 1
150 # define YYSTYPE_IS_TRIVIAL 1
151 #endif
152 
153 
154 
155 /* Copy the second part of user declarations. */
156 #if ! defined (yyoverflow) || YYERROR_VERBOSE
157 
158 # ifndef YYFREE
159 # define YYFREE free
160 # endif
161 # ifndef YYMALLOC
162 # define YYMALLOC malloc
163 # endif
164 
165 /* The parser invokes alloca or malloc; define the necessary symbols. */
166 
167 # ifdef YYSTACK_USE_ALLOCA
168 # if YYSTACK_USE_ALLOCA
169 # define YYSTACK_ALLOC alloca
170 # endif
171 # else
172 # if defined (alloca) || defined (_ALLOCA_H)
173 # define YYSTACK_ALLOC alloca
174 # else
175 # ifdef __GNUC__
176 # define YYSTACK_ALLOC __builtin_alloca
177 # endif
178 # endif
179 # endif
180 
181 # ifdef YYSTACK_ALLOC
182 /* Pacify GCC's `empty if-body' warning. */
183 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
184 # else
185 # if defined (__STDC__) || defined (__cplusplus)
186 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
187 # define YYSIZE_T size_t
188 # endif
189 # define YYSTACK_ALLOC YYMALLOC
190 # define YYSTACK_FREE YYFREE
191 # endif
192 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
193 
194 
195 #if (! defined (yyoverflow) \
196  && (! defined (__cplusplus) \
197  || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
198 
199 /* A type that is properly aligned for any stack member. */
200 union yyalloc
201 {
202  short int yyss;
204 };
205 
206 /* The size of the maximum gap between one aligned stack and the next. */
207 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
208 
209 /* The size of an array large to enough to hold all stacks, each with
210  N elements. */
211 # define YYSTACK_BYTES(N) \
212  ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
213  + YYSTACK_GAP_MAXIMUM)
214 
215 /* Copy COUNT objects from FROM to TO. The source and destination do
216  not overlap. */
217 # ifndef YYCOPY
218 # if defined (__GNUC__) && 1 < __GNUC__
219 # define YYCOPY(To, From, Count) \
220  __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
221 # else
222 # define YYCOPY(To, From, Count) \
223  do \
224  { \
225  register YYSIZE_T yyi; \
226  for (yyi = 0; yyi < (Count); yyi++) \
227  (To)[yyi] = (From)[yyi]; \
228  } \
229  while (0)
230 # endif
231 # endif
232 
233 /* Relocate STACK from its old location to the new one. The
234  local variables YYSIZE and YYSTACKSIZE give the old and new number of
235  elements in the stack, and YYPTR gives the new location of the
236  stack. Advance YYPTR to a properly aligned location for the next
237  stack. */
238 # define YYSTACK_RELOCATE(Stack) \
239  do \
240  { \
241  YYSIZE_T yynewbytes; \
242  YYCOPY (&yyptr->Stack, Stack, yysize); \
243  Stack = &yyptr->Stack; \
244  yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
245  yyptr += yynewbytes / sizeof (*yyptr); \
246  } \
247  while (0)
248 
249 #endif
250 
251 #if defined (__STDC__) || defined (__cplusplus)
252 typedef signed char yysigned_char;
253 #else
254 typedef short int yysigned_char;
255 #endif
256 
257 /* YYFINAL -- State number of the termination state. */
258 #define YYFINAL 2
259 /* YYLAST -- Last index in YYTABLE. */
260 #define YYLAST 91
261 
262 /* YYNTOKENS -- Number of terminals. */
263 #define YYNTOKENS 27
264 /* YYNNTS -- Number of nonterminals. */
265 #define YYNNTS 14
266 /* YYNRULES -- Number of rules. */
267 #define YYNRULES 37
268 /* YYNRULES -- Number of states. */
269 #define YYNSTATES 89
270 
271 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
272 #define YYUNDEFTOK 2
273 #define YYMAXUTOK 268
274 
275 #define YYTRANSLATE(YYX) \
276  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
277 
278 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
279 static const unsigned char yytranslate[] =
280  {
281  0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
282  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
283  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
284  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
285  20, 21, 16, 14, 19, 15, 2, 2, 26, 2,
286  2, 2, 2, 2, 2, 2, 2, 2, 2, 18,
287  2, 17, 2, 2, 2, 2, 2, 2, 2, 2,
288  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
289  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
290  2, 24, 2, 25, 2, 2, 2, 2, 2, 2,
291  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
292  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
293  2, 2, 2, 22, 2, 23, 2, 2, 2, 2,
294  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
295  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
296  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
297  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
298  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
299  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
300  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
301  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
302  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
303  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
304  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
305  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
306  2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
307  5, 6, 7, 8, 9, 10, 11, 12, 13
308  };
309 
310 #if YYDEBUG
311 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
312  YYRHS. */
313 static const unsigned char yyprhs[] =
314  {
315  0, 0, 3, 4, 7, 12, 17, 22, 29, 32,
316  34, 38, 42, 46, 50, 54, 57, 59, 61, 65,
317  69, 75, 83, 91, 102, 109, 116, 118, 121, 127,
318  129, 134, 136, 141, 143, 146, 149, 152
319  };
320 
321 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
322 static const yysigned_char yyrhs[] =
323  {
324  28, 0, -1, -1, 28, 29, -1, 9, 17, 3,
325  18, -1, 10, 17, 7, 18, -1, 11, 17, 7,
326  18, -1, 7, 17, 7, 19, 38, 18, -1, 30,
327  18, -1, 31, -1, 20, 30, 21, -1, 30, 14,
328  30, -1, 30, 15, 30, -1, 4, 16, 30, -1,
329  40, 16, 30, -1, 32, 35, -1, 35, -1, 33,
330  -1, 34, 34, 34, -1, 7, 17, 3, -1, 22,
331  36, 36, 3, 23, -1, 22, 36, 36, 7, 17,
332  3, 23, -1, 22, 36, 36, 7, 17, 4, 23,
333  -1, 22, 36, 36, 7, 17, 3, 7, 17, 3,
334  23, -1, 22, 36, 36, 3, 3, 23, -1, 22,
335  36, 36, 36, 3, 23, -1, 37, -1, 37, 35,
336  -1, 37, 35, 12, 17, 7, -1, 38, -1, 38,
337  13, 17, 3, -1, 39, -1, 39, 24, 3, 25,
338  -1, 8, -1, 8, 14, -1, 8, 15, -1, 8,
339  26, -1, 20, 4, 19, 4, 21, -1
340  };
341 
342 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
343 static const unsigned short int yyrline[] =
344  {
345  0, 62, 62, 63, 66, 69, 72, 75, 79, 94,
346  98, 106, 115, 124, 132, 142, 164, 210, 214, 218,
347  225, 235, 253, 270, 294, 304, 318, 321, 328, 354,
348  357, 363, 366, 372, 376, 380, 384, 390
349  };
350 #endif
351 
352 #if YYDEBUG || YYERROR_VERBOSE
353 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
354  First, the terminals, then, starting at YYNTOKENS, nonterminals. */
355 static const char *const yytname[] =
356  {
357  "$end", "error", "$undefined", "INT", "FLOAT", "COMPLEX", "SIGN",
358  "STRING", "PARTICLENAME", "DEBUG", "CHANNEL", "MODE", "MASSDEP",
359  "HELICITY", "'+'", "'-'", "'*'", "'='", "';'", "','", "'('", "')'",
360  "'{'", "'}'", "'['", "']'", "'0'", "$accept", "input", "statement",
361  "waveexp", "wave", "resonance", "quantum_nums", "quantum_num", "decay",
362  "particle", "pstate", "particleID", "particleCharge", "complex", 0
363  };
364 #endif
365 
366 # ifdef YYPRINT
367 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
368  token YYLEX-NUM. */
369 static const unsigned short int yytoknum[] =
370  {
371  0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
372  265, 266, 267, 268, 43, 45, 42, 61, 59, 44,
373  40, 41, 123, 125, 91, 93, 48
374  };
375 # endif
376 
377 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
378 static const unsigned char yyr1[] =
379  {
380  0, 27, 28, 28, 29, 29, 29, 29, 29, 30,
381  30, 30, 30, 30, 30, 31, 31, 32, 33, 34,
382  35, 35, 35, 35, 35, 35, 36, 36, 36, 37,
383  37, 38, 38, 39, 39, 39, 39, 40
384  };
385 
386 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
387 static const unsigned char yyr2[] =
388  {
389  0, 2, 0, 2, 4, 4, 4, 6, 2, 1,
390  3, 3, 3, 3, 3, 2, 1, 1, 3, 3,
391  5, 7, 7, 10, 6, 6, 1, 2, 5, 1,
392  4, 1, 4, 1, 2, 2, 2, 5
393  };
394 
395 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
396  STATE-NUM when YYTABLE doesn't specify something else to do. Zero
397  means the default is an error. */
398 static const unsigned char yydefact[] =
399  {
400  2, 0, 1, 0, 0, 0, 0, 0, 0, 0,
401  3, 0, 9, 0, 17, 0, 16, 0, 0, 0,
402  0, 0, 0, 0, 0, 0, 33, 0, 26, 29,
403  31, 0, 0, 8, 15, 0, 0, 13, 19, 0,
404  0, 0, 0, 0, 0, 10, 34, 35, 36, 0,
405  27, 0, 0, 11, 12, 18, 14, 0, 4, 5,
406  6, 0, 0, 0, 0, 0, 0, 0, 0, 37,
407  0, 20, 0, 0, 0, 30, 32, 7, 24, 0,
408  0, 25, 28, 0, 21, 22, 0, 0, 23
409  };
410 
411 /* YYDEFGOTO[NTERM-NUM]. */
412 static const yysigned_char yydefgoto[] =
413  {
414  -1, 1, 10, 11, 12, 13, 14, 15, 16, 27,
415  28, 29, 30, 17
416  };
417 
418 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
419  STATE-NUM. */
420 #define YYPACT_NINF -24
421 static const yysigned_char yypact[] =
422  {
423  -24, 5, -24, -10, 1, 24, 38, 39, 13, 46,
424  -24, -7, -24, -9, -24, 23, -24, 41, 25, 37,
425  55, 52, 53, 34, 44, 28, 22, 46, -9, 49,
426  40, 25, 25, -24, -24, 23, 25, -24, -24, 47,
427  45, 50, 51, 61, 64, -24, -24, -24, -24, 31,
428  58, 54, 69, -24, -24, -24, -24, 46, -24, -24,
429  -24, 56, -2, 57, 70, 59, 72, 60, 62, -24,
430  63, -24, 48, 65, 71, -24, -24, -24, -24, -4,
431  66, -24, -24, 67, -24, -24, 76, 68, -24
432  };
433 
434 /* YYPGOTO[NTERM-NUM]. */
435 static const yysigned_char yypgoto[] =
436  {
437  -24, -24, -24, -8, -24, -24, -24, -13, 18, -23,
438  -24, 26, -24, -24
439  };
440 
441 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
442  positive, shift that token. If negative, reduce the rule which
443  number is the opposite. If zero, do what YYDEFACT says.
444  If YYTABLE_NINF, syntax error. */
445 #define YYTABLE_NINF -1
446 static const unsigned char yytable[] =
447  {
448  25, 70, 35, 83, 49, 2, 18, 31, 32, 3,
449  37, 33, 4, 9, 5, 6, 7, 23, 19, 84,
450  24, 71, 55, 53, 54, 8, 64, 9, 56, 3,
451  24, 34, 24, 8, 62, 9, 46, 47, 63, 26,
452  38, 20, 31, 32, 39, 8, 50, 9, 48, 45,
453  18, 79, 80, 43, 26, 21, 22, 36, 40, 41,
454  42, 44, 51, 58, 52, 61, 57, 38, 59, 60,
455  65, 66, 67, 73, 72, 75, 74, 69, 82, 87,
456  77, 0, 0, 68, 86, 76, 78, 0, 81, 85,
457  0, 88
458  };
459 
460 static const yysigned_char yycheck[] =
461  {
462  8, 3, 15, 7, 27, 0, 16, 14, 15, 4,
463  18, 18, 7, 22, 9, 10, 11, 4, 17, 23,
464  7, 23, 35, 31, 32, 20, 49, 22, 36, 4,
465  7, 13, 7, 20, 3, 22, 14, 15, 7, 8,
466  3, 17, 14, 15, 7, 20, 28, 22, 26, 21,
467  16, 3, 4, 19, 8, 17, 17, 16, 3, 7,
468  7, 17, 13, 18, 24, 4, 19, 3, 18, 18,
469  12, 17, 3, 3, 17, 3, 17, 21, 7, 3,
470  18, -1, -1, 57, 17, 25, 23, -1, 23, 23,
471  -1, 23
472  };
473 
474 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
475  symbol of state STATE-NUM. */
476 static const unsigned char yystos[] =
477  {
478  0, 28, 0, 4, 7, 9, 10, 11, 20, 22,
479  29, 30, 31, 32, 33, 34, 35, 40, 16, 17,
480  17, 17, 17, 4, 7, 30, 8, 36, 37, 38,
481  39, 14, 15, 18, 35, 34, 16, 30, 3, 7,
482  3, 7, 7, 19, 17, 21, 14, 15, 26, 36,
483  35, 13, 24, 30, 30, 34, 30, 19, 18, 18,
484  18, 4, 3, 7, 36, 12, 17, 3, 38, 21,
485  3, 23, 17, 3, 17, 3, 25, 18, 23, 3,
486  4, 23, 7, 7, 23, 23, 17, 3, 23
487  };
488 
489 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
490 # define YYSIZE_T __SIZE_TYPE__
491 #endif
492 #if ! defined (YYSIZE_T) && defined (size_t)
493 # define YYSIZE_T size_t
494 #endif
495 #if ! defined (YYSIZE_T)
496 # if defined (__STDC__) || defined (__cplusplus)
497 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
498 # define YYSIZE_T size_t
499 # endif
500 #endif
501 #if ! defined (YYSIZE_T)
502 # define YYSIZE_T unsigned int
503 #endif
504 
505 #define yyerrok (yyerrstatus = 0)
506 #define yyclearin (yychar = YYEMPTY)
507 #define YYEMPTY (-2)
508 #define YYEOF 0
509 
510 #define YYACCEPT goto yyacceptlab
511 #define YYABORT goto yyabortlab
512 #define YYERROR goto yyerrorlab
513 
514 
515 /* Like YYERROR except do call yyerror. This remains here temporarily
516  to ease the transition to the new meaning of YYERROR, for GCC.
517  Once GCC version 2 has supplanted version 1, this can go. */
518 
519 #define YYFAIL goto yyerrlab
520 
521 #define YYRECOVERING() (!!yyerrstatus)
522 
523 #define YYBACKUP(Token, Value) \
524  do \
525  if (yychar == YYEMPTY && yylen == 1) \
526  { \
527  yychar = (Token); \
528  yylval = (Value); \
529  yytoken = YYTRANSLATE (yychar); \
530  YYPOPSTACK; \
531  goto yybackup; \
532  } \
533  else \
534  { \
535  yyerror ("syntax error: cannot back up"); \
536  YYERROR; \
537  } \
538  while (0)
539 
540 #define YYTERROR 1
541 #define YYERRCODE 256
542 
543 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
544  are run). */
545 
546 #ifndef YYLLOC_DEFAULT
547 # define YYLLOC_DEFAULT(Current, Rhs, N) \
548  ((Current).first_line = (Rhs)[1].first_line, \
549  (Current).first_column = (Rhs)[1].first_column, \
550  (Current).last_line = (Rhs)[N].last_line, \
551  (Current).last_column = (Rhs)[N].last_column)
552 #endif
553 
554 /* YYLEX -- calling `yylex' with the right arguments. */
555 
556 #ifdef YYLEX_PARAM
557 # define YYLEX yylex (YYLEX_PARAM)
558 #else
559 # define YYLEX yylex ()
560 #endif
561 
562 /* Enable debugging if requested. */
563 #if YYDEBUG
564 
565 # ifndef YYFPRINTF
566 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
567 # define YYFPRINTF fprintf
568 # endif
569 
570 # define YYDPRINTF(Args) \
571  do { \
572  if (yydebug) \
573  YYFPRINTF Args; \
574  } while (0)
575 
576 # define YYDSYMPRINT(Args) \
577  do { \
578  if (yydebug) \
579  yysymprint Args; \
580  } while (0)
581 
582 # define YYDSYMPRINTF(Title, Token, Value, Location) \
583  do { \
584  if (yydebug) \
585  { \
586  YYFPRINTF (stderr, "%s ", Title); \
587  yysymprint (stderr, \
588  Token, Value); \
589  YYFPRINTF (stderr, "\n"); \
590  } \
591  } while (0)
592 
593 /*------------------------------------------------------------------.
594  | yy_stack_print -- Print the state stack from its BOTTOM up to its |
595  | TOP (included). |
596  `------------------------------------------------------------------*/
597 
598 #if defined (__STDC__) || defined (__cplusplus)
599 static void
600 yy_stack_print (short int *bottom, short int *top)
601 #else
602  static void
603  yy_stack_print (bottom, top)
604  short int *bottom;
605 short int *top;
606 #endif
607 {
608  YYFPRINTF (stderr, "Stack now");
609  for (/* Nothing. */; bottom <= top; ++bottom)
610  YYFPRINTF (stderr, " %d", *bottom);
611  YYFPRINTF (stderr, "\n");
612 }
613 
614 # define YY_STACK_PRINT(Bottom, Top) \
615  do { \
616  if (yydebug) \
617  yy_stack_print ((Bottom), (Top)); \
618  } while (0)
619 
620 
621 /*------------------------------------------------.
622  | Report that the YYRULE is going to be reduced. |
623  `------------------------------------------------*/
624 
625 #if defined (__STDC__) || defined (__cplusplus)
626 static void
627 yy_reduce_print (int yyrule)
628 #else
629  static void
630  yy_reduce_print (yyrule)
631  int yyrule;
632 #endif
633 {
634  int yyi;
635  unsigned int yylno = yyrline[yyrule];
636  YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
637  yyrule - 1, yylno);
638  /* Print the symbols being reduced, and their result. */
639  for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
640  YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
641  YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
642 }
643 
644 # define YY_REDUCE_PRINT(Rule) \
645  do { \
646  if (yydebug) \
647  yy_reduce_print (Rule); \
648  } while (0)
649 
650 /* Nonzero means print parse trace. It is left uninitialized so that
651  multiple parsers can coexist. */
652 int yydebug;
653 #else /* !YYDEBUG */
654 # define YYDPRINTF(Args)
655 # define YYDSYMPRINT(Args)
656 # define YYDSYMPRINTF(Title, Token, Value, Location)
657 # define YY_STACK_PRINT(Bottom, Top)
658 # define YY_REDUCE_PRINT(Rule)
659 #endif /* !YYDEBUG */
660 
661 
662 /* YYINITDEPTH -- initial size of the parser's stacks. */
663 #ifndef YYINITDEPTH
664 # define YYINITDEPTH 200
665 #endif
666 
667 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
668  if the built-in stack extension method is used).
669 
670  Do not make this value too large; the results are undefined if
671  SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
672  evaluated with infinite-precision integer arithmetic. */
673 
674 #if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
675 # undef YYMAXDEPTH
676 #endif
677 
678 #ifndef YYMAXDEPTH
679 # define YYMAXDEPTH 10000
680 #endif
681 
682 
683 
684 #if YYERROR_VERBOSE
685 
686 # ifndef yystrlen
687 # if defined (__GLIBC__) && defined (_STRING_H)
688 # define yystrlen strlen
689 # else
690 /* Return the length of YYSTR. */
691 static YYSIZE_T
692 # if defined (__STDC__) || defined (__cplusplus)
693 yystrlen (const char *yystr)
694 # else
695  yystrlen (yystr)
696  const char *yystr;
697 # endif
698 {
699  register const char *yys = yystr;
700 
701  while (*yys++ != '\0')
702  continue;
703 
704  return yys - yystr - 1;
705 }
706 # endif
707 # endif
708 
709 # ifndef yystpcpy
710 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
711 # define yystpcpy stpcpy
712 # else
713 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
714  YYDEST. */
715 static char *
716 # if defined (__STDC__) || defined (__cplusplus)
717 yystpcpy (char *yydest, const char *yysrc)
718 # else
719  yystpcpy (yydest, yysrc)
720  char *yydest;
721 const char *yysrc;
722 # endif
723 {
724  register char *yyd = yydest;
725  register const char *yys = yysrc;
726 
727  while ((*yyd++ = *yys++) != '\0')
728  continue;
729 
730  return yyd - 1;
731 }
732 # endif
733 # endif
734 
735 #endif /* !YYERROR_VERBOSE */
736 
737 
738 
739 #if YYDEBUG
740 /*--------------------------------.
741  | Print this symbol on YYOUTPUT. |
742  `--------------------------------*/
743 
744 #if defined (__STDC__) || defined (__cplusplus)
745 static void
746 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
747 #else
748  static void
749  yysymprint (yyoutput, yytype, yyvaluep)
750  FILE *yyoutput;
751 int yytype;
752 YYSTYPE *yyvaluep;
753 #endif
754 {
755  /* Pacify ``unused variable'' warnings. */
756  (void) yyvaluep;
757 
758  if (yytype < YYNTOKENS)
759  {
760  YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
761 # ifdef YYPRINT
762  YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
763 # endif
764  }
765  else
766  YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
767 
768  switch (yytype)
769  {
770  default:
771  break;
772  }
773  YYFPRINTF (yyoutput, ")");
774 }
775 
776 #endif /* ! YYDEBUG */
777 /*-----------------------------------------------.
778  | Release the memory associated to this symbol. |
779  `-----------------------------------------------*/
780 
781 #if defined (__STDC__) || defined (__cplusplus)
782 static void
783 yydestruct (int yytype, YYSTYPE *yyvaluep)
784 #else
785  static void
786  yydestruct (yytype, yyvaluep)
787  int yytype;
788 YYSTYPE *yyvaluep;
789 #endif
790 {
791  /* Pacify ``unused variable'' warnings. */
792  (void) yyvaluep;
793 
794  switch (yytype)
795  {
796 
797  default:
798  break;
799  }
800 }
801 
802 
803 /* Prevent warnings from -Wmissing-prototypes. */
804 
805 #ifdef YYPARSE_PARAM
806 # if defined (__STDC__) || defined (__cplusplus)
807 int yyparse (void *YYPARSE_PARAM);
808 # else
809 int yyparse ();
810 # endif
811 #else /* ! YYPARSE_PARAM */
812 #if defined (__STDC__) || defined (__cplusplus)
813 int yyparse (void);
814 #else
815 int yyparse ();
816 #endif
817 #endif /* ! YYPARSE_PARAM */
818 
819 
820 
821 /* The lookahead symbol. */
822 int yychar;
823 
824 /* The semantic value of the lookahead symbol. */
826 
827 /* Number of syntax errors so far. */
829 
830 
831 
832 /*----------.
833  | yyparse. |
834  `----------*/
835 
836 #ifdef YYPARSE_PARAM
837 # if defined (__STDC__) || defined (__cplusplus)
838 int yyparse (void *YYPARSE_PARAM)
839 # else
840  int yyparse (YYPARSE_PARAM)
841  void *YYPARSE_PARAM;
842 # endif
843 #else /* ! YYPARSE_PARAM */
844 #if defined (__STDC__) || defined (__cplusplus)
845 int
846 yyparse (std::complex<double>& result)
847 #else
848  int
849  yyparse (std::complex<double>& result)
850 
851 #endif
852 #endif
853 {
854 
855  register int yystate;
856  register int yyn;
857  int yyresult;
858  /* Number of tokens to shift before error messages enabled. */
859  int yyerrstatus;
860  /* Lookahead token as an internal (translated) token number. */
861  int yytoken = 0;
862 
863  /* Three stacks and their tools:
864  `yyss': related to states,
865  `yyvs': related to semantic values,
866  `yyls': related to locations.
867 
868  Refer to the stacks thru separate pointers, to allow yyoverflow
869  to reallocate them elsewhere. */
870 
871  /* The state stack. */
872  short int yyssa[YYINITDEPTH];
873  short int *yyss = yyssa;
874  register short int *yyssp;
875 
876  /* The semantic value stack. */
877  YYSTYPE yyvsa[YYINITDEPTH];
878  YYSTYPE *yyvs = yyvsa;
879  register YYSTYPE *yyvsp;
880 
881 
882 
883 #define YYPOPSTACK (yyvsp--, yyssp--)
884 
885  YYSIZE_T yystacksize = YYINITDEPTH;
886 
887  /* The variables used to return semantic value and location from the
888  action routines. */
889  YYSTYPE yyval;
890 
891 
892  /* When reducing, the number of symbols on the RHS of the reduced
893  rule. */
894  int yylen;
895 
896  YYDPRINTF ((stderr, "Starting parse\n"));
897 
898  yystate = 0;
899  yyerrstatus = 0;
900  yynerrs = 0;
901  yychar = YYEMPTY; /* Cause a token to be read. */
902 
903  /* Initialize stack pointers.
904  Waste one element of value and location stack
905  so that they stay on the same level as the state stack.
906  The wasted elements are never initialized. */
907 
908  yyssp = yyss;
909  yyvsp = yyvs;
910 
911 
912  goto yysetstate;
913 
914  /*------------------------------------------------------------.
915  | yynewstate -- Push a new state, which is found in yystate. |
916  `------------------------------------------------------------*/
917  yynewstate:
918  /* In all cases, when you get here, the value and location stacks
919  have just been pushed. so pushing a state here evens the stacks.
920  */
921  yyssp++;
922 
923  yysetstate:
924  *yyssp = yystate;
925 
926  if (yyss + yystacksize - 1 <= yyssp)
927  {
928  /* Get the current used size of the three stacks, in elements. */
929  YYSIZE_T yysize = yyssp - yyss + 1;
930 
931 #ifdef yyoverflow
932  {
933  /* Give user a chance to reallocate the stack. Use copies of
934  these so that the &'s don't force the real ones into
935  memory. */
936  YYSTYPE *yyvs1 = yyvs;
937  short int *yyss1 = yyss;
938 
939 
940  /* Each stack pointer address is followed by the size of the
941  data in use in that stack, in bytes. This used to be a
942  conditional around just the two extra args, but that might
943  be undefined if yyoverflow is a macro. */
944  yyoverflow ("parser stack overflow",
945  &yyss1, yysize * sizeof (*yyssp),
946  &yyvs1, yysize * sizeof (*yyvsp),
947 
948  &yystacksize);
949 
950  yyss = yyss1;
951  yyvs = yyvs1;
952  }
953 #else /* no yyoverflow */
954 # ifndef YYSTACK_RELOCATE
955  goto yyoverflowlab;
956 # else
957  /* Extend the stack our own way. */
958  if (YYMAXDEPTH <= yystacksize)
959  goto yyoverflowlab;
960  yystacksize *= 2;
961  if (YYMAXDEPTH < yystacksize)
962  yystacksize = YYMAXDEPTH;
963 
964  {
965  short int *yyss1 = yyss;
966  union yyalloc *yyptr =
967  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
968  if (! yyptr)
969  goto yyoverflowlab;
970  YYSTACK_RELOCATE (yyss);
971  YYSTACK_RELOCATE (yyvs);
972 
973 # undef YYSTACK_RELOCATE
974  if (yyss1 != yyssa)
975  YYSTACK_FREE (yyss1);
976  }
977 # endif
978 #endif /* no yyoverflow */
979 
980  yyssp = yyss + yysize - 1;
981  yyvsp = yyvs + yysize - 1;
982 
983 
984  YYDPRINTF ((stderr, "Stack size increased to %lu\n",
985  (unsigned long int) yystacksize));
986 
987  if (yyss + yystacksize - 1 <= yyssp)
988  YYABORT;
989  }
990 
991  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
992 
993  goto yybackup;
994 
995  /*-----------.
996  | yybackup. |
997  `-----------*/
998  yybackup:
999 
1000  /* Do appropriate processing given the current state. */
1001  /* Read a lookahead token if we need one and don't already have one. */
1002  /* yyresume: */
1003 
1004  /* First try to decide what to do without reference to lookahead token. */
1005 
1006  yyn = yypact[yystate];
1007  if (yyn == YYPACT_NINF)
1008  goto yydefault;
1009 
1010  /* Not known => get a lookahead token if don't already have one. */
1011 
1012  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1013  if (yychar == YYEMPTY)
1014  {
1015  YYDPRINTF ((stderr, "Reading a token: "));
1016  yychar = YYLEX;
1017  }
1018 
1019  if (yychar <= YYEOF)
1020  {
1021  yychar = yytoken = YYEOF;
1022  YYDPRINTF ((stderr, "Now at end of input.\n"));
1023  }
1024  else
1025  {
1026  yytoken = YYTRANSLATE (yychar);
1027  YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
1028  }
1029 
1030  /* If the proper action on seeing token YYTOKEN is to reduce or to
1031  detect an error, take that action. */
1032  yyn += yytoken;
1033  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1034  goto yydefault;
1035  yyn = yytable[yyn];
1036  if (yyn <= 0)
1037  {
1038  if (yyn == 0 || yyn == YYTABLE_NINF)
1039  goto yyerrlab;
1040  yyn = -yyn;
1041  goto yyreduce;
1042  }
1043 
1044  if (yyn == YYFINAL)
1045  YYACCEPT;
1046 
1047  /* Shift the lookahead token. */
1048  YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
1049 
1050  /* Discard the token being shifted unless it is eof. */
1051  if (yychar != YYEOF)
1052  yychar = YYEMPTY;
1053 
1054  *++yyvsp = yylval;
1055 
1056 
1057  /* Count tokens shifted since error; after three, turn off error
1058  status. */
1059  if (yyerrstatus)
1060  yyerrstatus--;
1061 
1062  yystate = yyn;
1063  goto yynewstate;
1064 
1065 
1066  /*-----------------------------------------------------------.
1067  | yydefault -- do the default action for the current state. |
1068  `-----------------------------------------------------------*/
1069  yydefault:
1070  yyn = yydefact[yystate];
1071  if (yyn == 0)
1072  goto yyerrlab;
1073  goto yyreduce;
1074 
1075 
1076  /*-----------------------------.
1077  | yyreduce -- Do a reduction. |
1078  `-----------------------------*/
1079  yyreduce:
1080  /* yyn is the number of a rule to reduce with. */
1081  yylen = yyr2[yyn];
1082 
1083  /* If YYLEN is nonzero, implement the default value of the action:
1084  `$$ = $1'.
1085 
1086  Otherwise, the following line sets YYVAL to garbage.
1087  This behavior is undocumented and Bison
1088  users should not rely upon it. Assigning to YYVAL
1089  unconditionally makes the parser a bit smaller, and it avoids a
1090  GCC warning that YYVAL may be used uninitialized. */
1091  yyval = yyvsp[1-yylen];
1092 
1093 
1094  YY_REDUCE_PRINT (yyn);
1095  switch (yyn)
1096  {
1097  case 4:
1098  {
1099  debug = yyvsp[-1].num;
1100  }
1101  break;
1102 
1103  case 5:
1104  {
1105  gWave.channel(yyvsp[-1].string);
1106  }
1107  break;
1108 
1109  case 6:
1110  {
1111  mode = yyvsp[-1].string;
1112  }
1113  break;
1114 
1115  case 7:
1116  {
1117  t_part_init = yyvsp[-3].string;
1118  t_part_final = yyvsp[-1].Particle;
1119  }
1120  break;
1121 
1122  case 8:
1123  {
1124  result=*yyvsp[-1].Cnum;
1126  if (!gSuppressKeyParseOutput) {
1127  if (mode == "binary") {
1128  cout.write((char*) yyvsp[-1].Cnum,sizeof(complex<double>));
1129  }
1130  // else {
1131  else if (mode == "ascii") {
1132  cout << "Mass = " << ~(gWave.get4P()) << "\t";
1133  if ( gWave.channel() == "t" ) {
1134  cout << "t = " << (gEvent.beam().get4P()-gWave.get4P()).lenSq() << "\t";
1135  }
1136  cout << "Amp = " << *yyvsp[-1].Cnum << endl;
1137  }
1138  }
1139  delete yyvsp[-1].Cnum;
1140  }
1141  break;
1142 
1143  case 9:
1144  {
1145  yyval.Cnum = new complex<double>(*yyvsp[0].Cnum);
1146  delete(yyvsp[0].Cnum);
1147  }
1148  break;
1149 
1150  case 10:
1151  {
1152  yyval.Cnum = new complex<double>(*yyvsp[-1].Cnum);
1153  if (debug) {
1154  cout << " ( " << *yyvsp[-1].Cnum << " ) = " << *yyval.Cnum << endl;
1155  }
1156  delete(yyvsp[-1].Cnum);
1157  }
1158  break;
1159 
1160  case 11:
1161  {
1162  yyval.Cnum = new complex<double>(*yyvsp[-2].Cnum + *yyvsp[0].Cnum);
1163  if (debug) {
1164  cout << *yyvsp[-2].Cnum << " + " << *yyvsp[0].Cnum << " = " << *yyval.Cnum << endl;
1165  }
1166  delete(yyvsp[-2].Cnum);
1167  delete(yyvsp[0].Cnum);
1168  }
1169  break;
1170 
1171  case 12:
1172  {
1173  yyval.Cnum = new complex<double>(*yyvsp[-2].Cnum - *yyvsp[0].Cnum);
1174  if (debug) {
1175  cout << *yyvsp[-2].Cnum << " - " << *yyvsp[0].Cnum << " = " << *yyval.Cnum << endl;
1176  }
1177  delete(yyvsp[-2].Cnum);
1178  delete(yyvsp[0].Cnum);
1179  }
1180  break;
1181 
1182  case 13:
1183  {
1184  yyval.Cnum = new complex<double>(yyvsp[-2].Fnum * *yyvsp[0].Cnum);
1185  if (debug) {
1186  cout << yyvsp[-2].Fnum << " * " << *yyvsp[0].Cnum << " = " << *yyval.Cnum << endl;
1187  }
1188  delete(yyvsp[0].Cnum);
1189  }
1190  break;
1191 
1192  case 14:
1193  {
1194  yyval.Cnum = new complex<double>(*yyvsp[-2].Cnum * *yyvsp[0].Cnum);
1195  if (debug) {
1196  cout << *yyvsp[-2].Cnum << " * " << *yyvsp[0].Cnum << " = " << *yyval.Cnum << endl;
1197  }
1198  delete(yyvsp[-2].Cnum);
1199  delete(yyvsp[0].Cnum);
1200  }
1201  break;
1202 
1203  case 15:
1204  {
1205  gWave.setDecay(*yyvsp[0].Decay);
1206  delete yyvsp[0].Decay;
1207  if (debug) {
1208  cout << "@@Found a wave" << endl;
1209  gWave.print();
1210  cout << "@@Filling wave" << endl;
1211  }
1212  gWave.fill(gEvent, debug);
1213  if (debug) {
1214  cout << "@@Wave before boosts" << endl;
1215  gWave.print();
1216  }
1218  if (debug) {
1219  cout << "@@Wave after boosts" << endl;
1220  gWave.print();
1221  }
1223  yyval.Cnum = new complex<double>(gAmplitude);
1224  nwave++;
1225  }
1226  break;
1227 
1228  case 16:
1229  {
1230  gWave.setDecay(*yyvsp[0].Decay);
1231  delete yyvsp[0].Decay;
1232  if (debug) {
1233  cout << "@@Found a wave" << endl;
1234  gWave.print();
1235  cout << "@@Filling wave" << endl;
1236  }
1237  gWave.fill(gEvent, debug);
1238  if (debug) {
1239  cout << "@@Wave before boosts" << endl;
1240  gWave.print();
1241  }
1243  if (debug) {
1244  cout << "@@Wave after boosts" << endl;
1245  gWave.print();
1246  }
1247  if (debug) {
1248  cout << "This should compute decay amplitude expt wave" << endl;
1249  }
1250  double t = 0.0;
1251  fourVec t_init(0.0,threeVec(0.0,0.0,0.0));
1252  if (t_part_init == "beam") {
1253  t_init = gWave.getBeam();
1254  }
1255  else if (t_part_init == "target") {
1256  t_init = gWave.getTarget();
1257  }
1258  else {
1259  cerr << "unknown initial t specifier: " << t_part_init << endl;
1260  abort();
1261  }
1262  t = (t_init - *gWave.get4P(t_part_final, debug)).lenSq();
1263  if (debug) {
1264  cout << "calulating amplitude with t = " << t << endl;
1265  }
1266  delete t_part_final;
1267 
1268  gWave.setT(t);
1270  yyval.Cnum = new complex<double>(gAmplitude);
1271  nwave++;
1272  }
1273  break;
1274 
1275  case 17:
1276  {
1277  }
1278  break;
1279 
1280  case 18:
1281  {
1282  }
1283  break;
1284 
1285  case 19:
1286  {
1287  if(!strcmp(yyvsp[-2].string,"J")) gWave.setJ(yyvsp[0].num);
1288  if(!strcmp(yyvsp[-2].string,"M")) gWave.setM(yyvsp[0].num);
1289  if(!strcmp(yyvsp[-2].string,"P")) gWave.setP(yyvsp[0].num);
1290  }
1291  break;
1292 
1293  case 20:
1294  {
1295  decay* d = new decay;
1296  d->addChild(*yyvsp[-3].Particle);
1297  d->addChild(*yyvsp[-2].Particle);
1298  delete yyvsp[-3].Particle;
1299  delete yyvsp[-2].Particle;
1300  d->setL(yyvsp[-1].num);
1301  d->calculateS();
1302  yyval.Decay = d;
1303  }
1304  break;
1305 
1306  case 21:
1307  {
1308  decay* d = new decay;
1309  d->addChild(*yyvsp[-5].Particle);
1310  d->addChild(*yyvsp[-4].Particle);
1311  delete yyvsp[-5].Particle;
1312  delete yyvsp[-4].Particle;
1313  if(!strcmp(yyvsp[-3].string,"l")) {
1314  d->setL(yyvsp[-1].num);
1315  d->calculateS();
1316  }
1317  else {
1318  cerr << "unexpected field at line " << lineno << endl;
1319  cerr << "found \'" << yyvsp[-3].string << "\'" << endl;
1320  cerr << "expected \'l\'" << endl;
1321  exit(1);
1322  }
1323  yyval.Decay = d;
1324  }
1325  break;
1326 
1327  case 22:
1328  {
1329  decay* d = new decay;
1330  d->addChild(*yyvsp[-5].Particle);
1331  d->addChild(*yyvsp[-4].Particle);
1332  delete yyvsp[-5].Particle;
1333  delete yyvsp[-4].Particle;
1334  if(!strcmp(yyvsp[-3].string,"b")) {
1335  gWave.setSlope(yyvsp[-1].Fnum);
1336  }
1337  else {
1338  cerr << "unexpected field at line " << lineno << endl;
1339  cerr << "found \'" << yyvsp[-3].string << "\'" << endl;
1340  cerr << "expected \'b\'" << endl;
1341  exit(1);
1342  }
1343  yyval.Decay = d;
1344  }
1345  break;
1346 
1347  case 23:
1348  {
1349  decay* d = new decay;
1350  d->addChild(*yyvsp[-8].Particle);
1351  d->addChild(*yyvsp[-7].Particle);
1352  delete yyvsp[-8].Particle;
1353  delete yyvsp[-7].Particle;
1354  if(!strcmp(yyvsp[-6].string,"l")) {
1355  d->setL(yyvsp[-4].num);
1356  }
1357  else {
1358  cerr << "expecting \'l\' at line " << lineno << endl;
1359  cerr << "found \'" << yyvsp[-6].string << "\'" << endl;
1360  exit(1);
1361  }
1362  if(!strcmp(yyvsp[-3].string,"s")) {
1363  d->setS(yyvsp[-1].num);
1364  }
1365  else {
1366  cerr << "expecting \'l\' at line " << lineno << endl;
1367  cerr << "found \'" << yyvsp[-3].string << "\'" << endl;
1368  exit(1);
1369  }
1370  yyval.Decay = d;
1371  }
1372  break;
1373 
1374  case 24:
1375  {
1376  decay* d = new decay;
1377  d->addChild(*yyvsp[-4].Particle);
1378  d->addChild(*yyvsp[-3].Particle);
1379  delete yyvsp[-4].Particle;
1380  delete yyvsp[-3].Particle;
1381  d->setL(yyvsp[-2].num);
1382  d->setS(yyvsp[-1].num);
1383  yyval.Decay = d;
1384  }
1385  break;
1386 
1387  case 25:
1388  {
1389  decay* d = new decay;
1390  d->addChild(*yyvsp[-4].Particle);
1391  d->addChild(*yyvsp[-3].Particle);
1392  d->addChild(*yyvsp[-2].Particle);
1393  delete yyvsp[-4].Particle;
1394  delete yyvsp[-3].Particle;
1395  delete yyvsp[-2].Particle;
1396  d->setL(yyvsp[-1].num);
1397  d->calculateS();
1398  yyval.Decay = d;
1399  }
1400  break;
1401 
1402  case 26:
1403  {
1404  yyval.Particle = yyvsp[0].Particle;
1405  }
1406  break;
1407 
1408  case 27:
1409  {
1410  yyvsp[-1].Particle->setDecay(*yyvsp[0].Decay);
1411  massDep* bw = new breitWigner();
1412  yyvsp[-1].Particle->setMassDep(bw);
1413  delete yyvsp[0].Decay;
1414  yyval.Particle = yyvsp[-1].Particle;
1415  }
1416  break;
1417 
1418  case 28:
1419  {
1420  yyvsp[-4].Particle->setDecay(*yyvsp[-3].Decay);
1421  massDep* md;
1422  if (!strcmp(yyvsp[0].string,"bw")) {
1423  md = new breitWigner();
1424  }
1425  else if (!strcmp(yyvsp[0].string,"rhoprime")) {
1426  md = new rhoPrime();
1427  }
1428  else if (!strcmp(yyvsp[0].string,"amp")) {
1429  md = new AMP_M();
1430  }
1431  else if (!strcmp(yyvsp[0].string,"amp_ves")) {
1432  md = new AMP_ves();
1433  }
1434  else if (!strcmp(yyvsp[0].string,"amp_kach")) {
1435  md = new AMP_kach();
1436  }
1437  else if (!strcmp(yyvsp[0].string,"flat")) {
1438  md = new flat();
1439  }
1440  else if (!strncmp(yyvsp[0].string,"flatR",5)) {
1441  // extract Range from string
1442  // format : flatRXXXXtYYYY
1443  const char* expr=yyvsp[0].string;
1444  char dummy[4];
1445  strncpy(dummy,&expr[5],4);
1446  double low=atof(dummy);
1447  strncpy(dummy,&expr[10],4);
1448  // cerr << expr << endl;
1449  double high=atof(dummy);
1450  flatRange* r = new flatRange();
1451  r->setRange(low,high);
1452  //cerr << low << "-" << high << endl;
1453  md = r;
1454  }
1455  else if (!strcmp(yyvsp[0].string,"amp_lass")) {
1456  md = new AMP_LASS();
1457  }
1458  else {
1459  cerr << "unknown mass dependence: " << yyvsp[0].string;
1460  cerr << " at line " << lineno << endl;
1461  exit(1);
1462  }
1463  yyvsp[-4].Particle->setMassDep(md);
1464  delete yyvsp[-3].Decay;
1465  yyval.Particle = yyvsp[-4].Particle;
1466  }
1467  break;
1468 
1469  case 29:
1470  {
1471  yyval.Particle = yyvsp[0].Particle;
1472  }
1473  break;
1474 
1475  case 30:
1476  {
1477  yyvsp[-3].Particle->addHelicity(yyvsp[0].num);
1478  yyval.Particle = yyvsp[-3].Particle;
1479  }
1480  break;
1481 
1482  case 31:
1483  {
1484  yyval.Particle = yyvsp[0].Particle;
1485  }
1486  break;
1487 
1488  case 32:
1489  {
1490  yyvsp[-3].Particle->Index(yyvsp[-1].num);
1491  yyval.Particle = yyvsp[-3].Particle;
1492  }
1493  break;
1494 
1495  case 33:
1496  {
1497  particle* p = new particle(PDGtable.get(yyvsp[0].string),0);
1498  yyval.Particle = p;
1499  }
1500  break;
1501 
1502  case 34:
1503  {
1504  particle* p = new particle(PDGtable.get(yyvsp[-1].string),+1);
1505  yyval.Particle = p;
1506  }
1507  break;
1508 
1509  case 35:
1510  {
1511  particle* p = new particle(PDGtable.get(yyvsp[-1].string),-1);
1512  yyval.Particle = p;
1513  }
1514  break;
1515 
1516  case 36:
1517  {
1518  particle* p = new particle(PDGtable.get(yyvsp[-1].string),0);
1519  yyval.Particle = p;
1520  }
1521  break;
1522 
1523  case 37:
1524  {
1525  yyval.Cnum = new complex<double>(yyvsp[-3].Fnum,yyvsp[-1].Fnum);
1526  }
1527  break;
1528 
1529 
1530  }
1531 
1532 
1533  yyvsp -= yylen;
1534  yyssp -= yylen;
1535 
1536 
1537  YY_STACK_PRINT (yyss, yyssp);
1538 
1539  *++yyvsp = yyval;
1540 
1541 
1542  /* Now `shift' the result of the reduction. Determine what state
1543  that goes to, based on the state we popped back to and the rule
1544  number reduced by. */
1545 
1546  yyn = yyr1[yyn];
1547 
1548  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1549  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1550  yystate = yytable[yystate];
1551  else
1552  yystate = yydefgoto[yyn - YYNTOKENS];
1553 
1554  goto yynewstate;
1555 
1556 
1557  /*------------------------------------.
1558  | yyerrlab -- here on detecting error |
1559  `------------------------------------*/
1560  yyerrlab:
1561  /* If not already recovering from an error, report this error. */
1562  if (!yyerrstatus)
1563  {
1564  ++yynerrs;
1565 #if YYERROR_VERBOSE
1566  yyn = yypact[yystate];
1567 
1568  if (YYPACT_NINF < yyn && yyn < YYLAST)
1569  {
1570  YYSIZE_T yysize = 0;
1571  int yytype = YYTRANSLATE (yychar);
1572  const char* yyprefix;
1573  char *yymsg;
1574  int yyx;
1575 
1576  /* Start YYX at -YYN if negative to avoid negative indexes in
1577  YYCHECK. */
1578  int yyxbegin = yyn < 0 ? -yyn : 0;
1579 
1580  /* Stay within bounds of both yycheck and yytname. */
1581  int yychecklim = YYLAST - yyn;
1582  int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1583  int yycount = 0;
1584 
1585  yyprefix = ", expecting ";
1586  for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1587  if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1588  {
1589  yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
1590  yycount += 1;
1591  if (yycount == 5)
1592  {
1593  yysize = 0;
1594  break;
1595  }
1596  }
1597  yysize += (sizeof ("syntax error, unexpected ")
1598  + yystrlen (yytname[yytype]));
1599  yymsg = (char *) YYSTACK_ALLOC (yysize);
1600  if (yymsg != 0)
1601  {
1602  char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
1603  yyp = yystpcpy (yyp, yytname[yytype]);
1604 
1605  if (yycount < 5)
1606  {
1607  yyprefix = ", expecting ";
1608  for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1609  if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1610  {
1611  yyp = yystpcpy (yyp, yyprefix);
1612  yyp = yystpcpy (yyp, yytname[yyx]);
1613  yyprefix = " or ";
1614  }
1615  }
1616  yyerror (yymsg);
1617  YYSTACK_FREE (yymsg);
1618  }
1619  else
1620  yyerror ("syntax error; also virtual memory exhausted");
1621  }
1622  else
1623 #endif /* YYERROR_VERBOSE */
1624  yyerror ("syntax error");
1625  }
1626 
1627 
1628 
1629  if (yyerrstatus == 3)
1630  {
1631  /* If just tried and failed to reuse lookahead token after an
1632  error, discard it. */
1633 
1634  if (yychar <= YYEOF)
1635  {
1636  /* If at end of input, pop the error token,
1637  then the rest of the stack, then return failure. */
1638  if (yychar == YYEOF)
1639  for (;;)
1640  {
1641  YYPOPSTACK;
1642  if (yyssp == yyss)
1643  YYABORT;
1644  YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1645  yydestruct (yystos[*yyssp], yyvsp);
1646  }
1647  }
1648  else
1649  {
1650  YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
1651  yydestruct (yytoken, &yylval);
1652  yychar = YYEMPTY;
1653 
1654  }
1655  }
1656 
1657  /* Else will try to reuse lookahead token after shifting the error
1658  token. */
1659  goto yyerrlab1;
1660 
1661 
1662  /*---------------------------------------------------.
1663  | yyerrorlab -- error raised explicitly by YYERROR. |
1664  `---------------------------------------------------*/
1665  yyerrorlab:
1666 
1667 #ifdef __GNUC__
1668  /* Pacify GCC when the user code never invokes YYERROR and the label
1669  yyerrorlab therefore never appears in user code. */
1670  if (0)
1671  goto yyerrorlab;
1672 #endif
1673 
1674  yyvsp -= yylen;
1675  yyssp -= yylen;
1676  yystate = *yyssp;
1677  goto yyerrlab1;
1678 
1679 
1680  /*-------------------------------------------------------------.
1681  | yyerrlab1 -- common code for both syntax error and YYERROR. |
1682  `-------------------------------------------------------------*/
1683  yyerrlab1:
1684  yyerrstatus = 3; /* Each real token shifted decrements this. */
1685 
1686  for (;;)
1687  {
1688  yyn = yypact[yystate];
1689  if (yyn != YYPACT_NINF)
1690  {
1691  yyn += YYTERROR;
1692  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1693  {
1694  yyn = yytable[yyn];
1695  if (0 < yyn)
1696  break;
1697  }
1698  }
1699 
1700  /* Pop the current state because it cannot handle the error token. */
1701  if (yyssp == yyss)
1702  YYABORT;
1703 
1704  YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1705  yydestruct (yystos[yystate], yyvsp);
1706  YYPOPSTACK;
1707  yystate = *yyssp;
1708  YY_STACK_PRINT (yyss, yyssp);
1709  }
1710 
1711  if (yyn == YYFINAL)
1712  YYACCEPT;
1713 
1714  YYDPRINTF ((stderr, "Shifting error token, "));
1715 
1716  *++yyvsp = yylval;
1717 
1718 
1719  yystate = yyn;
1720  goto yynewstate;
1721 
1722 
1723  /*-------------------------------------.
1724  | yyacceptlab -- YYACCEPT comes here. |
1725  `-------------------------------------*/
1726  yyacceptlab:
1727  yyresult = 0;
1728  goto yyreturn;
1729 
1730  /*-----------------------------------.
1731  | yyabortlab -- YYABORT comes here. |
1732  `-----------------------------------*/
1733  yyabortlab:
1734  yyresult = 1;
1735  goto yyreturn;
1736 
1737 #ifndef yyoverflow
1738  /*----------------------------------------------.
1739  | yyoverflowlab -- parser overflow comes here. |
1740  `----------------------------------------------*/
1741  yyoverflowlab:
1742  yyerror ("parser stack overflow");
1743  yyresult = 2;
1744  /* Fall through. */
1745 #endif
1746 
1747  yyreturn:
1748 #ifndef yyoverflow
1749  if (yyss != yyssa)
1750  YYSTACK_FREE (yyss);
1751 #endif
1752  return yyresult;
1753 }