diff options
author | Thomas Martitz <kugel@rockbox.org> | 2012-04-17 17:06:51 +0200 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2012-04-17 17:07:43 +0200 |
commit | 728db2150277206ae82d6f5ed82b86cf779ee653 (patch) | |
tree | 6869ff16071c31c5a5e0679b095edd8e8f2aade6 /lib/skin_parser/skin_scan.c | |
parent | e43b856ed0f2fa3cb03a1335c9dc311b572e88e2 (diff) | |
download | rockbox-728db2150277206ae82d6f5ed82b86cf779ee653.tar.gz rockbox-728db2150277206ae82d6f5ed82b86cf779ee653.zip |
Revert "skin_engine: rework the parser to be closer to the langauge grammar."
This reverts commit ec8b21eef8b2fe1bd02f335dbc0dfbf05c2deff2 which was pushed by accident.
Change-Id: I1aaedf6876d0448a100dc582b79f1293d021bac1
Reviewed-on: http://gerrit.rockbox.org/216
Reviewed-by: Thomas Martitz <kugel@rockbox.org>
Diffstat (limited to 'lib/skin_parser/skin_scan.c')
-rw-r--r-- | lib/skin_parser/skin_scan.c | 71 |
1 files changed, 20 insertions, 51 deletions
diff --git a/lib/skin_parser/skin_scan.c b/lib/skin_parser/skin_scan.c index f6424aba53..50d58bc250 100644 --- a/lib/skin_parser/skin_scan.c +++ b/lib/skin_parser/skin_scan.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include "skin_debug.h" | 28 | #include "skin_debug.h" |
29 | #include "symbols.h" | 29 | #include "symbols.h" |
30 | #include "skin_parser.h" | 30 | #include "skin_parser.h" |
31 | #include "tag_table.h" | ||
32 | 31 | ||
33 | /* Scanning Functions */ | 32 | /* Scanning Functions */ |
34 | 33 | ||
@@ -41,54 +40,6 @@ void skip_comment(const char** document) | |||
41 | (*document)++; | 40 | (*document)++; |
42 | } | 41 | } |
43 | 42 | ||
44 | void skip_tag(const char** document) | ||
45 | { | ||
46 | char tag_name[MAX_TAG_LENGTH]; | ||
47 | int i; | ||
48 | bool qmark; | ||
49 | const struct tag_info *tag; | ||
50 | const char *cursor; | ||
51 | |||
52 | if(**document == TAGSYM) | ||
53 | (*document)++; | ||
54 | qmark = (**document == CONDITIONSYM); | ||
55 | if (qmark) | ||
56 | (*document)++; | ||
57 | |||
58 | if (!qmark && find_escape_character(**document)) | ||
59 | { | ||
60 | (*document)++; | ||
61 | } | ||
62 | else | ||
63 | { | ||
64 | cursor = *document; | ||
65 | |||
66 | /* Checking the tag name */ | ||
67 | for (i=0; cursor[i] && i<MAX_TAG_LENGTH; i++) | ||
68 | tag_name[i] = cursor[i]; | ||
69 | |||
70 | /* First we check the two characters after the '%', then a single char */ | ||
71 | tag = NULL; | ||
72 | i = MAX_TAG_LENGTH; | ||
73 | while (!tag && i > 1) | ||
74 | { | ||
75 | tag_name[i-1] = '\0'; | ||
76 | tag = find_tag(tag_name); | ||
77 | i--; | ||
78 | } | ||
79 | |||
80 | if (tag) | ||
81 | { | ||
82 | *document += strlen(tag->name); | ||
83 | } | ||
84 | } | ||
85 | if (**document == ARGLISTOPENSYM) | ||
86 | skip_arglist(document); | ||
87 | |||
88 | if (**document == ENUMLISTOPENSYM) | ||
89 | skip_enumlist(document); | ||
90 | } | ||
91 | |||
92 | void skip_arglist(const char** document) | 43 | void skip_arglist(const char** document) |
93 | { | 44 | { |
94 | if(**document == ARGLISTOPENSYM) | 45 | if(**document == ARGLISTOPENSYM) |
@@ -96,7 +47,16 @@ void skip_arglist(const char** document) | |||
96 | while(**document && **document != ARGLISTCLOSESYM) | 47 | while(**document && **document != ARGLISTCLOSESYM) |
97 | { | 48 | { |
98 | if(**document == TAGSYM) | 49 | if(**document == TAGSYM) |
99 | skip_tag(document); | 50 | { |
51 | (*document)++; | ||
52 | if(**document == '\0') | ||
53 | break; | ||
54 | (*document)++; | ||
55 | } | ||
56 | else if(**document == ARGLISTOPENSYM) | ||
57 | skip_arglist(document); | ||
58 | else if(**document == ENUMLISTOPENSYM) | ||
59 | skip_enumlist(document); | ||
100 | else if(**document == COMMENTSYM) | 60 | else if(**document == COMMENTSYM) |
101 | skip_comment(document); | 61 | skip_comment(document); |
102 | else | 62 | else |
@@ -113,7 +73,16 @@ void skip_enumlist(const char** document) | |||
113 | while(**document && **document != ENUMLISTCLOSESYM) | 73 | while(**document && **document != ENUMLISTCLOSESYM) |
114 | { | 74 | { |
115 | if(**document == TAGSYM) | 75 | if(**document == TAGSYM) |
116 | skip_tag(document); | 76 | { |
77 | (*document)++; | ||
78 | if(**document == '\0') | ||
79 | break; | ||
80 | (*document)++; | ||
81 | } | ||
82 | else if(**document == ARGLISTOPENSYM) | ||
83 | skip_arglist(document); | ||
84 | else if(**document == ENUMLISTOPENSYM) | ||
85 | skip_enumlist(document); | ||
117 | else if(**document == COMMENTSYM) | 86 | else if(**document == COMMENTSYM) |
118 | skip_comment(document); | 87 | skip_comment(document); |
119 | else | 88 | else |