summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2012-02-01 21:53:31 +1100
committerJonathan Gordon <rockbox@jdgordon.info>2012-02-01 22:05:06 +1100
commitf417312a71064550cf66bbbec41f1e18d38b74f2 (patch)
tree422d94b09764cfa80a3500c0dbd091e4efc50968
parent5f387c28ce716cb6991c36dd9a1e77069066f0ea (diff)
downloadrockbox-f417312a71064550cf66bbbec41f1e18d38b74f2.tar.gz
rockbox-f417312a71064550cf66bbbec41f1e18d38b74f2.zip
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
-rw-r--r--lib/skin_parser/skin_parser.c11
1 files changed, 10 insertions, 1 deletions
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
961 return 0; 961 return 0;
962 } 962 }
963 bookmark = cursor; 963 bookmark = cursor;
964 while(*cursor != ENUMLISTCLOSESYM && *cursor != '\n' && *cursor != '\0') 964 while(*cursor != ENUMLISTCLOSESYM && *cursor != '\0')
965 { 965 {
966 if(*cursor == COMMENTSYM) 966 if(*cursor == COMMENTSYM)
967 { 967 {
@@ -969,6 +969,8 @@ static int skin_parse_conditional(struct skin_element* element, const char** doc
969 } 969 }
970 else if(*cursor == ENUMLISTOPENSYM) 970 else if(*cursor == ENUMLISTOPENSYM)
971 { 971 {
972 if (*cursor == '\n')
973 cursor++;
972 skip_enumlist(&cursor); 974 skip_enumlist(&cursor);
973 } 975 }
974 else if(*cursor == TAGSYM) 976 else if(*cursor == TAGSYM)
@@ -982,6 +984,8 @@ static int skin_parse_conditional(struct skin_element* element, const char** doc
982 { 984 {
983 children++; 985 children++;
984 cursor++; 986 cursor++;
987 if (*cursor == '\n')
988 cursor++;
985#ifdef ROCKBOX 989#ifdef ROCKBOX
986 if (false_branch == NULL && !feature_available) 990 if (false_branch == NULL && !feature_available)
987 { 991 {
@@ -1038,6 +1042,11 @@ static int skin_parse_conditional(struct skin_element* element, const char** doc
1038 1042
1039 for(i = 0; i < children; i++) 1043 for(i = 0; i < children; i++)
1040 { 1044 {
1045 if (*cursor == '\n')
1046 {
1047 skin_line++;
1048 cursor++;
1049 }
1041 children_array[i] = skin_buffer_to_offset(skin_parse_code_as_arg(&cursor)); 1050 children_array[i] = skin_buffer_to_offset(skin_parse_code_as_arg(&cursor));
1042 if (children_array[i] < 0) 1051 if (children_array[i] < 0)
1043 return 0; 1052 return 0;