diff options
author | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2015-01-26 23:55:41 +0100 |
---|---|---|
committer | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2015-01-26 23:55:41 +0100 |
commit | f1d432892ce158490bb564ba3d01982772439a81 (patch) | |
tree | 043c13b3505ee87cc0a04af9f87b663aef7f7402 | |
parent | a453da28ddc856176747927a47d21af2bd4d4909 (diff) |
Renamed CSS to Style (finally)
-rw-r--r-- | CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/core/model/Style.cpp (renamed from src/core/CSS.cpp) | 4 | ||||
-rw-r--r-- | src/core/model/Style.hpp (renamed from src/core/CSS.hpp) | 8 | ||||
-rw-r--r-- | src/plugins/css/CSSParser.cpp | 87 | ||||
-rw-r--r-- | src/plugins/css/CSSParser.hpp | 24 | ||||
-rw-r--r-- | test/core/model/StyleTest.cpp (renamed from test/core/CSSTest.cpp) | 4 | ||||
-rw-r--r-- | test/plugins/css/CSSParserTest.cpp | 72 |
7 files changed, 108 insertions, 95 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c0daa8a..06f45d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -116,7 +116,6 @@ ADD_DEFINITIONS( ADD_LIBRARY(ousia_core src/core/CodeTokenizer - src/core/CSS src/core/Registry src/core/Tokenizer src/core/XML @@ -146,6 +145,7 @@ ADD_LIBRARY(ousia_core src/core/model/Index src/core/model/Node src/core/model/Project + src/core/model/Style src/core/model/Typesystem src/core/parser/Parser src/core/parser/ParserContext @@ -212,7 +212,6 @@ IF(TEST) ADD_EXECUTABLE(ousia_test_core test/core/CodeTokenizerTest - test/core/CSSTest test/core/RangeSetTest test/core/RegistryTest test/core/TokenizerTest @@ -238,6 +237,7 @@ IF(TEST) test/core/model/DocumentTest test/core/model/IndexTest test/core/model/NodeTest + test/core/model/StyleTest test/core/model/TypesystemTest test/core/parser/ParserStackTest test/core/resource/ResourceLocatorTest diff --git a/src/core/CSS.cpp b/src/core/model/Style.cpp index c42cf6c..b01b0c7 100644 --- a/src/core/CSS.cpp +++ b/src/core/model/Style.cpp @@ -16,9 +16,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "CSS.hpp" +#include "Style.hpp" namespace ousia { +namespace model { void RuleSet::merge(Rooted<RuleSet> other){ for(auto& o : other->rules){ @@ -140,3 +141,4 @@ std::vector<Rooted<SelectorNode>> SelectorNode::append(Handle<SelectorNode> node return append(new SelectorEdge{this->getManager(), node}); } } +} diff --git a/src/core/CSS.hpp b/src/core/model/Style.hpp index 75ac73f..673f51e 100644 --- a/src/core/CSS.hpp +++ b/src/core/model/Style.hpp @@ -17,12 +17,12 @@ */ /** - * @file CSS.hpp + * @file Style.hpp * @author Benjamin Paaßen (bpaassen@techfak.uni-bielefeld.de) */ -#ifndef _OUSIA_CSS_HPP_ -#define _OUSIA_CSS_HPP_ +#ifndef _OUSIA_STYLE_HPP_ +#define _OUSIA_STYLE_HPP_ #include <map> #include <vector> @@ -33,6 +33,7 @@ #include <core/model/Node.hpp> namespace ousia { +namespace model { /* * The Specificity or Precedence of a CSS RuleSet, which decides which @@ -402,4 +403,5 @@ public: void setAccepting(bool accepting) { this->accepting = accepting; } }; } +} #endif diff --git a/src/plugins/css/CSSParser.cpp b/src/plugins/css/CSSParser.cpp index cf92d32..40179bf 100644 --- a/src/plugins/css/CSSParser.cpp +++ b/src/plugins/css/CSSParser.cpp @@ -79,12 +79,13 @@ Rooted<Node> CSSParser::doParse(CharReader &reader, ParserContext &ctx) CodeTokenizer tokenizer{reader, CSS_ROOT, CSS_DESCRIPTORS}; tokenizer.ignoreComments = true; tokenizer.ignoreLinebreaks = true; - Rooted<SelectorNode> root = {new SelectorNode{ctx.getManager(), "root"}}; + Rooted<model::SelectorNode> root = { + new model::SelectorNode{ctx.getManager(), "root"}}; parseDocument(root, tokenizer, ctx); return root; } -void CSSParser::parseDocument(Rooted<SelectorNode> root, +void CSSParser::parseDocument(Rooted<model::SelectorNode> root, CodeTokenizer &tokenizer, ParserContext &ctx) { Token t; @@ -92,11 +93,11 @@ void CSSParser::parseDocument(Rooted<SelectorNode> root, return; } tokenizer.resetPeek(); - std::vector<Rooted<SelectorNode>> leafList; + std::vector<Rooted<model::SelectorNode>> leafList; // parse the SelectorTree for this ruleSet. parseSelectors(root, tokenizer, leafList, ctx); // parse the RuleSet itself. - Rooted<RuleSet> ruleSet = parseRuleSet(tokenizer, ctx); + Rooted<model::RuleSet> ruleSet = parseRuleSet(tokenizer, ctx); for (auto &leaf : leafList) { /* * every leaf is an accepting node, if one considers the SelectorTree @@ -113,14 +114,14 @@ void CSSParser::parseDocument(Rooted<SelectorNode> root, parseDocument(root, tokenizer, ctx); } -void CSSParser::parseSelectors(Rooted<SelectorNode> root, - CodeTokenizer &tokenizer, - std::vector<Rooted<SelectorNode>> &leafList, - ParserContext &ctx) +void CSSParser::parseSelectors( + Rooted<model::SelectorNode> root, CodeTokenizer &tokenizer, + std::vector<Rooted<model::SelectorNode>> &leafList, ParserContext &ctx) { auto tuple = parseSelector(tokenizer, ctx); // append the SelectorPath to the root node. - std::vector<Rooted<SelectorNode>> unmergedLeafs = root->append(tuple.first); + std::vector<Rooted<model::SelectorNode>> unmergedLeafs = + root->append(tuple.first); // append the leaf to the leafList. switch (unmergedLeafs.size()) { case 0: @@ -146,10 +147,10 @@ void CSSParser::parseSelectors(Rooted<SelectorNode> root, } } -std::pair<Rooted<SelectorNode>, Rooted<SelectorNode>> CSSParser::parseSelector( - CodeTokenizer &tokenizer, ParserContext &ctx) +std::pair<Rooted<model::SelectorNode>, Rooted<model::SelectorNode>> +CSSParser::parseSelector(CodeTokenizer &tokenizer, ParserContext &ctx) { - Rooted<SelectorNode> s = parsePrimitiveSelector(tokenizer, ctx); + Rooted<model::SelectorNode> s = parsePrimitiveSelector(tokenizer, ctx); Token t; if (!tokenizer.peek(t)) { // if we are at the end the found selector is the immediate child as @@ -164,8 +165,8 @@ std::pair<Rooted<SelectorNode>, Rooted<SelectorNode>> CSSParser::parseSelector( // so we parse the rest of the subsequent SelectorPath auto tuple = parseSelector(tokenizer, ctx); // then we establish the DESCENDANT relationship - s->getEdges().push_back( - new SelectorNode::SelectorEdge(ctx.getManager(), tuple.first)); + s->getEdges().push_back(new model::SelectorNode::SelectorEdge( + ctx.getManager(), tuple.first)); // and we return this node as well as the leaf. return std::make_pair(s, tuple.second); } @@ -176,9 +177,9 @@ std::pair<Rooted<SelectorNode>, Rooted<SelectorNode>> CSSParser::parseSelector( // so we parse the rest of the subsequent SelectorPath auto tuple = parseSelector(tokenizer, ctx); // then we establish the DESCENDANT relationship - s->getEdges().push_back(new SelectorNode::SelectorEdge( + s->getEdges().push_back(new model::SelectorNode::SelectorEdge( ctx.getManager(), tuple.first, - SelectionOperator::DIRECT_DESCENDANT)); + model::SelectionOperator::DIRECT_DESCENDANT)); // and we return this node as well as the leaf. return std::make_pair(s, tuple.second); } @@ -189,8 +190,8 @@ std::pair<Rooted<SelectorNode>, Rooted<SelectorNode>> CSSParser::parseSelector( } } -Rooted<SelectorNode> CSSParser::parsePrimitiveSelector(CodeTokenizer &tokenizer, - ParserContext &ctx) +Rooted<model::SelectorNode> CSSParser::parsePrimitiveSelector( + CodeTokenizer &tokenizer, ParserContext &ctx) { // first and foremost we expect a class name. Token t; @@ -198,7 +199,8 @@ Rooted<SelectorNode> CSSParser::parsePrimitiveSelector(CodeTokenizer &tokenizer, const std::string name = t.content; if (!tokenizer.peek(t)) { // if we are at the end, we just return this selector with its name. - Rooted<SelectorNode> n{new SelectorNode(ctx.getManager(), name)}; + Rooted<model::SelectorNode> n{ + new model::SelectorNode(ctx.getManager(), name)}; return n; } @@ -218,8 +220,9 @@ Rooted<SelectorNode> CSSParser::parsePrimitiveSelector(CodeTokenizer &tokenizer, // look for additional arguments. if (!expect(PAREN_OPEN, tokenizer, t, false, ctx)) { // if we don't have any, we return here. - Rooted<SelectorNode> n{new SelectorNode( - ctx.getManager(), name, {pseudo_select_name, isGenerative})}; + Rooted<model::SelectorNode> n{ + new model::SelectorNode(ctx.getManager(), name, + {pseudo_select_name, isGenerative})}; return n; } // parse the argument list. @@ -227,18 +230,19 @@ Rooted<SelectorNode> CSSParser::parsePrimitiveSelector(CodeTokenizer &tokenizer, // we require at least one argument, if parantheses are used // XXX args.push_back(VariantReader::parseGeneric(tokenizer.getInput(), - ctx.getLogger(), - {',', ')'}).second); + ctx.getLogger(), + {',', ')'}).second); while (expect(COMMA, tokenizer, t, false, ctx)) { // as long as we find commas we expect new arguments. - args.push_back( - VariantReader::parseGeneric( - tokenizer.getInput(), ctx.getLogger(), {',', ')'}).second); + args.push_back(VariantReader::parseGeneric(tokenizer.getInput(), + ctx.getLogger(), + {',', ')'}).second); } expect(PAREN_CLOSE, tokenizer, t, true, ctx); // and we return with the finished Selector. - Rooted<SelectorNode> n{new SelectorNode( - ctx.getManager(), name, {pseudo_select_name, args, isGenerative})}; + Rooted<model::SelectorNode> n{ + new model::SelectorNode(ctx.getManager(), name, + {pseudo_select_name, args, isGenerative})}; return n; } case HASH: { @@ -249,8 +253,8 @@ Rooted<SelectorNode> CSSParser::parsePrimitiveSelector(CodeTokenizer &tokenizer, expect(TOKEN_TEXT, tokenizer, t, true, ctx); Variant::arrayType args{Variant(t.content.c_str())}; // and we return the finished Selector - Rooted<SelectorNode> n{ - new SelectorNode(ctx.getManager(), name, {"has_id", args, false})}; + Rooted<model::SelectorNode> n{new model::SelectorNode( + ctx.getManager(), name, {"has_id", args, false})}; return n; } case BRACKET_OPEN: { @@ -269,7 +273,7 @@ Rooted<SelectorNode> CSSParser::parsePrimitiveSelector(CodeTokenizer &tokenizer, // we expect a closing bracket. expect(BRACKET_CLOSE, tokenizer, t, true, ctx); // and then we can return the result. - Rooted<SelectorNode> n{new SelectorNode( + Rooted<model::SelectorNode> n{new model::SelectorNode( ctx.getManager(), name, {"has_attribute", args, false})}; return n; } else { @@ -280,7 +284,7 @@ Rooted<SelectorNode> CSSParser::parsePrimitiveSelector(CodeTokenizer &tokenizer, // then we expect a closing bracket. expect(BRACKET_CLOSE, tokenizer, t, true, ctx); // and then we can return the result. - Rooted<SelectorNode> n{new SelectorNode( + Rooted<model::SelectorNode> n{new model::SelectorNode( ctx.getManager(), name, {"has_value", args, false})}; return n; } @@ -288,15 +292,16 @@ Rooted<SelectorNode> CSSParser::parsePrimitiveSelector(CodeTokenizer &tokenizer, default: // everything else is not part of the Selector anymore. tokenizer.resetPeek(); - Rooted<SelectorNode> n{new SelectorNode(ctx.getManager(), name)}; + Rooted<model::SelectorNode> n{ + new model::SelectorNode(ctx.getManager(), name)}; return n; } } -Rooted<RuleSet> CSSParser::parseRuleSet(CodeTokenizer &tokenizer, - ParserContext &ctx) +Rooted<model::RuleSet> CSSParser::parseRuleSet(CodeTokenizer &tokenizer, + ParserContext &ctx) { - Rooted<RuleSet> ruleSet{new RuleSet(ctx.getManager())}; + Rooted<model::RuleSet> ruleSet{new model::RuleSet(ctx.getManager())}; // if we have no ruleset content, we return an empty ruleset. Token t; if (!expect(CURLY_OPEN, tokenizer, t, false, ctx)) { @@ -309,8 +314,8 @@ Rooted<RuleSet> CSSParser::parseRuleSet(CodeTokenizer &tokenizer, return ruleSet; } -void CSSParser::parseRules(CodeTokenizer &tokenizer, Rooted<RuleSet> ruleSet, - ParserContext &ctx) +void CSSParser::parseRules(CodeTokenizer &tokenizer, + Rooted<model::RuleSet> ruleSet, ParserContext &ctx) { std::string key; Variant value; @@ -333,7 +338,7 @@ bool CSSParser::parseRule(CodeTokenizer &tokenizer, ParserContext &ctx, // then the value // TODO: Resolve key for appropriate parsing function here. value = VariantReader::parseGeneric(tokenizer.getInput(), ctx.getLogger(), - {';'}).second; + {';'}).second; // and a ; expect(SEMICOLON, tokenizer, t, true, ctx); return true; @@ -347,10 +352,10 @@ bool CSSParser::expect(int expectedType, CodeTokenizer &tokenizer, Token &t, if (force) { if (end) { throw LoggableException{"Unexpected end of file!", - tokenizer.getInput()}; + tokenizer.getInput()}; } else { throw LoggableException{"Unexpected token!", - tokenizer.getInput()}; + tokenizer.getInput()}; } } else { tokenizer.resetPeek(); diff --git a/src/plugins/css/CSSParser.hpp b/src/plugins/css/CSSParser.hpp index c6594f6..2f37e6a 100644 --- a/src/plugins/css/CSSParser.hpp +++ b/src/plugins/css/CSSParser.hpp @@ -32,8 +32,8 @@ #include <utility> #include <core/CodeTokenizer.hpp> -#include <core/CSS.hpp> #include <core/common/CharReader.hpp> +#include <core/model/Style.hpp> #include <core/parser/Parser.hpp> namespace ousia { @@ -71,42 +71,44 @@ private: /** * Implements the DOC Nonterminal */ - void parseDocument(Rooted<SelectorNode> root, CodeTokenizer &tokenizer, - ParserContext &ctx); + void parseDocument(Rooted<model::SelectorNode> root, + CodeTokenizer &tokenizer, ParserContext &ctx); /** * Implements the SELECTORS Nonterminal and adds all leaf nodes of the * resulting SelectorTree to the input leafList so that a parsed RuleSet can * be inserted there. */ - void parseSelectors(Rooted<SelectorNode> root, CodeTokenizer &tokenizer, - std::vector<Rooted<SelectorNode>> &leafList, + void parseSelectors(Rooted<model::SelectorNode> root, + CodeTokenizer &tokenizer, + std::vector<Rooted<model::SelectorNode>> &leafList, ParserContext &ctx); /** * Implements the SELECT Nonterminal, which in effect parses a SelectorPath * of the SelectorTree and returns the beginning node of the path as first * element as well as the leaf of the path as second tuple element. */ - std::pair<Rooted<SelectorNode>, Rooted<SelectorNode>> parseSelector( - CodeTokenizer &tokenizer, ParserContext &ctx); + std::pair<Rooted<model::SelectorNode>, Rooted<model::SelectorNode>> + parseSelector(CodeTokenizer &tokenizer, ParserContext &ctx); /** * Implements the SELECT' Nonterminal, which parses a single Selector with * its PseudoSelector and returns it. */ - Rooted<SelectorNode> parsePrimitiveSelector(CodeTokenizer &tokenizer, - ParserContext &ctx); + Rooted<model::SelectorNode> parsePrimitiveSelector(CodeTokenizer &tokenizer, + ParserContext &ctx); /** * Implements the RULESET Nonterminal, which parses an entire RuleSet. Note * that we do not require RuleSets to be parsed. It is permitted to just * insert Selector expressions. */ - Rooted<RuleSet> parseRuleSet(CodeTokenizer &tokenizer, ParserContext &ctx); + Rooted<model::RuleSet> parseRuleSet(CodeTokenizer &tokenizer, + ParserContext &ctx); /** * Implements the RULES Nonterminal, which parses CSSRules inside a RuleSet. */ - void parseRules(CodeTokenizer &tokenizer, Rooted<RuleSet> ruleSet, + void parseRules(CodeTokenizer &tokenizer, Rooted<model::RuleSet> ruleSet, ParserContext &ctx); /** diff --git a/test/core/CSSTest.cpp b/test/core/model/StyleTest.cpp index 2d182a1..4727f4d 100644 --- a/test/core/CSSTest.cpp +++ b/test/core/model/StyleTest.cpp @@ -18,9 +18,10 @@ #include <gtest/gtest.h> -#include <core/CSS.hpp> +#include <core/model/Style.hpp> namespace ousia { +namespace model { TEST(Specificity, testOperators) { Specificity s1{0, 0, 1}; @@ -268,3 +269,4 @@ TEST(SelectorNode, testAppend) ASSERT_EQ(ASelect, children[1]); } } +} diff --git a/test/plugins/css/CSSParserTest.cpp b/test/plugins/css/CSSParserTest.cpp index 33b97af..815efa2 100644 --- a/test/plugins/css/CSSParserTest.cpp +++ b/test/plugins/css/CSSParserTest.cpp @@ -28,7 +28,6 @@ namespace ousia { static TerminalLogger logger(std::cerr, true); -//static ConcreteLogger logger; TEST(CSSParser, testParseSelectors) { @@ -47,19 +46,19 @@ TEST(CSSParser, testParseSelectors) // parse the data. CSSParser instance; - Rooted<SelectorNode> root = - instance.parse(data, env.context).cast<SelectorNode>(); + Rooted<model::SelectorNode> root = + instance.parse(data, env.context).cast<model::SelectorNode>(); // we expect three children of the root node overall. ASSERT_EQ(3U, root->getEdges().size()); // get all "A" children, which should be two. - std::vector<Rooted<SelectorNode>> children = root->getChildren("A"); + std::vector<Rooted<model::SelectorNode>> children = root->getChildren("A"); ASSERT_EQ(2U, children.size()); // assert A - Rooted<SelectorNode> A = children[0]; + Rooted<model::SelectorNode> A = children[0]; ASSERT_EQ("A", A->getName()); { - PseudoSelector select{"true", false}; + model::PseudoSelector select{"true", false}; ASSERT_EQ(select, A->getPseudoSelector()); } ASSERT_EQ(2U, A->getEdges().size()); @@ -67,25 +66,25 @@ TEST(CSSParser, testParseSelectors) ASSERT_EQ(0U, A->getRuleSet()->getRules().size()); { // assert A > B - std::vector<Rooted<SelectorNode>> Achildren = - A->getChildren(SelectionOperator::DIRECT_DESCENDANT, "B"); + std::vector<Rooted<model::SelectorNode>> Achildren = + A->getChildren(model::SelectionOperator::DIRECT_DESCENDANT, "B"); ASSERT_EQ(1U, Achildren.size()); - Rooted<SelectorNode> B = Achildren[0]; + Rooted<model::SelectorNode> B = Achildren[0]; ASSERT_EQ("B", B->getName()); { - PseudoSelector select{"true", false}; + model::PseudoSelector select{"true", false}; ASSERT_EQ(select, B->getPseudoSelector()); } ASSERT_EQ(0U, B->getEdges().size()); ASSERT_TRUE(B->isAccepting()); ASSERT_EQ(0U, B->getRuleSet()->getRules().size()); // assert A B:r - Achildren = A->getChildren(SelectionOperator::DESCENDANT, "B"); + Achildren = A->getChildren(model::SelectionOperator::DESCENDANT, "B"); ASSERT_EQ(1U, Achildren.size()); - Rooted<SelectorNode> Br = Achildren[0]; + Rooted<model::SelectorNode> Br = Achildren[0]; ASSERT_EQ("B", Br->getName()); { - PseudoSelector select{"r", false}; + model::PseudoSelector select{"r", false}; ASSERT_EQ(select, Br->getPseudoSelector()); } ASSERT_EQ(0U, Br->getEdges().size()); @@ -95,10 +94,10 @@ TEST(CSSParser, testParseSelectors) // assert C#a children = root->getChildren("C"); ASSERT_EQ(1U, children.size()); - Rooted<SelectorNode> C = children[0]; + Rooted<model::SelectorNode> C = children[0]; ASSERT_EQ("C", C->getName()); { - PseudoSelector select{"has_id", {"a"}, false}; + model::PseudoSelector select{"has_id", {"a"}, false}; ASSERT_EQ(select, C->getPseudoSelector()); } ASSERT_EQ(1U, C->getEdges().size()); @@ -106,13 +105,13 @@ TEST(CSSParser, testParseSelectors) ASSERT_EQ(0U, C->getRuleSet()->getRules().size()); { // assert C#a A[bla=\"blub\"] - std::vector<Rooted<SelectorNode>> Cchildren = - C->getChildren(SelectionOperator::DESCENDANT, "A"); + std::vector<Rooted<model::SelectorNode>> Cchildren = + C->getChildren(model::SelectionOperator::DESCENDANT, "A"); ASSERT_EQ(1U, Cchildren.size()); - Rooted<SelectorNode> A = Cchildren[0]; + Rooted<model::SelectorNode> A = Cchildren[0]; ASSERT_EQ("A", A->getName()); { - PseudoSelector select{"has_value", {"bla", "blub"}, false}; + model::PseudoSelector select{"has_value", {"bla", "blub"}, false}; ASSERT_EQ(select, A->getPseudoSelector()); } ASSERT_EQ(0U, A->getEdges().size()); @@ -122,10 +121,11 @@ TEST(CSSParser, testParseSelectors) // assert A::g(4,2,3) children = root->getChildren("A"); ASSERT_EQ(2U, children.size()); - Rooted<SelectorNode> Ag = children[1]; + Rooted<model::SelectorNode> Ag = children[1]; ASSERT_EQ("A", Ag->getName()); { - PseudoSelector select{"g", {Variant(4), Variant(2), Variant(3)}, true}; + model::PseudoSelector select{ + "g", {Variant(4), Variant(2), Variant(3)}, true}; ASSERT_EQ(select, Ag->getPseudoSelector()); } ASSERT_EQ(0U, Ag->getEdges().size()); @@ -158,13 +158,13 @@ TEST(CSSParser, testParseCSS) // parse the input. CSSParser instance; CharReader reader{input}; - Rooted<SelectorNode> root = - instance.parse(reader, env.context).cast<SelectorNode>(); + Rooted<model::SelectorNode> root = + instance.parse(reader, env.context).cast<model::SelectorNode>(); // we expect three children of the root node overall. ASSERT_EQ(3U, root->getEdges().size()); // get all "A" children, which should be two. - std::vector<Rooted<SelectorNode>> children = root->getChildren("A"); + std::vector<Rooted<model::SelectorNode>> children = root->getChildren("A"); ASSERT_EQ(2U, children.size()); // assert A /* @@ -181,16 +181,16 @@ TEST(CSSParser, testParseCSS) * * should be merged. */ - Rooted<SelectorNode> A = children[0]; + Rooted<model::SelectorNode> A = children[0]; ASSERT_EQ("A", A->getName()); { - PseudoSelector select{"true", false}; + model::PseudoSelector select{"true", false}; ASSERT_EQ(select, A->getPseudoSelector()); } ASSERT_EQ(0U, A->getEdges().size()); ASSERT_TRUE(A->isAccepting()); { - Rooted<RuleSet> ruleSet = A->getRuleSet(); + Rooted<model::RuleSet> ruleSet = A->getRuleSet(); ASSERT_EQ(2U, ruleSet->getRules().size()); Variant v = ruleSet->getRules()["ident1"]; ASSERT_TRUE(v.isString()); @@ -206,16 +206,16 @@ TEST(CSSParser, testParseCSS) * ident3 : val3; * } */ - Rooted<SelectorNode> Aselect = children[1]; + Rooted<model::SelectorNode> Aselect = children[1]; ASSERT_EQ("A", Aselect->getName()); { - PseudoSelector select{"select", {"a", "b"}, false}; + model::PseudoSelector select{"select", {"a", "b"}, false}; ASSERT_EQ(select, Aselect->getPseudoSelector()); } ASSERT_EQ(0U, Aselect->getEdges().size()); ASSERT_TRUE(Aselect->isAccepting()); { - Rooted<RuleSet> ruleSet = Aselect->getRuleSet(); + Rooted<model::RuleSet> ruleSet = Aselect->getRuleSet(); ASSERT_EQ(1U, ruleSet->getRules().size()); Variant v = ruleSet->getRules()["ident3"]; ASSERT_TRUE(v.isString()); @@ -232,10 +232,10 @@ TEST(CSSParser, testParseCSS) children = root->getChildren("B"); ASSERT_EQ(1U, children.size()); - Rooted<SelectorNode> B = children[0]; + Rooted<model::SelectorNode> B = children[0]; ASSERT_EQ("B", B->getName()); { - PseudoSelector select{"true", false}; + model::PseudoSelector select{"true", false}; ASSERT_EQ(select, B->getPseudoSelector()); } ASSERT_EQ(1U, B->getEdges().size()); @@ -245,16 +245,16 @@ TEST(CSSParser, testParseCSS) children = B->getChildren("A"); ASSERT_EQ(1U, children.size()); - Rooted<SelectorNode> BA = children[0]; + Rooted<model::SelectorNode> BA = children[0]; ASSERT_EQ("A", BA->getName()); { - PseudoSelector select{"true", false}; + model::PseudoSelector select{"true", false}; ASSERT_EQ(select, BA->getPseudoSelector()); } ASSERT_EQ(0U, BA->getEdges().size()); ASSERT_TRUE(BA->isAccepting()); { - Rooted<RuleSet> ruleSet = BA->getRuleSet(); + Rooted<model::RuleSet> ruleSet = BA->getRuleSet(); ASSERT_EQ(2U, ruleSet->getRules().size()); Variant v = ruleSet->getRules()["ident1"]; ASSERT_TRUE(v.isString()); @@ -274,7 +274,7 @@ void assertException(std::string css) logger.reset(); try { - instance.parse(reader, env.context).cast<SelectorNode>(); + instance.parse(reader, env.context).cast<model::SelectorNode>(); } catch (LoggableException ex) { logger.log(ex); |