Graphviz
13.1.3~dev.20250831.0023
Loading...
Searching...
No Matches
htmlparse.h
Go to the documentation of this file.
1
/* A Bison parser, made by GNU Bison 3.8.2. */
2
3
/* Bison interface for Yacc-like parsers in C
4
5
Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
6
Inc.
7
8
This program is free software: you can redistribute it and/or modify
9
it under the terms of the GNU General Public License as published by
10
the Free Software Foundation, either version 3 of the License, or
11
(at your option) any later version.
12
13
This program is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
GNU General Public License for more details.
17
18
You should have received a copy of the GNU General Public License
19
along with this program. If not, see <https://www.gnu.org/licenses/>. */
20
21
/* As a special exception, you may create a larger work that contains
22
part or all of the Bison parser skeleton and distribute that work
23
under terms of your choice, so long as that work isn't itself a
24
parser generator using the skeleton or a modified version thereof
25
as a parser skeleton. Alternatively, if you modify or redistribute
26
the parser skeleton itself, you may (at your option) remove this
27
special exception, which will cause the skeleton and the resulting
28
Bison output files to be licensed under the GNU General Public
29
License without this special exception.
30
31
This special exception was added by the Free Software Foundation in
32
version 2.2 of Bison. */
33
34
/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
35
especially those whose name start with YY_ or yy_. They are
36
private implementation details that can be changed or removed. */
37
38
#ifndef YY_HTML_HTMLPARSE_H_INCLUDED
39
# define YY_HTML_HTMLPARSE_H_INCLUDED
40
/* Debug traces. */
41
#ifndef HTMLDEBUG
42
# if defined YYDEBUG
43
#if YYDEBUG
44
# define HTMLDEBUG 1
45
# else
46
# define HTMLDEBUG 0
47
# endif
48
# else
/* ! defined YYDEBUG */
49
# define HTMLDEBUG 0
50
# endif
/* ! defined YYDEBUG */
51
#endif
/* ! defined HTMLDEBUG */
52
#if HTMLDEBUG
53
extern
int
htmldebug;
54
#endif
55
/* "%code requires" blocks. */
56
#line 26 "../../lib/common/htmlparse.y"
57
58
#include <
common/htmllex.h
>
59
#include <
common/htmltable.h
>
60
#include <
common/textspan.h
>
61
#include <
gvc/gvcext.h
>
62
#include <
util/agxbuf.h
>
63
#include <
util/list.h
>
64
#include <
util/strview.h
>
65
66
#line 67 "htmlparse.h"
67
68
/* Token kinds. */
69
#ifndef HTMLTOKENTYPE
70
# define HTMLTOKENTYPE
71
enum
htmltokentype
72
{
73
HTMLEMPTY
= -2,
74
HTMLEOF
= 0,
/* "end of file" */
75
HTMLerror
= 256,
/* error */
76
HTMLUNDEF
= 257,
/* "invalid token" */
77
T_end_br
= 258,
/* T_end_br */
78
T_end_img
= 259,
/* T_end_img */
79
T_row
= 260,
/* T_row */
80
T_end_row
= 261,
/* T_end_row */
81
T_html
= 262,
/* T_html */
82
T_end_html
= 263,
/* T_end_html */
83
T_end_table
= 264,
/* T_end_table */
84
T_end_cell
= 265,
/* T_end_cell */
85
T_end_font
= 266,
/* T_end_font */
86
T_string
= 267,
/* T_string */
87
T_error
= 268,
/* T_error */
88
T_n_italic
= 269,
/* T_n_italic */
89
T_n_bold
= 270,
/* T_n_bold */
90
T_n_underline
= 271,
/* T_n_underline */
91
T_n_overline
= 272,
/* T_n_overline */
92
T_n_sup
= 273,
/* T_n_sup */
93
T_n_sub
= 274,
/* T_n_sub */
94
T_n_s
= 275,
/* T_n_s */
95
T_HR
= 276,
/* T_HR */
96
T_hr
= 277,
/* T_hr */
97
T_end_hr
= 278,
/* T_end_hr */
98
T_VR
= 279,
/* T_VR */
99
T_vr
= 280,
/* T_vr */
100
T_end_vr
= 281,
/* T_end_vr */
101
T_BR
= 282,
/* T_BR */
102
T_br
= 283,
/* T_br */
103
T_IMG
= 284,
/* T_IMG */
104
T_img
= 285,
/* T_img */
105
T_table
= 286,
/* T_table */
106
T_cell
= 287,
/* T_cell */
107
T_font
= 288,
/* T_font */
108
T_italic
= 289,
/* T_italic */
109
T_bold
= 290,
/* T_bold */
110
T_underline
= 291,
/* T_underline */
111
T_overline
= 292,
/* T_overline */
112
T_sup
= 293,
/* T_sup */
113
T_sub
= 294,
/* T_sub */
114
T_s
= 295
/* T_s */
115
};
116
typedef
enum
htmltokentype
htmltoken_kind_t
;
117
#endif
118
/* Token kinds. */
119
#define HTMLEMPTY -2
120
#define HTMLEOF 0
121
#define HTMLerror 256
122
#define HTMLUNDEF 257
123
#define T_end_br 258
124
#define T_end_img 259
125
#define T_row 260
126
#define T_end_row 261
127
#define T_html 262
128
#define T_end_html 263
129
#define T_end_table 264
130
#define T_end_cell 265
131
#define T_end_font 266
132
#define T_string 267
133
#define T_error 268
134
#define T_n_italic 269
135
#define T_n_bold 270
136
#define T_n_underline 271
137
#define T_n_overline 272
138
#define T_n_sup 273
139
#define T_n_sub 274
140
#define T_n_s 275
141
#define T_HR 276
142
#define T_hr 277
143
#define T_end_hr 278
144
#define T_VR 279
145
#define T_vr 280
146
#define T_end_vr 281
147
#define T_BR 282
148
#define T_br 283
149
#define T_IMG 284
150
#define T_img 285
151
#define T_table 286
152
#define T_cell 287
153
#define T_font 288
154
#define T_italic 289
155
#define T_bold 290
156
#define T_underline 291
157
#define T_overline 292
158
#define T_sup 293
159
#define T_sub 294
160
#define T_s 295
161
162
/* Value type. */
163
#if ! defined HTMLSTYPE && ! defined HTMLSTYPE_IS_DECLARED
164
union
HTMLSTYPE
165
{
166
#line 174 "../../lib/common/htmlparse.y"
167
168
int
i
;
169
htmltxt_t
*
txt
;
170
htmlcell_t
*
cell
;
171
htmltbl_t
*
tbl
;
172
textfont_t
*
font
;
173
htmlimg_t
*
img
;
174
row_t
*
p
;
175
176
#line 177 "htmlparse.h"
177
178
};
179
typedef
union
HTMLSTYPE
HTMLSTYPE
;
180
# define HTMLSTYPE_IS_TRIVIAL 1
181
# define HTMLSTYPE_IS_DECLARED 1
182
#endif
183
184
185
186
187
int
htmlparse
(
htmlscan_t
*
scanner
);
188
189
/* "%code provides" blocks. */
190
#line 36 "../../lib/common/htmlparse.y"
191
192
193
static
inline
void
free_ti
(
textspan_t
item
) {
194
free
(
item
.str);
195
}
196
197
static
inline
void
free_hi
(
htextspan_t
item
) {
198
for
(
size_t
i
= 0;
i
<
item
.nitems;
i
++) {
199
free
(
item
.items[
i
].str);
200
}
201
free
(
item
.items);
202
}
203
204
struct
htmlparserstate_s
{
205
htmllabel_t
*
lbl
;
/* Generated label */
206
htmltbl_t
*
tblstack
;
/* Stack of tables maintained during parsing */
207
LIST
(
textspan_t
) fitemList;
208
LIST
(
htextspan_t
) fspanList;
209
agxbuf
*
str
;
/* Buffer for text */
210
LIST
(
textfont_t
*) fontstack;
211
GVC_t
*
gvc
;
212
};
213
214
typedef
struct
{
215
#ifdef HAVE_EXPAT
216
struct
XML_ParserStruct *parser;
217
#endif
218
char
*
ptr
;
// input source
219
int
tok
;
// token type
220
agxbuf
*
xb
;
// buffer to gather T_string data
221
agxbuf
lb
;
// buffer for translating lexical data
222
int
warn
;
// set if warning given
223
int
error
;
// set if error given
224
char
inCell
;
// set if in TD to allow T_string
225
char
mode
;
// for handling artificial <HTML>..</HTML>
226
strview_t
currtok
;
// for error reporting
227
strview_t
prevtok
;
// for error reporting
228
GVC_t
*
gvc
;
// current GraphViz context
229
HTMLSTYPE
*
htmllval
;
// generated by htmlparse.y
230
}
htmllexstate_t
;
231
232
233
struct
htmlscan_s
{
234
htmllexstate_t
lexer
;
235
htmlparserstate_t
parser
;
236
};
237
238
#line 239 "htmlparse.h"
239
240
#endif
/* !YY_HTML_HTMLPARSE_H_INCLUDED */
agxbuf.h
free
void free(void *)
gvcext.h
htmllex.h
T_n_sup
#define T_n_sup
Definition
htmlparse.h:138
T_end_row
#define T_end_row
Definition
htmlparse.h:126
htmlparse
int htmlparse(htmlscan_t *scanner)
T_end_table
#define T_end_table
Definition
htmlparse.h:129
T_br
#define T_br
Definition
htmlparse.h:148
htmltoken_kind_t
enum htmltokentype htmltoken_kind_t
Definition
htmlparse.h:116
T_vr
#define T_vr
Definition
htmlparse.h:145
T_error
#define T_error
Definition
htmlparse.h:133
T_n_s
#define T_n_s
Definition
htmlparse.h:140
htmltokentype
htmltokentype
Definition
htmlparse.h:72
T_end_cell
#define T_end_cell
Definition
htmlparse.h:130
HTMLerror
#define HTMLerror
Definition
htmlparse.h:121
T_n_sub
#define T_n_sub
Definition
htmlparse.h:139
T_n_bold
#define T_n_bold
Definition
htmlparse.h:135
T_html
#define T_html
Definition
htmlparse.h:127
free_ti
static void free_ti(textspan_t item)
Definition
htmlparse.h:193
T_BR
#define T_BR
Definition
htmlparse.h:147
HTMLEMPTY
#define HTMLEMPTY
Definition
htmlparse.h:119
T_underline
#define T_underline
Definition
htmlparse.h:156
T_sup
#define T_sup
Definition
htmlparse.h:158
T_row
#define T_row
Definition
htmlparse.h:125
T_table
#define T_table
Definition
htmlparse.h:151
T_end_vr
#define T_end_vr
Definition
htmlparse.h:146
T_end_html
#define T_end_html
Definition
htmlparse.h:128
T_IMG
#define T_IMG
Definition
htmlparse.h:149
T_VR
#define T_VR
Definition
htmlparse.h:144
T_bold
#define T_bold
Definition
htmlparse.h:155
T_end_img
#define T_end_img
Definition
htmlparse.h:124
free_hi
static void free_hi(htextspan_t item)
Definition
htmlparse.h:197
T_sub
#define T_sub
Definition
htmlparse.h:159
T_s
#define T_s
Definition
htmlparse.h:160
T_n_italic
#define T_n_italic
Definition
htmlparse.h:134
HTMLUNDEF
#define HTMLUNDEF
Definition
htmlparse.h:122
T_end_font
#define T_end_font
Definition
htmlparse.h:131
T_overline
#define T_overline
Definition
htmlparse.h:157
T_hr
#define T_hr
Definition
htmlparse.h:142
HTMLEOF
#define HTMLEOF
Definition
htmlparse.h:120
T_font
#define T_font
Definition
htmlparse.h:153
T_italic
#define T_italic
Definition
htmlparse.h:154
T_end_br
#define T_end_br
Definition
htmlparse.h:123
T_n_underline
#define T_n_underline
Definition
htmlparse.h:136
T_cell
#define T_cell
Definition
htmlparse.h:152
T_end_hr
#define T_end_hr
Definition
htmlparse.h:143
T_string
#define T_string
Definition
htmlparse.h:132
T_img
#define T_img
Definition
htmlparse.h:150
T_HR
#define T_HR
Definition
htmlparse.h:141
T_n_overline
#define T_n_overline
Definition
htmlparse.h:137
scanner
cleanup & scanner
Definition
htmlparse.y:289
htmltable.h
list.h
type-generic dynamically expanding list
GVC_s
Definition
gvcint.h:81
agxbuf
Definition
agxbuf.h:54
htextspan_t
Definition
htmltable.h:52
htmlcell_t
Definition
htmltable.h:155
htmlimg_t
Definition
htmltable.h:67
htmllabel_t
Definition
htmltable.h:146
htmllexstate_t
Definition
htmlparse.h:214
htmllexstate_t::lb
agxbuf lb
Definition
htmlparse.h:221
htmllexstate_t::htmllval
HTMLSTYPE * htmllval
Definition
htmlparse.h:229
htmllexstate_t::inCell
char inCell
Definition
htmlparse.h:224
htmllexstate_t::tok
int tok
Definition
htmlparse.h:219
htmllexstate_t::ptr
char * ptr
Definition
htmlparse.h:218
htmllexstate_t::gvc
GVC_t * gvc
Definition
htmlparse.h:228
htmllexstate_t::mode
char mode
Definition
htmlparse.h:225
htmllexstate_t::xb
agxbuf * xb
Definition
htmlparse.h:220
htmllexstate_t::prevtok
strview_t prevtok
Definition
htmlparse.h:227
htmllexstate_t::error
int error
Definition
htmlparse.h:223
htmllexstate_t::warn
int warn
Definition
htmlparse.h:222
htmllexstate_t::currtok
strview_t currtok
Definition
htmlparse.h:226
htmlparserstate_s
Definition
htmlparse.h:204
htmlparserstate_s::LIST
LIST(textspan_t) fitemList
htmlparserstate_s::LIST
LIST(textfont_t *) fontstack
htmlparserstate_s::LIST
LIST(htextspan_t) fspanList
htmlparserstate_s::gvc
GVC_t * gvc
Definition
htmlparse.h:211
htmlparserstate_s::lbl
htmllabel_t * lbl
Definition
htmlparse.h:205
htmlparserstate_s::tblstack
htmltbl_t * tblstack
Definition
htmlparse.h:206
htmlparserstate_s::str
agxbuf * str
Definition
htmlparse.h:209
htmlscan_s
Definition
htmlparse.h:233
htmlscan_s::parser
htmlparserstate_t parser
Definition
htmlparse.h:235
htmlscan_s::lexer
htmllexstate_t lexer
Definition
htmlparse.h:234
htmltbl_t
Definition
htmltable.h:124
htmltxt_t
Definition
htmltable.h:60
item
Definition
utils.c:751
row_t
Definition
htmltable.h:111
strview_t
a non-owning string reference
Definition
strview.h:20
textfont_t
Definition
textspan.h:53
textspan_t
Definition
textspan.h:64
strview.h
Non-owning string references.
textspan.h
textspan_t, textfont_t, PostscriptAlias
HTMLSTYPE
Definition
htmlparse.h:165
HTMLSTYPE::tbl
htmltbl_t * tbl
Definition
htmlparse.h:171
HTMLSTYPE::txt
htmltxt_t * txt
Definition
htmlparse.h:169
HTMLSTYPE::i
int i
Definition
htmlparse.h:168
HTMLSTYPE::cell
htmlcell_t * cell
Definition
htmlparse.h:170
HTMLSTYPE::p
row_t * p
Definition
htmlparse.h:174
HTMLSTYPE::font
textfont_t * font
Definition
htmlparse.h:172
HTMLSTYPE::img
htmlimg_t * img
Definition
htmlparse.h:173
lib
common
htmlparse.h
Generated by
1.9.8