diff options
author | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2014-12-05 13:53:06 +0100 |
---|---|---|
committer | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2014-12-05 13:53:06 +0100 |
commit | 04ee61f336cf9bd848c9d922619db2ee45faafe9 (patch) | |
tree | e596538215290abd3dc5eb8693e0170b5083bc9b /src | |
parent | 9cb01624a4efe2063d5870f41e033476d9368b6d (diff) |
added an 'accepting' attribute to SelectorNodes to make them properly usable as finite state machine nodes without relying on rulesets.
Diffstat (limited to 'src')
-rw-r--r-- | src/core/CSS.hpp | 5 | ||||
-rw-r--r-- | src/plugins/css/CSSParser.cpp | 9 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/core/CSS.hpp b/src/core/CSS.hpp index 1c0ed17..1f5fedc 100644 --- a/src/core/CSS.hpp +++ b/src/core/CSS.hpp @@ -251,6 +251,7 @@ private: ManagedVector<SelectorEdge> edges; // TODO: This is temporarily commented out until the TypeSystem works. // Owned<RuleSet> ruleSets; + bool accepting; /** * This is an internal method all getChildren variants refer to. @@ -386,6 +387,10 @@ public: * automatically using the DESCENDANT SelectionOperator. */ std::vector<Rooted<SelectorNode>> append(Rooted<SelectorNode> node); + + bool isAccepting() { return accepting; } + + void setAccepting(bool accepting) { this->accepting = accepting; } }; } #endif diff --git a/src/plugins/css/CSSParser.cpp b/src/plugins/css/CSSParser.cpp index d239359..00b5af5 100644 --- a/src/plugins/css/CSSParser.cpp +++ b/src/plugins/css/CSSParser.cpp @@ -99,6 +99,15 @@ void CSSParser::parseDocument(Rooted<SelectorNode> root, std::vector<Rooted<SelectorNode>> leafList; parseSelectors(root, tokenizer, leafList, ctx); // TODO: Parse Ruleset + for (auto &leaf : leafList) { + /* every leaf is an accepting node, if one considers the SelectorTree + * to be a finite state machine. This is relevant, if users do not use + * the CSS Parser to parse actual Ruleset content but to construct a + * SelectorTree just to identify a part of the DocumentTree. + */ + leaf->setAccepting(true); + //TODO: append RuleSets + } parseDocument(root, tokenizer, ctx); } |