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
52extern 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
71 {
72 T_end_br = 258,
73 T_end_img = 259,
74 T_row = 260,
75 T_end_row = 261,
76 T_html = 262,
81 T_string = 267,
82 T_error = 268,
84 T_n_bold = 270,
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,
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
154union HTMLSTYPE
155{
156#line 180 "../../lib/common/htmlparse.y"
157
158 int i;
159 htmltxt_t* txt;
161 htmltbl_t* tbl;
163 htmlimg_t* img;
164 row_t *p;
165
166#line 167 "htmlparse.h"
167
168};
169typedef union HTMLSTYPE HTMLSTYPE;
170# define HTMLSTYPE_IS_TRIVIAL 1
171# define HTMLSTYPE_IS_DECLARED 1
172#endif
173
174
175
177/* "%code provides" blocks. */
178#line 36 "../../lib/common/htmlparse.y"
179
180
181DEFINE_LIST(sfont, textfont_t *)
182
183static inline void free_ti(textspan_t item) {
184 free(item.str);
185}
186
188
189static 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
197
198struct 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
208typedef 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
225
226
227struct htmlscan_s {
230};
231
232#line 233 "htmlparse.h"
233
234#endif /* !YY_HTML_HTMLPARSE_H_INCLUDED */
mode
Definition cvtgxl.c:33
void free(void *)
static GVC_t * gvc
Definition gv.cpp:23
htmltokentype
Definition htmlparse.c:232
#define T_n_sup
Definition htmlparse.h:128
#define T_end_row
Definition htmlparse.h:116
int htmlparse(htmlscan_t *scanner)
#define T_end_table
Definition htmlparse.h:119
#define T_br
Definition htmlparse.h:138
#define T_vr
Definition htmlparse.h:135
#define T_error
Definition htmlparse.h:123
#define T_n_s
Definition htmlparse.h:130
#define T_end_cell
Definition htmlparse.h:120
#define T_n_sub
Definition htmlparse.h:129
#define T_n_bold
Definition htmlparse.h:125
#define T_html
Definition htmlparse.h:117
static void free_ti(textspan_t item)
Definition htmlparse.h:183
#define T_BR
Definition htmlparse.h:137
#define T_underline
Definition htmlparse.h:146
#define T_sup
Definition htmlparse.h:148
#define T_row
Definition htmlparse.h:115
#define T_table
Definition htmlparse.h:141
#define T_end_vr
Definition htmlparse.h:136
#define T_end_html
Definition htmlparse.h:118
#define T_IMG
Definition htmlparse.h:139
#define T_VR
Definition htmlparse.h:134
#define T_bold
Definition htmlparse.h:145
#define T_end_img
Definition htmlparse.h:114
static void free_hi(htextspan_t item)
Definition htmlparse.h:189
#define T_sub
Definition htmlparse.h:149
#define T_s
Definition htmlparse.h:150
#define T_n_italic
Definition htmlparse.h:124
#define T_end_font
Definition htmlparse.h:121
#define T_overline
Definition htmlparse.h:147
#define T_hr
Definition htmlparse.h:132
#define T_font
Definition htmlparse.h:143
#define T_italic
Definition htmlparse.h:144
#define T_end_br
Definition htmlparse.h:113
#define T_n_underline
Definition htmlparse.h:126
#define T_cell
Definition htmlparse.h:142
#define T_end_hr
Definition htmlparse.h:133
#define T_string
Definition htmlparse.h:122
#define T_img
Definition htmlparse.h:140
#define T_HR
Definition htmlparse.h:131
#define T_n_overline
Definition htmlparse.h:127
table Syntax error
Definition htmlparse.y:294
cleanup & scanner
Definition htmlparse.y:295
#define DEFINE_LIST_WITH_DTOR(name, type, dtor)
Definition list.h:34
#define DEFINE_LIST(name, type)
Definition list.h:26
Definition gvcint.h:80
htmltbl_t * tblstack
Definition htmlparse.c:361
textspans_t fitemList
Definition htmlparse.c:362
htextspans_t fspanList
Definition htmlparse.c:363
htmllabel_t * lbl
Definition htmlparse.c:360
htmlparserstate_t parser
Definition htmlparse.c:390
htmllexstate_t lexer
Definition htmlparse.c:389
Definition utils.c:747
a non-owning string reference
Definition strview.h:20
Non-owning string references.
textspan_t, textfont_t, PostscriptAlias
static tok_t tok(const char *input, const char *separators)
begin tokenization of a new string
Definition tokenize.h:43
htmltbl_t * tbl
Definition htmlparse.c:322
row_t * p
Definition htmlparse.c:325
htmlcell_t * cell
Definition htmlparse.c:321
htmltxt_t * txt
Definition htmlparse.c:320
textfont_t * font
Definition htmlparse.c:323
htmlimg_t * img
Definition htmlparse.c:324