From 2fcb157f28b152ba32e89baddbd811b0d6e76b79 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Mon, 4 Sep 2017 14:56:51 +0100 Subject: Strip trailing whitespace. --- src/parse/font_face.c | 120 ++++++------ src/parse/important.c | 24 +-- src/parse/language.c | 244 ++++++++++++------------- src/parse/language.h | 2 +- src/parse/parse.c | 206 ++++++++++----------- src/parse/parse.h | 8 +- src/parse/properties/azimuth.c | 16 +- src/parse/properties/background.c | 44 ++--- src/parse/properties/background_position.c | 42 ++--- src/parse/properties/border.c | 6 +- src/parse/properties/border_color.c | 16 +- src/parse/properties/border_spacing.c | 22 +-- src/parse/properties/border_style.c | 24 +-- src/parse/properties/border_width.c | 16 +- src/parse/properties/clip.c | 26 +-- src/parse/properties/content.c | 6 +- src/parse/properties/css_property_parser_gen.c | 26 +-- src/parse/properties/cue.c | 8 +- src/parse/properties/cursor.c | 14 +- src/parse/properties/elevation.c | 4 +- src/parse/properties/font.c | 70 +++---- src/parse/properties/font_family.c | 8 +- src/parse/properties/font_weight.c | 12 +- src/parse/properties/list_style.c | 30 +-- src/parse/properties/list_style_type.c | 8 +- src/parse/properties/margin.c | 16 +- src/parse/properties/opacity.c | 2 +- src/parse/properties/outline.c | 32 ++-- src/parse/properties/padding.c | 18 +- src/parse/properties/pause.c | 2 +- src/parse/properties/play_during.c | 18 +- src/parse/properties/properties.h | 222 +++++++++++----------- src/parse/properties/quotes.c | 22 +-- src/parse/properties/text_decoration.c | 4 +- src/parse/properties/utils.c | 58 +++--- src/parse/properties/utils.h | 8 +- src/parse/properties/voice_family.c | 6 +- src/parse/propstrings.h | 42 ++--- 38 files changed, 726 insertions(+), 726 deletions(-) (limited to 'src/parse') diff --git a/src/parse/font_face.c b/src/parse/font_face.c index 8eab006..f17d50e 100644 --- a/src/parse/font_face.c +++ b/src/parse/font_face.c @@ -15,22 +15,22 @@ #include "parse/properties/utils.h" #include "select/font_face.h" -static bool font_rule_font_family_reserved(css_language *c, +static bool font_rule_font_family_reserved(css_language *c, const css_token *ident) { bool match; return (lwc_string_caseless_isequal(ident->idata, c->strings[SERIF], &match) == lwc_error_ok && match) || - (lwc_string_caseless_isequal(ident->idata, - c->strings[SANS_SERIF], &match) == lwc_error_ok && + (lwc_string_caseless_isequal(ident->idata, + c->strings[SANS_SERIF], &match) == lwc_error_ok && match) || (lwc_string_caseless_isequal(ident->idata, c->strings[CURSIVE], &match) == lwc_error_ok && match) || (lwc_string_caseless_isequal(ident->idata, c->strings[FANTASY], &match) == lwc_error_ok && match) || - (lwc_string_caseless_isequal(ident->idata, - c->strings[MONOSPACE], &match) == lwc_error_ok && + (lwc_string_caseless_isequal(ident->idata, + c->strings[MONOSPACE], &match) == lwc_error_ok && match) || (lwc_string_caseless_isequal(ident->idata, c->strings[INHERIT], &match) == lwc_error_ok && match) || @@ -40,9 +40,9 @@ static bool font_rule_font_family_reserved(css_language *c, &match) == lwc_error_ok && match); } -static css_error font_face_parse_font_family(css_language *c, +static css_error font_face_parse_font_family(css_language *c, const parserutils_vector *vector, int *ctx, - css_font_face *font_face) + css_font_face *font_face) { css_error error; lwc_string *string; @@ -58,9 +58,9 @@ static css_error font_face_parse_font_family(css_language *c, return CSS_OK; } - -static css_error font_face_src_parse_format(css_language *c, - const parserutils_vector *vector, int *ctx, + +static css_error font_face_src_parse_format(css_language *c, + const parserutils_vector *vector, int *ctx, css_font_face_format *format) { bool match; @@ -68,8 +68,8 @@ static css_error font_face_src_parse_format(css_language *c, *format = CSS_FONT_FACE_FORMAT_UNSPECIFIED; - /* 'format(' STRING [ ',' STRING ]* ')' - * + /* 'format(' STRING [ ',' STRING ]* ')' + * * 'format(' already consumed */ @@ -80,27 +80,27 @@ static css_error font_face_src_parse_format(css_language *c, if (token == NULL || token->type != CSS_TOKEN_STRING) return CSS_INVALID; - if (lwc_string_isequal(token->idata, - c->strings[WOFF], &match) == lwc_error_ok && + if (lwc_string_isequal(token->idata, + c->strings[WOFF], &match) == lwc_error_ok && match) { *format |= CSS_FONT_FACE_FORMAT_WOFF; - } else if ((lwc_string_isequal(token->idata, + } else if ((lwc_string_isequal(token->idata, c->strings[TRUETYPE], &match) == lwc_error_ok && match) || - (lwc_string_isequal(token->idata, + (lwc_string_isequal(token->idata, c->strings[OPENTYPE], &match) == lwc_error_ok && match)) { *format |= CSS_FONT_FACE_FORMAT_OPENTYPE; - } else if (lwc_string_isequal(token->idata, - c->strings[EMBEDDED_OPENTYPE], + } else if (lwc_string_isequal(token->idata, + c->strings[EMBEDDED_OPENTYPE], &match) == lwc_error_ok && match) { *format |= CSS_FONT_FACE_FORMAT_EMBEDDED_OPENTYPE; - } else if (lwc_string_isequal(token->idata, - c->strings[SVG], &match) == lwc_error_ok && + } else if (lwc_string_isequal(token->idata, + c->strings[SVG], &match) == lwc_error_ok && match) { *format |= CSS_FONT_FACE_FORMAT_SVG; } else { - /* The spec gives a list of possible strings, which + /* The spec gives a list of possible strings, which * hints that unknown strings should be parse errors, * but it also talks about "unknown font formats", * so we treat any string we don't know not as a parse @@ -119,8 +119,8 @@ static css_error font_face_src_parse_format(css_language *c, return CSS_OK; } -static css_error font_face_src_parse_spec_or_name(css_language *c, - const parserutils_vector *vector, int *ctx, +static css_error font_face_src_parse_spec_or_name(css_language *c, + const parserutils_vector *vector, int *ctx, lwc_string **location, css_font_face_location_type *location_type, css_font_face_format *format) @@ -138,12 +138,12 @@ static css_error font_face_src_parse_spec_or_name(css_language *c, consumeWhitespace(vector, ctx); token = parserutils_vector_iterate(vector, ctx); - if (token == NULL) + if (token == NULL) return CSS_INVALID; if (token->type == CSS_TOKEN_URI) { error = c->sheet->resolve(c->sheet->resolve_pw, - c->sheet->url, token->idata, + c->sheet->url, token->idata, location); if (error != CSS_OK) return error; @@ -154,10 +154,10 @@ static css_error font_face_src_parse_spec_or_name(css_language *c, token = parserutils_vector_peek(vector, *ctx); if (token != NULL && token->type == CSS_TOKEN_FUNCTION && - lwc_string_caseless_isequal(token->idata, - c->strings[FORMAT], &match) == lwc_error_ok && + lwc_string_caseless_isequal(token->idata, + c->strings[FORMAT], &match) == lwc_error_ok && match) { - parserutils_vector_iterate(vector, ctx); + parserutils_vector_iterate(vector, ctx); error = font_face_src_parse_format(c, vector, ctx, format); @@ -167,8 +167,8 @@ static css_error font_face_src_parse_spec_or_name(css_language *c, } } } else if (token->type == CSS_TOKEN_FUNCTION && - lwc_string_caseless_isequal(token->idata, - c->strings[LOCAL], + lwc_string_caseless_isequal(token->idata, + c->strings[LOCAL], &match) == lwc_error_ok && match) { consumeWhitespace(vector, ctx); @@ -179,7 +179,7 @@ static css_error font_face_src_parse_spec_or_name(css_language *c, consumeWhitespace(vector, ctx); - token = parserutils_vector_iterate(vector, ctx); + token = parserutils_vector_iterate(vector, ctx); if (token == NULL || tokenIsChar(token, ')') == false) { lwc_string_unref(*location); return CSS_INVALID; @@ -193,8 +193,8 @@ static css_error font_face_src_parse_spec_or_name(css_language *c, return CSS_OK; } -static css_error font_face_parse_src(css_language *c, - const parserutils_vector *vector, int *ctx, +static css_error font_face_parse_src(css_language *c, + const parserutils_vector *vector, int *ctx, css_font_face *font_face) { int orig_ctx = *ctx; @@ -213,11 +213,11 @@ static css_error font_face_parse_src(css_language *c, /* Create one css_font_face_src for each consecutive location and * [potentially] type pair in the comma-separated list */ - do { + do { lwc_string *location; css_font_face_location_type location_type = CSS_FONT_FACE_LOCATION_TYPE_UNSPECIFIED; - css_font_face_format format = + css_font_face_format format = CSS_FONT_FACE_FORMAT_UNSPECIFIED; error = font_face_src_parse_spec_or_name(c, vector, ctx, @@ -225,10 +225,10 @@ static css_error font_face_parse_src(css_language *c, if (error != CSS_OK) goto cleanup; - /* This will be inefficient if there are a lot of locations - + /* This will be inefficient if there are a lot of locations - * probably not a problem in practice. */ - new_srcs = realloc(srcs, + new_srcs = realloc(srcs, (n_srcs + 1) * sizeof(css_font_face_src)); if (new_srcs == NULL) { error = CSS_NOMEM; @@ -240,7 +240,7 @@ static css_error font_face_parse_src(css_language *c, srcs[n_srcs].bits[0] = format << 2 | location_type; ++n_srcs; - + consumeWhitespace(vector, ctx); token = parserutils_vector_iterate(vector, ctx); } while (token != NULL && tokenIsChar(token, ',')); @@ -250,7 +250,7 @@ static css_error font_face_parse_src(css_language *c, cleanup: if (error != CSS_OK) { *ctx = orig_ctx; - if (srcs != NULL) + if (srcs != NULL) free(srcs); } @@ -273,16 +273,16 @@ static css_error font_face_parse_font_style(css_language *c, if ((token == NULL) || ((token->type != CSS_TOKEN_IDENT))) { *ctx = orig_ctx; return CSS_INVALID; - } - - if ((lwc_string_caseless_isequal(token->idata, + } + + if ((lwc_string_caseless_isequal(token->idata, c->strings[NORMAL], &match) == lwc_error_ok && match)) { style = CSS_FONT_STYLE_NORMAL; - } else if ((lwc_string_caseless_isequal(token->idata, + } else if ((lwc_string_caseless_isequal(token->idata, c->strings[ITALIC], &match) == lwc_error_ok && match)) { style = CSS_FONT_STYLE_ITALIC; - } else if ((lwc_string_caseless_isequal(token->idata, - c->strings[OBLIQUE], &match) == lwc_error_ok && + } else if ((lwc_string_caseless_isequal(token->idata, + c->strings[OBLIQUE], &match) == lwc_error_ok && match)) { style = CSS_FONT_STYLE_OBLIQUE; } else { @@ -294,12 +294,12 @@ static css_error font_face_parse_font_style(css_language *c, } else { *ctx = orig_ctx; } - + return error; } -static css_error font_face_parse_font_weight(css_language *c, - const parserutils_vector *vector, int *ctx, +static css_error font_face_parse_font_weight(css_language *c, + const parserutils_vector *vector, int *ctx, css_font_face *font_face) { int orig_ctx = *ctx; @@ -308,7 +308,7 @@ static css_error font_face_parse_font_weight(css_language *c, enum css_font_weight_e weight = 0; bool match; - /* NUMBER (100, 200, 300, 400, 500, 600, 700, 800, 900) | + /* NUMBER (100, 200, 300, 400, 500, 600, 700, 800, 900) | * IDENT (normal, bold) */ token = parserutils_vector_iterate(vector, ctx); if (token == NULL || (token->type != CSS_TOKEN_IDENT && @@ -319,7 +319,7 @@ static css_error font_face_parse_font_weight(css_language *c, if (token->type == CSS_TOKEN_NUMBER) { size_t consumed = 0; - css_fixed num = css__number_from_lwc_string(token->idata, + css_fixed num = css__number_from_lwc_string(token->idata, true, &consumed); /* Invalid if there are trailing characters */ if (consumed != lwc_string_length(token->idata)) { @@ -339,10 +339,10 @@ static css_error font_face_parse_font_weight(css_language *c, case 900: weight = CSS_FONT_WEIGHT_900; break; default: error = CSS_INVALID; } - } else if ((lwc_string_caseless_isequal(token->idata, + } else if ((lwc_string_caseless_isequal(token->idata, c->strings[NORMAL], &match) == lwc_error_ok && match)) { weight = CSS_FONT_WEIGHT_NORMAL; - } else if ((lwc_string_caseless_isequal(token->idata, + } else if ((lwc_string_caseless_isequal(token->idata, c->strings[BOLD], &match) == lwc_error_ok && match)) { weight = CSS_FONT_WEIGHT_BOLD; } else { @@ -350,7 +350,7 @@ static css_error font_face_parse_font_weight(css_language *c, } if (error == CSS_OK) { - font_face->bits[0] = (font_face->bits[0] & 0xc3) | + font_face->bits[0] = (font_face->bits[0] & 0xc3) | (weight << 2); } else { *ctx = orig_ctx; @@ -372,7 +372,7 @@ static css_error font_face_parse_font_weight(css_language *c, * CSS_INVALID on invalid syntax, * CSS_NOMEM on memory exhaustion */ -css_error css__parse_font_descriptor(css_language *c, +css_error css__parse_font_descriptor(css_language *c, const css_token *descriptor, const parserutils_vector *vector, int *ctx, css_rule_font_face *rule) { @@ -388,24 +388,24 @@ css_error css__parse_font_descriptor(css_language *c, rule->font_face = font_face; } - - if (lwc_string_caseless_isequal(descriptor->idata, - c->strings[FONT_FAMILY], &match) == lwc_error_ok && + + if (lwc_string_caseless_isequal(descriptor->idata, + c->strings[FONT_FAMILY], &match) == lwc_error_ok && match) { return font_face_parse_font_family(c, vector, ctx, font_face); } else if (lwc_string_caseless_isequal(descriptor->idata, c->strings[SRC], &match) == lwc_error_ok && match) { return font_face_parse_src(c, vector, ctx, font_face); } else if (lwc_string_caseless_isequal(descriptor->idata, - c->strings[FONT_STYLE], &match) == lwc_error_ok && + c->strings[FONT_STYLE], &match) == lwc_error_ok && match) { return font_face_parse_font_style(c, vector, ctx, font_face); } else if (lwc_string_caseless_isequal(descriptor->idata, - c->strings[FONT_WEIGHT], &match) == lwc_error_ok && + c->strings[FONT_WEIGHT], &match) == lwc_error_ok && match) { return font_face_parse_font_weight(c, vector, ctx, font_face); } - + return CSS_INVALID; } diff --git a/src/parse/important.c b/src/parse/important.c index 5589467..ca4d60c 100644 --- a/src/parse/important.c +++ b/src/parse/important.c @@ -100,9 +100,9 @@ void css__make_style_important(css_style *style) case CSS_PROP_BORDER_LEFT_COLOR: case CSS_PROP_BACKGROUND_COLOR: case CSS_PROP_COLUMN_RULE_COLOR: - assert(BACKGROUND_COLOR_SET == + assert(BACKGROUND_COLOR_SET == (enum op_background_color)BORDER_COLOR_SET); - assert(BACKGROUND_COLOR_SET == + assert(BACKGROUND_COLOR_SET == (enum op_background_color)COLUMN_RULE_COLOR_SET); if (value == BACKGROUND_COLOR_SET) @@ -113,14 +113,14 @@ void css__make_style_important(css_style *style) case CSS_PROP_CUE_AFTER: case CSS_PROP_CUE_BEFORE: case CSS_PROP_LIST_STYLE_IMAGE: - assert(BACKGROUND_IMAGE_URI == + assert(BACKGROUND_IMAGE_URI == (enum op_background_image)CUE_AFTER_URI); - assert(BACKGROUND_IMAGE_URI == + assert(BACKGROUND_IMAGE_URI == (enum op_background_image)CUE_BEFORE_URI); assert(BACKGROUND_IMAGE_URI == (enum op_background_image)LIST_STYLE_IMAGE_URI); - if (value == BACKGROUND_IMAGE_URI) + if (value == BACKGROUND_IMAGE_URI) offset++; /* string table entry */ break; @@ -143,7 +143,7 @@ void css__make_style_important(css_style *style) case CSS_PROP_BORDER_LEFT_WIDTH: case CSS_PROP_OUTLINE_WIDTH: case CSS_PROP_COLUMN_RULE_WIDTH: - assert(BORDER_WIDTH_SET == + assert(BORDER_WIDTH_SET == (enum op_border_width)OUTLINE_WIDTH_SET); assert(BORDER_WIDTH_SET == (enum op_border_width)COLUMN_RULE_WIDTH_SET); @@ -173,7 +173,7 @@ void css__make_style_important(css_style *style) assert(BOTTOM_SET == (enum op_bottom)COLUMN_WIDTH_SET); assert(BOTTOM_SET == (enum op_bottom)COLUMN_GAP_SET); - if (value == BOTTOM_SET) + if (value == BOTTOM_SET) offset += 2; /* length + units */ break; @@ -233,7 +233,7 @@ void css__make_style_important(css_style *style) case CSS_PROP_COUNTER_INCREMENT: case CSS_PROP_COUNTER_RESET: - assert(COUNTER_INCREMENT_NONE == + assert(COUNTER_INCREMENT_NONE == (enum op_counter_increment)COUNTER_RESET_NONE); while (value != COUNTER_INCREMENT_NONE) { @@ -273,13 +273,13 @@ void css__make_style_important(css_style *style) break; case CSS_PROP_FONT_SIZE: - if (value == FONT_SIZE_DIMENSION) + if (value == FONT_SIZE_DIMENSION) offset += 2; /* length + units */ break; case CSS_PROP_LETTER_SPACING: case CSS_PROP_WORD_SPACING: - assert(LETTER_SPACING_SET == + assert(LETTER_SPACING_SET == (enum op_letter_spacing)WORD_SPACING_SET); if (value == LETTER_SPACING_SET) @@ -300,7 +300,7 @@ void css__make_style_important(css_style *style) case CSS_PROP_MAX_HEIGHT: case CSS_PROP_MAX_WIDTH: - assert(MAX_HEIGHT_SET == + assert(MAX_HEIGHT_SET == (enum op_max_height)MAX_WIDTH_SET); if (value == MAX_HEIGHT_SET) @@ -370,7 +370,7 @@ void css__make_style_important(css_style *style) break; case CSS_PROP_SPEECH_RATE: - if (value == SPEECH_RATE_SET) + if (value == SPEECH_RATE_SET) offset++; /* rate */ break; diff --git a/src/parse/language.c b/src/parse/language.c index 11e2b2f..9af2547 100644 --- a/src/parse/language.c +++ b/src/parse/language.c @@ -29,43 +29,43 @@ typedef struct context_entry { } context_entry; /* Event handlers */ -static css_error language_handle_event(css_parser_event type, +static css_error language_handle_event(css_parser_event type, const parserutils_vector *tokens, void *pw); -static css_error handleStartStylesheet(css_language *c, +static css_error handleStartStylesheet(css_language *c, const parserutils_vector *vector); -static css_error handleEndStylesheet(css_language *c, +static css_error handleEndStylesheet(css_language *c, const parserutils_vector *vector); -static css_error handleStartRuleset(css_language *c, +static css_error handleStartRuleset(css_language *c, const parserutils_vector *vector); -static css_error handleEndRuleset(css_language *c, +static css_error handleEndRuleset(css_language *c, const parserutils_vector *vector); -static css_error handleStartAtRule(css_language *c, +static css_error handleStartAtRule(css_language *c, const parserutils_vector *vector); -static css_error handleEndAtRule(css_language *c, +static css_error handleEndAtRule(css_language *c, const parserutils_vector *vector); -static css_error handleStartBlock(css_language *c, +static css_error handleStartBlock(css_language *c, const parserutils_vector *vector); -static css_error handleEndBlock(css_language *c, +static css_error handleEndBlock(css_language *c, const parserutils_vector *vector); -static css_error handleBlockContent(css_language *c, +static css_error handleBlockContent(css_language *c, const parserutils_vector *vector); -static css_error handleDeclaration(css_language *c, +static css_error handleDeclaration(css_language *c, const parserutils_vector *vector); /* At-rule parsing */ static css_error parseMediaList(css_language *c, const parserutils_vector *vector, int *ctx, uint64_t *media); -static css_error addNamespace(css_language *c, +static css_error addNamespace(css_language *c, lwc_string *prefix, lwc_string *uri); -static css_error lookupNamespace(css_language *c, +static css_error lookupNamespace(css_language *c, lwc_string *prefix, lwc_string **uri); /* Selector list parsing */ static css_error parseClass(css_language *c, const parserutils_vector *vector, int *ctx, css_selector_detail *specific); -static css_error parseAttrib(css_language *c, +static css_error parseAttrib(css_language *c, const parserutils_vector *vector, int *ctx, css_selector_detail *specific); static css_error parseNth(css_language *c, @@ -83,19 +83,19 @@ static css_error parseAppendSpecific(css_language *c, static css_error parseSelectorSpecifics(css_language *c, const parserutils_vector *vector, int *ctx, css_selector **parent); -static css_error parseTypeSelector(css_language *c, - const parserutils_vector *vector, int *ctx, +static css_error parseTypeSelector(css_language *c, + const parserutils_vector *vector, int *ctx, css_qname *qname); -static css_error parseSimpleSelector(css_language *c, - const parserutils_vector *vector, int *ctx, +static css_error parseSimpleSelector(css_language *c, + const parserutils_vector *vector, int *ctx, css_selector **result); -static css_error parseCombinator(css_language *c, - const parserutils_vector *vector, int *ctx, +static css_error parseCombinator(css_language *c, + const parserutils_vector *vector, int *ctx, css_combinator *result); -static css_error parseSelector(css_language *c, - const parserutils_vector *vector, int *ctx, +static css_error parseSelector(css_language *c, + const parserutils_vector *vector, int *ctx, css_selector **result); -static css_error parseSelectorList(css_language *c, +static css_error parseSelectorList(css_language *c, const parserutils_vector *vector, css_rule *rule); /* Declaration parsing */ @@ -128,7 +128,7 @@ css_error css__language_create(css_stylesheet *sheet, css_parser *parser, if (c == NULL) return CSS_NOMEM; - perror = parserutils_stack_create(sizeof(context_entry), + perror = parserutils_stack_create(sizeof(context_entry), STACK_CHUNK, &c->context); if (perror != PARSERUTILS_OK) { free(c); @@ -165,7 +165,7 @@ css_error css__language_create(css_stylesheet *sheet, css_parser *parser, css_error css__language_destroy(css_language *language) { uint32_t i; - + if (language == NULL) return CSS_BADPARM; @@ -182,7 +182,7 @@ css_error css__language_destroy(css_language *language) } parserutils_stack_destroy(language->context); - + free(language); return CSS_OK; @@ -194,10 +194,10 @@ css_error css__language_destroy(css_language *language) * \param type The event type * \param tokens Vector of tokens read since last event, or NULL * \param pw Pointer to handler context - * \return CSS_OK on success, CSS_INVALID to indicate parse error, + * \return CSS_OK on success, CSS_INVALID to indicate parse error, * appropriate error otherwise. */ -css_error language_handle_event(css_parser_event type, +css_error language_handle_event(css_parser_event type, const parserutils_vector *tokens, void *pw) { css_language *language = (css_language *) pw; @@ -232,7 +232,7 @@ css_error language_handle_event(css_parser_event type, * Parser stages * ******************************************************************************/ -css_error handleStartStylesheet(css_language *c, +css_error handleStartStylesheet(css_language *c, const parserutils_vector *vector) { parserutils_error perror; @@ -315,7 +315,7 @@ css_error handleStartRuleset(css_language *c, const parserutils_vector *vector) return error; } - /* Flag that we've had a valid rule, so @import/@namespace/@charset + /* Flag that we've had a valid rule, so @import/@namespace/@charset * have no effect. */ c->state = HAD_RULE; @@ -364,11 +364,11 @@ css_error handleStartAtRule(css_language *c, const parserutils_vector *vector) consumeWhitespace(vector, &ctx); - /* We now have an ATKEYWORD and the context for the start of any0, if + /* We now have an ATKEYWORD and the context for the start of any0, if * there is one */ assert(atkeyword != NULL && atkeyword->type == CSS_TOKEN_ATKEYWORD); - if (lwc_string_caseless_isequal(atkeyword->idata, c->strings[CHARSET], + if (lwc_string_caseless_isequal(atkeyword->idata, c->strings[CHARSET], &match) == lwc_error_ok && match) { if (c->state == CHARSET_PERMITTED) { const css_token *charset; @@ -378,7 +378,7 @@ css_error handleStartAtRule(css_language *c, const parserutils_vector *vector) return CSS_INVALID; charset = parserutils_vector_iterate(vector, &ctx); - if (charset == NULL || + if (charset == NULL || charset->type != CSS_TOKEN_STRING) return CSS_INVALID; @@ -386,7 +386,7 @@ css_error handleStartAtRule(css_language *c, const parserutils_vector *vector) if (token != NULL) return CSS_INVALID; - error = css__stylesheet_rule_create(c->sheet, + error = css__stylesheet_rule_create(c->sheet, CSS_RULE_CHARSET, &rule); if (error != CSS_OK) return error; @@ -404,25 +404,25 @@ css_error handleStartAtRule(css_language *c, const parserutils_vector *vector) return error; } - /* Rule is now owned by the sheet, + /* Rule is now owned by the sheet, * so no need to destroy it */ c->state = IMPORT_PERMITTED; } else { return CSS_INVALID; } - } else if (lwc_string_caseless_isequal(atkeyword->idata, - c->strings[LIBCSS_IMPORT], &match) == lwc_error_ok && + } else if (lwc_string_caseless_isequal(atkeyword->idata, + c->strings[LIBCSS_IMPORT], &match) == lwc_error_ok && match) { if (c->state <= IMPORT_PERMITTED) { lwc_string *url; uint64_t media = 0; - /* any0 = (STRING | URI) ws + /* any0 = (STRING | URI) ws * (IDENT ws (',' ws IDENT ws)* )? */ - const css_token *uri = + const css_token *uri = parserutils_vector_iterate(vector, &ctx); - if (uri == NULL || (uri->type != CSS_TOKEN_STRING && + if (uri == NULL || (uri->type != CSS_TOKEN_STRING && uri->type != CSS_TOKEN_URI)) return CSS_INVALID; @@ -434,7 +434,7 @@ css_error handleStartAtRule(css_language *c, const parserutils_vector *vector) return error; /* Create rule */ - error = css__stylesheet_rule_create(c->sheet, + error = css__stylesheet_rule_create(c->sheet, CSS_RULE_IMPORT, &rule); if (error != CSS_OK) return error; @@ -463,7 +463,7 @@ css_error handleStartAtRule(css_language *c, const parserutils_vector *vector) c->sheet, url, media); if (error != CSS_OK) { lwc_string_unref(url); - css__stylesheet_rule_destroy(c->sheet, + css__stylesheet_rule_destroy(c->sheet, rule); return error; } @@ -479,15 +479,15 @@ css_error handleStartAtRule(css_language *c, const parserutils_vector *vector) return error; } - /* Rule is now owned by the sheet, + /* Rule is now owned by the sheet, * so no need to destroy it */ c->state = IMPORT_PERMITTED; } else { return CSS_INVALID; } - } else if (lwc_string_caseless_isequal(atkeyword->idata, - c->strings[NAMESPACE], &match) == lwc_error_ok && + } else if (lwc_string_caseless_isequal(atkeyword->idata, + c->strings[NAMESPACE], &match) == lwc_error_ok && match) { if (c->state <= NAMESPACE_PERMITTED) { lwc_string *prefix = NULL; @@ -503,7 +503,7 @@ css_error handleStartAtRule(css_language *c, const parserutils_vector *vector) consumeWhitespace(vector, &ctx); - token = parserutils_vector_iterate(vector, + token = parserutils_vector_iterate(vector, &ctx); } @@ -525,7 +525,7 @@ css_error handleStartAtRule(css_language *c, const parserutils_vector *vector) } else { return CSS_INVALID; } - } else if (lwc_string_caseless_isequal(atkeyword->idata, c->strings[MEDIA], + } else if (lwc_string_caseless_isequal(atkeyword->idata, c->strings[MEDIA], &match) == lwc_error_ok && match) { uint64_t media = 0; @@ -535,7 +535,7 @@ css_error handleStartAtRule(css_language *c, const parserutils_vector *vector) if (error != CSS_OK) return error; - error = css__stylesheet_rule_create(c->sheet, + error = css__stylesheet_rule_create(c->sheet, CSS_RULE_MEDIA, &rule); if (error != CSS_OK) return error; @@ -552,18 +552,18 @@ css_error handleStartAtRule(css_language *c, const parserutils_vector *vector) return error; } - /* Rule is now owned by the sheet, + /* Rule is now owned by the sheet, * so no need to destroy it */ c->state = HAD_RULE; - } else if (lwc_string_caseless_isequal(atkeyword->idata, - c->strings[FONT_FACE], &match) == lwc_error_ok && + } else if (lwc_string_caseless_isequal(atkeyword->idata, + c->strings[FONT_FACE], &match) == lwc_error_ok && match) { error = css__stylesheet_rule_create(c->sheet, CSS_RULE_FONT_FACE, &rule); if (error != CSS_OK) return error; - + consumeWhitespace(vector, &ctx); error = css__stylesheet_add_rule(c->sheet, rule, NULL); @@ -572,11 +572,11 @@ css_error handleStartAtRule(css_language *c, const parserutils_vector *vector) return error; } - /* Rule is now owned by the sheet, + /* Rule is now owned by the sheet, * so no need to destroy it */ c->state = HAD_RULE; - } else if (lwc_string_caseless_isequal(atkeyword->idata, c->strings[PAGE], + } else if (lwc_string_caseless_isequal(atkeyword->idata, c->strings[PAGE], &match) == lwc_error_ok && match) { const css_token *token; @@ -614,7 +614,7 @@ css_error handleStartAtRule(css_language *c, const parserutils_vector *vector) return error; } - /* Rule is now owned by the sheet, + /* Rule is now owned by the sheet, * so no need to destroy it */ c->state = HAD_RULE; @@ -661,7 +661,7 @@ css_error handleStartBlock(css_language *c, const parserutils_vector *vector) UNUSED(vector); - /* If the current item on the stack isn't a block, + /* If the current item on the stack isn't a block, * then clone its data field. This ensures that the relevant rule * is available when parsing the block contents. */ cur = parserutils_stack_get_current(c->context); @@ -693,7 +693,7 @@ css_error handleEndBlock(css_language *c, const parserutils_vector *vector) return css_error_from_parserutils_error(perror); } - /* If the block we just popped off the stack was associated with a + /* If the block we just popped off the stack was associated with a * non-block stack entry, and that entry is not a top-level statement, * then report the end of that entry, too. */ if (rule != NULL && rule->ptype != CSS_RULE_PARENT_STYLESHEET) { @@ -718,9 +718,9 @@ css_error handleBlockContent(css_language *c, const parserutils_vector *vector) return CSS_INVALID; rule = entry->data; - if (rule == NULL || (rule->type != CSS_RULE_SELECTOR && + if (rule == NULL || (rule->type != CSS_RULE_SELECTOR && rule->type != CSS_RULE_PAGE && - rule->type != CSS_RULE_MEDIA && + rule->type != CSS_RULE_MEDIA && rule->type != CSS_RULE_FONT_FACE)) return CSS_INVALID; @@ -754,16 +754,16 @@ css_error handleDeclaration(css_language *c, const parserutils_vector *vector) return CSS_INVALID; rule = entry->data; - if (rule == NULL || (rule->type != CSS_RULE_SELECTOR && - rule->type != CSS_RULE_PAGE && + if (rule == NULL || (rule->type != CSS_RULE_SELECTOR && + rule->type != CSS_RULE_PAGE && rule->type != CSS_RULE_FONT_FACE)) return CSS_INVALID; /* Strip any leading whitespace (can happen if in nested block) */ consumeWhitespace(vector, &ctx); - /* IDENT ws ':' ws value - * + /* IDENT ws ':' ws value + * * In CSS 2.1, value is any1, so '{' or ATKEYWORD => parse error */ ident = parserutils_vector_iterate(vector, &ctx); @@ -809,47 +809,47 @@ css_error parseMediaList(css_language *c, if (token->type != CSS_TOKEN_IDENT) return CSS_INVALID; - if (lwc_string_caseless_isequal(token->idata, c->strings[AURAL], + if (lwc_string_caseless_isequal(token->idata, c->strings[AURAL], &match) == lwc_error_ok && match) { ret |= CSS_MEDIA_AURAL; } else if (lwc_string_caseless_isequal( - token->idata, c->strings[BRAILLE], + token->idata, c->strings[BRAILLE], &match) == lwc_error_ok && match) { ret |= CSS_MEDIA_BRAILLE; } else if (lwc_string_caseless_isequal( - token->idata, c->strings[EMBOSSED], + token->idata, c->strings[EMBOSSED], &match) == lwc_error_ok && match) { ret |= CSS_MEDIA_EMBOSSED; } else if (lwc_string_caseless_isequal( - token->idata, c->strings[HANDHELD], + token->idata, c->strings[HANDHELD], &match) == lwc_error_ok && match) { ret |= CSS_MEDIA_HANDHELD; } else if (lwc_string_caseless_isequal( - token->idata, c->strings[PRINT], + token->idata, c->strings[PRINT], &match) == lwc_error_ok && match) { ret |= CSS_MEDIA_PRINT; } else if (lwc_string_caseless_isequal( - token->idata, c->strings[PROJECTION], + token->idata, c->strings[PROJECTION], &match) == lwc_error_ok && match) { ret |= CSS_MEDIA_PROJECTION; } else if (lwc_string_caseless_isequal( - token->idata, c->strings[SCREEN], + token->idata, c->strings[SCREEN], &match) == lwc_error_ok && match) { ret |= CSS_MEDIA_SCREEN; } else if (lwc_string_caseless_isequal( - token->idata, c->strings[SPEECH], + token->idata, c->strings[SPEECH], &match) == lwc_error_ok && match) { ret |= CSS_MEDIA_SPEECH; } else if (lwc_string_caseless_isequal( - token->idata, c->strings[TTY], + token->idata, c->strings[TTY], &match) == lwc_error_ok && match) { ret |= CSS_MEDIA_TTY; } else if (lwc_string_caseless_isequal( - token->idata, c->strings[TV], + token->idata, c->strings[TV], &match) == lwc_error_ok && match) { ret |= CSS_MEDIA_TV; } else if (lwc_string_caseless_isequal( - token->idata, c->strings[ALL], + token->idata, c->strings[ALL], &match) == lwc_error_ok && match) { ret |= CSS_MEDIA_ALL; } else @@ -864,7 +864,7 @@ css_error parseMediaList(css_language *c, consumeWhitespace(vector, ctx); } - /* If, after parsing the media list, we still have no media, + /* If, after parsing the media list, we still have no media, * then it must be ALL. */ if (ret == 0) ret = CSS_MEDIA_ALL; @@ -908,8 +908,8 @@ css_error addNamespace(css_language *c, lwc_string *prefix, lwc_string *uri) if (idx == c->num_namespaces) { /* Not found, create a new mapping */ - css_namespace *ns = realloc(c->namespaces, - sizeof(css_namespace) * + css_namespace *ns = realloc(c->namespaces, + sizeof(css_namespace) * (c->num_namespaces + 1)); if (ns == NULL) @@ -972,7 +972,7 @@ css_error lookupNamespace(css_language *c, lwc_string *prefix, lwc_string **uri) * Selector list parsing functions * ******************************************************************************/ -css_error parseClass(css_language *c, const parserutils_vector *vector, +css_error parseClass(css_language *c, const parserutils_vector *vector, int *ctx, css_selector_detail *specific) { css_qname qname; @@ -998,12 +998,12 @@ css_error parseClass(css_language *c, const parserutils_vector *vector, lwc__intern_caseless_string(qname.name) != lwc_error_ok) return CSS_NOMEM; - return css__stylesheet_selector_detail_init(c->sheet, + return css__stylesheet_selector_detail_init(c->sheet, CSS_SELECTOR_CLASS, &qname, detail_value, CSS_SELECTOR_DETAIL_VALUE_STRING, false, specific); } -css_error parseAttrib(css_language *c, const parserutils_vector *vector, +css_error parseAttrib(css_language *c, const parserutils_vector *vector, int *ctx, css_selector_detail *specific) { css_qname qname; @@ -1014,12 +1014,12 @@ css_error parseAttrib(css_language *c, const parserutils_vector *vector, lwc_string *prefix = NULL; /* attrib -> '[' ws namespace_prefix? IDENT ws [ - * [ '=' | - * INCLUDES | - * DASHMATCH | + * [ '=' | + * INCLUDES | + * DASHMATCH | * PREFIXMATCH | - * SUFFIXMATCH | - * SUBSTRINGMATCH + * SUFFIXMATCH | + * SUBSTRINGMATCH * ] ws * [ IDENT | STRING ] ws ]? ']' * namespace_prefix -> [ IDENT | '*' ]? '|' @@ -1100,8 +1100,8 @@ css_error parseAttrib(css_language *c, const parserutils_vector *vector, detail_value.string = value != NULL ? value->idata : NULL; - return css__stylesheet_selector_detail_init(c->sheet, type, - &qname, detail_value, + return css__stylesheet_selector_detail_init(c->sheet, type, + &qname, detail_value, CSS_SELECTOR_DETAIL_VALUE_STRING, false, specific); } @@ -1178,7 +1178,7 @@ css_error parseNth(css_language *c, data += 1; len -= 1; } else { - if (data[0] != '-' || + if (data[0] != '-' || (data[1] != 'n' && data[1] != 'N')) return CSS_INVALID; @@ -1204,7 +1204,7 @@ css_error parseNth(css_language *c, /* -n-b */ b = css__number_from_string( - (const uint8_t *) data + 1, + (const uint8_t *) data + 1, len - 1, true, &consumed); @@ -1216,7 +1216,7 @@ css_error parseNth(css_language *c, } } else { /* 2n */ - a = css__number_from_lwc_string(token->idata, + a = css__number_from_lwc_string(token->idata, true, &consumed); if (consumed == 0 || (data[consumed] != 'n' && data[consumed] != 'N')) @@ -1306,7 +1306,7 @@ css_error parseNth(css_language *c, return CSS_OK; } -css_error parsePseudo(css_language *c, const parserutils_vector *vector, +css_error parsePseudo(css_language *c, const parserutils_vector *vector, int *ctx, bool in_not, css_selector_detail *specific) { static const struct @@ -1347,7 +1347,7 @@ css_error parsePseudo(css_language *c, const parserutils_vector *vector, { AFTER, CSS_SELECTOR_PSEUDO_ELEMENT } }; css_selector_detail_value detail_value; - css_selector_detail_value_type value_type = + css_selector_detail_value_type value_type = CSS_SELECTOR_DETAIL_VALUE_STRING; css_qname qname; const css_token *token; @@ -1375,7 +1375,7 @@ css_error parsePseudo(css_language *c, const parserutils_vector *vector, } /* Expect IDENT or FUNCTION */ - if (token == NULL || (token->type != CSS_TOKEN_IDENT && + if (token == NULL || (token->type != CSS_TOKEN_IDENT && token->type != CSS_TOKEN_FUNCTION)) return CSS_INVALID; @@ -1384,7 +1384,7 @@ css_error parsePseudo(css_language *c, const parserutils_vector *vector, /* Search lut for selector type */ for (lut_idx = 0; lut_idx < N_ELEMENTS(pseudo_lut); lut_idx++) { - if ((lwc_string_caseless_isequal(qname.name, + if ((lwc_string_caseless_isequal(qname.name, c->strings[pseudo_lut[lut_idx].index], &match) == lwc_error_ok) && match) { type = pseudo_lut[lut_idx].type; @@ -1401,7 +1401,7 @@ css_error parsePseudo(css_language *c, const parserutils_vector *vector, return CSS_INVALID; /* :not() and pseudo elements are not permitted in :not() */ - if (in_not && (type == CSS_SELECTOR_PSEUDO_ELEMENT || + if (in_not && (type == CSS_SELECTOR_PSEUDO_ELEMENT || pseudo_lut[lut_idx].index == NOT)) return CSS_INVALID; @@ -1420,9 +1420,9 @@ css_error parsePseudo(css_language *c, const parserutils_vector *vector, value_type = CSS_SELECTOR_DETAIL_VALUE_STRING; consumeWhitespace(vector, ctx); - } else if (fun_type == NTH_CHILD || - fun_type == NTH_LAST_CHILD || - fun_type == NTH_OF_TYPE || + } else if (fun_type == NTH_CHILD || + fun_type == NTH_LAST_CHILD || + fun_type == NTH_OF_TYPE || fun_type == NTH_LAST_OF_TYPE) { /* an + b */ error = parseNth(c, vector, ctx, &detail_value); @@ -1436,11 +1436,11 @@ css_error parsePseudo(css_language *c, const parserutils_vector *vector, if (token == NULL) return CSS_INVALID; - if (token->type == CSS_TOKEN_IDENT || + if (token->type == CSS_TOKEN_IDENT || tokenIsChar(token, '*') || tokenIsChar(token, '|')) { /* Have type selector */ - error = parseTypeSelector(c, vector, ctx, + error = parseTypeSelector(c, vector, ctx, &qname); if (error != CSS_OK) return error; @@ -1460,7 +1460,7 @@ css_error parsePseudo(css_language *c, const parserutils_vector *vector, /* specific */ css_selector_detail det; - error = parseSpecific(c, vector, ctx, true, + error = parseSpecific(c, vector, ctx, true, &det); if (error != CSS_OK) return error; @@ -1481,8 +1481,8 @@ css_error parsePseudo(css_language *c, const parserutils_vector *vector, return CSS_INVALID; } - return css__stylesheet_selector_detail_init(c->sheet, - type, &qname, detail_value, value_type, + return css__stylesheet_selector_detail_init(c->sheet, + type, &qname, detail_value, value_type, negate, specific); } @@ -1516,7 +1516,7 @@ css_error parseSpecific(css_language *c, error = css__stylesheet_selector_detail_init(c->sheet, CSS_SELECTOR_ID, &qname, detail_value, - CSS_SELECTOR_DETAIL_VALUE_STRING, false, + CSS_SELECTOR_DETAIL_VALUE_STRING, false, specific); if (error != CSS_OK) return error; @@ -1541,7 +1541,7 @@ css_error parseSpecific(css_language *c, return CSS_OK; } -css_error parseAppendSpecific(css_language *c, +css_error parseAppendSpecific(css_language *c, const parserutils_vector *vector, int *ctx, css_selector **parent) { @@ -1552,7 +1552,7 @@ css_error parseAppendSpecific(css_language *c, if (error != CSS_OK) return error; - return css__stylesheet_selector_append_specific(c->sheet, parent, + return css__stylesheet_selector_append_specific(c->sheet, parent, &specific); } @@ -1565,7 +1565,7 @@ css_error parseSelectorSpecifics(css_language *c, /* specifics -> specific* */ while ((token = parserutils_vector_peek(vector, *ctx)) != NULL && - token->type != CSS_TOKEN_S && + token->type != CSS_TOKEN_S && tokenIsChar(token, '+') == false && tokenIsChar(token, '>') == false && tokenIsChar(token, '~') == false && @@ -1639,8 +1639,8 @@ css_error parseTypeSelector(css_language *c, const parserutils_vector *vector, return CSS_OK; } -css_error parseSimpleSelector(css_language *c, - const parserutils_vector *vector, int *ctx, +css_error parseSimpleSelector(css_language *c, + const parserutils_vector *vector, int *ctx, css_selector **result) { int orig_ctx = *ctx; @@ -1746,7 +1746,7 @@ css_error parseCombinator(css_language *c, const parserutils_vector *vector, return CSS_OK; } -css_error parseSelector(css_language *c, const parserutils_vector *vector, +css_error parseSelector(css_language *c, const parserutils_vector *vector, int *ctx, css_selector **result) { css_error error; @@ -1754,10 +1754,10 @@ css_error parseSelector(css_language *c, const parserutils_vector *vector, css_selector *selector = NULL; /* selector -> simple_selector [ combinator simple_selector ]* ws - * + * * Note, however, that, as combinator can be wholly whitespace, - * there's an ambiguity as to whether "ws" has been reached. We - * resolve this by attempting to extract a combinator, then + * there's an ambiguity as to whether "ws" has been reached. We + * resolve this by attempting to extract a combinator, then * recovering when we detect that we've reached the end of the * selector. */ @@ -1778,13 +1778,13 @@ css_error parseSelector(css_language *c, const parserutils_vector *vector, /* In the case of "html , body { ... }", the whitespace after * "html" and "body" will be considered an ancestor combinator. - * This clearly is not the case, however. Therefore, as a - * special case, if we've got an ancestor combinator and there + * This clearly is not the case, however. Therefore, as a + * special case, if we've got an ancestor combinator and there * are no further tokens, or if the next token is a comma, * we ignore the supposed combinator and continue. */ - if (comb == CSS_COMBINATOR_ANCESTOR && - ((token = parserutils_vector_peek(vector, - *ctx)) == NULL || + if (comb == CSS_COMBINATOR_ANCESTOR && + ((token = parserutils_vector_peek(vector, + *ctx)) == NULL || tokenIsChar(token, ','))) continue; @@ -1847,7 +1847,7 @@ css_error parseSelectorList(css_language *c, const parserutils_vector *vector, error = parseSelector(c, vector, &ctx, &selector); if (error != CSS_OK) { if (selector != NULL) { - css__stylesheet_selector_destroy(c->sheet, + css__stylesheet_selector_destroy(c->sheet, selector); } return error; @@ -1855,7 +1855,7 @@ css_error parseSelectorList(css_language *c, const parserutils_vector *vector, assert(selector != NULL); - error = css__stylesheet_rule_add_selector(c->sheet, rule, + error = css__stylesheet_rule_add_selector(c->sheet, rule, selector); if (error != CSS_OK) { css__stylesheet_selector_destroy(c->sheet, selector); @@ -1870,7 +1870,7 @@ css_error parseSelectorList(css_language *c, const parserutils_vector *vector, * Property parsing functions * ******************************************************************************/ -css_error parseProperty(css_language *c, const css_token *property, +css_error parseProperty(css_language *c, const css_token *property, const parserutils_vector *vector, int *ctx, css_rule *rule) { css_error error; @@ -1898,7 +1898,7 @@ css_error parseProperty(css_language *c, const css_token *property, /* allocate style */ error = css__stylesheet_style_create(c->sheet, &style); - if (error != CSS_OK) + if (error != CSS_OK) return error; assert (style != NULL); diff --git a/src/parse/language.h b/src/parse/language.h index f7c8536..2ab4987 100644 --- a/src/parse/language.h +++ b/src/parse/language.h @@ -84,7 +84,7 @@ static inline bool tokenIsChar(const css_token *token, uint8_t c) { bool result = false; - if (token != NULL && token->type == CSS_TOKEN_CHAR && + if (token != NULL && token->type == CSS_TOKEN_CHAR && lwc_string_length(token->idata) == 1) { char d = lwc_string_data(token->idata)[0]; diff --git a/src/parse/parse.c b/src/parse/parse.c index b65b0f5..68492d4 100644 --- a/src/parse/parse.c +++ b/src/parse/parse.c @@ -107,8 +107,8 @@ struct css_parser void *event_pw; /**< Client data for event handler */ }; -static css_error css__parser_create_internal(const char *charset, - css_charset_source cs_source, parser_state initial, +static css_error css__parser_create_internal(const char *charset, + css_charset_source cs_source, parser_state initial, css_parser **parser); static css_error transition(css_parser *parser, parser_state to, @@ -280,7 +280,7 @@ css_error css__parser_setopt(css_parser *parser, css_parser_opttype type, * \param len Length of chunk * \return CSS_OK on success, appropriate error otherwise */ -css_error css__parser_parse_chunk(css_parser *parser, const uint8_t *data, +css_error css__parser_parse_chunk(css_parser *parser, const uint8_t *data, size_t len) { parserutils_error perror; @@ -344,7 +344,7 @@ css_error css__parser_completed(css_parser *parser) * \param source Pointer to location to receive charset source * \return Pointer to charset name (constant; do not free) */ -const char *css__parser_read_charset(css_parser *parser, +const char *css__parser_read_charset(css_parser *parser, css_charset_source *source) { const char *charset; @@ -386,8 +386,8 @@ bool css__parser_quirks_permitted(css_parser *parser) * CSS_BADPARM on bad parameters, * CSS_NOMEM on memory exhaustion */ -css_error css__parser_create_internal(const char *charset, - css_charset_source cs_source, parser_state initial, +css_error css__parser_create_internal(const char *charset, + css_charset_source cs_source, parser_state initial, css_parser **parser) { css_parser *p; @@ -415,7 +415,7 @@ css_error css__parser_create_internal(const char *charset, return error; } - perror = parserutils_stack_create(sizeof(parser_state), + perror = parserutils_stack_create(sizeof(parser_state), STACK_CHUNK, &p->states); if (perror != PARSERUTILS_OK) { css__lexer_destroy(p->lexer); @@ -424,7 +424,7 @@ css_error css__parser_create_internal(const char *charset, return css_error_from_parserutils_error(perror); } - perror = parserutils_vector_create(sizeof(css_token), + perror = parserutils_vector_create(sizeof(css_token), STACK_CHUNK, &p->tokens); if (perror != PARSERUTILS_OK) { parserutils_stack_destroy(p->states); @@ -434,7 +434,7 @@ css_error css__parser_create_internal(const char *charset, return css_error_from_parserutils_error(perror); } - perror = parserutils_stack_create(sizeof(char), + perror = parserutils_stack_create(sizeof(char), STACK_CHUNK, &p->open_items); if (perror != PARSERUTILS_OK) { parserutils_vector_destroy(p->tokens); @@ -481,7 +481,7 @@ css_error css__parser_create_internal(const char *charset, * \param subsequent The state to return to * \return CSS_OK on success, appropriate error otherwise */ -css_error transition(css_parser *parser, parser_state to, +css_error transition(css_parser *parser, parser_state to, parser_state subsequent) { parser_state *state = parserutils_stack_get_current(parser->states); @@ -556,7 +556,7 @@ css_error done(css_parser *parser) /** * Assert that the expected token is next in the input - * + * * \param parser The parser instance * \param type The expected token type * \return CSS_OK on success, appropriate error otherwise @@ -638,7 +638,7 @@ css_error getToken(css_parser *parser, const css_token **token) } /* Append token to vector */ - perror = parserutils_vector_append(parser->tokens, + perror = parserutils_vector_append(parser->tokens, (css_token *) (*token)); if (perror != PARSERUTILS_OK) return css_error_from_parserutils_error(perror); @@ -661,7 +661,7 @@ css_error pushBack(css_parser *parser, const css_token *token) /* The pushback buffer depth is 1 token. Assert this. */ assert(parser->pushback == NULL); - + perror = parserutils_vector_remove_last(parser->tokens); if (perror != PARSERUTILS_OK) return css_error_from_parserutils_error(perror); @@ -713,7 +713,7 @@ css_error parseStart(css_parser *parser) printf("Begin stylesheet\n"); #endif if (parser->event != NULL) { - parser->event(CSS_PARSER_START_STYLESHEET, NULL, + parser->event(CSS_PARSER_START_STYLESHEET, NULL, parser->event_pw); } @@ -742,10 +742,10 @@ css_error parseStart(css_parser *parser) printf("End stylesheet\n"); #endif if (parser->event != NULL) { - parser->event(CSS_PARSER_END_STYLESHEET, NULL, + parser->event(CSS_PARSER_END_STYLESHEET, NULL, parser->event_pw); } - + unref_interned_strings_in_tokens(parser); parserutils_vector_clear(parser->tokens); @@ -843,7 +843,7 @@ css_error parseRuleset(css_parser *parser) const css_token *token; css_error error; - /* ruleset -> selector '{' ws ruleset-end + /* ruleset -> selector '{' ws ruleset-end * -> '{' ws ruleset-end */ @@ -856,20 +856,20 @@ css_error parseRuleset(css_parser *parser) if (error != CSS_OK) return error; - /* The grammar's ambiguous here -- selectors may start with a - * brace. We're going to assume that that won't happen, + /* The grammar's ambiguous here -- selectors may start with a + * brace. We're going to assume that that won't happen, * however. */ - if (token->type == CSS_TOKEN_CHAR && - lwc_string_length(token->idata) == 1 && + if (token->type == CSS_TOKEN_CHAR && + lwc_string_length(token->idata) == 1 && lwc_string_data(token->idata)[0] == '{') { #if !defined(NDEBUG) && defined(DEBUG_EVENTS) printf("Begin ruleset\n"); #endif if (parser->event != NULL) { - if (parser->event(CSS_PARSER_START_RULESET, - NULL, parser->event_pw) == + if (parser->event(CSS_PARSER_START_RULESET, + NULL, parser->event_pw) == CSS_INVALID) { - parser_state to = + parser_state to = { sMalformedSelector, Initial }; return transitionNoRet(parser, to); @@ -895,7 +895,7 @@ css_error parseRuleset(css_parser *parser) parserutils_vector_dump(parser->tokens, __func__, tprinter); #endif if (parser->parseError == false && parser->event != NULL) { - if (parser->event(CSS_PARSER_START_RULESET, + if (parser->event(CSS_PARSER_START_RULESET, parser->tokens, parser->event_pw) == CSS_INVALID) parser->parseError = true; @@ -919,14 +919,14 @@ css_error parseRuleset(css_parser *parser) return done(parser); } - if (token->type != CSS_TOKEN_CHAR || + if (token->type != CSS_TOKEN_CHAR || lwc_string_length(token->idata) != 1 || lwc_string_data(token->idata)[0] != '{') { - /* This should never happen, as FOLLOW(selector) + /* This should never happen, as FOLLOW(selector) * contains only '{' */ assert(0 && "Expected {"); } - + state->substate = WS; /* Fall through */ case WS: @@ -948,7 +948,7 @@ css_error parseRulesetEnd(css_parser *parser) const css_token *token; css_error error; - /* ruleset-end -> declaration decl-list '}' ws + /* ruleset-end -> declaration decl-list '}' ws * -> decl-list '}' ws */ @@ -969,7 +969,7 @@ css_error parseRulesetEnd(css_parser *parser) * attempt to parse a declaration. This will catch any invalid * input at this point and read to the start of the next * declaration. FIRST(decl-list) = (';', '}') */ - if (token->type != CSS_TOKEN_CHAR || + if (token->type != CSS_TOKEN_CHAR || lwc_string_length(token->idata) != 1 || (lwc_string_data(token->idata)[0] != '}' && lwc_string_data(token->idata)[0] != ';')) { @@ -1001,7 +1001,7 @@ css_error parseRulesetEnd(css_parser *parser) return done(parser); } - if (token->type != CSS_TOKEN_CHAR || + if (token->type != CSS_TOKEN_CHAR || lwc_string_length(token->idata) != 1 || lwc_string_data(token->idata)[0] != '}') { /* This should never happen, as FOLLOW(decl-list) @@ -1077,9 +1077,9 @@ css_error parseAtRule(css_parser *parser) if (error != CSS_OK) return error; - /* Grammar ambiguity: any0 can be followed by '{',';',')',']'. + /* Grammar ambiguity: any0 can be followed by '{',';',')',']'. * at-rule can only be followed by '{' and ';'. */ - if (token->type == CSS_TOKEN_CHAR && + if (token->type == CSS_TOKEN_CHAR && lwc_string_length(token->idata) == 1) { if (lwc_string_data(token->idata)[0] == ')' || lwc_string_data( @@ -1119,7 +1119,7 @@ css_error parseAtRuleEnd(css_parser *parser) parserutils_vector_dump(parser->tokens, __func__, tprinter); #endif if (parser->event != NULL) { - if (parser->event(CSS_PARSER_START_ATRULE, + if (parser->event(CSS_PARSER_START_ATRULE, parser->tokens, parser->event_pw) == CSS_INVALID) { parser_state to = { sMalformedAtRule, Initial }; @@ -1140,12 +1140,12 @@ css_error parseAtRuleEnd(css_parser *parser) return done(parser); } - if (token->type != CSS_TOKEN_CHAR || + if (token->type != CSS_TOKEN_CHAR || lwc_string_length(token->idata) != 1) { /* Should never happen FOLLOW(at-rule) == '{', ';'*/ assert(0 && "Expected { or ;"); } - + if (lwc_string_data(token->idata)[0] == '{') { parser_state to = { sBlock, Initial }; parser_state subsequent = { sAtRuleEnd, AfterBlock }; @@ -1205,7 +1205,7 @@ css_error parseBlock(css_parser *parser) parser->event_pw); } - if (token->type != CSS_TOKEN_CHAR || + if (token->type != CSS_TOKEN_CHAR || lwc_string_length(token->idata) != 1 || lwc_string_data(token->idata)[0] != '{') { /* This should never happen, as FIRST(block) == '{' */ @@ -1244,10 +1244,10 @@ css_error parseBlock(css_parser *parser) return done(parser); } - if (token->type != CSS_TOKEN_CHAR || + if (token->type != CSS_TOKEN_CHAR || lwc_string_length(token->idata) != 1 || lwc_string_data(token->idata)[0] != '}') { - /* This should never happen, as + /* This should never happen, as * FOLLOW(block-content) == '}' */ assert(0 && "Expected }"); } @@ -1282,7 +1282,7 @@ css_error parseBlockContent(css_parser *parser) const css_token *token; css_error error; - /* block-content -> any block-content + /* block-content -> any block-content * -> block block-content * -> ATKEYWORD ws block-content * -> ';' ws block-content @@ -1299,12 +1299,12 @@ css_error parseBlockContent(css_parser *parser) if (token->type == CSS_TOKEN_ATKEYWORD) { state->substate = WS; } else if (token->type == CSS_TOKEN_CHAR) { - if (lwc_string_length(token->idata) == 1 && + if (lwc_string_length(token->idata) == 1 && lwc_string_data( token->idata)[0] == '{') { /* Grammar ambiguity. Assume block */ parser_state to = { sBlock, Initial }; - parser_state subsequent = + parser_state subsequent = { sBlockContent, Initial }; error = pushBack(parser, token); @@ -1318,7 +1318,7 @@ css_error parseBlockContent(css_parser *parser) if (parser->event != NULL) { parser->event( CSS_PARSER_BLOCK_CONTENT, - parser->tokens, + parser->tokens, parser->event_pw); } @@ -1327,7 +1327,7 @@ css_error parseBlockContent(css_parser *parser) parserutils_vector_clear( parser->tokens); - return transition(parser, to, + return transition(parser, to, subsequent); } else if (lwc_string_length( token->idata) == 1 && @@ -1345,7 +1345,7 @@ css_error parseBlockContent(css_parser *parser) if (parser->event != NULL) { parser->event( CSS_PARSER_BLOCK_CONTENT, - parser->tokens, + parser->tokens, parser->event_pw); } @@ -1409,7 +1409,7 @@ css_error parseBlockContent(css_parser *parser) if (state->substate == Initial) { parser_state to = { sAny, Initial }; - parser_state subsequent = + parser_state subsequent = { sBlockContent, Initial }; error = pushBack(parser, token); @@ -1498,7 +1498,7 @@ css_error parseDeclaration(css_parser *parser) return done(parser); } - if (token->type != CSS_TOKEN_CHAR || + if (token->type != CSS_TOKEN_CHAR || lwc_string_length(token->idata) != 1 || lwc_string_data(token->idata)[0] != ':') { /* parse error -- expected : */ @@ -1572,9 +1572,9 @@ css_error parseDeclList(css_parser *parser) return done(parser); } - if (token->type != CSS_TOKEN_CHAR || + if (token->type != CSS_TOKEN_CHAR || lwc_string_length(token->idata) != 1 || - (lwc_string_data(token->idata)[0] != '}' && + (lwc_string_data(token->idata)[0] != '}' && lwc_string_data(token->idata)[0] != ';')) { /* Should never happen */ assert(0 && "Expected ; or }"); @@ -1611,7 +1611,7 @@ css_error parseDeclListEnd(css_parser *parser) const css_token *token; css_error error; - /* decl-list-end -> declaration decl-list + /* decl-list-end -> declaration decl-list * -> decl-list */ @@ -1621,12 +1621,12 @@ css_error parseDeclListEnd(css_parser *parser) if (error != CSS_OK) return error; - if (token->type != CSS_TOKEN_CHAR || - lwc_string_length(token->idata) != 1 || + if (token->type != CSS_TOKEN_CHAR || + lwc_string_length(token->idata) != 1 || (lwc_string_data(token->idata)[0] != ';' && lwc_string_data(token->idata)[0] != '}')) { parser_state to = { sDeclaration, Initial }; - parser_state subsequent = + parser_state subsequent = { sDeclListEnd, AfterDeclaration }; error = pushBack(parser, token); @@ -1717,7 +1717,7 @@ css_error parseValue1(css_parser *parser) return error; /* Grammar ambiguity -- assume ';' or '}' mark end */ - if (token->type == CSS_TOKEN_CHAR && + if (token->type == CSS_TOKEN_CHAR && lwc_string_length(token->idata) == 1 && (lwc_string_data(token->idata)[0] == ';' || lwc_string_data(token->idata)[0] == '}')) { @@ -1746,7 +1746,7 @@ css_error parseValue0(css_parser *parser) css_error error; /* value0 -> value value0 - * -> + * -> */ while (1) { @@ -1768,7 +1768,7 @@ css_error parseValue0(css_parser *parser) return done(parser); /* Grammar ambiguity -- assume ';' or '}' mark end */ - if (token->type == CSS_TOKEN_CHAR && + if (token->type == CSS_TOKEN_CHAR && lwc_string_length( token->idata) == 1 && (lwc_string_data( @@ -1813,8 +1813,8 @@ css_error parseValue(css_parser *parser) if (token->type == CSS_TOKEN_ATKEYWORD) { state->substate = WS; - } else if (token->type == CSS_TOKEN_CHAR && - lwc_string_length(token->idata) == 1 && + } else if (token->type == CSS_TOKEN_CHAR && + lwc_string_length(token->idata) == 1 && lwc_string_data(token->idata)[0] == '{') { /* Grammar ambiguity. Assume block. */ parser_state to = { sBlock, Initial }; @@ -1854,7 +1854,7 @@ css_error parseAny0(css_parser *parser) css_error error; /* any0 -> any any0 - * -> + * -> */ while (1) { @@ -1875,9 +1875,9 @@ css_error parseAny0(css_parser *parser) if (token->type == CSS_TOKEN_EOF) return done(parser); - /* Grammar ambiguity: + /* Grammar ambiguity: * assume '{', ';', ')', ']' mark end */ - if (token->type == CSS_TOKEN_CHAR && + if (token->type == CSS_TOKEN_CHAR && lwc_string_length( token->idata) == 1 && (lwc_string_data( @@ -1945,9 +1945,9 @@ css_error parseAny1(css_parser *parser) if (error != CSS_OK) return error; - /* Grammar ambiguity: any0 can be followed by + /* Grammar ambiguity: any0 can be followed by * '{', ';', ')', ']'. any1 can only be followed by '{'. */ - if (token->type == CSS_TOKEN_CHAR && + if (token->type == CSS_TOKEN_CHAR && lwc_string_length(token->idata) == 1) { if (lwc_string_data(token->idata)[0] == ';' || lwc_string_data( @@ -2003,20 +2003,20 @@ css_error parseAny(css_parser *parser) if (error != CSS_OK) return error; - if (token->type != CSS_TOKEN_IDENT && - token->type != CSS_TOKEN_NUMBER && - token->type != CSS_TOKEN_PERCENTAGE && - token->type != CSS_TOKEN_DIMENSION && - token->type != CSS_TOKEN_STRING && - token->type != CSS_TOKEN_CHAR && - token->type != CSS_TOKEN_URI && - token->type != CSS_TOKEN_HASH && - token->type != CSS_TOKEN_UNICODE_RANGE && - token->type != CSS_TOKEN_INCLUDES && - token->type != CSS_TOKEN_DASHMATCH && - token->type != CSS_TOKEN_PREFIXMATCH && - token->type != CSS_TOKEN_SUFFIXMATCH && - token->type != CSS_TOKEN_SUBSTRINGMATCH && + if (token->type != CSS_TOKEN_IDENT && + token->type != CSS_TOKEN_NUMBER && + token->type != CSS_TOKEN_PERCENTAGE && + token->type != CSS_TOKEN_DIMENSION && + token->type != CSS_TOKEN_STRING && + token->type != CSS_TOKEN_CHAR && + token->type != CSS_TOKEN_URI && + token->type != CSS_TOKEN_HASH && + token->type != CSS_TOKEN_UNICODE_RANGE && + token->type != CSS_TOKEN_INCLUDES && + token->type != CSS_TOKEN_DASHMATCH && + token->type != CSS_TOKEN_PREFIXMATCH && + token->type != CSS_TOKEN_SUFFIXMATCH && + token->type != CSS_TOKEN_SUBSTRINGMATCH && token->type != CSS_TOKEN_FUNCTION) { /* parse error */ parser->parseError = true; @@ -2027,14 +2027,14 @@ css_error parseAny(css_parser *parser) if (token->type == CSS_TOKEN_FUNCTION) { parser->match_char = ')'; state->substate = WS; - } else if (token->type == CSS_TOKEN_CHAR && - lwc_string_length(token->idata) == 1 && - (lwc_string_data(token->idata)[0] == '(' || + } else if (token->type == CSS_TOKEN_CHAR && + lwc_string_length(token->idata) == 1 && + (lwc_string_data(token->idata)[0] == '(' || lwc_string_data(token->idata)[0] == '[')) { parser->match_char = lwc_string_data( token->idata)[0] == '(' ? ')' : ']'; state->substate = WS; - } + } state->substate = WS2; /* Fall through */ @@ -2064,9 +2064,9 @@ css_error parseAny(css_parser *parser) return error; /* Match correct close bracket (grammar ambiguity) */ - if (token->type == CSS_TOKEN_CHAR && + if (token->type == CSS_TOKEN_CHAR && lwc_string_length(token->idata) == 1 && - lwc_string_data(token->idata)[0] == + lwc_string_data(token->idata)[0] == parser->match_char) { state->substate = WS2; goto ws2; @@ -2086,14 +2086,14 @@ css_error parseMalformedDeclaration(css_parser *parser) const css_token *token = NULL; css_error error; - /* Malformed declaration: read everything up to the next ; or } + /* Malformed declaration: read everything up to the next ; or } * We must ensure that pairs of {}, (), [], are balanced */ switch (state->substate) { case Initial: { /* Clear stack of open items */ - while (parserutils_stack_pop(parser->open_items, NULL) == + while (parserutils_stack_pop(parser->open_items, NULL) == PARSERUTILS_OK) ; @@ -2156,13 +2156,13 @@ css_error parseMalformedDeclaration(css_parser *parser) break; } - /* Either pop off the stack, if we've matched the + /* Either pop off the stack, if we've matched the * current item, or push the start token on */ if (match != NULL && *match == want) { parserutils_stack_pop( parser->open_items, NULL); } else if (want == 0) { - parserutils_stack_push(parser->open_items, + parserutils_stack_push(parser->open_items, &data[0]); } } @@ -2193,7 +2193,7 @@ css_error parseMalformedSelector(css_parser *parser) switch (state->substate) { case Initial: /* Clear the stack of open items */ - while (parserutils_stack_pop(parser->open_items, NULL) == + while (parserutils_stack_pop(parser->open_items, NULL) == PARSERUTILS_OK) ; @@ -2243,21 +2243,21 @@ css_error parseMalformedSelector(css_parser *parser) break; } - /* Either pop off the stack, if we've matched the + /* Either pop off the stack, if we've matched the * current item, or push the start token on */ if (match != NULL && *match == want) { parserutils_stack_pop( parser->open_items, NULL); } else if (want == 0) { - parserutils_stack_push(parser->open_items, + parserutils_stack_push(parser->open_items, &data[0]); } /* If we encountered a '}', there was data on the stack * before, and the stack's now empty, then we've popped - * a '{' off the stack. That means we've found the end + * a '{' off the stack. That means we've found the end * of the block, so we're done here. */ - if (want == '{' && match != NULL && + if (want == '{' && match != NULL && parserutils_stack_get_current( parser->open_items) == NULL) break; @@ -2291,7 +2291,7 @@ css_error parseMalformedAtRule(css_parser *parser) case Initial: { /* Clear stack of open items */ - while (parserutils_stack_pop(parser->open_items, NULL) == + while (parserutils_stack_pop(parser->open_items, NULL) == PARSERUTILS_OK) ; @@ -2352,21 +2352,21 @@ css_error parseMalformedAtRule(css_parser *parser) break; } - /* Either pop off the stack, if we've matched the + /* Either pop off the stack, if we've matched the * current item, or push the start token on */ if (match != NULL && *match == want) { parserutils_stack_pop( parser->open_items, NULL); } else if (want == 0) { - parserutils_stack_push(parser->open_items, + parserutils_stack_push(parser->open_items, &data[0]); } /* If we encountered a '}', there was data on the stack * before, and the stack's now empty, then we've popped - * a '{' off the stack. That means we've found the end + * a '{' off the stack. That means we've found the end * of the block, so we're done here. */ - if (want == '{' && match != NULL && + if (want == '{' && match != NULL && parserutils_stack_get_current( parser->open_items) == NULL) break; @@ -2395,7 +2395,7 @@ css_error parseInlineStyle(css_parser *parser) switch (state->substate) { case Initial: - /* Emit fake events such that the language parser knows + /* Emit fake events such that the language parser knows * no different from a normal parse. */ if (parser->event != NULL) { @@ -2430,7 +2430,7 @@ css_error parseInlineStyle(css_parser *parser) /* Emit remaining fake events to end the parse */ if (parser->event != NULL) { /* 1) end ruleset */ - parser->event(CSS_PARSER_END_RULESET, NULL, + parser->event(CSS_PARSER_END_RULESET, NULL, parser->event_pw); /* 2) end stylesheet */ @@ -2497,7 +2497,7 @@ css_error parseISBody(css_parser *parser) const css_token *token; css_error error; - /* is-body -> declaration decl-list '}' ws + /* is-body -> declaration decl-list '}' ws * -> decl-list '}' ws * * Note that this looks suspiciously similar to ruleset-end. @@ -2518,7 +2518,7 @@ css_error parseISBody(css_parser *parser) * attempt to parse a declaration. This will catch any invalid * input at this point and read to the start of the next * declaration. FIRST(decl-list) = (';', '}') */ - if (token->type != CSS_TOKEN_CHAR || + if (token->type != CSS_TOKEN_CHAR || lwc_string_length(token->idata) != 1 || (lwc_string_data(token->idata)[0] != '}' && lwc_string_data(token->idata)[0] != ';')) { @@ -2550,7 +2550,7 @@ css_error parseISBody(css_parser *parser) return done(parser); } - if (token->type != CSS_TOKEN_CHAR || + if (token->type != CSS_TOKEN_CHAR || lwc_string_length(token->idata) != 1 || lwc_string_data(token->idata)[0] != '}') { /* This should never happen, as FOLLOW(decl-list) @@ -2580,7 +2580,7 @@ void unref_interned_strings_in_tokens(css_parser *parser) { int32_t ctx = 0; const css_token *tok; - + while ((tok = parserutils_vector_iterate( parser->tokens, &ctx)) != NULL) { if (tok->idata != NULL) { diff --git a/src/parse/parse.h b/src/parse/parse.h index 6b95acb..833aa51 100644 --- a/src/parse/parse.h +++ b/src/parse/parse.h @@ -34,7 +34,7 @@ typedef enum css_parser_event { CSS_PARSER_DECLARATION } css_parser_event; -typedef css_error (*css_parser_event_handler)(css_parser_event type, +typedef css_error (*css_parser_event_handler)(css_parser_event type, const parserutils_vector *tokens, void *pw); /** @@ -59,18 +59,18 @@ typedef union css_parser_optparams { css_error css__parser_create(const char *charset, css_charset_source cs_source, css_parser **parser); -css_error css__parser_create_for_inline_style(const char *charset, +css_error css__parser_create_for_inline_style(const char *charset, css_charset_source cs_source, css_parser **parser); css_error css__parser_destroy(css_parser *parser); css_error css__parser_setopt(css_parser *parser, css_parser_opttype type, css_parser_optparams *params); -css_error css__parser_parse_chunk(css_parser *parser, const uint8_t *data, +css_error css__parser_parse_chunk(css_parser *parser, const uint8_t *data, size_t len); css_error css__parser_completed(css_parser *parser); -const char *css__parser_read_charset(css_parser *parser, +const char *css__parser_read_charset(css_parser *parser, css_charset_source *source); bool css__parser_quirks_permitted(css_parser *parser); diff --git a/src/parse/properties/azimuth.c b/src/parse/properties/azimuth.c index 7df7298..f54189b 100644 --- a/src/parse/properties/azimuth.c +++ b/src/parse/properties/azimuth.c @@ -27,8 +27,8 @@ * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ -css_error css__parse_azimuth(css_language *c, - const parserutils_vector *vector, int *ctx, +css_error css__parse_azimuth(css_language *c, + const parserutils_vector *vector, int *ctx, css_style *result) { int orig_ctx = *ctx; @@ -40,10 +40,10 @@ css_error css__parse_azimuth(css_language *c, uint32_t unit = 0; bool match; - /* angle | [ IDENT(left-side, far-left, left, center-left, center, - * center-right, right, far-right, right-side) || - * IDENT(behind) - * ] + /* angle | [ IDENT(left-side, far-left, left, center-left, center, + * center-right, right, far-right, right-side) || + * IDENT(behind) + * ] * | IDENT(leftwards, rightwards, inherit) */ token = parserutils_vector_peek(vector, *ctx); @@ -71,7 +71,7 @@ css_error css__parse_azimuth(css_language *c, parserutils_vector_iterate(vector, ctx); /* Now, we may have one of the other keywords or behind, - * potentially followed by behind or other keyword, + * potentially followed by behind or other keyword, * respectively */ if ((lwc_string_caseless_isequal( token->idata, c->strings[LEFT_SIDE], @@ -184,7 +184,7 @@ css_error css__parse_azimuth(css_language *c, value |= AZIMUTH_CENTER; } } else { - error = css__parse_unit_specifier(c, vector, ctx, UNIT_DEG, + error = css__parse_unit_specifier(c, vector, ctx, UNIT_DEG, &length, &unit); if (error != CSS_OK) { *ctx = orig_ctx; diff --git a/src/parse/properties/background.c b/src/parse/properties/background.c index cae069c..01b995e 100644 --- a/src/parse/properties/background.c +++ b/src/parse/properties/background.c @@ -49,36 +49,36 @@ css_error css__parse_background(css_language *c, /* Firstly, handle inherit */ token = parserutils_vector_peek(vector, *ctx); - if (token == NULL) + if (token == NULL) return CSS_INVALID; - + if (is_css_inherit(c, token)) { error = css_stylesheet_style_inherit(result, CSS_PROP_BACKGROUND_ATTACHMENT); - if (error != CSS_OK) + if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_BACKGROUND_COLOR); - if (error != CSS_OK) - return error; + if (error != CSS_OK) + return error; error = css_stylesheet_style_inherit(result, CSS_PROP_BACKGROUND_IMAGE); - if (error != CSS_OK) + if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_BACKGROUND_POSITION); - if (error != CSS_OK) + if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_BACKGROUND_REPEAT); - if (error == CSS_OK) + if (error == CSS_OK) parserutils_vector_iterate(vector, ctx); return error; - } + } /* allocate styles */ error = css__stylesheet_style_create(c->sheet, &attachment_style); - if (error != CSS_OK) + if (error != CSS_OK) return error; error = css__stylesheet_style_create(c->sheet, &color_style); @@ -124,24 +124,24 @@ css_error css__parse_background(css_language *c, /* Try each property parser in turn, but only if we * haven't already got a value for this property. */ - if ((attachment) && - (error = css__parse_background_attachment(c, vector, ctx, + if ((attachment) && + (error = css__parse_background_attachment(c, vector, ctx, attachment_style)) == CSS_OK) { attachment = false; - } else if ((color) && + } else if ((color) && (error = css__parse_background_color(c, vector, ctx, color_style)) == CSS_OK) { color = false; - } else if ((image) && + } else if ((image) && (error = css__parse_background_image(c, vector, ctx, image_style)) == CSS_OK) { image = false; } else if ((position) && - (error = css__parse_background_position(c, vector, ctx, + (error = css__parse_background_position(c, vector, ctx, position_style)) == CSS_OK) { position = false; } else if ((repeat) && - (error = css__parse_background_repeat(c, vector, ctx, + (error = css__parse_background_repeat(c, vector, ctx, repeat_style)) == CSS_OK) { repeat = false; } @@ -157,23 +157,23 @@ css_error css__parse_background(css_language *c, } while (*ctx != prev_ctx && token != NULL); if (attachment) { - error = css__stylesheet_style_appendOPV(attachment_style, - CSS_PROP_BACKGROUND_ATTACHMENT, 0, + error = css__stylesheet_style_appendOPV(attachment_style, + CSS_PROP_BACKGROUND_ATTACHMENT, 0, BACKGROUND_ATTACHMENT_SCROLL); if (error != CSS_OK) goto css__parse_background_cleanup; } if (color) { - error = css__stylesheet_style_appendOPV(color_style, - CSS_PROP_BACKGROUND_COLOR, 0, + error = css__stylesheet_style_appendOPV(color_style, + CSS_PROP_BACKGROUND_COLOR, 0, BACKGROUND_COLOR_TRANSPARENT); if (error != CSS_OK) goto css__parse_background_cleanup; } if (image) { - error = css__stylesheet_style_appendOPV(image_style, + error = css__stylesheet_style_appendOPV(image_style, CSS_PROP_BACKGROUND_IMAGE, 0, BACKGROUND_IMAGE_NONE); if (error != CSS_OK) @@ -190,7 +190,7 @@ css_error css__parse_background(css_language *c, } if (repeat) { - error = css__stylesheet_style_appendOPV(repeat_style, + error = css__stylesheet_style_appendOPV(repeat_style, CSS_PROP_BACKGROUND_REPEAT, 0, BACKGROUND_REPEAT_REPEAT); if (error != CSS_OK) diff --git a/src/parse/properties/background_position.c b/src/parse/properties/background_position.c index d4b31dc..6932c05 100644 --- a/src/parse/properties/background_position.c +++ b/src/parse/properties/background_position.c @@ -27,8 +27,8 @@ * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ -css_error css__parse_background_position(css_language *c, - const parserutils_vector *vector, int *ctx, +css_error css__parse_background_position(css_language *c, + const parserutils_vector *vector, int *ctx, css_style *result) { int orig_ctx = *ctx; @@ -65,35 +65,35 @@ css_error css__parse_background_position(css_language *c, if (token->type == CSS_TOKEN_IDENT) { if ((lwc_string_caseless_isequal( token->idata, c->strings[LEFT], - &match) == lwc_error_ok && + &match) == lwc_error_ok && match)) { - value[i] = + value[i] = BACKGROUND_POSITION_HORZ_LEFT; } else if ((lwc_string_caseless_isequal( token->idata, c->strings[RIGHT], - &match) == lwc_error_ok && + &match) == lwc_error_ok && match)) { - value[i] = + value[i] = BACKGROUND_POSITION_HORZ_RIGHT; } else if ((lwc_string_caseless_isequal( token->idata, c->strings[TOP], - &match) == lwc_error_ok && + &match) == lwc_error_ok && match)) { value[i] = BACKGROUND_POSITION_VERT_TOP; } else if ((lwc_string_caseless_isequal( - token->idata, + token->idata, c->strings[BOTTOM], - &match) == lwc_error_ok && + &match) == lwc_error_ok && match)) { - value[i] = + value[i] = BACKGROUND_POSITION_VERT_BOTTOM; } else if ((lwc_string_caseless_isequal( - token->idata, + token->idata, c->strings[CENTER], - &match) == lwc_error_ok && + &match) == lwc_error_ok && match)) { /* We'll fix this up later */ - value[i] = + value[i] = BACKGROUND_POSITION_VERT_CENTER; } else if (i == 1) { /* Second pass, so ignore this one */ @@ -108,15 +108,15 @@ css_error css__parse_background_position(css_language *c, } else if (token->type == CSS_TOKEN_DIMENSION || token->type == CSS_TOKEN_NUMBER || token->type == CSS_TOKEN_PERCENTAGE) { - error = css__parse_unit_specifier(c, vector, ctx, + error = css__parse_unit_specifier(c, vector, ctx, UNIT_PX, &length[i], &unit[i]); if (error != CSS_OK) { *ctx = orig_ctx; return error; } - if (unit[i] & UNIT_ANGLE || - unit[i] & UNIT_TIME || + if (unit[i] & UNIT_ANGLE || + unit[i] & UNIT_TIME || unit[i] & UNIT_FREQ) { *ctx = orig_ctx; return CSS_INVALID; @@ -163,7 +163,7 @@ css_error css__parse_background_position(css_language *c, value[1] != BACKGROUND_POSITION_VERT_SET) { /* Two keywords. Verify the axes differ */ if (((value[0] & 0xf) != 0 && (value[1] & 0xf) != 0) || - ((value[0] & 0xf0) != 0 && + ((value[0] & 0xf0) != 0 && (value[1] & 0xf0) != 0)) { *ctx = orig_ctx; return CSS_INVALID; @@ -175,7 +175,7 @@ css_error css__parse_background_position(css_language *c, /* Verify the axes differ */ if (((value[0] & 0xf) != 0 && (value[1] & 0xf) != 0) || - ((value[0] & 0xf0) != 0 && + ((value[0] & 0xf0) != 0 && (value[1] & 0xf0) != 0)) { *ctx = orig_ctx; return CSS_INVALID; @@ -183,9 +183,9 @@ css_error css__parse_background_position(css_language *c, } } - error = css__stylesheet_style_appendOPV(result, - CSS_PROP_BACKGROUND_POSITION, - flags, + error = css__stylesheet_style_appendOPV(result, + CSS_PROP_BACKGROUND_POSITION, + flags, value[0] | value[1]); if (error != CSS_OK) { *ctx = orig_ctx; diff --git a/src/parse/properties/border.c b/src/parse/properties/border.c index 98ad08b..26cdbcd 100644 --- a/src/parse/properties/border.c +++ b/src/parse/properties/border.c @@ -56,9 +56,9 @@ css_error css__parse_border(css_language *c, *ctx = orig_ctx; error = css__parse_border_side(c, vector, ctx, result, BORDER_SIDE_LEFT); - if (error != CSS_OK) + if (error != CSS_OK) *ctx = orig_ctx; - + return error; - + } diff --git a/src/parse/properties/border_color.c b/src/parse/properties/border_color.c index 7495ffc..28d30b7 100644 --- a/src/parse/properties/border_color.c +++ b/src/parse/properties/border_color.c @@ -41,28 +41,28 @@ css_error css__parse_border_color(css_language *c, /* Firstly, handle inherit */ token = parserutils_vector_peek(vector, *ctx); - if (token == NULL) + if (token == NULL) return CSS_INVALID; - + if (is_css_inherit(c, token)) { error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_TOP_COLOR); - if (error != CSS_OK) + if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_RIGHT_COLOR); - if (error != CSS_OK) - return error; + if (error != CSS_OK) + return error; error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_BOTTOM_COLOR); - if (error != CSS_OK) + if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_LEFT_COLOR); - if (error == CSS_OK) + if (error == CSS_OK) parserutils_vector_iterate(vector, ctx); return error; - } + } /* Attempt to parse up to 4 colours */ do { diff --git a/src/parse/properties/border_spacing.c b/src/parse/properties/border_spacing.c index e9949fd..2322a5a 100644 --- a/src/parse/properties/border_spacing.c +++ b/src/parse/properties/border_spacing.c @@ -27,8 +27,8 @@ * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ -css_error css__parse_border_spacing(css_language *c, - const parserutils_vector *vector, int *ctx, +css_error css__parse_border_spacing(css_language *c, + const parserutils_vector *vector, int *ctx, css_style *result) { int orig_ctx = *ctx; @@ -65,7 +65,7 @@ css_error css__parse_border_spacing(css_language *c, return error; } - if (unit[0] & UNIT_ANGLE || unit[0] & UNIT_TIME || + if (unit[0] & UNIT_ANGLE || unit[0] & UNIT_TIME || unit[0] & UNIT_FREQ || unit[0] & UNIT_PCT) { *ctx = orig_ctx; return CSS_INVALID; @@ -78,16 +78,16 @@ css_error css__parse_border_spacing(css_language *c, token = parserutils_vector_peek(vector, *ctx); if (token != NULL) { /* Attempt second length, ignoring errors. - * The core !important parser will ensure + * The core !important parser will ensure * any remaining junk is thrown out. * Ctx will be preserved on error, as usual */ error = css__parse_unit_specifier(c, vector, ctx, UNIT_PX, &length[1], &unit[1]); if (error == CSS_OK) { - if (unit[1] & UNIT_ANGLE || + if (unit[1] & UNIT_ANGLE || unit[1] & UNIT_TIME || - unit[1] & UNIT_FREQ || + unit[1] & UNIT_FREQ || unit[1] & UNIT_PCT) { *ctx = orig_ctx; return CSS_INVALID; @@ -119,11 +119,11 @@ css_error css__parse_border_spacing(css_language *c, return error; } - error = css__stylesheet_style_vappend(result, - 4, - length[0], - unit[0], - length[1], + error = css__stylesheet_style_vappend(result, + 4, + length[0], + unit[0], + length[1], unit[1]); } diff --git a/src/parse/properties/border_style.c b/src/parse/properties/border_style.c index d4a4d12..a0d264d 100644 --- a/src/parse/properties/border_style.c +++ b/src/parse/properties/border_style.c @@ -41,28 +41,28 @@ css_error css__parse_border_style(css_language *c, /* Firstly, handle inherit */ token = parserutils_vector_peek(vector, *ctx); - if (token == NULL) + if (token == NULL) return CSS_INVALID; - + if (is_css_inherit(c, token)) { error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_TOP_STYLE); - if (error != CSS_OK) + if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_RIGHT_STYLE); - if (error != CSS_OK) - return error; + if (error != CSS_OK) + return error; error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_BOTTOM_STYLE); - if (error != CSS_OK) + if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_LEFT_STYLE); - if (error == CSS_OK) + if (error == CSS_OK) parserutils_vector_iterate(vector, ctx); return error; - } + } /* Attempt to parse up to 4 styles */ do { @@ -73,7 +73,7 @@ css_error css__parse_border_style(css_language *c, return CSS_INVALID; } - if (token->type != CSS_TOKEN_IDENT) + if (token->type != CSS_TOKEN_IDENT) break; if ((lwc_string_caseless_isequal(token->idata, c->strings[NONE], &match) == lwc_error_ok && match)) { @@ -101,9 +101,9 @@ css_error css__parse_border_style(css_language *c, } side_count++; - + parserutils_vector_iterate(vector, ctx); - + consumeWhitespace(vector, ctx); token = parserutils_vector_peek(vector, *ctx); @@ -113,7 +113,7 @@ css_error css__parse_border_style(css_language *c, #define SIDE_APPEND(OP,NUM) \ error = css__stylesheet_style_appendOPV(result, (OP), 0, side_val[(NUM)]); \ if (error != CSS_OK) \ - break + break switch (side_count) { case 1: diff --git a/src/parse/properties/border_width.c b/src/parse/properties/border_width.c index 8b86bc4..bc911c9 100644 --- a/src/parse/properties/border_width.c +++ b/src/parse/properties/border_width.c @@ -43,28 +43,28 @@ css_error css__parse_border_width(css_language *c, /* Firstly, handle inherit */ token = parserutils_vector_peek(vector, *ctx); - if (token == NULL) + if (token == NULL) return CSS_INVALID; - + if (is_css_inherit(c, token)) { error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_TOP_WIDTH); - if (error != CSS_OK) + if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_RIGHT_WIDTH); - if (error != CSS_OK) - return error; + if (error != CSS_OK) + return error; error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_BOTTOM_WIDTH); - if (error != CSS_OK) + if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_LEFT_WIDTH); - if (error == CSS_OK) + if (error == CSS_OK) parserutils_vector_iterate(vector, ctx); return error; - } + } /* Attempt to parse up to 4 widths */ do { diff --git a/src/parse/properties/clip.c b/src/parse/properties/clip.c index 3d200f5..7862d4a 100644 --- a/src/parse/properties/clip.c +++ b/src/parse/properties/clip.c @@ -27,8 +27,8 @@ * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ -css_error css__parse_clip(css_language *c, - const parserutils_vector *vector, int *ctx, +css_error css__parse_clip(css_language *c, + const parserutils_vector *vector, int *ctx, css_style *result) { int orig_ctx = *ctx; @@ -39,7 +39,7 @@ css_error css__parse_clip(css_language *c, uint32_t unit[4] = { 0 }; bool match; - /* FUNCTION(rect) [ [ IDENT(auto) | length ] CHAR(,)? ]{3} + /* FUNCTION(rect) [ [ IDENT(auto) | length ] CHAR(,)? ]{3} * [ IDENT(auto) | length ] CHAR{)} | * IDENT(auto, inherit) */ token = parserutils_vector_iterate(vector, ctx); @@ -81,11 +81,11 @@ css_error css__parse_clip(css_language *c, } if (token->type == CSS_TOKEN_IDENT) { - /* Slightly magical way of generating the auto + /* Slightly magical way of generating the auto * values. These are bits 3-6 of the value. */ if ((lwc_string_caseless_isequal( token->idata, c->strings[AUTO], - &match) == lwc_error_ok && + &match) == lwc_error_ok && match)) value |= 1 << (i + 3); else { @@ -95,16 +95,16 @@ css_error css__parse_clip(css_language *c, parserutils_vector_iterate(vector, ctx); } else { - error = css__parse_unit_specifier(c, vector, ctx, - UNIT_PX, - &length[num_lengths], + error = css__parse_unit_specifier(c, vector, ctx, + UNIT_PX, + &length[num_lengths], &unit[num_lengths]); if (error != CSS_OK) { *ctx = orig_ctx; return error; } - if (unit[num_lengths] & UNIT_ANGLE || + if (unit[num_lengths] & UNIT_ANGLE || unit[num_lengths] & UNIT_TIME || unit[num_lengths] & UNIT_FREQ || unit[num_lengths] & UNIT_PCT) { @@ -150,11 +150,11 @@ css_error css__parse_clip(css_language *c, } for (i = 0; i < num_lengths; i++) { - error = css__stylesheet_style_vappend(result, - 2, - length[i], + error = css__stylesheet_style_vappend(result, + 2, + length[i], unit[i]); - if (error != CSS_OK) + if (error != CSS_OK) break; } diff --git a/src/parse/properties/content.c b/src/parse/properties/content.c index 860d0f1..10f221f 100644 --- a/src/parse/properties/content.c +++ b/src/parse/properties/content.c @@ -127,15 +127,15 @@ css_error css__parse_content(css_language *c, error = c->sheet->resolve(c->sheet->resolve_pw, c->sheet->url, - token->idata, + token->idata, &uri); if (error != CSS_OK) { *ctx = orig_ctx; return error; } - error = css__stylesheet_string_add(c->sheet, - uri, + error = css__stylesheet_string_add(c->sheet, + uri, &uri_snumber); if (error != CSS_OK) { *ctx = orig_ctx; diff --git a/src/parse/properties/css_property_parser_gen.c b/src/parse/properties/css_property_parser_gen.c index a430c9b..0e6ce72 100644 --- a/src/parse/properties/css_property_parser_gen.c +++ b/src/parse/properties/css_property_parser_gen.c @@ -109,8 +109,8 @@ void output_header(FILE *outputf, const char *descriptor, struct keyval *parser_ " const parserutils_vector *vector, int *ctx,\n" " css_style *result%s)\n" "{\n", - descriptor, - parser_id->key, + descriptor, + parser_id->key, is_generic ? " * \\param op Bytecode OpCode for CSS property to encode\n" : "", parser_id->key, is_generic ? ", enum css_properties_e op" : ""); @@ -249,7 +249,7 @@ void output_number(FILE *outputf, struct keyval *parseid, struct keyval_list *kv "\t\tif (%s) {\n" "\t\t\t*ctx = orig_ctx;\n" "\t\t\treturn CSS_INVALID;\n" - "\t\t}\n\n", + "\t\t}\n\n", ulkv->val); } @@ -264,7 +264,7 @@ void output_number(FILE *outputf, struct keyval *parseid, struct keyval_list *kv "\t\terror = css__stylesheet_style_append(result, num);\n" "\t} else ", parseid->val, - ckv->val); + ckv->val); } void output_color(FILE *outputf, struct keyval *parseid, struct keyval_list *kvlist) @@ -317,21 +317,21 @@ void output_length_unit(FILE *outputf, struct keyval *parseid, struct keyval_lis "\t\tif ((%s) == false) {\n" "\t\t\t*ctx = orig_ctx;\n" "\t\t\treturn CSS_INVALID;\n" - "\t\t}\n\n", + "\t\t}\n\n", ulkv->val); } else if (strcmp(ulkv->key, "DISALLOW") == 0) { fprintf(outputf, "\t\tif (%s) {\n" "\t\t\t*ctx = orig_ctx;\n" "\t\t\treturn CSS_INVALID;\n" - "\t\t}\n\n", + "\t\t}\n\n", ulkv->val); } else if (strcmp(ulkv->key, "RANGE") == 0) { fprintf(outputf, "\t\tif (length %s) {\n" "\t\t\t*ctx = orig_ctx;\n" "\t\t\treturn CSS_INVALID;\n" - "\t\t}\n\n", + "\t\t}\n\n", ulkv->val); } @@ -350,9 +350,9 @@ void output_length_unit(FILE *outputf, struct keyval *parseid, struct keyval_lis ckv->val); } -void -output_ident_list(FILE *outputf, - struct keyval *parseid, +void +output_ident_list(FILE *outputf, + struct keyval *parseid, struct keyval_list *kvlist) { struct keyval *ckv = kvlist->item[0]; /* list type : opv value */ @@ -387,7 +387,7 @@ output_ident_list(FILE *outputf, "\t\t\t\t*ctx = orig_ctx;\n" "\t\t\t\treturn error;\n" "\t\t\t}\n\n" - "\t\t\terror = css__stylesheet_style_append(result, snumber);\n" + "\t\t\terror = css__stylesheet_style_append(result, snumber);\n" "\t\t\tif (error != CSS_OK) {\n" "\t\t\t\t*ctx = orig_ctx;\n" "\t\t\t\treturn error;\n" @@ -553,13 +553,13 @@ int main(int argc, char **argv) curlist = &IDENT_LIST; } else if (rkv->val[0] == ')') { curlist = &base; - } + } } else if (strcmp(rkv->key, "LENGTH_UNIT") == 0) { if (rkv->val[0] == '(') { curlist = &LENGTH_UNIT; } else if (rkv->val[0] == ')') { curlist = &base; - } + } only_ident = false; do_token_check = false; } else if (strcmp(rkv->key, "COLOR") == 0) { diff --git a/src/parse/properties/cue.c b/src/parse/properties/cue.c index ea94adb..eef10d1 100644 --- a/src/parse/properties/cue.c +++ b/src/parse/properties/cue.c @@ -27,8 +27,8 @@ * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ -css_error css__parse_cue(css_language *c, - const parserutils_vector *vector, int *ctx, +css_error css__parse_cue(css_language *c, + const parserutils_vector *vector, int *ctx, css_style *result) { int orig_ctx = *ctx; @@ -47,7 +47,7 @@ css_error css__parse_cue(css_language *c, error = css__parse_cue_before(c, vector, ctx, result); if (error == CSS_OK) { /* first token parsed */ - + consumeWhitespace(vector, ctx); token = parserutils_vector_peek(vector, *ctx); @@ -62,7 +62,7 @@ css_error css__parse_cue(css_language *c, error = CSS_INVALID; } else { error = css__parse_cue_after(c, vector, ctx, result); - if (error == CSS_OK) { + if (error == CSS_OK) { /* second token parsed */ if (is_css_inherit(c, first_token)) { /* valid second token after inherit */ diff --git a/src/parse/properties/cursor.c b/src/parse/properties/cursor.c index 6b9eadf..ad3ac47 100644 --- a/src/parse/properties/cursor.c +++ b/src/parse/properties/cursor.c @@ -26,8 +26,8 @@ * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ -css_error css__parse_cursor(css_language *c, - const parserutils_vector *vector, int *ctx, +css_error css__parse_cursor(css_language *c, + const parserutils_vector *vector, int *ctx, css_style *result) { int orig_ctx = *ctx; @@ -37,11 +37,11 @@ css_error css__parse_cursor(css_language *c, /* [ (URI ',')* IDENT(auto, crosshair, default, pointer, move, e-resize, * ne-resize, nw-resize, n-resize, se-resize, sw-resize, - * s-resize, w-resize, text, wait, help, progress) ] - * | IDENT(inherit) + * s-resize, w-resize, text, wait, help, progress) ] + * | IDENT(inherit) */ token = parserutils_vector_iterate(vector, ctx); - if ((token == NULL) || + if ((token == NULL) || (token->type != CSS_TOKEN_IDENT && token->type != CSS_TOKEN_URI)) { *ctx = orig_ctx; @@ -75,8 +75,8 @@ css_error css__parse_cursor(css_language *c, return error; } - error = css__stylesheet_string_add(c->sheet, - uri, + error = css__stylesheet_string_add(c->sheet, + uri, &uri_snumber); if (error != CSS_OK) { *ctx = orig_ctx; diff --git a/src/parse/properties/elevation.c b/src/parse/properties/elevation.c index 0b5fdc4..fea35a3 100644 --- a/src/parse/properties/elevation.c +++ b/src/parse/properties/elevation.c @@ -27,8 +27,8 @@ * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ -css_error css__parse_elevation(css_language *c, - const parserutils_vector *vector, int *ctx, +css_error css__parse_elevation(css_language *c, + const parserutils_vector *vector, int *ctx, css_style *result) { int orig_ctx = *ctx; diff --git a/src/parse/properties/font.c b/src/parse/properties/font.c index 2cdb488..9903f75 100644 --- a/src/parse/properties/font.c +++ b/src/parse/properties/font.c @@ -15,7 +15,7 @@ static css_error parse_system_font(css_language *c, - css_style *result, css_system_font *system_font) + css_style *result, css_system_font *system_font) { css_error error; bool match; @@ -38,7 +38,7 @@ static css_error parse_system_font(css_language *c, error = CSS_BADPARM; break; } - if (error != CSS_OK) + if (error != CSS_OK) return error; /* variant */ @@ -55,8 +55,8 @@ static css_error parse_system_font(css_language *c, error = CSS_BADPARM; break; } - if (error != CSS_OK) - return error; + if (error != CSS_OK) + return error; /* weight */ switch(system_font->weight) { @@ -116,29 +116,29 @@ static css_error parse_system_font(css_language *c, error = CSS_BADPARM; break; } - if (error != CSS_OK) + if (error != CSS_OK) return error; /* size */ error = css__stylesheet_style_appendOPV(result, CSS_PROP_FONT_SIZE, 0, FONT_SIZE_DIMENSION); - if (error != CSS_OK) + if (error != CSS_OK) return error; error = css__stylesheet_style_vappend(result, 2, system_font->size.size, system_font->size.unit); - if (error != CSS_OK) + if (error != CSS_OK) return error; /* line height */ error = css__stylesheet_style_appendOPV(result, CSS_PROP_LINE_HEIGHT, 0, LINE_HEIGHT_DIMENSION); - if (error != CSS_OK) + if (error != CSS_OK) return error; error = css__stylesheet_style_vappend(result, 2, system_font->line_height.size, system_font->line_height.unit); - if (error != CSS_OK) + if (error != CSS_OK) return error; /* font family */ - if ((lwc_string_caseless_isequal(system_font->family, c->strings[SERIF], &match) == lwc_error_ok && match)) + if ((lwc_string_caseless_isequal(system_font->family, c->strings[SERIF], &match) == lwc_error_ok && match)) error = css__stylesheet_style_appendOPV(result, CSS_PROP_FONT_FAMILY, 0, FONT_FAMILY_SERIF); else if ((lwc_string_caseless_isequal(system_font->family, c->strings[SANS_SERIF], &match) == lwc_error_ok && match)) error = css__stylesheet_style_appendOPV(result, CSS_PROP_FONT_FAMILY, 0, FONT_FAMILY_SANS_SERIF); @@ -207,47 +207,47 @@ css_error css__parse_font(css_language *c, /* Firstly, handle inherit */ token = parserutils_vector_peek(vector, *ctx); - if (token == NULL) + if (token == NULL) return CSS_INVALID; - + if (is_css_inherit(c, token)) { error = css_stylesheet_style_inherit(result, CSS_PROP_FONT_STYLE); - if (error != CSS_OK) + if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_FONT_VARIANT); - if (error != CSS_OK) - return error; + if (error != CSS_OK) + return error; error = css_stylesheet_style_inherit(result, CSS_PROP_FONT_WEIGHT); - if (error != CSS_OK) + if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_FONT_SIZE); - if (error != CSS_OK) + if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_LINE_HEIGHT); - if (error != CSS_OK) + if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_FONT_FAMILY); - if (error == CSS_OK) + if (error == CSS_OK) parserutils_vector_iterate(vector, ctx); return error; - } + } /* Perhaps an unknown font name; ask the client */ - if ((token->type == CSS_TOKEN_IDENT) && + if ((token->type == CSS_TOKEN_IDENT) && (c->sheet->font != NULL) && - (c->sheet->font(c->sheet->font_pw, - token->idata, + (c->sheet->font(c->sheet->font_pw, + token->idata, &system_font) == CSS_OK)) { - + error = parse_system_font(c, result, &system_font); - if (error == CSS_OK) + if (error == CSS_OK) parserutils_vector_iterate(vector, ctx); return error; @@ -256,7 +256,7 @@ css_error css__parse_font(css_language *c, /* allocate styles */ error = css__stylesheet_style_create(c->sheet, &style_style); - if (error != CSS_OK) + if (error != CSS_OK) return error; error = css__stylesheet_style_create(c->sheet, &variant_style); @@ -312,15 +312,15 @@ css_error css__parse_font(css_language *c, goto css__parse_font_cleanup; } - if ((style) && + if ((style) && (error = css__parse_font_style(c, vector, ctx, style_style)) == CSS_OK) { style = false; - } else if ((variant) && + } else if ((variant) && (error = css__parse_font_variant(c, vector, ctx, variant_style)) == CSS_OK) { variant = false; - } else if ((weight) && + } else if ((weight) && (error = css__parse_font_weight(c, vector, ctx, weight_style)) == CSS_OK) { weight = false; @@ -389,23 +389,23 @@ css_error css__parse_font(css_language *c, /* defaults */ if (style) { - error = css__stylesheet_style_appendOPV(style_style, - CSS_PROP_FONT_STYLE, 0, + error = css__stylesheet_style_appendOPV(style_style, + CSS_PROP_FONT_STYLE, 0, FONT_STYLE_NORMAL); if (error != CSS_OK) goto css__parse_font_cleanup; } if (variant) { - error = css__stylesheet_style_appendOPV(variant_style, - CSS_PROP_FONT_VARIANT, 0, + error = css__stylesheet_style_appendOPV(variant_style, + CSS_PROP_FONT_VARIANT, 0, FONT_VARIANT_NORMAL); if (error != CSS_OK) goto css__parse_font_cleanup; } if (weight) { - error = css__stylesheet_style_appendOPV(weight_style, + error = css__stylesheet_style_appendOPV(weight_style, CSS_PROP_FONT_WEIGHT, 0, FONT_WEIGHT_NORMAL); if (error != CSS_OK) @@ -413,7 +413,7 @@ css_error css__parse_font(css_language *c, } if (line_height) { - error = css__stylesheet_style_appendOPV(line_height_style, + error = css__stylesheet_style_appendOPV(line_height_style, CSS_PROP_LINE_HEIGHT, 0, LINE_HEIGHT_NORMAL); if (error != CSS_OK) diff --git a/src/parse/properties/font_family.c b/src/parse/properties/font_family.c index 60c069d..23c080b 100644 --- a/src/parse/properties/font_family.c +++ b/src/parse/properties/font_family.c @@ -98,8 +98,8 @@ static css_code_t font_family_value(css_language *c, const css_token *token, boo * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ -css_error css__parse_font_family(css_language *c, - const parserutils_vector *vector, int *ctx, +css_error css__parse_font_family(css_language *c, + const parserutils_vector *vector, int *ctx, css_style *result) { int orig_ctx = *ctx; @@ -108,11 +108,11 @@ css_error css__parse_font_family(css_language *c, bool match; /* [ IDENT+ | STRING ] [ ',' [ IDENT+ | STRING ] ]* | IDENT(inherit) - * + * * In the case of IDENT+, any whitespace between tokens is collapsed to * a single space * - * \todo Mozilla makes the comma optional. + * \todo Mozilla makes the comma optional. * Perhaps this is a quirk we should inherit? */ diff --git a/src/parse/properties/font_weight.c b/src/parse/properties/font_weight.c index 4853106..8e57e5f 100644 --- a/src/parse/properties/font_weight.c +++ b/src/parse/properties/font_weight.c @@ -27,8 +27,8 @@ * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ -css_error css__parse_font_weight(css_language *c, - const parserutils_vector *vector, int *ctx, +css_error css__parse_font_weight(css_language *c, + const parserutils_vector *vector, int *ctx, css_style *result) { int orig_ctx = *ctx; @@ -38,7 +38,7 @@ css_error css__parse_font_weight(css_language *c, uint16_t value = 0; bool match; - /* NUMBER (100, 200, 300, 400, 500, 600, 700, 800, 900) | + /* NUMBER (100, 200, 300, 400, 500, 600, 700, 800, 900) | * IDENT (normal, bold, bolder, lighter, inherit) */ token = parserutils_vector_iterate(vector, ctx); if (token == NULL || (token->type != CSS_TOKEN_IDENT && @@ -53,7 +53,7 @@ css_error css__parse_font_weight(css_language *c, flags |= FLAG_INHERIT; } else if (token->type == CSS_TOKEN_NUMBER) { size_t consumed = 0; - css_fixed num = css__number_from_lwc_string(token->idata, + css_fixed num = css__number_from_lwc_string(token->idata, true, &consumed); /* Invalid if there are trailing characters */ if (consumed != lwc_string_length(token->idata)) { @@ -98,9 +98,9 @@ css_error css__parse_font_weight(css_language *c, CSS_PROP_FONT_WEIGHT, flags, value); - if (error != CSS_OK) + if (error != CSS_OK) *ctx = orig_ctx; - + return error; } diff --git a/src/parse/properties/list_style.c b/src/parse/properties/list_style.c index 4ef4ce8..f12fa2e 100644 --- a/src/parse/properties/list_style.c +++ b/src/parse/properties/list_style.c @@ -44,29 +44,29 @@ css_error css__parse_list_style(css_language *c, /* Firstly, handle inherit */ token = parserutils_vector_peek(vector, *ctx); - if (token == NULL) + if (token == NULL) return CSS_INVALID; - + if (is_css_inherit(c, token)) { error = css_stylesheet_style_inherit(result, CSS_PROP_LIST_STYLE_IMAGE); - if (error != CSS_OK) + if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_LIST_STYLE_POSITION); - if (error != CSS_OK) - return error; + if (error != CSS_OK) + return error; error = css_stylesheet_style_inherit(result, CSS_PROP_LIST_STYLE_TYPE); - if (error == CSS_OK) + if (error == CSS_OK) parserutils_vector_iterate(vector, ctx); return error; - } + } /* allocate styles */ error = css__stylesheet_style_create(c->sheet, &image_style); - if (error != CSS_OK) + if (error != CSS_OK) return error; error = css__stylesheet_style_create(c->sheet, &position_style); @@ -94,15 +94,15 @@ css_error css__parse_list_style(css_language *c, goto css__parse_list_style_cleanup; } - if ((type) && + if ((type) && (error = css__parse_list_style_type(c, vector, ctx, type_style)) == CSS_OK) { type = false; - } else if ((position) && - (error = css__parse_list_style_position(c, vector, + } else if ((position) && + (error = css__parse_list_style_position(c, vector, ctx, position_style)) == CSS_OK) { position = false; - } else if ((image) && + } else if ((image) && (error = css__parse_list_style_image(c, vector, ctx, image_style)) == CSS_OK) { image = false; @@ -121,19 +121,19 @@ css_error css__parse_list_style(css_language *c, /* defaults */ if (image) { - error = css__stylesheet_style_appendOPV(image_style, + error = css__stylesheet_style_appendOPV(image_style, CSS_PROP_LIST_STYLE_IMAGE, 0, LIST_STYLE_IMAGE_NONE); } if (position) { - error = css__stylesheet_style_appendOPV(position_style, + error = css__stylesheet_style_appendOPV(position_style, CSS_PROP_LIST_STYLE_POSITION, 0, LIST_STYLE_POSITION_OUTSIDE); } if (type) { - error = css__stylesheet_style_appendOPV(type_style, + error = css__stylesheet_style_appendOPV(type_style, CSS_PROP_LIST_STYLE_TYPE, 0, LIST_STYLE_TYPE_DISC); } diff --git a/src/parse/properties/list_style_type.c b/src/parse/properties/list_style_type.c index b73bcb7..ccaa133 100644 --- a/src/parse/properties/list_style_type.c +++ b/src/parse/properties/list_style_type.c @@ -27,8 +27,8 @@ * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ -css_error css__parse_list_style_type(css_language *c, - const parserutils_vector *vector, int *ctx, +css_error css__parse_list_style_type(css_language *c, + const parserutils_vector *vector, int *ctx, css_style *result) { int orig_ctx = *ctx; @@ -63,8 +63,8 @@ css_error css__parse_list_style_type(css_language *c, error = css__stylesheet_style_appendOPV(result, CSS_PROP_LIST_STYLE_TYPE, flags, value); - if (error != CSS_OK) + if (error != CSS_OK) *ctx = orig_ctx; - + return error; } diff --git a/src/parse/properties/margin.c b/src/parse/properties/margin.c index 896e300..7817d50 100644 --- a/src/parse/properties/margin.c +++ b/src/parse/properties/margin.c @@ -43,28 +43,28 @@ css_error css__parse_margin(css_language *c, /* Firstly, handle inherit */ token = parserutils_vector_peek(vector, *ctx); - if (token == NULL) + if (token == NULL) return CSS_INVALID; - + if (is_css_inherit(c, token)) { error = css_stylesheet_style_inherit(result, CSS_PROP_MARGIN_TOP); - if (error != CSS_OK) + if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_MARGIN_RIGHT); - if (error != CSS_OK) - return error; + if (error != CSS_OK) + return error; error = css_stylesheet_style_inherit(result, CSS_PROP_MARGIN_BOTTOM); - if (error != CSS_OK) + if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_MARGIN_LEFT); - if (error == CSS_OK) + if (error == CSS_OK) parserutils_vector_iterate(vector, ctx); return error; - } + } /* Attempt to parse up to 4 widths */ do { diff --git a/src/parse/properties/opacity.c b/src/parse/properties/opacity.c index edad9f8..e8b7c3e 100644 --- a/src/parse/properties/opacity.c +++ b/src/parse/properties/opacity.c @@ -73,7 +73,7 @@ css_error css__parse_opacity(css_language *c, if (error != CSS_OK) *ctx = orig_ctx; - + return error; } diff --git a/src/parse/properties/outline.c b/src/parse/properties/outline.c index eb4f525..d9d9ec2 100644 --- a/src/parse/properties/outline.c +++ b/src/parse/properties/outline.c @@ -44,29 +44,29 @@ css_error css__parse_outline(css_language *c, /* Firstly, handle inherit */ token = parserutils_vector_peek(vector, *ctx); - if (token == NULL) + if (token == NULL) return CSS_INVALID; - + if (is_css_inherit(c, token)) { error = css_stylesheet_style_inherit(result, CSS_PROP_OUTLINE_COLOR); - if (error != CSS_OK) + if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_OUTLINE_STYLE); - if (error != CSS_OK) - return error; + if (error != CSS_OK) + return error; error = css_stylesheet_style_inherit(result, CSS_PROP_OUTLINE_WIDTH); - if (error == CSS_OK) + if (error == CSS_OK) parserutils_vector_iterate(vector, ctx); return error; - } + } /* allocate styles */ error = css__stylesheet_style_create(c->sheet, &color_style); - if (error != CSS_OK) + if (error != CSS_OK) return error; error = css__stylesheet_style_create(c->sheet, &style_style); @@ -94,19 +94,19 @@ css_error css__parse_outline(css_language *c, goto css__parse_outline_cleanup; } - if ((color) && + if ((color) && (error = css__parse_outline_color(c, vector, ctx, color_style)) == CSS_OK) { color = false; - } else if ((style) && - (error = css__parse_outline_style(c, vector, + } else if ((style) && + (error = css__parse_outline_style(c, vector, ctx, style_style)) == CSS_OK) { style = false; - } else if ((width) && + } else if ((width) && (error = css__parse_outline_width(c, vector, ctx, width_style)) == CSS_OK) { width = false; - } + } if (error == CSS_OK) { consumeWhitespace(vector, ctx); @@ -121,19 +121,19 @@ css_error css__parse_outline(css_language *c, /* defaults */ if (color) { - error = css__stylesheet_style_appendOPV(color_style, + error = css__stylesheet_style_appendOPV(color_style, CSS_PROP_OUTLINE_COLOR, 0, OUTLINE_COLOR_INVERT); } if (style) { - error = css__stylesheet_style_appendOPV(style_style, + error = css__stylesheet_style_appendOPV(style_style, CSS_PROP_OUTLINE_STYLE, 0, OUTLINE_STYLE_NONE); } if (width) { - error = css__stylesheet_style_appendOPV(width_style, + error = css__stylesheet_style_appendOPV(width_style, CSS_PROP_OUTLINE_WIDTH, 0, OUTLINE_WIDTH_MEDIUM); } diff --git a/src/parse/properties/padding.c b/src/parse/properties/padding.c index 7a5b88b..7f5b9f6 100644 --- a/src/parse/properties/padding.c +++ b/src/parse/properties/padding.c @@ -41,28 +41,28 @@ css_error css__parse_padding(css_language *c, /* Firstly, handle inherit */ token = parserutils_vector_peek(vector, *ctx); - if (token == NULL) + if (token == NULL) return CSS_INVALID; - + if (is_css_inherit(c, token)) { error = css_stylesheet_style_inherit(result, CSS_PROP_PADDING_TOP); - if (error != CSS_OK) + if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_PADDING_RIGHT); - if (error != CSS_OK) - return error; + if (error != CSS_OK) + return error; error = css_stylesheet_style_inherit(result, CSS_PROP_PADDING_BOTTOM); - if (error != CSS_OK) + if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_PADDING_LEFT); - if (error == CSS_OK) + if (error == CSS_OK) parserutils_vector_iterate(vector, ctx); return error; - } + } /* Attempt to parse up to 4 widths */ do { @@ -81,7 +81,7 @@ css_error css__parse_padding(css_language *c, *ctx = orig_ctx; return CSS_INVALID; } - + if (side_length[side_count] < 0) { *ctx = orig_ctx; return CSS_INVALID; diff --git a/src/parse/properties/pause.c b/src/parse/properties/pause.c index fcb4644..e45a8f4 100644 --- a/src/parse/properties/pause.c +++ b/src/parse/properties/pause.c @@ -62,7 +62,7 @@ css_error css__parse_pause(css_language *c, error = CSS_INVALID; } else { error = css__parse_pause_after(c, vector, ctx, result); - if (error == CSS_OK) { + if (error == CSS_OK) { /* second token parsed */ if (is_css_inherit(c, first_token)) { /* valid second token after inherit */ diff --git a/src/parse/properties/play_during.c b/src/parse/properties/play_during.c index 1e5ad63..109ae64 100644 --- a/src/parse/properties/play_during.c +++ b/src/parse/properties/play_during.c @@ -27,8 +27,8 @@ * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ -css_error css__parse_play_during(css_language *c, - const parserutils_vector *vector, int *ctx, +css_error css__parse_play_during(css_language *c, + const parserutils_vector *vector, int *ctx, css_style *result) { int orig_ctx = *ctx; @@ -42,7 +42,7 @@ css_error css__parse_play_during(css_language *c, /* URI [ IDENT(mix) || IDENT(repeat) ]? | IDENT(auto,none,inherit) */ token = parserutils_vector_iterate(vector, ctx); - if ((token == NULL) || + if ((token == NULL) || ((token->type != CSS_TOKEN_IDENT) && (token->type != CSS_TOKEN_URI))) { *ctx = orig_ctx; @@ -79,8 +79,8 @@ css_error css__parse_play_during(css_language *c, return error; } - error = css__stylesheet_string_add(c->sheet, - uri, + error = css__stylesheet_string_add(c->sheet, + uri, &uri_snumber); if (error != CSS_OK) { *ctx = orig_ctx; @@ -95,7 +95,7 @@ css_error css__parse_play_during(css_language *c, if (token != NULL && token->type == CSS_TOKEN_IDENT) { if ((lwc_string_caseless_isequal( token->idata, c->strings[MIX], - &match) == lwc_error_ok && + &match) == lwc_error_ok && match)) { if ((value & PLAY_DURING_MIX) == 0) value |= PLAY_DURING_MIX; @@ -104,7 +104,7 @@ css_error css__parse_play_during(css_language *c, return CSS_INVALID; } } else if (lwc_string_caseless_isequal( - token->idata, + token->idata, c->strings[REPEAT], &match) == lwc_error_ok && match) { @@ -130,12 +130,12 @@ css_error css__parse_play_during(css_language *c, return error; } - if ((flags & FLAG_INHERIT) == false && + if ((flags & FLAG_INHERIT) == false && (value & PLAY_DURING_TYPE_MASK) == PLAY_DURING_URI) { error = css__stylesheet_style_append(result, uri_snumber); } - if (error != CSS_OK) + if (error != CSS_OK) *ctx = orig_ctx; return error; diff --git a/src/parse/properties/properties.h b/src/parse/properties/properties.h index e7b2bf7..4517515 100644 --- a/src/parse/properties/properties.h +++ b/src/parse/properties/properties.h @@ -16,32 +16,32 @@ /** * Type of property handler function */ -typedef css_error (*css_prop_handler)(css_language *c, - const parserutils_vector *vector, int *ctx, +typedef css_error (*css_prop_handler)(css_language *c, + const parserutils_vector *vector, int *ctx, css_style *result); extern const css_prop_handler property_handlers[LAST_PROP + 1 - FIRST_PROP]; css_error css__parse_azimuth(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_background(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_background_attachment(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_background_color(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_background_image(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_background_position(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_background_repeat(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_border(css_language *c, const parserutils_vector *vector, int *ctx, @@ -50,46 +50,46 @@ css_error css__parse_border_bottom(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_border_bottom_color(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_border_bottom_style(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_border_bottom_width(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_border_color(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_border_collapse(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_border_left(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_border_left_color(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_border_left_style(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_border_left_width(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_border_right(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_border_right_color(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_border_right_style(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_border_right_width(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_border_spacing(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_border_style(css_language *c, const parserutils_vector *vector, int *ctx, @@ -98,19 +98,19 @@ css_error css__parse_border_top(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_border_top_color(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_border_top_style(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_border_top_width(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_border_width(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_bottom(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_box_sizing(css_language *c, const parserutils_vector *vector, int *ctx, @@ -125,169 +125,169 @@ css_error css__parse_break_inside(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_caption_side(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_clear(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_clip(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_color(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_columns(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_column_count(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_column_fill(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_column_gap(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_column_rule(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_column_rule_color(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_column_rule_style(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_column_rule_width(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_column_span(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_column_width(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_content(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_counter_increment(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_counter_reset(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_cue(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_cue_after(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_cue_before(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_cursor(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_direction(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_display(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_elevation(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_empty_cells(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_float(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_font(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_font_family(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_font_size(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_font_style(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_font_variant(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_font_weight(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_height(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_left(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_letter_spacing(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_line_height(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_list_style(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_list_style_image(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_list_style_position(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_list_style_type(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_margin(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_margin_bottom(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_margin_left(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_margin_right(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_margin_top(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_max_height(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_max_width(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_min_height(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_min_width(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_opacity(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_orphans(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_outline(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_outline_color(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_outline_style(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_outline_width(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_overflow(css_language *c, const parserutils_vector *vector, int *ctx, @@ -302,124 +302,124 @@ css_error css__parse_padding(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_padding_bottom(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_padding_left(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_padding_right(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_padding_top(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_page_break_after(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_page_break_before(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_page_break_inside(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_pause(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_pause_after(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_pause_before(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_pitch_range(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_pitch(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_play_during(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_position(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_quotes(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_richness(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_right(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_speak_header(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_speak_numeral(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_speak_punctuation(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_speak(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_speech_rate(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_stress(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_table_layout(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_text_align(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_text_decoration(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_text_indent(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_text_transform(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_top(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_unicode_bidi(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_vertical_align(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_visibility(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_voice_family(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_volume(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_white_space(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_widows(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_width(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_word_spacing(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_writing_mode(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_z_index(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, css_style *result); #endif diff --git a/src/parse/properties/quotes.c b/src/parse/properties/quotes.c index b7fc294..9d3c4c9 100644 --- a/src/parse/properties/quotes.c +++ b/src/parse/properties/quotes.c @@ -69,39 +69,39 @@ css_error css__parse_quotes(css_language *c, uint32_t open_snumber; uint32_t close_snumber; - error = css__stylesheet_string_add(c->sheet, - lwc_string_ref(token->idata), + error = css__stylesheet_string_add(c->sheet, + lwc_string_ref(token->idata), &open_snumber); - if (error != CSS_OK) + if (error != CSS_OK) break; consumeWhitespace(vector, ctx); token = parserutils_vector_iterate(vector, ctx); - if ((token == NULL) || + if ((token == NULL) || (token->type != CSS_TOKEN_STRING)) { error = CSS_INVALID; break; } - error = css__stylesheet_string_add(c->sheet, - lwc_string_ref(token->idata), + error = css__stylesheet_string_add(c->sheet, + lwc_string_ref(token->idata), &close_snumber); - if (error != CSS_OK) + if (error != CSS_OK) break; consumeWhitespace(vector, ctx); error = CSS_FIRST_APPEND(QUOTES_STRING); - if (error != CSS_OK) + if (error != CSS_OK) break; error = css__stylesheet_style_append(result, open_snumber); - if (error != CSS_OK) + if (error != CSS_OK) break; error = css__stylesheet_style_append(result, close_snumber); - if (error != CSS_OK) + if (error != CSS_OK) break; first = false; @@ -115,7 +115,7 @@ css_error css__parse_quotes(css_language *c, if (error == CSS_OK) { /* AddTerminator */ error = css__stylesheet_style_append(result, QUOTES_NONE); - } + } } else { error = CSS_INVALID; } diff --git a/src/parse/properties/text_decoration.c b/src/parse/properties/text_decoration.c index 9bfdec2..a7bae24 100644 --- a/src/parse/properties/text_decoration.c +++ b/src/parse/properties/text_decoration.c @@ -27,8 +27,8 @@ * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ -css_error css__parse_text_decoration(css_language *c, - const parserutils_vector *vector, int *ctx, +css_error css__parse_text_decoration(css_language *c, + const parserutils_vector *vector, int *ctx, css_style *result) { int orig_ctx = *ctx; diff --git a/src/parse/properties/utils.c b/src/parse/properties/utils.c index 82dacf8..47b06e3 100644 --- a/src/parse/properties/utils.c +++ b/src/parse/properties/utils.c @@ -136,28 +136,28 @@ css_error css__parse_border_side(css_language *c, /* Firstly, handle inherit */ token = parserutils_vector_peek(vector, *ctx); - if (token == NULL) + if (token == NULL) return CSS_INVALID; - + if (is_css_inherit(c, token)) { error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_TOP_COLOR + side); - if (error != CSS_OK) + if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_TOP_STYLE + side); - if (error != CSS_OK) - return error; + if (error != CSS_OK) + return error; error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_TOP_WIDTH + side); - if (error == CSS_OK) + if (error == CSS_OK) parserutils_vector_iterate(vector, ctx); return error; - } + } /* allocate styles */ error = css__stylesheet_style_create(c->sheet, &color_style); - if (error != CSS_OK) + if (error != CSS_OK) return error; error = css__stylesheet_style_create(c->sheet, &style_style); @@ -188,19 +188,19 @@ css_error css__parse_border_side(css_language *c, /* Try each property parser in turn, but only if we * haven't already got a value for this property. */ - if ((color) && - (error = css__parse_border_side_color(c, vector, ctx, + if ((color) && + (error = css__parse_border_side_color(c, vector, ctx, color_style, CSS_PROP_BORDER_TOP_COLOR + side)) == CSS_OK) { color = false; - } else if ((style) && + } else if ((style) && (error = css__parse_border_side_style(c, vector, ctx, style_style, CSS_PROP_BORDER_TOP_STYLE + side)) == CSS_OK) { style = false; - } else if ((width) && + } else if ((width) && (error = css__parse_border_side_width(c, vector, ctx, width_style, CSS_PROP_BORDER_TOP_WIDTH + side)) == CSS_OK) { width = false; - } + } if (error == CSS_OK) { consumeWhitespace(vector, ctx); @@ -214,7 +214,7 @@ css_error css__parse_border_side(css_language *c, if (style) { error = css__stylesheet_style_appendOPV(style_style, - CSS_PROP_BORDER_TOP_STYLE + side, 0, + CSS_PROP_BORDER_TOP_STYLE + side, 0, BORDER_STYLE_NONE); if (error != CSS_OK) goto css__parse_border_side_cleanup; @@ -295,7 +295,7 @@ static void HSL_to_RGB(css_fixed hue, css_fixed sat, css_fixed lit, uint8_t *r, /* Compute min(r,g,b) */ min_rgb = FSUB(FMUL(lit, INTTOFIX(2)), max_rgb); - /* We know that the value of at least one of the components is + /* We know that the value of at least one of the components is * max(r,g,b) and that the value of at least one of the other * components is min(r,g,b). * @@ -370,7 +370,7 @@ css_error css__parse_colour_specifier(css_language *c, consumeWhitespace(vector, ctx); - /* IDENT() | + /* IDENT() | * HASH(rgb | rrggbb) | * FUNCTION(rgb) [ [ NUMBER | PERCENTAGE ] ',' ] {3} ')' * FUNCTION(rgba) [ [ NUMBER | PERCENTAGE ] ',' ] {4} ')' @@ -539,8 +539,8 @@ css_error css__parse_colour_specifier(css_language *c, css_fixed hue, sat, lit; int32_t alpha = 255; - /* hue is a number without a unit representing an - * angle (0-360) degrees + /* hue is a number without a unit representing an + * angle (0-360) degrees */ consumeWhitespace(vector, ctx); @@ -615,7 +615,7 @@ css_error css__parse_colour_specifier(css_language *c, if (!tokenIsChar(token, ',')) goto invalid; - + consumeWhitespace(vector, ctx); token = parserutils_vector_iterate(vector, ctx); @@ -625,7 +625,7 @@ css_error css__parse_colour_specifier(css_language *c, alpha = css__number_from_lwc_string(token->idata, false, &consumed); if (consumed != lwc_string_length(token->idata)) goto invalid; /* failed to consume the whole string as a number */ - + alpha = FIXTOINT(FMUL(alpha, F_255)); consumeWhitespace(vector, ctx); @@ -1074,11 +1074,11 @@ css_error css__ident_list_or_string_to_string(css_language *c, lwc_string **result) { const css_token *token; - + token = parserutils_vector_peek(vector, *ctx); if (token == NULL) return CSS_INVALID; - + if (token->type == CSS_TOKEN_STRING) { token = parserutils_vector_iterate(vector, ctx); *result = lwc_string_ref(token->idata); @@ -1087,7 +1087,7 @@ css_error css__ident_list_or_string_to_string(css_language *c, return css__ident_list_to_string(c, vector, ctx, reserved, result); } - + return CSS_INVALID; } @@ -1126,7 +1126,7 @@ css_error css__ident_list_to_string(css_language *c, /* We know this token exists, and is an IDENT */ token = parserutils_vector_iterate(vector, ctx); - /* Consume all subsequent IDENT or S tokens */ + /* Consume all subsequent IDENT or S tokens */ while (token != NULL && (token->type == CSS_TOKEN_IDENT || token->type == CSS_TOKEN_S)) { if (token->type == CSS_TOKEN_IDENT) { @@ -1136,12 +1136,12 @@ css_error css__ident_list_to_string(css_language *c, goto cleanup; } - perror = parserutils_buffer_append(buffer, - (const uint8_t *) lwc_string_data(token->idata), + perror = parserutils_buffer_append(buffer, + (const uint8_t *) lwc_string_data(token->idata), lwc_string_length(token->idata)); } else { /* S */ - perror = parserutils_buffer_append(buffer, + perror = parserutils_buffer_append(buffer, (const uint8_t *) " ", 1); } @@ -1232,7 +1232,7 @@ css_error css__comma_list_to_style(css_language *c, if (error != CSS_OK) goto cleanup; - error = css__stylesheet_style_append(result, + error = css__stylesheet_style_append(result, value); if (error != CSS_OK) goto cleanup; @@ -1251,7 +1251,7 @@ css_error css__comma_list_to_style(css_language *c, css_code_t value = get_value(c, token, first); uint32_t snumber; - error = css__stylesheet_string_add(c->sheet, + error = css__stylesheet_string_add(c->sheet, lwc_string_ref(token->idata), &snumber); if (error != CSS_OK) goto cleanup; diff --git a/src/parse/properties/utils.h b/src/parse/properties/utils.h index b7b31da..e4c97c7 100644 --- a/src/parse/properties/utils.h +++ b/src/parse/properties/utils.h @@ -10,7 +10,7 @@ #include "parse/language.h" -static inline bool is_css_inherit(css_language *c, const css_token *token) +static inline bool is_css_inherit(css_language *c, const css_token *token) { bool match; return ((token->type == CSS_TOKEN_IDENT) && @@ -168,7 +168,7 @@ css_error css__parse_colour_specifier(css_language *c, const parserutils_vector *vector, int *ctx, uint16_t *value, uint32_t *result); -css_error css__parse_named_colour(css_language *c, lwc_string *data, +css_error css__parse_named_colour(css_language *c, lwc_string *data, uint32_t *result); css_error css__parse_hash_colour(lwc_string *data, uint32_t *result); @@ -178,7 +178,7 @@ css_error css__parse_unit_specifier(css_language *c, uint32_t default_unit, css_fixed *length, uint32_t *unit); -css_error css__parse_unit_keyword(const char *ptr, size_t len, +css_error css__parse_unit_keyword(const char *ptr, size_t len, uint32_t *unit); css_error css__ident_list_or_string_to_string(css_language *c, @@ -195,7 +195,7 @@ css_error css__comma_list_to_style(css_language *c, const parserutils_vector *vector, int *ctx, bool (*reserved)(css_language *c, const css_token *ident), css_code_t (*get_value)(css_language *c, - const css_token *token, + const css_token *token, bool first), css_style *result); diff --git a/src/parse/properties/voice_family.c b/src/parse/properties/voice_family.c index 8a969a6..193cb6b 100644 --- a/src/parse/properties/voice_family.c +++ b/src/parse/properties/voice_family.c @@ -83,8 +83,8 @@ static css_code_t voice_family_value(css_language *c, const css_token *token, bo * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ -css_error css__parse_voice_family(css_language *c, - const parserutils_vector *vector, int *ctx, +css_error css__parse_voice_family(css_language *c, + const parserutils_vector *vector, int *ctx, css_style *result) { int orig_ctx = *ctx; @@ -93,7 +93,7 @@ css_error css__parse_voice_family(css_language *c, bool match; /* [ IDENT+ | STRING ] [ ',' [ IDENT+ | STRING ] ]* | IDENT(inherit) - * + * * In the case of IDENT+, any whitespace between tokens is collapsed to * a single space */ diff --git a/src/parse/propstrings.h b/src/parse/propstrings.h index 1203c22..e0d16e2 100644 --- a/src/parse/propstrings.h +++ b/src/parse/propstrings.h @@ -22,15 +22,15 @@ enum { CHARSET, LIBCSS_IMPORT, MEDIA, NAMESPACE, FONT_FACE, PAGE, /* Media types */ - AURAL, BRAILLE, EMBOSSED, HANDHELD, PRINT, PROJECTION, + AURAL, BRAILLE, EMBOSSED, HANDHELD, PRINT, PROJECTION, SCREEN, SPEECH, TTY, TV, ALL, /* Pseudo classes */ - FIRST_CHILD, LINK, VISITED, HOVER, ACTIVE, FOCUS, LANG, + FIRST_CHILD, LINK, VISITED, HOVER, ACTIVE, FOCUS, LANG, /* LEFT, RIGHT, -- already in properties */ FIRST, ROOT, NTH_CHILD, NTH_LAST_CHILD, NTH_OF_TYPE, NTH_LAST_OF_TYPE, LAST_CHILD, FIRST_OF_TYPE, LAST_OF_TYPE, ONLY_CHILD, - ONLY_OF_TYPE, EMPTY, TARGET, ENABLED, DISABLED, CHECKED, NOT, + ONLY_OF_TYPE, EMPTY, TARGET, ENABLED, DISABLED, CHECKED, NOT, /* Pseudo elements */ FIRST_LINE, FIRST_LETTER, BEFORE, AFTER, @@ -38,14 +38,14 @@ enum { /* Properties */ FIRST_PROP, - AZIMUTH = FIRST_PROP, BACKGROUND, BACKGROUND_ATTACHMENT, - BACKGROUND_COLOR, BACKGROUND_IMAGE, BACKGROUND_POSITION, - BACKGROUND_REPEAT, BORDER, BORDER_BOTTOM, BORDER_BOTTOM_COLOR, - BORDER_BOTTOM_STYLE, BORDER_BOTTOM_WIDTH, BORDER_COLLAPSE, - BORDER_COLOR, BORDER_LEFT, BORDER_LEFT_COLOR, BORDER_LEFT_STYLE, - BORDER_LEFT_WIDTH, BORDER_RIGHT, BORDER_RIGHT_COLOR, - BORDER_RIGHT_STYLE, BORDER_RIGHT_WIDTH, BORDER_SPACING, - BORDER_STYLE, BORDER_TOP, BORDER_TOP_COLOR, BORDER_TOP_STYLE, + AZIMUTH = FIRST_PROP, BACKGROUND, BACKGROUND_ATTACHMENT, + BACKGROUND_COLOR, BACKGROUND_IMAGE, BACKGROUND_POSITION, + BACKGROUND_REPEAT, BORDER, BORDER_BOTTOM, BORDER_BOTTOM_COLOR, + BORDER_BOTTOM_STYLE, BORDER_BOTTOM_WIDTH, BORDER_COLLAPSE, + BORDER_COLOR, BORDER_LEFT, BORDER_LEFT_COLOR, BORDER_LEFT_STYLE, + BORDER_LEFT_WIDTH, BORDER_RIGHT, BORDER_RIGHT_COLOR, + BORDER_RIGHT_STYLE, BORDER_RIGHT_WIDTH, BORDER_SPACING, + BORDER_STYLE, BORDER_TOP, BORDER_TOP_COLOR, BORDER_TOP_STYLE, BORDER_TOP_WIDTH, BORDER_WIDTH, BOTTOM, BOX_SIZING, BREAK_AFTER, BREAK_BEFORE, BREAK_INSIDE, CAPTION_SIDE, CLEAR, CLIP, COLOR, COLUMNS, COLUMN_COUNT, COLUMN_FILL, COLUMN_GAP, COLUMN_RULE, COLUMN_RULE_COLOR, @@ -79,7 +79,7 @@ enum { TABLE_CELL, TABLE_CAPTION, BELOW, LEVEL, ABOVE, HIGHER, LOWER, SHOW, HIDE, XX_SMALL, X_SMALL, SMALL, LARGE, X_LARGE, XX_LARGE, LARGER, SMALLER, NORMAL, ITALIC, OBLIQUE, SMALL_CAPS, BOLD, BOLDER, - LIGHTER, INSIDE, OUTSIDE, DISC, CIRCLE, SQUARE, DECIMAL, + LIGHTER, INSIDE, OUTSIDE, DISC, CIRCLE, SQUARE, DECIMAL, DECIMAL_LEADING_ZERO, LOWER_ROMAN, UPPER_ROMAN, LOWER_GREEK, LOWER_LATIN, UPPER_LATIN, ARMENIAN, GEORGIAN, LOWER_ALPHA, UPPER_ALPHA, INVERT, VISIBLE, ALWAYS, AVOID, X_LOW, LOW, HIGH, X_HIGH, LIBCSS_STATIC, @@ -88,12 +88,12 @@ enum { UPPERCASE, LOWERCASE, EMBED, BIDI_OVERRIDE, BASELINE, SUB, SUPER, TEXT_TOP, MIDDLE, TEXT_BOTTOM, SILENT, X_SOFT, SOFT, LOUD, X_LOUD, PRE, NOWRAP, PRE_WRAP, PRE_LINE, LEFTWARDS, RIGHTWARDS, LEFT_SIDE, - FAR_LEFT, CENTER_LEFT, CENTER_RIGHT, FAR_RIGHT, RIGHT_SIDE, BEHIND, - RECT, OPEN_QUOTE, CLOSE_QUOTE, NO_OPEN_QUOTE, NO_CLOSE_QUOTE, ATTR, - COUNTER, COUNTERS, CROSSHAIR, DEFAULT, POINTER, MOVE, E_RESIZE, - NE_RESIZE, NW_RESIZE, N_RESIZE, SE_RESIZE, SW_RESIZE, S_RESIZE, + FAR_LEFT, CENTER_LEFT, CENTER_RIGHT, FAR_RIGHT, RIGHT_SIDE, BEHIND, + RECT, OPEN_QUOTE, CLOSE_QUOTE, NO_OPEN_QUOTE, NO_CLOSE_QUOTE, ATTR, + COUNTER, COUNTERS, CROSSHAIR, DEFAULT, POINTER, MOVE, E_RESIZE, + NE_RESIZE, NW_RESIZE, N_RESIZE, SE_RESIZE, SW_RESIZE, S_RESIZE, W_RESIZE, LIBCSS_TEXT, WAIT, HELP, PROGRESS, SERIF, SANS_SERIF, CURSIVE, - FANTASY, MONOSPACE, MALE, FEMALE, CHILD, MIX, UNDERLINE, OVERLINE, + FANTASY, MONOSPACE, MALE, FEMALE, CHILD, MIX, UNDERLINE, OVERLINE, LINE_THROUGH, BLINK, RGB, RGBA, HSL, HSLA, LIBCSS_LEFT, LIBCSS_CENTER, LIBCSS_RIGHT, CURRENTCOLOR, ODD, EVEN, SRC, LOCAL, INITIAL, FORMAT, WOFF, TRUETYPE, OPENTYPE, EMBEDDED_OPENTYPE, SVG, COLUMN, @@ -111,14 +111,14 @@ enum { DARKORCHID, DARKRED, DARKSALMON, DARKSEAGREEN, DARKSLATEBLUE, DARKSLATEGRAY, DARKSLATEGREY, DARKTURQUOISE, DARKVIOLET, DEEPPINK, DEEPSKYBLUE, DIMGRAY, DIMGREY, DODGERBLUE, FELDSPAR, FIREBRICK, - FLORALWHITE, FORESTGREEN, FUCHSIA, GAINSBORO, GHOSTWHITE, GOLD, + FLORALWHITE, FORESTGREEN, FUCHSIA, GAINSBORO, GHOSTWHITE, GOLD, GOLDENROD, GRAY, GREEN, GREENYELLOW, GREY, HONEYDEW, HOTPINK, INDIANRED, INDIGO, IVORY, KHAKI, LAVENDER, LAVENDERBLUSH, LAWNGREEN, LEMONCHIFFON, LIGHTBLUE, LIGHTCORAL, LIGHTCYAN, LIGHTGOLDENRODYELLOW, LIGHTGRAY, LIGHTGREEN, LIGHTGREY, LIGHTPINK, LIGHTSALMON, LIGHTSEAGREEN, - LIGHTSKYBLUE, LIGHTSLATEBLUE, LIGHTSLATEGRAY, LIGHTSLATEGREY, + LIGHTSKYBLUE, LIGHTSLATEBLUE, LIGHTSLATEGRAY, LIGHTSLATEGREY, LIGHTSTEELBLUE, LIGHTYELLOW, LIME, LIMEGREEN, LINEN, MAGENTA, MAROON, - MEDIUMAQUAMARINE, MEDIUMBLUE, MEDIUMORCHID, MEDIUMPURPLE, + MEDIUMAQUAMARINE, MEDIUMBLUE, MEDIUMORCHID, MEDIUMPURPLE, MEDIUMSEAGREEN, MEDIUMSLATEBLUE, MEDIUMSPRINGGREEN, MEDIUMTURQUOISE, MEDIUMVIOLETRED, MIDNIGHTBLUE, MINTCREAM, MISTYROSE, MOCCASIN, NAVAJOWHITE, NAVY, OLDLACE, OLIVE, OLIVEDRAB, ORANGE, ORANGERED, @@ -126,7 +126,7 @@ enum { PAPAYAWHIP, PEACHPUFF, PERU, PINK, PLUM, POWDERBLUE, PURPLE, RED, ROSYBROWN, ROYALBLUE, SADDLEBROWN, SALMON, SANDYBROWN, SEAGREEN, SEASHELL, SIENNA, SILVER, SKYBLUE, SLATEBLUE, SLATEGRAY, SLATEGREY, - SNOW, SPRINGGREEN, STEELBLUE, TAN, TEAL, THISTLE, TOMATO, TURQUOISE, + SNOW, SPRINGGREEN, STEELBLUE, TAN, TEAL, THISTLE, TOMATO, TURQUOISE, VIOLET, VIOLETRED, WHEAT, WHITE, WHITESMOKE, YELLOW, YELLOWGREEN, LAST_COLOUR = YELLOWGREEN, -- cgit v1.2.3