breakout_parser 0.0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,2164 @@
1
+
2
+ /* A Bison parser, made by GNU Bison 2.4.1. */
3
+
4
+ /* Skeleton implementation for Bison's Yacc-like parsers in C
5
+
6
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
7
+ Free Software Foundation, Inc.
8
+
9
+ This program is free software: you can redistribute it and/or modify
10
+ it under the terms of the GNU General Public License as published by
11
+ the Free Software Foundation, either version 3 of the License, or
12
+ (at your option) any later version.
13
+
14
+ This program is distributed in the hope that it will be useful,
15
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
+ GNU General Public License for more details.
18
+
19
+ You should have received a copy of the GNU General Public License
20
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
21
+
22
+ /* As a special exception, you may create a larger work that contains
23
+ part or all of the Bison parser skeleton and distribute that work
24
+ under terms of your choice, so long as that work isn't itself a
25
+ parser generator using the skeleton or a modified version thereof
26
+ as a parser skeleton. Alternatively, if you modify or redistribute
27
+ the parser skeleton itself, you may (at your option) remove this
28
+ special exception, which will cause the skeleton and the resulting
29
+ Bison output files to be licensed under the GNU General Public
30
+ License without this special exception.
31
+
32
+ This special exception was added by the Free Software Foundation in
33
+ version 2.2 of Bison. */
34
+
35
+ /* C LALR(1) parser skeleton written by Richard Stallman, by
36
+ simplifying the original so-called "semantic" parser. */
37
+
38
+ /* All symbols defined below should begin with yy or YY, to avoid
39
+ infringing on user name space. This should be done even for local
40
+ variables, as they might otherwise be expanded by user macros.
41
+ There are some unavoidable exceptions within include files to
42
+ define necessary library symbols; they are noted "INFRINGES ON
43
+ USER NAME SPACE" below. */
44
+
45
+ /* Identify Bison output. */
46
+ #define YYBISON 1
47
+
48
+ /* Bison version. */
49
+ #define YYBISON_VERSION "2.4.1"
50
+
51
+ /* Skeleton name. */
52
+ #define YYSKELETON_NAME "yacc.c"
53
+
54
+ /* Pure parsers. */
55
+ #define YYPURE 0
56
+
57
+ /* Push parsers. */
58
+ #define YYPUSH 0
59
+
60
+ /* Pull parsers. */
61
+ #define YYPULL 1
62
+
63
+ /* Using locations. */
64
+ #define YYLSP_NEEDED 0
65
+
66
+
67
+
68
+ /* Copy the first part of user declarations. */
69
+
70
+ /* Line 189 of yacc.c */
71
+ #line 1 "parser.y"
72
+
73
+ #include <stdio.h>
74
+ #include <stdlib.h>
75
+ #include <string.h>
76
+
77
+ #ifdef RUBY_VERSION
78
+ #include "ruby.h"
79
+ #else
80
+ #define REALLOC_N(ptr,type,n) ptr=realloc(ptr,sizeof(type)*n)
81
+ #endif
82
+
83
+ extern int yylex();
84
+
85
+ char *in_buf = NULL, *in_pos = NULL;
86
+ size_t in_buf_len = 0;
87
+
88
+ char *buf = NULL, *bufptr = NULL;
89
+ size_t bufsize = 0;
90
+ char *space_name = "test_space";
91
+
92
+ #define CHECK_BUF_SIZE(len) \
93
+ if( (bufptr - buf + len + 1) >= bufsize ){ \
94
+ /*printf("[.] REALLOC oldsz=%d, newsz=%d\n",bufsize, (bufsize+((len > 0x1000) ? (len+0x1000) : 0x1000)));*/ \
95
+ char *oldbuf = buf; \
96
+ bufsize += (len > 0x1000) ? (len+0x1000) : 0x1000; \
97
+ REALLOC_N(buf, char, bufsize); \
98
+ bufptr = buf + (bufptr-oldbuf); \
99
+ }
100
+
101
+ concat(const char*what, size_t len){
102
+ // printf("[.] concat: w=\"%s\", l=%d\n",what,len);
103
+ CHECK_BUF_SIZE(len);
104
+ memcpy(bufptr, what, len);
105
+ bufptr += len;
106
+ // printf("[.] concat OK\n");
107
+ }
108
+
109
+ // it's better to use concat(), especially if "what"'s length is always predefined
110
+ concat2(const char*what){
111
+ size_t len = strlen(what);
112
+ concat(what,len);
113
+ }
114
+
115
+ // better error reporting
116
+ #define YYERROR_VERBOSE
117
+
118
+ // more stacks
119
+ #define YYMAXDEPTH 0x180000
120
+
121
+ // bison requires that you supply this function
122
+ void yyerror(const char *msg)
123
+ {
124
+ printf("ERROR(PARSER): %s\n", msg);
125
+ }
126
+
127
+
128
+
129
+
130
+ /* Line 189 of yacc.c */
131
+ #line 132 "parser.tab.c"
132
+
133
+ /* Enabling traces. */
134
+ #ifndef YYDEBUG
135
+ # define YYDEBUG 0
136
+ #endif
137
+
138
+ /* Enabling verbose error messages. */
139
+ #ifdef YYERROR_VERBOSE
140
+ # undef YYERROR_VERBOSE
141
+ # define YYERROR_VERBOSE 1
142
+ #else
143
+ # define YYERROR_VERBOSE 0
144
+ #endif
145
+
146
+ /* Enabling the token table. */
147
+ #ifndef YYTOKEN_TABLE
148
+ # define YYTOKEN_TABLE 0
149
+ #endif
150
+
151
+
152
+ /* Tokens. */
153
+ #ifndef YYTOKENTYPE
154
+ # define YYTOKENTYPE
155
+ /* Put the tokens into the symbol table, so that GDB and other debuggers
156
+ know about them. */
157
+ enum yytokentype {
158
+ T_CHAR = 258,
159
+ BOLD_START = 259,
160
+ ITALIC_START = 260,
161
+ T_WORD = 261,
162
+ TICKET_LINK = 262,
163
+ LINK = 263,
164
+ SVN_REVISION_LINK = 264,
165
+ GIT_REVISION_LINK = 265,
166
+ WIKI_LINK = 266,
167
+ ANCHOR_LINK = 267,
168
+ URL_WITH_PROTO_LINK = 268,
169
+ URL_WITHOUT_PROTO_LINK = 269,
170
+ URL = 270,
171
+ UL = 271,
172
+ H1 = 272,
173
+ H2 = 273,
174
+ H3 = 274,
175
+ H4 = 275,
176
+ H5 = 276,
177
+ SPACE = 277,
178
+ BR = 278,
179
+ BRBR = 279,
180
+ OLI = 280,
181
+ ULI = 281,
182
+ PRE_START = 282,
183
+ PRE_END = 283,
184
+ BOLD_END = 284,
185
+ ITALIC_END = 285
186
+ };
187
+ #endif
188
+
189
+
190
+
191
+ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
192
+ typedef union YYSTYPE
193
+ {
194
+
195
+ /* Line 214 of yacc.c */
196
+ #line 59 "parser.y"
197
+
198
+ double dvalue;
199
+ int ivalue;
200
+ char const* svalue;
201
+
202
+
203
+
204
+ /* Line 214 of yacc.c */
205
+ #line 206 "parser.tab.c"
206
+ } YYSTYPE;
207
+ # define YYSTYPE_IS_TRIVIAL 1
208
+ # define yystype YYSTYPE /* obsolescent; will be withdrawn */
209
+ # define YYSTYPE_IS_DECLARED 1
210
+ #endif
211
+
212
+
213
+ /* Copy the second part of user declarations. */
214
+
215
+
216
+ /* Line 264 of yacc.c */
217
+ #line 218 "parser.tab.c"
218
+
219
+ #ifdef short
220
+ # undef short
221
+ #endif
222
+
223
+ #ifdef YYTYPE_UINT8
224
+ typedef YYTYPE_UINT8 yytype_uint8;
225
+ #else
226
+ typedef unsigned char yytype_uint8;
227
+ #endif
228
+
229
+ #ifdef YYTYPE_INT8
230
+ typedef YYTYPE_INT8 yytype_int8;
231
+ #elif (defined __STDC__ || defined __C99__FUNC__ \
232
+ || defined __cplusplus || defined _MSC_VER)
233
+ typedef signed char yytype_int8;
234
+ #else
235
+ typedef short int yytype_int8;
236
+ #endif
237
+
238
+ #ifdef YYTYPE_UINT16
239
+ typedef YYTYPE_UINT16 yytype_uint16;
240
+ #else
241
+ typedef unsigned short int yytype_uint16;
242
+ #endif
243
+
244
+ #ifdef YYTYPE_INT16
245
+ typedef YYTYPE_INT16 yytype_int16;
246
+ #else
247
+ typedef short int yytype_int16;
248
+ #endif
249
+
250
+ #ifndef YYSIZE_T
251
+ # ifdef __SIZE_TYPE__
252
+ # define YYSIZE_T __SIZE_TYPE__
253
+ # elif defined size_t
254
+ # define YYSIZE_T size_t
255
+ # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
256
+ || defined __cplusplus || defined _MSC_VER)
257
+ # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
258
+ # define YYSIZE_T size_t
259
+ # else
260
+ # define YYSIZE_T unsigned int
261
+ # endif
262
+ #endif
263
+
264
+ #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
265
+
266
+ #ifndef YY_
267
+ # if YYENABLE_NLS
268
+ # if ENABLE_NLS
269
+ # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
270
+ # define YY_(msgid) dgettext ("bison-runtime", msgid)
271
+ # endif
272
+ # endif
273
+ # ifndef YY_
274
+ # define YY_(msgid) msgid
275
+ # endif
276
+ #endif
277
+
278
+ /* Suppress unused-variable warnings by "using" E. */
279
+ #if ! defined lint || defined __GNUC__
280
+ # define YYUSE(e) ((void) (e))
281
+ #else
282
+ # define YYUSE(e) /* empty */
283
+ #endif
284
+
285
+ /* Identity function, used to suppress warnings about constant conditions. */
286
+ #ifndef lint
287
+ # define YYID(n) (n)
288
+ #else
289
+ #if (defined __STDC__ || defined __C99__FUNC__ \
290
+ || defined __cplusplus || defined _MSC_VER)
291
+ static int
292
+ YYID (int yyi)
293
+ #else
294
+ static int
295
+ YYID (yyi)
296
+ int yyi;
297
+ #endif
298
+ {
299
+ return yyi;
300
+ }
301
+ #endif
302
+
303
+ #if ! defined yyoverflow || YYERROR_VERBOSE
304
+
305
+ /* The parser invokes alloca or malloc; define the necessary symbols. */
306
+
307
+ # ifdef YYSTACK_USE_ALLOCA
308
+ # if YYSTACK_USE_ALLOCA
309
+ # ifdef __GNUC__
310
+ # define YYSTACK_ALLOC __builtin_alloca
311
+ # elif defined __BUILTIN_VA_ARG_INCR
312
+ # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
313
+ # elif defined _AIX
314
+ # define YYSTACK_ALLOC __alloca
315
+ # elif defined _MSC_VER
316
+ # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
317
+ # define alloca _alloca
318
+ # else
319
+ # define YYSTACK_ALLOC alloca
320
+ # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
321
+ || defined __cplusplus || defined _MSC_VER)
322
+ # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
323
+ # ifndef _STDLIB_H
324
+ # define _STDLIB_H 1
325
+ # endif
326
+ # endif
327
+ # endif
328
+ # endif
329
+ # endif
330
+
331
+ # ifdef YYSTACK_ALLOC
332
+ /* Pacify GCC's `empty if-body' warning. */
333
+ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
334
+ # ifndef YYSTACK_ALLOC_MAXIMUM
335
+ /* The OS might guarantee only one guard page at the bottom of the stack,
336
+ and a page size can be as small as 4096 bytes. So we cannot safely
337
+ invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
338
+ to allow for a few compiler-allocated temporary stack slots. */
339
+ # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
340
+ # endif
341
+ # else
342
+ # define YYSTACK_ALLOC YYMALLOC
343
+ # define YYSTACK_FREE YYFREE
344
+ # ifndef YYSTACK_ALLOC_MAXIMUM
345
+ # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
346
+ # endif
347
+ # if (defined __cplusplus && ! defined _STDLIB_H \
348
+ && ! ((defined YYMALLOC || defined malloc) \
349
+ && (defined YYFREE || defined free)))
350
+ # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
351
+ # ifndef _STDLIB_H
352
+ # define _STDLIB_H 1
353
+ # endif
354
+ # endif
355
+ # ifndef YYMALLOC
356
+ # define YYMALLOC malloc
357
+ # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
358
+ || defined __cplusplus || defined _MSC_VER)
359
+ void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
360
+ # endif
361
+ # endif
362
+ # ifndef YYFREE
363
+ # define YYFREE free
364
+ # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
365
+ || defined __cplusplus || defined _MSC_VER)
366
+ void free (void *); /* INFRINGES ON USER NAME SPACE */
367
+ # endif
368
+ # endif
369
+ # endif
370
+ #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
371
+
372
+
373
+ #if (! defined yyoverflow \
374
+ && (! defined __cplusplus \
375
+ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
376
+
377
+ /* A type that is properly aligned for any stack member. */
378
+ union yyalloc
379
+ {
380
+ yytype_int16 yyss_alloc;
381
+ YYSTYPE yyvs_alloc;
382
+ };
383
+
384
+ /* The size of the maximum gap between one aligned stack and the next. */
385
+ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
386
+
387
+ /* The size of an array large to enough to hold all stacks, each with
388
+ N elements. */
389
+ # define YYSTACK_BYTES(N) \
390
+ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
391
+ + YYSTACK_GAP_MAXIMUM)
392
+
393
+ /* Copy COUNT objects from FROM to TO. The source and destination do
394
+ not overlap. */
395
+ # ifndef YYCOPY
396
+ # if defined __GNUC__ && 1 < __GNUC__
397
+ # define YYCOPY(To, From, Count) \
398
+ __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
399
+ # else
400
+ # define YYCOPY(To, From, Count) \
401
+ do \
402
+ { \
403
+ YYSIZE_T yyi; \
404
+ for (yyi = 0; yyi < (Count); yyi++) \
405
+ (To)[yyi] = (From)[yyi]; \
406
+ } \
407
+ while (YYID (0))
408
+ # endif
409
+ # endif
410
+
411
+ /* Relocate STACK from its old location to the new one. The
412
+ local variables YYSIZE and YYSTACKSIZE give the old and new number of
413
+ elements in the stack, and YYPTR gives the new location of the
414
+ stack. Advance YYPTR to a properly aligned location for the next
415
+ stack. */
416
+ # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
417
+ do \
418
+ { \
419
+ YYSIZE_T yynewbytes; \
420
+ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
421
+ Stack = &yyptr->Stack_alloc; \
422
+ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
423
+ yyptr += yynewbytes / sizeof (*yyptr); \
424
+ } \
425
+ while (YYID (0))
426
+
427
+ #endif
428
+
429
+ /* YYFINAL -- State number of the termination state. */
430
+ #define YYFINAL 40
431
+ /* YYLAST -- Last index in YYTABLE. */
432
+ #define YYLAST 93
433
+
434
+ /* YYNTOKENS -- Number of terminals. */
435
+ #define YYNTOKENS 31
436
+ /* YYNNTS -- Number of nonterminals. */
437
+ #define YYNNTS 26
438
+ /* YYNRULES -- Number of rules. */
439
+ #define YYNRULES 56
440
+ /* YYNRULES -- Number of states. */
441
+ #define YYNSTATES 64
442
+
443
+ /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
444
+ #define YYUNDEFTOK 2
445
+ #define YYMAXUTOK 285
446
+
447
+ #define YYTRANSLATE(YYX) \
448
+ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
449
+
450
+ /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
451
+ static const yytype_uint8 yytranslate[] =
452
+ {
453
+ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
454
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
455
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
456
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
457
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
458
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
459
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
460
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
461
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
462
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
463
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
464
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
465
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
466
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
467
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
468
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
469
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
470
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
471
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
472
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
473
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
474
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
475
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
476
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
477
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
478
+ 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
479
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
480
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
481
+ 25, 26, 27, 28, 29, 30
482
+ };
483
+
484
+ #if YYDEBUG
485
+ /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
486
+ YYRHS. */
487
+ static const yytype_uint8 yyprhs[] =
488
+ {
489
+ 0, 0, 3, 4, 7, 9, 11, 13, 15, 17,
490
+ 19, 21, 22, 23, 28, 29, 30, 35, 37, 39,
491
+ 42, 45, 49, 51, 54, 57, 61, 63, 66, 68,
492
+ 70, 72, 74, 76, 78, 80, 82, 84, 86, 88,
493
+ 90, 92, 94, 96, 97, 100, 102, 104, 106, 108,
494
+ 110, 112, 114, 116, 118, 120, 121
495
+ };
496
+
497
+ /* YYRHS -- A `-1'-separated list of the rules' RHS. */
498
+ static const yytype_int8 yyrhs[] =
499
+ {
500
+ 32, 0, -1, -1, 33, 32, -1, 54, -1, 42,
501
+ -1, 47, -1, 48, -1, 49, -1, 50, -1, 51,
502
+ -1, -1, -1, 34, 38, 35, 33, -1, -1, -1,
503
+ 36, 40, 37, 33, -1, 55, -1, 39, -1, 38,
504
+ 39, -1, 53, 42, -1, 53, 42, 23, -1, 41,
505
+ -1, 40, 41, -1, 52, 42, -1, 52, 42, 23,
506
+ -1, 43, -1, 43, 42, -1, 45, -1, 44, -1,
507
+ 6, -1, 15, -1, 4, -1, 29, -1, 5, -1,
508
+ 30, -1, 7, -1, 9, -1, 10, -1, 13, -1,
509
+ 14, -1, 11, -1, 12, -1, -1, 46, 45, -1,
510
+ 3, -1, 17, -1, 18, -1, 19, -1, 20, -1,
511
+ 21, -1, 25, -1, 26, -1, 23, -1, 24, -1,
512
+ -1, 27, 56, 45, 28, -1
513
+ };
514
+
515
+ /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
516
+ static const yytype_uint8 yyrline[] =
517
+ {
518
+ 0, 80, 80, 81, 84, 85, 86, 87, 88, 89,
519
+ 90, 91, 91, 91, 92, 92, 92, 93, 95, 96,
520
+ 98, 99, 101, 102, 104, 105, 107, 108, 110, 111,
521
+ 112, 113, 114, 115, 116, 117, 119, 120, 121, 122,
522
+ 123, 124, 125, 127, 128, 130, 137, 138, 139, 140,
523
+ 141, 143, 144, 145, 146, 147, 147
524
+ };
525
+ #endif
526
+
527
+ #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
528
+ /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
529
+ First, the terminals, then, starting at YYNTOKENS, nonterminals. */
530
+ static const char *const yytname[] =
531
+ {
532
+ "$end", "error", "$undefined", "T_CHAR", "BOLD_START", "ITALIC_START",
533
+ "T_WORD", "TICKET_LINK", "LINK", "SVN_REVISION_LINK",
534
+ "GIT_REVISION_LINK", "WIKI_LINK", "ANCHOR_LINK", "URL_WITH_PROTO_LINK",
535
+ "URL_WITHOUT_PROTO_LINK", "URL", "UL", "H1", "H2", "H3", "H4", "H5",
536
+ "SPACE", "BR", "BRBR", "OLI", "ULI", "PRE_START", "PRE_END", "BOLD_END",
537
+ "ITALIC_END", "$accept", "text", "textitem", "$@1", "$@2", "$@3", "$@4",
538
+ "ulist", "ulitem", "olist", "olitem", "words", "word", "link", "chars",
539
+ "char", "h1", "h2", "h3", "h4", "h5", "oli", "uli", "br", "pre", "$@5", 0
540
+ };
541
+ #endif
542
+
543
+ # ifdef YYPRINT
544
+ /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
545
+ token YYLEX-NUM. */
546
+ static const yytype_uint16 yytoknum[] =
547
+ {
548
+ 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
549
+ 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
550
+ 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
551
+ 285
552
+ };
553
+ # endif
554
+
555
+ /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
556
+ static const yytype_uint8 yyr1[] =
557
+ {
558
+ 0, 31, 32, 32, 33, 33, 33, 33, 33, 33,
559
+ 33, 34, 35, 33, 36, 37, 33, 33, 38, 38,
560
+ 39, 39, 40, 40, 41, 41, 42, 42, 43, 43,
561
+ 43, 43, 43, 43, 43, 43, 44, 44, 44, 44,
562
+ 44, 44, 44, 45, 45, 46, 47, 48, 49, 50,
563
+ 51, 52, 53, 54, 54, 56, 55
564
+ };
565
+
566
+ /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
567
+ static const yytype_uint8 yyr2[] =
568
+ {
569
+ 0, 2, 0, 2, 1, 1, 1, 1, 1, 1,
570
+ 1, 0, 0, 4, 0, 0, 4, 1, 1, 2,
571
+ 2, 3, 1, 2, 2, 3, 1, 2, 1, 1,
572
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
573
+ 1, 1, 1, 0, 2, 1, 1, 1, 1, 1,
574
+ 1, 1, 1, 1, 1, 0, 4
575
+ };
576
+
577
+ /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
578
+ STATE-NUM when YYTABLE doesn't specify something else to do. Zero
579
+ means the default is an error. */
580
+ static const yytype_uint8 yydefact[] =
581
+ {
582
+ 2, 45, 32, 34, 30, 36, 37, 38, 41, 42,
583
+ 39, 40, 31, 46, 47, 48, 49, 50, 53, 54,
584
+ 55, 33, 35, 0, 2, 0, 0, 5, 26, 29,
585
+ 28, 43, 6, 7, 8, 9, 10, 4, 17, 43,
586
+ 1, 3, 52, 12, 18, 43, 51, 15, 22, 43,
587
+ 27, 44, 0, 11, 19, 20, 11, 23, 24, 56,
588
+ 13, 21, 16, 25
589
+ };
590
+
591
+ /* YYDEFGOTO[NTERM-NUM]. */
592
+ static const yytype_int8 yydefgoto[] =
593
+ {
594
+ -1, 23, 24, 25, 53, 26, 56, 43, 44, 47,
595
+ 48, 27, 28, 29, 30, 31, 32, 33, 34, 35,
596
+ 36, 49, 45, 37, 38, 39
597
+ };
598
+
599
+ /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
600
+ STATE-NUM. */
601
+ #define YYPACT_NINF -25
602
+ static const yytype_int8 yypact[] =
603
+ {
604
+ 28, -25, -25, -25, -25, -25, -25, -25, -25, -25,
605
+ -25, -25, -25, -25, -25, -25, -25, -25, -25, -25,
606
+ -25, -25, -25, 1, 28, -24, -3, -25, 56, -25,
607
+ -25, 23, -25, -25, -25, -25, -25, -25, -25, 23,
608
+ -25, -25, -25, -24, -25, 56, -25, -3, -25, 56,
609
+ -25, -25, 8, 0, -25, 5, 0, -25, 21, -25,
610
+ -25, -25, -25, -25
611
+ };
612
+
613
+ /* YYPGOTO[NTERM-NUM]. */
614
+ static const yytype_int8 yypgoto[] =
615
+ {
616
+ -25, 26, 20, -25, -25, -25, -25, -25, 13, -25,
617
+ 17, 44, -25, -25, -23, -25, -25, -25, -25, -25,
618
+ -25, -25, -25, -25, -25, -25
619
+ };
620
+
621
+ /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
622
+ positive, shift that token. If negative, reduce the rule which
623
+ number is the opposite. If zero, do what YYDEFACT says.
624
+ If YYTABLE_NINF, syntax error. */
625
+ #define YYTABLE_NINF -44
626
+ static const yytype_int8 yytable[] =
627
+ {
628
+ -43, 40, 42, 1, 2, 3, 4, 5, 51, 6,
629
+ 7, 8, 9, 10, 11, 12, 52, 13, 14, 15,
630
+ 16, 17, 46, 18, 19, -14, 1, 20, 61, 21,
631
+ 22, 1, 2, 3, 4, 5, 59, 6, 7, 8,
632
+ 9, 10, 11, 12, 63, 13, 14, 15, 16, 17,
633
+ 41, 18, 19, -14, -11, 20, 54, 21, 22, 1,
634
+ 2, 3, 4, 5, 57, 6, 7, 8, 9, 10,
635
+ 11, 12, 50, 60, 0, 0, 62, 0, 0, 0,
636
+ 0, 0, 0, 0, 0, 21, 22, 0, 0, 55,
637
+ 0, 0, 0, 58
638
+ };
639
+
640
+ static const yytype_int8 yycheck[] =
641
+ {
642
+ 0, 0, 26, 3, 4, 5, 6, 7, 31, 9,
643
+ 10, 11, 12, 13, 14, 15, 39, 17, 18, 19,
644
+ 20, 21, 25, 23, 24, 25, 3, 27, 23, 29,
645
+ 30, 3, 4, 5, 6, 7, 28, 9, 10, 11,
646
+ 12, 13, 14, 15, 23, 17, 18, 19, 20, 21,
647
+ 24, 23, 24, 25, 26, 27, 43, 29, 30, 3,
648
+ 4, 5, 6, 7, 47, 9, 10, 11, 12, 13,
649
+ 14, 15, 28, 53, -1, -1, 56, -1, -1, -1,
650
+ -1, -1, -1, -1, -1, 29, 30, -1, -1, 45,
651
+ -1, -1, -1, 49
652
+ };
653
+
654
+ /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
655
+ symbol of state STATE-NUM. */
656
+ static const yytype_uint8 yystos[] =
657
+ {
658
+ 0, 3, 4, 5, 6, 7, 9, 10, 11, 12,
659
+ 13, 14, 15, 17, 18, 19, 20, 21, 23, 24,
660
+ 27, 29, 30, 32, 33, 34, 36, 42, 43, 44,
661
+ 45, 46, 47, 48, 49, 50, 51, 54, 55, 56,
662
+ 0, 32, 26, 38, 39, 53, 25, 40, 41, 52,
663
+ 42, 45, 45, 35, 39, 42, 37, 41, 42, 28,
664
+ 33, 23, 33, 23
665
+ };
666
+
667
+ #define yyerrok (yyerrstatus = 0)
668
+ #define yyclearin (yychar = YYEMPTY)
669
+ #define YYEMPTY (-2)
670
+ #define YYEOF 0
671
+
672
+ #define YYACCEPT goto yyacceptlab
673
+ #define YYABORT goto yyabortlab
674
+ #define YYERROR goto yyerrorlab
675
+
676
+
677
+ /* Like YYERROR except do call yyerror. This remains here temporarily
678
+ to ease the transition to the new meaning of YYERROR, for GCC.
679
+ Once GCC version 2 has supplanted version 1, this can go. */
680
+
681
+ #define YYFAIL goto yyerrlab
682
+
683
+ #define YYRECOVERING() (!!yyerrstatus)
684
+
685
+ #define YYBACKUP(Token, Value) \
686
+ do \
687
+ if (yychar == YYEMPTY && yylen == 1) \
688
+ { \
689
+ yychar = (Token); \
690
+ yylval = (Value); \
691
+ yytoken = YYTRANSLATE (yychar); \
692
+ YYPOPSTACK (1); \
693
+ goto yybackup; \
694
+ } \
695
+ else \
696
+ { \
697
+ yyerror (YY_("syntax error: cannot back up")); \
698
+ YYERROR; \
699
+ } \
700
+ while (YYID (0))
701
+
702
+
703
+ #define YYTERROR 1
704
+ #define YYERRCODE 256
705
+
706
+
707
+ /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
708
+ If N is 0, then set CURRENT to the empty location which ends
709
+ the previous symbol: RHS[0] (always defined). */
710
+
711
+ #define YYRHSLOC(Rhs, K) ((Rhs)[K])
712
+ #ifndef YYLLOC_DEFAULT
713
+ # define YYLLOC_DEFAULT(Current, Rhs, N) \
714
+ do \
715
+ if (YYID (N)) \
716
+ { \
717
+ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
718
+ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
719
+ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
720
+ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
721
+ } \
722
+ else \
723
+ { \
724
+ (Current).first_line = (Current).last_line = \
725
+ YYRHSLOC (Rhs, 0).last_line; \
726
+ (Current).first_column = (Current).last_column = \
727
+ YYRHSLOC (Rhs, 0).last_column; \
728
+ } \
729
+ while (YYID (0))
730
+ #endif
731
+
732
+
733
+ /* YY_LOCATION_PRINT -- Print the location on the stream.
734
+ This macro was not mandated originally: define only if we know
735
+ we won't break user code: when these are the locations we know. */
736
+
737
+ #ifndef YY_LOCATION_PRINT
738
+ # if YYLTYPE_IS_TRIVIAL
739
+ # define YY_LOCATION_PRINT(File, Loc) \
740
+ fprintf (File, "%d.%d-%d.%d", \
741
+ (Loc).first_line, (Loc).first_column, \
742
+ (Loc).last_line, (Loc).last_column)
743
+ # else
744
+ # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
745
+ # endif
746
+ #endif
747
+
748
+
749
+ /* YYLEX -- calling `yylex' with the right arguments. */
750
+
751
+ #ifdef YYLEX_PARAM
752
+ # define YYLEX yylex (YYLEX_PARAM)
753
+ #else
754
+ # define YYLEX yylex ()
755
+ #endif
756
+
757
+ /* Enable debugging if requested. */
758
+ #if YYDEBUG
759
+
760
+ # ifndef YYFPRINTF
761
+ # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
762
+ # define YYFPRINTF fprintf
763
+ # endif
764
+
765
+ # define YYDPRINTF(Args) \
766
+ do { \
767
+ if (yydebug) \
768
+ YYFPRINTF Args; \
769
+ } while (YYID (0))
770
+
771
+ # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
772
+ do { \
773
+ if (yydebug) \
774
+ { \
775
+ YYFPRINTF (stderr, "%s ", Title); \
776
+ yy_symbol_print (stderr, \
777
+ Type, Value); \
778
+ YYFPRINTF (stderr, "\n"); \
779
+ } \
780
+ } while (YYID (0))
781
+
782
+
783
+ /*--------------------------------.
784
+ | Print this symbol on YYOUTPUT. |
785
+ `--------------------------------*/
786
+
787
+ /*ARGSUSED*/
788
+ #if (defined __STDC__ || defined __C99__FUNC__ \
789
+ || defined __cplusplus || defined _MSC_VER)
790
+ static void
791
+ yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
792
+ #else
793
+ static void
794
+ yy_symbol_value_print (yyoutput, yytype, yyvaluep)
795
+ FILE *yyoutput;
796
+ int yytype;
797
+ YYSTYPE const * const yyvaluep;
798
+ #endif
799
+ {
800
+ if (!yyvaluep)
801
+ return;
802
+ # ifdef YYPRINT
803
+ if (yytype < YYNTOKENS)
804
+ YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
805
+ # else
806
+ YYUSE (yyoutput);
807
+ # endif
808
+ switch (yytype)
809
+ {
810
+ default:
811
+ break;
812
+ }
813
+ }
814
+
815
+
816
+ /*--------------------------------.
817
+ | Print this symbol on YYOUTPUT. |
818
+ `--------------------------------*/
819
+
820
+ #if (defined __STDC__ || defined __C99__FUNC__ \
821
+ || defined __cplusplus || defined _MSC_VER)
822
+ static void
823
+ yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
824
+ #else
825
+ static void
826
+ yy_symbol_print (yyoutput, yytype, yyvaluep)
827
+ FILE *yyoutput;
828
+ int yytype;
829
+ YYSTYPE const * const yyvaluep;
830
+ #endif
831
+ {
832
+ if (yytype < YYNTOKENS)
833
+ YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
834
+ else
835
+ YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
836
+
837
+ yy_symbol_value_print (yyoutput, yytype, yyvaluep);
838
+ YYFPRINTF (yyoutput, ")");
839
+ }
840
+
841
+ /*------------------------------------------------------------------.
842
+ | yy_stack_print -- Print the state stack from its BOTTOM up to its |
843
+ | TOP (included). |
844
+ `------------------------------------------------------------------*/
845
+
846
+ #if (defined __STDC__ || defined __C99__FUNC__ \
847
+ || defined __cplusplus || defined _MSC_VER)
848
+ static void
849
+ yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
850
+ #else
851
+ static void
852
+ yy_stack_print (yybottom, yytop)
853
+ yytype_int16 *yybottom;
854
+ yytype_int16 *yytop;
855
+ #endif
856
+ {
857
+ YYFPRINTF (stderr, "Stack now");
858
+ for (; yybottom <= yytop; yybottom++)
859
+ {
860
+ int yybot = *yybottom;
861
+ YYFPRINTF (stderr, " %d", yybot);
862
+ }
863
+ YYFPRINTF (stderr, "\n");
864
+ }
865
+
866
+ # define YY_STACK_PRINT(Bottom, Top) \
867
+ do { \
868
+ if (yydebug) \
869
+ yy_stack_print ((Bottom), (Top)); \
870
+ } while (YYID (0))
871
+
872
+
873
+ /*------------------------------------------------.
874
+ | Report that the YYRULE is going to be reduced. |
875
+ `------------------------------------------------*/
876
+
877
+ #if (defined __STDC__ || defined __C99__FUNC__ \
878
+ || defined __cplusplus || defined _MSC_VER)
879
+ static void
880
+ yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
881
+ #else
882
+ static void
883
+ yy_reduce_print (yyvsp, yyrule)
884
+ YYSTYPE *yyvsp;
885
+ int yyrule;
886
+ #endif
887
+ {
888
+ int yynrhs = yyr2[yyrule];
889
+ int yyi;
890
+ unsigned long int yylno = yyrline[yyrule];
891
+ YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
892
+ yyrule - 1, yylno);
893
+ /* The symbols being reduced. */
894
+ for (yyi = 0; yyi < yynrhs; yyi++)
895
+ {
896
+ YYFPRINTF (stderr, " $%d = ", yyi + 1);
897
+ yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
898
+ &(yyvsp[(yyi + 1) - (yynrhs)])
899
+ );
900
+ YYFPRINTF (stderr, "\n");
901
+ }
902
+ }
903
+
904
+ # define YY_REDUCE_PRINT(Rule) \
905
+ do { \
906
+ if (yydebug) \
907
+ yy_reduce_print (yyvsp, Rule); \
908
+ } while (YYID (0))
909
+
910
+ /* Nonzero means print parse trace. It is left uninitialized so that
911
+ multiple parsers can coexist. */
912
+ int yydebug;
913
+ #else /* !YYDEBUG */
914
+ # define YYDPRINTF(Args)
915
+ # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
916
+ # define YY_STACK_PRINT(Bottom, Top)
917
+ # define YY_REDUCE_PRINT(Rule)
918
+ #endif /* !YYDEBUG */
919
+
920
+
921
+ /* YYINITDEPTH -- initial size of the parser's stacks. */
922
+ #ifndef YYINITDEPTH
923
+ # define YYINITDEPTH 200
924
+ #endif
925
+
926
+ /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
927
+ if the built-in stack extension method is used).
928
+
929
+ Do not make this value too large; the results are undefined if
930
+ YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
931
+ evaluated with infinite-precision integer arithmetic. */
932
+
933
+ #ifndef YYMAXDEPTH
934
+ # define YYMAXDEPTH 10000
935
+ #endif
936
+
937
+
938
+
939
+ #if YYERROR_VERBOSE
940
+
941
+ # ifndef yystrlen
942
+ # if defined __GLIBC__ && defined _STRING_H
943
+ # define yystrlen strlen
944
+ # else
945
+ /* Return the length of YYSTR. */
946
+ #if (defined __STDC__ || defined __C99__FUNC__ \
947
+ || defined __cplusplus || defined _MSC_VER)
948
+ static YYSIZE_T
949
+ yystrlen (const char *yystr)
950
+ #else
951
+ static YYSIZE_T
952
+ yystrlen (yystr)
953
+ const char *yystr;
954
+ #endif
955
+ {
956
+ YYSIZE_T yylen;
957
+ for (yylen = 0; yystr[yylen]; yylen++)
958
+ continue;
959
+ return yylen;
960
+ }
961
+ # endif
962
+ # endif
963
+
964
+ # ifndef yystpcpy
965
+ # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
966
+ # define yystpcpy stpcpy
967
+ # else
968
+ /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
969
+ YYDEST. */
970
+ #if (defined __STDC__ || defined __C99__FUNC__ \
971
+ || defined __cplusplus || defined _MSC_VER)
972
+ static char *
973
+ yystpcpy (char *yydest, const char *yysrc)
974
+ #else
975
+ static char *
976
+ yystpcpy (yydest, yysrc)
977
+ char *yydest;
978
+ const char *yysrc;
979
+ #endif
980
+ {
981
+ char *yyd = yydest;
982
+ const char *yys = yysrc;
983
+
984
+ while ((*yyd++ = *yys++) != '\0')
985
+ continue;
986
+
987
+ return yyd - 1;
988
+ }
989
+ # endif
990
+ # endif
991
+
992
+ # ifndef yytnamerr
993
+ /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
994
+ quotes and backslashes, so that it's suitable for yyerror. The
995
+ heuristic is that double-quoting is unnecessary unless the string
996
+ contains an apostrophe, a comma, or backslash (other than
997
+ backslash-backslash). YYSTR is taken from yytname. If YYRES is
998
+ null, do not copy; instead, return the length of what the result
999
+ would have been. */
1000
+ static YYSIZE_T
1001
+ yytnamerr (char *yyres, const char *yystr)
1002
+ {
1003
+ if (*yystr == '"')
1004
+ {
1005
+ YYSIZE_T yyn = 0;
1006
+ char const *yyp = yystr;
1007
+
1008
+ for (;;)
1009
+ switch (*++yyp)
1010
+ {
1011
+ case '\'':
1012
+ case ',':
1013
+ goto do_not_strip_quotes;
1014
+
1015
+ case '\\':
1016
+ if (*++yyp != '\\')
1017
+ goto do_not_strip_quotes;
1018
+ /* Fall through. */
1019
+ default:
1020
+ if (yyres)
1021
+ yyres[yyn] = *yyp;
1022
+ yyn++;
1023
+ break;
1024
+
1025
+ case '"':
1026
+ if (yyres)
1027
+ yyres[yyn] = '\0';
1028
+ return yyn;
1029
+ }
1030
+ do_not_strip_quotes: ;
1031
+ }
1032
+
1033
+ if (! yyres)
1034
+ return yystrlen (yystr);
1035
+
1036
+ return yystpcpy (yyres, yystr) - yyres;
1037
+ }
1038
+ # endif
1039
+
1040
+ /* Copy into YYRESULT an error message about the unexpected token
1041
+ YYCHAR while in state YYSTATE. Return the number of bytes copied,
1042
+ including the terminating null byte. If YYRESULT is null, do not
1043
+ copy anything; just return the number of bytes that would be
1044
+ copied. As a special case, return 0 if an ordinary "syntax error"
1045
+ message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1046
+ size calculation. */
1047
+ static YYSIZE_T
1048
+ yysyntax_error (char *yyresult, int yystate, int yychar)
1049
+ {
1050
+ int yyn = yypact[yystate];
1051
+
1052
+ if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1053
+ return 0;
1054
+ else
1055
+ {
1056
+ int yytype = YYTRANSLATE (yychar);
1057
+ YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1058
+ YYSIZE_T yysize = yysize0;
1059
+ YYSIZE_T yysize1;
1060
+ int yysize_overflow = 0;
1061
+ enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1062
+ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1063
+ int yyx;
1064
+
1065
+ # if 0
1066
+ /* This is so xgettext sees the translatable formats that are
1067
+ constructed on the fly. */
1068
+ YY_("syntax error, unexpected %s");
1069
+ YY_("syntax error, unexpected %s, expecting %s");
1070
+ YY_("syntax error, unexpected %s, expecting %s or %s");
1071
+ YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1072
+ YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1073
+ # endif
1074
+ char *yyfmt;
1075
+ char const *yyf;
1076
+ static char const yyunexpected[] = "syntax error, unexpected %s";
1077
+ static char const yyexpecting[] = ", expecting %s";
1078
+ static char const yyor[] = " or %s";
1079
+ char yyformat[sizeof yyunexpected
1080
+ + sizeof yyexpecting - 1
1081
+ + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1082
+ * (sizeof yyor - 1))];
1083
+ char const *yyprefix = yyexpecting;
1084
+
1085
+ /* Start YYX at -YYN if negative to avoid negative indexes in
1086
+ YYCHECK. */
1087
+ int yyxbegin = yyn < 0 ? -yyn : 0;
1088
+
1089
+ /* Stay within bounds of both yycheck and yytname. */
1090
+ int yychecklim = YYLAST - yyn + 1;
1091
+ int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1092
+ int yycount = 1;
1093
+
1094
+ yyarg[0] = yytname[yytype];
1095
+ yyfmt = yystpcpy (yyformat, yyunexpected);
1096
+
1097
+ for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1098
+ if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1099
+ {
1100
+ if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1101
+ {
1102
+ yycount = 1;
1103
+ yysize = yysize0;
1104
+ yyformat[sizeof yyunexpected - 1] = '\0';
1105
+ break;
1106
+ }
1107
+ yyarg[yycount++] = yytname[yyx];
1108
+ yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1109
+ yysize_overflow |= (yysize1 < yysize);
1110
+ yysize = yysize1;
1111
+ yyfmt = yystpcpy (yyfmt, yyprefix);
1112
+ yyprefix = yyor;
1113
+ }
1114
+
1115
+ yyf = YY_(yyformat);
1116
+ yysize1 = yysize + yystrlen (yyf);
1117
+ yysize_overflow |= (yysize1 < yysize);
1118
+ yysize = yysize1;
1119
+
1120
+ if (yysize_overflow)
1121
+ return YYSIZE_MAXIMUM;
1122
+
1123
+ if (yyresult)
1124
+ {
1125
+ /* Avoid sprintf, as that infringes on the user's name space.
1126
+ Don't have undefined behavior even if the translation
1127
+ produced a string with the wrong number of "%s"s. */
1128
+ char *yyp = yyresult;
1129
+ int yyi = 0;
1130
+ while ((*yyp = *yyf) != '\0')
1131
+ {
1132
+ if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1133
+ {
1134
+ yyp += yytnamerr (yyp, yyarg[yyi++]);
1135
+ yyf += 2;
1136
+ }
1137
+ else
1138
+ {
1139
+ yyp++;
1140
+ yyf++;
1141
+ }
1142
+ }
1143
+ }
1144
+ return yysize;
1145
+ }
1146
+ }
1147
+ #endif /* YYERROR_VERBOSE */
1148
+
1149
+
1150
+ /*-----------------------------------------------.
1151
+ | Release the memory associated to this symbol. |
1152
+ `-----------------------------------------------*/
1153
+
1154
+ /*ARGSUSED*/
1155
+ #if (defined __STDC__ || defined __C99__FUNC__ \
1156
+ || defined __cplusplus || defined _MSC_VER)
1157
+ static void
1158
+ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1159
+ #else
1160
+ static void
1161
+ yydestruct (yymsg, yytype, yyvaluep)
1162
+ const char *yymsg;
1163
+ int yytype;
1164
+ YYSTYPE *yyvaluep;
1165
+ #endif
1166
+ {
1167
+ YYUSE (yyvaluep);
1168
+
1169
+ if (!yymsg)
1170
+ yymsg = "Deleting";
1171
+ YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1172
+
1173
+ switch (yytype)
1174
+ {
1175
+
1176
+ default:
1177
+ break;
1178
+ }
1179
+ }
1180
+
1181
+ /* Prevent warnings from -Wmissing-prototypes. */
1182
+ #ifdef YYPARSE_PARAM
1183
+ #if defined __STDC__ || defined __cplusplus
1184
+ int yyparse (void *YYPARSE_PARAM);
1185
+ #else
1186
+ int yyparse ();
1187
+ #endif
1188
+ #else /* ! YYPARSE_PARAM */
1189
+ #if defined __STDC__ || defined __cplusplus
1190
+ int yyparse (void);
1191
+ #else
1192
+ int yyparse ();
1193
+ #endif
1194
+ #endif /* ! YYPARSE_PARAM */
1195
+
1196
+
1197
+ /* The lookahead symbol. */
1198
+ int yychar;
1199
+
1200
+ /* The semantic value of the lookahead symbol. */
1201
+ YYSTYPE yylval;
1202
+
1203
+ /* Number of syntax errors so far. */
1204
+ int yynerrs;
1205
+
1206
+
1207
+
1208
+ /*-------------------------.
1209
+ | yyparse or yypush_parse. |
1210
+ `-------------------------*/
1211
+
1212
+ #ifdef YYPARSE_PARAM
1213
+ #if (defined __STDC__ || defined __C99__FUNC__ \
1214
+ || defined __cplusplus || defined _MSC_VER)
1215
+ int
1216
+ yyparse (void *YYPARSE_PARAM)
1217
+ #else
1218
+ int
1219
+ yyparse (YYPARSE_PARAM)
1220
+ void *YYPARSE_PARAM;
1221
+ #endif
1222
+ #else /* ! YYPARSE_PARAM */
1223
+ #if (defined __STDC__ || defined __C99__FUNC__ \
1224
+ || defined __cplusplus || defined _MSC_VER)
1225
+ int
1226
+ yyparse (void)
1227
+ #else
1228
+ int
1229
+ yyparse ()
1230
+
1231
+ #endif
1232
+ #endif
1233
+ {
1234
+
1235
+
1236
+ int yystate;
1237
+ /* Number of tokens to shift before error messages enabled. */
1238
+ int yyerrstatus;
1239
+
1240
+ /* The stacks and their tools:
1241
+ `yyss': related to states.
1242
+ `yyvs': related to semantic values.
1243
+
1244
+ Refer to the stacks thru separate pointers, to allow yyoverflow
1245
+ to reallocate them elsewhere. */
1246
+
1247
+ /* The state stack. */
1248
+ yytype_int16 yyssa[YYINITDEPTH];
1249
+ yytype_int16 *yyss;
1250
+ yytype_int16 *yyssp;
1251
+
1252
+ /* The semantic value stack. */
1253
+ YYSTYPE yyvsa[YYINITDEPTH];
1254
+ YYSTYPE *yyvs;
1255
+ YYSTYPE *yyvsp;
1256
+
1257
+ YYSIZE_T yystacksize;
1258
+
1259
+ int yyn;
1260
+ int yyresult;
1261
+ /* Lookahead token as an internal (translated) token number. */
1262
+ int yytoken;
1263
+ /* The variables used to return semantic value and location from the
1264
+ action routines. */
1265
+ YYSTYPE yyval;
1266
+
1267
+ #if YYERROR_VERBOSE
1268
+ /* Buffer for error messages, and its allocated size. */
1269
+ char yymsgbuf[128];
1270
+ char *yymsg = yymsgbuf;
1271
+ YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1272
+ #endif
1273
+
1274
+ #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1275
+
1276
+ /* The number of symbols on the RHS of the reduced rule.
1277
+ Keep to zero when no symbol should be popped. */
1278
+ int yylen = 0;
1279
+
1280
+ yytoken = 0;
1281
+ yyss = yyssa;
1282
+ yyvs = yyvsa;
1283
+ yystacksize = YYINITDEPTH;
1284
+
1285
+ YYDPRINTF ((stderr, "Starting parse\n"));
1286
+
1287
+ yystate = 0;
1288
+ yyerrstatus = 0;
1289
+ yynerrs = 0;
1290
+ yychar = YYEMPTY; /* Cause a token to be read. */
1291
+
1292
+ /* Initialize stack pointers.
1293
+ Waste one element of value and location stack
1294
+ so that they stay on the same level as the state stack.
1295
+ The wasted elements are never initialized. */
1296
+ yyssp = yyss;
1297
+ yyvsp = yyvs;
1298
+
1299
+ goto yysetstate;
1300
+
1301
+ /*------------------------------------------------------------.
1302
+ | yynewstate -- Push a new state, which is found in yystate. |
1303
+ `------------------------------------------------------------*/
1304
+ yynewstate:
1305
+ /* In all cases, when you get here, the value and location stacks
1306
+ have just been pushed. So pushing a state here evens the stacks. */
1307
+ yyssp++;
1308
+
1309
+ yysetstate:
1310
+ *yyssp = yystate;
1311
+
1312
+ if (yyss + yystacksize - 1 <= yyssp)
1313
+ {
1314
+ /* Get the current used size of the three stacks, in elements. */
1315
+ YYSIZE_T yysize = yyssp - yyss + 1;
1316
+
1317
+ #ifdef yyoverflow
1318
+ {
1319
+ /* Give user a chance to reallocate the stack. Use copies of
1320
+ these so that the &'s don't force the real ones into
1321
+ memory. */
1322
+ YYSTYPE *yyvs1 = yyvs;
1323
+ yytype_int16 *yyss1 = yyss;
1324
+
1325
+ /* Each stack pointer address is followed by the size of the
1326
+ data in use in that stack, in bytes. This used to be a
1327
+ conditional around just the two extra args, but that might
1328
+ be undefined if yyoverflow is a macro. */
1329
+ yyoverflow (YY_("memory exhausted"),
1330
+ &yyss1, yysize * sizeof (*yyssp),
1331
+ &yyvs1, yysize * sizeof (*yyvsp),
1332
+ &yystacksize);
1333
+
1334
+ yyss = yyss1;
1335
+ yyvs = yyvs1;
1336
+ }
1337
+ #else /* no yyoverflow */
1338
+ # ifndef YYSTACK_RELOCATE
1339
+ goto yyexhaustedlab;
1340
+ # else
1341
+ /* Extend the stack our own way. */
1342
+ if (YYMAXDEPTH <= yystacksize)
1343
+ goto yyexhaustedlab;
1344
+ yystacksize *= 2;
1345
+ if (YYMAXDEPTH < yystacksize)
1346
+ yystacksize = YYMAXDEPTH;
1347
+
1348
+ {
1349
+ yytype_int16 *yyss1 = yyss;
1350
+ union yyalloc *yyptr =
1351
+ (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1352
+ if (! yyptr)
1353
+ goto yyexhaustedlab;
1354
+ YYSTACK_RELOCATE (yyss_alloc, yyss);
1355
+ YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1356
+ # undef YYSTACK_RELOCATE
1357
+ if (yyss1 != yyssa)
1358
+ YYSTACK_FREE (yyss1);
1359
+ }
1360
+ # endif
1361
+ #endif /* no yyoverflow */
1362
+
1363
+ yyssp = yyss + yysize - 1;
1364
+ yyvsp = yyvs + yysize - 1;
1365
+
1366
+ YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1367
+ (unsigned long int) yystacksize));
1368
+
1369
+ if (yyss + yystacksize - 1 <= yyssp)
1370
+ YYABORT;
1371
+ }
1372
+
1373
+ YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1374
+
1375
+ if (yystate == YYFINAL)
1376
+ YYACCEPT;
1377
+
1378
+ goto yybackup;
1379
+
1380
+ /*-----------.
1381
+ | yybackup. |
1382
+ `-----------*/
1383
+ yybackup:
1384
+
1385
+ /* Do appropriate processing given the current state. Read a
1386
+ lookahead token if we need one and don't already have one. */
1387
+
1388
+ /* First try to decide what to do without reference to lookahead token. */
1389
+ yyn = yypact[yystate];
1390
+ if (yyn == YYPACT_NINF)
1391
+ goto yydefault;
1392
+
1393
+ /* Not known => get a lookahead token if don't already have one. */
1394
+
1395
+ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1396
+ if (yychar == YYEMPTY)
1397
+ {
1398
+ YYDPRINTF ((stderr, "Reading a token: "));
1399
+ yychar = YYLEX;
1400
+ }
1401
+
1402
+ if (yychar <= YYEOF)
1403
+ {
1404
+ yychar = yytoken = YYEOF;
1405
+ YYDPRINTF ((stderr, "Now at end of input.\n"));
1406
+ }
1407
+ else
1408
+ {
1409
+ yytoken = YYTRANSLATE (yychar);
1410
+ YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1411
+ }
1412
+
1413
+ /* If the proper action on seeing token YYTOKEN is to reduce or to
1414
+ detect an error, take that action. */
1415
+ yyn += yytoken;
1416
+ if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1417
+ goto yydefault;
1418
+ yyn = yytable[yyn];
1419
+ if (yyn <= 0)
1420
+ {
1421
+ if (yyn == 0 || yyn == YYTABLE_NINF)
1422
+ goto yyerrlab;
1423
+ yyn = -yyn;
1424
+ goto yyreduce;
1425
+ }
1426
+
1427
+ /* Count tokens shifted since error; after three, turn off error
1428
+ status. */
1429
+ if (yyerrstatus)
1430
+ yyerrstatus--;
1431
+
1432
+ /* Shift the lookahead token. */
1433
+ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1434
+
1435
+ /* Discard the shifted token. */
1436
+ yychar = YYEMPTY;
1437
+
1438
+ yystate = yyn;
1439
+ *++yyvsp = yylval;
1440
+
1441
+ goto yynewstate;
1442
+
1443
+
1444
+ /*-----------------------------------------------------------.
1445
+ | yydefault -- do the default action for the current state. |
1446
+ `-----------------------------------------------------------*/
1447
+ yydefault:
1448
+ yyn = yydefact[yystate];
1449
+ if (yyn == 0)
1450
+ goto yyerrlab;
1451
+ goto yyreduce;
1452
+
1453
+
1454
+ /*-----------------------------.
1455
+ | yyreduce -- Do a reduction. |
1456
+ `-----------------------------*/
1457
+ yyreduce:
1458
+ /* yyn is the number of a rule to reduce with. */
1459
+ yylen = yyr2[yyn];
1460
+
1461
+ /* If YYLEN is nonzero, implement the default value of the action:
1462
+ `$$ = $1'.
1463
+
1464
+ Otherwise, the following line sets YYVAL to garbage.
1465
+ This behavior is undocumented and Bison
1466
+ users should not rely upon it. Assigning to YYVAL
1467
+ unconditionally makes the parser a bit smaller, and it avoids a
1468
+ GCC warning that YYVAL may be used uninitialized. */
1469
+ yyval = yyvsp[1-yylen];
1470
+
1471
+
1472
+ YY_REDUCE_PRINT (yyn);
1473
+ switch (yyn)
1474
+ {
1475
+ case 6:
1476
+
1477
+ /* Line 1455 of yacc.c */
1478
+ #line 86 "parser.y"
1479
+ {concat("</h1>",5);}
1480
+ break;
1481
+
1482
+ case 7:
1483
+
1484
+ /* Line 1455 of yacc.c */
1485
+ #line 87 "parser.y"
1486
+ {concat("</h2>",5);}
1487
+ break;
1488
+
1489
+ case 8:
1490
+
1491
+ /* Line 1455 of yacc.c */
1492
+ #line 88 "parser.y"
1493
+ {concat("</h3>",5);}
1494
+ break;
1495
+
1496
+ case 9:
1497
+
1498
+ /* Line 1455 of yacc.c */
1499
+ #line 89 "parser.y"
1500
+ {concat("</h4>",5);}
1501
+ break;
1502
+
1503
+ case 10:
1504
+
1505
+ /* Line 1455 of yacc.c */
1506
+ #line 90 "parser.y"
1507
+ {concat("</h5>",5);}
1508
+ break;
1509
+
1510
+ case 11:
1511
+
1512
+ /* Line 1455 of yacc.c */
1513
+ #line 91 "parser.y"
1514
+ {concat("<ul>",4);}
1515
+ break;
1516
+
1517
+ case 12:
1518
+
1519
+ /* Line 1455 of yacc.c */
1520
+ #line 91 "parser.y"
1521
+ {concat("</ul>",5);}
1522
+ break;
1523
+
1524
+ case 14:
1525
+
1526
+ /* Line 1455 of yacc.c */
1527
+ #line 92 "parser.y"
1528
+ {concat("<ol>",4);}
1529
+ break;
1530
+
1531
+ case 15:
1532
+
1533
+ /* Line 1455 of yacc.c */
1534
+ #line 92 "parser.y"
1535
+ {concat("</ol>",5);}
1536
+ break;
1537
+
1538
+ case 18:
1539
+
1540
+ /* Line 1455 of yacc.c */
1541
+ #line 95 "parser.y"
1542
+ {concat("</li>",5);}
1543
+ break;
1544
+
1545
+ case 19:
1546
+
1547
+ /* Line 1455 of yacc.c */
1548
+ #line 96 "parser.y"
1549
+ {concat("</li>",5);}
1550
+ break;
1551
+
1552
+ case 22:
1553
+
1554
+ /* Line 1455 of yacc.c */
1555
+ #line 101 "parser.y"
1556
+ {concat("</li>",5);}
1557
+ break;
1558
+
1559
+ case 23:
1560
+
1561
+ /* Line 1455 of yacc.c */
1562
+ #line 102 "parser.y"
1563
+ {concat("</li>",5);}
1564
+ break;
1565
+
1566
+ case 30:
1567
+
1568
+ /* Line 1455 of yacc.c */
1569
+ #line 112 "parser.y"
1570
+ {concat2((yyvsp[(1) - (1)].svalue));}
1571
+ break;
1572
+
1573
+ case 31:
1574
+
1575
+ /* Line 1455 of yacc.c */
1576
+ #line 113 "parser.y"
1577
+ {process_url((yyvsp[(1) - (1)].svalue));}
1578
+ break;
1579
+
1580
+ case 32:
1581
+
1582
+ /* Line 1455 of yacc.c */
1583
+ #line 114 "parser.y"
1584
+ {(yyvsp[(1) - (1)].ivalue) ? concat(" <strong>",9) : concat("<strong>",8);}
1585
+ break;
1586
+
1587
+ case 33:
1588
+
1589
+ /* Line 1455 of yacc.c */
1590
+ #line 115 "parser.y"
1591
+ {concat("</strong>",9);}
1592
+ break;
1593
+
1594
+ case 34:
1595
+
1596
+ /* Line 1455 of yacc.c */
1597
+ #line 116 "parser.y"
1598
+ {(yyvsp[(1) - (1)].ivalue) ? concat(" <em>",5) : concat("<em>",4);}
1599
+ break;
1600
+
1601
+ case 35:
1602
+
1603
+ /* Line 1455 of yacc.c */
1604
+ #line 117 "parser.y"
1605
+ {concat("</em>",5);}
1606
+ break;
1607
+
1608
+ case 36:
1609
+
1610
+ /* Line 1455 of yacc.c */
1611
+ #line 119 "parser.y"
1612
+ {process_ticket_link((yyvsp[(1) - (1)].svalue));}
1613
+ break;
1614
+
1615
+ case 37:
1616
+
1617
+ /* Line 1455 of yacc.c */
1618
+ #line 120 "parser.y"
1619
+ {process_svn_link((yyvsp[(1) - (1)].svalue));}
1620
+ break;
1621
+
1622
+ case 38:
1623
+
1624
+ /* Line 1455 of yacc.c */
1625
+ #line 121 "parser.y"
1626
+ {process_git_link((yyvsp[(1) - (1)].svalue));}
1627
+ break;
1628
+
1629
+ case 39:
1630
+
1631
+ /* Line 1455 of yacc.c */
1632
+ #line 122 "parser.y"
1633
+ {process_url_link((yyvsp[(1) - (1)].svalue),NULL);}
1634
+ break;
1635
+
1636
+ case 40:
1637
+
1638
+ /* Line 1455 of yacc.c */
1639
+ #line 123 "parser.y"
1640
+ {process_url_link((yyvsp[(1) - (1)].svalue),"http://");}
1641
+ break;
1642
+
1643
+ case 41:
1644
+
1645
+ /* Line 1455 of yacc.c */
1646
+ #line 124 "parser.y"
1647
+ {process_wiki_link((yyvsp[(1) - (1)].svalue));}
1648
+ break;
1649
+
1650
+ case 42:
1651
+
1652
+ /* Line 1455 of yacc.c */
1653
+ #line 125 "parser.y"
1654
+ {process_anchor_link((yyvsp[(1) - (1)].svalue));}
1655
+ break;
1656
+
1657
+ case 45:
1658
+
1659
+ /* Line 1455 of yacc.c */
1660
+ #line 130 "parser.y"
1661
+ {concat_escaped_char((yyvsp[(1) - (1)].ivalue));}
1662
+ break;
1663
+
1664
+ case 46:
1665
+
1666
+ /* Line 1455 of yacc.c */
1667
+ #line 137 "parser.y"
1668
+ {concat("<h1 id=\"",8); process_header((yyvsp[(1) - (1)].svalue));}
1669
+ break;
1670
+
1671
+ case 47:
1672
+
1673
+ /* Line 1455 of yacc.c */
1674
+ #line 138 "parser.y"
1675
+ {concat("<h2 id=\"",8); process_header((yyvsp[(1) - (1)].svalue));}
1676
+ break;
1677
+
1678
+ case 48:
1679
+
1680
+ /* Line 1455 of yacc.c */
1681
+ #line 139 "parser.y"
1682
+ {concat("<h3 id=\"",8); process_header((yyvsp[(1) - (1)].svalue));}
1683
+ break;
1684
+
1685
+ case 49:
1686
+
1687
+ /* Line 1455 of yacc.c */
1688
+ #line 140 "parser.y"
1689
+ {concat("<h4 id=\"",8); process_header((yyvsp[(1) - (1)].svalue));}
1690
+ break;
1691
+
1692
+ case 50:
1693
+
1694
+ /* Line 1455 of yacc.c */
1695
+ #line 141 "parser.y"
1696
+ {concat("<h5 id=\"",8); process_header((yyvsp[(1) - (1)].svalue));}
1697
+ break;
1698
+
1699
+ case 51:
1700
+
1701
+ /* Line 1455 of yacc.c */
1702
+ #line 143 "parser.y"
1703
+ {concat("<li>",4);}
1704
+ break;
1705
+
1706
+ case 52:
1707
+
1708
+ /* Line 1455 of yacc.c */
1709
+ #line 144 "parser.y"
1710
+ {concat("<li>",4);}
1711
+ break;
1712
+
1713
+ case 53:
1714
+
1715
+ /* Line 1455 of yacc.c */
1716
+ #line 145 "parser.y"
1717
+ {concat("<br />",6);}
1718
+ break;
1719
+
1720
+ case 54:
1721
+
1722
+ /* Line 1455 of yacc.c */
1723
+ #line 146 "parser.y"
1724
+ {concat("<br /><br />",12);}
1725
+ break;
1726
+
1727
+ case 55:
1728
+
1729
+ /* Line 1455 of yacc.c */
1730
+ #line 147 "parser.y"
1731
+ {concat("<pre><code>",11);}
1732
+ break;
1733
+
1734
+ case 56:
1735
+
1736
+ /* Line 1455 of yacc.c */
1737
+ #line 147 "parser.y"
1738
+ {concat("</code></pre>",13);}
1739
+ break;
1740
+
1741
+
1742
+
1743
+ /* Line 1455 of yacc.c */
1744
+ #line 1745 "parser.tab.c"
1745
+ default: break;
1746
+ }
1747
+ YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1748
+
1749
+ YYPOPSTACK (yylen);
1750
+ yylen = 0;
1751
+ YY_STACK_PRINT (yyss, yyssp);
1752
+
1753
+ *++yyvsp = yyval;
1754
+
1755
+ /* Now `shift' the result of the reduction. Determine what state
1756
+ that goes to, based on the state we popped back to and the rule
1757
+ number reduced by. */
1758
+
1759
+ yyn = yyr1[yyn];
1760
+
1761
+ yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1762
+ if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1763
+ yystate = yytable[yystate];
1764
+ else
1765
+ yystate = yydefgoto[yyn - YYNTOKENS];
1766
+
1767
+ goto yynewstate;
1768
+
1769
+
1770
+ /*------------------------------------.
1771
+ | yyerrlab -- here on detecting error |
1772
+ `------------------------------------*/
1773
+ yyerrlab:
1774
+ /* If not already recovering from an error, report this error. */
1775
+ if (!yyerrstatus)
1776
+ {
1777
+ ++yynerrs;
1778
+ #if ! YYERROR_VERBOSE
1779
+ yyerror (YY_("syntax error"));
1780
+ #else
1781
+ {
1782
+ YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1783
+ if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1784
+ {
1785
+ YYSIZE_T yyalloc = 2 * yysize;
1786
+ if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1787
+ yyalloc = YYSTACK_ALLOC_MAXIMUM;
1788
+ if (yymsg != yymsgbuf)
1789
+ YYSTACK_FREE (yymsg);
1790
+ yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1791
+ if (yymsg)
1792
+ yymsg_alloc = yyalloc;
1793
+ else
1794
+ {
1795
+ yymsg = yymsgbuf;
1796
+ yymsg_alloc = sizeof yymsgbuf;
1797
+ }
1798
+ }
1799
+
1800
+ if (0 < yysize && yysize <= yymsg_alloc)
1801
+ {
1802
+ (void) yysyntax_error (yymsg, yystate, yychar);
1803
+ yyerror (yymsg);
1804
+ }
1805
+ else
1806
+ {
1807
+ yyerror (YY_("syntax error"));
1808
+ if (yysize != 0)
1809
+ goto yyexhaustedlab;
1810
+ }
1811
+ }
1812
+ #endif
1813
+ }
1814
+
1815
+
1816
+
1817
+ if (yyerrstatus == 3)
1818
+ {
1819
+ /* If just tried and failed to reuse lookahead token after an
1820
+ error, discard it. */
1821
+
1822
+ if (yychar <= YYEOF)
1823
+ {
1824
+ /* Return failure if at end of input. */
1825
+ if (yychar == YYEOF)
1826
+ YYABORT;
1827
+ }
1828
+ else
1829
+ {
1830
+ yydestruct ("Error: discarding",
1831
+ yytoken, &yylval);
1832
+ yychar = YYEMPTY;
1833
+ }
1834
+ }
1835
+
1836
+ /* Else will try to reuse lookahead token after shifting the error
1837
+ token. */
1838
+ goto yyerrlab1;
1839
+
1840
+
1841
+ /*---------------------------------------------------.
1842
+ | yyerrorlab -- error raised explicitly by YYERROR. |
1843
+ `---------------------------------------------------*/
1844
+ yyerrorlab:
1845
+
1846
+ /* Pacify compilers like GCC when the user code never invokes
1847
+ YYERROR and the label yyerrorlab therefore never appears in user
1848
+ code. */
1849
+ if (/*CONSTCOND*/ 0)
1850
+ goto yyerrorlab;
1851
+
1852
+ /* Do not reclaim the symbols of the rule which action triggered
1853
+ this YYERROR. */
1854
+ YYPOPSTACK (yylen);
1855
+ yylen = 0;
1856
+ YY_STACK_PRINT (yyss, yyssp);
1857
+ yystate = *yyssp;
1858
+ goto yyerrlab1;
1859
+
1860
+
1861
+ /*-------------------------------------------------------------.
1862
+ | yyerrlab1 -- common code for both syntax error and YYERROR. |
1863
+ `-------------------------------------------------------------*/
1864
+ yyerrlab1:
1865
+ yyerrstatus = 3; /* Each real token shifted decrements this. */
1866
+
1867
+ for (;;)
1868
+ {
1869
+ yyn = yypact[yystate];
1870
+ if (yyn != YYPACT_NINF)
1871
+ {
1872
+ yyn += YYTERROR;
1873
+ if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1874
+ {
1875
+ yyn = yytable[yyn];
1876
+ if (0 < yyn)
1877
+ break;
1878
+ }
1879
+ }
1880
+
1881
+ /* Pop the current state because it cannot handle the error token. */
1882
+ if (yyssp == yyss)
1883
+ YYABORT;
1884
+
1885
+
1886
+ yydestruct ("Error: popping",
1887
+ yystos[yystate], yyvsp);
1888
+ YYPOPSTACK (1);
1889
+ yystate = *yyssp;
1890
+ YY_STACK_PRINT (yyss, yyssp);
1891
+ }
1892
+
1893
+ *++yyvsp = yylval;
1894
+
1895
+
1896
+ /* Shift the error token. */
1897
+ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1898
+
1899
+ yystate = yyn;
1900
+ goto yynewstate;
1901
+
1902
+
1903
+ /*-------------------------------------.
1904
+ | yyacceptlab -- YYACCEPT comes here. |
1905
+ `-------------------------------------*/
1906
+ yyacceptlab:
1907
+ yyresult = 0;
1908
+ goto yyreturn;
1909
+
1910
+ /*-----------------------------------.
1911
+ | yyabortlab -- YYABORT comes here. |
1912
+ `-----------------------------------*/
1913
+ yyabortlab:
1914
+ yyresult = 1;
1915
+ goto yyreturn;
1916
+
1917
+ #if !defined(yyoverflow) || YYERROR_VERBOSE
1918
+ /*-------------------------------------------------.
1919
+ | yyexhaustedlab -- memory exhaustion comes here. |
1920
+ `-------------------------------------------------*/
1921
+ yyexhaustedlab:
1922
+ yyerror (YY_("memory exhausted"));
1923
+ yyresult = 2;
1924
+ /* Fall through. */
1925
+ #endif
1926
+
1927
+ yyreturn:
1928
+ if (yychar != YYEMPTY)
1929
+ yydestruct ("Cleanup: discarding lookahead",
1930
+ yytoken, &yylval);
1931
+ /* Do not reclaim the symbols of the rule which action triggered
1932
+ this YYABORT or YYACCEPT. */
1933
+ YYPOPSTACK (yylen);
1934
+ YY_STACK_PRINT (yyss, yyssp);
1935
+ while (yyssp != yyss)
1936
+ {
1937
+ yydestruct ("Cleanup: popping",
1938
+ yystos[*yyssp], yyvsp);
1939
+ YYPOPSTACK (1);
1940
+ }
1941
+ #ifndef yyoverflow
1942
+ if (yyss != yyssa)
1943
+ YYSTACK_FREE (yyss);
1944
+ #endif
1945
+ #if YYERROR_VERBOSE
1946
+ if (yymsg != yymsgbuf)
1947
+ YYSTACK_FREE (yymsg);
1948
+ #endif
1949
+ /* Make sure YYID is used. */
1950
+ return YYID (yyresult);
1951
+ }
1952
+
1953
+
1954
+
1955
+ /* Line 1675 of yacc.c */
1956
+ #line 151 "parser.y"
1957
+
1958
+
1959
+ concat_hex_char(char c){
1960
+ unsigned char d;
1961
+ d = ((unsigned char)c)>>4;
1962
+ concat_raw_char(d>9 ? ('a'+d-10) : '0'+d);
1963
+ d = c&0x0f;
1964
+ concat_raw_char(d>9 ? ('a'+d-10) : '0'+d);
1965
+ }
1966
+
1967
+ need_hex_convert(const char*p, const char*pend){
1968
+ // scan for non alphanum chars first
1969
+ for(; *p && p<=pend; p++){
1970
+ if( *p == ' ' ||
1971
+ *p == '_' ||
1972
+ *p == '-' ||
1973
+ *p == '.' ||
1974
+ (*p >= '0' && *p <= '9') ||
1975
+ (*p >= 'a' && *p <= 'z') ||
1976
+ (*p >= 'A' && *p <= 'Z')
1977
+ ){
1978
+ // allowed char
1979
+ } else {
1980
+ // forbidden char found
1981
+ return 1;
1982
+ }
1983
+ }
1984
+ return 0;
1985
+ }
1986
+
1987
+ process_header(const char*title){
1988
+ const char*p,*pend;
1989
+
1990
+ // skip heading spaces
1991
+ while(*title == ' ' || *title == '\t') title++;
1992
+
1993
+ // skip tailing spaces
1994
+ p = title;
1995
+ pend = p+strlen(p)-1;
1996
+ while(pend > p && (*pend == ' ' || *pend == '\t')) pend--;
1997
+
1998
+ // concat 'id'
1999
+ if( need_hex_convert(title,pend) ){
2000
+ for(p = title; *p && p<=pend; p++) concat_hex_char( *p );
2001
+ } else {
2002
+ for(p = title; *p && p<=pend; p++) concat_raw_char( *p == ' ' ? '_' : *p);
2003
+ }
2004
+ concat("\">",2);
2005
+ for(p = title; *p && p<=pend; p++) concat_escaped_char( *p );
2006
+ }
2007
+
2008
+ process_link_tail(const char*text,const char*pend,const char*prepend){
2009
+ const char*p;
2010
+
2011
+ concat("\">",2);
2012
+
2013
+ if(!pend){
2014
+ pend = strchr(text,']');
2015
+ pend = pend ? (pend-1) : (text + strlen(text) - 1);
2016
+ }
2017
+
2018
+ // find start of TITLE: [[url:http://www.ru|TITLE]]
2019
+ if(p = strchr(text,'|')){
2020
+ // title found
2021
+ p++;
2022
+ } else {
2023
+ // no title
2024
+ if(prepend) concat2(prepend);
2025
+ p = text;
2026
+ }
2027
+
2028
+ for(; *p && p<=pend; p++) concat_escaped_char( *p );
2029
+ concat("</a>",4);
2030
+ }
2031
+
2032
+ process_anchor_link(const char*target){
2033
+ const char *p,*pend;
2034
+
2035
+ // skip tail
2036
+ p = target;
2037
+ pend = p+strlen(p)-1;
2038
+ while(pend > p && (*pend == ' ' || *pend == '\t' || *pend == ']')) pend--;
2039
+
2040
+ if((p = strchr(target,'|')) && (p<pend) && (p>target)) pend = p-1;
2041
+
2042
+ concat("<a href=\"#",10);
2043
+ if( need_hex_convert(target,pend) ){
2044
+ for(p = target; *p && p<=pend; p++) concat_hex_char( *p );
2045
+ } else {
2046
+ for(p = target; *p && p<=pend; p++) concat_raw_char( *p == ' ' ? '_' : *p);
2047
+ }
2048
+ concat("\" title=\"#",10);
2049
+ for(p = target; *p && p<=pend; p++) concat_raw_char( *p );
2050
+ concat("\" class=\"wiki_link",18);
2051
+ process_link_tail(target,NULL,"#");
2052
+ }
2053
+
2054
+ process_url_link(const char*target,const char* proto){
2055
+ const char *c;
2056
+ concat("<a href=\"",9);
2057
+ if(proto) concat2(proto);
2058
+ for(c=target; *c && *c != ']' && *c != '|'; c++) concat_raw_char(*c);
2059
+ process_link_tail(target,NULL,proto);
2060
+ }
2061
+
2062
+ process_svn_link(const char*target){
2063
+ const char *c;
2064
+ concat("<a href=\"http://code.assembla.com/",34);
2065
+ concat2(space_name);
2066
+ concat("/svn/changesets/",16);
2067
+ for(c=target; *c && *c!=']' && *c!='|'; c++) concat_raw_char(*c);
2068
+ process_link_tail(target,NULL,"revision:");
2069
+ }
2070
+
2071
+ process_git_link(const char*target){
2072
+ const char *c;
2073
+ concat("<a href=\"http://code.assembla.com/",34);
2074
+ concat2(space_name);
2075
+ concat("/git/changesets/",16);
2076
+ for(c=target; *c && *c!=']' && *c!='|'; c++) concat_raw_char(*c);
2077
+ process_link_tail(target,NULL,"revision:");
2078
+ }
2079
+
2080
+ process_wiki_link(const char*target){
2081
+ const char *c;
2082
+ concat("<a class=\"wiki_link\" title=\"",28);
2083
+ for(c=target; *c && *c!=']' && *c!='|'; c++) concat_raw_char(*c);
2084
+ concat("\" href=\"/wiki/show/",19);
2085
+ concat2(space_name);
2086
+ concat_raw_char('/');
2087
+ for(c=target; *c && *c!=']' && *c!='|'; c++) concat_raw_char(*c);
2088
+ process_link_tail(target,NULL,NULL);
2089
+ }
2090
+
2091
+ process_ticket_link(const char*ticket_id){
2092
+ const char *c;
2093
+ while(*ticket_id && (*ticket_id < '0' || *ticket_id > '9') ) ticket_id++;
2094
+ concat("<a href=\"/spaces/",17);
2095
+ concat2(space_name);
2096
+ concat("/tickets/",9);
2097
+ for(c=ticket_id; *c && *c>='0' && *c<='9'; c++) concat_raw_char(*c);
2098
+ process_link_tail(ticket_id,NULL,"#");
2099
+ }
2100
+
2101
+ concat_escaped_char(int c){
2102
+ switch(c){
2103
+ case '<':
2104
+ concat("&lt;",4);
2105
+ break;
2106
+ case '>':
2107
+ concat("&gt;",4);
2108
+ break;
2109
+ case '"':
2110
+ concat("&quot;",6);
2111
+ break;
2112
+ case '&':
2113
+ concat("&amp;",5);
2114
+ break;
2115
+ default:
2116
+ concat_raw_char(c);
2117
+ break;
2118
+ }
2119
+ }
2120
+
2121
+
2122
+ concat_raw_char(int c){
2123
+ CHECK_BUF_SIZE(1);
2124
+ *bufptr++ = c;
2125
+ }
2126
+
2127
+ /*
2128
+ concat_escaping_html(const char*what){
2129
+ char *po = buf + strlen(buf);
2130
+ const char *pi = what;
2131
+
2132
+ for(;*pi;pi++){
2133
+ switch(*pi){
2134
+ case '<':
2135
+ strcpy(po,"&lt;");
2136
+ po += 4;
2137
+ break;
2138
+ case '>':
2139
+ strcpy(po,"&gt;");
2140
+ po += 4;
2141
+ break;
2142
+ case '"':
2143
+ strcpy(po,"&quot;");
2144
+ po += 6;
2145
+ break;
2146
+ case '&':
2147
+ strcpy(po,"&amp;");
2148
+ po += 5;
2149
+ break;
2150
+ default:
2151
+ *po++ = *pi;
2152
+ }
2153
+ }
2154
+ *po = 0;
2155
+ }*/
2156
+
2157
+ process_url(const char*url){
2158
+ const char *p;
2159
+
2160
+ concat("<a href=\"",9);
2161
+ for(p=url; *p; p++) concat_raw_char(*p);
2162
+ process_link_tail(url,NULL,NULL);
2163
+ }
2164
+