1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Jonathan Gordon 2012-02-01 21:53:31 +11:00
parent 5f387c28ce
commit f417312a71

View file

@ -961,7 +961,7 @@ static int skin_parse_conditional(struct skin_element* element, const char** doc
return 0; return 0;
} }
bookmark = cursor; bookmark = cursor;
while(*cursor != ENUMLISTCLOSESYM && *cursor != '\n' && *cursor != '\0') while(*cursor != ENUMLISTCLOSESYM && *cursor != '\0')
{ {
if(*cursor == COMMENTSYM) if(*cursor == COMMENTSYM)
{ {
@ -969,6 +969,8 @@ static int skin_parse_conditional(struct skin_element* element, const char** doc
} }
else if(*cursor == ENUMLISTOPENSYM) else if(*cursor == ENUMLISTOPENSYM)
{ {
if (*cursor == '\n')
cursor++;
skip_enumlist(&cursor); skip_enumlist(&cursor);
} }
else if(*cursor == TAGSYM) else if(*cursor == TAGSYM)
@ -982,6 +984,8 @@ static int skin_parse_conditional(struct skin_element* element, const char** doc
{ {
children++; children++;
cursor++; cursor++;
if (*cursor == '\n')
cursor++;
#ifdef ROCKBOX #ifdef ROCKBOX
if (false_branch == NULL && !feature_available) 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++) 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)); children_array[i] = skin_buffer_to_offset(skin_parse_code_as_arg(&cursor));
if (children_array[i] < 0) if (children_array[i] < 0)
return 0; return 0;