summaryrefslogtreecommitdiff
path: root/src/parse
diff options
context:
space:
mode:
Diffstat (limited to 'src/parse')
-rw-r--r--src/parse/properties/utils.c116
-rw-r--r--src/parse/propstrings.c14
-rw-r--r--src/parse/propstrings.h3
3 files changed, 66 insertions, 67 deletions
diff --git a/src/parse/properties/utils.c b/src/parse/properties/utils.c
index 0e49853..a71e22d 100644
--- a/src/parse/properties/utils.c
+++ b/src/parse/properties/utils.c
@@ -29,77 +29,60 @@
css_error css__parse_list_style_type_value(css_language *c, const css_token *ident,
uint16_t *value)
{
- bool match;
-
/* IDENT (disc, circle, square, decimal, decimal-leading-zero,
* lower-roman, upper-roman, lower-greek, lower-latin,
* upper-latin, armenian, georgian, lower-alpha, upper-alpha,
* none)
*/
- if ((lwc_string_caseless_isequal(
- ident->idata, c->strings[DISC],
- &match) == lwc_error_ok && match)) {
- *value = LIST_STYLE_TYPE_DISC;
- } else if ((lwc_string_caseless_isequal(
- ident->idata, c->strings[CIRCLE],
- &match) == lwc_error_ok && match)) {
- *value = LIST_STYLE_TYPE_CIRCLE;
- } else if ((lwc_string_caseless_isequal(
- ident->idata, c->strings[SQUARE],
- &match) == lwc_error_ok && match)) {
- *value = LIST_STYLE_TYPE_SQUARE;
- } else if ((lwc_string_caseless_isequal(
- ident->idata, c->strings[DECIMAL],
- &match) == lwc_error_ok && match)) {
- *value = LIST_STYLE_TYPE_DECIMAL;
- } else if ((lwc_string_caseless_isequal(
- ident->idata, c->strings[DECIMAL_LEADING_ZERO],
- &match) == lwc_error_ok && match)) {
- *value = LIST_STYLE_TYPE_DECIMAL_LEADING_ZERO;
- } else if ((lwc_string_caseless_isequal(
- ident->idata, c->strings[LOWER_ROMAN],
- &match) == lwc_error_ok && match)) {
- *value = LIST_STYLE_TYPE_LOWER_ROMAN;
- } else if ((lwc_string_caseless_isequal(
- ident->idata, c->strings[UPPER_ROMAN],
- &match) == lwc_error_ok && match)) {
- *value = LIST_STYLE_TYPE_UPPER_ROMAN;
- } else if ((lwc_string_caseless_isequal(
- ident->idata, c->strings[LOWER_GREEK],
- &match) == lwc_error_ok && match)) {
- *value = LIST_STYLE_TYPE_LOWER_GREEK;
- } else if ((lwc_string_caseless_isequal(
- ident->idata, c->strings[LOWER_LATIN],
- &match) == lwc_error_ok && match)) {
- *value = LIST_STYLE_TYPE_LOWER_LATIN;
- } else if ((lwc_string_caseless_isequal(
- ident->idata, c->strings[UPPER_LATIN],
- &match) == lwc_error_ok && match)) {
- *value = LIST_STYLE_TYPE_UPPER_LATIN;
- } else if ((lwc_string_caseless_isequal(
- ident->idata, c->strings[ARMENIAN],
- &match) == lwc_error_ok && match)) {
- *value = LIST_STYLE_TYPE_ARMENIAN;
- } else if ((lwc_string_caseless_isequal(
- ident->idata, c->strings[GEORGIAN],
- &match) == lwc_error_ok && match)) {
- *value = LIST_STYLE_TYPE_GEORGIAN;
- } else if ((lwc_string_caseless_isequal(
- ident->idata, c->strings[LOWER_ALPHA],
- &match) == lwc_error_ok && match)) {
- *value = LIST_STYLE_TYPE_LOWER_ALPHA;
- } else if ((lwc_string_caseless_isequal(
- ident->idata, c->strings[UPPER_ALPHA],
- &match) == lwc_error_ok && match)) {
- *value = LIST_STYLE_TYPE_UPPER_ALPHA;
- } else if ((lwc_string_caseless_isequal(
- ident->idata, c->strings[NONE],
- &match) == lwc_error_ok && match)) {
- *value = LIST_STYLE_TYPE_NONE;
- } else
- return CSS_INVALID;
+ #define MAP_ENTRIES 29
+ bool match;
+ int midx;
+ const struct {
+ int stringid;
+ int value;
+ } mapping[MAP_ENTRIES] = {
+ { DISC, LIST_STYLE_TYPE_DISC },
+ { CIRCLE, LIST_STYLE_TYPE_CIRCLE },
+ { SQUARE, LIST_STYLE_TYPE_SQUARE },
+ { DECIMAL, LIST_STYLE_TYPE_DECIMAL },
+ { DECIMAL_LEADING_ZERO, LIST_STYLE_TYPE_DECIMAL_LEADING_ZERO },
+ { LOWER_ROMAN, LIST_STYLE_TYPE_LOWER_ROMAN },
+ { UPPER_ROMAN, LIST_STYLE_TYPE_UPPER_ROMAN },
+ { LOWER_GREEK, LIST_STYLE_TYPE_LOWER_GREEK },
+ { LOWER_LATIN, LIST_STYLE_TYPE_LOWER_LATIN },
+ { UPPER_LATIN, LIST_STYLE_TYPE_UPPER_LATIN },
+ { ARMENIAN, LIST_STYLE_TYPE_ARMENIAN },
+ { GEORGIAN, LIST_STYLE_TYPE_GEORGIAN },
+ { LOWER_ALPHA, LIST_STYLE_TYPE_LOWER_ALPHA },
+ { UPPER_ALPHA, LIST_STYLE_TYPE_UPPER_ALPHA },
+ { NONE, LIST_STYLE_TYPE_NONE },
+ { BINARY, LIST_STYLE_TYPE_BINARY },
+ { OCTAL, LIST_STYLE_TYPE_OCTAL},
+ { LOWER_HEXADECIMAL, LIST_STYLE_TYPE_LOWER_HEXADECIMAL },
+ { UPPER_HEXADECIMAL, LIST_STYLE_TYPE_UPPER_HEXADECIMAL },
+ { ARABIC_INDIC, LIST_STYLE_TYPE_ARABIC_INDIC },
+ { LOWER_ARMENIAN, LIST_STYLE_TYPE_LOWER_ARMENIAN },
+ { UPPER_ARMENIAN, LIST_STYLE_TYPE_UPPER_ARMENIAN },
+ { BENGALI, LIST_STYLE_TYPE_BENGALI },
+ { CAMBODIAN, LIST_STYLE_TYPE_CAMBODIAN },
+ { KHMER, LIST_STYLE_TYPE_KHMER },
+ { CJK_DECIMAL, LIST_STYLE_TYPE_CJK_DECIMAL },
+ { DEVANAGARI, LIST_STYLE_TYPE_DEVANAGARI },
+ { GUJARATI, LIST_STYLE_TYPE_GUJARATI },
+ { GURMUKHI, LIST_STYLE_TYPE_GURMUKHI }
+ };
- return CSS_OK;
+ for (midx = 0; midx < MAP_ENTRIES; midx++) {
+ if ((lwc_string_caseless_isequal(
+ ident->idata,
+ c->strings[mapping[midx].stringid],
+ &match) == lwc_error_ok && match)) {
+ *value = mapping[midx].value;
+ return CSS_OK;
+ }
+ }
+
+ return CSS_INVALID;
}
@@ -1117,7 +1100,7 @@ css_error css__ident_list_or_string_to_string(css_language *c,
token = parserutils_vector_iterate(vector, ctx);
*result = lwc_string_ref(token->idata);
return CSS_OK;
- } else if(token->type == CSS_TOKEN_IDENT) {
+ } else if(token->type == CSS_TOKEN_IDENT) {
return css__ident_list_to_string(c, vector, ctx, reserved,
result);
}
@@ -1333,4 +1316,3 @@ cleanup:
return error;
}
-
diff --git a/src/parse/propstrings.c b/src/parse/propstrings.c
index 3c9401b..302f7f8 100644
--- a/src/parse/propstrings.c
+++ b/src/parse/propstrings.c
@@ -309,6 +309,20 @@ const stringmap_entry stringmap[LAST_KNOWN] = {
{ "georgian", SLEN("georgian") },
{ "lower-alpha", SLEN("lower-alpha") },
{ "upper-alpha", SLEN("upper-alpha") },
+ { "binary", SLEN("binary") },
+ { "octal", SLEN("octal") },
+ { "lower-hexadecimal", SLEN("lower-hexadecimal") },
+ { "upper-hexadecimal", SLEN("upper-hexadecimal") },
+ { "arabic-indic", SLEN("arabic-indic") },
+ { "lower-armenian", SLEN("lower-armenian") },
+ { "upper-armenian", SLEN("upper-armenian") },
+ { "bengali", SLEN("bengali") },
+ { "cambodian", SLEN("cambodian") },
+ { "khmer", SLEN("khmer") },
+ { "cjk-decimal", SLEN("cjk-decimal") },
+ { "devanagari", SLEN("devanagari") },
+ { "gujarati", SLEN("gujarati") },
+ { "gurmukhi", SLEN("gurmukhi") },
{ "invert", SLEN("invert") },
{ "visible", SLEN("visible") },
{ "always", SLEN("always") },
diff --git a/src/parse/propstrings.h b/src/parse/propstrings.h
index 24b681b..65954c6 100644
--- a/src/parse/propstrings.h
+++ b/src/parse/propstrings.h
@@ -83,6 +83,9 @@ enum {
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,
+ BINARY, OCTAL, LOWER_HEXADECIMAL, UPPER_HEXADECIMAL, ARABIC_INDIC,
+ LOWER_ARMENIAN, UPPER_ARMENIAN, BENGALI, CAMBODIAN, KHMER, CJK_DECIMAL,
+ DEVANAGARI, GUJARATI, GURMUKHI,
INVERT, VISIBLE, ALWAYS, AVOID, X_LOW, LOW, HIGH, X_HIGH, LIBCSS_STATIC,
RELATIVE, ABSOLUTE, ONCE, DIGITS, CONTINUOUS, CODE, SPELL_OUT, X_SLOW,
SLOW, FAST, X_FAST, FASTER, SLOWER, CENTER, JUSTIFY, CAPITALIZE,