diff options
Diffstat (limited to 'gui/ThemeParser.h')
-rw-r--r-- | gui/ThemeParser.h | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/gui/ThemeParser.h b/gui/ThemeParser.h index 762baefd7f..df99893d58 100644 --- a/gui/ThemeParser.h +++ b/gui/ThemeParser.h @@ -52,25 +52,33 @@ public: enum ParserState { kParserNeedKey, kParserNeedKeyName, - kParserNeedKeyValues, + + kParserNeedPropertyName, + kParserNeedPropertyOperator, + kParserNeedPropertyValue, + kParserError }; bool parse(); - void parseKeyValue(Common::String &key_name); - void parseActiveKey(bool closed); - - void parserError(const char *error_string); - void debug_testEval(); protected: void parserCallback_DRAW(); void parserCallback_DRAWDATA(); - inline void skipSpaces() { - while (isspace(_text[_pos])) + bool parseKeyValue(Common::String &key_name); + void parseActiveKey(bool closed); + void parserError(const char *error_string); + + inline bool skipSpaces() { + if (!isspace(_text[_pos])) + return false; + + while (_text[_pos] && isspace(_text[_pos])) _pos++; + + return true; } inline bool skipComments() { @@ -85,6 +93,18 @@ protected: return false; } + inline bool isValidNameChar(char c) { + return isalnum(c) || c == '_'; + } + + inline bool parseToken() { + _token.clear(); + while (isValidNameChar(_text[_pos])) + _token += _text[_pos++]; + + return (_text[_pos] != 0); + } + int _pos; char *_text; |