/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. * This file is part of The Croco Library
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of version 2.1 of the GNU Lesser General Public
  7. * License as published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  17. * USA
  18. *
  19. * Author: Dodji Seketeli
  20. * See COPYRIGHTS file for coypyright information.
  21. */
  22. /**
  23. *@file
  24. *The declaration of the #CRTknzr (tokenizer)
  25. *class.
  26. */
  27. #ifndef __CR_TKNZR_H__
  28. #define __CR_TKNZR_H__
  29. #include "cr-utils.h"
  30. #include "cr-input.h"
  31. #include "cr-token.h"
  32. G_BEGIN_DECLS
  33. typedef struct _CRTknzr CRTknzr ;
  34. typedef struct _CRTknzrPriv CRTknzrPriv ;
  35. /**
  36. *The tokenizer is the class that knows
  37. *about all the css token. Its main job is
  38. *to return the next token found in the character
  39. *input stream.
  40. */
  41. struct _CRTknzr
  42. {
  43. /*the private data of the tokenizer.*/
  44. CRTknzrPriv *priv ;
  45. } ;
  46. /* added by Iago Rubio */
  47. gulong
  48. cr_tknzr_get_cur_line(CRTknzr *a_this) ;
  49. /* end */
  50. CRTknzr * cr_tknzr_new (CRInput *a_input) ;
  51. CRTknzr * cr_tknzr_new_from_uri (const guchar *a_file_uri,
  52. enum CREncoding a_enc) ;
  53. CRTknzr * cr_tknzr_new_from_buf (guchar *a_buf, gulong a_len,
  54. enum CREncoding a_enc,
  55. gboolean a_free_at_destroy) ;
  56. gboolean cr_tknzr_unref (CRTknzr *a_this) ;
  57. void cr_tknzr_ref (CRTknzr *a_this) ;
  58. enum CRStatus cr_tknzr_read_byte (CRTknzr *a_this, guchar *a_byte) ;
  59. enum CRStatus cr_tknzr_read_char (CRTknzr *a_this, guint32 *a_char);
  60. enum CRStatus cr_tknzr_peek_char (CRTknzr *a_this, guint32 *a_char) ;
  61. enum CRStatus cr_tknzr_peek_byte (CRTknzr *a_this, gulong a_offset,
  62. guchar *a_byte) ;
  63. guchar cr_tknzr_peek_byte2 (CRTknzr *a_this, gulong a_offset,
  64. gboolean *a_eof) ;
  65. enum CRStatus cr_tknzr_set_cur_pos (CRTknzr *a_this, CRInputPos *a_pos) ;
  66. glong cr_tknzr_get_nb_bytes_left (CRTknzr *a_this) ;
  67. enum CRStatus cr_tknzr_get_cur_pos (CRTknzr *a_this, CRInputPos *a_pos) ;
  68. enum CRStatus cr_tknzr_get_parsing_location (CRTknzr *a_this,
  69. CRParsingLocation *a_loc) ;
  70. enum CRStatus cr_tknzr_seek_index (CRTknzr *a_this,
  71. enum CRSeekPos a_origin,
  72. gint a_pos) ;
  73. enum CRStatus cr_tknzr_get_cur_byte_addr (CRTknzr *a_this, guchar **a_addr) ;
  74. enum CRStatus cr_tknzr_consume_chars (CRTknzr *a_this, guint32 a_char,
  75. glong *a_nb_char) ;
  76. enum CRStatus cr_tknzr_get_next_token (CRTknzr *a_this, CRToken ** a_tk) ;
  77. enum CRStatus cr_tknzr_unget_token (CRTknzr *a_this, CRToken *a_token) ;
  78. enum CRStatus cr_tknzr_parse_token (CRTknzr *a_this, enum CRTokenType a_type,
  79. enum CRTokenExtraType a_et, gpointer a_res,
  80. gpointer a_extra_res) ;
  81. enum CRStatus cr_tknzr_set_input (CRTknzr *a_this, CRInput *a_input) ;
  82. enum CRStatus cr_tknzr_get_input (CRTknzr *a_this, CRInput **a_input) ;
  83. void cr_tknzr_destroy (CRTknzr *a_this) ;
  84. G_END_DECLS
  85. #endif /*__CR_TKZNR_H__*/