diff options
| author | Jonathan Gordon <rockbox@jdgordon.info> | 2012-04-16 15:42:24 +1000 |
|---|---|---|
| committer | Thomas Martitz <kugel@rockbox.org> | 2012-04-17 17:05:20 +0200 |
| commit | e43b856ed0f2fa3cb03a1335c9dc311b572e88e2 (patch) | |
| tree | 4b22c3178612058c739e4e76500433d11d51615a /lib/skin_parser/skin_parser.c | |
| parent | e92fbb42d7d25311cc03a69390ba758033d5134a (diff) | |
| download | rockbox-e43b856ed0f2fa3cb03a1335c9dc311b572e88e2.zip rockbox-e43b856ed0f2fa3cb03a1335c9dc311b572e88e2.tar.gz rockbox-e43b856ed0f2fa3cb03a1335c9dc311b572e88e2.tar.bz2 rockbox-e43b856ed0f2fa3cb03a1335c9dc311b572e88e2.tar.xz | |
skin_engine: rework the parser to be closer to the langauge grammar.
The parser was unconditionally scanning things which it thought
were conditional/enum lists (or tag arg lists) when they couldn't
possibly be (i.e < inside a param which should be valid).
This change fixes it (i.e %?and(%if(%pv, <, -50), %if(%mp, > 1))
is perfectly valid now.
This *may* break your exsiting skins if you were using %if with < or >
Change-Id: Ibcb42bc6bb78908f79de024b61276b91b1ce02a0
Reviewed-on: http://gerrit.rockbox.org/214
Reviewed-by: Thomas Martitz <kugel@rockbox.org>
Diffstat (limited to 'lib/skin_parser/skin_parser.c')
| -rw-r--r-- | lib/skin_parser/skin_parser.c | 65 |
1 files changed, 5 insertions, 60 deletions
diff --git a/lib/skin_parser/skin_parser.c b/lib/skin_parser/skin_parser.c index a81bcde..44a1c03 100644 --- a/lib/skin_parser/skin_parser.c +++ b/lib/skin_parser/skin_parser.c @@ -182,26 +182,12 @@ static struct skin_element* skin_parse_viewport(const char** document) } else if(*cursor == TAGSYM) { - /* A ';' directly after a '%' doesn't count */ - cursor ++; - - if(*cursor == '\0') - break; - - cursor++; + skip_tag(&cursor); } else if(*cursor == COMMENTSYM) { skip_comment(&cursor); } - else if(*cursor == ARGLISTOPENSYM) - { - skip_arglist(&cursor); - } - else if(*cursor == ENUMLISTOPENSYM) - { - skip_enumlist(&cursor); - } else { /* Advancing the cursor as normal */ @@ -445,20 +431,9 @@ static struct skin_element* skin_parse_sublines_optional(const char** document, { skip_comment(&cursor); } - else if(*cursor == ENUMLISTOPENSYM) - { - skip_enumlist(&cursor); - } - else if(*cursor == ARGLISTOPENSYM) - { - skip_arglist(&cursor); - } else if(*cursor == TAGSYM) { - cursor++; - if(*cursor == '\0' || *cursor == '\n') - break; - cursor++; + skip_tag(&cursor); } else if(*cursor == MULTILINESYM) { @@ -595,19 +570,12 @@ static int skin_parse_tag(struct skin_element* element, const char** document) /* Skipping over escaped characters */ if(*cursor == TAGSYM) { - cursor++; - if(*cursor == '\0') - break; - cursor++; + skip_tag(&cursor); } else if(*cursor == COMMENTSYM) { skip_comment(&cursor); } - else if(*cursor == ARGLISTOPENSYM) - { - skip_arglist(&cursor); - } else if(*cursor == ARGLISTSEPARATESYM) { num_args++; @@ -974,18 +942,9 @@ static int skin_parse_conditional(struct skin_element* element, const char** doc { skip_comment(&cursor); } - else if(*cursor == ENUMLISTOPENSYM) - { - if (*cursor == '\n') - cursor++; - skip_enumlist(&cursor); - } else if(*cursor == TAGSYM) { - cursor++; - if(*cursor == '\0' || *cursor == '\n') - break; - cursor++; + skip_tag(&cursor); } else if(*cursor == ENUMLISTSEPARATESYM) { @@ -1139,21 +1098,7 @@ static struct skin_element* skin_parse_code_as_arg(const char** document) } else if(*cursor == TAGSYM) { - /* A ';' directly after a '%' doesn't count */ - cursor ++; - - if(*cursor == '\0') - break; - - cursor++; - } - else if(*cursor == ARGLISTOPENSYM) - { - skip_arglist(&cursor); - } - else if(*cursor == ENUMLISTOPENSYM) - { - skip_enumlist(&cursor); + skip_tag(&cursor); } else { |