1 /* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */
2
3 /* libcroco - Library for parsing and applying CSS
4 * Copyright (C) 2006-2019 Free Software Foundation, Inc.
5 *
6 * This file is not part of the GNU gettext program, but is used with
7 * GNU gettext.
8 *
9 * The original copyright notice is as follows:
10 */
11
12 /*
13 * This file is part of The Croco Library
14 *
15 * Copyright (C) 2003-2004 Dodji Seketeli. All Rights Reserved.
16 *
17 * This program is free software; you can redistribute it and/or
18 * modify it under the terms of version 2.1 of the GNU Lesser General Public
19 * License as published by the Free Software Foundation.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU Lesser General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
29 * USA
30 *
31 * Author: Dodji Seketeli
32 */
33
34 #ifndef __CR_PARSER_H__
35 #define __CR_PARSER_H__
36
37 #include <glib.h>
38 #include "cr-input.h"
39 #include "cr-tknzr.h"
40 #include "cr-utils.h"
41 #include "cr-doc-handler.h"
42
43 G_BEGIN_DECLS
44
45 /**
46 *@file
47 *The declaration file
48 *of the #CRParser class.
49 */
50 typedef struct _CRParser CRParser ;
51 typedef struct _CRParserPriv CRParserPriv ;
52
53
54 /**
55 *The implementation of
56 *the SAC parser.
57 *The Class is opaque
58 *and must be manipulated through
59 *the provided methods.
60 */
61 struct _CRParser {
62 CRParserPriv *priv ;
63 } ;
64
65
66 CRParser * cr_parser_new (CRTknzr *a_tknzr) ;
67
68 CRParser * cr_parser_new_from_buf (guchar *a_buf, gulong a_len,
69 enum CREncoding a_enc,
70 gboolean a_free_buf) ;
71
72 CRParser * cr_parser_new_from_file (const guchar *a_file_uri,
73 enum CREncoding a_enc) ;
74
75 CRParser * cr_parser_new_from_input (CRInput *a_input) ;
76
77 enum CRStatus cr_parser_set_tknzr (CRParser *a_this, CRTknzr *a_tknzr) ;
78
79 enum CRStatus cr_parser_get_tknzr (CRParser *a_this, CRTknzr **a_tknzr) ;
80
81 enum CRStatus cr_parser_get_parsing_location (CRParser const *a_this, CRParsingLocation *a_loc) ;
82
83 enum CRStatus cr_parser_try_to_skip_spaces_and_comments (CRParser *a_this) ;
84
85
86 enum CRStatus cr_parser_set_sac_handler (CRParser *a_this,
87 CRDocHandler *a_handler) ;
88
89 enum CRStatus cr_parser_get_sac_handler (CRParser *a_this,
90 CRDocHandler **a_handler) ;
91
92 enum CRStatus cr_parser_set_use_core_grammar (CRParser *a_this,
93 gboolean a_use_core_grammar) ;
94 enum CRStatus cr_parser_get_use_core_grammar (CRParser const *a_this,
95 gboolean *a_use_core_grammar) ;
96
97 enum CRStatus cr_parser_parse (CRParser *a_this) ;
98
99 enum CRStatus cr_parser_parse_file (CRParser *a_this,
100 const guchar *a_file_uri,
101 enum CREncoding a_enc) ;
102
103 enum CRStatus cr_parser_parse_buf (CRParser *a_this, const guchar *a_buf,
104 gulong a_len, enum CREncoding a_enc) ;
105
106 enum CRStatus cr_parser_set_default_sac_handler (CRParser *a_this) ;
107
108 enum CRStatus cr_parser_parse_term (CRParser *a_this, CRTerm **a_term) ;
109
110 enum CRStatus cr_parser_parse_expr (CRParser *a_this, CRTerm **a_expr) ;
111
112 enum CRStatus cr_parser_parse_prio (CRParser *a_this, CRString **a_prio) ;
113
114 enum CRStatus cr_parser_parse_declaration (CRParser *a_this, CRString **a_property,
115 CRTerm **a_expr, gboolean *a_important) ;
116
117 enum CRStatus cr_parser_parse_statement_core (CRParser *a_this) ;
118
119 enum CRStatus cr_parser_parse_ruleset (CRParser *a_this) ;
120
121 enum CRStatus cr_parser_parse_import (CRParser *a_this, GList ** a_media_list,
122 CRString **a_import_string,
123 CRParsingLocation *a_location) ;
124
125 enum CRStatus cr_parser_parse_media (CRParser *a_this) ;
126
127 enum CRStatus cr_parser_parse_page (CRParser *a_this) ;
128
129 enum CRStatus cr_parser_parse_charset (CRParser *a_this, CRString **a_value,
130 CRParsingLocation *a_charset_sym_location) ;
131
132 enum CRStatus cr_parser_parse_font_face (CRParser *a_this) ;
133
134 void cr_parser_destroy (CRParser *a_this) ;
135
136 G_END_DECLS
137
138 #endif /*__CR_PARSER_H__*/