breakout_parser 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/breakout_parser/lex.yy.c +669 -478
- data/ext/breakout_parser/make_win32.bat +1 -0
- data/ext/breakout_parser/parser.l +31 -30
- data/ext/breakout_parser/parser.tab.c +189 -166
- data/ext/breakout_parser/parser.tab.h +23 -22
- data/ext/breakout_parser/parser.y +17 -1
- data/ext/breakout_parser/ruby_ext.c +15 -1
- data/spec/parser_spec.rb +94 -28
- metadata +2 -2
@@ -5,6 +5,7 @@
|
|
5
5
|
// HACK for parsing end of bold/italic text at EOF
|
6
6
|
// see http://flex.sourceforge.net/manual/How-can-I-match-text-only-at-the-end-of-a-file_003f.html#How-can-I-match-text-only-at-the-end-of-a-file_003f
|
7
7
|
int was_fake_br = 0;
|
8
|
+
int parse_links_only = 0;
|
8
9
|
|
9
10
|
extern char* in_buf;
|
10
11
|
extern char* in_pos;
|
@@ -77,23 +78,19 @@ extern size_t in_buf_len;
|
|
77
78
|
%}
|
78
79
|
|
79
80
|
%option stack
|
80
|
-
%x _PRE_CODE _PRE _CODE _NOTEXTILE
|
81
|
+
%x _PRE_CODE _PRE _CODE _NOTEXTILE _LINKS_ONLY
|
81
82
|
%s _BOLD _ITALIC
|
82
83
|
|
83
84
|
|
84
85
|
|
85
86
|
%%
|
87
|
+
if( parse_links_only ) BEGIN(_LINKS_ONLY);
|
86
88
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
([ \t]*\r){2,} { return BRBR; }
|
93
|
-
([ \t]*\r\n){2,} { return BRBR; }
|
94
|
-
*/
|
95
|
-
|
96
|
-
[ \t]*(\r\n|\r|\n) { return BR; }
|
89
|
+
<INITIAL,_LINKS_ONLY,_BOLD,_ITALIC>{
|
90
|
+
\xff ; /* EOF mark. should not appear in valid UTF8 text */
|
91
|
+
[\r\n\t ]+\xff ; /* EOF + skip tailing whitespace */
|
92
|
+
[ \t]*(\r\n|\r|\n) { return BR; }
|
93
|
+
}
|
97
94
|
|
98
95
|
\<pre>[ \t]*<code>[\r\n]* { BEGIN _PRE_CODE; return PRE_CODE_START; }
|
99
96
|
\<pre>[\r\n]* { BEGIN _PRE; return PRE_START; }
|
@@ -124,35 +121,39 @@ extern size_t in_buf_len;
|
|
124
121
|
^[ \t]*\*[ ]+ { return ULI; }
|
125
122
|
^[ \t]*#[ ]+ { return OLI; }
|
126
123
|
|
127
|
-
https?:\/\/[^ \r\n<>"(){}*]+[^ \r\n<>"(){}*,.\[\]] { yylval.svalue = yytext; return URL; }
|
128
124
|
|
129
|
-
|
130
|
-
|
125
|
+
<INITIAL,_LINKS_ONLY,_BOLD,_ITALIC>{
|
126
|
+
(https?:\/\/|www\.)[^ \r\n<>"(){}*]+[^ \r\n<>"(){}*,.\[\]] { yylval.svalue = yytext; return URL; }
|
131
127
|
|
132
|
-
|
133
|
-
\[\[revision:[0-9a-f]+(\|[^\[\]]+)?\]\] { yylval.svalue = yytext+11; return GIT_REVISION_LINK; }
|
134
|
-
\[\[r:[0-9]+(\|[^\[\]]+)?\]\] { yylval.svalue = yytext+4; return SVN_REVISION_LINK; }
|
135
|
-
\[\[r:[0-9a-f]+(\|[^\[\]]+)?\]\] { yylval.svalue = yytext+4; return GIT_REVISION_LINK; }
|
128
|
+
[0-9a-zA-Z_.-]+@[0-9a-zA-Z_-]{2,}\.[0-9a-zA-Z_.-]+[a-zA-Z0-9] { yylval.svalue = yytext; return EMAIL; }
|
136
129
|
|
137
|
-
|
138
|
-
\[\[
|
139
|
-
|
130
|
+
#[0-9]+/[ \t\r\n,.;()?!:-] { yylval.svalue = yytext; return TICKET_LINK; }
|
131
|
+
\[\[ticket:[0-9]+(\|[^\[\]]+)?\]\] { yylval.svalue = yytext; return TICKET_LINK; }
|
132
|
+
|
133
|
+
\[\[revision:[0-9]+(\|[^\[\]]+)?\]\] { yylval.svalue = yytext+11; return SVN_REVISION_LINK; }
|
134
|
+
\[\[revision:[0-9a-f]+(\|[^\[\]]+)?\]\] { yylval.svalue = yytext+11; return GIT_REVISION_LINK; }
|
135
|
+
\[\[r:[0-9]+(\|[^\[\]]+)?\]\] { yylval.svalue = yytext+4; return SVN_REVISION_LINK; }
|
136
|
+
\[\[r:[0-9a-f]+(\|[^\[\]]+)?\]\] { yylval.svalue = yytext+4; return GIT_REVISION_LINK; }
|
140
137
|
|
141
|
-
\[\[
|
142
|
-
\[\[[
|
138
|
+
\[\[url:[a-z]+:\/\/[^]]+\]\] { yylval.svalue = yytext+6; return URL_WITH_PROTO_LINK; }
|
139
|
+
\[\[url:\/[^]]+\]\] { yylval.svalue = yytext+6; return URL_WITH_PROTO_LINK; }
|
140
|
+
\[\[url:[^]]+\]\] { yylval.svalue = yytext+6; return URL_WITHOUT_PROTO_LINK; }
|
143
141
|
|
144
|
-
\[\[
|
142
|
+
\[\[wiki:[^]]+\]\] { yylval.svalue = yytext+7; return WIKI_LINK; }
|
143
|
+
\[\[[a-zA-Z0-9_-][a-zA-Z0-9_#-]+(\|[^\[\]]+)?\]\] { yylval.svalue = yytext+2; return WIKI_LINK; }
|
145
144
|
|
146
|
-
\[\[
|
147
|
-
\[\[image:[a-zA-Z0-9_.-]+(\|[^\[\]]+)?\]\] { yylval.svalue = yytext+8; return IMAGE_LINK; }
|
145
|
+
\[\[#[^\r\n\[\]]+\]\] { yylval.svalue = yytext+3; return ANCHOR_LINK; }
|
148
146
|
|
149
|
-
|
150
|
-
[
|
147
|
+
\[\[file:[a-zA-Z0-9_.-]+(\|[^\[\]]+)?\]\] { yylval.svalue = yytext+7; return FILE_LINK; }
|
148
|
+
\[\[image:[a-zA-Z0-9_.-]+(\|[^\[\]]+)?\]\] { yylval.svalue = yytext+8; return IMAGE_LINK; }
|
151
149
|
|
152
|
-
[
|
150
|
+
^[ \t]+ ; /* skip spaces at line start */
|
151
|
+
[ \t]+ { yylval.ivalue = ' '; return T_CHAR; }
|
153
152
|
|
154
|
-
|
153
|
+
[a-zA-Z0-9]+ { yylval.svalue = yytext; return T_WORD; }
|
155
154
|
|
155
|
+
. { yylval.ivalue = yytext[0]; return T_CHAR; }
|
156
|
+
}
|
156
157
|
|
157
158
|
<_NOTEXTILE>[ \t\r\n]*<\/notextile> { BEGIN INITIAL; return NOTEXTILE_END; }
|
158
159
|
<_NOTEXTILE>[ \t\r\n]*\xff { BEGIN INITIAL; return NOTEXTILE_END; }
|
@@ -172,27 +172,28 @@ void yyerror(const char *msg)
|
|
172
172
|
FILE_LINK = 270,
|
173
173
|
IMAGE_LINK = 271,
|
174
174
|
URL = 272,
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
175
|
+
EMAIL = 273,
|
176
|
+
UL = 274,
|
177
|
+
H1 = 275,
|
178
|
+
H2 = 276,
|
179
|
+
H3 = 277,
|
180
|
+
H4 = 278,
|
181
|
+
H5 = 279,
|
182
|
+
INLINE_CODE = 280,
|
183
|
+
SPACE = 281,
|
184
|
+
BR = 282,
|
185
|
+
OLI = 283,
|
186
|
+
ULI = 284,
|
187
|
+
PRE_CODE_START = 285,
|
188
|
+
PRE_CODE_END = 286,
|
189
|
+
PRE_START = 287,
|
190
|
+
PRE_END = 288,
|
191
|
+
CODE_START = 289,
|
192
|
+
CODE_END = 290,
|
193
|
+
NOTEXTILE_START = 291,
|
194
|
+
NOTEXTILE_END = 292,
|
195
|
+
BOLD_END = 293,
|
196
|
+
ITALIC_END = 294
|
196
197
|
};
|
197
198
|
#endif
|
198
199
|
|
@@ -212,7 +213,7 @@ typedef union YYSTYPE
|
|
212
213
|
|
213
214
|
|
214
215
|
/* Line 214 of yacc.c */
|
215
|
-
#line
|
216
|
+
#line 217 "parser.tab.c"
|
216
217
|
} YYSTYPE;
|
217
218
|
# define YYSTYPE_IS_TRIVIAL 1
|
218
219
|
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
@@ -224,7 +225,7 @@ typedef union YYSTYPE
|
|
224
225
|
|
225
226
|
|
226
227
|
/* Line 264 of yacc.c */
|
227
|
-
#line
|
228
|
+
#line 229 "parser.tab.c"
|
228
229
|
|
229
230
|
#ifdef short
|
230
231
|
# undef short
|
@@ -437,22 +438,22 @@ union yyalloc
|
|
437
438
|
#endif
|
438
439
|
|
439
440
|
/* YYFINAL -- State number of the termination state. */
|
440
|
-
#define YYFINAL
|
441
|
+
#define YYFINAL 49
|
441
442
|
/* YYLAST -- Last index in YYTABLE. */
|
442
|
-
#define YYLAST
|
443
|
+
#define YYLAST 113
|
443
444
|
|
444
445
|
/* YYNTOKENS -- Number of terminals. */
|
445
|
-
#define YYNTOKENS
|
446
|
+
#define YYNTOKENS 40
|
446
447
|
/* YYNNTS -- Number of nonterminals. */
|
447
448
|
#define YYNNTS 28
|
448
449
|
/* YYNRULES -- Number of rules. */
|
449
|
-
#define YYNRULES
|
450
|
+
#define YYNRULES 64
|
450
451
|
/* YYNRULES -- Number of states. */
|
451
|
-
#define YYNSTATES
|
452
|
+
#define YYNSTATES 78
|
452
453
|
|
453
454
|
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
|
454
455
|
#define YYUNDEFTOK 2
|
455
|
-
#define YYMAXUTOK
|
456
|
+
#define YYMAXUTOK 294
|
456
457
|
|
457
458
|
#define YYTRANSLATE(YYX) \
|
458
459
|
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
|
@@ -489,7 +490,7 @@ static const yytype_uint8 yytranslate[] =
|
|
489
490
|
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
|
490
491
|
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
|
491
492
|
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
|
492
|
-
35, 36, 37, 38
|
493
|
+
35, 36, 37, 38, 39
|
493
494
|
};
|
494
495
|
|
495
496
|
#if YYDEBUG
|
@@ -501,29 +502,29 @@ static const yytype_uint8 yyprhs[] =
|
|
501
502
|
19, 21, 22, 23, 28, 29, 30, 35, 37, 39,
|
502
503
|
42, 45, 49, 51, 54, 57, 61, 63, 66, 68,
|
503
504
|
70, 72, 74, 76, 78, 80, 82, 84, 86, 88,
|
504
|
-
90, 92, 94, 96, 98, 100, 102,
|
505
|
-
110, 112, 114, 116, 118, 120, 122, 124,
|
506
|
-
|
505
|
+
90, 92, 94, 96, 98, 100, 102, 104, 105, 108,
|
506
|
+
110, 112, 114, 116, 118, 120, 122, 124, 126, 127,
|
507
|
+
132, 136, 137, 142, 143
|
507
508
|
};
|
508
509
|
|
509
510
|
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
|
510
511
|
static const yytype_int8 yyrhs[] =
|
511
512
|
{
|
512
|
-
|
513
|
-
-1,
|
514
|
-
-1, -1, -1,
|
515
|
-
|
516
|
-
|
517
|
-
-1,
|
518
|
-
-1,
|
519
|
-
6, -1, 17, -1,
|
520
|
-
|
521
|
-
|
522
|
-
16, -1, -1,
|
523
|
-
20, -1, 21, -1, 22, -1, 23, -1,
|
524
|
-
28, -1,
|
525
|
-
|
526
|
-
-1,
|
513
|
+
41, 0, -1, -1, 42, 41, -1, 63, -1, 51,
|
514
|
+
-1, 56, -1, 57, -1, 58, -1, 59, -1, 60,
|
515
|
+
-1, -1, -1, 43, 47, 44, 42, -1, -1, -1,
|
516
|
+
45, 49, 46, 42, -1, 64, -1, 48, -1, 47,
|
517
|
+
48, -1, 62, 51, -1, 62, 51, 27, -1, 50,
|
518
|
+
-1, 49, 50, -1, 61, 51, -1, 61, 51, 27,
|
519
|
+
-1, 52, -1, 52, 51, -1, 54, -1, 53, -1,
|
520
|
+
6, -1, 17, -1, 18, -1, 4, -1, 38, -1,
|
521
|
+
5, -1, 39, -1, 25, -1, 7, -1, 9, -1,
|
522
|
+
10, -1, 13, -1, 14, -1, 11, -1, 12, -1,
|
523
|
+
15, -1, 16, -1, -1, 55, 54, -1, 3, -1,
|
524
|
+
20, -1, 21, -1, 22, -1, 23, -1, 24, -1,
|
525
|
+
28, -1, 29, -1, 27, -1, -1, 30, 65, 54,
|
526
|
+
31, -1, 36, 54, 37, -1, -1, 32, 66, 54,
|
527
|
+
33, -1, -1, 34, 67, 54, 35, -1
|
527
528
|
};
|
528
529
|
|
529
530
|
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
|
@@ -532,10 +533,10 @@ static const yytype_uint8 yyrline[] =
|
|
532
533
|
0, 85, 85, 86, 89, 90, 91, 92, 93, 94,
|
533
534
|
95, 96, 96, 96, 97, 97, 97, 98, 100, 101,
|
534
535
|
103, 104, 106, 107, 109, 110, 112, 113, 115, 116,
|
535
|
-
117, 118, 119, 120, 121, 122, 123,
|
536
|
-
128, 129, 130, 131, 132, 133,
|
537
|
-
146, 147, 148, 149,
|
538
|
-
158,
|
536
|
+
117, 118, 119, 120, 121, 122, 123, 124, 126, 127,
|
537
|
+
128, 129, 130, 131, 132, 133, 134, 136, 137, 139,
|
538
|
+
146, 147, 148, 149, 150, 152, 153, 154, 157, 157,
|
539
|
+
158, 159, 159, 160, 160
|
539
540
|
};
|
540
541
|
#endif
|
541
542
|
|
@@ -547,14 +548,14 @@ static const char *const yytname[] =
|
|
547
548
|
"$end", "error", "$undefined", "T_CHAR", "BOLD_START", "ITALIC_START",
|
548
549
|
"T_WORD", "TICKET_LINK", "LINK", "SVN_REVISION_LINK",
|
549
550
|
"GIT_REVISION_LINK", "WIKI_LINK", "ANCHOR_LINK", "URL_WITH_PROTO_LINK",
|
550
|
-
"URL_WITHOUT_PROTO_LINK", "FILE_LINK", "IMAGE_LINK", "URL", "
|
551
|
-
"H2", "H3", "H4", "H5", "INLINE_CODE", "SPACE", "BR", "OLI",
|
552
|
-
"PRE_CODE_START", "PRE_CODE_END", "PRE_START", "PRE_END",
|
553
|
-
"CODE_END", "NOTEXTILE_START", "NOTEXTILE_END", "BOLD_END",
|
554
|
-
"$accept", "text", "textitem", "$@1", "$@2", "$@3", "$@4",
|
555
|
-
"ulitem", "olist", "olitem", "words", "word", "link", "chars",
|
556
|
-
"h1", "h2", "h3", "h4", "h5", "oli", "uli", "br", "code", "$@5",
|
557
|
-
"$@7", 0
|
551
|
+
"URL_WITHOUT_PROTO_LINK", "FILE_LINK", "IMAGE_LINK", "URL", "EMAIL",
|
552
|
+
"UL", "H1", "H2", "H3", "H4", "H5", "INLINE_CODE", "SPACE", "BR", "OLI",
|
553
|
+
"ULI", "PRE_CODE_START", "PRE_CODE_END", "PRE_START", "PRE_END",
|
554
|
+
"CODE_START", "CODE_END", "NOTEXTILE_START", "NOTEXTILE_END", "BOLD_END",
|
555
|
+
"ITALIC_END", "$accept", "text", "textitem", "$@1", "$@2", "$@3", "$@4",
|
556
|
+
"ulist", "ulitem", "olist", "olitem", "words", "word", "link", "chars",
|
557
|
+
"char", "h1", "h2", "h3", "h4", "h5", "oli", "uli", "br", "code", "$@5",
|
558
|
+
"$@6", "$@7", 0
|
558
559
|
};
|
559
560
|
#endif
|
560
561
|
|
@@ -566,20 +567,20 @@ static const yytype_uint16 yytoknum[] =
|
|
566
567
|
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
|
567
568
|
265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
|
568
569
|
275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
|
569
|
-
285, 286, 287, 288, 289, 290, 291, 292, 293
|
570
|
+
285, 286, 287, 288, 289, 290, 291, 292, 293, 294
|
570
571
|
};
|
571
572
|
# endif
|
572
573
|
|
573
574
|
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
|
574
575
|
static const yytype_uint8 yyr1[] =
|
575
576
|
{
|
576
|
-
0,
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
56, 57, 58, 59, 60, 61, 62,
|
582
|
-
|
577
|
+
0, 40, 41, 41, 42, 42, 42, 42, 42, 42,
|
578
|
+
42, 43, 44, 42, 45, 46, 42, 42, 47, 47,
|
579
|
+
48, 48, 49, 49, 50, 50, 51, 51, 52, 52,
|
580
|
+
52, 52, 52, 52, 52, 52, 52, 52, 53, 53,
|
581
|
+
53, 53, 53, 53, 53, 53, 53, 54, 54, 55,
|
582
|
+
56, 57, 58, 59, 60, 61, 62, 63, 65, 64,
|
583
|
+
64, 66, 64, 67, 64
|
583
584
|
};
|
584
585
|
|
585
586
|
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
|
@@ -589,9 +590,9 @@ static const yytype_uint8 yyr2[] =
|
|
589
590
|
1, 0, 0, 4, 0, 0, 4, 1, 1, 2,
|
590
591
|
2, 3, 1, 2, 2, 3, 1, 2, 1, 1,
|
591
592
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
592
|
-
1, 1, 1, 1, 1, 1, 0, 2, 1,
|
593
|
-
1, 1, 1, 1, 1, 1, 1, 0, 4,
|
594
|
-
0, 4, 0, 4
|
593
|
+
1, 1, 1, 1, 1, 1, 1, 0, 2, 1,
|
594
|
+
1, 1, 1, 1, 1, 1, 1, 1, 0, 4,
|
595
|
+
3, 0, 4, 0, 4
|
595
596
|
};
|
596
597
|
|
597
598
|
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
|
@@ -599,82 +600,82 @@ static const yytype_uint8 yyr2[] =
|
|
599
600
|
means the default is an error. */
|
600
601
|
static const yytype_uint8 yydefact[] =
|
601
602
|
{
|
602
|
-
2,
|
603
|
-
|
604
|
-
|
605
|
-
0, 0, 5, 26, 29, 28,
|
606
|
-
9, 10, 4, 17,
|
607
|
-
|
608
|
-
|
609
|
-
|
603
|
+
2, 49, 33, 35, 30, 38, 39, 40, 43, 44,
|
604
|
+
41, 42, 45, 46, 31, 32, 50, 51, 52, 53,
|
605
|
+
54, 37, 57, 58, 61, 63, 47, 34, 36, 0,
|
606
|
+
2, 0, 0, 5, 26, 29, 28, 47, 6, 7,
|
607
|
+
8, 9, 10, 4, 17, 47, 47, 47, 0, 1,
|
608
|
+
3, 56, 12, 18, 47, 55, 15, 22, 47, 27,
|
609
|
+
48, 0, 0, 0, 60, 11, 19, 20, 11, 23,
|
610
|
+
24, 59, 62, 64, 13, 21, 16, 25
|
610
611
|
};
|
611
612
|
|
612
613
|
/* YYDEFGOTO[NTERM-NUM]. */
|
613
614
|
static const yytype_int8 yydefgoto[] =
|
614
615
|
{
|
615
|
-
-1,
|
616
|
-
|
617
|
-
|
616
|
+
-1, 29, 30, 31, 65, 32, 68, 52, 53, 56,
|
617
|
+
57, 33, 34, 35, 36, 37, 38, 39, 40, 41,
|
618
|
+
42, 58, 54, 43, 44, 45, 46, 47
|
618
619
|
};
|
619
620
|
|
620
621
|
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
|
621
622
|
STATE-NUM. */
|
622
|
-
#define YYPACT_NINF -
|
623
|
+
#define YYPACT_NINF -40
|
623
624
|
static const yytype_int8 yypact[] =
|
624
625
|
{
|
625
|
-
|
626
|
-
-
|
627
|
-
-
|
628
|
-
|
629
|
-
-
|
630
|
-
-
|
631
|
-
|
632
|
-
|
626
|
+
37, -40, -40, -40, -40, -40, -40, -40, -40, -40,
|
627
|
+
-40, -40, -40, -40, -40, -40, -40, -40, -40, -40,
|
628
|
+
-40, -40, -40, -40, -40, -40, -2, -40, -40, 2,
|
629
|
+
37, -21, -9, -40, 74, -40, -40, -2, -40, -40,
|
630
|
+
-40, -40, -40, -40, -40, -2, -2, -2, -6, -40,
|
631
|
+
-40, -40, -21, -40, 74, -40, -9, -40, 74, -40,
|
632
|
+
-40, 4, 12, 21, -40, 0, -40, 6, 0, -40,
|
633
|
+
10, -40, -40, -40, -40, -40, -40, -40
|
633
634
|
};
|
634
635
|
|
635
636
|
/* YYPGOTO[NTERM-NUM]. */
|
636
637
|
static const yytype_int8 yypgoto[] =
|
637
638
|
{
|
638
|
-
-
|
639
|
-
|
640
|
-
-
|
639
|
+
-40, 33, -39, -40, -40, -40, -40, -40, 16, -40,
|
640
|
+
14, 40, -40, -40, 56, -40, -40, -40, -40, -40,
|
641
|
+
-40, -40, -40, -40, -40, -40, -40, -40
|
641
642
|
};
|
642
643
|
|
643
644
|
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
|
644
645
|
positive, shift that token. If negative, reduce the rule which
|
645
646
|
number is the opposite. If zero, do what YYDEFACT says.
|
646
647
|
If YYTABLE_NINF, syntax error. */
|
647
|
-
#define YYTABLE_NINF -
|
648
|
+
#define YYTABLE_NINF -48
|
648
649
|
static const yytype_int8 yytable[] =
|
649
650
|
{
|
650
|
-
-
|
651
|
-
7, 8, 9, 10, 11, 12, 13, 14,
|
652
|
-
16, 17, 18, 19, 20,
|
653
|
-
|
654
|
-
2, 3, 4, 5,
|
655
|
-
11, 12, 13, 14,
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
651
|
+
-47, 1, 49, 1, 2, 3, 4, 5, 51, 6,
|
652
|
+
7, 8, 9, 10, 11, 12, 13, 14, 15, 55,
|
653
|
+
16, 17, 18, 19, 20, 21, 74, 22, -14, 76,
|
654
|
+
23, 64, 24, 75, 25, 71, 26, 77, 27, 28,
|
655
|
+
1, 2, 3, 4, 5, 72, 6, 7, 8, 9,
|
656
|
+
10, 11, 12, 13, 14, 15, 73, 16, 17, 18,
|
657
|
+
19, 20, 21, 50, 22, -14, -11, 23, 66, 24,
|
658
|
+
69, 25, 0, 26, 59, 27, 28, 1, 2, 3,
|
659
|
+
4, 5, 48, 6, 7, 8, 9, 10, 11, 12,
|
660
|
+
13, 14, 15, 60, 67, 0, 0, 0, 70, 21,
|
661
|
+
0, 61, 62, 63, 0, 0, 0, 0, 0, 0,
|
662
|
+
0, 0, 27, 28
|
662
663
|
};
|
663
664
|
|
664
665
|
static const yytype_int8 yycheck[] =
|
665
666
|
{
|
666
|
-
0, 3, 0, 3, 4, 5, 6, 7,
|
667
|
-
10, 11, 12, 13, 14, 15, 16, 17,
|
668
|
-
20, 21, 22, 23, 24,
|
669
|
-
|
670
|
-
4, 5, 6, 7,
|
671
|
-
14, 15, 16, 17,
|
672
|
-
24,
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
45, 46,
|
677
|
-
38
|
667
|
+
0, 3, 0, 3, 4, 5, 6, 7, 29, 9,
|
668
|
+
10, 11, 12, 13, 14, 15, 16, 17, 18, 28,
|
669
|
+
20, 21, 22, 23, 24, 25, 65, 27, 28, 68,
|
670
|
+
30, 37, 32, 27, 34, 31, 36, 27, 38, 39,
|
671
|
+
3, 4, 5, 6, 7, 33, 9, 10, 11, 12,
|
672
|
+
13, 14, 15, 16, 17, 18, 35, 20, 21, 22,
|
673
|
+
23, 24, 25, 30, 27, 28, 29, 30, 52, 32,
|
674
|
+
56, 34, -1, 36, 34, 38, 39, 3, 4, 5,
|
675
|
+
6, 7, 26, 9, 10, 11, 12, 13, 14, 15,
|
676
|
+
16, 17, 18, 37, 54, -1, -1, -1, 58, 25,
|
677
|
+
-1, 45, 46, 47, -1, -1, -1, -1, -1, -1,
|
678
|
+
-1, -1, 38, 39
|
678
679
|
};
|
679
680
|
|
680
681
|
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
|
@@ -682,13 +683,13 @@ static const yytype_int8 yycheck[] =
|
|
682
683
|
static const yytype_uint8 yystos[] =
|
683
684
|
{
|
684
685
|
0, 3, 4, 5, 6, 7, 9, 10, 11, 12,
|
685
|
-
13, 14, 15, 16, 17,
|
686
|
-
24,
|
687
|
-
42,
|
688
|
-
58, 59,
|
689
|
-
|
690
|
-
|
691
|
-
|
686
|
+
13, 14, 15, 16, 17, 18, 20, 21, 22, 23,
|
687
|
+
24, 25, 27, 30, 32, 34, 36, 38, 39, 41,
|
688
|
+
42, 43, 45, 51, 52, 53, 54, 55, 56, 57,
|
689
|
+
58, 59, 60, 63, 64, 65, 66, 67, 54, 0,
|
690
|
+
41, 29, 47, 48, 62, 28, 49, 50, 61, 51,
|
691
|
+
54, 54, 54, 54, 37, 44, 48, 51, 46, 50,
|
692
|
+
51, 31, 33, 35, 42, 27, 42, 27
|
692
693
|
};
|
693
694
|
|
694
695
|
#define yyerrok (yyerrstatus = 0)
|
@@ -1608,147 +1609,147 @@ yyreduce:
|
|
1608
1609
|
|
1609
1610
|
/* Line 1455 of yacc.c */
|
1610
1611
|
#line 119 "parser.y"
|
1611
|
-
{(yyvsp[(1) - (1)].
|
1612
|
+
{process_email((yyvsp[(1) - (1)].svalue));}
|
1612
1613
|
break;
|
1613
1614
|
|
1614
1615
|
case 33:
|
1615
1616
|
|
1616
1617
|
/* Line 1455 of yacc.c */
|
1617
1618
|
#line 120 "parser.y"
|
1618
|
-
{concat("
|
1619
|
+
{(yyvsp[(1) - (1)].ivalue) ? concat(" <strong>",9) : concat("<strong>",8);}
|
1619
1620
|
break;
|
1620
1621
|
|
1621
1622
|
case 34:
|
1622
1623
|
|
1623
1624
|
/* Line 1455 of yacc.c */
|
1624
1625
|
#line 121 "parser.y"
|
1625
|
-
{
|
1626
|
+
{concat("</strong>",9);}
|
1626
1627
|
break;
|
1627
1628
|
|
1628
1629
|
case 35:
|
1629
1630
|
|
1630
1631
|
/* Line 1455 of yacc.c */
|
1631
1632
|
#line 122 "parser.y"
|
1632
|
-
{concat("
|
1633
|
+
{(yyvsp[(1) - (1)].ivalue) ? concat(" <em>",5) : concat("<em>",4);}
|
1633
1634
|
break;
|
1634
1635
|
|
1635
1636
|
case 36:
|
1636
1637
|
|
1637
1638
|
/* Line 1455 of yacc.c */
|
1638
1639
|
#line 123 "parser.y"
|
1639
|
-
{
|
1640
|
+
{concat("</em>",5);}
|
1640
1641
|
break;
|
1641
1642
|
|
1642
1643
|
case 37:
|
1643
1644
|
|
1644
1645
|
/* Line 1455 of yacc.c */
|
1645
|
-
#line
|
1646
|
-
{
|
1646
|
+
#line 124 "parser.y"
|
1647
|
+
{process_inline_code((yyvsp[(1) - (1)].svalue));}
|
1647
1648
|
break;
|
1648
1649
|
|
1649
1650
|
case 38:
|
1650
1651
|
|
1651
1652
|
/* Line 1455 of yacc.c */
|
1652
1653
|
#line 126 "parser.y"
|
1653
|
-
{
|
1654
|
+
{process_ticket_link((yyvsp[(1) - (1)].svalue));}
|
1654
1655
|
break;
|
1655
1656
|
|
1656
1657
|
case 39:
|
1657
1658
|
|
1658
1659
|
/* Line 1455 of yacc.c */
|
1659
1660
|
#line 127 "parser.y"
|
1660
|
-
{
|
1661
|
+
{process_svn_link((yyvsp[(1) - (1)].svalue));}
|
1661
1662
|
break;
|
1662
1663
|
|
1663
1664
|
case 40:
|
1664
1665
|
|
1665
1666
|
/* Line 1455 of yacc.c */
|
1666
1667
|
#line 128 "parser.y"
|
1667
|
-
{
|
1668
|
+
{process_git_link((yyvsp[(1) - (1)].svalue));}
|
1668
1669
|
break;
|
1669
1670
|
|
1670
1671
|
case 41:
|
1671
1672
|
|
1672
1673
|
/* Line 1455 of yacc.c */
|
1673
1674
|
#line 129 "parser.y"
|
1674
|
-
{process_url_link((yyvsp[(1) - (1)].svalue),
|
1675
|
+
{process_url_link((yyvsp[(1) - (1)].svalue),NULL);}
|
1675
1676
|
break;
|
1676
1677
|
|
1677
1678
|
case 42:
|
1678
1679
|
|
1679
1680
|
/* Line 1455 of yacc.c */
|
1680
1681
|
#line 130 "parser.y"
|
1681
|
-
{
|
1682
|
+
{process_url_link((yyvsp[(1) - (1)].svalue),"http://");}
|
1682
1683
|
break;
|
1683
1684
|
|
1684
1685
|
case 43:
|
1685
1686
|
|
1686
1687
|
/* Line 1455 of yacc.c */
|
1687
1688
|
#line 131 "parser.y"
|
1688
|
-
{
|
1689
|
+
{process_wiki_link((yyvsp[(1) - (1)].svalue));}
|
1689
1690
|
break;
|
1690
1691
|
|
1691
1692
|
case 44:
|
1692
1693
|
|
1693
1694
|
/* Line 1455 of yacc.c */
|
1694
1695
|
#line 132 "parser.y"
|
1695
|
-
{
|
1696
|
+
{process_anchor_link((yyvsp[(1) - (1)].svalue));}
|
1696
1697
|
break;
|
1697
1698
|
|
1698
1699
|
case 45:
|
1699
1700
|
|
1700
1701
|
/* Line 1455 of yacc.c */
|
1701
1702
|
#line 133 "parser.y"
|
1702
|
-
{
|
1703
|
+
{process_file_link((yyvsp[(1) - (1)].svalue));}
|
1703
1704
|
break;
|
1704
1705
|
|
1705
|
-
case
|
1706
|
+
case 46:
|
1706
1707
|
|
1707
1708
|
/* Line 1455 of yacc.c */
|
1708
|
-
#line
|
1709
|
-
{
|
1709
|
+
#line 134 "parser.y"
|
1710
|
+
{process_image_link((yyvsp[(1) - (1)].svalue));}
|
1710
1711
|
break;
|
1711
1712
|
|
1712
1713
|
case 49:
|
1713
1714
|
|
1714
1715
|
/* Line 1455 of yacc.c */
|
1715
|
-
#line
|
1716
|
-
{
|
1716
|
+
#line 139 "parser.y"
|
1717
|
+
{concat_escaped_char((yyvsp[(1) - (1)].ivalue));}
|
1717
1718
|
break;
|
1718
1719
|
|
1719
1720
|
case 50:
|
1720
1721
|
|
1721
1722
|
/* Line 1455 of yacc.c */
|
1722
1723
|
#line 146 "parser.y"
|
1723
|
-
{concat("<
|
1724
|
+
{concat("<h1 id=\"",8); process_header((yyvsp[(1) - (1)].svalue));}
|
1724
1725
|
break;
|
1725
1726
|
|
1726
1727
|
case 51:
|
1727
1728
|
|
1728
1729
|
/* Line 1455 of yacc.c */
|
1729
1730
|
#line 147 "parser.y"
|
1730
|
-
{concat("<
|
1731
|
+
{concat("<h2 id=\"",8); process_header((yyvsp[(1) - (1)].svalue));}
|
1731
1732
|
break;
|
1732
1733
|
|
1733
1734
|
case 52:
|
1734
1735
|
|
1735
1736
|
/* Line 1455 of yacc.c */
|
1736
1737
|
#line 148 "parser.y"
|
1737
|
-
{concat("<
|
1738
|
+
{concat("<h3 id=\"",8); process_header((yyvsp[(1) - (1)].svalue));}
|
1738
1739
|
break;
|
1739
1740
|
|
1740
1741
|
case 53:
|
1741
1742
|
|
1742
1743
|
/* Line 1455 of yacc.c */
|
1743
1744
|
#line 149 "parser.y"
|
1744
|
-
{concat("<
|
1745
|
+
{concat("<h4 id=\"",8); process_header((yyvsp[(1) - (1)].svalue));}
|
1745
1746
|
break;
|
1746
1747
|
|
1747
1748
|
case 54:
|
1748
1749
|
|
1749
1750
|
/* Line 1455 of yacc.c */
|
1750
|
-
#line
|
1751
|
-
{concat("<
|
1751
|
+
#line 150 "parser.y"
|
1752
|
+
{concat("<h5 id=\"",8); process_header((yyvsp[(1) - (1)].svalue));}
|
1752
1753
|
break;
|
1753
1754
|
|
1754
1755
|
case 55:
|
@@ -1762,55 +1763,62 @@ yyreduce:
|
|
1762
1763
|
|
1763
1764
|
/* Line 1455 of yacc.c */
|
1764
1765
|
#line 153 "parser.y"
|
1765
|
-
{concat("<
|
1766
|
+
{concat("<li>",4);}
|
1766
1767
|
break;
|
1767
1768
|
|
1768
1769
|
case 57:
|
1769
1770
|
|
1770
1771
|
/* Line 1455 of yacc.c */
|
1771
|
-
#line
|
1772
|
-
{concat("<
|
1772
|
+
#line 154 "parser.y"
|
1773
|
+
{concat("<br />",6);}
|
1773
1774
|
break;
|
1774
1775
|
|
1775
1776
|
case 58:
|
1776
1777
|
|
1777
1778
|
/* Line 1455 of yacc.c */
|
1778
|
-
#line
|
1779
|
-
{concat("
|
1779
|
+
#line 157 "parser.y"
|
1780
|
+
{concat("<pre><code>",11);}
|
1780
1781
|
break;
|
1781
1782
|
|
1782
|
-
case
|
1783
|
+
case 59:
|
1783
1784
|
|
1784
1785
|
/* Line 1455 of yacc.c */
|
1785
|
-
#line
|
1786
|
-
{concat("
|
1786
|
+
#line 157 "parser.y"
|
1787
|
+
{concat("</code></pre>",13);}
|
1787
1788
|
break;
|
1788
1789
|
|
1789
1790
|
case 61:
|
1790
1791
|
|
1791
1792
|
/* Line 1455 of yacc.c */
|
1792
|
-
#line
|
1793
|
-
{concat("
|
1793
|
+
#line 159 "parser.y"
|
1794
|
+
{concat("<pre>",5);}
|
1794
1795
|
break;
|
1795
1796
|
|
1796
1797
|
case 62:
|
1797
1798
|
|
1798
1799
|
/* Line 1455 of yacc.c */
|
1799
1800
|
#line 159 "parser.y"
|
1800
|
-
{concat("
|
1801
|
+
{concat("</pre>",6);}
|
1801
1802
|
break;
|
1802
1803
|
|
1803
1804
|
case 63:
|
1804
1805
|
|
1805
1806
|
/* Line 1455 of yacc.c */
|
1806
|
-
#line
|
1807
|
+
#line 160 "parser.y"
|
1808
|
+
{concat("<code>",6);}
|
1809
|
+
break;
|
1810
|
+
|
1811
|
+
case 64:
|
1812
|
+
|
1813
|
+
/* Line 1455 of yacc.c */
|
1814
|
+
#line 160 "parser.y"
|
1807
1815
|
{concat("</code>",7);}
|
1808
1816
|
break;
|
1809
1817
|
|
1810
1818
|
|
1811
1819
|
|
1812
1820
|
/* Line 1455 of yacc.c */
|
1813
|
-
#line
|
1821
|
+
#line 1822 "parser.tab.c"
|
1814
1822
|
default: break;
|
1815
1823
|
}
|
1816
1824
|
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
|
@@ -2022,7 +2030,7 @@ yyreturn:
|
|
2022
2030
|
|
2023
2031
|
|
2024
2032
|
/* Line 1675 of yacc.c */
|
2025
|
-
#line
|
2033
|
+
#line 164 "parser.y"
|
2026
2034
|
|
2027
2035
|
|
2028
2036
|
concat_hex_char(char c){
|
@@ -2265,7 +2273,22 @@ process_url(const char*url){
|
|
2265
2273
|
const char *p;
|
2266
2274
|
|
2267
2275
|
concat("<a rel=\"nofollow\" href=\"",24);
|
2276
|
+
if( *url == 'w' ){
|
2277
|
+
// url starts with 'www.'
|
2278
|
+
concat("http://",7);
|
2279
|
+
} else {
|
2280
|
+
// assume url starts with 'http://'
|
2281
|
+
}
|
2282
|
+
for(p=url; *p; p++) concat_raw_char(*p);
|
2283
|
+
process_link_tail(url,NULL,NULL);
|
2284
|
+
}
|
2285
|
+
|
2286
|
+
process_email(const char*url){
|
2287
|
+
const char *p;
|
2288
|
+
|
2289
|
+
concat("<a href=\"mailto:",16);
|
2268
2290
|
for(p=url; *p; p++) concat_raw_char(*p);
|
2269
2291
|
process_link_tail(url,NULL,NULL);
|
2270
2292
|
}
|
2271
2293
|
|
2294
|
+
|