rmultimarkdown 4.7.1.1 → 6.2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +2 -2
- data/README.md +7 -9
- data/Rakefile +33 -18
- data/ext/Makefile +261 -0
- data/ext/extconf.rb +23 -3
- data/ext/mmd/aho-corasick.c +596 -0
- data/ext/mmd/aho-corasick.h +120 -0
- data/ext/mmd/beamer.c +344 -0
- data/ext/mmd/beamer.h +72 -0
- data/ext/mmd/char.c +156 -0
- data/ext/mmd/char.h +111 -0
- data/ext/mmd/char_lookup.c +212 -0
- data/ext/mmd/critic_markup.c +330 -0
- data/ext/mmd/critic_markup.h +94 -0
- data/ext/mmd/d_string.c +402 -0
- data/ext/mmd/epub.c +563 -0
- data/ext/mmd/epub.h +69 -0
- data/ext/mmd/fodt.c +2288 -0
- data/ext/mmd/fodt.h +81 -0
- data/ext/mmd/html.c +2460 -0
- data/ext/mmd/html.h +81 -0
- data/ext/mmd/i18n.h +170 -0
- data/ext/mmd/include/d_string.h +182 -0
- data/ext/mmd/include/libMultiMarkdown.h +548 -0
- data/ext/mmd/include/token.h +233 -0
- data/ext/mmd/latex.c +2435 -0
- data/ext/mmd/latex.h +83 -0
- data/ext/mmd/lexer.c +3001 -0
- data/ext/mmd/lexer.h +75 -0
- data/ext/mmd/memoir.c +138 -0
- data/ext/mmd/memoir.h +67 -0
- data/ext/mmd/miniz.c +7557 -0
- data/ext/mmd/miniz.h +1328 -0
- data/ext/mmd/mmd.c +2798 -0
- data/ext/mmd/mmd.h +120 -0
- data/ext/mmd/object_pool.c +141 -0
- data/ext/mmd/object_pool.h +101 -0
- data/ext/mmd/opendocument-content.c +2071 -0
- data/ext/mmd/opendocument-content.h +135 -0
- data/ext/mmd/opendocument.c +981 -0
- data/ext/mmd/opendocument.h +118 -0
- data/ext/mmd/parser.c +1760 -0
- data/ext/mmd/parser.h +39 -0
- data/{MultiMarkdown-4 → ext/mmd}/rng.c +90 -49
- data/ext/mmd/scanners.c +77512 -0
- data/ext/mmd/scanners.h +101 -0
- data/ext/mmd/stack.c +142 -0
- data/ext/mmd/stack.h +113 -0
- data/ext/mmd/textbundle.c +455 -0
- data/ext/mmd/textbundle.h +115 -0
- data/ext/mmd/token.c +773 -0
- data/ext/mmd/token_pairs.c +263 -0
- data/ext/mmd/token_pairs.h +123 -0
- data/ext/mmd/transclude.c +549 -0
- data/ext/mmd/transclude.h +87 -0
- data/ext/mmd/uthash.h +1074 -0
- data/ext/mmd/uuid.c +154 -0
- data/ext/mmd/uuid.h +77 -0
- data/ext/mmd/version.h +111 -0
- data/ext/mmd/writer.c +2652 -0
- data/ext/mmd/writer.h +260 -0
- data/ext/mmd/zip.c +210 -0
- data/ext/mmd/zip.h +120 -0
- data/ext/{multi_markdown.c → ruby_multi_markdown.c} +87 -18
- data/lib/multi_markdown.bundle +0 -0
- data/lib/multi_markdown.rb +5 -8
- data/lib/multi_markdown/version.rb +1 -1
- data/rmultimarkdown.gemspec +2 -2
- data/test/{extensions_test.rb.rb → extensions_test.rb} +10 -54
- data/test/multi_markdown_test.rb +13 -0
- metadata +67 -47
- data/MultiMarkdown-4/GLibFacade.c +0 -310
- data/MultiMarkdown-4/GLibFacade.h +0 -100
- data/MultiMarkdown-4/beamer.c +0 -182
- data/MultiMarkdown-4/beamer.h +0 -11
- data/MultiMarkdown-4/critic.c +0 -111
- data/MultiMarkdown-4/critic.h +0 -15
- data/MultiMarkdown-4/glib.h +0 -11
- data/MultiMarkdown-4/html.c +0 -1117
- data/MultiMarkdown-4/html.h +0 -14
- data/MultiMarkdown-4/latex.c +0 -1217
- data/MultiMarkdown-4/latex.h +0 -16
- data/MultiMarkdown-4/libMultiMarkdown.h +0 -177
- data/MultiMarkdown-4/lyx.c +0 -2265
- data/MultiMarkdown-4/lyx.h +0 -37
- data/MultiMarkdown-4/lyxbeamer.c +0 -265
- data/MultiMarkdown-4/lyxbeamer.h +0 -11
- data/MultiMarkdown-4/memoir.c +0 -80
- data/MultiMarkdown-4/memoir.h +0 -10
- data/MultiMarkdown-4/multimarkdown.c +0 -518
- data/MultiMarkdown-4/odf.c +0 -1222
- data/MultiMarkdown-4/odf.h +0 -18
- data/MultiMarkdown-4/opml.c +0 -189
- data/MultiMarkdown-4/opml.h +0 -15
- data/MultiMarkdown-4/parse_utilities.c +0 -884
- data/MultiMarkdown-4/parser.c +0 -16656
- data/MultiMarkdown-4/parser.h +0 -188
- data/MultiMarkdown-4/rtf.c +0 -665
- data/MultiMarkdown-4/rtf.h +0 -17
- data/MultiMarkdown-4/strtok.c +0 -56
- data/MultiMarkdown-4/strtok.h +0 -9
- data/MultiMarkdown-4/text.c +0 -53
- data/MultiMarkdown-4/text.h +0 -11
- data/MultiMarkdown-4/toc.c +0 -142
- data/MultiMarkdown-4/toc.h +0 -15
- data/MultiMarkdown-4/transclude.c +0 -307
- data/MultiMarkdown-4/transclude.h +0 -28
- data/MultiMarkdown-4/writer.c +0 -731
- data/MultiMarkdown-4/writer.h +0 -38
@@ -0,0 +1,118 @@
|
|
1
|
+
/**
|
2
|
+
|
3
|
+
MultiMarkdown -- Lightweight markup processor to produce HTML, LaTeX, and more.
|
4
|
+
|
5
|
+
@file opendocument.h
|
6
|
+
|
7
|
+
@brief Common Utilities for various OpenDocument export types
|
8
|
+
|
9
|
+
|
10
|
+
@author Fletcher T. Penney
|
11
|
+
@bug
|
12
|
+
|
13
|
+
**/
|
14
|
+
|
15
|
+
/*
|
16
|
+
|
17
|
+
Copyright © 2016 - 2017 Fletcher T. Penney.
|
18
|
+
|
19
|
+
|
20
|
+
The `MultiMarkdown 6` project is released under the MIT License..
|
21
|
+
|
22
|
+
GLibFacade.c and GLibFacade.h are from the MultiMarkdown v4 project:
|
23
|
+
|
24
|
+
https://github.com/fletcher/MultiMarkdown-4/
|
25
|
+
|
26
|
+
MMD 4 is released under both the MIT License and GPL.
|
27
|
+
|
28
|
+
|
29
|
+
CuTest is released under the zlib/libpng license. See CuTest.c for the
|
30
|
+
text of the license.
|
31
|
+
|
32
|
+
uthash library:
|
33
|
+
Copyright (c) 2005-2016, Troy D. Hanson
|
34
|
+
|
35
|
+
Licensed under Revised BSD license
|
36
|
+
|
37
|
+
miniz library:
|
38
|
+
Copyright 2013-2014 RAD Game Tools and Valve Software
|
39
|
+
Copyright 2010-2014 Rich Geldreich and Tenacious Software LLC
|
40
|
+
|
41
|
+
Licensed under the MIT license
|
42
|
+
|
43
|
+
argtable3 library:
|
44
|
+
Copyright (C) 1998-2001,2003-2011,2013 Stewart Heitmann
|
45
|
+
<sheitmann@users.sourceforge.net>
|
46
|
+
All rights reserved.
|
47
|
+
|
48
|
+
Licensed under the Revised BSD License
|
49
|
+
|
50
|
+
|
51
|
+
## The MIT License ##
|
52
|
+
|
53
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
54
|
+
a copy of this software and associated documentation files (the
|
55
|
+
"Software"), to deal in the Software without restriction, including
|
56
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
57
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
58
|
+
permit persons to whom the Software is furnished to do so, subject to
|
59
|
+
the following conditions:
|
60
|
+
|
61
|
+
The above copyright notice and this permission notice shall be
|
62
|
+
included in all copies or substantial portions of the Software.
|
63
|
+
|
64
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
65
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
66
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
67
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
68
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
69
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
70
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
71
|
+
|
72
|
+
|
73
|
+
## Revised BSD License ##
|
74
|
+
|
75
|
+
Redistribution and use in source and binary forms, with or without
|
76
|
+
modification, are permitted provided that the following conditions are
|
77
|
+
met:
|
78
|
+
* Redistributions of source code must retain the above copyright
|
79
|
+
notice, this list of conditions and the following disclaimer.
|
80
|
+
* Redistributions in binary form must reproduce the above
|
81
|
+
copyright notice, this list of conditions and the following
|
82
|
+
disclaimer in the documentation and/or other materials provided
|
83
|
+
with the distribution.
|
84
|
+
* Neither the name of the <organization> nor the
|
85
|
+
names of its contributors may be used to endorse or promote
|
86
|
+
products derived from this software without specific prior
|
87
|
+
written permission.
|
88
|
+
|
89
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
90
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
91
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
92
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT
|
93
|
+
HOLDER> BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
94
|
+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
95
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES LOSS OF USE, DATA, OR
|
96
|
+
PROFITS OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
97
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
98
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
99
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
100
|
+
|
101
|
+
|
102
|
+
*/
|
103
|
+
|
104
|
+
|
105
|
+
#ifndef OPENDOCUMENT_MULTIMARKDOWN_H
|
106
|
+
#define OPENDOCUMENT_MULTIMARKDOWN_H
|
107
|
+
|
108
|
+
#include "d_string.h"
|
109
|
+
#include "mmd.h"
|
110
|
+
#include "writer.h"
|
111
|
+
|
112
|
+
char * opendocument_metadata(mmd_engine * e, scratch_pad * scratch);
|
113
|
+
|
114
|
+
|
115
|
+
DString * opendocument_flat_text_create(const char * body, mmd_engine * e, const char * directory);
|
116
|
+
DString * opendocument_text_create(const char * body, mmd_engine * e, const char * directory);
|
117
|
+
|
118
|
+
#endif
|
data/ext/mmd/parser.c
ADDED
@@ -0,0 +1,1760 @@
|
|
1
|
+
/*
|
2
|
+
** 2000-05-29
|
3
|
+
**
|
4
|
+
** The author disclaims copyright to this source code. In place of
|
5
|
+
** a legal notice, here is a blessing:
|
6
|
+
**
|
7
|
+
** May you do good and not evil.
|
8
|
+
** May you find forgiveness for yourself and forgive others.
|
9
|
+
** May you share freely, never taking more than you give.
|
10
|
+
**
|
11
|
+
*************************************************************************
|
12
|
+
** Driver template for the LEMON parser generator.
|
13
|
+
**
|
14
|
+
** The "lemon" program processes an LALR(1) input grammar file, then uses
|
15
|
+
** this template to construct a parser. The "lemon" program inserts text
|
16
|
+
** at each "%%" line. Also, any "P-a-r-s-e" identifer prefix (without the
|
17
|
+
** interstitial "-" characters) contained in this template is changed into
|
18
|
+
** the value of the %name directive from the grammar. Otherwise, the content
|
19
|
+
** of this template is copied straight through into the generate parser
|
20
|
+
** source file.
|
21
|
+
**
|
22
|
+
** The following is the concatenation of all %include directives from the
|
23
|
+
** input grammar file:
|
24
|
+
*/
|
25
|
+
#include <stdio.h>
|
26
|
+
/************ Begin %include sections from the grammar ************************/
|
27
|
+
|
28
|
+
#include <assert.h>
|
29
|
+
#include <stdio.h>
|
30
|
+
#include <stdlib.h>
|
31
|
+
|
32
|
+
#include "libMultiMarkdown.h"
|
33
|
+
#include "mmd.h"
|
34
|
+
#include "parser.h"
|
35
|
+
#include "token.h"
|
36
|
+
/**************** End of %include directives **********************************/
|
37
|
+
/* These constants specify the various numeric values for terminal symbols
|
38
|
+
** in a format understandable to "makeheaders". This section is blank unless
|
39
|
+
** "lemon" is run with the "-m" command-line option.
|
40
|
+
***************** Begin makeheaders token definitions *************************/
|
41
|
+
/**************** End makeheaders token definitions ***************************/
|
42
|
+
|
43
|
+
/* The next sections is a series of control #defines.
|
44
|
+
** various aspects of the generated parser.
|
45
|
+
** YYCODETYPE is the data type used to store the integer codes
|
46
|
+
** that represent terminal and non-terminal symbols.
|
47
|
+
** "unsigned char" is used if there are fewer than
|
48
|
+
** 256 symbols. Larger types otherwise.
|
49
|
+
** YYNOCODE is a number of type YYCODETYPE that is not used for
|
50
|
+
** any terminal or nonterminal symbol.
|
51
|
+
** YYFALLBACK If defined, this indicates that one or more tokens
|
52
|
+
** (also known as: "terminal symbols") have fall-back
|
53
|
+
** values which should be used if the original symbol
|
54
|
+
** would not parse. This permits keywords to sometimes
|
55
|
+
** be used as identifiers, for example.
|
56
|
+
** YYACTIONTYPE is the data type used for "action codes" - numbers
|
57
|
+
** that indicate what to do in response to the next
|
58
|
+
** token.
|
59
|
+
** ParseTOKENTYPE is the data type used for minor type for terminal
|
60
|
+
** symbols. Background: A "minor type" is a semantic
|
61
|
+
** value associated with a terminal or non-terminal
|
62
|
+
** symbols. For example, for an "ID" terminal symbol,
|
63
|
+
** the minor type might be the name of the identifier.
|
64
|
+
** Each non-terminal can have a different minor type.
|
65
|
+
** Terminal symbols all have the same minor type, though.
|
66
|
+
** This macros defines the minor type for terminal
|
67
|
+
** symbols.
|
68
|
+
** YYMINORTYPE is the data type used for all minor types.
|
69
|
+
** This is typically a union of many types, one of
|
70
|
+
** which is ParseTOKENTYPE. The entry in the union
|
71
|
+
** for terminal symbols is called "yy0".
|
72
|
+
** YYSTACKDEPTH is the maximum depth of the parser's stack. If
|
73
|
+
** zero the stack is dynamically sized using realloc()
|
74
|
+
** ParseARG_SDECL A static variable declaration for the %extra_argument
|
75
|
+
** ParseARG_PDECL A parameter declaration for the %extra_argument
|
76
|
+
** ParseARG_STORE Code to store %extra_argument into yypParser
|
77
|
+
** ParseARG_FETCH Code to extract %extra_argument from yypParser
|
78
|
+
** YYERRORSYMBOL is the code number of the error symbol. If not
|
79
|
+
** defined, then do no error processing.
|
80
|
+
** YYNSTATE the combined number of states.
|
81
|
+
** YYNRULE the number of rules in the grammar
|
82
|
+
** YY_MAX_SHIFT Maximum value for shift actions
|
83
|
+
** YY_MIN_SHIFTREDUCE Minimum value for shift-reduce actions
|
84
|
+
** YY_MAX_SHIFTREDUCE Maximum value for shift-reduce actions
|
85
|
+
** YY_MIN_REDUCE Maximum value for reduce actions
|
86
|
+
** YY_ERROR_ACTION The yy_action[] code for syntax error
|
87
|
+
** YY_ACCEPT_ACTION The yy_action[] code for accept
|
88
|
+
** YY_NO_ACTION The yy_action[] code for no-op
|
89
|
+
*/
|
90
|
+
#ifndef INTERFACE
|
91
|
+
# define INTERFACE 1
|
92
|
+
#endif
|
93
|
+
/************* Begin control #defines *****************************************/
|
94
|
+
#define YYCODETYPE unsigned char
|
95
|
+
#define YYNOCODE 91
|
96
|
+
#define YYACTIONTYPE unsigned short int
|
97
|
+
#define ParseTOKENTYPE token *
|
98
|
+
typedef union {
|
99
|
+
int yyinit;
|
100
|
+
ParseTOKENTYPE yy0;
|
101
|
+
} YYMINORTYPE;
|
102
|
+
#ifndef YYSTACKDEPTH
|
103
|
+
#define YYSTACKDEPTH 100
|
104
|
+
#endif
|
105
|
+
#define ParseARG_SDECL mmd_engine * engine ;
|
106
|
+
#define ParseARG_PDECL , mmd_engine * engine
|
107
|
+
#define ParseARG_FETCH mmd_engine * engine = yypParser->engine
|
108
|
+
#define ParseARG_STORE yypParser->engine = engine
|
109
|
+
#define YYFALLBACK 1
|
110
|
+
#define YYNSTATE 47
|
111
|
+
#define YYNRULE 156
|
112
|
+
#define YY_MAX_SHIFT 46
|
113
|
+
#define YY_MIN_SHIFTREDUCE 158
|
114
|
+
#define YY_MAX_SHIFTREDUCE 313
|
115
|
+
#define YY_MIN_REDUCE 314
|
116
|
+
#define YY_MAX_REDUCE 469
|
117
|
+
#define YY_ERROR_ACTION 470
|
118
|
+
#define YY_ACCEPT_ACTION 471
|
119
|
+
#define YY_NO_ACTION 472
|
120
|
+
/************* End control #defines *******************************************/
|
121
|
+
|
122
|
+
/* Define the yytestcase() macro to be a no-op if is not already defined
|
123
|
+
** otherwise.
|
124
|
+
**
|
125
|
+
** Applications can choose to define yytestcase() in the %include section
|
126
|
+
** to a macro that can assist in verifying code coverage. For production
|
127
|
+
** code the yytestcase() macro should be turned off. But it is useful
|
128
|
+
** for testing.
|
129
|
+
*/
|
130
|
+
#ifndef yytestcase
|
131
|
+
# define yytestcase(X)
|
132
|
+
#endif
|
133
|
+
|
134
|
+
|
135
|
+
/* Next are the tables used to determine what action to take based on the
|
136
|
+
** current state and lookahead token. These tables are used to implement
|
137
|
+
** functions that take a state number and lookahead value and return an
|
138
|
+
** action integer.
|
139
|
+
**
|
140
|
+
** Suppose the action integer is N. Then the action is determined as
|
141
|
+
** follows
|
142
|
+
**
|
143
|
+
** 0 <= N <= YY_MAX_SHIFT Shift N. That is, push the lookahead
|
144
|
+
** token onto the stack and goto state N.
|
145
|
+
**
|
146
|
+
** N between YY_MIN_SHIFTREDUCE Shift to an arbitrary state then
|
147
|
+
** and YY_MAX_SHIFTREDUCE reduce by rule N-YY_MIN_SHIFTREDUCE.
|
148
|
+
**
|
149
|
+
** N between YY_MIN_REDUCE Reduce by rule N-YY_MIN_REDUCE
|
150
|
+
** and YY_MAX_REDUCE
|
151
|
+
**
|
152
|
+
** N == YY_ERROR_ACTION A syntax error has occurred.
|
153
|
+
**
|
154
|
+
** N == YY_ACCEPT_ACTION The parser accepts its input.
|
155
|
+
**
|
156
|
+
** N == YY_NO_ACTION No such action. Denotes unused
|
157
|
+
** slots in the yy_action[] table.
|
158
|
+
**
|
159
|
+
** The action table is constructed as a single large table named yy_action[].
|
160
|
+
** Given state S and lookahead X, the action is computed as either:
|
161
|
+
**
|
162
|
+
** (A) N = yy_action[ yy_shift_ofst[S] + X ]
|
163
|
+
** (B) N = yy_default[S]
|
164
|
+
**
|
165
|
+
** The (A) formula is preferred. The B formula is used instead if:
|
166
|
+
** (1) The yy_shift_ofst[S]+X value is out of range, or
|
167
|
+
** (2) yy_lookahead[yy_shift_ofst[S]+X] is not equal to X, or
|
168
|
+
** (3) yy_shift_ofst[S] equal YY_SHIFT_USE_DFLT.
|
169
|
+
** (Implementation note: YY_SHIFT_USE_DFLT is chosen so that
|
170
|
+
** YY_SHIFT_USE_DFLT+X will be out of range for all possible lookaheads X.
|
171
|
+
** Hence only tests (1) and (2) need to be evaluated.)
|
172
|
+
**
|
173
|
+
** The formulas above are for computing the action when the lookahead is
|
174
|
+
** a terminal symbol. If the lookahead is a non-terminal (as occurs after
|
175
|
+
** a reduce action) then the yy_reduce_ofst[] array is used in place of
|
176
|
+
** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of
|
177
|
+
** YY_SHIFT_USE_DFLT.
|
178
|
+
**
|
179
|
+
** The following are the tables generated in this section:
|
180
|
+
**
|
181
|
+
** yy_action[] A single table containing all actions.
|
182
|
+
** yy_lookahead[] A table containing the lookahead for each entry in
|
183
|
+
** yy_action. Used to detect hash collisions.
|
184
|
+
** yy_shift_ofst[] For each state, the offset into yy_action for
|
185
|
+
** shifting terminals.
|
186
|
+
** yy_reduce_ofst[] For each state, the offset into yy_action for
|
187
|
+
** shifting non-terminals after a reduce.
|
188
|
+
** yy_default[] Default action for each state.
|
189
|
+
**
|
190
|
+
*********** Begin parsing tables **********************************************/
|
191
|
+
#define YY_ACTTAB_COUNT (321)
|
192
|
+
static const YYACTIONTYPE yy_action[] = {
|
193
|
+
/* 0 */ 471, 1, 160, 37, 171, 172, 173, 174, 175, 176,
|
194
|
+
/* 10 */ 45, 178, 29, 180, 32, 41, 40, 30, 14, 187,
|
195
|
+
/* 20 */ 188, 189, 44, 246, 13, 13, 32, 44, 240, 241,
|
196
|
+
/* 30 */ 249, 38, 38, 27, 270, 26, 25, 217, 28, 213,
|
197
|
+
/* 40 */ 41, 40, 210, 8, 222, 43, 263, 15, 15, 314,
|
198
|
+
/* 50 */ 167, 308, 312, 46, 5, 16, 256, 257, 308, 42,
|
199
|
+
/* 60 */ 262, 287, 161, 162, 163, 164, 165, 166, 261, 7,
|
200
|
+
/* 70 */ 6, 17, 4, 3, 2, 18, 169, 5, 302, 224,
|
201
|
+
/* 80 */ 272, 275, 278, 273, 276, 279, 306, 270, 293, 167,
|
202
|
+
/* 90 */ 39, 39, 46, 237, 16, 256, 257, 308, 42, 19,
|
203
|
+
/* 100 */ 287, 161, 162, 163, 164, 165, 166, 261, 7, 6,
|
204
|
+
/* 110 */ 17, 4, 3, 2, 18, 169, 5, 302, 252, 272,
|
205
|
+
/* 120 */ 275, 278, 273, 276, 279, 306, 270, 293, 159, 37,
|
206
|
+
/* 130 */ 171, 172, 173, 174, 175, 176, 45, 178, 29, 180,
|
207
|
+
/* 140 */ 32, 41, 40, 30, 14, 187, 188, 189, 308, 312,
|
208
|
+
/* 150 */ 253, 270, 32, 225, 256, 257, 252, 38, 38, 27,
|
209
|
+
/* 160 */ 190, 26, 25, 185, 28, 304, 41, 40, 283, 8,
|
210
|
+
/* 170 */ 196, 43, 280, 15, 15, 33, 33, 247, 282, 284,
|
211
|
+
/* 180 */ 283, 34, 34, 5, 280, 206, 35, 35, 253, 303,
|
212
|
+
/* 190 */ 282, 284, 12, 44, 12, 13, 13, 203, 218, 220,
|
213
|
+
/* 200 */ 216, 219, 221, 6, 286, 281, 285, 36, 36, 31,
|
214
|
+
/* 210 */ 214, 211, 212, 215, 31, 283, 286, 281, 285, 280,
|
215
|
+
/* 220 */ 31, 9, 9, 20, 20, 282, 284, 199, 199, 191,
|
216
|
+
/* 230 */ 468, 468, 9, 9, 20, 20, 245, 243, 198, 198,
|
217
|
+
/* 240 */ 7, 232, 31, 256, 257, 207, 208, 209, 245, 227,
|
218
|
+
/* 250 */ 31, 286, 281, 285, 9, 9, 20, 20, 31, 206,
|
219
|
+
/* 260 */ 197, 197, 9, 9, 20, 20, 238, 31, 204, 204,
|
220
|
+
/* 270 */ 10, 10, 22, 22, 226, 233, 31, 316, 316, 11,
|
221
|
+
/* 280 */ 11, 23, 23, 297, 228, 31, 316, 294, 316, 190,
|
222
|
+
/* 290 */ 21, 21, 290, 296, 298, 316, 288, 316, 190, 24,
|
223
|
+
/* 300 */ 24, 316, 289, 291, 316, 316, 316, 316, 316, 316,
|
224
|
+
/* 310 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 223,
|
225
|
+
/* 320 */ 295,
|
226
|
+
};
|
227
|
+
static const YYCODETYPE yy_lookahead[] = {
|
228
|
+
/* 0 */ 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
|
229
|
+
/* 10 */ 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
|
230
|
+
/* 20 */ 61, 62, 86, 87, 88, 89, 67, 86, 2, 3,
|
231
|
+
/* 30 */ 89, 72, 73, 74, 38, 76, 77, 75, 79, 75,
|
232
|
+
/* 40 */ 81, 82, 75, 84, 78, 86, 5, 88, 89, 0,
|
233
|
+
/* 50 */ 1, 9, 10, 4, 28, 6, 7, 8, 9, 10,
|
234
|
+
/* 60 */ 19, 12, 13, 14, 15, 16, 17, 18, 19, 20,
|
235
|
+
/* 70 */ 21, 22, 23, 24, 25, 26, 27, 28, 29, 80,
|
236
|
+
/* 80 */ 31, 32, 33, 34, 35, 36, 37, 38, 39, 1,
|
237
|
+
/* 90 */ 72, 73, 4, 83, 6, 7, 8, 9, 10, 67,
|
238
|
+
/* 100 */ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
|
239
|
+
/* 110 */ 22, 23, 24, 25, 26, 27, 28, 29, 5, 31,
|
240
|
+
/* 120 */ 32, 33, 34, 35, 36, 37, 38, 39, 43, 44,
|
241
|
+
/* 130 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
|
242
|
+
/* 140 */ 55, 56, 57, 58, 59, 60, 61, 62, 9, 10,
|
243
|
+
/* 150 */ 37, 38, 67, 67, 7, 8, 5, 72, 73, 74,
|
244
|
+
/* 160 */ 64, 76, 77, 3, 79, 5, 81, 82, 1, 84,
|
245
|
+
/* 170 */ 71, 86, 5, 88, 89, 63, 64, 38, 11, 12,
|
246
|
+
/* 180 */ 1, 63, 64, 28, 5, 38, 63, 64, 37, 29,
|
247
|
+
/* 190 */ 11, 12, 85, 86, 87, 88, 89, 73, 31, 32,
|
248
|
+
/* 200 */ 33, 34, 35, 21, 37, 38, 39, 63, 64, 51,
|
249
|
+
/* 210 */ 31, 32, 33, 34, 51, 1, 37, 38, 39, 5,
|
250
|
+
/* 220 */ 51, 63, 64, 65, 66, 11, 12, 69, 70, 66,
|
251
|
+
/* 230 */ 2, 3, 63, 64, 65, 66, 9, 10, 69, 70,
|
252
|
+
/* 240 */ 20, 82, 51, 7, 8, 31, 32, 33, 9, 81,
|
253
|
+
/* 250 */ 51, 37, 38, 39, 63, 64, 65, 66, 51, 38,
|
254
|
+
/* 260 */ 69, 70, 63, 64, 65, 66, 29, 51, 69, 70,
|
255
|
+
/* 270 */ 63, 64, 65, 66, 38, 68, 51, 90, 90, 63,
|
256
|
+
/* 280 */ 64, 65, 66, 1, 68, 51, 90, 5, 90, 64,
|
257
|
+
/* 290 */ 65, 66, 1, 11, 12, 90, 5, 90, 64, 65,
|
258
|
+
/* 300 */ 66, 90, 11, 12, 90, 90, 90, 90, 90, 90,
|
259
|
+
/* 310 */ 90, 90, 90, 90, 90, 90, 90, 90, 90, 37,
|
260
|
+
/* 320 */ 38,
|
261
|
+
};
|
262
|
+
#define YY_SHIFT_USE_DFLT (321)
|
263
|
+
#define YY_SHIFT_COUNT (46)
|
264
|
+
#define YY_SHIFT_MIN (-4)
|
265
|
+
#define YY_SHIFT_MAX (291)
|
266
|
+
static const short yy_shift_ofst[] = {
|
267
|
+
/* 0 */ 88, 49, 113, 113, 113, 113, 113, 113, 42, 113,
|
268
|
+
/* 10 */ 113, 113, 42, 139, 26, 42, 151, 151, 151, 151,
|
269
|
+
/* 20 */ -4, -4, -4, -4, -4, 167, 179, 214, 282, 291,
|
270
|
+
/* 30 */ 160, 147, 236, 151, 151, 151, 151, 41, 155, 155,
|
271
|
+
/* 40 */ 182, 220, 228, 227, 239, 221, 237,
|
272
|
+
};
|
273
|
+
#define YY_REDUCE_USE_DFLT (-65)
|
274
|
+
#define YY_REDUCE_COUNT (41)
|
275
|
+
#define YY_REDUCE_MIN (-64)
|
276
|
+
#define YY_REDUCE_MAX (234)
|
277
|
+
static const short yy_reduce_ofst[] = {
|
278
|
+
/* 0 */ -41, 85, 158, 169, 191, 199, 207, 216, 107, 225,
|
279
|
+
/* 10 */ 234, 234, -64, -59, 18, -59, 112, 118, 123, 144,
|
280
|
+
/* 20 */ 163, 163, 163, 163, 163, -38, -36, -33, -1, -34,
|
281
|
+
/* 30 */ 10, 32, 86, 96, 96, 96, 96, 99, 124, 124,
|
282
|
+
/* 40 */ 159, 168,
|
283
|
+
};
|
284
|
+
static const YYACTIONTYPE yy_default[] = {
|
285
|
+
/* 0 */ 470, 470, 422, 421, 420, 361, 392, 387, 463, 414,
|
286
|
+
/* 10 */ 390, 385, 398, 404, 342, 406, 461, 424, 423, 349,
|
287
|
+
/* 20 */ 416, 351, 391, 386, 350, 433, 430, 427, 448, 335,
|
288
|
+
/* 30 */ 340, 411, 337, 395, 357, 356, 348, 326, 469, 358,
|
289
|
+
/* 40 */ 339, 338, 400, 467, 467, 333, 324,
|
290
|
+
};
|
291
|
+
/********** End of lemon-generated parsing tables *****************************/
|
292
|
+
|
293
|
+
/* The next table maps tokens (terminal symbols) into fallback tokens.
|
294
|
+
** If a construct like the following:
|
295
|
+
**
|
296
|
+
** %fallback ID X Y Z.
|
297
|
+
**
|
298
|
+
** appears in the grammar, then ID becomes a fallback token for X, Y,
|
299
|
+
** and Z. Whenever one of the tokens X, Y, or Z is input to the parser
|
300
|
+
** but it does not parse, the type of the token is changed to ID and
|
301
|
+
** the parse is retried before an error is thrown.
|
302
|
+
**
|
303
|
+
** This feature can be used, for example, to cause some keywords in a language
|
304
|
+
** to revert to identifiers if they keyword does not apply in the context where
|
305
|
+
** it appears.
|
306
|
+
*/
|
307
|
+
#ifdef YYFALLBACK
|
308
|
+
static const YYCODETYPE yyFallback[] = {
|
309
|
+
0, /* $ => nothing */
|
310
|
+
0, /* LINE_HR => nothing */
|
311
|
+
1, /* LINE_SETEXT_1 => LINE_HR */
|
312
|
+
1, /* LINE_SETEXT_2 => LINE_HR */
|
313
|
+
1, /* LINE_YAML => LINE_HR */
|
314
|
+
0, /* LINE_CONTINUATION => nothing */
|
315
|
+
5, /* LINE_PLAIN => LINE_CONTINUATION */
|
316
|
+
5, /* LINE_INDENTED_TAB => LINE_CONTINUATION */
|
317
|
+
5, /* LINE_INDENTED_SPACE => LINE_CONTINUATION */
|
318
|
+
5, /* LINE_TABLE => LINE_CONTINUATION */
|
319
|
+
5, /* LINE_TABLE_SEPARATOR => LINE_CONTINUATION */
|
320
|
+
0, /* LINE_FALLBACK => nothing */
|
321
|
+
11, /* LINE_HTML => LINE_FALLBACK */
|
322
|
+
11, /* LINE_ATX_1 => LINE_FALLBACK */
|
323
|
+
11, /* LINE_ATX_2 => LINE_FALLBACK */
|
324
|
+
11, /* LINE_ATX_3 => LINE_FALLBACK */
|
325
|
+
11, /* LINE_ATX_4 => LINE_FALLBACK */
|
326
|
+
11, /* LINE_ATX_5 => LINE_FALLBACK */
|
327
|
+
11, /* LINE_ATX_6 => LINE_FALLBACK */
|
328
|
+
11, /* LINE_BLOCKQUOTE => LINE_FALLBACK */
|
329
|
+
11, /* LINE_LIST_BULLETED => LINE_FALLBACK */
|
330
|
+
11, /* LINE_LIST_ENUMERATED => LINE_FALLBACK */
|
331
|
+
11, /* LINE_DEF_ABBREVIATION => LINE_FALLBACK */
|
332
|
+
11, /* LINE_DEF_CITATION => LINE_FALLBACK */
|
333
|
+
11, /* LINE_DEF_FOOTNOTE => LINE_FALLBACK */
|
334
|
+
11, /* LINE_DEF_GLOSSARY => LINE_FALLBACK */
|
335
|
+
11, /* LINE_DEF_LINK => LINE_FALLBACK */
|
336
|
+
11, /* LINE_TOC => LINE_FALLBACK */
|
337
|
+
11, /* LINE_DEFINITION => LINE_FALLBACK */
|
338
|
+
11, /* LINE_META => LINE_FALLBACK */
|
339
|
+
0, /* LINE_BACKTICK => nothing */
|
340
|
+
30, /* LINE_FENCE_BACKTICK_3 => LINE_BACKTICK */
|
341
|
+
30, /* LINE_FENCE_BACKTICK_4 => LINE_BACKTICK */
|
342
|
+
30, /* LINE_FENCE_BACKTICK_5 => LINE_BACKTICK */
|
343
|
+
30, /* LINE_FENCE_BACKTICK_START_3 => LINE_BACKTICK */
|
344
|
+
30, /* LINE_FENCE_BACKTICK_START_4 => LINE_BACKTICK */
|
345
|
+
30, /* LINE_FENCE_BACKTICK_START_5 => LINE_BACKTICK */
|
346
|
+
};
|
347
|
+
#endif /* YYFALLBACK */
|
348
|
+
|
349
|
+
/* The following structure represents a single element of the
|
350
|
+
** parser's stack. Information stored includes:
|
351
|
+
**
|
352
|
+
** + The state number for the parser at this level of the stack.
|
353
|
+
**
|
354
|
+
** + The value of the token stored at this level of the stack.
|
355
|
+
** (In other words, the "major" token.)
|
356
|
+
**
|
357
|
+
** + The semantic value stored at this level of the stack. This is
|
358
|
+
** the information used by the action routines in the grammar.
|
359
|
+
** It is sometimes called the "minor" token.
|
360
|
+
**
|
361
|
+
** After the "shift" half of a SHIFTREDUCE action, the stateno field
|
362
|
+
** actually contains the reduce action for the second half of the
|
363
|
+
** SHIFTREDUCE.
|
364
|
+
*/
|
365
|
+
struct yyStackEntry {
|
366
|
+
YYACTIONTYPE stateno; /* The state-number, or reduce action in SHIFTREDUCE */
|
367
|
+
YYCODETYPE major; /* The major token value. This is the code
|
368
|
+
** number for the token at this stack level */
|
369
|
+
YYMINORTYPE minor; /* The user-supplied minor token value. This
|
370
|
+
** is the value of the token */
|
371
|
+
};
|
372
|
+
typedef struct yyStackEntry yyStackEntry;
|
373
|
+
|
374
|
+
/* The state of the parser is completely contained in an instance of
|
375
|
+
** the following structure */
|
376
|
+
struct yyParser {
|
377
|
+
yyStackEntry *yytos; /* Pointer to top element of the stack */
|
378
|
+
#ifdef YYTRACKMAXSTACKDEPTH
|
379
|
+
int yyhwm; /* High-water mark of the stack */
|
380
|
+
#endif
|
381
|
+
#ifndef YYNOERRORRECOVERY
|
382
|
+
int yyerrcnt; /* Shifts left before out of the error */
|
383
|
+
#endif
|
384
|
+
ParseARG_SDECL /* A place to hold %extra_argument */
|
385
|
+
#if YYSTACKDEPTH<=0
|
386
|
+
int yystksz; /* Current side of the stack */
|
387
|
+
yyStackEntry *yystack; /* The parser's stack */
|
388
|
+
yyStackEntry yystk0; /* First stack entry */
|
389
|
+
#else
|
390
|
+
yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */
|
391
|
+
#endif
|
392
|
+
};
|
393
|
+
typedef struct yyParser yyParser;
|
394
|
+
|
395
|
+
#ifndef NDEBUG
|
396
|
+
#include <stdio.h>
|
397
|
+
static FILE *yyTraceFILE = 0;
|
398
|
+
static char *yyTracePrompt = 0;
|
399
|
+
#endif /* NDEBUG */
|
400
|
+
|
401
|
+
#ifndef NDEBUG
|
402
|
+
/*
|
403
|
+
** Turn parser tracing on by giving a stream to which to write the trace
|
404
|
+
** and a prompt to preface each trace message. Tracing is turned off
|
405
|
+
** by making either argument NULL
|
406
|
+
**
|
407
|
+
** Inputs:
|
408
|
+
** <ul>
|
409
|
+
** <li> A FILE* to which trace output should be written.
|
410
|
+
** If NULL, then tracing is turned off.
|
411
|
+
** <li> A prefix string written at the beginning of every
|
412
|
+
** line of trace output. If NULL, then tracing is
|
413
|
+
** turned off.
|
414
|
+
** </ul>
|
415
|
+
**
|
416
|
+
** Outputs:
|
417
|
+
** None.
|
418
|
+
*/
|
419
|
+
void ParseTrace(FILE *TraceFILE, char *zTracePrompt){
|
420
|
+
yyTraceFILE = TraceFILE;
|
421
|
+
yyTracePrompt = zTracePrompt;
|
422
|
+
if( yyTraceFILE==0 ) yyTracePrompt = 0;
|
423
|
+
else if( yyTracePrompt==0 ) yyTraceFILE = 0;
|
424
|
+
}
|
425
|
+
#endif /* NDEBUG */
|
426
|
+
|
427
|
+
#ifndef NDEBUG
|
428
|
+
/* For tracing shifts, the names of all terminals and nonterminals
|
429
|
+
** are required. The following table supplies these names */
|
430
|
+
static const char *const yyTokenName[] = {
|
431
|
+
"$", "LINE_HR", "LINE_SETEXT_1", "LINE_SETEXT_2",
|
432
|
+
"LINE_YAML", "LINE_CONTINUATION", "LINE_PLAIN", "LINE_INDENTED_TAB",
|
433
|
+
"LINE_INDENTED_SPACE", "LINE_TABLE", "LINE_TABLE_SEPARATOR", "LINE_FALLBACK",
|
434
|
+
"LINE_HTML", "LINE_ATX_1", "LINE_ATX_2", "LINE_ATX_3",
|
435
|
+
"LINE_ATX_4", "LINE_ATX_5", "LINE_ATX_6", "LINE_BLOCKQUOTE",
|
436
|
+
"LINE_LIST_BULLETED", "LINE_LIST_ENUMERATED", "LINE_DEF_ABBREVIATION", "LINE_DEF_CITATION",
|
437
|
+
"LINE_DEF_FOOTNOTE", "LINE_DEF_GLOSSARY", "LINE_DEF_LINK", "LINE_TOC",
|
438
|
+
"LINE_DEFINITION", "LINE_META", "LINE_BACKTICK", "LINE_FENCE_BACKTICK_3",
|
439
|
+
"LINE_FENCE_BACKTICK_4", "LINE_FENCE_BACKTICK_5", "LINE_FENCE_BACKTICK_START_3", "LINE_FENCE_BACKTICK_START_4",
|
440
|
+
"LINE_FENCE_BACKTICK_START_5", "LINE_STOP_COMMENT", "LINE_EMPTY", "LINE_START_COMMENT",
|
441
|
+
"error", "doc", "blocks", "block",
|
442
|
+
"blockquote", "def_abbreviation", "def_citation", "def_footnote",
|
443
|
+
"def_glossary", "def_link", "definition_block", "empty",
|
444
|
+
"fenced_block", "html_block", "html_com_block", "indented_code",
|
445
|
+
"list_bullet", "list_enum", "meta_block", "para",
|
446
|
+
"setext_1", "setext_2", "table", "chunk",
|
447
|
+
"chunk_line", "nested_chunks", "nested_chunk", "indented_line",
|
448
|
+
"ext_chunk", "opt_ext_chunk", "tail", "quote_line",
|
449
|
+
"defs", "def", "fenced_3", "fenced_line",
|
450
|
+
"fenced_4", "fenced_5", "html_line", "html_comment",
|
451
|
+
"comment_line", "item_bullet", "item_enum", "meta_line",
|
452
|
+
"table_header", "table_body", "header_rows", "table_section",
|
453
|
+
"all_rows", "row",
|
454
|
+
};
|
455
|
+
#endif /* NDEBUG */
|
456
|
+
|
457
|
+
#ifndef NDEBUG
|
458
|
+
/* For tracing reduce actions, the names of all rules are required.
|
459
|
+
*/
|
460
|
+
static const char *const yyRuleName[] = {
|
461
|
+
/* 0 */ "doc ::= blocks",
|
462
|
+
/* 1 */ "blocks ::= blocks block",
|
463
|
+
/* 2 */ "blocks ::= block",
|
464
|
+
/* 3 */ "block ::= LINE_ATX_1",
|
465
|
+
/* 4 */ "block ::= LINE_ATX_2",
|
466
|
+
/* 5 */ "block ::= LINE_ATX_3",
|
467
|
+
/* 6 */ "block ::= LINE_ATX_4",
|
468
|
+
/* 7 */ "block ::= LINE_ATX_5",
|
469
|
+
/* 8 */ "block ::= LINE_ATX_6",
|
470
|
+
/* 9 */ "block ::= LINE_HR",
|
471
|
+
/* 10 */ "block ::= LINE_YAML",
|
472
|
+
/* 11 */ "block ::= LINE_TOC",
|
473
|
+
/* 12 */ "block ::= blockquote",
|
474
|
+
/* 13 */ "block ::= def_abbreviation",
|
475
|
+
/* 14 */ "block ::= def_citation",
|
476
|
+
/* 15 */ "block ::= def_footnote",
|
477
|
+
/* 16 */ "block ::= def_glossary",
|
478
|
+
/* 17 */ "block ::= def_link",
|
479
|
+
/* 18 */ "block ::= definition_block",
|
480
|
+
/* 19 */ "block ::= empty",
|
481
|
+
/* 20 */ "block ::= fenced_block",
|
482
|
+
/* 21 */ "block ::= html_block",
|
483
|
+
/* 22 */ "block ::= html_com_block",
|
484
|
+
/* 23 */ "block ::= indented_code",
|
485
|
+
/* 24 */ "block ::= list_bullet",
|
486
|
+
/* 25 */ "block ::= list_enum",
|
487
|
+
/* 26 */ "block ::= meta_block",
|
488
|
+
/* 27 */ "block ::= meta_block LINE_SETEXT_2",
|
489
|
+
/* 28 */ "block ::= para",
|
490
|
+
/* 29 */ "block ::= setext_1",
|
491
|
+
/* 30 */ "block ::= setext_2",
|
492
|
+
/* 31 */ "block ::= table",
|
493
|
+
/* 32 */ "chunk ::= chunk chunk_line",
|
494
|
+
/* 33 */ "nested_chunks ::= nested_chunks nested_chunk",
|
495
|
+
/* 34 */ "nested_chunk ::= empty indented_line chunk",
|
496
|
+
/* 35 */ "nested_chunk ::= empty indented_line",
|
497
|
+
/* 36 */ "ext_chunk ::= chunk nested_chunks",
|
498
|
+
/* 37 */ "opt_ext_chunk ::= chunk nested_chunks",
|
499
|
+
/* 38 */ "blockquote ::= blockquote quote_line",
|
500
|
+
/* 39 */ "def_citation ::= LINE_DEF_CITATION tail",
|
501
|
+
/* 40 */ "def_footnote ::= LINE_DEF_FOOTNOTE tail",
|
502
|
+
/* 41 */ "def_glossary ::= LINE_DEF_GLOSSARY tail",
|
503
|
+
/* 42 */ "def_link ::= LINE_DEF_LINK chunk",
|
504
|
+
/* 43 */ "def_abbreviation ::= LINE_DEF_ABBREVIATION chunk",
|
505
|
+
/* 44 */ "definition_block ::= para defs",
|
506
|
+
/* 45 */ "defs ::= defs def",
|
507
|
+
/* 46 */ "def ::= LINE_DEFINITION tail",
|
508
|
+
/* 47 */ "def ::= LINE_DEFINITION",
|
509
|
+
/* 48 */ "empty ::= empty LINE_EMPTY",
|
510
|
+
/* 49 */ "fenced_block ::= fenced_3 LINE_FENCE_BACKTICK_3",
|
511
|
+
/* 50 */ "fenced_block ::= fenced_3 LINE_FENCE_BACKTICK_4",
|
512
|
+
/* 51 */ "fenced_block ::= fenced_3 LINE_FENCE_BACKTICK_5",
|
513
|
+
/* 52 */ "fenced_3 ::= fenced_3 fenced_line",
|
514
|
+
/* 53 */ "fenced_block ::= fenced_4 LINE_FENCE_BACKTICK_4",
|
515
|
+
/* 54 */ "fenced_block ::= fenced_4 LINE_FENCE_BACKTICK_5",
|
516
|
+
/* 55 */ "fenced_4 ::= fenced_4 fenced_line",
|
517
|
+
/* 56 */ "fenced_4 ::= fenced_4 LINE_FENCE_BACKTICK_3",
|
518
|
+
/* 57 */ "fenced_4 ::= fenced_4 LINE_FENCE_BACKTICK_START_3",
|
519
|
+
/* 58 */ "fenced_block ::= fenced_5 LINE_FENCE_BACKTICK_5",
|
520
|
+
/* 59 */ "fenced_5 ::= fenced_5 fenced_line",
|
521
|
+
/* 60 */ "fenced_5 ::= fenced_5 LINE_FENCE_BACKTICK_3",
|
522
|
+
/* 61 */ "fenced_5 ::= fenced_5 LINE_FENCE_BACKTICK_START_3",
|
523
|
+
/* 62 */ "fenced_5 ::= fenced_5 LINE_FENCE_BACKTICK_4",
|
524
|
+
/* 63 */ "fenced_5 ::= fenced_5 LINE_FENCE_BACKTICK_START_4",
|
525
|
+
/* 64 */ "html_block ::= html_block html_line",
|
526
|
+
/* 65 */ "html_com_block ::= html_comment LINE_STOP_COMMENT",
|
527
|
+
/* 66 */ "html_comment ::= html_comment comment_line",
|
528
|
+
/* 67 */ "indented_code ::= indented_code indented_line",
|
529
|
+
/* 68 */ "indented_code ::= indented_code LINE_EMPTY",
|
530
|
+
/* 69 */ "list_bullet ::= list_bullet item_bullet",
|
531
|
+
/* 70 */ "item_bullet ::= LINE_LIST_BULLETED ext_chunk",
|
532
|
+
/* 71 */ "item_bullet ::= LINE_LIST_BULLETED chunk",
|
533
|
+
/* 72 */ "item_bullet ::= LINE_LIST_BULLETED nested_chunks",
|
534
|
+
/* 73 */ "item_bullet ::= LINE_LIST_BULLETED",
|
535
|
+
/* 74 */ "list_enum ::= list_enum item_enum",
|
536
|
+
/* 75 */ "item_enum ::= LINE_LIST_ENUMERATED ext_chunk",
|
537
|
+
/* 76 */ "item_enum ::= LINE_LIST_ENUMERATED chunk",
|
538
|
+
/* 77 */ "item_enum ::= LINE_LIST_ENUMERATED nested_chunks",
|
539
|
+
/* 78 */ "item_enum ::= LINE_LIST_ENUMERATED",
|
540
|
+
/* 79 */ "meta_block ::= meta_block meta_line",
|
541
|
+
/* 80 */ "meta_block ::= LINE_YAML LINE_META",
|
542
|
+
/* 81 */ "para ::= LINE_PLAIN chunk",
|
543
|
+
/* 82 */ "setext_1 ::= para LINE_SETEXT_1",
|
544
|
+
/* 83 */ "setext_2 ::= para LINE_SETEXT_2",
|
545
|
+
/* 84 */ "table ::= table_header table_body",
|
546
|
+
/* 85 */ "table_header ::= header_rows LINE_TABLE_SEPARATOR",
|
547
|
+
/* 86 */ "table_header ::= LINE_TABLE_SEPARATOR",
|
548
|
+
/* 87 */ "header_rows ::= header_rows LINE_TABLE",
|
549
|
+
/* 88 */ "table_body ::= table_body table_section",
|
550
|
+
/* 89 */ "table_section ::= all_rows LINE_EMPTY",
|
551
|
+
/* 90 */ "table_section ::= all_rows",
|
552
|
+
/* 91 */ "all_rows ::= all_rows row",
|
553
|
+
/* 92 */ "para ::= all_rows",
|
554
|
+
/* 93 */ "chunk ::= chunk_line",
|
555
|
+
/* 94 */ "chunk_line ::= LINE_CONTINUATION",
|
556
|
+
/* 95 */ "chunk_line ::= LINE_STOP_COMMENT",
|
557
|
+
/* 96 */ "nested_chunks ::= nested_chunk",
|
558
|
+
/* 97 */ "nested_chunk ::= empty",
|
559
|
+
/* 98 */ "indented_line ::= LINE_INDENTED_TAB",
|
560
|
+
/* 99 */ "indented_line ::= LINE_INDENTED_SPACE",
|
561
|
+
/* 100 */ "opt_ext_chunk ::= chunk",
|
562
|
+
/* 101 */ "tail ::= opt_ext_chunk",
|
563
|
+
/* 102 */ "tail ::= nested_chunks",
|
564
|
+
/* 103 */ "blockquote ::= LINE_BLOCKQUOTE",
|
565
|
+
/* 104 */ "quote_line ::= LINE_BLOCKQUOTE",
|
566
|
+
/* 105 */ "quote_line ::= LINE_CONTINUATION",
|
567
|
+
/* 106 */ "def_citation ::= LINE_DEF_CITATION",
|
568
|
+
/* 107 */ "def_footnote ::= LINE_DEF_FOOTNOTE",
|
569
|
+
/* 108 */ "def_glossary ::= LINE_DEF_GLOSSARY",
|
570
|
+
/* 109 */ "def_link ::= LINE_DEF_LINK",
|
571
|
+
/* 110 */ "def_abbreviation ::= LINE_DEF_ABBREVIATION",
|
572
|
+
/* 111 */ "defs ::= def",
|
573
|
+
/* 112 */ "empty ::= LINE_EMPTY",
|
574
|
+
/* 113 */ "fenced_block ::= fenced_3",
|
575
|
+
/* 114 */ "fenced_3 ::= LINE_FENCE_BACKTICK_3",
|
576
|
+
/* 115 */ "fenced_3 ::= LINE_FENCE_BACKTICK_START_3",
|
577
|
+
/* 116 */ "fenced_block ::= fenced_4",
|
578
|
+
/* 117 */ "fenced_4 ::= LINE_FENCE_BACKTICK_4",
|
579
|
+
/* 118 */ "fenced_4 ::= LINE_FENCE_BACKTICK_START_4",
|
580
|
+
/* 119 */ "fenced_block ::= fenced_5",
|
581
|
+
/* 120 */ "fenced_5 ::= LINE_FENCE_BACKTICK_5",
|
582
|
+
/* 121 */ "fenced_5 ::= LINE_FENCE_BACKTICK_START_5",
|
583
|
+
/* 122 */ "fenced_line ::= LINE_CONTINUATION",
|
584
|
+
/* 123 */ "fenced_line ::= LINE_EMPTY",
|
585
|
+
/* 124 */ "fenced_line ::= LINE_FALLBACK",
|
586
|
+
/* 125 */ "fenced_line ::= LINE_HR",
|
587
|
+
/* 126 */ "fenced_line ::= LINE_HTML",
|
588
|
+
/* 127 */ "fenced_line ::= LINE_START_COMMENT",
|
589
|
+
/* 128 */ "fenced_line ::= LINE_STOP_COMMENT",
|
590
|
+
/* 129 */ "html_block ::= LINE_HTML",
|
591
|
+
/* 130 */ "html_line ::= LINE_CONTINUATION",
|
592
|
+
/* 131 */ "html_line ::= LINE_FALLBACK",
|
593
|
+
/* 132 */ "html_line ::= LINE_HR",
|
594
|
+
/* 133 */ "html_line ::= LINE_HTML",
|
595
|
+
/* 134 */ "html_com_block ::= html_comment",
|
596
|
+
/* 135 */ "html_comment ::= LINE_START_COMMENT",
|
597
|
+
/* 136 */ "comment_line ::= LINE_CONTINUATION",
|
598
|
+
/* 137 */ "comment_line ::= LINE_EMPTY",
|
599
|
+
/* 138 */ "comment_line ::= LINE_FALLBACK",
|
600
|
+
/* 139 */ "comment_line ::= LINE_HR",
|
601
|
+
/* 140 */ "comment_line ::= LINE_HTML",
|
602
|
+
/* 141 */ "indented_code ::= indented_line",
|
603
|
+
/* 142 */ "list_bullet ::= item_bullet",
|
604
|
+
/* 143 */ "list_enum ::= item_enum",
|
605
|
+
/* 144 */ "meta_block ::= LINE_META",
|
606
|
+
/* 145 */ "meta_line ::= LINE_META",
|
607
|
+
/* 146 */ "meta_line ::= LINE_CONTINUATION",
|
608
|
+
/* 147 */ "para ::= LINE_PLAIN",
|
609
|
+
/* 148 */ "para ::= LINE_STOP_COMMENT",
|
610
|
+
/* 149 */ "table ::= table_header",
|
611
|
+
/* 150 */ "header_rows ::= LINE_TABLE",
|
612
|
+
/* 151 */ "table_body ::= table_section",
|
613
|
+
/* 152 */ "all_rows ::= row",
|
614
|
+
/* 153 */ "row ::= header_rows",
|
615
|
+
/* 154 */ "row ::= LINE_TABLE_SEPARATOR",
|
616
|
+
/* 155 */ "para ::= defs",
|
617
|
+
};
|
618
|
+
#endif /* NDEBUG */
|
619
|
+
|
620
|
+
|
621
|
+
#if YYSTACKDEPTH<=0
|
622
|
+
/*
|
623
|
+
** Try to increase the size of the parser stack. Return the number
|
624
|
+
** of errors. Return 0 on success.
|
625
|
+
*/
|
626
|
+
static int yyGrowStack(yyParser *p){
|
627
|
+
int newSize;
|
628
|
+
int idx;
|
629
|
+
yyStackEntry *pNew;
|
630
|
+
|
631
|
+
newSize = p->yystksz*2 + 100;
|
632
|
+
idx = p->yytos ? (int)(p->yytos - p->yystack) : 0;
|
633
|
+
if( p->yystack==&p->yystk0 ){
|
634
|
+
pNew = malloc(newSize*sizeof(pNew[0]));
|
635
|
+
if( pNew ) pNew[0] = p->yystk0;
|
636
|
+
}else{
|
637
|
+
pNew = realloc(p->yystack, newSize*sizeof(pNew[0]));
|
638
|
+
}
|
639
|
+
if( pNew ){
|
640
|
+
p->yystack = pNew;
|
641
|
+
p->yytos = &p->yystack[idx];
|
642
|
+
#ifndef NDEBUG
|
643
|
+
if( yyTraceFILE ){
|
644
|
+
fprintf(yyTraceFILE,"%sStack grows from %d to %d entries.\n",
|
645
|
+
yyTracePrompt, p->yystksz, newSize);
|
646
|
+
}
|
647
|
+
#endif
|
648
|
+
p->yystksz = newSize;
|
649
|
+
}
|
650
|
+
return pNew==0;
|
651
|
+
}
|
652
|
+
#endif
|
653
|
+
|
654
|
+
/* Datatype of the argument to the memory allocated passed as the
|
655
|
+
** second argument to ParseAlloc() below. This can be changed by
|
656
|
+
** putting an appropriate #define in the %include section of the input
|
657
|
+
** grammar.
|
658
|
+
*/
|
659
|
+
#ifndef YYMALLOCARGTYPE
|
660
|
+
# define YYMALLOCARGTYPE size_t
|
661
|
+
#endif
|
662
|
+
|
663
|
+
/*
|
664
|
+
** This function allocates a new parser.
|
665
|
+
** The only argument is a pointer to a function which works like
|
666
|
+
** malloc.
|
667
|
+
**
|
668
|
+
** Inputs:
|
669
|
+
** A pointer to the function used to allocate memory.
|
670
|
+
**
|
671
|
+
** Outputs:
|
672
|
+
** A pointer to a parser. This pointer is used in subsequent calls
|
673
|
+
** to Parse and ParseFree.
|
674
|
+
*/
|
675
|
+
void *ParseAlloc(void *(*mallocProc)(YYMALLOCARGTYPE)){
|
676
|
+
yyParser *pParser;
|
677
|
+
pParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) );
|
678
|
+
if( pParser ){
|
679
|
+
#ifdef YYTRACKMAXSTACKDEPTH
|
680
|
+
pParser->yyhwm = 0;
|
681
|
+
#endif
|
682
|
+
#if YYSTACKDEPTH<=0
|
683
|
+
pParser->yytos = NULL;
|
684
|
+
pParser->yystack = NULL;
|
685
|
+
pParser->yystksz = 0;
|
686
|
+
if( yyGrowStack(pParser) ){
|
687
|
+
pParser->yystack = &pParser->yystk0;
|
688
|
+
pParser->yystksz = 1;
|
689
|
+
}
|
690
|
+
#endif
|
691
|
+
#ifndef YYNOERRORRECOVERY
|
692
|
+
pParser->yyerrcnt = -1;
|
693
|
+
#endif
|
694
|
+
pParser->yytos = pParser->yystack;
|
695
|
+
pParser->yystack[0].stateno = 0;
|
696
|
+
pParser->yystack[0].major = 0;
|
697
|
+
}
|
698
|
+
return pParser;
|
699
|
+
}
|
700
|
+
|
701
|
+
/* The following function deletes the "minor type" or semantic value
|
702
|
+
** associated with a symbol. The symbol can be either a terminal
|
703
|
+
** or nonterminal. "yymajor" is the symbol code, and "yypminor" is
|
704
|
+
** a pointer to the value to be deleted. The code used to do the
|
705
|
+
** deletions is derived from the %destructor and/or %token_destructor
|
706
|
+
** directives of the input grammar.
|
707
|
+
*/
|
708
|
+
static void yy_destructor(
|
709
|
+
yyParser *yypParser, /* The parser */
|
710
|
+
YYCODETYPE yymajor, /* Type code for object to destroy */
|
711
|
+
YYMINORTYPE *yypminor /* The object to be destroyed */
|
712
|
+
){
|
713
|
+
ParseARG_FETCH;
|
714
|
+
switch( yymajor ){
|
715
|
+
/* Here is inserted the actions which take place when a
|
716
|
+
** terminal or non-terminal is destroyed. This can happen
|
717
|
+
** when the symbol is popped from the stack during a
|
718
|
+
** reduce or during error processing or when a parser is
|
719
|
+
** being destroyed before it is finished parsing.
|
720
|
+
**
|
721
|
+
** Note: during a reduce, the only symbols destroyed are those
|
722
|
+
** which appear on the RHS of the rule, but which are *not* used
|
723
|
+
** inside the C code.
|
724
|
+
*/
|
725
|
+
/********* Begin destructor definitions ***************************************/
|
726
|
+
/********* End destructor definitions *****************************************/
|
727
|
+
default: break; /* If no destructor action specified: do nothing */
|
728
|
+
}
|
729
|
+
}
|
730
|
+
|
731
|
+
/*
|
732
|
+
** Pop the parser's stack once.
|
733
|
+
**
|
734
|
+
** If there is a destructor routine associated with the token which
|
735
|
+
** is popped from the stack, then call it.
|
736
|
+
*/
|
737
|
+
static void yy_pop_parser_stack(yyParser *pParser){
|
738
|
+
yyStackEntry *yytos;
|
739
|
+
assert( pParser->yytos!=0 );
|
740
|
+
assert( pParser->yytos > pParser->yystack );
|
741
|
+
yytos = pParser->yytos--;
|
742
|
+
#ifndef NDEBUG
|
743
|
+
if( yyTraceFILE ){
|
744
|
+
fprintf(yyTraceFILE,"%sPopping %s\n",
|
745
|
+
yyTracePrompt,
|
746
|
+
yyTokenName[yytos->major]);
|
747
|
+
}
|
748
|
+
#endif
|
749
|
+
yy_destructor(pParser, yytos->major, &yytos->minor);
|
750
|
+
}
|
751
|
+
|
752
|
+
/*
|
753
|
+
** Deallocate and destroy a parser. Destructors are called for
|
754
|
+
** all stack elements before shutting the parser down.
|
755
|
+
**
|
756
|
+
** If the YYPARSEFREENEVERNULL macro exists (for example because it
|
757
|
+
** is defined in a %include section of the input grammar) then it is
|
758
|
+
** assumed that the input pointer is never NULL.
|
759
|
+
*/
|
760
|
+
void ParseFree(
|
761
|
+
void *p, /* The parser to be deleted */
|
762
|
+
void (*freeProc)(void*) /* Function used to reclaim memory */
|
763
|
+
){
|
764
|
+
yyParser *pParser = (yyParser*)p;
|
765
|
+
#ifndef YYPARSEFREENEVERNULL
|
766
|
+
if( pParser==0 ) return;
|
767
|
+
#endif
|
768
|
+
while( pParser->yytos>pParser->yystack ) yy_pop_parser_stack(pParser);
|
769
|
+
#if YYSTACKDEPTH<=0
|
770
|
+
if( pParser->yystack!=&pParser->yystk0 ) free(pParser->yystack);
|
771
|
+
#endif
|
772
|
+
(*freeProc)((void*)pParser);
|
773
|
+
}
|
774
|
+
|
775
|
+
/*
|
776
|
+
** Return the peak depth of the stack for a parser.
|
777
|
+
*/
|
778
|
+
#ifdef YYTRACKMAXSTACKDEPTH
|
779
|
+
int ParseStackPeak(void *p){
|
780
|
+
yyParser *pParser = (yyParser*)p;
|
781
|
+
return pParser->yyhwm;
|
782
|
+
}
|
783
|
+
#endif
|
784
|
+
|
785
|
+
/*
|
786
|
+
** Find the appropriate action for a parser given the terminal
|
787
|
+
** look-ahead token iLookAhead.
|
788
|
+
*/
|
789
|
+
static unsigned int yy_find_shift_action(
|
790
|
+
yyParser *pParser, /* The parser */
|
791
|
+
YYCODETYPE iLookAhead /* The look-ahead token */
|
792
|
+
){
|
793
|
+
int i;
|
794
|
+
int stateno = pParser->yytos->stateno;
|
795
|
+
|
796
|
+
if( stateno>=YY_MIN_REDUCE ) return stateno;
|
797
|
+
assert( stateno <= YY_SHIFT_COUNT );
|
798
|
+
do{
|
799
|
+
i = yy_shift_ofst[stateno];
|
800
|
+
assert( iLookAhead!=YYNOCODE );
|
801
|
+
i += iLookAhead;
|
802
|
+
if( i<0 || i>=YY_ACTTAB_COUNT || yy_lookahead[i]!=iLookAhead ){
|
803
|
+
#ifdef YYFALLBACK
|
804
|
+
YYCODETYPE iFallback; /* Fallback token */
|
805
|
+
if( iLookAhead<sizeof(yyFallback)/sizeof(yyFallback[0])
|
806
|
+
&& (iFallback = yyFallback[iLookAhead])!=0 ){
|
807
|
+
#ifndef NDEBUG
|
808
|
+
if( yyTraceFILE ){
|
809
|
+
fprintf(yyTraceFILE, "%sFALLBACK %s => %s\n",
|
810
|
+
yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]);
|
811
|
+
}
|
812
|
+
#endif
|
813
|
+
assert( yyFallback[iFallback]==0 ); /* Fallback loop must terminate */
|
814
|
+
iLookAhead = iFallback;
|
815
|
+
continue;
|
816
|
+
}
|
817
|
+
#endif
|
818
|
+
#ifdef YYWILDCARD
|
819
|
+
{
|
820
|
+
int j = i - iLookAhead + YYWILDCARD;
|
821
|
+
if(
|
822
|
+
#if YY_SHIFT_MIN+YYWILDCARD<0
|
823
|
+
j>=0 &&
|
824
|
+
#endif
|
825
|
+
#if YY_SHIFT_MAX+YYWILDCARD>=YY_ACTTAB_COUNT
|
826
|
+
j<YY_ACTTAB_COUNT &&
|
827
|
+
#endif
|
828
|
+
yy_lookahead[j]==YYWILDCARD && iLookAhead>0
|
829
|
+
){
|
830
|
+
#ifndef NDEBUG
|
831
|
+
if( yyTraceFILE ){
|
832
|
+
fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n",
|
833
|
+
yyTracePrompt, yyTokenName[iLookAhead],
|
834
|
+
yyTokenName[YYWILDCARD]);
|
835
|
+
}
|
836
|
+
#endif /* NDEBUG */
|
837
|
+
return yy_action[j];
|
838
|
+
}
|
839
|
+
}
|
840
|
+
#endif /* YYWILDCARD */
|
841
|
+
return yy_default[stateno];
|
842
|
+
}else{
|
843
|
+
return yy_action[i];
|
844
|
+
}
|
845
|
+
}while(1);
|
846
|
+
}
|
847
|
+
|
848
|
+
/*
|
849
|
+
** Find the appropriate action for a parser given the non-terminal
|
850
|
+
** look-ahead token iLookAhead.
|
851
|
+
*/
|
852
|
+
static int yy_find_reduce_action(
|
853
|
+
int stateno, /* Current state number */
|
854
|
+
YYCODETYPE iLookAhead /* The look-ahead token */
|
855
|
+
){
|
856
|
+
int i;
|
857
|
+
#ifdef YYERRORSYMBOL
|
858
|
+
if( stateno>YY_REDUCE_COUNT ){
|
859
|
+
return yy_default[stateno];
|
860
|
+
}
|
861
|
+
#else
|
862
|
+
assert( stateno<=YY_REDUCE_COUNT );
|
863
|
+
#endif
|
864
|
+
i = yy_reduce_ofst[stateno];
|
865
|
+
assert( i!=YY_REDUCE_USE_DFLT );
|
866
|
+
assert( iLookAhead!=YYNOCODE );
|
867
|
+
i += iLookAhead;
|
868
|
+
#ifdef YYERRORSYMBOL
|
869
|
+
if( i<0 || i>=YY_ACTTAB_COUNT || yy_lookahead[i]!=iLookAhead ){
|
870
|
+
return yy_default[stateno];
|
871
|
+
}
|
872
|
+
#else
|
873
|
+
assert( i>=0 && i<YY_ACTTAB_COUNT );
|
874
|
+
assert( yy_lookahead[i]==iLookAhead );
|
875
|
+
#endif
|
876
|
+
return yy_action[i];
|
877
|
+
}
|
878
|
+
|
879
|
+
/*
|
880
|
+
** The following routine is called if the stack overflows.
|
881
|
+
*/
|
882
|
+
static void yyStackOverflow(yyParser *yypParser){
|
883
|
+
ParseARG_FETCH;
|
884
|
+
yypParser->yytos--;
|
885
|
+
#ifndef NDEBUG
|
886
|
+
if( yyTraceFILE ){
|
887
|
+
fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt);
|
888
|
+
}
|
889
|
+
#endif
|
890
|
+
while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
|
891
|
+
/* Here code is inserted which will execute if the parser
|
892
|
+
** stack every overflows */
|
893
|
+
/******** Begin %stack_overflow code ******************************************/
|
894
|
+
/******** End %stack_overflow code ********************************************/
|
895
|
+
ParseARG_STORE; /* Suppress warning about unused %extra_argument var */
|
896
|
+
}
|
897
|
+
|
898
|
+
/*
|
899
|
+
** Print tracing information for a SHIFT action
|
900
|
+
*/
|
901
|
+
#ifndef NDEBUG
|
902
|
+
static void yyTraceShift(yyParser *yypParser, int yyNewState){
|
903
|
+
if( yyTraceFILE ){
|
904
|
+
if( yyNewState<YYNSTATE ){
|
905
|
+
fprintf(yyTraceFILE,"%sShift '%s', go to state %d\n",
|
906
|
+
yyTracePrompt,yyTokenName[yypParser->yytos->major],
|
907
|
+
yyNewState);
|
908
|
+
}else{
|
909
|
+
fprintf(yyTraceFILE,"%sShift '%s'\n",
|
910
|
+
yyTracePrompt,yyTokenName[yypParser->yytos->major]);
|
911
|
+
}
|
912
|
+
}
|
913
|
+
}
|
914
|
+
#else
|
915
|
+
# define yyTraceShift(X,Y)
|
916
|
+
#endif
|
917
|
+
|
918
|
+
/*
|
919
|
+
** Perform a shift action.
|
920
|
+
*/
|
921
|
+
static void yy_shift(
|
922
|
+
yyParser *yypParser, /* The parser to be shifted */
|
923
|
+
int yyNewState, /* The new state to shift in */
|
924
|
+
int yyMajor, /* The major token to shift in */
|
925
|
+
ParseTOKENTYPE yyMinor /* The minor token to shift in */
|
926
|
+
){
|
927
|
+
yyStackEntry *yytos;
|
928
|
+
yypParser->yytos++;
|
929
|
+
#ifdef YYTRACKMAXSTACKDEPTH
|
930
|
+
if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){
|
931
|
+
yypParser->yyhwm++;
|
932
|
+
assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack) );
|
933
|
+
}
|
934
|
+
#endif
|
935
|
+
#if YYSTACKDEPTH>0
|
936
|
+
if( yypParser->yytos>=&yypParser->yystack[YYSTACKDEPTH] ){
|
937
|
+
yyStackOverflow(yypParser);
|
938
|
+
return;
|
939
|
+
}
|
940
|
+
#else
|
941
|
+
if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz] ){
|
942
|
+
if( yyGrowStack(yypParser) ){
|
943
|
+
yyStackOverflow(yypParser);
|
944
|
+
return;
|
945
|
+
}
|
946
|
+
}
|
947
|
+
#endif
|
948
|
+
if( yyNewState > YY_MAX_SHIFT ){
|
949
|
+
yyNewState += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE;
|
950
|
+
}
|
951
|
+
yytos = yypParser->yytos;
|
952
|
+
yytos->stateno = (YYACTIONTYPE)yyNewState;
|
953
|
+
yytos->major = (YYCODETYPE)yyMajor;
|
954
|
+
yytos->minor.yy0 = yyMinor;
|
955
|
+
yyTraceShift(yypParser, yyNewState);
|
956
|
+
}
|
957
|
+
|
958
|
+
/* The following table contains information about every rule that
|
959
|
+
** is used during the reduce.
|
960
|
+
*/
|
961
|
+
static const struct {
|
962
|
+
YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */
|
963
|
+
unsigned char nrhs; /* Number of right-hand side symbols in the rule */
|
964
|
+
} yyRuleInfo[] = {
|
965
|
+
{ 41, 1 },
|
966
|
+
{ 42, 2 },
|
967
|
+
{ 42, 1 },
|
968
|
+
{ 43, 1 },
|
969
|
+
{ 43, 1 },
|
970
|
+
{ 43, 1 },
|
971
|
+
{ 43, 1 },
|
972
|
+
{ 43, 1 },
|
973
|
+
{ 43, 1 },
|
974
|
+
{ 43, 1 },
|
975
|
+
{ 43, 1 },
|
976
|
+
{ 43, 1 },
|
977
|
+
{ 43, 1 },
|
978
|
+
{ 43, 1 },
|
979
|
+
{ 43, 1 },
|
980
|
+
{ 43, 1 },
|
981
|
+
{ 43, 1 },
|
982
|
+
{ 43, 1 },
|
983
|
+
{ 43, 1 },
|
984
|
+
{ 43, 1 },
|
985
|
+
{ 43, 1 },
|
986
|
+
{ 43, 1 },
|
987
|
+
{ 43, 1 },
|
988
|
+
{ 43, 1 },
|
989
|
+
{ 43, 1 },
|
990
|
+
{ 43, 1 },
|
991
|
+
{ 43, 1 },
|
992
|
+
{ 43, 2 },
|
993
|
+
{ 43, 1 },
|
994
|
+
{ 43, 1 },
|
995
|
+
{ 43, 1 },
|
996
|
+
{ 43, 1 },
|
997
|
+
{ 63, 2 },
|
998
|
+
{ 65, 2 },
|
999
|
+
{ 66, 3 },
|
1000
|
+
{ 66, 2 },
|
1001
|
+
{ 68, 2 },
|
1002
|
+
{ 69, 2 },
|
1003
|
+
{ 44, 2 },
|
1004
|
+
{ 46, 2 },
|
1005
|
+
{ 47, 2 },
|
1006
|
+
{ 48, 2 },
|
1007
|
+
{ 49, 2 },
|
1008
|
+
{ 45, 2 },
|
1009
|
+
{ 50, 2 },
|
1010
|
+
{ 72, 2 },
|
1011
|
+
{ 73, 2 },
|
1012
|
+
{ 73, 1 },
|
1013
|
+
{ 51, 2 },
|
1014
|
+
{ 52, 2 },
|
1015
|
+
{ 52, 2 },
|
1016
|
+
{ 52, 2 },
|
1017
|
+
{ 74, 2 },
|
1018
|
+
{ 52, 2 },
|
1019
|
+
{ 52, 2 },
|
1020
|
+
{ 76, 2 },
|
1021
|
+
{ 76, 2 },
|
1022
|
+
{ 76, 2 },
|
1023
|
+
{ 52, 2 },
|
1024
|
+
{ 77, 2 },
|
1025
|
+
{ 77, 2 },
|
1026
|
+
{ 77, 2 },
|
1027
|
+
{ 77, 2 },
|
1028
|
+
{ 77, 2 },
|
1029
|
+
{ 53, 2 },
|
1030
|
+
{ 54, 2 },
|
1031
|
+
{ 79, 2 },
|
1032
|
+
{ 55, 2 },
|
1033
|
+
{ 55, 2 },
|
1034
|
+
{ 56, 2 },
|
1035
|
+
{ 81, 2 },
|
1036
|
+
{ 81, 2 },
|
1037
|
+
{ 81, 2 },
|
1038
|
+
{ 81, 1 },
|
1039
|
+
{ 57, 2 },
|
1040
|
+
{ 82, 2 },
|
1041
|
+
{ 82, 2 },
|
1042
|
+
{ 82, 2 },
|
1043
|
+
{ 82, 1 },
|
1044
|
+
{ 58, 2 },
|
1045
|
+
{ 58, 2 },
|
1046
|
+
{ 59, 2 },
|
1047
|
+
{ 60, 2 },
|
1048
|
+
{ 61, 2 },
|
1049
|
+
{ 62, 2 },
|
1050
|
+
{ 84, 2 },
|
1051
|
+
{ 84, 1 },
|
1052
|
+
{ 86, 2 },
|
1053
|
+
{ 85, 2 },
|
1054
|
+
{ 87, 2 },
|
1055
|
+
{ 87, 1 },
|
1056
|
+
{ 88, 2 },
|
1057
|
+
{ 59, 1 },
|
1058
|
+
{ 63, 1 },
|
1059
|
+
{ 64, 1 },
|
1060
|
+
{ 64, 1 },
|
1061
|
+
{ 65, 1 },
|
1062
|
+
{ 66, 1 },
|
1063
|
+
{ 67, 1 },
|
1064
|
+
{ 67, 1 },
|
1065
|
+
{ 69, 1 },
|
1066
|
+
{ 70, 1 },
|
1067
|
+
{ 70, 1 },
|
1068
|
+
{ 44, 1 },
|
1069
|
+
{ 71, 1 },
|
1070
|
+
{ 71, 1 },
|
1071
|
+
{ 46, 1 },
|
1072
|
+
{ 47, 1 },
|
1073
|
+
{ 48, 1 },
|
1074
|
+
{ 49, 1 },
|
1075
|
+
{ 45, 1 },
|
1076
|
+
{ 72, 1 },
|
1077
|
+
{ 51, 1 },
|
1078
|
+
{ 52, 1 },
|
1079
|
+
{ 74, 1 },
|
1080
|
+
{ 74, 1 },
|
1081
|
+
{ 52, 1 },
|
1082
|
+
{ 76, 1 },
|
1083
|
+
{ 76, 1 },
|
1084
|
+
{ 52, 1 },
|
1085
|
+
{ 77, 1 },
|
1086
|
+
{ 77, 1 },
|
1087
|
+
{ 75, 1 },
|
1088
|
+
{ 75, 1 },
|
1089
|
+
{ 75, 1 },
|
1090
|
+
{ 75, 1 },
|
1091
|
+
{ 75, 1 },
|
1092
|
+
{ 75, 1 },
|
1093
|
+
{ 75, 1 },
|
1094
|
+
{ 53, 1 },
|
1095
|
+
{ 78, 1 },
|
1096
|
+
{ 78, 1 },
|
1097
|
+
{ 78, 1 },
|
1098
|
+
{ 78, 1 },
|
1099
|
+
{ 54, 1 },
|
1100
|
+
{ 79, 1 },
|
1101
|
+
{ 80, 1 },
|
1102
|
+
{ 80, 1 },
|
1103
|
+
{ 80, 1 },
|
1104
|
+
{ 80, 1 },
|
1105
|
+
{ 80, 1 },
|
1106
|
+
{ 55, 1 },
|
1107
|
+
{ 56, 1 },
|
1108
|
+
{ 57, 1 },
|
1109
|
+
{ 58, 1 },
|
1110
|
+
{ 83, 1 },
|
1111
|
+
{ 83, 1 },
|
1112
|
+
{ 59, 1 },
|
1113
|
+
{ 59, 1 },
|
1114
|
+
{ 62, 1 },
|
1115
|
+
{ 86, 1 },
|
1116
|
+
{ 85, 1 },
|
1117
|
+
{ 88, 1 },
|
1118
|
+
{ 89, 1 },
|
1119
|
+
{ 89, 1 },
|
1120
|
+
{ 59, 1 },
|
1121
|
+
};
|
1122
|
+
|
1123
|
+
static void yy_accept(yyParser*); /* Forward Declaration */
|
1124
|
+
|
1125
|
+
/*
|
1126
|
+
** Perform a reduce action and the shift that must immediately
|
1127
|
+
** follow the reduce.
|
1128
|
+
*/
|
1129
|
+
static void yy_reduce(
|
1130
|
+
yyParser *yypParser, /* The parser */
|
1131
|
+
unsigned int yyruleno /* Number of the rule by which to reduce */
|
1132
|
+
){
|
1133
|
+
int yygoto; /* The next state */
|
1134
|
+
int yyact; /* The next action */
|
1135
|
+
yyStackEntry *yymsp; /* The top of the parser's stack */
|
1136
|
+
int yysize; /* Amount to pop the stack */
|
1137
|
+
ParseARG_FETCH;
|
1138
|
+
yymsp = yypParser->yytos;
|
1139
|
+
#ifndef NDEBUG
|
1140
|
+
if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){
|
1141
|
+
yysize = yyRuleInfo[yyruleno].nrhs;
|
1142
|
+
fprintf(yyTraceFILE, "%sReduce [%s], go to state %d.\n", yyTracePrompt,
|
1143
|
+
yyRuleName[yyruleno], yymsp[-yysize].stateno);
|
1144
|
+
}
|
1145
|
+
#endif /* NDEBUG */
|
1146
|
+
|
1147
|
+
/* Check that the stack is large enough to grow by a single entry
|
1148
|
+
** if the RHS of the rule is empty. This ensures that there is room
|
1149
|
+
** enough on the stack to push the LHS value */
|
1150
|
+
if( yyRuleInfo[yyruleno].nrhs==0 ){
|
1151
|
+
#ifdef YYTRACKMAXSTACKDEPTH
|
1152
|
+
if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){
|
1153
|
+
yypParser->yyhwm++;
|
1154
|
+
assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack));
|
1155
|
+
}
|
1156
|
+
#endif
|
1157
|
+
#if YYSTACKDEPTH>0
|
1158
|
+
if( yypParser->yytos>=&yypParser->yystack[YYSTACKDEPTH-1] ){
|
1159
|
+
yyStackOverflow(yypParser);
|
1160
|
+
return;
|
1161
|
+
}
|
1162
|
+
#else
|
1163
|
+
if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){
|
1164
|
+
if( yyGrowStack(yypParser) ){
|
1165
|
+
yyStackOverflow(yypParser);
|
1166
|
+
return;
|
1167
|
+
}
|
1168
|
+
yymsp = yypParser->yytos;
|
1169
|
+
}
|
1170
|
+
#endif
|
1171
|
+
}
|
1172
|
+
|
1173
|
+
switch( yyruleno ){
|
1174
|
+
/* Beginning here are the reduction cases. A typical example
|
1175
|
+
** follows:
|
1176
|
+
** case 0:
|
1177
|
+
** #line <lineno> <grammarfile>
|
1178
|
+
** { ... } // User supplied code
|
1179
|
+
** #line <lineno> <thisfile>
|
1180
|
+
** break;
|
1181
|
+
*/
|
1182
|
+
/********** Begin reduce actions **********************************************/
|
1183
|
+
YYMINORTYPE yylhsminor;
|
1184
|
+
case 0: /* doc ::= blocks */
|
1185
|
+
{ engine->root = yymsp[0].minor.yy0; }
|
1186
|
+
break;
|
1187
|
+
case 1: /* blocks ::= blocks block */
|
1188
|
+
{
|
1189
|
+
strip_line_tokens_from_block(engine, yymsp[0].minor.yy0);
|
1190
|
+
if (yymsp[-1].minor.yy0 == NULL) { yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; yymsp[0].minor.yy0 = NULL;}
|
1191
|
+
yylhsminor.yy0 = yymsp[-1].minor.yy0;
|
1192
|
+
token_chain_append(yylhsminor.yy0, yymsp[0].minor.yy0);
|
1193
|
+
#ifndef NDEBUG
|
1194
|
+
fprintf(stderr, "Next block %d\n", yylhsminor.yy0->tail->type);
|
1195
|
+
#endif
|
1196
|
+
}
|
1197
|
+
yymsp[-1].minor.yy0 = yylhsminor.yy0;
|
1198
|
+
break;
|
1199
|
+
case 2: /* blocks ::= block */
|
1200
|
+
{
|
1201
|
+
engine->root = yymsp[0].minor.yy0; // In case the first block is metadata and we just want to know if it exists
|
1202
|
+
strip_line_tokens_from_block(engine, yymsp[0].minor.yy0);
|
1203
|
+
#ifndef NDEBUG
|
1204
|
+
fprintf(stderr, "First block %d\n", yymsp[0].minor.yy0->type);
|
1205
|
+
#endif
|
1206
|
+
yylhsminor.yy0 = yymsp[0].minor.yy0;
|
1207
|
+
}
|
1208
|
+
yymsp[0].minor.yy0 = yylhsminor.yy0;
|
1209
|
+
break;
|
1210
|
+
case 3: /* block ::= LINE_ATX_1 */
|
1211
|
+
{ yylhsminor.yy0 = token_new_parent(yymsp[0].minor.yy0, BLOCK_H1); stack_push(engine->header_stack, yylhsminor.yy0); }
|
1212
|
+
yymsp[0].minor.yy0 = yylhsminor.yy0;
|
1213
|
+
break;
|
1214
|
+
case 4: /* block ::= LINE_ATX_2 */
|
1215
|
+
{ yylhsminor.yy0 = token_new_parent(yymsp[0].minor.yy0, BLOCK_H2); stack_push(engine->header_stack, yylhsminor.yy0); }
|
1216
|
+
yymsp[0].minor.yy0 = yylhsminor.yy0;
|
1217
|
+
break;
|
1218
|
+
case 5: /* block ::= LINE_ATX_3 */
|
1219
|
+
{ yylhsminor.yy0 = token_new_parent(yymsp[0].minor.yy0, BLOCK_H3); stack_push(engine->header_stack, yylhsminor.yy0); }
|
1220
|
+
yymsp[0].minor.yy0 = yylhsminor.yy0;
|
1221
|
+
break;
|
1222
|
+
case 6: /* block ::= LINE_ATX_4 */
|
1223
|
+
{ yylhsminor.yy0 = token_new_parent(yymsp[0].minor.yy0, BLOCK_H4); stack_push(engine->header_stack, yylhsminor.yy0); }
|
1224
|
+
yymsp[0].minor.yy0 = yylhsminor.yy0;
|
1225
|
+
break;
|
1226
|
+
case 7: /* block ::= LINE_ATX_5 */
|
1227
|
+
{ yylhsminor.yy0 = token_new_parent(yymsp[0].minor.yy0, BLOCK_H5); stack_push(engine->header_stack, yylhsminor.yy0); }
|
1228
|
+
yymsp[0].minor.yy0 = yylhsminor.yy0;
|
1229
|
+
break;
|
1230
|
+
case 8: /* block ::= LINE_ATX_6 */
|
1231
|
+
{ yylhsminor.yy0 = token_new_parent(yymsp[0].minor.yy0, BLOCK_H6); stack_push(engine->header_stack, yylhsminor.yy0); }
|
1232
|
+
yymsp[0].minor.yy0 = yylhsminor.yy0;
|
1233
|
+
break;
|
1234
|
+
case 9: /* block ::= LINE_HR */
|
1235
|
+
case 10: /* block ::= LINE_YAML */ yytestcase(yyruleno==10);
|
1236
|
+
{ yylhsminor.yy0 = token_new_parent(yymsp[0].minor.yy0, BLOCK_HR); }
|
1237
|
+
yymsp[0].minor.yy0 = yylhsminor.yy0;
|
1238
|
+
break;
|
1239
|
+
case 11: /* block ::= LINE_TOC */
|
1240
|
+
{ yylhsminor.yy0 = token_new_parent(yymsp[0].minor.yy0, BLOCK_TOC); }
|
1241
|
+
yymsp[0].minor.yy0 = yylhsminor.yy0;
|
1242
|
+
break;
|
1243
|
+
case 12: /* block ::= blockquote */
|
1244
|
+
{ yylhsminor.yy0 = token_new_parent(yymsp[0].minor.yy0, BLOCK_BLOCKQUOTE); recursive_parse_blockquote(engine, yylhsminor.yy0); }
|
1245
|
+
yymsp[0].minor.yy0 = yylhsminor.yy0;
|
1246
|
+
break;
|
1247
|
+
case 13: /* block ::= def_abbreviation */
|
1248
|
+
{ yylhsminor.yy0 = token_new_parent(yymsp[0].minor.yy0, BLOCK_DEF_ABBREVIATION); stack_push(engine->definition_stack, yylhsminor.yy0); }
|
1249
|
+
yymsp[0].minor.yy0 = yylhsminor.yy0;
|
1250
|
+
break;
|
1251
|
+
case 14: /* block ::= def_citation */
|
1252
|
+
{ yylhsminor.yy0 = token_new_parent(yymsp[0].minor.yy0, BLOCK_DEF_CITATION); stack_push(engine->definition_stack, yylhsminor.yy0); }
|
1253
|
+
yymsp[0].minor.yy0 = yylhsminor.yy0;
|
1254
|
+
break;
|
1255
|
+
case 15: /* block ::= def_footnote */
|
1256
|
+
{ yylhsminor.yy0 = token_new_parent(yymsp[0].minor.yy0, BLOCK_DEF_FOOTNOTE); stack_push(engine->definition_stack, yylhsminor.yy0); recursive_parse_indent(engine, yylhsminor.yy0); }
|
1257
|
+
yymsp[0].minor.yy0 = yylhsminor.yy0;
|
1258
|
+
break;
|
1259
|
+
case 16: /* block ::= def_glossary */
|
1260
|
+
{ yylhsminor.yy0 = token_new_parent(yymsp[0].minor.yy0, BLOCK_DEF_GLOSSARY); stack_push(engine->definition_stack, yylhsminor.yy0); recursive_parse_indent(engine, yylhsminor.yy0); }
|
1261
|
+
yymsp[0].minor.yy0 = yylhsminor.yy0;
|
1262
|
+
break;
|
1263
|
+
case 17: /* block ::= def_link */
|
1264
|
+
{ yylhsminor.yy0 = token_new_parent(yymsp[0].minor.yy0, BLOCK_DEF_LINK); stack_push(engine->definition_stack, yylhsminor.yy0); }
|
1265
|
+
yymsp[0].minor.yy0 = yylhsminor.yy0;
|
1266
|
+
break;
|
1267
|
+
case 18: /* block ::= definition_block */
|
1268
|
+
{ yylhsminor.yy0 = token_new_parent(yymsp[0].minor.yy0, BLOCK_DEFLIST); }
|
1269
|
+
yymsp[0].minor.yy0 = yylhsminor.yy0;
|
1270
|
+
break;
|
1271
|
+
case 19: /* block ::= empty */
|
1272
|
+
{ yylhsminor.yy0 = token_new_parent(yymsp[0].minor.yy0, BLOCK_EMPTY); }
|
1273
|
+
yymsp[0].minor.yy0 = yylhsminor.yy0;
|
1274
|
+
break;
|
1275
|
+
case 20: /* block ::= fenced_block */
|
1276
|
+
{ yylhsminor.yy0 = token_new_parent(yymsp[0].minor.yy0, BLOCK_CODE_FENCED); yymsp[0].minor.yy0->child->type = CODE_FENCE; }
|
1277
|
+
yymsp[0].minor.yy0 = yylhsminor.yy0;
|
1278
|
+
break;
|
1279
|
+
case 21: /* block ::= html_block */
|
1280
|
+
case 22: /* block ::= html_com_block */ yytestcase(yyruleno==22);
|
1281
|
+
{ yylhsminor.yy0 = token_new_parent(yymsp[0].minor.yy0, BLOCK_HTML); }
|
1282
|
+
yymsp[0].minor.yy0 = yylhsminor.yy0;
|
1283
|
+
break;
|
1284
|
+
case 23: /* block ::= indented_code */
|
1285
|
+
{ yylhsminor.yy0 = token_new_parent(yymsp[0].minor.yy0, BLOCK_CODE_INDENTED); }
|
1286
|
+
yymsp[0].minor.yy0 = yylhsminor.yy0;
|
1287
|
+
break;
|
1288
|
+
case 24: /* block ::= list_bullet */
|
1289
|
+
{ yylhsminor.yy0 = token_new_parent(yymsp[0].minor.yy0, BLOCK_LIST_BULLETED); is_list_loose(yylhsminor.yy0); }
|
1290
|
+
yymsp[0].minor.yy0 = yylhsminor.yy0;
|
1291
|
+
break;
|
1292
|
+
case 25: /* block ::= list_enum */
|
1293
|
+
{ yylhsminor.yy0 = token_new_parent(yymsp[0].minor.yy0, BLOCK_LIST_ENUMERATED); is_list_loose(yylhsminor.yy0); }
|
1294
|
+
yymsp[0].minor.yy0 = yylhsminor.yy0;
|
1295
|
+
break;
|
1296
|
+
case 26: /* block ::= meta_block */
|
1297
|
+
{ yylhsminor.yy0 = token_new_parent(yymsp[0].minor.yy0, BLOCK_META); }
|
1298
|
+
yymsp[0].minor.yy0 = yylhsminor.yy0;
|
1299
|
+
break;
|
1300
|
+
case 27: /* block ::= meta_block LINE_SETEXT_2 */
|
1301
|
+
{ yylhsminor.yy0 = token_new_parent(yymsp[-1].minor.yy0, BLOCK_META); token_append_child(yylhsminor.yy0, yymsp[0].minor.yy0); }
|
1302
|
+
yymsp[-1].minor.yy0 = yylhsminor.yy0;
|
1303
|
+
break;
|
1304
|
+
case 28: /* block ::= para */
|
1305
|
+
{ yylhsminor.yy0 = token_new_parent(yymsp[0].minor.yy0, BLOCK_PARA); is_para_html(engine, yylhsminor.yy0); }
|
1306
|
+
yymsp[0].minor.yy0 = yylhsminor.yy0;
|
1307
|
+
break;
|
1308
|
+
case 29: /* block ::= setext_1 */
|
1309
|
+
{ yylhsminor.yy0 = token_new_parent(yymsp[0].minor.yy0, BLOCK_SETEXT_1); stack_push(engine->header_stack, yylhsminor.yy0); }
|
1310
|
+
yymsp[0].minor.yy0 = yylhsminor.yy0;
|
1311
|
+
break;
|
1312
|
+
case 30: /* block ::= setext_2 */
|
1313
|
+
{ yylhsminor.yy0 = token_new_parent(yymsp[0].minor.yy0, BLOCK_SETEXT_2); stack_push(engine->header_stack, yylhsminor.yy0); }
|
1314
|
+
yymsp[0].minor.yy0 = yylhsminor.yy0;
|
1315
|
+
break;
|
1316
|
+
case 31: /* block ::= table */
|
1317
|
+
{ yylhsminor.yy0 = token_new_parent(yymsp[0].minor.yy0, BLOCK_TABLE); stack_push(engine->table_stack, yylhsminor.yy0); }
|
1318
|
+
yymsp[0].minor.yy0 = yylhsminor.yy0;
|
1319
|
+
break;
|
1320
|
+
case 32: /* chunk ::= chunk chunk_line */
|
1321
|
+
case 33: /* nested_chunks ::= nested_chunks nested_chunk */ yytestcase(yyruleno==33);
|
1322
|
+
case 36: /* ext_chunk ::= chunk nested_chunks */ yytestcase(yyruleno==36);
|
1323
|
+
case 37: /* opt_ext_chunk ::= chunk nested_chunks */ yytestcase(yyruleno==37);
|
1324
|
+
case 38: /* blockquote ::= blockquote quote_line */ yytestcase(yyruleno==38);
|
1325
|
+
case 39: /* def_citation ::= LINE_DEF_CITATION tail */ yytestcase(yyruleno==39);
|
1326
|
+
case 40: /* def_footnote ::= LINE_DEF_FOOTNOTE tail */ yytestcase(yyruleno==40);
|
1327
|
+
case 41: /* def_glossary ::= LINE_DEF_GLOSSARY tail */ yytestcase(yyruleno==41);
|
1328
|
+
case 42: /* def_link ::= LINE_DEF_LINK chunk */ yytestcase(yyruleno==42);
|
1329
|
+
case 43: /* def_abbreviation ::= LINE_DEF_ABBREVIATION chunk */ yytestcase(yyruleno==43);
|
1330
|
+
case 45: /* defs ::= defs def */ yytestcase(yyruleno==45);
|
1331
|
+
case 48: /* empty ::= empty LINE_EMPTY */ yytestcase(yyruleno==48);
|
1332
|
+
case 52: /* fenced_3 ::= fenced_3 fenced_line */ yytestcase(yyruleno==52);
|
1333
|
+
case 55: /* fenced_4 ::= fenced_4 fenced_line */ yytestcase(yyruleno==55);
|
1334
|
+
case 56: /* fenced_4 ::= fenced_4 LINE_FENCE_BACKTICK_3 */ yytestcase(yyruleno==56);
|
1335
|
+
case 57: /* fenced_4 ::= fenced_4 LINE_FENCE_BACKTICK_START_3 */ yytestcase(yyruleno==57);
|
1336
|
+
case 59: /* fenced_5 ::= fenced_5 fenced_line */ yytestcase(yyruleno==59);
|
1337
|
+
case 60: /* fenced_5 ::= fenced_5 LINE_FENCE_BACKTICK_3 */ yytestcase(yyruleno==60);
|
1338
|
+
case 61: /* fenced_5 ::= fenced_5 LINE_FENCE_BACKTICK_START_3 */ yytestcase(yyruleno==61);
|
1339
|
+
case 62: /* fenced_5 ::= fenced_5 LINE_FENCE_BACKTICK_4 */ yytestcase(yyruleno==62);
|
1340
|
+
case 63: /* fenced_5 ::= fenced_5 LINE_FENCE_BACKTICK_START_4 */ yytestcase(yyruleno==63);
|
1341
|
+
case 64: /* html_block ::= html_block html_line */ yytestcase(yyruleno==64);
|
1342
|
+
case 65: /* html_com_block ::= html_comment LINE_STOP_COMMENT */ yytestcase(yyruleno==65);
|
1343
|
+
case 66: /* html_comment ::= html_comment comment_line */ yytestcase(yyruleno==66);
|
1344
|
+
case 67: /* indented_code ::= indented_code indented_line */ yytestcase(yyruleno==67);
|
1345
|
+
case 68: /* indented_code ::= indented_code LINE_EMPTY */ yytestcase(yyruleno==68);
|
1346
|
+
case 69: /* list_bullet ::= list_bullet item_bullet */ yytestcase(yyruleno==69);
|
1347
|
+
case 74: /* list_enum ::= list_enum item_enum */ yytestcase(yyruleno==74);
|
1348
|
+
case 79: /* meta_block ::= meta_block meta_line */ yytestcase(yyruleno==79);
|
1349
|
+
case 80: /* meta_block ::= LINE_YAML LINE_META */ yytestcase(yyruleno==80);
|
1350
|
+
case 81: /* para ::= LINE_PLAIN chunk */ yytestcase(yyruleno==81);
|
1351
|
+
case 82: /* setext_1 ::= para LINE_SETEXT_1 */ yytestcase(yyruleno==82);
|
1352
|
+
case 83: /* setext_2 ::= para LINE_SETEXT_2 */ yytestcase(yyruleno==83);
|
1353
|
+
case 84: /* table ::= table_header table_body */ yytestcase(yyruleno==84);
|
1354
|
+
case 87: /* header_rows ::= header_rows LINE_TABLE */ yytestcase(yyruleno==87);
|
1355
|
+
case 88: /* table_body ::= table_body table_section */ yytestcase(yyruleno==88);
|
1356
|
+
case 91: /* all_rows ::= all_rows row */ yytestcase(yyruleno==91);
|
1357
|
+
{ yylhsminor.yy0 = yymsp[-1].minor.yy0; token_chain_append(yymsp[-1].minor.yy0, yymsp[0].minor.yy0); }
|
1358
|
+
yymsp[-1].minor.yy0 = yylhsminor.yy0;
|
1359
|
+
break;
|
1360
|
+
case 34: /* nested_chunk ::= empty indented_line chunk */
|
1361
|
+
{ yylhsminor.yy0 = yymsp[-2].minor.yy0; token_chain_append(yymsp[-2].minor.yy0, yymsp[-1].minor.yy0); token_chain_append(yymsp[-2].minor.yy0, yymsp[0].minor.yy0); yymsp[-1].minor.yy0->type = LINE_CONTINUATION; }
|
1362
|
+
yymsp[-2].minor.yy0 = yylhsminor.yy0;
|
1363
|
+
break;
|
1364
|
+
case 35: /* nested_chunk ::= empty indented_line */
|
1365
|
+
{ yylhsminor.yy0 = yymsp[-1].minor.yy0; token_chain_append(yymsp[-1].minor.yy0, yymsp[0].minor.yy0); yymsp[0].minor.yy0->type = LINE_CONTINUATION; }
|
1366
|
+
yymsp[-1].minor.yy0 = yylhsminor.yy0;
|
1367
|
+
break;
|
1368
|
+
case 44: /* definition_block ::= para defs */
|
1369
|
+
{ yylhsminor.yy0 = yymsp[-1].minor.yy0; token_chain_append(yymsp[-1].minor.yy0, yymsp[0].minor.yy0); yymsp[-1].minor.yy0->type = BLOCK_TERM; }
|
1370
|
+
yymsp[-1].minor.yy0 = yylhsminor.yy0;
|
1371
|
+
break;
|
1372
|
+
case 46: /* def ::= LINE_DEFINITION tail */
|
1373
|
+
{ yylhsminor.yy0 = token_new_parent(yymsp[-1].minor.yy0, BLOCK_DEFINITION); token_chain_append(yymsp[-1].minor.yy0, yymsp[0].minor.yy0); recursive_parse_indent(engine, yylhsminor.yy0); }
|
1374
|
+
yymsp[-1].minor.yy0 = yylhsminor.yy0;
|
1375
|
+
break;
|
1376
|
+
case 47: /* def ::= LINE_DEFINITION */
|
1377
|
+
{ yylhsminor.yy0 = token_new_parent(yymsp[0].minor.yy0, BLOCK_DEFINITION); }
|
1378
|
+
yymsp[0].minor.yy0 = yylhsminor.yy0;
|
1379
|
+
break;
|
1380
|
+
case 49: /* fenced_block ::= fenced_3 LINE_FENCE_BACKTICK_3 */
|
1381
|
+
case 50: /* fenced_block ::= fenced_3 LINE_FENCE_BACKTICK_4 */ yytestcase(yyruleno==50);
|
1382
|
+
case 51: /* fenced_block ::= fenced_3 LINE_FENCE_BACKTICK_5 */ yytestcase(yyruleno==51);
|
1383
|
+
case 53: /* fenced_block ::= fenced_4 LINE_FENCE_BACKTICK_4 */ yytestcase(yyruleno==53);
|
1384
|
+
case 54: /* fenced_block ::= fenced_4 LINE_FENCE_BACKTICK_5 */ yytestcase(yyruleno==54);
|
1385
|
+
case 58: /* fenced_block ::= fenced_5 LINE_FENCE_BACKTICK_5 */ yytestcase(yyruleno==58);
|
1386
|
+
{ yylhsminor.yy0 = yymsp[-1].minor.yy0; token_chain_append(yymsp[-1].minor.yy0, yymsp[0].minor.yy0); yymsp[0].minor.yy0->child->type = CODE_FENCE; }
|
1387
|
+
yymsp[-1].minor.yy0 = yylhsminor.yy0;
|
1388
|
+
break;
|
1389
|
+
case 70: /* item_bullet ::= LINE_LIST_BULLETED ext_chunk */
|
1390
|
+
case 72: /* item_bullet ::= LINE_LIST_BULLETED nested_chunks */ yytestcase(yyruleno==72);
|
1391
|
+
case 75: /* item_enum ::= LINE_LIST_ENUMERATED ext_chunk */ yytestcase(yyruleno==75);
|
1392
|
+
case 77: /* item_enum ::= LINE_LIST_ENUMERATED nested_chunks */ yytestcase(yyruleno==77);
|
1393
|
+
{ yylhsminor.yy0 = token_new_parent(yymsp[-1].minor.yy0, BLOCK_LIST_ITEM); token_chain_append(yymsp[-1].minor.yy0, yymsp[0].minor.yy0); recursive_parse_list_item(engine, yylhsminor.yy0); }
|
1394
|
+
yymsp[-1].minor.yy0 = yylhsminor.yy0;
|
1395
|
+
break;
|
1396
|
+
case 71: /* item_bullet ::= LINE_LIST_BULLETED chunk */
|
1397
|
+
case 76: /* item_enum ::= LINE_LIST_ENUMERATED chunk */ yytestcase(yyruleno==76);
|
1398
|
+
{ yylhsminor.yy0 = token_new_parent(yymsp[-1].minor.yy0, BLOCK_LIST_ITEM_TIGHT); token_chain_append(yymsp[-1].minor.yy0, yymsp[0].minor.yy0); recursive_parse_list_item(engine, yylhsminor.yy0); }
|
1399
|
+
yymsp[-1].minor.yy0 = yylhsminor.yy0;
|
1400
|
+
break;
|
1401
|
+
case 73: /* item_bullet ::= LINE_LIST_BULLETED */
|
1402
|
+
case 78: /* item_enum ::= LINE_LIST_ENUMERATED */ yytestcase(yyruleno==78);
|
1403
|
+
{ yylhsminor.yy0 = token_new_parent(yymsp[0].minor.yy0, BLOCK_LIST_ITEM_TIGHT); }
|
1404
|
+
yymsp[0].minor.yy0 = yylhsminor.yy0;
|
1405
|
+
break;
|
1406
|
+
case 85: /* table_header ::= header_rows LINE_TABLE_SEPARATOR */
|
1407
|
+
{ yylhsminor.yy0 = token_new_parent(yymsp[-1].minor.yy0, BLOCK_TABLE_HEADER); token_chain_append(yymsp[-1].minor.yy0, yymsp[0].minor.yy0); }
|
1408
|
+
yymsp[-1].minor.yy0 = yylhsminor.yy0;
|
1409
|
+
break;
|
1410
|
+
case 86: /* table_header ::= LINE_TABLE_SEPARATOR */
|
1411
|
+
{ yylhsminor.yy0 = token_new_parent(yymsp[0].minor.yy0, BLOCK_TABLE_HEADER); }
|
1412
|
+
yymsp[0].minor.yy0 = yylhsminor.yy0;
|
1413
|
+
break;
|
1414
|
+
case 89: /* table_section ::= all_rows LINE_EMPTY */
|
1415
|
+
{ yylhsminor.yy0 = token_new_parent(yymsp[-1].minor.yy0, BLOCK_TABLE_SECTION); token_chain_append(yymsp[-1].minor.yy0, yymsp[0].minor.yy0); }
|
1416
|
+
yymsp[-1].minor.yy0 = yylhsminor.yy0;
|
1417
|
+
break;
|
1418
|
+
case 90: /* table_section ::= all_rows */
|
1419
|
+
{ yylhsminor.yy0 = token_new_parent(yymsp[0].minor.yy0, BLOCK_TABLE_SECTION); }
|
1420
|
+
yymsp[0].minor.yy0 = yylhsminor.yy0;
|
1421
|
+
break;
|
1422
|
+
case 92: /* para ::= all_rows */
|
1423
|
+
{ yylhsminor.yy0 = yymsp[0].minor.yy0; }
|
1424
|
+
yymsp[0].minor.yy0 = yylhsminor.yy0;
|
1425
|
+
break;
|
1426
|
+
default:
|
1427
|
+
/* (93) chunk ::= chunk_line (OPTIMIZED OUT) */ assert(yyruleno!=93);
|
1428
|
+
/* (94) chunk_line ::= LINE_CONTINUATION */ yytestcase(yyruleno==94);
|
1429
|
+
/* (95) chunk_line ::= LINE_STOP_COMMENT */ yytestcase(yyruleno==95);
|
1430
|
+
/* (96) nested_chunks ::= nested_chunk (OPTIMIZED OUT) */ assert(yyruleno!=96);
|
1431
|
+
/* (97) nested_chunk ::= empty */ yytestcase(yyruleno==97);
|
1432
|
+
/* (98) indented_line ::= LINE_INDENTED_TAB */ yytestcase(yyruleno==98);
|
1433
|
+
/* (99) indented_line ::= LINE_INDENTED_SPACE */ yytestcase(yyruleno==99);
|
1434
|
+
/* (100) opt_ext_chunk ::= chunk */ yytestcase(yyruleno==100);
|
1435
|
+
/* (101) tail ::= opt_ext_chunk (OPTIMIZED OUT) */ assert(yyruleno!=101);
|
1436
|
+
/* (102) tail ::= nested_chunks */ yytestcase(yyruleno==102);
|
1437
|
+
/* (103) blockquote ::= LINE_BLOCKQUOTE */ yytestcase(yyruleno==103);
|
1438
|
+
/* (104) quote_line ::= LINE_BLOCKQUOTE */ yytestcase(yyruleno==104);
|
1439
|
+
/* (105) quote_line ::= LINE_CONTINUATION */ yytestcase(yyruleno==105);
|
1440
|
+
/* (106) def_citation ::= LINE_DEF_CITATION */ yytestcase(yyruleno==106);
|
1441
|
+
/* (107) def_footnote ::= LINE_DEF_FOOTNOTE */ yytestcase(yyruleno==107);
|
1442
|
+
/* (108) def_glossary ::= LINE_DEF_GLOSSARY */ yytestcase(yyruleno==108);
|
1443
|
+
/* (109) def_link ::= LINE_DEF_LINK */ yytestcase(yyruleno==109);
|
1444
|
+
/* (110) def_abbreviation ::= LINE_DEF_ABBREVIATION */ yytestcase(yyruleno==110);
|
1445
|
+
/* (111) defs ::= def (OPTIMIZED OUT) */ assert(yyruleno!=111);
|
1446
|
+
/* (112) empty ::= LINE_EMPTY */ yytestcase(yyruleno==112);
|
1447
|
+
/* (113) fenced_block ::= fenced_3 */ yytestcase(yyruleno==113);
|
1448
|
+
/* (114) fenced_3 ::= LINE_FENCE_BACKTICK_3 */ yytestcase(yyruleno==114);
|
1449
|
+
/* (115) fenced_3 ::= LINE_FENCE_BACKTICK_START_3 */ yytestcase(yyruleno==115);
|
1450
|
+
/* (116) fenced_block ::= fenced_4 */ yytestcase(yyruleno==116);
|
1451
|
+
/* (117) fenced_4 ::= LINE_FENCE_BACKTICK_4 */ yytestcase(yyruleno==117);
|
1452
|
+
/* (118) fenced_4 ::= LINE_FENCE_BACKTICK_START_4 */ yytestcase(yyruleno==118);
|
1453
|
+
/* (119) fenced_block ::= fenced_5 */ yytestcase(yyruleno==119);
|
1454
|
+
/* (120) fenced_5 ::= LINE_FENCE_BACKTICK_5 */ yytestcase(yyruleno==120);
|
1455
|
+
/* (121) fenced_5 ::= LINE_FENCE_BACKTICK_START_5 */ yytestcase(yyruleno==121);
|
1456
|
+
/* (122) fenced_line ::= LINE_CONTINUATION */ yytestcase(yyruleno==122);
|
1457
|
+
/* (123) fenced_line ::= LINE_EMPTY */ yytestcase(yyruleno==123);
|
1458
|
+
/* (124) fenced_line ::= LINE_FALLBACK */ yytestcase(yyruleno==124);
|
1459
|
+
/* (125) fenced_line ::= LINE_HR */ yytestcase(yyruleno==125);
|
1460
|
+
/* (126) fenced_line ::= LINE_HTML */ yytestcase(yyruleno==126);
|
1461
|
+
/* (127) fenced_line ::= LINE_START_COMMENT */ yytestcase(yyruleno==127);
|
1462
|
+
/* (128) fenced_line ::= LINE_STOP_COMMENT */ yytestcase(yyruleno==128);
|
1463
|
+
/* (129) html_block ::= LINE_HTML */ yytestcase(yyruleno==129);
|
1464
|
+
/* (130) html_line ::= LINE_CONTINUATION */ yytestcase(yyruleno==130);
|
1465
|
+
/* (131) html_line ::= LINE_FALLBACK */ yytestcase(yyruleno==131);
|
1466
|
+
/* (132) html_line ::= LINE_HR */ yytestcase(yyruleno==132);
|
1467
|
+
/* (133) html_line ::= LINE_HTML */ yytestcase(yyruleno==133);
|
1468
|
+
/* (134) html_com_block ::= html_comment */ yytestcase(yyruleno==134);
|
1469
|
+
/* (135) html_comment ::= LINE_START_COMMENT */ yytestcase(yyruleno==135);
|
1470
|
+
/* (136) comment_line ::= LINE_CONTINUATION */ yytestcase(yyruleno==136);
|
1471
|
+
/* (137) comment_line ::= LINE_EMPTY */ yytestcase(yyruleno==137);
|
1472
|
+
/* (138) comment_line ::= LINE_FALLBACK */ yytestcase(yyruleno==138);
|
1473
|
+
/* (139) comment_line ::= LINE_HR */ yytestcase(yyruleno==139);
|
1474
|
+
/* (140) comment_line ::= LINE_HTML */ yytestcase(yyruleno==140);
|
1475
|
+
/* (141) indented_code ::= indented_line (OPTIMIZED OUT) */ assert(yyruleno!=141);
|
1476
|
+
/* (142) list_bullet ::= item_bullet (OPTIMIZED OUT) */ assert(yyruleno!=142);
|
1477
|
+
/* (143) list_enum ::= item_enum (OPTIMIZED OUT) */ assert(yyruleno!=143);
|
1478
|
+
/* (144) meta_block ::= LINE_META */ yytestcase(yyruleno==144);
|
1479
|
+
/* (145) meta_line ::= LINE_META */ yytestcase(yyruleno==145);
|
1480
|
+
/* (146) meta_line ::= LINE_CONTINUATION */ yytestcase(yyruleno==146);
|
1481
|
+
/* (147) para ::= LINE_PLAIN */ yytestcase(yyruleno==147);
|
1482
|
+
/* (148) para ::= LINE_STOP_COMMENT */ yytestcase(yyruleno==148);
|
1483
|
+
/* (149) table ::= table_header */ yytestcase(yyruleno==149);
|
1484
|
+
/* (150) header_rows ::= LINE_TABLE */ yytestcase(yyruleno==150);
|
1485
|
+
/* (151) table_body ::= table_section (OPTIMIZED OUT) */ assert(yyruleno!=151);
|
1486
|
+
/* (152) all_rows ::= row (OPTIMIZED OUT) */ assert(yyruleno!=152);
|
1487
|
+
/* (153) row ::= header_rows */ yytestcase(yyruleno==153);
|
1488
|
+
/* (154) row ::= LINE_TABLE_SEPARATOR */ yytestcase(yyruleno==154);
|
1489
|
+
/* (155) para ::= defs */ yytestcase(yyruleno==155);
|
1490
|
+
break;
|
1491
|
+
/********** End reduce actions ************************************************/
|
1492
|
+
};
|
1493
|
+
assert( yyruleno<sizeof(yyRuleInfo)/sizeof(yyRuleInfo[0]) );
|
1494
|
+
yygoto = yyRuleInfo[yyruleno].lhs;
|
1495
|
+
yysize = yyRuleInfo[yyruleno].nrhs;
|
1496
|
+
yyact = yy_find_reduce_action(yymsp[-yysize].stateno,(YYCODETYPE)yygoto);
|
1497
|
+
if( yyact <= YY_MAX_SHIFTREDUCE ){
|
1498
|
+
if( yyact>YY_MAX_SHIFT ){
|
1499
|
+
yyact += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE;
|
1500
|
+
}
|
1501
|
+
yymsp -= yysize-1;
|
1502
|
+
yypParser->yytos = yymsp;
|
1503
|
+
yymsp->stateno = (YYACTIONTYPE)yyact;
|
1504
|
+
yymsp->major = (YYCODETYPE)yygoto;
|
1505
|
+
yyTraceShift(yypParser, yyact);
|
1506
|
+
}else{
|
1507
|
+
assert( yyact == YY_ACCEPT_ACTION );
|
1508
|
+
yypParser->yytos -= yysize;
|
1509
|
+
yy_accept(yypParser);
|
1510
|
+
}
|
1511
|
+
}
|
1512
|
+
|
1513
|
+
/*
|
1514
|
+
** The following code executes when the parse fails
|
1515
|
+
*/
|
1516
|
+
#ifndef YYNOERRORRECOVERY
|
1517
|
+
static void yy_parse_failed(
|
1518
|
+
yyParser *yypParser /* The parser */
|
1519
|
+
){
|
1520
|
+
ParseARG_FETCH;
|
1521
|
+
#ifndef NDEBUG
|
1522
|
+
if( yyTraceFILE ){
|
1523
|
+
fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt);
|
1524
|
+
}
|
1525
|
+
#endif
|
1526
|
+
while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
|
1527
|
+
/* Here code is inserted which will be executed whenever the
|
1528
|
+
** parser fails */
|
1529
|
+
/************ Begin %parse_failure code ***************************************/
|
1530
|
+
|
1531
|
+
fprintf(stderr, "Parser failed to successfully parse.\n");
|
1532
|
+
/************ End %parse_failure code *****************************************/
|
1533
|
+
ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */
|
1534
|
+
}
|
1535
|
+
#endif /* YYNOERRORRECOVERY */
|
1536
|
+
|
1537
|
+
/*
|
1538
|
+
** The following code executes when a syntax error first occurs.
|
1539
|
+
*/
|
1540
|
+
static void yy_syntax_error(
|
1541
|
+
yyParser *yypParser, /* The parser */
|
1542
|
+
int yymajor, /* The major type of the error token */
|
1543
|
+
ParseTOKENTYPE yyminor /* The minor type of the error token */
|
1544
|
+
){
|
1545
|
+
ParseARG_FETCH;
|
1546
|
+
#define TOKEN yyminor
|
1547
|
+
/************ Begin %syntax_error code ****************************************/
|
1548
|
+
|
1549
|
+
#ifndef NDEBUG
|
1550
|
+
fprintf(stderr,"Parser syntax error.\n");
|
1551
|
+
int n = sizeof(yyTokenName) / sizeof(yyTokenName[0]);
|
1552
|
+
for (int i = 0; i < n; ++i) {
|
1553
|
+
int a = yy_find_shift_action(yypParser, (YYCODETYPE)i);
|
1554
|
+
if (a < YYNSTATE + YYNRULE) {
|
1555
|
+
fprintf(stderr,"expected token: %s\n", yyTokenName[i]);
|
1556
|
+
}
|
1557
|
+
}
|
1558
|
+
#endif
|
1559
|
+
/************ End %syntax_error code ******************************************/
|
1560
|
+
ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */
|
1561
|
+
}
|
1562
|
+
|
1563
|
+
/*
|
1564
|
+
** The following is executed when the parser accepts
|
1565
|
+
*/
|
1566
|
+
static void yy_accept(
|
1567
|
+
yyParser *yypParser /* The parser */
|
1568
|
+
){
|
1569
|
+
ParseARG_FETCH;
|
1570
|
+
#ifndef NDEBUG
|
1571
|
+
if( yyTraceFILE ){
|
1572
|
+
fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt);
|
1573
|
+
}
|
1574
|
+
#endif
|
1575
|
+
#ifndef YYNOERRORRECOVERY
|
1576
|
+
yypParser->yyerrcnt = -1;
|
1577
|
+
#endif
|
1578
|
+
assert( yypParser->yytos==yypParser->yystack );
|
1579
|
+
/* Here code is inserted which will be executed whenever the
|
1580
|
+
** parser accepts */
|
1581
|
+
/*********** Begin %parse_accept code *****************************************/
|
1582
|
+
/*********** End %parse_accept code *******************************************/
|
1583
|
+
ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */
|
1584
|
+
}
|
1585
|
+
|
1586
|
+
/* The main parser program.
|
1587
|
+
** The first argument is a pointer to a structure obtained from
|
1588
|
+
** "ParseAlloc" which describes the current state of the parser.
|
1589
|
+
** The second argument is the major token number. The third is
|
1590
|
+
** the minor token. The fourth optional argument is whatever the
|
1591
|
+
** user wants (and specified in the grammar) and is available for
|
1592
|
+
** use by the action routines.
|
1593
|
+
**
|
1594
|
+
** Inputs:
|
1595
|
+
** <ul>
|
1596
|
+
** <li> A pointer to the parser (an opaque structure.)
|
1597
|
+
** <li> The major token number.
|
1598
|
+
** <li> The minor token number.
|
1599
|
+
** <li> An option argument of a grammar-specified type.
|
1600
|
+
** </ul>
|
1601
|
+
**
|
1602
|
+
** Outputs:
|
1603
|
+
** None.
|
1604
|
+
*/
|
1605
|
+
void Parse(
|
1606
|
+
void *yyp, /* The parser */
|
1607
|
+
int yymajor, /* The major token code number */
|
1608
|
+
ParseTOKENTYPE yyminor /* The value for the token */
|
1609
|
+
ParseARG_PDECL /* Optional %extra_argument parameter */
|
1610
|
+
){
|
1611
|
+
YYMINORTYPE yyminorunion;
|
1612
|
+
unsigned int yyact; /* The parser action. */
|
1613
|
+
#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY)
|
1614
|
+
int yyendofinput; /* True if we are at the end of input */
|
1615
|
+
#endif
|
1616
|
+
#ifdef YYERRORSYMBOL
|
1617
|
+
int yyerrorhit = 0; /* True if yymajor has invoked an error */
|
1618
|
+
#endif
|
1619
|
+
yyParser *yypParser; /* The parser */
|
1620
|
+
|
1621
|
+
yypParser = (yyParser*)yyp;
|
1622
|
+
assert( yypParser->yytos!=0 );
|
1623
|
+
#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY)
|
1624
|
+
yyendofinput = (yymajor==0);
|
1625
|
+
#endif
|
1626
|
+
ParseARG_STORE;
|
1627
|
+
|
1628
|
+
#ifndef NDEBUG
|
1629
|
+
if( yyTraceFILE ){
|
1630
|
+
fprintf(yyTraceFILE,"%sInput '%s'\n",yyTracePrompt,yyTokenName[yymajor]);
|
1631
|
+
}
|
1632
|
+
#endif
|
1633
|
+
|
1634
|
+
do{
|
1635
|
+
yyact = yy_find_shift_action(yypParser,(YYCODETYPE)yymajor);
|
1636
|
+
if( yyact <= YY_MAX_SHIFTREDUCE ){
|
1637
|
+
yy_shift(yypParser,yyact,yymajor,yyminor);
|
1638
|
+
#ifndef YYNOERRORRECOVERY
|
1639
|
+
yypParser->yyerrcnt--;
|
1640
|
+
#endif
|
1641
|
+
yymajor = YYNOCODE;
|
1642
|
+
}else if( yyact <= YY_MAX_REDUCE ){
|
1643
|
+
yy_reduce(yypParser,yyact-YY_MIN_REDUCE);
|
1644
|
+
}else{
|
1645
|
+
assert( yyact == YY_ERROR_ACTION );
|
1646
|
+
yyminorunion.yy0 = yyminor;
|
1647
|
+
#ifdef YYERRORSYMBOL
|
1648
|
+
int yymx;
|
1649
|
+
#endif
|
1650
|
+
#ifndef NDEBUG
|
1651
|
+
if( yyTraceFILE ){
|
1652
|
+
fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt);
|
1653
|
+
}
|
1654
|
+
#endif
|
1655
|
+
#ifdef YYERRORSYMBOL
|
1656
|
+
/* A syntax error has occurred.
|
1657
|
+
** The response to an error depends upon whether or not the
|
1658
|
+
** grammar defines an error token "ERROR".
|
1659
|
+
**
|
1660
|
+
** This is what we do if the grammar does define ERROR:
|
1661
|
+
**
|
1662
|
+
** * Call the %syntax_error function.
|
1663
|
+
**
|
1664
|
+
** * Begin popping the stack until we enter a state where
|
1665
|
+
** it is legal to shift the error symbol, then shift
|
1666
|
+
** the error symbol.
|
1667
|
+
**
|
1668
|
+
** * Set the error count to three.
|
1669
|
+
**
|
1670
|
+
** * Begin accepting and shifting new tokens. No new error
|
1671
|
+
** processing will occur until three tokens have been
|
1672
|
+
** shifted successfully.
|
1673
|
+
**
|
1674
|
+
*/
|
1675
|
+
if( yypParser->yyerrcnt<0 ){
|
1676
|
+
yy_syntax_error(yypParser,yymajor,yyminor);
|
1677
|
+
}
|
1678
|
+
yymx = yypParser->yytos->major;
|
1679
|
+
if( yymx==YYERRORSYMBOL || yyerrorhit ){
|
1680
|
+
#ifndef NDEBUG
|
1681
|
+
if( yyTraceFILE ){
|
1682
|
+
fprintf(yyTraceFILE,"%sDiscard input token %s\n",
|
1683
|
+
yyTracePrompt,yyTokenName[yymajor]);
|
1684
|
+
}
|
1685
|
+
#endif
|
1686
|
+
yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion);
|
1687
|
+
yymajor = YYNOCODE;
|
1688
|
+
}else{
|
1689
|
+
while( yypParser->yytos >= yypParser->yystack
|
1690
|
+
&& yymx != YYERRORSYMBOL
|
1691
|
+
&& (yyact = yy_find_reduce_action(
|
1692
|
+
yypParser->yytos->stateno,
|
1693
|
+
YYERRORSYMBOL)) >= YY_MIN_REDUCE
|
1694
|
+
){
|
1695
|
+
yy_pop_parser_stack(yypParser);
|
1696
|
+
}
|
1697
|
+
if( yypParser->yytos < yypParser->yystack || yymajor==0 ){
|
1698
|
+
yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
|
1699
|
+
yy_parse_failed(yypParser);
|
1700
|
+
#ifndef YYNOERRORRECOVERY
|
1701
|
+
yypParser->yyerrcnt = -1;
|
1702
|
+
#endif
|
1703
|
+
yymajor = YYNOCODE;
|
1704
|
+
}else if( yymx!=YYERRORSYMBOL ){
|
1705
|
+
yy_shift(yypParser,yyact,YYERRORSYMBOL,yyminor);
|
1706
|
+
}
|
1707
|
+
}
|
1708
|
+
yypParser->yyerrcnt = 3;
|
1709
|
+
yyerrorhit = 1;
|
1710
|
+
#elif defined(YYNOERRORRECOVERY)
|
1711
|
+
/* If the YYNOERRORRECOVERY macro is defined, then do not attempt to
|
1712
|
+
** do any kind of error recovery. Instead, simply invoke the syntax
|
1713
|
+
** error routine and continue going as if nothing had happened.
|
1714
|
+
**
|
1715
|
+
** Applications can set this macro (for example inside %include) if
|
1716
|
+
** they intend to abandon the parse upon the first syntax error seen.
|
1717
|
+
*/
|
1718
|
+
yy_syntax_error(yypParser,yymajor, yyminor);
|
1719
|
+
yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
|
1720
|
+
yymajor = YYNOCODE;
|
1721
|
+
|
1722
|
+
#else /* YYERRORSYMBOL is not defined */
|
1723
|
+
/* This is what we do if the grammar does not define ERROR:
|
1724
|
+
**
|
1725
|
+
** * Report an error message, and throw away the input token.
|
1726
|
+
**
|
1727
|
+
** * If the input token is $, then fail the parse.
|
1728
|
+
**
|
1729
|
+
** As before, subsequent error messages are suppressed until
|
1730
|
+
** three input tokens have been successfully shifted.
|
1731
|
+
*/
|
1732
|
+
if( yypParser->yyerrcnt<=0 ){
|
1733
|
+
yy_syntax_error(yypParser,yymajor, yyminor);
|
1734
|
+
}
|
1735
|
+
yypParser->yyerrcnt = 3;
|
1736
|
+
yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
|
1737
|
+
if( yyendofinput ){
|
1738
|
+
yy_parse_failed(yypParser);
|
1739
|
+
#ifndef YYNOERRORRECOVERY
|
1740
|
+
yypParser->yyerrcnt = -1;
|
1741
|
+
#endif
|
1742
|
+
}
|
1743
|
+
yymajor = YYNOCODE;
|
1744
|
+
#endif
|
1745
|
+
}
|
1746
|
+
}while( yymajor!=YYNOCODE && yypParser->yytos>yypParser->yystack );
|
1747
|
+
#ifndef NDEBUG
|
1748
|
+
if( yyTraceFILE ){
|
1749
|
+
yyStackEntry *i;
|
1750
|
+
char cDiv = '[';
|
1751
|
+
fprintf(yyTraceFILE,"%sReturn. Stack=",yyTracePrompt);
|
1752
|
+
for(i=&yypParser->yystack[1]; i<=yypParser->yytos; i++){
|
1753
|
+
fprintf(yyTraceFILE,"%c%s", cDiv, yyTokenName[i->major]);
|
1754
|
+
cDiv = ' ';
|
1755
|
+
}
|
1756
|
+
fprintf(yyTraceFILE,"]\n");
|
1757
|
+
}
|
1758
|
+
#endif
|
1759
|
+
return;
|
1760
|
+
}
|