From 1338ceef5c2ff3cccbf288d39162a50b03491497 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sat, 13 Aug 2022 16:18:36 +0100 Subject: Parse: Update code generator to support new values --- src/parse/properties/css_property_parser_gen.c | 46 +++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/src/parse/properties/css_property_parser_gen.c b/src/parse/properties/css_property_parser_gen.c index 24cc536..1e8b007 100644 --- a/src/parse/properties/css_property_parser_gen.c +++ b/src/parse/properties/css_property_parser_gen.c @@ -169,18 +169,38 @@ void output_ident(FILE *outputf, bool only_ident, struct keyval *parseid, struct "if ("); if (!only_ident) { fprintf(outputf, - "(token->type == CSS_TOKEN_IDENT) && "); + "(token->type == CSS_TOKEN_IDENT) &&\n\t\t\t"); } fprintf(outputf, - "(lwc_string_caseless_isequal(token->idata, c->strings[%s], &match) == lwc_error_ok && match)) {\n", + "(lwc_string_caseless_isequal(\n" + "\t\t\ttoken->idata, c->strings[%s],\n" + "\t\t\t&match) == lwc_error_ok && match)) {\n", ckv->key); if (strcmp(ckv->key,"INHERIT") == 0) { fprintf(outputf, - "\t\t\terror = css_stylesheet_style_inherit(result, %s);\n", + "\t\terror = css_stylesheet_style_inherit(result,\n" + "\t\t\t\t%s);\n\n", + parseid->val); + } else if (strcmp(ckv->key,"INITIAL") == 0) { + fprintf(outputf, + "\t\terror = css_stylesheet_style_initial(result,\n" + "\t\t\t\t%s);\n\n", + parseid->val); + } else if (strcmp(ckv->key,"REVERT") == 0) { + fprintf(outputf, + "\t\terror = css_stylesheet_style_revert(result,\n" + "\t\t\t\t%s);\n\n", + parseid->val); + } else if (strcmp(ckv->key,"UNSET") == 0) { + fprintf(outputf, + "\t\terror = css_stylesheet_style_unset(result,\n" + "\t\t\t\t%s);\n\n", parseid->val); } else { fprintf(outputf, - "\t\t\terror = css__stylesheet_style_appendOPV(result, %s, %s);\n", + "\t\terror = css__stylesheet_style_appendOPV(result,\n" + "\t\t\t\t%s,\n" + "\t\t\t\t%s);\n\n", parseid->val, ckv->val); } @@ -466,10 +486,22 @@ void output_wrap(FILE *outputf, struct keyval *parseid, struct keyval_list *WRAP } char str_INHERIT[] = "INHERIT"; +char str_INITIAL[] = "INITIAL"; +char str_REVERT[] = "REVERT"; +char str_UNSET[] = "UNSET"; struct keyval ident_inherit = { .key = str_INHERIT, }; +struct keyval ident_initial = { + .key = str_INITIAL, +}; +struct keyval ident_unset = { + .key = str_UNSET, +}; +struct keyval ident_revert = { + .key = str_REVERT, +}; int main(int argc, char **argv) { @@ -554,6 +586,12 @@ int main(int argc, char **argv) curlist = &base; } else if (strcmp(rkv->val, str_INHERIT) == 0) { IDENT.item[IDENT.count++] = &ident_inherit; + } else if (strcmp(rkv->val, str_INITIAL) == 0) { + IDENT.item[IDENT.count++] = &ident_initial; + } else if (strcmp(rkv->val, str_REVERT) == 0) { + IDENT.item[IDENT.count++] = &ident_revert; + } else if (strcmp(rkv->val, str_UNSET) == 0) { + IDENT.item[IDENT.count++] = &ident_unset; } } else if (strcmp(rkv->key, "IDENT_LIST") == 0) { if (rkv->val[0] == '(') { -- cgit v1.2.1