aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-03-19 13:50:39 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-03-19 13:50:39 +0000
commitc29150b36547140e3e7121fec994f781b9d6e46f (patch)
tree93f87df86c414db6ba2984f59864e0f632c28999
parenta9be46e2316e6c06452b74777aca069433fb3d2a (diff)
downloadpaludis-c29150b36547140e3e7121fec994f781b9d6e46f.tar.gz
paludis-c29150b36547140e3e7121fec994f781b9d6e46f.tar.xz
Add options to parse_elike_dependencies
-rw-r--r--paludis/elike_dep_parser-fwd.hh11
-rw-r--r--paludis/elike_dep_parser.cc2
-rw-r--r--paludis/elike_dep_parser.se18
-rw-r--r--paludis/elike_dep_parser_TEST.cc7
-rw-r--r--paludis/files.m42
-rw-r--r--paludis/repositories/e/dep_parser.cc16
-rw-r--r--paludis/repositories/fake/dep_parser.cc10
7 files changed, 47 insertions, 19 deletions
diff --git a/paludis/elike_dep_parser-fwd.hh b/paludis/elike_dep_parser-fwd.hh
index bee1a26..63ceeaa 100644
--- a/paludis/elike_dep_parser-fwd.hh
+++ b/paludis/elike_dep_parser-fwd.hh
@@ -22,6 +22,7 @@
#include <paludis/util/attributes.hh>
#include <paludis/util/map-fwd.hh>
+#include <paludis/util/options-fwd.hh>
#include <paludis/name-fwd.hh>
#include <functional>
#include <memory>
@@ -31,6 +32,10 @@ namespace paludis
{
struct ELikeDepParserCallbacks;
+#include <paludis/elike_dep_parser-se.hh>
+
+ typedef Options<ELikeDepParserOption> ELikeDepParserOptions;
+
typedef std::function<void (const std::string &)> ELikeDepParserStringFunction;
typedef std::function<void (const std::string &, const std::string &)> ELikeDepParserArrowFunction;
typedef std::function<void ()> ELikeDepParserAnyFunction;
@@ -47,7 +52,11 @@ namespace paludis
ELikeDepParserAnnotationsFunction;
typedef std::function<void ()> ELikeDepParserNoAnnotationsFunction;
- void parse_elike_dependencies(const std::string &, const ELikeDepParserCallbacks & callbacks) PALUDIS_VISIBLE;
+ void parse_elike_dependencies(
+ const std::string &,
+ const ELikeDepParserCallbacks & callbacks,
+ const ELikeDepParserOptions & options
+ ) PALUDIS_VISIBLE;
}
#endif
diff --git a/paludis/elike_dep_parser.cc b/paludis/elike_dep_parser.cc
index 85a14ab..f99b6ba 100644
--- a/paludis/elike_dep_parser.cc
+++ b/paludis/elike_dep_parser.cc
@@ -257,7 +257,7 @@ namespace
}
void
-paludis::parse_elike_dependencies(const std::string & s, const ELikeDepParserCallbacks & callbacks)
+paludis::parse_elike_dependencies(const std::string & s, const ELikeDepParserCallbacks & callbacks, const ELikeDepParserOptions &)
{
Context context("When parsing '" + s + "':");
diff --git a/paludis/elike_dep_parser.se b/paludis/elike_dep_parser.se
new file mode 100644
index 0000000..d76365c
--- /dev/null
+++ b/paludis/elike_dep_parser.se
@@ -0,0 +1,18 @@
+#!/usr/bin/env bash
+# vim: set sw=4 sts=4 et ft=sh :
+
+make_enum_ELikeDepParserOption()
+{
+ prefix edpo
+
+ key edpo_allow_embedded_comments "Allow # comments"
+
+ doxygen_comment << "END"
+ /**
+ * Options for parse_elike_package_dep_spec.
+ *
+ * \see ELikeDepParserOptions
+ */
+END
+}
+
diff --git a/paludis/elike_dep_parser_TEST.cc b/paludis/elike_dep_parser_TEST.cc
index 36bd005..e1158ad 100644
--- a/paludis/elike_dep_parser_TEST.cc
+++ b/paludis/elike_dep_parser_TEST.cc
@@ -21,6 +21,7 @@
#include <paludis/util/map.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/make_named_values.hh>
+#include <paludis/util/options.hh>
#include <test/test_framework.hh>
#include <test/test_runner.hh>
@@ -79,7 +80,7 @@ namespace test_cases
n::on_use() = std::bind(&handler, std::ref(out), "use<", _1, ", ", "", ""),
n::on_use_under_any() = &do_nothing
));
- parse_elike_dependencies(in, callbacks);
+ parse_elike_dependencies(in, callbacks, { });
TEST_CHECK_EQUAL(out, "any<s<a>s<b>all<s<c>s<d>s<e>>>EMPTY");
}
} elike_dep_parser_basic_test;
@@ -108,7 +109,7 @@ namespace test_cases
n::on_use() = std::bind(&handler, std::ref(out), "use<", _1, ", ", "", ""),
n::on_use_under_any() = &do_nothing
));
- parse_elike_dependencies(in, callbacks);
+ parse_elike_dependencies(in, callbacks, { });
TEST_CHECK_EQUAL(out, "all<all<>>EMPTY");
}
} elike_dep_parser_test_empty_blocks;
@@ -137,7 +138,7 @@ namespace test_cases
n::on_use() = std::bind(&handler, std::ref(out), "use<", _1, ", ", "", ""),
n::on_use_under_any() = &do_nothing
));
- parse_elike_dependencies(in, callbacks);
+ parse_elike_dependencies(in, callbacks, { });
TEST_CHECK_EQUAL(out, "s<a>[first:foo;second:bar baz;]EMPTY");
}
} elike_dep_parser_annotations_test;
diff --git a/paludis/files.m4 b/paludis/files.m4
index 69ebb3b..fc99f9b 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -35,7 +35,7 @@ add(`distribution', `hh', `cc', `impl', `fwd')
add(`elf_linkage_checker', `hh', `cc')
add(`elike_blocker', `hh', `cc', `fwd', `se')
add(`elike_choices', `hh', `cc', `fwd', `se')
-add(`elike_dep_parser', `hh', `cc', `fwd', `test')
+add(`elike_dep_parser', `hh', `cc', `fwd', `test', `se')
add(`elike_conditional_dep_spec', `hh', `cc', `fwd')
add(`elike_package_dep_spec', `hh', `cc', `fwd', `se')
add(`elike_slot_requirement', `hh', `cc', `fwd')
diff --git a/paludis/repositories/e/dep_parser.cc b/paludis/repositories/e/dep_parser.cc
index 878b5cc..2c3549b 100644
--- a/paludis/repositories/e/dep_parser.cc
+++ b/paludis/repositories/e/dep_parser.cc
@@ -525,7 +525,7 @@ paludis::erepository::parse_depend(const std::string & s, const Environment * co
n::on_use_under_any() = std::bind(&use_under_any_handler, s, std::cref(eapi))
));
- parse_elike_dependencies(s, callbacks);
+ parse_elike_dependencies(s, callbacks, { });
for (auto b(stack.begin()->block_children().begin()), b_end(stack.begin()->block_children().end()) ;
b != b_end ; ++b)
@@ -575,7 +575,7 @@ paludis::erepository::parse_provide(const std::string & s, const Environment * c
n::on_use_under_any() = std::bind(&use_under_any_handler, s, std::cref(eapi))
));
- parse_elike_dependencies(s, callbacks);
+ parse_elike_dependencies(s, callbacks, { });
return top;
}
@@ -625,7 +625,7 @@ paludis::erepository::parse_fetchable_uri(const std::string & s, const Environme
n::on_use_under_any() = std::bind(&use_under_any_handler, s, std::cref(eapi))
));
- parse_elike_dependencies(s, callbacks);
+ parse_elike_dependencies(s, callbacks, { });
return top;
}
@@ -671,7 +671,7 @@ paludis::erepository::parse_simple_uri(const std::string & s, const Environment
n::on_use_under_any() = &do_nothing
));
- parse_elike_dependencies(s, callbacks);
+ parse_elike_dependencies(s, callbacks, { });
return top;
}
@@ -717,7 +717,7 @@ paludis::erepository::parse_license(const std::string & s, const Environment * c
n::on_use_under_any() = std::bind(&use_under_any_handler, s, std::cref(eapi))
));
- parse_elike_dependencies(s, callbacks);
+ parse_elike_dependencies(s, callbacks, { });
return top;
}
@@ -763,7 +763,7 @@ paludis::erepository::parse_plain_text(const std::string & s, const Environment
n::on_use_under_any() = &do_nothing
));
- parse_elike_dependencies(s, callbacks);
+ parse_elike_dependencies(s, callbacks, { });
return top;
}
@@ -811,7 +811,7 @@ paludis::erepository::parse_myoptions(const std::string & s, const Environment *
n::on_use_under_any() = &do_nothing
));
- parse_elike_dependencies(s, callbacks);
+ parse_elike_dependencies(s, callbacks, { });
return top;
}
@@ -857,7 +857,7 @@ paludis::erepository::parse_required_use(const std::string & s, const Environmen
n::on_use_under_any() = &do_nothing
));
- parse_elike_dependencies(s, callbacks);
+ parse_elike_dependencies(s, callbacks, { });
return top;
}
diff --git a/paludis/repositories/fake/dep_parser.cc b/paludis/repositories/fake/dep_parser.cc
index 884b5ef..b8fe714 100644
--- a/paludis/repositories/fake/dep_parser.cc
+++ b/paludis/repositories/fake/dep_parser.cc
@@ -191,7 +191,7 @@ paludis::fakerepository::parse_depend(const std::string & s, const Environment *
n::on_use_under_any() = &do_nothing
));
- parse_elike_dependencies(s, callbacks);
+ parse_elike_dependencies(s, callbacks, { });
return top;
}
@@ -222,7 +222,7 @@ paludis::fakerepository::parse_provide(const std::string & s, const Environment
n::on_use_under_any() = &do_nothing
));
- parse_elike_dependencies(s, callbacks);
+ parse_elike_dependencies(s, callbacks, { });
return top;
}
@@ -253,7 +253,7 @@ paludis::fakerepository::parse_fetchable_uri(const std::string & s, const Enviro
n::on_use_under_any() = &do_nothing
));
- parse_elike_dependencies(s, callbacks);
+ parse_elike_dependencies(s, callbacks, { });
return top;
}
@@ -284,7 +284,7 @@ paludis::fakerepository::parse_simple_uri(const std::string & s, const Environme
n::on_use_under_any() = &do_nothing
));
- parse_elike_dependencies(s, callbacks);
+ parse_elike_dependencies(s, callbacks, { });
return top;
}
@@ -315,7 +315,7 @@ paludis::fakerepository::parse_license(const std::string & s, const Environment
n::on_use_under_any() = &do_nothing
));
- parse_elike_dependencies(s, callbacks);
+ parse_elike_dependencies(s, callbacks, { });
return top;
}