summaryrefslogtreecommitdiff
path: root/src/cr-parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cr-parser.c')
-rw-r--r--src/cr-parser.c443
1 files changed, 163 insertions, 280 deletions
diff --git a/src/cr-parser.c b/src/cr-parser.c
index 0fa1ffa..5b0a56f 100644
--- a/src/cr-parser.c
+++ b/src/cr-parser.c
@@ -24,8 +24,7 @@
*/
/**
- *@CRParser:
- *
+ *@file
*The definition of the #CRParser class.
*/
@@ -42,7 +41,7 @@
*=====================================
*
*One must keep in mind
- *that css UA must comply with two syntaxes.
+ *that css UA must comply with two syntax.
*
*1/the specific syntax that defines the css language
*for a given level of specificatin (e.g css2 syntax
@@ -137,9 +136,8 @@ struct _CRParserPriv {
#define CHARS_TAB_SIZE 12
/**
- * IS_NUM:
- *@a_char: the char to test.
*return TRUE if the character is a number ([0-9]), FALSE otherwise
+ *@param a_char the char to test.
*/
#define IS_NUM(a_char) (((a_char) >= '0' && (a_char) <= '9')?TRUE:FALSE)
@@ -163,18 +161,16 @@ if ((status) != CR_OK) \
}
/**
- * CHECK_PARSING_STATUS_ERR:
- *@a_this: the current instance of #CRParser .
- *@a_status: the status to check. Is of type enum #CRStatus.
- *@a_is_exception: in case of error, if is TRUE, the status
+ *same as CHECK_PARSING_STATUS() but this one pushes an error
+ *on the parser error stack when an error arises.
+ *@param a_this the current instance of #CRParser .
+ *@param a_status the status to check. Is of type enum #CRStatus.
+ *@param a_is_exception in case of error, if is TRUE, the status
*is set to CR_PARSING_ERROR before goto error. If is false, the
*real low level status is kept and will be returned by the
*upper level function that called this macro. Usally,this must
*be set to FALSE.
*
- *same as CHECK_PARSING_STATUS() but this one pushes an error
- *on the parser error stack when an error arises.
- *
*/
#define CHECK_PARSING_STATUS_ERR(a_this, a_status, a_is_exception,\
a_err_msg, a_err_status) \
@@ -413,9 +409,7 @@ static enum CRStatus
static CRParserError *
cr_parser_error_new (const guchar * a_msg, enum CRStatus a_status)
{
- CRParserError *result = NULL;
-
- result = g_try_malloc (sizeof (CRParserError));
+ CRParserError *result = (CRParserError *)g_try_malloc (sizeof (CRParserError));
if (result == NULL) {
cr_utils_trace_info ("Out of memory");
@@ -444,7 +438,7 @@ cr_parser_error_set_msg (CRParserError * a_this, const guchar * a_msg)
g_free (a_this->msg);
}
- a_this->msg = g_strdup (a_msg);
+ a_this->msg = (guchar *)g_strdup ((gchar *)a_msg);
}
/**
@@ -511,7 +505,7 @@ cr_parser_error_destroy (CRParserError * a_this)
*@param a_this the current instance of #CRParser.
*@param a_msg the error message.
*@param a_status the error status.
- *@return CR_OK upon successfull completion, an error code otherwise.
+ *@return CR_OK upon successful completion, an error code otherwise.
*/
static enum CRStatus
cr_parser_push_error (CRParser * a_this,
@@ -553,7 +547,7 @@ cr_parser_push_error (CRParser * a_this,
}
/**
- *Dumps the error stack on stdout.
+ *Dumps the error stack using g_printerr.
*@param a_this the current instance of #CRParser.
*@param a_clear_errs whether to clear the error stack
*after the dump or not.
@@ -609,13 +603,11 @@ cr_parser_clear_errors (CRParser * a_this)
}
/**
- * cr_parser_try_to_skip_spaces_and_comments:
- *@a_this: the current instance of #CRParser.
- *
*Same as cr_parser_try_to_skip_spaces() but this one skips
*spaces and comments.
*
- *Returns CR_OK upon successfull completion, an error code otherwise.
+ *@param a_this the current instance of #CRParser.
+ *@return CR_OK upon successfull completion, an error code otherwise.
*/
enum CRStatus
cr_parser_try_to_skip_spaces_and_comments (CRParser * a_this)
@@ -733,7 +725,7 @@ cr_parser_parse_stylesheet_core (CRParser * a_this)
error:
cr_parser_push_error
- (a_this, "could not recognize next production", CR_ERROR);
+ (a_this, (guchar *)"could not recognize next production", CR_ERROR);
cr_parser_dump_err_stack (a_this, TRUE);
@@ -1329,7 +1321,7 @@ cr_parser_parse_attribute_selector (CRParser * a_this,
CRInputPos init_pos;
CRToken *token = NULL;
CRAttrSel *result = NULL;
- CRParsingLocation location = {0} ;
+ CRParsingLocation location = {0,0,0} ;
g_return_val_if_fail (a_this && a_sel, CR_BAD_PARAM_ERROR);
@@ -1491,9 +1483,6 @@ cr_parser_parse_property (CRParser * a_this,
}
/**
- * cr_parser_parse_term:
- *@a_term: out parameter. The successfully parsed term.
- *
*Parses a "term" as defined in the css2 spec, appendix D.1:
*term ::= unary_operator? [NUMBER S* | PERCENTAGE S* | LENGTH S* |
*EMS S* | EXS S* | ANGLE S* | TIME S* | FREQ S* | function ] |
@@ -1501,7 +1490,8 @@ cr_parser_parse_property (CRParser * a_this,
*
*TODO: handle parsing of 'RGB'
*
- *Returns CR_OK upon successfull completion, an error code otherwise.
+ *@param a_term out parameter. The successfully parsed term.
+ *@return CR_OK upon successfull completion, an error code otherwise.
*/
enum CRStatus
cr_parser_parse_term (CRParser * a_this, CRTerm ** a_term)
@@ -1512,7 +1502,7 @@ cr_parser_parse_term (CRParser * a_this, CRTerm ** a_term)
CRTerm *param = NULL;
CRToken *token = NULL;
CRString *func_name = NULL;
- CRParsingLocation location = {0} ;
+ CRParsingLocation location = {0,0,0} ;
g_return_val_if_fail (a_this && a_term, CR_BAD_PARAM_ERROR);
@@ -1646,17 +1636,15 @@ cr_parser_parse_term (CRParser * a_this, CRTerm ** a_term)
}
/**
- * cr_parser_parse_simple_selector:
- *@a_this: the "this pointer" of the current instance of #CRParser.
- *@a_sel: out parameter. Is set to the successfully parsed simple
- *selector.
- *
*Parses a "simple_selector" as defined by the css2 spec in appendix D.1 :
*element_name? [ HASH | class | attrib | pseudo ]* S*
*and where pseudo is:
*pseudo ::= ':' [ IDENT | FUNCTION S* IDENT S* ')' ]
*
- *Returns CR_OK upon successfull completion, an error code otherwise.
+ *@Param a_this the "this pointer" of the current instance of #CRParser.
+ *@param a_sel out parameter. Is set to the successfully parsed simple
+ *selector.
+ *@return CR_OK upon successfull completion, an error code otherwise.
*/
static enum CRStatus
cr_parser_parse_simple_selector (CRParser * a_this, CRSimpleSel ** a_sel)
@@ -1686,12 +1674,16 @@ cr_parser_parse_simple_selector (CRParser * a_this, CRSimpleSel ** a_sel)
if (token && token->type == DELIM_TK
&& token->u.unichar == '*') {
- sel->type_mask |= UNIVERSAL_SELECTOR;
+ int comb = (int)sel->type_mask | (int) UNIVERSAL_SELECTOR;
+ sel->type_mask = (enum SimpleSelectorType)comb;
+ //sel->type_mask |= UNIVERSAL_SELECTOR;
sel->name = cr_string_new_from_string ("*");
found_sel = TRUE;
} else if (token && token->type == IDENT_TK) {
sel->name = token->u.str;
- sel->type_mask |= TYPE_SELECTOR;
+ int comb = (int)sel->type_mask | (int) TYPE_SELECTOR;
+ sel->type_mask = (enum SimpleSelectorType)comb;
+ //sel->type_mask |= TYPE_SELECTOR;
token->u.str = NULL;
found_sel = TRUE;
} else {
@@ -1912,18 +1904,16 @@ cr_parser_parse_simple_selector (CRParser * a_this, CRSimpleSel ** a_sel)
}
/**
- * cr_parser_parse_simple_sels:
- *@a_this: the this pointer of the current instance of #CRParser.
- *@a_start: a pointer to the
- *first chararcter of the successfully parsed
- *string.
- *@a_end: a pointer to the last character of the successfully parsed
- *string.
- *
*Parses a "selector" as defined by the css2 spec in appendix D.1:
*selector ::= simple_selector [ combinator simple_selector ]*
*
- *Returns CR_OK upon successfull completion, an error code otherwise.
+ *@param a_this the this pointer of the current instance of #CRParser.
+ *@param a_start a pointer to the
+ *first chararcter of the successfully parsed
+ *string.
+ *@param a_end a pointer to the last character of the successfully parsed
+ *string.
+ *@return CR_OK upon successfull completion, an error code otherwise.
*/
static enum CRStatus
cr_parser_parse_simple_sels (CRParser * a_this,
@@ -1948,7 +1938,7 @@ cr_parser_parse_simple_sels (CRParser * a_this,
for (;;) {
guint32 next_char = 0;
- enum Combinator comb = 0;
+ int comb = 0;
sel = NULL;
@@ -1971,7 +1961,7 @@ cr_parser_parse_simple_sels (CRParser * a_this,
break;
if (comb && sel) {
- sel->combinator = comb;
+ sel->combinator = (enum Combinator)comb;
comb = 0;
}
if (sel) {
@@ -1990,14 +1980,11 @@ cr_parser_parse_simple_sels (CRParser * a_this,
}
/**
- * cr_parser_parse_selector:
- *@a_this: the current instance of #CRParser.
- *@a_selector: the parsed list of comma separated
- *selectors.
- *
*Parses a comma separated list of selectors.
- *
- *Returns CR_OK upon successful completion, an error
+ *@param a_this the current instance of #CRParser.
+ *@param a_selector the parsed list of comma separated
+ *selectors.
+ *@return CR_OK upon successful completion, an error
*code otherwise.
*/
static enum CRStatus
@@ -2111,17 +2098,16 @@ cr_parser_parse_selector (CRParser * a_this,
}
/**
- * cr_parser_parse_function:
- *@a_this: the "this pointer" of the current instance of #CRParser.
- *
- *@a_func_name: out parameter. The parsed function name
- *@a_expr: out parameter. The successfully parsed term.
- *
*Parses a "function" as defined in css spec at appendix D.1:
*function ::= FUNCTION S* expr ')' S*
*FUNCTION ::= ident'('
*
- *Returns CR_OK upon successfull completion, an error code otherwise.
+ *@param a_this the "this pointer" of the current instance of
+ *#CRParser.
+ *
+ *@param a_func_name out parameter. The parsed function name
+ *@param a_expr out parameter. The successfully parsed term.
+ *@return CR_OK upon successfull completion, an error code otherwise.
*/
static enum CRStatus
cr_parser_parse_function (CRParser * a_this,
@@ -2199,15 +2185,13 @@ cr_parser_parse_function (CRParser * a_this,
}
/**
- * cr_parser_parse_uri:
- *@a_this: the current instance of #CRParser.
- *@a_str: the successfully parsed url.
- *
*Parses an uri as defined by the css spec [4.1.1]:
* URI ::= url\({w}{string}{w}\)
* |url\({w}([!#$%&*-~]|{nonascii}|{escape})*{w}\)
*
- *Returns CR_OK upon successfull completion, an error code otherwise.
+ *@param a_this the current instance of #CRParser.
+ *@param a_str the successfully parsed url.
+ *@return CR_OK upon successfull completion, an error code otherwise.
*/
static enum CRStatus
cr_parser_parse_uri (CRParser * a_this, CRString ** a_str)
@@ -2224,21 +2208,19 @@ cr_parser_parse_uri (CRParser * a_this, CRString ** a_str)
}
/**
- * cr_parser_parse_string:
- *@a_this: the current instance of #CRParser.
- *@a_start: out parameter. Upon successfull completion,
- *points to the beginning of the string, points to an undefined value
- *otherwise.
- *@a_end: out parameter. Upon successfull completion, points to
- *the beginning of the string, points to an undefined value otherwise.
- *
*Parses a string type as defined in css spec [4.1.1]:
*
*string ::= {string1}|{string2}
*string1 ::= \"([\t !#$%&(-~]|\\{nl}|\'|{nonascii}|{escape})*\"
*string2 ::= \'([\t !#$%&(-~]|\\{nl}|\"|{nonascii}|{escape})*\'
*
- *Returns CR_OK upon successfull completion, an error code otherwise.
+ *@param a_this the current instance of #CRParser.
+ *@param a_start out parameter. Upon successfull completion,
+ *points to the beginning of the string, points to an undefined value
+ *otherwise.
+ *@param a_end out parameter. Upon successfull completion, points to
+ *the beginning of the string, points to an undefined value otherwise.
+ *@return CR_OK upon successfull completion, an error code otherwise.
*/
static enum CRStatus
cr_parser_parse_string (CRParser * a_this, CRString ** a_str)
@@ -2329,7 +2311,7 @@ cr_parser_parse_stylesheet (CRParser * a_this)
CHECK_PARSING_STATUS (status, TRUE);
if (token && token->type == CHARSET_SYM_TK) {
- CRParsingLocation location = {0} ;
+ CRParsingLocation location = {0,0,0} ;
status = cr_tknzr_unget_token (PRIVATE (a_this)->tknzr,
token);
CHECK_PARSING_STATUS (status, TRUE);
@@ -2405,7 +2387,7 @@ cr_parser_parse_stylesheet (CRParser * a_this)
if (token && token->type == IMPORT_SYM_TK) {
GList *media_list = NULL;
CRString *import_string = NULL;
- CRParsingLocation location = {0} ;
+ CRParsingLocation location = {0,0,0} ;
status = cr_tknzr_unget_token
(PRIVATE (a_this)->tknzr, token);
@@ -2463,7 +2445,7 @@ cr_parser_parse_stylesheet (CRParser * a_this)
/*free the medium list */
for (cur = media_list; cur; cur = cur->next) {
if (cur->data) {
- cr_string_destroy (cur->data);
+ cr_string_destroy ((CRString *)cur->data);
}
}
@@ -2703,7 +2685,7 @@ cr_parser_parse_stylesheet (CRParser * a_this)
}
cr_parser_push_error
- (a_this, "could not recognize next production", CR_ERROR);
+ (a_this, (guchar *)"could not recognize next production", CR_ERROR);
if (PRIVATE (a_this)->sac_handler
&& PRIVATE (a_this)->sac_handler->unrecoverable_error) {
@@ -2738,24 +2720,23 @@ cr_parser_parse_stylesheet (CRParser * a_this)
****************************************/
/**
- * cr_parser_new:
- * @a_tknzr: the tokenizer to use for the parsing.
- *
*Creates a new parser to parse data
*coming the input stream given in parameter.
- *
- *Returns the newly created instance of #CRParser,
+ *@param a_input the input stream of the parser.
+ *Note that the newly created parser will ref
+ *a_input and unref it when parsing reaches the
+ *end of the input stream.
+ *@return the newly created instance of #CRParser,
*or NULL if an error occured.
*/
CRParser *
cr_parser_new (CRTknzr * a_tknzr)
{
- CRParser *result = NULL;
enum CRStatus status = CR_OK;
- result = g_malloc0 (sizeof (CRParser));
+ CRParser *result = (CRParser *)g_malloc0 (sizeof (CRParser));
- PRIVATE (result) = g_malloc0 (sizeof (CRParserPriv));
+ PRIVATE (result) = (CRParserPriv *)g_malloc0 (sizeof (CRParserPriv));
if (a_tknzr) {
status = cr_parser_set_tknzr (result, a_tknzr);
@@ -2767,18 +2748,15 @@ cr_parser_new (CRTknzr * a_tknzr)
}
/**
- * cr_parser_new_from_buf:
- *@a_buf: the buffer to parse.
- *@a_len: the length of the data in the buffer.
- *@a_enc: the encoding of the input buffer a_buf.
- *@a_free_buf: if set to TRUE, a_buf will be freed
+ *Instanciates a new parser from a memory buffer.
+ *@param a_buf the buffer to parse.
+ *@param a_len the length of the data in the buffer.
+ *@param a_enc the encoding of the input buffer a_buf.
+ *@param a_free_buf if set to TRUE, a_buf will be freed
*during the destruction of the newly built instance
*of #CRParser. If set to FALSE, it is up to the caller to
*eventually free it.
- *
- *Instanciates a new parser from a memory buffer.
- *
- *Returns the newly built parser, or NULL if an error arises.
+ *@return the newly built parser, or NULL if an error arises.
*/
CRParser *
cr_parser_new_from_buf (guchar * a_buf,
@@ -2789,7 +2767,7 @@ cr_parser_new_from_buf (guchar * a_buf,
CRParser *result = NULL;
CRInput *input = NULL;
- g_return_val_if_fail (a_buf && a_len, NULL);
+ g_return_val_if_fail (a_buf, NULL);
input = cr_input_new_from_buf (a_buf, a_len, a_enc, a_free_buf);
g_return_val_if_fail (input, NULL);
@@ -2803,12 +2781,6 @@ cr_parser_new_from_buf (guchar * a_buf,
return result;
}
-/**
- * cr_parser_new_from_input:
- * @a_input: the parser input stream to use.
- *
- * Returns a newly built parser input.
- */
CRParser *
cr_parser_new_from_input (CRInput * a_input)
{
@@ -2826,13 +2798,6 @@ cr_parser_new_from_input (CRInput * a_input)
return result;
}
-/**
- * cr_parser_new_from_file:
- * @a_file_uri: the uri of the file to parse.
- * @a_enc: the file encoding to use.
- *
- * Returns the newly built parser.
- */
CRParser *
cr_parser_new_from_file (const guchar * a_file_uri, enum CREncoding a_enc)
{
@@ -2851,13 +2816,10 @@ cr_parser_new_from_file (const guchar * a_file_uri, enum CREncoding a_enc)
}
/**
- * cr_parser_set_sac_handler:
- *@a_this: the "this pointer" of the current instance of #CRParser.
- *@a_handler: the handler to set.
- *
*Sets a SAC document handler to the parser.
- *
- *Returns CR_OK upon successfull completion, an error code otherwise.
+ *@param a_this the "this pointer" of the current instance of #CRParser.
+ *@param a_handler the handler to set.
+ *@return CR_OK upon successfull completion, an error code otherwise.
*/
enum CRStatus
cr_parser_set_sac_handler (CRParser * a_this, CRDocHandler * a_handler)
@@ -2875,14 +2837,11 @@ cr_parser_set_sac_handler (CRParser * a_this, CRDocHandler * a_handler)
}
/**
- * cr_parser_get_sac_handler:
- *@a_this: the "this pointer" of the current instance of
- *#CRParser.
- *@a_handler: out parameter. The returned handler.
- *
*Gets the SAC document handler.
- *
- *Returns CR_OK upon successfull completion, an error code
+ *@param a_this the "this pointer" of the current instance of
+ *#CRParser.
+ *@param a_handler out parameter. The returned handler.
+ *@return CR_OK upon successfull completion, an error code
*otherwise.
*/
enum CRStatus
@@ -2896,13 +2855,10 @@ cr_parser_get_sac_handler (CRParser * a_this, CRDocHandler ** a_handler)
}
/**
- * cr_parser_set_default_sac_handler:
- *@a_this: a pointer to the current instance of #CRParser.
- *
*Sets the SAC handler associated to the current instance
*of #CRParser to the default SAC handler.
- *
- *Returns CR_OK upon successfull completion, an error code otherwise.
+ *@param a_this a pointer to the current instance of #CRParser.
+ *@return CR_OK upon successfull completion, an error code otherwise.
*/
enum CRStatus
cr_parser_set_default_sac_handler (CRParser * a_this)
@@ -2926,13 +2882,6 @@ cr_parser_set_default_sac_handler (CRParser * a_this)
return status;
}
-/**
- * cr_parser_set_use_core_grammar:
- * @a_this: the current instance of #CRParser.
- * @a_use_core_grammar: where to parse against the css core grammar.
- *
- * Returns CR_OK upon succesful completion, an error code otherwise.
- */
enum CRStatus
cr_parser_set_use_core_grammar (CRParser * a_this,
gboolean a_use_core_grammar)
@@ -2944,15 +2893,8 @@ cr_parser_set_use_core_grammar (CRParser * a_this,
return CR_OK;
}
-/**
- * cr_parser_get_use_core_grammar:
- * @a_this: the current instance of #CRParser.
- * @a_use_core_grammar: wether to use the core grammar or not.
- *
- * Returns CR_OK upon succesful completion, an error code otherwise.
- */
enum CRStatus
-cr_parser_get_use_core_grammar (CRParser const * a_this,
+cr_parser_get_use_core_grammar (CRParser * a_this,
gboolean * a_use_core_grammar)
{
g_return_val_if_fail (a_this && PRIVATE (a_this), CR_BAD_PARAM_ERROR);
@@ -2963,15 +2905,11 @@ cr_parser_get_use_core_grammar (CRParser const * a_this,
}
/**
- * cr_parser_parse_file:
- *@a_this: a pointer to the current instance of #CRParser.
- *@a_file_uri: the uri to the file to load. For the time being,
- *@a_enc: the encoding of the file to parse.
- *only local files are supported.
- *
*Parses a the given in parameter.
- *
- *Returns CR_OK upon successfull completion, an error code otherwise.
+ *@param a_this a pointer to the current instance of #CRParser.
+ *@param a_file_uri the uri to the file to load. For the time being,
+ *only local files are supported.
+ *@return CR_OK upon successfull completion, an error code otherwise.
*/
enum CRStatus
cr_parser_parse_file (CRParser * a_this,
@@ -2996,16 +2934,9 @@ cr_parser_parse_file (CRParser * a_this,
}
/**
- * cr_parser_parse_expr:
- * @a_this: the current instance of #CRParser.
- * @a_expr: out parameter. the parsed expression.
- *
*Parses an expression as defined by the css2 spec in appendix
*D.1:
*expr: term [ operator term ]*
- *
- *
- * Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
cr_parser_parse_expr (CRParser * a_this, CRTerm ** a_expr)
@@ -3027,7 +2958,7 @@ cr_parser_parse_expr (CRParser * a_this, CRTerm ** a_expr)
CHECK_PARSING_STATUS (status, FALSE);
for (;;) {
- guchar operator = 0;
+ guchar operatr = 0;
status = cr_tknzr_peek_byte (PRIVATE (a_this)->tknzr,
1, &next_byte);
@@ -3047,7 +2978,7 @@ cr_parser_parse_expr (CRParser * a_this, CRTerm ** a_expr)
}
if (next_byte == '/' || next_byte == ',') {
- READ_NEXT_BYTE (a_this, &operator);
+ READ_NEXT_BYTE (a_this, &operatr);
}
cr_parser_try_to_skip_spaces_and_comments (a_this);
@@ -3059,7 +2990,7 @@ cr_parser_parse_expr (CRParser * a_this, CRTerm ** a_expr)
break;
}
- switch (operator) {
+ switch (operatr) {
case '/':
expr2->the_operator = DIVIDE;
break;
@@ -3072,7 +3003,7 @@ cr_parser_parse_expr (CRParser * a_this, CRTerm ** a_expr)
expr = cr_term_append_term (expr, expr2);
expr2 = NULL;
- operator = 0;
+ operatr = 0;
nb_terms++;
}
@@ -3102,17 +3033,13 @@ cr_parser_parse_expr (CRParser * a_this, CRTerm ** a_expr)
}
/**
- * cr_parser_parse_prio:
- *@a_this: the current instance of #CRParser.
- *@a_prio: a string representing the priority.
- *Today, only "!important" is returned as only this
- *priority is defined by css2.
- *
*Parses a declaration priority as defined by
*the css2 grammar in appendix C:
*prio: IMPORTANT_SYM S*
- *
- * Returns CR_OK upon successful completion, an error code otherwise.
+ *@param a_this the current instance of #CRParser.
+ *@param a_prio a string representing the priority.
+ *Today, only "!important" is returned as only this
+ *priority is defined by css2.
*/
enum CRStatus
cr_parser_parse_prio (CRParser * a_this, CRString ** a_prio)
@@ -3151,19 +3078,17 @@ cr_parser_parse_prio (CRParser * a_this, CRString ** a_prio)
}
/**
- * cr_parser_parse_declaration:
- *@a_this: the "this pointer" of the current instance of #CRParser.
- *@a_property: the successfully parsed property. The caller
- * *must* free the returned pointer.
- *@a_expr: the expression that represents the attribute value.
- *The caller *must* free the returned pointer.
- *
*TODO: return the parsed priority, so that
*upper layers can take benefit from it.
*Parses a "declaration" as defined by the css2 spec in appendix D.1:
*declaration ::= [property ':' S* expr prio?]?
*
- *Returns CR_OK upon successfull completion, an error code otherwise.
+ *@param a_this the "this pointer" of the current instance of #CRParser.
+ *@param a_property the successfully parsed property. The caller
+ * *must* free the returned pointer.
+ *@param a_expr the expression that represents the attribute value.
+ *The caller *must* free the returned pointer.
+ *@return CR_OK upon successfull completion, an error code otherwise.
*/
enum CRStatus
cr_parser_parse_declaration (CRParser * a_this,
@@ -3189,7 +3114,7 @@ cr_parser_parse_declaration (CRParser * a_this,
CHECK_PARSING_STATUS_ERR
(a_this, status, FALSE,
- "while parsing declaration: next property is malformed",
+ (guchar *)"while parsing declaration: next property is malformed",
CR_SYNTAX_ERROR);
READ_NEXT_CHAR (a_this, &cur_char);
@@ -3198,7 +3123,7 @@ cr_parser_parse_declaration (CRParser * a_this,
status = CR_PARSING_ERROR;
cr_parser_push_error
(a_this,
- "while parsing declaration: this char must be ':'",
+ (guchar *)"while parsing declaration: this char must be ':'",
CR_SYNTAX_ERROR);
goto error;
}
@@ -3209,7 +3134,7 @@ cr_parser_parse_declaration (CRParser * a_this,
CHECK_PARSING_STATUS_ERR
(a_this, status, FALSE,
- "while parsing declaration: next expression is malformed",
+ (guchar *)"while parsing declaration: next expression is malformed",
CR_SYNTAX_ERROR);
cr_parser_try_to_skip_spaces_and_comments (a_this);
@@ -3250,14 +3175,11 @@ cr_parser_parse_declaration (CRParser * a_this,
}
/**
- * cr_parser_parse_statement_core:
- *@a_this: the current instance of #CRParser.
- *
*Parses a statement as defined by the css core grammar in
*chapter 4.1 of the css2 spec.
*statement : ruleset | at-rule;
- *
- *Returns CR_OK upon successfull completion, an error code otherwise.
+ *@param a_this the current instance of #CRParser.
+ *@return CR_OK upon successfull completion, an error code otherwise.
*/
enum CRStatus
cr_parser_parse_statement_core (CRParser * a_this)
@@ -3309,9 +3231,6 @@ cr_parser_parse_statement_core (CRParser * a_this)
}
/**
- * cr_parser_parse_ruleset:
- *@a_this: the "this pointer" of the current instance of #CRParser.
- *
*Parses a "ruleset" as defined in the css2 spec at appendix D.1.
*ruleset ::= selector [ ',' S* selector ]*
*'{' S* declaration? [ ';' S* declaration? ]* '}' S*;
@@ -3320,8 +3239,8 @@ cr_parser_parse_statement_core (CRParser * a_this)
*callbacks whenever it encounters some specific constructions.
*See the documentation of #CRDocHandler (the SAC handler) to know
*when which SAC handler is called.
- *
- *Returns CR_OK upon successfull completion, an error code otherwise.
+ *@param a_this the "this pointer" of the current instance of #CRParser.
+ *@return CR_OK upon successfull completion, an error code otherwise.
*/
enum CRStatus
cr_parser_parse_ruleset (CRParser * a_this)
@@ -3336,7 +3255,6 @@ cr_parser_parse_ruleset (CRParser * a_this)
CRSelector *selector = NULL;
gboolean start_selector = FALSE,
is_important = FALSE;
- CRParsingLocation end_parsing_location;
g_return_val_if_fail (a_this, CR_BAD_PARAM_ERROR);
@@ -3349,7 +3267,7 @@ cr_parser_parse_ruleset (CRParser * a_this)
ENSURE_PARSING_COND_ERR
(a_this, cur_char == '{',
- "while parsing rulset: current char should be '{'",
+ (guchar *)"while parsing rulset: current char should be '{'",
CR_SYNTAX_ERROR);
if (PRIVATE (a_this)->sac_handler
@@ -3413,7 +3331,7 @@ cr_parser_parse_ruleset (CRParser * a_this)
}
CHECK_PARSING_STATUS_ERR
(a_this, status, FALSE,
- "while parsing ruleset: next construction should be a declaration",
+ (guchar *)"while parsing ruleset: next construction should be a declaration",
CR_SYNTAX_ERROR);
for (;;) {
@@ -3451,14 +3369,12 @@ cr_parser_parse_ruleset (CRParser * a_this)
end_of_ruleset:
cr_parser_try_to_skip_spaces_and_comments (a_this);
- cr_parser_get_parsing_location (a_this, &end_parsing_location);
READ_NEXT_CHAR (a_this, &cur_char);
ENSURE_PARSING_COND_ERR
(a_this, cur_char == '}',
- "while parsing rulset: current char must be a '}'",
+ (guchar *)"while parsing rulset: current char must be a '}'",
CR_SYNTAX_ERROR);
- selector->location = end_parsing_location;
if (PRIVATE (a_this)->sac_handler
&& PRIVATE (a_this)->sac_handler->end_selector) {
PRIVATE (a_this)->sac_handler->end_selector
@@ -3515,29 +3431,29 @@ cr_parser_parse_ruleset (CRParser * a_this)
}
/**
- * cr_parser_parse_import:
- *@a_this: the "this pointer" of the current instance
+ *Parses an 'import' declaration as defined in the css2 spec
+ *in appendix D.1:
+ *
+ *import ::=
+ *@import [STRING|URI] S* [ medium [ ',' S* medium]* ]? ';' S*
+ *
+ *@param a_this the "this pointer" of the current instance
*of #CRParser.
- *@a_media_list: out parameter. A linked list of
+ *
+ *@param a_medium_list out parameter. A linked list of
*#CRString
*Each CRString is a string that contains
*a 'medium' declaration part of the successfully
*parsed 'import' declaration.
- *@a_import_string: out parameter.
+ *
+ *@param a_import_string out parameter.
*A string that contains the 'import
*string". The import string can be either an uri (if it starts with
*the substring "uri(") or a any other css2 string. Note that
* *a_import_string must be initially set to NULL or else, this function
*will return CR_BAD_PARAM_ERROR.
- *@a_location: the location (line, column) where the import has been parsed
*
- *Parses an 'import' declaration as defined in the css2 spec
- *in appendix D.1:
- *
- *import ::=
- *\@import [STRING|URI] S* [ medium [ ',' S* medium]* ]? ';' S*
- *
- *Returns CR_OK upon sucessfull completion, an error code otherwise.
+ *@return CR_OK upon sucessfull completion, an error code otherwise.
*/
enum CRStatus
cr_parser_parse_import (CRParser * a_this,
@@ -3662,7 +3578,7 @@ cr_parser_parse_import (CRParser * a_this,
*/
for (cur = *a_media_list; cur; cur = cur->next) {
if (cur->data) {
- cr_string_destroy (cur->data);
+ cr_string_destroy ((CRString *)cur->data);
}
}
@@ -3686,19 +3602,16 @@ cr_parser_parse_import (CRParser * a_this,
}
/**
- * cr_parser_parse_media:
- *@a_this: the "this pointer" of the current instance of #CRParser.
- *
*Parses a 'media' declaration as specified in the css2 spec at
*appendix D.1:
*
- *media ::= \@media S* medium [ ',' S* medium ]* '{' S* ruleset* '}' S*
+ *media ::= @media S* medium [ ',' S* medium ]* '{' S* ruleset* '}' S*
*
*Note that this function calls the required sac handlers during the parsing
*to notify media productions. See #CRDocHandler to know the callback called
- *during \@media parsing.
- *
- *Returns CR_OK upon successfull completion, an error code otherwise.
+ *during @media parsing.
+ *@param a_this the "this pointer" of the current instance of #CRParser.
+ *@return CR_OK upon successfull completion, an error code otherwise.
*/
enum CRStatus
cr_parser_parse_media (CRParser * a_this)
@@ -3710,7 +3623,7 @@ cr_parser_parse_media (CRParser * a_this)
cur_char = 0;
CRString *medium = NULL;
GList *media_list = NULL;
- CRParsingLocation location = {0} ;
+ CRParsingLocation location = {0,0,0} ;
g_return_val_if_fail (a_this
&& PRIVATE (a_this),
@@ -3816,7 +3729,7 @@ cr_parser_parse_media (CRParser * a_this)
GList *cur = NULL;
for (cur = media_list; cur; cur = cur->next) {
- cr_string_destroy (cur->data);
+ cr_string_destroy ((CRString *)cur->data);
}
g_list_free (media_list);
@@ -3844,7 +3757,7 @@ cr_parser_parse_media (CRParser * a_this)
GList *cur = NULL;
for (cur = media_list; cur; cur = cur->next) {
- cr_string_destroy (cur->data);
+ cr_string_destroy ((CRString *)cur->data);
}
g_list_free (media_list);
@@ -3857,18 +3770,15 @@ cr_parser_parse_media (CRParser * a_this)
}
/**
- * cr_parser_parse_page:
- *@a_this: the "this pointer" of the current instance of #CRParser.
- *
- *Parses '\@page' rule as specified in the css2 spec in appendix D.1:
+ *Parses '@page' rule as specified in the css2 spec in appendix D.1:
*page ::= PAGE_SYM S* IDENT? pseudo_page? S*
*'{' S* declaration [ ';' S* declaration ]* '}' S*
*
*This function also calls the relevant SAC handlers whenever it
*encounters a construction that must
*be reported to the calling application.
- *
- *Returns CR_OK upon successfull completion, an error code otherwise.
+ *@param a_this the "this pointer" of the current instance of #CRParser.
+ *@return CR_OK upon successfull completion, an error code otherwise.
*/
enum CRStatus
cr_parser_parse_page (CRParser * a_this)
@@ -3881,7 +3791,7 @@ cr_parser_parse_page (CRParser * a_this)
*page_pseudo_class = NULL,
*property = NULL;
gboolean important = TRUE;
- CRParsingLocation location = {0} ;
+ CRParsingLocation location = {0,0,0} ;
g_return_val_if_fail (a_this, CR_BAD_PARAM_ERROR);
@@ -4108,18 +4018,16 @@ cr_parser_parse_page (CRParser * a_this)
}
/**
- * cr_parser_parse_charset:
- *@a_this: the "this pointer" of the current instance of #CRParser.
- *@a_value: out parameter. The actual parsed value of the charset
- *declararation. Note that for safety check reasons, *a_value must be
- *set to NULL.
- *@a_charset_sym_location: the parsing location of the charset rule
- *
*Parses a charset declaration as defined implictly by the css2 spec in
*appendix D.1:
*charset ::= CHARSET_SYM S* STRING S* ';'
*
- *Returns CR_OK upon successfull completion, an error code otherwise.
+ *@param a_this the "this pointer" of the current instance of #CRParser.
+ *@param a_value out parameter. The actual parsed value of the charset
+ *declararation. Note that for safety check reasons, *a_value must be
+ *set to NULL.
+ *@param a_charset_sym_location the parsing location of
+ *@return CR_OK upon successfull completion, an error code otherwise.
*/
enum CRStatus
cr_parser_parse_charset (CRParser * a_this, CRString ** a_value,
@@ -4199,18 +4107,14 @@ cr_parser_parse_charset (CRParser * a_this, CRString ** a_value,
}
/**
- * cr_parser_parse_font_face:
- *@a_this: the current instance of #CRParser.
- *
- *Parses the "\@font-face" rule specified in the css1 spec in
+ *Parses the "@font-face" rule specified in the css1 spec in
*appendix D.1:
*
*font_face ::= FONT_FACE_SYM S*
*'{' S* declaration [ ';' S* declaration ]* '}' S*
*
*This function will call SAC handlers whenever it is necessary.
- *
- *Returns CR_OK upon successfull completion, an error code otherwise.
+ *@return CR_OK upon successfull completion, an error code otherwise.
*/
enum CRStatus
cr_parser_parse_font_face (CRParser * a_this)
@@ -4223,7 +4127,7 @@ cr_parser_parse_font_face (CRParser * a_this)
gboolean important = FALSE;
guint32 next_char = 0,
cur_char = 0;
- CRParsingLocation location = {0} ;
+ CRParsingLocation location = {0,0,0} ;
g_return_val_if_fail (a_this, CR_BAD_PARAM_ERROR);
@@ -4360,14 +4264,11 @@ cr_parser_parse_font_face (CRParser * a_this)
}
/**
- * cr_parser_parse:
- *@a_this: the current instance of #CRParser.
- *
*Parses the data that comes from the
*input previously associated to the current instance of
*#CRParser.
- *
- *Returns CR_OK upon succesful completion, an error code otherwise.
+ *@param a_this the current instance of #CRParser.
+ *@return CR_OK ;
*/
enum CRStatus
cr_parser_parse (CRParser * a_this)
@@ -4386,13 +4287,6 @@ cr_parser_parse (CRParser * a_this)
return status;
}
-/**
- * cr_parser_set_tknzr:
- * @a_this: the current instance of #CRParser;
- * @a_tknzr: the new tokenizer.
- *
- * Returns CR_OK upon successful completion, an error code otherwise.
- */
enum CRStatus
cr_parser_set_tknzr (CRParser * a_this, CRTknzr * a_tknzr)
{
@@ -4411,13 +4305,10 @@ cr_parser_set_tknzr (CRParser * a_this, CRTknzr * a_tknzr)
}
/**
- * cr_parser_get_tknzr:
- *@a_this: the current instance of #CRParser
- *@a_tknzr: out parameter. The returned tokenizer
- *
*Getter of the parser's underlying tokenizer
- *
- *Returns CR_OK upon succesful completion, an error code
+ *@param a_this the current instance of #CRParser
+ *@param a_tknzr out parameter. The returned tokenizer
+ *@return CR_OK upon succesful completion, an error code
*otherwise
*/
enum CRStatus
@@ -4431,17 +4322,14 @@ cr_parser_get_tknzr (CRParser * a_this, CRTknzr ** a_tknzr)
}
/**
- * cr_parser_get_parsing_location:
- *@a_this: the current instance of #CRParser
- *@a_loc: the parsing location to get.
- *
*Gets the current parsing location.
- *
- *Returns CR_OK upon succesful completion, an error code
+ *@param a_this the current instance of #CRParser
+ *@param a_loc the parsing location to get.
+ *@return CR_OK upon succesful completion, an error code
*otherwise.
*/
enum CRStatus
-cr_parser_get_parsing_location (CRParser const *a_this,
+cr_parser_get_parsing_location (CRParser *a_this,
CRParsingLocation *a_loc)
{
g_return_val_if_fail (a_this
@@ -4453,15 +4341,12 @@ cr_parser_get_parsing_location (CRParser const *a_this,
}
/**
- * cr_parser_parse_buf:
- *@a_this: the current instance of #CRparser
- *@a_buf: the input buffer
- *@a_len: the length of the input buffer
- *@a_enc: the encoding of the buffer
- *
*Parses a stylesheet from a buffer
- *
- *Returns CR_OK upon successful completion, an error code otherwise.
+ *@param a_this the current instance of #CRparser
+ *@param a_buf the input buffer
+ *@param a_len the length of the input buffer
+ *@param a_enc the encoding of the buffer
+ *@return CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
cr_parser_parse_buf (CRParser * a_this,
@@ -4487,12 +4372,10 @@ cr_parser_parse_buf (CRParser * a_this,
}
/**
- * cr_parser_destroy:
- *@a_this: the current instance of #CRParser to
- *destroy.
- *
*Destroys the current instance
*of #CRParser.
+ *@param a_this the current instance of #CRParser to
+ *destroy.
*/
void
cr_parser_destroy (CRParser * a_this)