mirror of
https://github.com/jezhiggins/arabica
synced 2025-01-17 18:12:04 +01:00
Started work on refactoring precedence handling. Need to try and preserver the tree shape it forms, rather than a simple case of monotonically increasing precen
I mean decreasing precedence.
This commit is contained in:
parent
2b2c09b1f3
commit
e8c0aaa416
2 changed files with 53 additions and 2 deletions
50
include/XSLT/impl/xslt_precedence.hpp
Executable file
50
include/XSLT/impl/xslt_precedence.hpp
Executable file
|
@ -0,0 +1,50 @@
|
|||
#ifndef ARABICA_XSLT_PRECEDENCE_HPP
|
||||
#define ARABICA_XSLT_PRECEDENCE_HPP
|
||||
|
||||
class Precedence
|
||||
{
|
||||
public:
|
||||
Precedence() :
|
||||
precedence_()
|
||||
{
|
||||
} // Precedence
|
||||
|
||||
Precedence(const Precedence& rhs) :
|
||||
precedence_(rhs.precedence_)
|
||||
{
|
||||
} // Precedence
|
||||
|
||||
private:
|
||||
Precedence(const std::vector<int> precedence) :
|
||||
precedence_(precedence)
|
||||
{
|
||||
} // Precedence
|
||||
|
||||
public:
|
||||
~Precedence() { }
|
||||
|
||||
bool operator==(const Precedence& rhs) const
|
||||
{
|
||||
return precedence_ == rhs.precedence_;
|
||||
} // operator==
|
||||
|
||||
Precedence& operator=(const Precedence& rhs)
|
||||
{
|
||||
std::vector<int> other(rhs.precedence_);
|
||||
|
||||
precedence_.swap(other);
|
||||
return *this;
|
||||
} // operator=
|
||||
|
||||
Precedence nextGeneration(int p) const
|
||||
{
|
||||
Precedence next(precedence_);
|
||||
next.precedence_.push_back(p);
|
||||
return next;
|
||||
} // nextGeneration
|
||||
|
||||
private:
|
||||
std::vector<int> precedence_;
|
||||
}; // class Precedence
|
||||
|
||||
#endif
|
|
@ -2,6 +2,7 @@
|
|||
#define ARABICA_XSLT_TEMPLATE_HPP
|
||||
|
||||
#include "xslt_item.hpp"
|
||||
#include "xslt_precedence.hpp"
|
||||
|
||||
namespace Arabica
|
||||
{
|
||||
|
@ -12,8 +13,8 @@ class Template : public ItemContainer
|
|||
{
|
||||
public:
|
||||
Template(const std::pair<std::string, std::string>& name,
|
||||
const std::pair<std::string, std::string>& mode,
|
||||
const std::string& priority) :
|
||||
const std::pair<std::string, std::string>& mode,
|
||||
const std::string& priority) :
|
||||
matches_(),
|
||||
name_(name),
|
||||
mode_(mode)
|
||||
|
|
Loading…
Reference in a new issue