cr-tknzr.h

Go to the documentation of this file.
00001 /* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */
00002 
00003 /*
00004  * This file is part of The Croco Library
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of version 2.1 of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Lesser General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00018  * USA
00019  *
00020  * Author: Dodji Seketeli
00021  * See COPYRIGHTS file for coypyright information.
00022  */
00023 
00024 /**
00025  *@file
00026  *The declaration of the #CRTknzr (tokenizer)
00027  *class.
00028  */
00029 
00030 #ifndef __CR_TKNZR_H__
00031 #define __CR_TKNZR_H__
00032 
00033 #include "cr-utils.h"
00034 #include "cr-input.h"
00035 #include "cr-token.h"
00036 
00037 G_BEGIN_DECLS
00038         
00039         
00040 typedef struct _CRTknzr CRTknzr ;
00041 typedef struct _CRTknzrPriv CRTknzrPriv ;
00042 
00043 /**
00044  *The tokenizer is the class that knows
00045  *about all the css token. Its main job is
00046  *to return the next token found in the character 
00047  *input stream.
00048  */
00049 struct _CRTknzr
00050 {
00051         /*the private data of the tokenizer.*/
00052         CRTknzrPriv *priv ;
00053 } ;
00054 
00055 CRTknzr * cr_tknzr_new (CRInput *a_input) ;
00056 
00057 CRTknzr * cr_tknzr_new_from_uri (const guchar *a_file_uri,
00058                                  enum CREncoding a_enc) ;
00059 
00060 CRTknzr * cr_tknzr_new_from_buf (guchar *a_buf, gulong a_len,
00061                                  enum CREncoding a_enc,
00062                                  gboolean a_free_at_destroy) ;
00063 
00064 gboolean cr_tknzr_unref (CRTknzr *a_this) ;
00065         
00066 void cr_tknzr_ref (CRTknzr *a_this) ;
00067 
00068 enum CRStatus cr_tknzr_read_byte (CRTknzr *a_this, guchar *a_byte) ;
00069         
00070 enum CRStatus cr_tknzr_read_char (CRTknzr *a_this, guint32 *a_char);
00071 
00072 enum CRStatus cr_tknzr_peek_char (CRTknzr *a_this, guint32 *a_char) ;
00073 
00074 enum CRStatus cr_tknzr_peek_byte (CRTknzr *a_this, gulong a_offset, 
00075                                   guchar *a_byte) ;
00076 
00077 guchar cr_tknzr_peek_byte2 (CRTknzr *a_this, gulong a_offset, 
00078                             gboolean *a_eof) ;
00079 
00080 enum CRStatus cr_tknzr_set_cur_pos (CRTknzr *a_this, CRInputPos *a_pos) ;
00081 
00082 glong cr_tknzr_get_nb_bytes_left (CRTknzr *a_this) ;
00083 
00084 enum CRStatus cr_tknzr_get_cur_pos (CRTknzr *a_this, CRInputPos *a_pos) ;
00085 
00086 enum CRStatus cr_tknzr_get_parsing_location (CRTknzr *a_this,
00087                                              CRParsingLocation *a_loc) ;
00088 
00089 enum CRStatus cr_tknzr_seek_index (CRTknzr *a_this,
00090                                    enum CRSeekPos a_origin,
00091                                    gint a_pos) ;
00092 
00093 enum CRStatus cr_tknzr_get_cur_byte_addr (CRTknzr *a_this, guchar **a_addr) ;
00094 
00095 
00096 enum CRStatus cr_tknzr_consume_chars (CRTknzr *a_this, guint32 a_char,
00097                                       glong *a_nb_char) ;
00098 
00099 enum CRStatus cr_tknzr_get_next_token (CRTknzr *a_this, CRToken ** a_tk) ;
00100 
00101 enum CRStatus cr_tknzr_unget_token (CRTknzr *a_this, CRToken *a_token) ;
00102 
00103 
00104 enum CRStatus cr_tknzr_parse_token (CRTknzr *a_this, enum CRTokenType a_type,
00105                                     enum CRTokenExtraType a_et, gpointer a_res,
00106                                     gpointer a_extra_res) ;
00107 enum CRStatus cr_tknzr_set_input (CRTknzr *a_this, CRInput *a_input) ;
00108 
00109 enum CRStatus cr_tknzr_get_input (CRTknzr *a_this, CRInput **a_input) ;
00110 
00111 void cr_tknzr_destroy (CRTknzr *a_this) ;
00112         
00113 G_END_DECLS
00114 
00115 #endif /*__CR_TKZNR_H__*/

Generated on Wed Mar 15 18:23:55 2006 for Libcroco by  doxygen 1.4.6