diff options
author | Robert Bieber <robby@bieberphoto.com> | 2010-07-18 00:59:02 +0000 |
---|---|---|
committer | Robert Bieber <robby@bieberphoto.com> | 2010-07-18 00:59:02 +0000 |
commit | 3c4fb8abe4e28091cb857705af2d762cd00b985a (patch) | |
tree | 804090633b693cbb185d801a75683404d345e2fc /lib/skin_parser/skin_parser.c | |
parent | eb52a45a0c1f42386dbc0e148e81972ae3878b71 (diff) | |
download | rockbox-3c4fb8abe4e28091cb857705af2d762cd00b985a.tar.gz rockbox-3c4fb8abe4e28091cb857705af2d762cd00b985a.zip |
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.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/lib/skin_parser/skin_parser.c b/lib/skin_parser/skin_parser.c index 5bc5984fb7..3e23067258 100644 --- a/lib/skin_parser/skin_parser.c +++ b/lib/skin_parser/skin_parser.c | |||
@@ -34,6 +34,7 @@ | |||
34 | 34 | ||
35 | /* Global variables for the parser */ | 35 | /* Global variables for the parser */ |
36 | int skin_line = 0; | 36 | int skin_line = 0; |
37 | char* skin_start = 0; | ||
37 | int viewport_line = 0; | 38 | int viewport_line = 0; |
38 | 39 | ||
39 | /* Auxiliary parsing functions (not visible at global scope) */ | 40 | /* Auxiliary parsing functions (not visible at global scope) */ |
@@ -66,6 +67,7 @@ struct skin_element* skin_parse(const char* document) | |||
66 | char* cursor = (char*)document; /*Keeps track of location in the document*/ | 67 | char* cursor = (char*)document; /*Keeps track of location in the document*/ |
67 | 68 | ||
68 | skin_line = 1; | 69 | skin_line = 1; |
70 | skin_start = (char*)document; | ||
69 | viewport_line = 0; | 71 | viewport_line = 0; |
70 | 72 | ||
71 | skin_clear_errors(); | 73 | skin_clear_errors(); |
@@ -381,7 +383,7 @@ static struct skin_element* skin_parse_sublines_optional(char** document, | |||
381 | 383 | ||
382 | if(*cursor != MULTILINESYM && i != sublines - 1) | 384 | if(*cursor != MULTILINESYM && i != sublines - 1) |
383 | { | 385 | { |
384 | skin_error(MULTILINE_EXPECTED); | 386 | skin_error(MULTILINE_EXPECTED, cursor); |
385 | return NULL; | 387 | return NULL; |
386 | } | 388 | } |
387 | else if(i != sublines - 1) | 389 | else if(i != sublines - 1) |
@@ -433,7 +435,7 @@ static int skin_parse_tag(struct skin_element* element, char** document) | |||
433 | 435 | ||
434 | if(!tag) | 436 | if(!tag) |
435 | { | 437 | { |
436 | skin_error(ILLEGAL_TAG); | 438 | skin_error(ILLEGAL_TAG, cursor); |
437 | return 0; | 439 | return 0; |
438 | } | 440 | } |
439 | 441 | ||
@@ -464,7 +466,7 @@ static int skin_parse_tag(struct skin_element* element, char** document) | |||
464 | /* Checking the number of arguments and allocating args */ | 466 | /* Checking the number of arguments and allocating args */ |
465 | if(*cursor != ARGLISTOPENSYM && tag_args[0] != '|') | 467 | if(*cursor != ARGLISTOPENSYM && tag_args[0] != '|') |
466 | { | 468 | { |
467 | skin_error(ARGLIST_EXPECTED); | 469 | skin_error(ARGLIST_EXPECTED, cursor); |
468 | return 0; | 470 | return 0; |
469 | } | 471 | } |
470 | else | 472 | else |
@@ -512,7 +514,7 @@ static int skin_parse_tag(struct skin_element* element, char** document) | |||
512 | /* Making sure we haven't run out of arguments */ | 514 | /* Making sure we haven't run out of arguments */ |
513 | if(*tag_args == '\0') | 515 | if(*tag_args == '\0') |
514 | { | 516 | { |
515 | skin_error(TOO_MANY_ARGS); | 517 | skin_error(TOO_MANY_ARGS, cursor); |
516 | return 0; | 518 | return 0; |
517 | } | 519 | } |
518 | 520 | ||
@@ -545,7 +547,7 @@ static int skin_parse_tag(struct skin_element* element, char** document) | |||
545 | } | 547 | } |
546 | else | 548 | else |
547 | { | 549 | { |
548 | skin_error(DEFAULT_NOT_ALLOWED); | 550 | skin_error(DEFAULT_NOT_ALLOWED, cursor); |
549 | return 0; | 551 | return 0; |
550 | } | 552 | } |
551 | } | 553 | } |
@@ -554,7 +556,7 @@ static int skin_parse_tag(struct skin_element* element, char** document) | |||
554 | /* Scanning an int argument */ | 556 | /* Scanning an int argument */ |
555 | if(!isdigit(*cursor) && *cursor != '-') | 557 | if(!isdigit(*cursor) && *cursor != '-') |
556 | { | 558 | { |
557 | skin_error(INT_EXPECTED); | 559 | skin_error(INT_EXPECTED, cursor); |
558 | return 0; | 560 | return 0; |
559 | } | 561 | } |
560 | 562 | ||
@@ -610,12 +612,12 @@ static int skin_parse_tag(struct skin_element* element, char** document) | |||
610 | 612 | ||
611 | if(*cursor != ARGLISTSEPERATESYM && i < num_args - 1) | 613 | if(*cursor != ARGLISTSEPERATESYM && i < num_args - 1) |
612 | { | 614 | { |
613 | skin_error(SEPERATOR_EXPECTED); | 615 | skin_error(SEPERATOR_EXPECTED, cursor); |
614 | return 0; | 616 | return 0; |
615 | } | 617 | } |
616 | else if(*cursor != ARGLISTCLOSESYM && i == num_args - 1) | 618 | else if(*cursor != ARGLISTCLOSESYM && i == num_args - 1) |
617 | { | 619 | { |
618 | skin_error(CLOSE_EXPECTED); | 620 | skin_error(CLOSE_EXPECTED, cursor); |
619 | return 0; | 621 | return 0; |
620 | } | 622 | } |
621 | else | 623 | else |
@@ -639,7 +641,7 @@ static int skin_parse_tag(struct skin_element* element, char** document) | |||
639 | /* Checking for a premature end */ | 641 | /* Checking for a premature end */ |
640 | if(*tag_args != '\0' && !optional) | 642 | if(*tag_args != '\0' && !optional) |
641 | { | 643 | { |
642 | skin_error(INSUFFICIENT_ARGS); | 644 | skin_error(INSUFFICIENT_ARGS, cursor); |
643 | return 0; | 645 | return 0; |
644 | } | 646 | } |
645 | 647 | ||
@@ -724,7 +726,7 @@ static int skin_parse_conditional(struct skin_element* element, char** document) | |||
724 | /* Counting the children */ | 726 | /* Counting the children */ |
725 | if(*(cursor++) != ENUMLISTOPENSYM) | 727 | if(*(cursor++) != ENUMLISTOPENSYM) |
726 | { | 728 | { |
727 | skin_error(ARGLIST_EXPECTED); | 729 | skin_error(ARGLIST_EXPECTED, cursor); |
728 | return 0; | 730 | return 0; |
729 | } | 731 | } |
730 | bookmark = cursor; | 732 | bookmark = cursor; |
@@ -768,12 +770,12 @@ static int skin_parse_conditional(struct skin_element* element, char** document) | |||
768 | 770 | ||
769 | if(i < children - 1 && *cursor != ENUMLISTSEPERATESYM) | 771 | if(i < children - 1 && *cursor != ENUMLISTSEPERATESYM) |
770 | { | 772 | { |
771 | skin_error(SEPERATOR_EXPECTED); | 773 | skin_error(SEPERATOR_EXPECTED, cursor); |
772 | return 0; | 774 | return 0; |
773 | } | 775 | } |
774 | else if(i == children - 1 && *cursor != ENUMLISTCLOSESYM) | 776 | else if(i == children - 1 && *cursor != ENUMLISTCLOSESYM) |
775 | { | 777 | { |
776 | skin_error(CLOSE_EXPECTED); | 778 | skin_error(CLOSE_EXPECTED, cursor); |
777 | return 0; | 779 | return 0; |
778 | } | 780 | } |
779 | else | 781 | else |