summaryrefslogtreecommitdiff
path: root/lib/skin_parser/skin_parser.c
diff options
context:
space:
mode:
authorRobert Bieber <robby@bieberphoto.com>2010-07-18 00:59:02 +0000
committerRobert Bieber <robby@bieberphoto.com>2010-07-18 00:59:02 +0000
commit3c4fb8abe4e28091cb857705af2d762cd00b985a (patch)
tree804090633b693cbb185d801a75683404d345e2fc /lib/skin_parser/skin_parser.c
parenteb52a45a0c1f42386dbc0e148e81972ae3878b71 (diff)
downloadrockbox-3c4fb8abe4e28091cb857705af2d762cd00b985a.zip
rockbox-3c4fb8abe4e28091cb857705af2d762cd00b985a.tar.gz
rockbox-3c4fb8abe4e28091cb857705af2d762cd00b985a.tar.bz2
rockbox-3c4fb8abe4e28091cb857705af2d762cd00b985a.tar.xz
Theme Editor: Added column number to parser error messages
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27477 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'lib/skin_parser/skin_parser.c')
-rw-r--r--lib/skin_parser/skin_parser.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/lib/skin_parser/skin_parser.c b/lib/skin_parser/skin_parser.c
index 5bc5984..3e23067 100644
--- a/lib/skin_parser/skin_parser.c
+++ b/lib/skin_parser/skin_parser.c
@@ -34,6 +34,7 @@
/* Global variables for the parser */
int skin_line = 0;
+char* skin_start = 0;
int viewport_line = 0;
/* Auxiliary parsing functions (not visible at global scope) */
@@ -66,6 +67,7 @@ struct skin_element* skin_parse(const char* document)
char* cursor = (char*)document; /*Keeps track of location in the document*/
skin_line = 1;
+ skin_start = (char*)document;
viewport_line = 0;
skin_clear_errors();
@@ -381,7 +383,7 @@ static struct skin_element* skin_parse_sublines_optional(char** document,
if(*cursor != MULTILINESYM && i != sublines - 1)
{
- skin_error(MULTILINE_EXPECTED);
+ skin_error(MULTILINE_EXPECTED, cursor);
return NULL;
}
else if(i != sublines - 1)
@@ -433,7 +435,7 @@ static int skin_parse_tag(struct skin_element* element, char** document)
if(!tag)
{
- skin_error(ILLEGAL_TAG);
+ skin_error(ILLEGAL_TAG, cursor);
return 0;
}
@@ -464,7 +466,7 @@ static int skin_parse_tag(struct skin_element* element, char** document)
/* Checking the number of arguments and allocating args */
if(*cursor != ARGLISTOPENSYM && tag_args[0] != '|')
{
- skin_error(ARGLIST_EXPECTED);
+ skin_error(ARGLIST_EXPECTED, cursor);
return 0;
}
else
@@ -512,7 +514,7 @@ static int skin_parse_tag(struct skin_element* element, char** document)
/* Making sure we haven't run out of arguments */
if(*tag_args == '\0')
{
- skin_error(TOO_MANY_ARGS);
+ skin_error(TOO_MANY_ARGS, cursor);
return 0;
}
@@ -545,7 +547,7 @@ static int skin_parse_tag(struct skin_element* element, char** document)
}
else
{
- skin_error(DEFAULT_NOT_ALLOWED);
+ skin_error(DEFAULT_NOT_ALLOWED, cursor);
return 0;
}
}
@@ -554,7 +556,7 @@ static int skin_parse_tag(struct skin_element* element, char** document)
/* Scanning an int argument */
if(!isdigit(*cursor) && *cursor != '-')
{
- skin_error(INT_EXPECTED);
+ skin_error(INT_EXPECTED, cursor);
return 0;
}
@@ -610,12 +612,12 @@ static int skin_parse_tag(struct skin_element* element, char** document)
if(*cursor != ARGLISTSEPERATESYM && i < num_args - 1)
{
- skin_error(SEPERATOR_EXPECTED);
+ skin_error(SEPERATOR_EXPECTED, cursor);
return 0;
}
else if(*cursor != ARGLISTCLOSESYM && i == num_args - 1)
{
- skin_error(CLOSE_EXPECTED);
+ skin_error(CLOSE_EXPECTED, cursor);
return 0;
}
else
@@ -639,7 +641,7 @@ static int skin_parse_tag(struct skin_element* element, char** document)
/* Checking for a premature end */
if(*tag_args != '\0' && !optional)
{
- skin_error(INSUFFICIENT_ARGS);
+ skin_error(INSUFFICIENT_ARGS, cursor);
return 0;
}
@@ -724,7 +726,7 @@ static int skin_parse_conditional(struct skin_element* element, char** document)
/* Counting the children */
if(*(cursor++) != ENUMLISTOPENSYM)
{
- skin_error(ARGLIST_EXPECTED);
+ skin_error(ARGLIST_EXPECTED, cursor);
return 0;
}
bookmark = cursor;
@@ -768,12 +770,12 @@ static int skin_parse_conditional(struct skin_element* element, char** document)
if(i < children - 1 && *cursor != ENUMLISTSEPERATESYM)
{
- skin_error(SEPERATOR_EXPECTED);
+ skin_error(SEPERATOR_EXPECTED, cursor);
return 0;
}
else if(i == children - 1 && *cursor != ENUMLISTCLOSESYM)
{
- skin_error(CLOSE_EXPECTED);
+ skin_error(CLOSE_EXPECTED, cursor);
return 0;
}
else