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