Graphviz 13.0.0~dev.20250607.1528
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
53extern 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
72 {
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 };
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
165{
166#line 180 "../../lib/common/htmlparse.y"
167
168 int i;
175
176#line 177 "htmlparse.h"
177
178};
179typedef union HTMLSTYPE HTMLSTYPE;
180# define HTMLSTYPE_IS_TRIVIAL 1
181# define HTMLSTYPE_IS_DECLARED 1
182#endif
183
184
185
186
188
189/* "%code provides" blocks. */
190#line 36 "../../lib/common/htmlparse.y"
191
192
193DEFINE_LIST(sfont, textfont_t *)
194
195static inline void free_ti(textspan_t item) {
196 free(item.str);
197}
198
200
201static inline void free_hi(htextspan_t item) {
202 for (size_t i = 0; i < item.nitems; i++) {
203 free(item.items[i].str);
204 }
205 free(item.items);
206}
207
209
211 htmllabel_t* lbl; /* Generated label */
212 htmltbl_t* tblstack; /* Stack of tables maintained during parsing */
213 textspans_t fitemList;
214 htextspans_t fspanList;
215 agxbuf* str; /* Buffer for text */
216 sfont_t fontstack;
218};
219
220typedef struct {
221#ifdef HAVE_EXPAT
222 struct XML_ParserStruct *parser;
223#endif
224 char* ptr; // input source
225 int tok; // token type
226 agxbuf* xb; // buffer to gather T_string data
227 agxbuf lb; // buffer for translating lexical data
228 int warn; // set if warning given
229 int error; // set if error given
230 char inCell; // set if in TD to allow T_string
231 char mode; // for handling artificial <HTML>..</HTML>
232 strview_t currtok; // for error reporting
233 strview_t prevtok; // for error reporting
234 GVC_t *gvc; // current GraphViz context
235 HTMLSTYPE *htmllval; // generated by htmlparse.y
237
238
243
244#line 245 "htmlparse.h"
245
246#endif /* !YY_HTML_HTMLPARSE_H_INCLUDED */
void free(void *)
#define T_n_sup
Definition htmlparse.h:138
#define T_end_row
Definition htmlparse.h:126
int htmlparse(htmlscan_t *scanner)
#define T_end_table
Definition htmlparse.h:129
#define T_br
Definition htmlparse.h:148
enum htmltokentype htmltoken_kind_t
Definition htmlparse.h:116
#define T_vr
Definition htmlparse.h:145
#define T_error
Definition htmlparse.h:133
#define T_n_s
Definition htmlparse.h:140
htmltokentype
Definition htmlparse.h:72
#define T_end_cell
Definition htmlparse.h:130
#define HTMLerror
Definition htmlparse.h:121
#define T_n_sub
Definition htmlparse.h:139
#define T_n_bold
Definition htmlparse.h:135
#define T_html
Definition htmlparse.h:127
static void free_ti(textspan_t item)
Definition htmlparse.h:195
#define T_BR
Definition htmlparse.h:147
#define HTMLEMPTY
Definition htmlparse.h:119
#define T_underline
Definition htmlparse.h:156
#define T_sup
Definition htmlparse.h:158
#define T_row
Definition htmlparse.h:125
#define T_table
Definition htmlparse.h:151
#define T_end_vr
Definition htmlparse.h:146
#define T_end_html
Definition htmlparse.h:128
#define T_IMG
Definition htmlparse.h:149
#define T_VR
Definition htmlparse.h:144
#define T_bold
Definition htmlparse.h:155
#define T_end_img
Definition htmlparse.h:124
static void free_hi(htextspan_t item)
Definition htmlparse.h:201
#define T_sub
Definition htmlparse.h:159
#define T_s
Definition htmlparse.h:160
#define T_n_italic
Definition htmlparse.h:134
#define HTMLUNDEF
Definition htmlparse.h:122
#define T_end_font
Definition htmlparse.h:131
#define T_overline
Definition htmlparse.h:157
#define T_hr
Definition htmlparse.h:142
#define HTMLEOF
Definition htmlparse.h:120
#define T_font
Definition htmlparse.h:153
#define T_italic
Definition htmlparse.h:154
#define T_end_br
Definition htmlparse.h:123
#define T_n_underline
Definition htmlparse.h:136
#define T_cell
Definition htmlparse.h:152
#define T_end_hr
Definition htmlparse.h:143
#define T_string
Definition htmlparse.h:132
#define T_img
Definition htmlparse.h:150
#define T_HR
Definition htmlparse.h:141
#define T_n_overline
Definition htmlparse.h:137
cleanup & scanner
Definition htmlparse.y:295
#define DEFINE_LIST_WITH_DTOR(name, type, dtor)
Definition list.h:30
#define DEFINE_LIST(name, type)
Definition list.h:22
Definition gvcint.h:81
HTMLSTYPE * htmllval
Definition htmlparse.h:235
agxbuf * xb
Definition htmlparse.h:226
strview_t prevtok
Definition htmlparse.h:233
strview_t currtok
Definition htmlparse.h:232
textspans_t fitemList
Definition htmlparse.h:213
htextspans_t fspanList
Definition htmlparse.h:214
htmllabel_t * lbl
Definition htmlparse.h:211
htmltbl_t * tblstack
Definition htmlparse.h:212
htmlparserstate_t parser
Definition htmlparse.h:241
htmllexstate_t lexer
Definition htmlparse.h:240
Definition utils.c:749
a non-owning string reference
Definition strview.h:20
Non-owning string references.
textspan_t, textfont_t, PostscriptAlias
htmltbl_t * tbl
Definition htmlparse.h:171
htmltxt_t * txt
Definition htmlparse.h:169
htmlcell_t * cell
Definition htmlparse.h:170
row_t * p
Definition htmlparse.h:174
textfont_t * font
Definition htmlparse.h:172
htmlimg_t * img
Definition htmlparse.h:173