1/* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */ 2 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 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 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 */ 23 24#ifndef __CR_PARSER_H__ 25#define __CR_PARSER_H__ 26 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" 32 33G_BEGIN_DECLS 34 35/** 36 *@file 37 *The declaration file 38 *of the #CRParser class. 39 */ 40typedef struct _CRParser CRParser ; 41typedef struct _CRParserPriv CRParserPriv ; 42 43 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 */ 51struct _CRParser { 52 CRParserPriv *priv ; 53} ; 54 55 56CRParser * cr_parser_new (CRTknzr *a_tknzr) ; 57 58CRParser * cr_parser_new_from_buf (guchar *a_buf, gulong a_len, 59 enum CREncoding a_enc, 60 gboolean a_free_buf) ; 61 62CRParser * cr_parser_new_from_file (const guchar *a_file_uri, 63 enum CREncoding a_enc) ; 64 65CRParser * cr_parser_new_from_input (CRInput *a_input) ; 66 67enum CRStatus cr_parser_set_tknzr (CRParser *a_this, CRTknzr *a_tknzr) ; 68 69enum CRStatus cr_parser_get_tknzr (CRParser *a_this, CRTknzr **a_tknzr) ; 70 71enum CRStatus cr_parser_get_parsing_location (CRParser *a_this, CRParsingLocation *a_loc) ; 72 73enum CRStatus cr_parser_try_to_skip_spaces_and_comments (CRParser *a_this) ; 74 75 76enum CRStatus cr_parser_set_sac_handler (CRParser *a_this, 77 CRDocHandler *a_handler) ; 78 79enum CRStatus cr_parser_get_sac_handler (CRParser *a_this, 80 CRDocHandler **a_handler) ; 81 82enum CRStatus cr_parser_set_use_core_grammar (CRParser *a_this, 83 gboolean a_use_core_grammar) ; 84enum CRStatus cr_parser_get_use_core_grammar (CRParser *a_this, 85 gboolean *a_use_core_grammar) ; 86 87enum CRStatus cr_parser_parse (CRParser *a_this) ; 88 89enum CRStatus cr_parser_parse_file (CRParser *a_this, 90 const guchar *a_file_uri, 91 enum CREncoding a_enc) ; 92 93enum CRStatus cr_parser_parse_buf (CRParser *a_this, const guchar *a_buf, 94 gulong a_len, enum CREncoding a_enc) ; 95 96enum CRStatus cr_parser_set_default_sac_handler (CRParser *a_this) ; 97 98enum CRStatus cr_parser_parse_term (CRParser *a_this, CRTerm **a_term) ; 99 100enum CRStatus cr_parser_parse_expr (CRParser *a_this, CRTerm **a_expr) ; 101 102enum CRStatus cr_parser_parse_prio (CRParser *a_this, CRString **a_prio) ; 103 104enum CRStatus cr_parser_parse_declaration (CRParser *a_this, CRString **a_property, 105 CRTerm **a_expr, gboolean *a_important) ; 106 107enum CRStatus cr_parser_parse_statement_core (CRParser *a_this) ; 108 109enum CRStatus cr_parser_parse_ruleset (CRParser *a_this) ; 110 111enum CRStatus cr_parser_parse_import (CRParser *a_this, GList ** a_media_list, 112 CRString **a_import_string, 113 CRParsingLocation *a_location) ; 114 115enum CRStatus cr_parser_parse_media (CRParser *a_this) ; 116 117enum CRStatus cr_parser_parse_page (CRParser *a_this) ; 118 119enum CRStatus cr_parser_parse_charset (CRParser *a_this, CRString **a_value, 120 CRParsingLocation *a_charset_sym_location) ; 121 122enum CRStatus cr_parser_parse_font_face (CRParser *a_this) ; 123 124void cr_parser_destroy (CRParser *a_this) ; 125 126G_END_DECLS 127 128#endif /*__CR_PARSER_H__*/ 129