From f417312a71064550cf66bbbec41f1e18d38b74f2 Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Wed, 1 Feb 2012 21:53:31 +1100 Subject: skin parser: Allow the first character after conditional seperators to be \n This hopefully makes difficult conditionals more easy to read: i.e OLD: %?bp<%?bc<%xd(Ba)|%xd(Bb)>|%?bl<|%xd(Bc)|%xd(Bd)|%xd(Be)|%xd(Bf)|%xd(Bg)|%xd(Bh)|%xd(Bi)|%xd(Bj)>> NEW: %?bp< %?bc< %xd(Ba)|%xd(Bb) >| %?bl<|%xd(Bc)|%xd(Bd)| %xd(Be)|%xd(Bf)| %xd(Bg)|%xd(Bh)| %xd(Bi)|%xd(Bj) > > Change-Id: Ic89d2c95562b27e7427c3a5d528340f9aec55cf2 --- lib/skin_parser/skin_parser.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/skin_parser/skin_parser.c b/lib/skin_parser/skin_parser.c index 7dc0fa3a2f..24f64fd788 100644 --- a/lib/skin_parser/skin_parser.c +++ b/lib/skin_parser/skin_parser.c @@ -961,7 +961,7 @@ static int skin_parse_conditional(struct skin_element* element, const char** doc return 0; } bookmark = cursor; - while(*cursor != ENUMLISTCLOSESYM && *cursor != '\n' && *cursor != '\0') + while(*cursor != ENUMLISTCLOSESYM && *cursor != '\0') { if(*cursor == COMMENTSYM) { @@ -969,6 +969,8 @@ static int skin_parse_conditional(struct skin_element* element, const char** doc } else if(*cursor == ENUMLISTOPENSYM) { + if (*cursor == '\n') + cursor++; skip_enumlist(&cursor); } else if(*cursor == TAGSYM) @@ -982,6 +984,8 @@ static int skin_parse_conditional(struct skin_element* element, const char** doc { children++; cursor++; + if (*cursor == '\n') + cursor++; #ifdef ROCKBOX if (false_branch == NULL && !feature_available) { @@ -1038,6 +1042,11 @@ static int skin_parse_conditional(struct skin_element* element, const char** doc for(i = 0; i < children; i++) { + if (*cursor == '\n') + { + skin_line++; + cursor++; + } children_array[i] = skin_buffer_to_offset(skin_parse_code_as_arg(&cursor)); if (children_array[i] < 0) return 0; -- cgit v1.2.3