diff options
Diffstat (limited to 'lib/skin_parser/skin_scan.c')
-rw-r--r-- | lib/skin_parser/skin_scan.c | 71 |
1 files changed, 51 insertions, 20 deletions
diff --git a/lib/skin_parser/skin_scan.c b/lib/skin_parser/skin_scan.c index 50d58bc250..f93606d54d 100644 --- a/lib/skin_parser/skin_scan.c +++ b/lib/skin_parser/skin_scan.c | |||
@@ -28,6 +28,7 @@ | |||
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" | ||
31 | 32 | ||
32 | /* Scanning Functions */ | 33 | /* Scanning Functions */ |
33 | 34 | ||
@@ -40,6 +41,54 @@ void skip_comment(const char** document) | |||
40 | (*document)++; | 41 | (*document)++; |
41 | } | 42 | } |
42 | 43 | ||
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 | |||
43 | void skip_arglist(const char** document) | 92 | void skip_arglist(const char** document) |
44 | { | 93 | { |
45 | if(**document == ARGLISTOPENSYM) | 94 | if(**document == ARGLISTOPENSYM) |
@@ -47,16 +96,7 @@ void skip_arglist(const char** document) | |||
47 | while(**document && **document != ARGLISTCLOSESYM) | 96 | while(**document && **document != ARGLISTCLOSESYM) |
48 | { | 97 | { |
49 | if(**document == TAGSYM) | 98 | if(**document == TAGSYM) |
50 | { | 99 | skip_tag(document); |
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); | ||
60 | else if(**document == COMMENTSYM) | 100 | else if(**document == COMMENTSYM) |
61 | skip_comment(document); | 101 | skip_comment(document); |
62 | else | 102 | else |
@@ -73,16 +113,7 @@ void skip_enumlist(const char** document) | |||
73 | while(**document && **document != ENUMLISTCLOSESYM) | 113 | while(**document && **document != ENUMLISTCLOSESYM) |
74 | { | 114 | { |
75 | if(**document == TAGSYM) | 115 | if(**document == TAGSYM) |
76 | { | 116 | skip_tag(document); |
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); | ||
86 | else if(**document == COMMENTSYM) | 117 | else if(**document == COMMENTSYM) |
87 | skip_comment(document); | 118 | skip_comment(document); |
88 | else | 119 | else |