summaryrefslogtreecommitdiff
path: root/utils/themeeditor/skin_parser.c
diff options
context:
space:
mode:
authorRobert Bieber <robby@bieberphoto.com>2010-06-02 07:48:48 +0000
committerRobert Bieber <robby@bieberphoto.com>2010-06-02 07:48:48 +0000
commit496bcf39c7070ad35c73610d2f2dd492cae8b94c (patch)
tree8b881cfa1e4d466e7d0f125723250ccb6d5c04d5 /utils/themeeditor/skin_parser.c
parent7f10b0336e9aacd4fb21269da652671ff610aa05 (diff)
downloadrockbox-496bcf39c7070ad35c73610d2f2dd492cae8b94c.tar.gz
rockbox-496bcf39c7070ad35c73610d2f2dd492cae8b94c.zip
Theme Editor: Fixed parsing and code generation for nested conditionals
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26467 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/themeeditor/skin_parser.c')
-rw-r--r--utils/themeeditor/skin_parser.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/utils/themeeditor/skin_parser.c b/utils/themeeditor/skin_parser.c
index 94d059bfcc..a771fe7584 100644
--- a/utils/themeeditor/skin_parser.c
+++ b/utils/themeeditor/skin_parser.c
@@ -295,6 +295,7 @@ struct skin_element* skin_parse_sublines_optional(char** document,
295 char* cursor = *document; 295 char* cursor = *document;
296 int sublines = 1; 296 int sublines = 1;
297 int i; 297 int i;
298 int nested = 0;
298 299
299 retval = skin_alloc_element(); 300 retval = skin_alloc_element();
300 retval->type = SUBLINES; 301 retval->type = SUBLINES;
@@ -311,8 +312,24 @@ struct skin_element* skin_parse_sublines_optional(char** document,
311 && !(check_viewport(cursor) && cursor != *document)) 312 && !(check_viewport(cursor) && cursor != *document))
312 { 313 {
313 if(*cursor == COMMENTSYM) 314 if(*cursor == COMMENTSYM)
315 {
314 skip_comment(&cursor); 316 skip_comment(&cursor);
317 continue;
318 }
315 319
320 if(*cursor == ENUMLISTOPENSYM && conditional)
321 {
322 nested++;
323 cursor++;
324 while(nested)
325 {
326 if(*cursor == ENUMLISTOPENSYM)
327 nested++;
328 if(*cursor == ENUMLISTCLOSESYM)
329 nested--;
330 cursor++;
331 }
332 }
316 /* Accounting for escaped subline symbols */ 333 /* Accounting for escaped subline symbols */
317 if(*cursor == TAGSYM) 334 if(*cursor == TAGSYM)
318 { 335 {
@@ -637,6 +654,7 @@ int skin_parse_conditional(struct skin_element* element, char** document)
637 struct skin_element* tag = skin_alloc_element(); /* The tag to evaluate */ 654 struct skin_element* tag = skin_alloc_element(); /* The tag to evaluate */
638 int children = 1; 655 int children = 1;
639 int i; 656 int i;
657 int nested = 0;
640 658
641 element->type = CONDITIONAL; 659 element->type = CONDITIONAL;
642 element->line = skin_line; 660 element->line = skin_line;
@@ -660,6 +678,20 @@ int skin_parse_conditional(struct skin_element* element, char** document)
660 continue; 678 continue;
661 } 679 }
662 680
681 if(*cursor == ENUMLISTOPENSYM)
682 {
683 nested++;
684 cursor++;
685 while(nested)
686 {
687 if(*cursor == ENUMLISTOPENSYM)
688 nested++;
689 if(*cursor == ENUMLISTCLOSESYM)
690 nested--;
691 cursor++;
692 }
693 }
694
663 if(*cursor == TAGSYM) 695 if(*cursor == TAGSYM)
664 { 696 {
665 cursor++; 697 cursor++;