mirror of
https://github.com/KingDuckZ/dindexer.git
synced 2025-02-17 11:45:50 +00:00
Rename AstType to GlobExpression
This commit is contained in:
parent
94ebfbdfcb
commit
61fa9628a5
5 changed files with 15 additions and 15 deletions
|
@ -44,12 +44,12 @@ namespace qi = boost::spirit::qi;
|
|||
namespace g2r {
|
||||
namespace {
|
||||
template <typename Iterator>
|
||||
struct GlobGrammar : qi::grammar<Iterator, AstType()> {
|
||||
struct GlobGrammar : qi::grammar<Iterator, GlobExpression()> {
|
||||
GlobGrammar ( void );
|
||||
~GlobGrammar ( void ) = default;
|
||||
|
||||
qi::rule<Iterator, AstType()> start;
|
||||
qi::rule<Iterator, AstType()> alternation_list;
|
||||
qi::rule<Iterator, GlobExpression()> start;
|
||||
qi::rule<Iterator, GlobExpression()> alternation_list;
|
||||
qi::rule<Iterator, GlobAlternation()> alternation;
|
||||
qi::rule<Iterator, GlobGroup()> group;
|
||||
qi::rule<Iterator, std::string()> literal;
|
||||
|
@ -92,11 +92,11 @@ namespace g2r {
|
|||
}
|
||||
} //unnamed namespace
|
||||
|
||||
AstType make_ast (const std::string& parGlob) {
|
||||
GlobExpression make_ast (const std::string& parGlob) {
|
||||
GlobGrammar<std::string::const_iterator> gramm;
|
||||
|
||||
auto glob_beg = parGlob.cbegin();
|
||||
AstType glob_ast;
|
||||
GlobExpression glob_ast;
|
||||
const bool parse_ret = boost::spirit::qi::parse(
|
||||
glob_beg,
|
||||
parGlob.end(),
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include <string>
|
||||
|
||||
namespace g2r {
|
||||
AstType make_ast ( const std::string& parGlob );
|
||||
GlobExpression make_ast ( const std::string& parGlob );
|
||||
} //namespace g2r
|
||||
|
||||
#endif
|
||||
|
|
|
@ -82,16 +82,16 @@ namespace g2r {
|
|||
GlobJolly
|
||||
>;
|
||||
|
||||
struct GlobAlternation {
|
||||
std::vector<std::vector<GlobNode>> alternatives;
|
||||
};
|
||||
using GlobExpression = std::vector<GlobNode>;
|
||||
|
||||
using AstType = std::vector<GlobNode>;
|
||||
struct GlobAlternation {
|
||||
std::vector<GlobExpression> alternatives;
|
||||
};
|
||||
} //namespace g2r
|
||||
|
||||
BOOST_FUSION_ADAPT_STRUCT(
|
||||
g2r::GlobAlternation,
|
||||
(std::vector<std::vector<g2r::GlobNode>>, alternatives)
|
||||
(std::vector<g2r::GlobExpression>, alternatives)
|
||||
);
|
||||
|
||||
static_assert(g2r::GlobJolly(1, 2, false) < g2r::GlobJolly(0, 0, true), "Wrong less than");
|
||||
|
|
|
@ -25,10 +25,10 @@ namespace ka = boost::spirit::karma;
|
|||
namespace g2r {
|
||||
namespace {
|
||||
template <typename Iterator>
|
||||
struct RegexGen : ka::grammar<Iterator, AstType()> {
|
||||
struct RegexGen : ka::grammar<Iterator, GlobExpression()> {
|
||||
RegexGen ( void );
|
||||
|
||||
boost::spirit::karma::rule<Iterator, AstType()> start;
|
||||
boost::spirit::karma::rule<Iterator, GlobExpression()> start;
|
||||
boost::spirit::karma::rule<Iterator, GlobAlternation()> alternation;
|
||||
boost::spirit::karma::rule<Iterator, GlobGroup()> group;
|
||||
boost::spirit::karma::rule<Iterator, std::string()> literal;
|
||||
|
@ -63,7 +63,7 @@ namespace g2r {
|
|||
}
|
||||
} //unnamed namespace
|
||||
|
||||
std::string render_ast (const AstType& parAst) {
|
||||
std::string render_ast (const GlobExpression& parAst) {
|
||||
RegexGen<boost::spirit::ostream_iterator> gramm;
|
||||
std::ostringstream oss;
|
||||
oss << ka::format(gramm, parAst);
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include <string>
|
||||
|
||||
namespace g2r {
|
||||
std::string render_ast ( const AstType& parAst );
|
||||
std::string render_ast ( const GlobExpression& parAst );
|
||||
} //namespace g2r
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue