|
libcss
|
#include <assert.h>#include <string.h>#include <strings.h>#include "stylesheet.h"#include "bytecode/bytecode.h"#include "bytecode/opcodes.h"#include "parse/properties/properties.h"#include "parse/properties/utils.h"#include "utils/parserutilserror.h"Macros | |
| #define | MAP_ENTRIES 52 |
| #define | ORGB(R, G, B) |
Functions | |
| css_error | css__parse_list_style_type_value (css_language *c, const css_token *ident, uint16_t *value) |
| css_error | css__parse_border_side (css_language *c, const parserutils_vector *vector, int32_t *ctx, css_style *result, enum border_side_e side) |
| css_error | css__parse_colour_specifier (css_language *c, const parserutils_vector *vector, int32_t *ctx, uint16_t *value, uint32_t *result) |
| 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) |
| css_error | css__parse_unit_specifier (css_language *c, const parserutils_vector *vector, int32_t *ctx, uint32_t default_unit, css_fixed *length, uint32_t *unit) |
| 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, const parserutils_vector *vector, int32_t *ctx, bool(*reserved)(css_language *c, const css_token *ident), lwc_string **result) |
| css_error | css__ident_list_to_string (css_language *c, const parserutils_vector *vector, int32_t *ctx, bool(*reserved)(css_language *c, const css_token *ident), lwc_string **result) |
| css_error | css__comma_list_to_style (css_language *c, const parserutils_vector *vector, int32_t *ctx, bool(*reserved)(css_language *c, const css_token *ident), css_code_t(*get_value)(css_language *c, const css_token *token, bool first), css_style *result) |
| css_error | css__parse_calc (css_language *c, const parserutils_vector *vector, int *ctx, css_style *result, css_code_t OPV, uint32_t unit) |
| #define MAP_ENTRIES 52 |
| #define ORGB | ( | R, | |
| G, | |||
| B | |||
| ) |
| css_error css__comma_list_to_style | ( | css_language * | c, |
| const parserutils_vector * | vector, | ||
| int32_t * | ctx, | ||
| bool(*)(css_language *c, const css_token *ident) | reserved, | ||
| css_code_t(*)(css_language *c, const css_token *token, bool first) | get_value, | ||
| css_style * | result | ||
| ) |
Parse a comma separated list, converting to bytecode
| c | Parsing context |
| vector | Vector of tokens to process |
| ctx | Pointer to vector iteration context |
| reserved | Callback to determine if an identifier is reserved |
| get_value | Callback to retrieve bytecode value for a token |
| style | Pointer to output style |
Post condition: *ctx is updated with the next token to process If the input is invalid, then *ctx remains unchanged.
| css_error css__ident_list_or_string_to_string | ( | css_language * | c, |
| const parserutils_vector * | vector, | ||
| int32_t * | ctx, | ||
| bool(*)(css_language *c, const css_token *ident) | reserved, | ||
| lwc_string ** | result | ||
| ) |
Create a string from a list of IDENT/S tokens if the next token is IDENT or references the next token's string if it is a STRING
| c | Parsing context |
| vector | Vector containing tokens |
| ctx | Vector iteration context |
| reserved | Callback to determine if an identifier is reserved |
| result | Pointer to location to receive resulting string |
Post condition: *ctx is updated with the next token to process If the input is invalid, then *ctx remains unchanged.
The resulting string's reference is passed to the caller
| css_error css__ident_list_to_string | ( | css_language * | c, |
| const parserutils_vector * | vector, | ||
| int32_t * | ctx, | ||
| bool(*)(css_language *c, const css_token *ident) | reserved, | ||
| lwc_string ** | result | ||
| ) |
Create a string from a list of IDENT/S tokens
| c | Parsing context |
| vector | Vector containing tokens |
| ctx | Vector iteration context |
| reserved | Callback to determine if an identifier is reserved |
| result | Pointer to location to receive resulting string |
Post condition: *ctx is updated with the next token to process If the input is invalid, then *ctx remains unchanged.
The resulting string's reference is passed to the caller
| css_error css__parse_border_side | ( | css_language * | c, |
| const parserutils_vector * | vector, | ||
| int32_t * | ctx, | ||
| css_style * | result, | ||
| enum border_side_e | side | ||
| ) |
Parse border-{top,right,bottom,left} shorthand
| c | Parsing context |
| vector | Vector of tokens to process |
| ctx | Pointer to vector iteration context |
| side | The side we're parsing for |
| result | Pointer to location to receive resulting style |
Post condition: *ctx is updated with the next token to process If the input is invalid, then *ctx remains unchanged.
| css_error css__parse_calc | ( | css_language * | c, |
| const parserutils_vector * | vector, | ||
| int * | ctx, | ||
| css_style * | result, | ||
| css_code_t | OPV, | ||
| uint32_t | unit | ||
| ) |
Parse a CSS calc() invocation
Calc can generate a number of kinds of units, so we have to tell the parser the kind of unit we're aiming for (e.g. UNIT_PX, UNIT_ANGLE, etc.)
| [in] | c | Parsing context |
| [in] | vector | Vector of tokens to process |
| [in] | ctx | Pointer to vector iteration context |
| [in] | result | Pointer to location to receive resulting style |
| [in] | OPV | The CSS property we are calculating for |
| [in] | unit | The kind of unit which we want to come out of this calc() |
Post condition: *ctx is updated with the next token to process If the input is invalid, then *ctx remains unchanged.
| css_error css__parse_colour_specifier | ( | css_language * | c, |
| const parserutils_vector * | vector, | ||
| int32_t * | ctx, | ||
| uint16_t * | value, | ||
| uint32_t * | result | ||
| ) |
Parse a colour specifier
| c | Parsing context |
| vector | Vector of tokens to process |
| ctx | Pointer to vector iteration context |
| value | Pointer to location to receive value |
| result | Pointer to location to receive result (AARRGGBB) |
Post condition: *ctx is updated with the next token to process If the input is invalid, then *ctx remains unchanged.
| css_error css__parse_hash_colour | ( | lwc_string * | data, |
| uint32_t * | result | ||
| ) |
Parse a hash colour (#rgb, #rgba, #rrggbb or #rrggbbaa)
| data | Pointer to colour string |
| result | Pointer to location to receive result (AARRGGBB) |
| css_error css__parse_list_style_type_value | ( | css_language * | c, |
| const css_token * | ident, | ||
| uint16_t * | value | ||
| ) |
Parse list-style-type value
| c | Parsing context |
| ident | Identifier to consider |
| value | Pointer to location to receive value |
| css_error css__parse_named_colour | ( | css_language * | c, |
| lwc_string * | data, | ||
| uint32_t * | result | ||
| ) |
Parse a named colour
| c | Parsing context |
| data | Colour name string |
| result | Pointer to location to receive result |
Legacy system colour mapping
| css_error css__parse_unit_keyword | ( | const char * | ptr, |
| size_t | len, | ||
| uint32_t * | unit | ||
| ) |
Parse a unit keyword
| ptr | Pointer to keyword string |
| len | Length, in bytes, of string |
| unit | Pointer to location to receive computed unit |
| css_error css__parse_unit_specifier | ( | css_language * | c, |
| const parserutils_vector * | vector, | ||
| int32_t * | ctx, | ||
| uint32_t | default_unit, | ||
| css_fixed * | length, | ||
| uint32_t * | unit | ||
| ) |
Parse a unit specifier
| c | Parsing context |
| vector | Vector of tokens to process |
| ctx | Pointer to current vector iteration context |
| default_unit | The default unit to use if none specified |
| length | Pointer to location to receive length |
| unit | Pointer to location to receive unit |
Post condition: *ctx is updated with the next token to process If the input is invalid, then *ctx remains unchanged.