Graphviz
13.0.0~dev.20241220.2304
Loading...
Searching...
No Matches
htmlparse.h
Go to the documentation of this file.
1
/* A Bison parser, made by GNU Bison 3.5.1. */
2
3
/* Bison interface for Yacc-like parsers in C
4
5
Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 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 <http://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
/* Undocumented macros, especially those whose name start with YY_,
35
are private implementation details. Do not rely on them. */
36
37
#ifndef YY_HTML_HTMLPARSE_H_INCLUDED
38
# define YY_HTML_HTMLPARSE_H_INCLUDED
39
/* Debug traces. */
40
#ifndef HTMLDEBUG
41
# if defined YYDEBUG
42
#if YYDEBUG
43
# define HTMLDEBUG 1
44
# else
45
# define HTMLDEBUG 0
46
# endif
47
# else
/* ! defined YYDEBUG */
48
# define HTMLDEBUG 0
49
# endif
/* ! defined YYDEBUG */
50
#endif
/* ! defined HTMLDEBUG */
51
#if HTMLDEBUG
52
extern
int
htmldebug;
53
#endif
54
/* "%code requires" blocks. */
55
#line 26 "../../lib/common/htmlparse.y"
56
57
#include <
cgraph/list.h
>
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/strview.h
>
64
65
#line 66 "htmlparse.h"
66
67
/* Token type. */
68
#ifndef HTMLTOKENTYPE
69
# define HTMLTOKENTYPE
70
enum
htmltokentype
71
{
72
T_end_br
= 258,
73
T_end_img
= 259,
74
T_row
= 260,
75
T_end_row
= 261,
76
T_html
= 262,
77
T_end_html
= 263,
78
T_end_table
= 264,
79
T_end_cell
= 265,
80
T_end_font
= 266,
81
T_string
= 267,
82
T_error
= 268,
83
T_n_italic
= 269,
84
T_n_bold
= 270,
85
T_n_underline
= 271,
86
T_n_overline
= 272,
87
T_n_sup
= 273,
88
T_n_sub
= 274,
89
T_n_s
= 275,
90
T_HR
= 276,
91
T_hr
= 277,
92
T_end_hr
= 278,
93
T_VR
= 279,
94
T_vr
= 280,
95
T_end_vr
= 281,
96
T_BR
= 282,
97
T_br
= 283,
98
T_IMG
= 284,
99
T_img
= 285,
100
T_table
= 286,
101
T_cell
= 287,
102
T_font
= 288,
103
T_italic
= 289,
104
T_bold
= 290,
105
T_underline
= 291,
106
T_overline
= 292,
107
T_sup
= 293,
108
T_sub
= 294,
109
T_s
= 295
110
};
111
#endif
112
/* Tokens. */
113
#define T_end_br 258
114
#define T_end_img 259
115
#define T_row 260
116
#define T_end_row 261
117
#define T_html 262
118
#define T_end_html 263
119
#define T_end_table 264
120
#define T_end_cell 265
121
#define T_end_font 266
122
#define T_string 267
123
#define T_error 268
124
#define T_n_italic 269
125
#define T_n_bold 270
126
#define T_n_underline 271
127
#define T_n_overline 272
128
#define T_n_sup 273
129
#define T_n_sub 274
130
#define T_n_s 275
131
#define T_HR 276
132
#define T_hr 277
133
#define T_end_hr 278
134
#define T_VR 279
135
#define T_vr 280
136
#define T_end_vr 281
137
#define T_BR 282
138
#define T_br 283
139
#define T_IMG 284
140
#define T_img 285
141
#define T_table 286
142
#define T_cell 287
143
#define T_font 288
144
#define T_italic 289
145
#define T_bold 290
146
#define T_underline 291
147
#define T_overline 292
148
#define T_sup 293
149
#define T_sub 294
150
#define T_s 295
151
152
/* Value type. */
153
#if ! defined HTMLSTYPE && ! defined HTMLSTYPE_IS_DECLARED
154
union
HTMLSTYPE
155
{
156
#line 180 "../../lib/common/htmlparse.y"
157
158
int
i
;
159
htmltxt_t
*
txt
;
160
htmlcell_t
*
cell
;
161
htmltbl_t
*
tbl
;
162
textfont_t
*
font
;
163
htmlimg_t
*
img
;
164
row_t
*
p
;
165
166
#line 167 "htmlparse.h"
167
168
};
169
typedef
union
HTMLSTYPE
HTMLSTYPE
;
170
# define HTMLSTYPE_IS_TRIVIAL 1
171
# define HTMLSTYPE_IS_DECLARED 1
172
#endif
173
174
175
176
int
htmlparse
(
htmlscan_t
*
scanner
);
177
/* "%code provides" blocks. */
178
#line 36 "../../lib/common/htmlparse.y"
179
180
181
DEFINE_LIST
(sfont,
textfont_t
*)
182
183
static inline
void
free_ti
(
textspan_t
item
) {
184
free
(
item
.str);
185
}
186
187
DEFINE_LIST_WITH_DTOR
(textspans,
textspan_t
,
free_ti
)
188
189
static inline
void
free_hi
(
htextspan_t
item
) {
190
for
(
size_t
i
= 0;
i
<
item
.nitems;
i
++) {
191
free
(
item
.items[
i
].str);
192
}
193
free
(
item
.items);
194
}
195
196
DEFINE_LIST_WITH_DTOR
(htextspans,
htextspan_t
,
free_hi
)
197
198
struct
htmlparserstate_s
{
199
htmllabel_t
*
lbl
;
/* Generated label */
200
htmltbl_t
*
tblstack
;
/* Stack of tables maintained during parsing */
201
textspans_t
fitemList
;
202
htextspans_t
fspanList
;
203
agxbuf
*
str
;
/* Buffer for text */
204
sfont_t
fontstack
;
205
GVC_t
*
gvc
;
206
};
207
208
typedef
struct
{
209
#ifdef HAVE_EXPAT
210
struct
XML_ParserStruct *parser;
211
#endif
212
char
* ptr;
// input source
213
int
tok
;
// token type
214
agxbuf
* xb;
// buffer to gather T_string data
215
agxbuf
lb;
// buffer for translating lexical data
216
int
warn;
// set if warning given
217
int
error
;
// set if error given
218
char
inCell;
// set if in TD to allow T_string
219
char
mode
;
// for handling artificial <HTML>..</HTML>
220
strview_t
currtok;
// for error reporting
221
strview_t
prevtok;
// for error reporting
222
GVC_t
*
gvc
;
// current GraphViz context
223
HTMLSTYPE
*htmllval;
// generated by htmlparse.y
224
}
htmllexstate_t
;
225
226
227
struct
htmlscan_s
{
228
htmllexstate_t
lexer
;
229
htmlparserstate_t
parser
;
230
};
231
232
#line 233 "htmlparse.h"
233
234
#endif
/* !YY_HTML_HTMLPARSE_H_INCLUDED */
agxbuf.h
mode
mode
Definition
cvtgxl.c:33
free
void free(void *)
gvc
static GVC_t * gvc
Definition
gv.cpp:23
gvcext.h
htmllex.h
htmltokentype
htmltokentype
Definition
htmlparse.c:232
T_n_sup
#define T_n_sup
Definition
htmlparse.h:128
T_end_row
#define T_end_row
Definition
htmlparse.h:116
htmlparse
int htmlparse(htmlscan_t *scanner)
T_end_table
#define T_end_table
Definition
htmlparse.h:119
T_br
#define T_br
Definition
htmlparse.h:138
T_vr
#define T_vr
Definition
htmlparse.h:135
T_error
#define T_error
Definition
htmlparse.h:123
T_n_s
#define T_n_s
Definition
htmlparse.h:130
T_end_cell
#define T_end_cell
Definition
htmlparse.h:120
T_n_sub
#define T_n_sub
Definition
htmlparse.h:129
T_n_bold
#define T_n_bold
Definition
htmlparse.h:125
T_html
#define T_html
Definition
htmlparse.h:117
free_ti
static void free_ti(textspan_t item)
Definition
htmlparse.h:183
T_BR
#define T_BR
Definition
htmlparse.h:137
T_underline
#define T_underline
Definition
htmlparse.h:146
T_sup
#define T_sup
Definition
htmlparse.h:148
T_row
#define T_row
Definition
htmlparse.h:115
T_table
#define T_table
Definition
htmlparse.h:141
T_end_vr
#define T_end_vr
Definition
htmlparse.h:136
T_end_html
#define T_end_html
Definition
htmlparse.h:118
T_IMG
#define T_IMG
Definition
htmlparse.h:139
T_VR
#define T_VR
Definition
htmlparse.h:134
T_bold
#define T_bold
Definition
htmlparse.h:145
T_end_img
#define T_end_img
Definition
htmlparse.h:114
free_hi
static void free_hi(htextspan_t item)
Definition
htmlparse.h:189
T_sub
#define T_sub
Definition
htmlparse.h:149
T_s
#define T_s
Definition
htmlparse.h:150
T_n_italic
#define T_n_italic
Definition
htmlparse.h:124
T_end_font
#define T_end_font
Definition
htmlparse.h:121
T_overline
#define T_overline
Definition
htmlparse.h:147
T_hr
#define T_hr
Definition
htmlparse.h:132
T_font
#define T_font
Definition
htmlparse.h:143
T_italic
#define T_italic
Definition
htmlparse.h:144
T_end_br
#define T_end_br
Definition
htmlparse.h:113
T_n_underline
#define T_n_underline
Definition
htmlparse.h:126
T_cell
#define T_cell
Definition
htmlparse.h:142
T_end_hr
#define T_end_hr
Definition
htmlparse.h:133
T_string
#define T_string
Definition
htmlparse.h:122
T_img
#define T_img
Definition
htmlparse.h:140
T_HR
#define T_HR
Definition
htmlparse.h:131
T_n_overline
#define T_n_overline
Definition
htmlparse.h:127
error
table Syntax error
Definition
htmlparse.y:294
scanner
cleanup & scanner
Definition
htmlparse.y:295
htmltable.h
list.h
DEFINE_LIST_WITH_DTOR
#define DEFINE_LIST_WITH_DTOR(name, type, dtor)
Definition
list.h:34
DEFINE_LIST
#define DEFINE_LIST(name, type)
Definition
list.h:26
GVC_s
Definition
gvcint.h:80
agxbuf
Definition
agxbuf.h:54
htextspan_t
Definition
htmltable.h:52
htmlcell_t
Definition
htmltable.h:157
htmlimg_t
Definition
htmltable.h:67
htmllabel_t
Definition
htmltable.h:148
htmllexstate_t
Definition
htmlparse.c:369
htmlparserstate_s
Definition
htmlparse.c:359
htmlparserstate_s::fontstack
sfont_t fontstack
Definition
htmlparse.c:365
htmlparserstate_s::tblstack
htmltbl_t * tblstack
Definition
htmlparse.c:361
htmlparserstate_s::fitemList
textspans_t fitemList
Definition
htmlparse.c:362
htmlparserstate_s::fspanList
htextspans_t fspanList
Definition
htmlparse.c:363
htmlparserstate_s::lbl
htmllabel_t * lbl
Definition
htmlparse.c:360
htmlparserstate_s::gvc
GVC_t * gvc
Definition
htmlparse.c:366
htmlparserstate_s::str
agxbuf * str
Definition
htmlparse.c:364
htmlscan_s
Definition
htmlparse.c:388
htmlscan_s::parser
htmlparserstate_t parser
Definition
htmlparse.c:390
htmlscan_s::lexer
htmllexstate_t lexer
Definition
htmlparse.c:389
htmltbl_t
Definition
htmltable.h:126
htmltxt_t
Definition
htmltable.h:60
item
Definition
utils.c:747
row_t
Definition
htmltable.h:113
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
tok
static tok_t tok(const char *input, const char *separators)
begin tokenization of a new string
Definition
tokenize.h:43
HTMLSTYPE
Definition
htmlparse.c:316
HTMLSTYPE::tbl
htmltbl_t * tbl
Definition
htmlparse.c:322
HTMLSTYPE::i
int i
Definition
htmlparse.c:319
HTMLSTYPE::p
row_t * p
Definition
htmlparse.c:325
HTMLSTYPE::cell
htmlcell_t * cell
Definition
htmlparse.c:321
HTMLSTYPE::txt
htmltxt_t * txt
Definition
htmlparse.c:320
HTMLSTYPE::font
textfont_t * font
Definition
htmlparse.c:323
HTMLSTYPE::img
htmlimg_t * img
Definition
htmlparse.c:324
lib
common
htmlparse.h
Generated by
1.9.8