PageRenderTime 29ms CodeModel.GetById 19ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 1ms

/cssed-0.4.0/libcroco/parser/cr-tknzr.h

#
C++ Header | 121 lines | 50 code | 36 blank | 35 comment | 0 complexity | f7ab1dc1a1d4f0eb038a05e0153c3371 MD5 | raw file
  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 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 coypyright information.
 22 */
 23
 24/**
 25 *@file
 26 *The declaration of the #CRTknzr (tokenizer)
 27 *class.
 28 */
 29
 30#ifndef __CR_TKNZR_H__
 31#define __CR_TKNZR_H__
 32
 33#include "cr-utils.h"
 34#include "cr-input.h"
 35#include "cr-token.h"
 36
 37G_BEGIN_DECLS
 38	
 39	
 40typedef struct _CRTknzr CRTknzr ;
 41typedef struct _CRTknzrPriv CRTknzrPriv ;
 42
 43/**
 44 *The tokenizer is the class that knows
 45 *about all the css token. Its main job is
 46 *to return the next token found in the character 
 47 *input stream.
 48 */
 49struct _CRTknzr
 50{
 51        /*the private data of the tokenizer.*/
 52        CRTknzrPriv *priv ;
 53} ;
 54
 55/* added by Iago Rubio */
 56gulong
 57cr_tknzr_get_cur_line(CRTknzr *a_this) ;
 58/* end */
 59
 60
 61CRTknzr * cr_tknzr_new (CRInput *a_input) ;
 62
 63CRTknzr * cr_tknzr_new_from_uri (const guchar *a_file_uri,
 64                                 enum CREncoding a_enc) ;
 65
 66CRTknzr * cr_tknzr_new_from_buf (guchar *a_buf, gulong a_len,
 67                                 enum CREncoding a_enc,
 68                                 gboolean a_free_at_destroy) ;
 69
 70gboolean cr_tknzr_unref (CRTknzr *a_this) ;
 71        
 72void cr_tknzr_ref (CRTknzr *a_this) ;
 73
 74enum CRStatus cr_tknzr_read_byte (CRTknzr *a_this, guchar *a_byte) ;
 75        
 76enum CRStatus cr_tknzr_read_char (CRTknzr *a_this, guint32 *a_char);
 77
 78enum CRStatus cr_tknzr_peek_char (CRTknzr *a_this, guint32 *a_char) ;
 79
 80enum CRStatus cr_tknzr_peek_byte (CRTknzr *a_this, gulong a_offset, 
 81                                  guchar *a_byte) ;
 82
 83guchar cr_tknzr_peek_byte2 (CRTknzr *a_this, gulong a_offset, 
 84                            gboolean *a_eof) ;
 85
 86enum CRStatus cr_tknzr_set_cur_pos (CRTknzr *a_this, CRInputPos *a_pos) ;
 87
 88glong cr_tknzr_get_nb_bytes_left (CRTknzr *a_this) ;
 89
 90enum CRStatus cr_tknzr_get_cur_pos (CRTknzr *a_this, CRInputPos *a_pos) ;
 91
 92enum CRStatus cr_tknzr_get_parsing_location (CRTknzr *a_this,
 93                                             CRParsingLocation *a_loc) ;
 94
 95enum CRStatus cr_tknzr_seek_index (CRTknzr *a_this,
 96                                   enum CRSeekPos a_origin,
 97                                   gint a_pos) ;
 98
 99enum CRStatus cr_tknzr_get_cur_byte_addr (CRTknzr *a_this, guchar **a_addr) ;
100
101
102enum CRStatus cr_tknzr_consume_chars (CRTknzr *a_this, guint32 a_char,
103                                      glong *a_nb_char) ;
104
105enum CRStatus cr_tknzr_get_next_token (CRTknzr *a_this, CRToken ** a_tk) ;
106
107enum CRStatus cr_tknzr_unget_token (CRTknzr *a_this, CRToken *a_token) ;
108
109
110enum CRStatus cr_tknzr_parse_token (CRTknzr *a_this, enum CRTokenType a_type,
111                                    enum CRTokenExtraType a_et, gpointer a_res,
112                                    gpointer a_extra_res) ;
113enum CRStatus cr_tknzr_set_input (CRTknzr *a_this, CRInput *a_input) ;
114
115enum CRStatus cr_tknzr_get_input (CRTknzr *a_this, CRInput **a_input) ;
116
117void cr_tknzr_destroy (CRTknzr *a_this) ;
118	
119G_END_DECLS
120
121#endif /*__CR_TKZNR_H__*/