#include "string.h"
#include "cr-tknzr.h"
#include "cr-doc-handler.h"
Go to the source code of this file.
Data Structures | |
struct | _CRTknzrPriv |
Defines | |
#define | PRIVATE(obj) ((obj)->priv) |
#define | IS_NUM(a_char) (((a_char) >= '0' && (a_char) <= '9')?TRUE:FALSE) |
return TRUE if the character is a number ([0-9]), FALSE otherwise | |
#define | CHECK_PARSING_STATUS(status, is_exception) |
Checks if 'status' equals CR_OK. | |
#define | PEEK_NEXT_CHAR(a_tknzr, a_to_char) |
Peeks the next char from the input stream of the current tokenizer. | |
#define | READ_NEXT_CHAR(a_tknzr, to_char) |
Reads the next char from the input stream of the current parser. | |
#define | RECORD_INITIAL_POS(a_tknzr, a_pos) |
Gets information about the current position in the input of the parser. | |
#define | RECORD_CUR_BYTE_ADDR(a_tknzr, a_addr) |
Gets the address of the current byte inside the parser input. | |
#define | PEEK_BYTE(a_tknzr, a_offset, a_byte_ptr) |
Peeks a byte from the topmost parser input at a given offset from the current position. | |
#define | BYTE(a_input, a_n, a_eof) cr_input_peek_byte2 (a_input, a_n, a_eof) |
#define | READ_NEXT_BYTE(a_tknzr, a_byte_ptr) |
Reads a byte from the topmost parser input steam. | |
#define | SKIP_BYTES(a_tknzr, a_nb_bytes) |
Skips a given number of byte in the topmost parser input. | |
#define | SKIP_CHARS(a_tknzr, a_nb_chars) |
Skip utf8 encoded characters. | |
#define | ENSURE_PARSING_COND(condition) if (! (condition)) {status = CR_PARSING_ERROR; goto error ;} |
Tests the condition and if it is false, sets status to "CR_PARSING_ERROR" and goto the 'error' label. | |
Functions | |
CRTknzr * | cr_tknzr_new (CRInput *a_input) |
CRTknzr * | cr_tknzr_new_from_buf (guchar *a_buf, gulong a_len, enum CREncoding a_enc, gboolean a_free_at_destroy) |
CRTknzr * | cr_tknzr_new_from_uri (const guchar *a_file_uri, enum CREncoding a_enc) |
void | cr_tknzr_ref (CRTknzr *a_this) |
gboolean | cr_tknzr_unref (CRTknzr *a_this) |
enum CRStatus | cr_tknzr_set_input (CRTknzr *a_this, CRInput *a_input) |
enum CRStatus | cr_tknzr_get_input (CRTknzr *a_this, CRInput **a_input) |
enum CRStatus | cr_tknzr_read_byte (CRTknzr *a_this, guchar *a_byte) |
Reads the next byte from the parser input stream. | |
enum CRStatus | cr_tknzr_read_char (CRTknzr *a_this, guint32 *a_char) |
Reads the next char from the parser input stream. | |
enum CRStatus | cr_tknzr_peek_char (CRTknzr *a_this, guint32 *a_char) |
Peeks a char from the parser input stream. | |
enum CRStatus | cr_tknzr_peek_byte (CRTknzr *a_this, gulong a_offset, guchar *a_byte) |
Peeks a byte ahead at a given postion in the parser input stream. | |
guchar | cr_tknzr_peek_byte2 (CRTknzr *a_this, gulong a_offset, gboolean *a_eof) |
Same as cr_tknzr_peek_byte() but this api returns the byte peeked. | |
glong | cr_tknzr_get_nb_bytes_left (CRTknzr *a_this) |
Gets the number of bytes left in the topmost input stream associated to this parser. | |
enum CRStatus | cr_tknzr_get_cur_pos (CRTknzr *a_this, CRInputPos *a_pos) |
enum CRStatus | cr_tknzr_get_parsing_location (CRTknzr *a_this, CRParsingLocation *a_loc) |
enum CRStatus | cr_tknzr_get_cur_byte_addr (CRTknzr *a_this, guchar **a_addr) |
enum CRStatus | cr_tknzr_seek_index (CRTknzr *a_this, enum CRSeekPos a_origin, gint a_pos) |
enum CRStatus | cr_tknzr_consume_chars (CRTknzr *a_this, guint32 a_char, glong *a_nb_char) |
enum CRStatus | cr_tknzr_set_cur_pos (CRTknzr *a_this, CRInputPos *a_pos) |
enum CRStatus | cr_tknzr_unget_token (CRTknzr *a_this, CRToken *a_token) |
enum CRStatus | cr_tknzr_get_next_token (CRTknzr *a_this, CRToken **a_tk) |
Returns the next token of the input stream. | |
enum CRStatus | cr_tknzr_parse_token (CRTknzr *a_this, enum CRTokenType a_type, enum CRTokenExtraType a_et, gpointer a_res, gpointer a_extra_res) |
void | cr_tknzr_destroy (CRTknzr *a_this) |
Definition in file cr-tknzr.c.
|
Definition at line 161 of file cr-tknzr.c. |
|
Value: if ((status) != CR_OK) \ { \ if (is_exception == FALSE) \ { \ status = CR_PARSING_ERROR ; \ } \ goto error ; \ } If not, goto the 'error' label.
Definition at line 80 of file cr-tknzr.c. |
|
Tests the condition and if it is false, sets status to "CR_PARSING_ERROR" and goto the 'error' label.
Definition at line 210 of file cr-tknzr.c. |
|
return TRUE if the character is a number ([0-9]), FALSE otherwise
Definition at line 69 of file cr-tknzr.c. |
|
Value: status = cr_tknzr_peek_byte (a_tknzr, \ a_offset, \ a_byte_ptr) ; \ CHECK_PARSING_STATUS (status, TRUE) ; If it fails, goto the "error:" label.
Definition at line 155 of file cr-tknzr.c. |
|
Value: {\ status = cr_tknzr_peek_char (a_tknzr, a_to_char) ; \ CHECK_PARSING_STATUS (status, TRUE) \ } invokes CHECK_PARSING_STATUS on the status returned by cr_tknzr_input_peek_char().
Definition at line 99 of file cr-tknzr.c. |
|
Definition at line 63 of file cr-tknzr.c. |
|
Value: status = \ cr_input_read_byte (PRIVATE (a_tknzr)->input, a_byte_ptr) ;\ CHECK_PARSING_STATUS (status, TRUE) ; If it fails, goto the "error" label.
Definition at line 171 of file cr-tknzr.c. |
|
Value: status = cr_tknzr_read_char (a_tknzr, to_char) ;\ CHECK_PARSING_STATUS (status, TRUE) In case of error, jumps to the "error:" label located in the function where this macro is called.
Definition at line 113 of file cr-tknzr.c. |
|
Value: status = cr_input_get_cur_byte_addr \ (PRIVATE (a_tknzr)->input, a_addr) ; \ CHECK_PARSING_STATUS (status, TRUE)
Definition at line 139 of file cr-tknzr.c. |
|
Value: status = cr_input_get_cur_pos (PRIVATE \ (a_tknzr)->input, a_pos) ; \ g_return_val_if_fail (status == CR_OK, status) In case of failure, this macro returns from the calling function and returns a status code of type enum CRStatus.
Definition at line 127 of file cr-tknzr.c. |
|
Value: status = cr_input_seek_index (PRIVATE (a_tknzr)->input, \ CR_SEEK_CUR, a_nb_bytes) ; \ CHECK_PARSING_STATUS (status, TRUE) ; Don't update line and column number. In case of error, jumps to the "error:" label of the surrounding function.
Definition at line 184 of file cr-tknzr.c. |
|
Value: { \ glong nb_chars = a_nb_chars ; \ status = cr_input_consume_chars \ (PRIVATE (a_tknzr)->input,0, &nb_chars) ; \ CHECK_PARSING_STATUS (status, TRUE) ; \ } Updates line and column numbers.
Definition at line 196 of file cr-tknzr.c. |
|
Definition at line 1900 of file cr-tknzr.c. References CR_BAD_PARAM_ERROR, cr_input_consume_chars(), cr_input_set_cur_pos(), cr_token_destroy(), and PRIVATE. |
|
Definition at line 2739 of file cr-tknzr.c. References cr_input_unref(), cr_token_destroy(), and PRIVATE. Referenced by cr_tknzr_unref(). |
|
Definition at line 1869 of file cr-tknzr.c. References CR_BAD_PARAM_ERROR, cr_input_get_cur_byte_addr(), cr_input_set_cur_pos(), cr_token_destroy(), and PRIVATE. |
|
Definition at line 1839 of file cr-tknzr.c. References CR_BAD_PARAM_ERROR, cr_input_get_cur_pos(), cr_input_set_cur_pos(), cr_token_destroy(), CRInputPos, and PRIVATE. |
|
Definition at line 1690 of file cr-tknzr.c. References CR_BAD_PARAM_ERROR, CRInput, and PRIVATE. |
|
Gets the number of bytes left in the topmost input stream associated to this parser.
Definition at line 1823 of file cr-tknzr.c. References CR_BAD_PARAM_ERROR, cr_input_get_nb_bytes_left(), cr_input_set_cur_pos(), cr_token_destroy(), and PRIVATE. |
|
|
Definition at line 1856 of file cr-tknzr.c. References CR_BAD_PARAM_ERROR, cr_input_get_parsing_location(), CRParsingLocation, and PRIVATE. Referenced by cr_parser_get_parsing_location(), and cr_tknzr_get_next_token(). |
|
Definition at line 1584 of file cr-tknzr.c. References cr_tknzr_set_input(), cr_utils_trace_info, CRInput, CRTknzr, CRTknzrPriv, and _CRTknzr::priv. Referenced by cr_parser_new_from_input(), cr_tknzr_new_from_buf(), and cr_tknzr_new_from_uri(). |
|
Definition at line 1616 of file cr-tknzr.c. References cr_input_new_from_buf(), cr_tknzr_new(), CRInput, and CRTknzr. Referenced by cr_parser_parse_buf(). |
|
Definition at line 1634 of file cr-tknzr.c. References cr_input_new_from_uri(), cr_tknzr_new(), CRInput, and CRTknzr. Referenced by cr_parser_new_from_file(), and cr_parser_parse_file(). |
|
Definition at line 2628 of file cr-tknzr.c. References ANGLE_TK, ATKEYWORD_TK, CDC_TK, CDO_TK, CHARSET_SYM_TK, COMMENT_TK, CR_BAD_PARAM_ERROR, cr_tknzr_get_next_token(), cr_tknzr_unget_token(), cr_token_destroy(), CRNum, CRStatus, CRString, CRToken, DASHMATCH_TK, DELIM_TK, _CRToken::dimen, DIMEN_TK, EMS_TK, EXS_TK, FONT_FACE_SYM_TK, FREQ_TK, FUNCTION_TK, HASH_TK, IDENT_TK, IMPORT_SYM_TK, IMPORTANT_SYM_TK, INCLUDES_TK, LENGTH_TK, MEDIA_SYM_TK, NO_TK, _CRToken::num, NUMBER_TK, PAGE_SYM_TK, PERCENTAGE_TK, PRIVATE, S_TK, _CRToken::str, STRING_TK, TIME_TK, _CRToken::u, _CRToken::unichar, UNICODERANGE_TK, and URI_TK. |
|
Peeks a byte ahead at a given postion in the parser input stream.
Definition at line 1780 of file cr-tknzr.c. References CR_BAD_PARAM_ERROR, cr_input_peek_byte(), cr_input_set_cur_pos(), CR_SEEK_CUR, cr_token_destroy(), and PRIVATE. Referenced by cr_parser_parse_expr(). |
|
Same as cr_tknzr_peek_byte() but this api returns the byte peeked.
Definition at line 1808 of file cr-tknzr.c. References cr_input_peek_byte2(), and PRIVATE. |
|
Peeks a char from the parser input stream. To "peek a char" means reads the next char without consuming it. Subsequent calls to this function return the same char.
Definition at line 1754 of file cr-tknzr.c. References CR_BAD_PARAM_ERROR, cr_input_peek_char(), cr_input_set_cur_pos(), cr_token_destroy(), and PRIVATE. Referenced by cr_declaration_parse_list_from_buf(), cr_parser_parse_import(), and cr_parser_parse_ruleset(). |
|
Reads the next byte from the parser input stream.
Definition at line 1713 of file cr-tknzr.c. References CR_BAD_PARAM_ERROR, cr_input_read_byte(), and PRIVATE. |
|
Reads the next char from the parser input stream.
Definition at line 1729 of file cr-tknzr.c. References CR_BAD_PARAM_ERROR, cr_input_read_char(), cr_input_set_cur_pos(), cr_token_destroy(), and PRIVATE. Referenced by cr_declaration_parse_list_from_buf(). |
|
Definition at line 1649 of file cr-tknzr.c. References PRIVATE. Referenced by cr_parser_set_tknzr(). |
|
Definition at line 1884 of file cr-tknzr.c. References CR_BAD_PARAM_ERROR, cr_input_seek_index(), cr_input_set_cur_pos(), cr_token_destroy(), and PRIVATE. |
|
Definition at line 1917 of file cr-tknzr.c. References CR_BAD_PARAM_ERROR, cr_input_set_cur_pos(), cr_token_destroy(), CRInputPos, and PRIVATE. Referenced by cr_parser_parse_charset(), cr_parser_parse_declaration(), cr_parser_parse_expr(), cr_parser_parse_font_face(), cr_parser_parse_import(), cr_parser_parse_media(), cr_parser_parse_page(), cr_parser_parse_prio(), cr_parser_parse_ruleset(), cr_parser_parse_statement_core(), cr_parser_parse_term(), and cr_tknzr_get_next_token(). |
|
Definition at line 1674 of file cr-tknzr.c. References CR_BAD_PARAM_ERROR, cr_input_ref(), cr_input_unref(), CRInput, and PRIVATE. Referenced by cr_tknzr_new(). |
|
Definition at line 1931 of file cr-tknzr.c. References CR_BAD_PARAM_ERROR, CRToken, and PRIVATE. Referenced by cr_parser_parse_page(), cr_parser_parse_statement_core(), cr_parser_parse_term(), cr_parser_try_to_skip_spaces_and_comments(), and cr_tknzr_parse_token(). |
|
Definition at line 1657 of file cr-tknzr.c. References cr_tknzr_destroy(), and PRIVATE. Referenced by cr_parser_destroy(), and cr_parser_set_tknzr(). |