diff options
author | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2015-01-21 01:17:49 +0100 |
---|---|---|
committer | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2015-01-21 01:17:49 +0100 |
commit | 6decad0b8e7e369bd8215f31a45dd3eae982d2a9 (patch) | |
tree | 96d22db47629956c554d11a9e56bc68a2fc9b40b /src/plugins/css | |
parent | 311a770805dff2cdffc1ecbfbbf0c5aae44c8878 (diff) |
Some further refactoring -- renamed Scope to ParserScope, got rid of parser namespace, added new functionality to RegistryClass, wrote documentation, added function for extracting file extensions to Utils
Diffstat (limited to 'src/plugins/css')
-rw-r--r-- | src/plugins/css/CSSParser.cpp | 8 | ||||
-rw-r--r-- | src/plugins/css/CSSParser.hpp | 20 |
2 files changed, 6 insertions, 22 deletions
diff --git a/src/plugins/css/CSSParser.cpp b/src/plugins/css/CSSParser.cpp index 40486cc..8cb41ea 100644 --- a/src/plugins/css/CSSParser.cpp +++ b/src/plugins/css/CSSParser.cpp @@ -19,10 +19,9 @@ #include "CSSParser.hpp" #include <core/common/VariantReader.hpp> +#include <core/parser/ParserContext.hpp> namespace ousia { -namespace parser { -namespace css { // CSS code tokens static const int CURLY_OPEN = 1; @@ -75,7 +74,7 @@ static const std::map<int, CodeTokenDescriptor> CSS_DESCRIPTORS = { {ESCAPE, {CodeTokenMode::ESCAPE, ESCAPE}}, {LINEBREAK, {CodeTokenMode::LINEBREAK, LINEBREAK}}}; -Rooted<Node> CSSParser::parse(CharReader &reader, ParserContext &ctx) +Rooted<Node> CSSParser::doParse(CharReader &reader, ParserContext &ctx) { CodeTokenizer tokenizer{reader, CSS_ROOT, CSS_DESCRIPTORS}; tokenizer.ignoreComments = true; @@ -362,5 +361,4 @@ bool CSSParser::expect(int expectedType, CodeTokenizer &tokenizer, Token &t, return true; } } -} -} + diff --git a/src/plugins/css/CSSParser.hpp b/src/plugins/css/CSSParser.hpp index 1ec54f5..c6594f6 100644 --- a/src/plugins/css/CSSParser.hpp +++ b/src/plugins/css/CSSParser.hpp @@ -24,6 +24,7 @@ * * @author Benjamin Paassen - bpaassen@techfak.uni-bielefeld.de */ + #ifndef _OUSIA_CSS_PARSER_HPP_ #define _OUSIA_CSS_PARSER_HPP_ @@ -36,8 +37,6 @@ #include <core/parser/Parser.hpp> namespace ousia { -namespace parser { -namespace css { /** * This is a context free, recursive parser for a subset of the CSS3 language @@ -139,7 +138,7 @@ private: bool expect(int expectedType, CodeTokenizer &tokenizer, Token &t, bool force, ParserContext &ctx); -public: +protected: /** * This parses the given input as CSS content as specified by the grammar * seen above. The return value is a Rooted reference to the root of the @@ -157,21 +156,8 @@ public: * @return returns the root node of the resulting SelectorTree. For more * information on the return conventions consult the Parser.hpp. */ - Rooted<Node> parse(CharReader &reader, ParserContext &ctx) override; - - using Parser::parse; - - /** - * As befits a class called CSSParser, this Parser parses CSS. - */ - std::set<std::string> mimetypes() - { - std::set<std::string> out{"text/css"}; - return out; - } + Rooted<Node> doParse(CharReader &reader, ParserContext &ctx) override; }; } -} -} #endif |