diff options
-rw-r--r-- | paludis/elike_dep_parser-fwd.hh | 3 | ||||
-rw-r--r-- | paludis/elike_dep_parser.cc | 5 | ||||
-rw-r--r-- | paludis/elike_dep_parser.hh | 4 | ||||
-rw-r--r-- | paludis/elike_dep_parser_TEST.cc | 5 | ||||
-rw-r--r-- | paludis/repositories/e/dep_parser.cc | 8 | ||||
-rw-r--r-- | paludis/repositories/fake/dep_parser.cc | 5 |
6 files changed, 26 insertions, 4 deletions
diff --git a/paludis/elike_dep_parser-fwd.hh b/paludis/elike_dep_parser-fwd.hh index 45c9336d0..bee1a267c 100644 --- a/paludis/elike_dep_parser-fwd.hh +++ b/paludis/elike_dep_parser-fwd.hh @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2008, 2010 Ciaran McCreesh + * Copyright (c) 2008, 2010, 2011 Ciaran McCreesh * * This file is part of the Paludis package manager. Paludis is free software; * you can redistribute it and/or modify it under the terms of the GNU General @@ -45,6 +45,7 @@ namespace paludis typedef std::function<void ()> ELikeDepParserUseUnderAnyFunction; typedef std::function<void (const std::shared_ptr<const Map<std::string, std::string> > &)> ELikeDepParserAnnotationsFunction; + typedef std::function<void ()> ELikeDepParserNoAnnotationsFunction; void parse_elike_dependencies(const std::string &, const ELikeDepParserCallbacks & callbacks) PALUDIS_VISIBLE; } diff --git a/paludis/elike_dep_parser.cc b/paludis/elike_dep_parser.cc index 54c0ba273..85a14abde 100644 --- a/paludis/elike_dep_parser.cc +++ b/paludis/elike_dep_parser.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2008, 2010 Ciaran McCreesh + * Copyright (c) 2008, 2010, 2011 Ciaran McCreesh * * This file is part of the Paludis package manager. Paludis is free software; * you can redistribute it and/or modify it under the terms of the GNU General @@ -43,7 +43,10 @@ namespace Context context("When parsing annotation block at offset '" + stringify(parser.offset()) + "':"); if (! parser.consume(*simple_parser::any_of(" \t\r\n") & simple_parser::exact("[["))) + { + callbacks.on_no_annotations()(); return; + } if (! parser.consume(+simple_parser::any_of(" \t\r\n"))) error(parser, callbacks, "Expected space after '[['"); diff --git a/paludis/elike_dep_parser.hh b/paludis/elike_dep_parser.hh index 5e3eb251c..0e5223efa 100644 --- a/paludis/elike_dep_parser.hh +++ b/paludis/elike_dep_parser.hh @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2008, 2010 Ciaran McCreesh + * Copyright (c) 2008, 2010, 2011 Ciaran McCreesh * * This file is part of the Paludis package manager. Paludis is free software; * you can redistribute it and/or modify it under the terms of the GNU General @@ -34,6 +34,7 @@ namespace paludis typedef Name<struct name_on_error> on_error; typedef Name<struct name_on_exactly_one> on_exactly_one; typedef Name<struct name_on_label> on_label; + typedef Name<struct name_on_no_annotations> on_no_annotations; typedef Name<struct name_on_pop> on_pop; typedef Name<struct name_on_should_be_empty> on_should_be_empty; typedef Name<struct name_on_string> on_string; @@ -50,6 +51,7 @@ namespace paludis NamedValue<n::on_error, ELikeDepParserErrorFunction> on_error; NamedValue<n::on_exactly_one, ELikeDepParserExactlyOneFunction> on_exactly_one; NamedValue<n::on_label, ELikeDepParserLabelFunction> on_label; + NamedValue<n::on_no_annotations, ELikeDepParserNoAnnotationsFunction> on_no_annotations; NamedValue<n::on_pop, ELikeDepParserPopFunction> on_pop; NamedValue<n::on_should_be_empty, ELikeDepParserShouldBeEmptyFunction> on_should_be_empty; NamedValue<n::on_string, ELikeDepParserStringFunction> on_string; diff --git a/paludis/elike_dep_parser_TEST.cc b/paludis/elike_dep_parser_TEST.cc index ddc9c56c5..36bd0056b 100644 --- a/paludis/elike_dep_parser_TEST.cc +++ b/paludis/elike_dep_parser_TEST.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2008, 2010 Ciaran McCreesh + * Copyright (c) 2008, 2010, 2011 Ciaran McCreesh * * This file is part of the Paludis package manager. Paludis is free software; * you can redistribute it and/or modify it under the terms of the GNU General @@ -72,6 +72,7 @@ namespace test_cases n::on_error() = std::bind(&handler, std::ref(out), "error<", _1, ">", "", ""), n::on_exactly_one() = std::bind(&handler, std::ref(out), "x<", "", "", "", ""), n::on_label() = std::bind(&handler, std::ref(out), "label<", _1, "", "", ""), + n::on_no_annotations() = &do_nothing, n::on_pop() = std::bind(&handler, std::ref(out), ">", "", "", "", ""), n::on_should_be_empty() = std::bind(&handler, std::ref(out), "EMPTY", "", "", "", ""), n::on_string() = std::bind(&handler, std::ref(out), "s<", _1, ">", "", ""), @@ -100,6 +101,7 @@ namespace test_cases n::on_error() = std::bind(&handler, std::ref(out), "error<", _1, ">", "", ""), n::on_exactly_one() = std::bind(&handler, std::ref(out), "x<", "", "", "", ""), n::on_label() = std::bind(&handler, std::ref(out), "label<", _1, "", "", ""), + n::on_no_annotations() = &do_nothing, n::on_pop() = std::bind(&handler, std::ref(out), ">", "", "", "", ""), n::on_should_be_empty() = std::bind(&handler, std::ref(out), "EMPTY", "", "", "", ""), n::on_string() = std::bind(&handler, std::ref(out), "s<", _1, ">", "", ""), @@ -128,6 +130,7 @@ namespace test_cases n::on_error() = std::bind(&handler, std::ref(out), "error<", _1, ">", "", ""), n::on_exactly_one() = std::bind(&handler, std::ref(out), "x<", "", "", "", ""), n::on_label() = std::bind(&handler, std::ref(out), "label<", _1, "", "", ""), + n::on_no_annotations() = &do_nothing, n::on_pop() = std::bind(&handler, std::ref(out), ">", "", "", "", ""), n::on_should_be_empty() = std::bind(&handler, std::ref(out), "EMPTY", "", "", "", ""), n::on_string() = std::bind(&handler, std::ref(out), "s<", _1, ">", "", ""), diff --git a/paludis/repositories/e/dep_parser.cc b/paludis/repositories/e/dep_parser.cc index 738c78616..9906942d1 100644 --- a/paludis/repositories/e/dep_parser.cc +++ b/paludis/repositories/e/dep_parser.cc @@ -383,6 +383,7 @@ paludis::erepository::parse_depend(const std::string & s, const Environment * co ParseStackTypes<DependencySpecTree>::AnnotationsGoHere(std::bind( &set_thing_to_annotate_maybe_block, std::ref(thing_to_annotate), _1, std::ref(thing_to_annotate_if_block), _2)), _1, std::cref(eapi)), + n::on_no_annotations() = &do_nothing, n::on_pop() = std::bind(&pop_handler<DependencySpecTree>, std::ref(stack), ParseStackTypes<DependencySpecTree>::AnnotationsGoHere(std::bind( &set_thing_to_annotate_maybe_block, std::ref(thing_to_annotate), _1, std::ref(thing_to_annotate_if_block), _2)), s), @@ -422,6 +423,7 @@ paludis::erepository::parse_provide(const std::string & s, const Environment * c n::on_error() = std::bind(&error_handler, s, _1), n::on_exactly_one() = std::bind(&exactly_one_not_allowed_handler, s), n::on_label() = std::bind(&labels_not_allowed_handler, s, _1), + n::on_no_annotations() = &do_nothing, n::on_pop() = std::bind(&pop_handler<ProvideSpecTree>, std::ref(stack), ParseStackTypes<ProvideSpecTree>::AnnotationsGoHere(std::bind( &set_thing_to_annotate, std::ref(thing_to_annotate), _1)), s), @@ -465,6 +467,7 @@ paludis::erepository::parse_fetchable_uri(const std::string & s, const Environme n::on_label() = std::bind(&fetchable_label_handler<FetchableURISpecTree>, std::ref(stack), ParseStackTypes<FetchableURISpecTree>::AnnotationsGoHere(std::bind( &set_thing_to_annotate, std::ref(thing_to_annotate), _1)), _1, std::cref(eapi)), + n::on_no_annotations() = &do_nothing, n::on_pop() = std::bind(&pop_handler<FetchableURISpecTree>, std::ref(stack), ParseStackTypes<FetchableURISpecTree>::AnnotationsGoHere(std::bind( &set_thing_to_annotate, std::ref(thing_to_annotate), _1)), s), @@ -504,6 +507,7 @@ paludis::erepository::parse_simple_uri(const std::string & s, const Environment n::on_error() = std::bind(&error_handler, s, _1), n::on_exactly_one() = std::bind(&exactly_one_not_allowed_handler, s), n::on_label() = std::bind(&labels_not_allowed_handler, s, _1), + n::on_no_annotations() = &do_nothing, n::on_pop() = std::bind(&pop_handler<SimpleURISpecTree>, std::ref(stack), ParseStackTypes<SimpleURISpecTree>::AnnotationsGoHere(std::bind( &set_thing_to_annotate, std::ref(thing_to_annotate), _1)), s), @@ -543,6 +547,7 @@ paludis::erepository::parse_license(const std::string & s, const Environment * c n::on_error() = std::bind(&error_handler, s, _1), n::on_exactly_one() = std::bind(&exactly_one_not_allowed_handler, s), n::on_label() = std::bind(&labels_not_allowed_handler, s, _1), + n::on_no_annotations() = &do_nothing, n::on_pop() = std::bind(&pop_handler<LicenseSpecTree>, std::ref(stack), ParseStackTypes<LicenseSpecTree>::AnnotationsGoHere(std::bind( &set_thing_to_annotate, std::ref(thing_to_annotate), _1)), s), @@ -582,6 +587,7 @@ paludis::erepository::parse_plain_text(const std::string & s, const Environment n::on_error() = std::bind(&error_handler, s, _1), n::on_exactly_one() = std::bind(&exactly_one_not_allowed_handler, s), n::on_label() = std::bind(&labels_not_allowed_handler, s, _1), + n::on_no_annotations() = &do_nothing, n::on_pop() = std::bind(&pop_handler<PlainTextSpecTree>, std::ref(stack), ParseStackTypes<PlainTextSpecTree>::AnnotationsGoHere(std::bind( &set_thing_to_annotate, std::ref(thing_to_annotate), _1)), s), @@ -623,6 +629,7 @@ paludis::erepository::parse_myoptions(const std::string & s, const Environment * n::on_label() = std::bind(&plain_text_label_handler<PlainTextSpecTree>, std::ref(stack), ParseStackTypes<PlainTextSpecTree>::AnnotationsGoHere(std::bind( &set_thing_to_annotate, std::ref(thing_to_annotate), _1)), _1), + n::on_no_annotations() = &do_nothing, n::on_pop() = std::bind(&pop_handler<PlainTextSpecTree>, std::ref(stack), ParseStackTypes<PlainTextSpecTree>::AnnotationsGoHere(std::bind( &set_thing_to_annotate, std::ref(thing_to_annotate), _1)), s), @@ -662,6 +669,7 @@ paludis::erepository::parse_required_use(const std::string & s, const Environmen n::on_error() = std::bind(&error_handler, s, _1), n::on_exactly_one() = std::bind(&any_all_handler<RequiredUseSpecTree, ExactlyOneDepSpec>, std::ref(stack)), n::on_label() = std::bind(&labels_not_allowed_handler, s, _1), + n::on_no_annotations() = &do_nothing, n::on_pop() = std::bind(&pop_handler<RequiredUseSpecTree>, std::ref(stack), ParseStackTypes<RequiredUseSpecTree>::AnnotationsGoHere(std::bind( &set_thing_to_annotate, std::ref(thing_to_annotate), _1)), s), diff --git a/paludis/repositories/fake/dep_parser.cc b/paludis/repositories/fake/dep_parser.cc index c59934c8c..b3e128896 100644 --- a/paludis/repositories/fake/dep_parser.cc +++ b/paludis/repositories/fake/dep_parser.cc @@ -183,6 +183,7 @@ paludis::fakerepository::parse_depend(const std::string & s, const Environment * n::on_error() = std::bind(&error_handler, s, _1), n::on_exactly_one() = std::bind(&exactly_one_not_allowed_handler, s), n::on_label() = std::bind(&labels_not_allowed_handler, s, _1), + n::on_no_annotations() = &do_nothing, n::on_pop() = std::bind(&pop_handler<DependencySpecTree>, std::ref(stack), s), n::on_should_be_empty() = std::bind(&should_be_empty_handler<DependencySpecTree>, std::ref(stack), s), n::on_string() = std::bind(&package_or_block_dep_spec_string_handler<DependencySpecTree>, std::ref(stack), _1), @@ -213,6 +214,7 @@ paludis::fakerepository::parse_provide(const std::string & s, const Environment n::on_error() = std::bind(&error_handler, s, _1), n::on_exactly_one() = std::bind(&exactly_one_not_allowed_handler, s), n::on_label() = std::bind(&labels_not_allowed_handler, s, _1), + n::on_no_annotations() = &do_nothing, n::on_pop() = std::bind(&pop_handler<ProvideSpecTree>, std::ref(stack), s), n::on_should_be_empty() = std::bind(&should_be_empty_handler<ProvideSpecTree>, std::ref(stack), s), n::on_string() = std::bind(&package_dep_spec_string_handler<ProvideSpecTree>, std::ref(stack), _1), @@ -243,6 +245,7 @@ paludis::fakerepository::parse_fetchable_uri(const std::string & s, const Enviro n::on_error() = std::bind(&error_handler, s, _1), n::on_exactly_one() = std::bind(&exactly_one_not_allowed_handler, s), n::on_label() = std::bind(&labels_not_allowed_handler, s, _1), + n::on_no_annotations() = &do_nothing, n::on_pop() = std::bind(&pop_handler<FetchableURISpecTree>, std::ref(stack), s), n::on_should_be_empty() = std::bind(&should_be_empty_handler<FetchableURISpecTree>, std::ref(stack), s), n::on_string() = std::bind(&arrow_handler<FetchableURISpecTree>, std::ref(stack), _1, ""), @@ -273,6 +276,7 @@ paludis::fakerepository::parse_simple_uri(const std::string & s, const Environme n::on_error() = std::bind(&error_handler, s, _1), n::on_exactly_one() = std::bind(&exactly_one_not_allowed_handler, s), n::on_label() = std::bind(&labels_not_allowed_handler, s, _1), + n::on_no_annotations() = &do_nothing, n::on_pop() = std::bind(&pop_handler<SimpleURISpecTree>, std::ref(stack), s), n::on_should_be_empty() = std::bind(&should_be_empty_handler<SimpleURISpecTree>, std::ref(stack), s), n::on_string() = std::bind(&simple_uri_handler<SimpleURISpecTree>, std::ref(stack), _1), @@ -303,6 +307,7 @@ paludis::fakerepository::parse_license(const std::string & s, const Environment n::on_error() = std::bind(&error_handler, s, _1), n::on_exactly_one() = std::bind(&exactly_one_not_allowed_handler, s), n::on_label() = std::bind(&labels_not_allowed_handler, s, _1), + n::on_no_annotations() = &do_nothing, n::on_pop() = std::bind(&pop_handler<LicenseSpecTree>, std::ref(stack), s), n::on_should_be_empty() = std::bind(&should_be_empty_handler<LicenseSpecTree>, std::ref(stack), s), n::on_string() = std::bind(&license_handler<LicenseSpecTree>, std::ref(stack), _1), |