Graphviz 13.0.0~dev.20250607.1528
|
#include <common/render.h>
#include <common/htmltable.h>
#include <common/htmllex.h>
#include <stdbool.h>
#include <util/alloc.h>
#include "htmlparse.h"
#include <limits.h>
Go to the source code of this file.
Data Structures | |
union | yyalloc |
Macros | |
#define | YYBISON 30802 |
#define | YYBISON_VERSION "3.8.2" |
#define | YYSKELETON_NAME "yacc.c" |
#define | YYPURE 2 |
#define | YYPUSH 0 |
#define | YYPULL 1 |
#define | YYSTYPE HTMLSTYPE |
#define | yyparse htmlparse |
#define | yylex htmllex |
#define | yyerror htmlerror |
#define | yydebug htmldebug |
#define | yynerrs htmlnerrs |
#define | YY_CAST(Type, Val) ((Type) (Val)) |
#define | YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) |
#define | YY_NULLPTR ((void*)0) |
#define | YYPTRDIFF_T long |
#define | YYPTRDIFF_MAXIMUM LONG_MAX |
#define | YYSIZE_T unsigned |
#define | YYSIZE_MAXIMUM |
#define | YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) |
#define | YY_(Msgid) Msgid |
#define | YY_ATTRIBUTE_PURE |
#define | YY_ATTRIBUTE_UNUSED |
#define | YY_USE(E) ((void) (E)) |
#define | YY_INITIAL_VALUE(Value) Value |
#define | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
#define | YY_IGNORE_MAYBE_UNINITIALIZED_END |
#define | YY_IGNORE_USELESS_CAST_BEGIN |
#define | YY_IGNORE_USELESS_CAST_END |
#define | YY_ASSERT(E) ((void) (0 && (E))) |
#define | YYSTACK_ALLOC YYMALLOC |
#define | YYSTACK_FREE YYFREE |
#define | YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM |
#define | YYMALLOC malloc |
#define | YYFREE free |
#define | YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1) |
#define | YYSTACK_BYTES(N) |
#define | YYCOPY_NEEDED 1 |
#define | YYSTACK_RELOCATE(Stack_alloc, Stack) |
#define | YYFINAL 31 |
#define | YYLAST 271 |
#define | YYNTOKENS 41 |
#define | YYNNTS 39 |
#define | YYNRULES 69 |
#define | YYNSTATES 116 |
#define | YYMAXUTOK 295 |
#define | YYTRANSLATE(YYX) |
#define | YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State]) |
#define | YYPACT_NINF (-82) |
#define | yypact_value_is_default(Yyn) ((Yyn) == YYPACT_NINF) |
#define | YYTABLE_NINF (-63) |
#define | yytable_value_is_error(Yyn) 0 |
#define | yyerrok (yyerrstatus = 0) |
#define | yyclearin (yychar = HTMLEMPTY) |
#define | YYACCEPT goto yyacceptlab |
#define | YYABORT goto yyabortlab |
#define | YYERROR goto yyerrorlab |
#define | YYNOMEM goto yyexhaustedlab |
#define | YYRECOVERING() (!!yyerrstatus) |
#define | YYBACKUP(Token, Value) |
#define | YYERRCODE HTMLUNDEF |
#define | YYDPRINTF(Args) ((void) 0) |
#define | YY_SYMBOL_PRINT(Title, Kind, Value, Location) |
#define | YY_STACK_PRINT(Bottom, Top) |
#define | YY_REDUCE_PRINT(Rule) |
#define | YYINITDEPTH 200 |
#define | YYMAXDEPTH 10000 |
#define | YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) |
Typedefs | |
typedef enum yysymbol_kind_t | yysymbol_kind_t |
typedef signed char | yytype_int8 |
typedef short | yytype_int16 |
typedef unsigned char | yytype_uint8 |
typedef unsigned short | yytype_uint16 |
typedef yytype_int8 | yy_state_t |
typedef int | yy_state_fast_t |
Functions | |
static void | cleanCell (htmlcell_t *cp) |
Clean up cell if error in parsing. | |
static void | cleanTbl (htmltbl_t *tp) |
Clean up table if error in parsing. | |
static void | appendFItemList (htmlparserstate_t *html_state, agxbuf *ag) |
Append a new text span to the list. | |
static void | appendFLineList (htmlparserstate_t *html_state, int v) |
static htmltxt_t * | mkText (htmlparserstate_t *html_state) |
static row_t * | lastRow (htmlparserstate_t *html_state) |
static void | addRow (htmlparserstate_t *html_state) |
Add new cell row to current table. | |
static void | setCell (htmlparserstate_t *html_state, htmlcell_t *cp, void *obj, label_type_t kind) |
Set cell body and type and attach to row. | |
static htmllabel_t * | mkLabel (void *obj, label_type_t kind) |
Create label, given body and type. | |
static void | cleanup (htmlparserstate_t *html_state) |
static bool | nonSpace (const char *s) |
Return 1 if s contains a non-space character. | |
static void | pushFont (htmlparserstate_t *html_state, textfont_t *fp) |
Fonts are allocated in the lexer. | |
static void | popFont (htmlparserstate_t *html_state) |
void * | malloc (YYSIZE_T) |
void | free (void *) |
static void | yydestruct (const char *yymsg, yysymbol_kind_t yykind, YYSTYPE *yyvaluep, htmlscan_t *scanner) |
int | yyparse (htmlscan_t *scanner) |
htmllabel_t * | parseHTML (char *txt, int *warn, htmlenv_t *env) |
Variables | |
static const yytype_int8 | yytranslate [] |
static const yytype_int16 | yypact [] |
static const yytype_int8 | yydefact [] |
static const yytype_int16 | yypgoto [] |
static const yytype_int8 | yydefgoto [] |
static const yytype_int8 | yytable [] |
static const yytype_int8 | yycheck [] |
static const yytype_int8 | yystos [] |
static const yytype_int8 | yyr1 [] |
static const yytype_int8 | yyr2 [] |
#define YY_ | ( | Msgid | ) | Msgid |
Definition at line 403 of file htmlparse.c.
#define YY_ACCESSING_SYMBOL | ( | State | ) | YY_CAST (yysymbol_kind_t, yystos[State]) |
Accessing symbol of state STATE.
Definition at line 674 of file htmlparse.c.
Definition at line 469 of file htmlparse.c.
#define YY_ATTRIBUTE_PURE |
Definition at line 412 of file htmlparse.c.
#define YY_ATTRIBUTE_UNUSED |
Definition at line 420 of file htmlparse.c.
#define YY_CAST | ( | Type, | |
Val | |||
) | ((Type) (Val)) |
Definition at line 173 of file htmlparse.c.
#define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
Definition at line 449 of file htmlparse.c.
#define YY_IGNORE_MAYBE_UNINITIALIZED_END |
Definition at line 450 of file htmlparse.c.
#define YY_IGNORE_USELESS_CAST_BEGIN |
Definition at line 464 of file htmlparse.c.
#define YY_IGNORE_USELESS_CAST_END |
Definition at line 465 of file htmlparse.c.
#define YY_INITIAL_VALUE | ( | Value | ) | Value |
Definition at line 446 of file htmlparse.c.
#define YY_NULLPTR ((void*)0) |
Definition at line 185 of file htmlparse.c.
#define YY_REDUCE_PRINT | ( | Rule | ) |
Definition at line 1041 of file htmlparse.c.
#define YY_REINTERPRET_CAST | ( | Type, | |
Val | |||
) | ((Type) (Val)) |
Definition at line 174 of file htmlparse.c.
#define YY_STACK_PRINT | ( | Bottom, | |
Top | |||
) |
Definition at line 1040 of file htmlparse.c.
#define YY_SYMBOL_PRINT | ( | Title, | |
Kind, | |||
Value, | |||
Location | |||
) |
Definition at line 1039 of file htmlparse.c.
Definition at line 426 of file htmlparse.c.
#define YYABORT goto yyabortlab |
Definition at line 888 of file htmlparse.c.
#define YYACCEPT goto yyacceptlab |
Definition at line 887 of file htmlparse.c.
#define YYBACKUP | ( | Token, | |
Value | |||
) |
Definition at line 895 of file htmlparse.c.
#define YYBISON 30802 |
Definition at line 49 of file htmlparse.c.
#define YYBISON_VERSION "3.8.2" |
Definition at line 52 of file htmlparse.c.
Definition at line 885 of file htmlparse.c.
#define YYCOPY_NEEDED 1 |
Definition at line 558 of file htmlparse.c.
#define yydebug htmldebug |
Definition at line 72 of file htmlparse.c.
#define YYDPRINTF | ( | Args | ) | ((void) 0) |
Definition at line 1038 of file htmlparse.c.
#define YYERRCODE HTMLUNDEF |
Definition at line 914 of file htmlparse.c.
#define yyerrok (yyerrstatus = 0) |
Definition at line 884 of file htmlparse.c.
#define yyerror htmlerror |
Definition at line 71 of file htmlparse.c.
#define YYERROR goto yyerrorlab |
Definition at line 889 of file htmlparse.c.
#define YYFINAL 31 |
Definition at line 599 of file htmlparse.c.
#define YYFREE free |
Definition at line 530 of file htmlparse.c.
#define YYINITDEPTH 200 |
Definition at line 1047 of file htmlparse.c.
#define YYLAST 271 |
Definition at line 601 of file htmlparse.c.
#define yylex | ( | void | ) | htmllex |
Definition at line 70 of file htmlparse.c.
#define YYMALLOC malloc |
Definition at line 524 of file htmlparse.c.
#define YYMAXDEPTH 10000 |
Definition at line 1058 of file htmlparse.c.
#define YYMAXUTOK 295 |
Definition at line 613 of file htmlparse.c.
#define yynerrs htmlnerrs |
Definition at line 73 of file htmlparse.c.
#define YYNNTS 39 |
Definition at line 606 of file htmlparse.c.
#define YYNOMEM goto yyexhaustedlab |
Definition at line 890 of file htmlparse.c.
#define YYNRULES 69 |
Definition at line 608 of file htmlparse.c.
#define YYNSTATES 116 |
Definition at line 610 of file htmlparse.c.
#define YYNTOKENS 41 |
Definition at line 604 of file htmlparse.c.
#define YYPACT_NINF (-82) |
Definition at line 707 of file htmlparse.c.
#define yypact_value_is_default | ( | Yyn | ) | ((Yyn) == YYPACT_NINF) |
Definition at line 709 of file htmlparse.c.
#define yyparse | ( | void | ) | htmlparse |
Definition at line 69 of file htmlparse.c.
#define YYPTRDIFF_MAXIMUM LONG_MAX |
Definition at line 363 of file htmlparse.c.
#define YYPTRDIFF_T long |
Definition at line 362 of file htmlparse.c.
#define YYPULL 1 |
Definition at line 64 of file htmlparse.c.
#define YYPURE 2 |
Definition at line 58 of file htmlparse.c.
#define YYPUSH 0 |
Definition at line 61 of file htmlparse.c.
#define YYRECOVERING | ( | ) | (!!yyerrstatus) |
Definition at line 893 of file htmlparse.c.
#define YYSIZE_MAXIMUM |
Definition at line 380 of file htmlparse.c.
#define YYSIZE_T unsigned |
Definition at line 376 of file htmlparse.c.
#define YYSIZEOF | ( | X | ) | YY_CAST (YYPTRDIFF_T, sizeof (X)) |
Definition at line 386 of file htmlparse.c.
#define YYSKELETON_NAME "yacc.c" |
Definition at line 55 of file htmlparse.c.
#define YYSTACK_ALLOC YYMALLOC |
Definition at line 510 of file htmlparse.c.
#define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM |
Definition at line 513 of file htmlparse.c.
#define YYSTACK_BYTES | ( | N | ) |
Definition at line 554 of file htmlparse.c.
#define YYSTACK_FREE YYFREE |
Definition at line 511 of file htmlparse.c.
Definition at line 550 of file htmlparse.c.
#define YYSTACK_RELOCATE | ( | Stack_alloc, | |
Stack | |||
) |
Definition at line 565 of file htmlparse.c.
#define YYSTYPE HTMLSTYPE |
Definition at line 67 of file htmlparse.c.
#define YYTABLE_NINF (-63) |
Definition at line 712 of file htmlparse.c.
#define yytable_value_is_error | ( | Yyn | ) | 0 |
Definition at line 714 of file htmlparse.c.
#define YYTRANSLATE | ( | YYX | ) |
Definition at line 618 of file htmlparse.c.
typedef int yy_state_fast_t |
Definition at line 393 of file htmlparse.c.
typedef yytype_int8 yy_state_t |
Definition at line 390 of file htmlparse.c.
typedef enum yysymbol_kind_t yysymbol_kind_t |
Definition at line 275 of file htmlparse.c.
typedef short yytype_int16 |
Definition at line 314 of file htmlparse.c.
typedef signed char yytype_int8 |
Definition at line 306 of file htmlparse.c.
typedef unsigned short yytype_uint16 |
Definition at line 346 of file htmlparse.c.
typedef unsigned char yytype_uint8 |
Definition at line 335 of file htmlparse.c.
anonymous enum |
Enumerator | |
---|---|
YYENOMEM |
Definition at line 882 of file htmlparse.c.
enum yysymbol_kind_t |
Definition at line 191 of file htmlparse.c.
|
static |
Definition at line 1933 of file htmlparse.c.
References gv_alloc(), htmltbl_t::hrule, htmltbl_t::p, htmltbl_t::rows, row_t::ruled, htmlparserstate_s::tblstack, and htmltbl_t::u.
Referenced by yyparse().
|
static |
Definition at line 1864 of file htmlparse.c.
References agxbdisown(), htmlparserstate_s::fitemList, htmlparserstate_s::fontstack, and textspan_t::str.
Referenced by yyparse().
|
static |
Definition at line 1872 of file htmlparse.c.
References cnt(), htmlparserstate_s::fitemList, textspan_t::font, htmlparserstate_s::fontstack, htmlparserstate_s::fspanList, gv_alloc(), gv_calloc(), gv_strdup(), htextspan_t::items, htextspan_t::just, htextspan_t::nitems, and textspan_t::str.
Referenced by mkText(), and yyparse().
|
static |
Definition at line 104 of file htmlparse.c.
References htmlcell_t::child, cleanTbl(), htmlcell_t::data, free(), free_html_data(), free_html_text(), HTML_TBL, HTML_TEXT, htmllabel_t::kind, htmllabel_t::tbl, htmllabel_t::txt, and htmllabel_t::u.
Referenced by cleanTbl().
|
static |
Definition at line 89 of file htmlparse.c.
References cleanCell(), htmltbl_t::data, free(), free_html_data(), htmltbl_t::p, rows, htmltbl_t::rows, row_t::rp, and htmltbl_t::u.
Referenced by cleanCell(), cleanup(), and cleanup().
|
static |
Definition at line 1960 of file htmlparse.c.
References cleanTbl(), htmlparserstate_s::fitemList, htmlparserstate_s::fontstack, free_html_label(), htmlparserstate_s::fspanList, htmlparserstate_s::lbl, NULL, htmltbl_t::p, htmltbl_t::prev, htmlparserstate_s::tblstack, and htmltbl_t::u.
void free | ( | void * | ) |
|
static |
Definition at line 1927 of file htmlparse.c.
References htmltbl_t::p, htmltbl_t::rows, htmlparserstate_s::tblstack, and htmltbl_t::u.
Referenced by yyparse().
void * malloc | ( | YYSIZE_T | ) |
|
static |
Definition at line 131 of file htmlparse.c.
References gv_alloc(), HTML_TEXT, htmllabel_t::kind, htmllabel_t::tbl, htmllabel_t::txt, and htmllabel_t::u.
Referenced by yyparse().
|
static |
Definition at line 1903 of file htmlparse.c.
References appendFLineList(), cnt(), htmlparserstate_s::fitemList, htmlparserstate_s::fspanList, gv_alloc(), gv_calloc(), htmltxt_t::nspans, htmltxt_t::spans, and UNSET_ALIGN.
Referenced by yyparse().
|
static |
Definition at line 149 of file htmlparse.c.
Referenced by yyparse().
htmllabel_t * parseHTML | ( | char * | txt, |
int * | warn, | ||
htmlenv_t * | env | ||
) |
Definition at line 2013 of file htmlparse.c.
References agxbfree(), clearHTMLlexer(), htmlenv_t::g, GD_gvc, htmlparse(), initHTMLlexer(), NULL, scanner, and str.
Referenced by make_html_label().
|
static |
Definition at line 2003 of file htmlparse.c.
References htmlparserstate_s::fontstack.
Referenced by yyparse().
|
static |
Definition at line 1982 of file htmlparse.c.
References textfont_t::color, dtinsert, textfont_t::flags, htmlparserstate_s::fontstack, htmlparserstate_s::gvc, textfont_t::name, textfont_t::size, and GVC_s::textfont_dt.
Referenced by yyparse().
|
static |
Definition at line 1941 of file htmlparse.c.
References htmlcell_t::child, htmlcell_t::hruled, HTML_IMAGE, HTML_TEXT, htmllabel_t::img, htmllabel_t::kind, htmltbl_t::p, row, htmltbl_t::rows, row_t::rp, htmllabel_t::tbl, htmlparserstate_s::tblstack, htmllabel_t::txt, htmltbl_t::u, htmllabel_t::u, htmltbl_t::vrule, and htmlcell_t::vruled.
Referenced by yyparse().
|
static |
Definition at line 1071 of file htmlparse.c.
References scanner, YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN, YY_IGNORE_MAYBE_UNINITIALIZED_END, YY_SYMBOL_PRINT, and YY_USE.
Referenced by yyparse().
int yyparse | ( | htmlscan_t * | scanner | ) |
Definition at line 1095 of file htmlparse.c.
References addRow(), agxbuse(), appendFItemList(), appendFLineList(), cleanup(), font, HTML_IMAGE, HTML_TBL, HTML_TEXT, HTMLEMPTY, HTMLEOF, htmlerror(), HTMLerror, HTMLUNDEF, lastRow(), mkLabel(), mkText(), nonSpace(), popFont(), pushFont(), scanner, setCell(), YY_, YY_ACCESSING_SYMBOL, YY_ASSERT, YY_CAST, YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN, YY_IGNORE_MAYBE_UNINITIALIZED_END, YY_IGNORE_USELESS_CAST_BEGIN, YY_IGNORE_USELESS_CAST_END, YY_INITIAL_VALUE, YY_REDUCE_PRINT, YY_STACK_PRINT, YY_SYMBOL_PRINT, YYABORT, YYACCEPT, yychar, yycheck, yydefact, yydefgoto, yydestruct(), YYDPRINTF, yyerror, YYERROR, YYFINAL, YYINITDEPTH, YYLAST, yylex, yylval, YYMAXDEPTH, yynerrs, YYNOMEM, YYNSTATES, YYNTOKENS, yypact, yypact_value_is_default, yypgoto, YYPOPSTACK, YYPTRDIFF_T, yyr1, yyr2, YYSIZE_T, YYSIZEOF, YYSTACK_ALLOC, YYSTACK_BYTES, YYSTACK_FREE, YYSTACK_RELOCATE, YYSTYPE, YYSYMBOL_YYEMPTY, YYSYMBOL_YYEOF, YYSYMBOL_YYerror, yytable, yytable_value_is_error, and YYTRANSLATE.
|
static |
Definition at line 807 of file htmlparse.c.
Referenced by yyparse().
|
static |
Definition at line 738 of file htmlparse.c.
Referenced by yyparse().
|
static |
Definition at line 764 of file htmlparse.c.
Referenced by yyparse().
|
static |
Definition at line 719 of file htmlparse.c.
Referenced by yyparse().
|
static |
Definition at line 755 of file htmlparse.c.
Referenced by yyparse().
|
static |
Definition at line 858 of file htmlparse.c.
Referenced by yyparse().
|
static |
Definition at line 870 of file htmlparse.c.
Referenced by yyparse().
|
static |
Definition at line 841 of file htmlparse.c.
|
static |
Definition at line 775 of file htmlparse.c.
Referenced by yyparse().
|
static |
Definition at line 625 of file htmlparse.c.