diff options
author | ygorshenin <mipt.vi002@gmail.com> | 2016-11-24 12:08:07 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-24 12:08:07 +0300 |
commit | 6a910da9b26a60408db842bce4b24812ba55b671 (patch) | |
tree | dabc574e2c562ca5edf08c269ae609bd5002eaaa | |
parent | 5172c94d2c549ca6dec37606e55d807b3dd490c8 (diff) | |
parent | 7366a3e48cf05045c4166ab28a8602837bf5c6fb (diff) |
Merge pull request #4792 from syershov/compile-speedup
[3party] Opening hours compile speedup
-rw-r--r-- | 3party/opening_hours/CMakeLists.txt | 7 | ||||
-rw-r--r-- | 3party/opening_hours/opening_hours.pro | 10 | ||||
-rw-r--r-- | 3party/opening_hours/opening_hours_parsers.hpp | 440 | ||||
-rw-r--r-- | 3party/opening_hours/opening_hours_parsers_terminals.cpp | 111 | ||||
-rw-r--r-- | 3party/opening_hours/opening_hours_parsers_terminals.hpp | 143 | ||||
-rw-r--r-- | 3party/opening_hours/parse_months.cpp | 110 | ||||
-rw-r--r-- | 3party/opening_hours/parse_opening_hours.cpp | 201 | ||||
-rw-r--r-- | 3party/opening_hours/parse_opening_hours.hpp | 23 | ||||
-rw-r--r-- | 3party/opening_hours/parse_timespans.cpp | 99 | ||||
-rw-r--r-- | 3party/opening_hours/parse_weekdays.cpp | 80 | ||||
-rw-r--r-- | 3party/opening_hours/parse_weeks.cpp | 37 | ||||
-rw-r--r-- | 3party/opening_hours/parse_years.cpp | 42 | ||||
-rw-r--r-- | xcode/api/api.xcodeproj/project.pbxproj | 1 | ||||
-rw-r--r-- | xcode/opening_hours/opening_hours.xcodeproj/project.pbxproj | 28 |
14 files changed, 687 insertions, 645 deletions
diff --git a/3party/opening_hours/CMakeLists.txt b/3party/opening_hours/CMakeLists.txt index 1aad2c5f17..c073ad93fa 100644 --- a/3party/opening_hours/CMakeLists.txt +++ b/3party/opening_hours/CMakeLists.txt @@ -15,9 +15,14 @@ set( opening_hours.hpp opening_hours.cpp opening_hours_parsers.hpp - opening_hours_parsers_terminals.hpp + opening_hours_parsers_terminals.cpp parse_opening_hours.hpp parse_opening_hours.cpp + parse_years.cpp + parse_weekdays.cpp + parse_weeks.cpp + parse_timespans.cpp + parse_months.cpp rules_evaluation_private.hpp rules_evaluation.hpp rules_evaluation.cpp diff --git a/3party/opening_hours/opening_hours.pro b/3party/opening_hours/opening_hours.pro index 698657919c..467bf7996b 100644 --- a/3party/opening_hours/opening_hours.pro +++ b/3party/opening_hours/opening_hours.pro @@ -15,11 +15,17 @@ include($$ROOT_DIR/common.pri) HEADERS += opening_hours.hpp \ opening_hours_parsers.hpp \ - opening_hours_parsers_terminals.hpp \ parse_opening_hours.hpp \ rules_evaluation_private.hpp \ rules_evaluation.hpp SOURCES += rules_evaluation.cpp \ + opening_hours_parsers_terminals.cpp \ opening_hours.cpp \ - parse_opening_hours.cpp + parse_opening_hours.cpp \ + parse_years.cpp \ + parse_weekdays.cpp \ + parse_weeks.cpp \ + parse_timespans.cpp \ + parse_months.cpp + diff --git a/3party/opening_hours/opening_hours_parsers.hpp b/3party/opening_hours/opening_hours_parsers.hpp index 37b74f6fb8..cdc06fb8f7 100644 --- a/3party/opening_hours/opening_hours_parsers.hpp +++ b/3party/opening_hours/opening_hours_parsers.hpp @@ -3,28 +3,8 @@ #include "opening_hours.hpp" // #define BOOST_SPIRIT_DEBUG -#define BOOST_SPIRIT_USE_PHOENIX_V3 -#include <boost/spirit/include/phoenix_bind.hpp> -#include <boost/spirit/include/phoenix_fusion.hpp> -#include <boost/spirit/include/phoenix_object.hpp> -#include <boost/spirit/include/phoenix_operator.hpp> -#include <boost/spirit/include/phoenix_statement.hpp> -#include <boost/spirit/include/phoenix_stl.hpp> #include <boost/spirit/include/qi.hpp> -#if defined(__clang__) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wshorten-64-to-32" -#include <boost/date_time/posix_time/posix_time.hpp> -#include <boost/date_time/gregorian/gregorian.hpp> -#pragma clang diagnostic pop -#else -#include <boost/date_time/posix_time/posix_time.hpp> -#include <boost/date_time/gregorian/gregorian.hpp> -#endif - -#include "opening_hours_parsers_terminals.hpp" - namespace osmoh { namespace phx = boost::phoenix; @@ -36,72 +16,50 @@ namespace charset = boost::spirit::standard_wide; using space_type = charset::space_type; -template <class Iterator> -class year_selector : public qi::grammar<Iterator, osmoh::TYearRanges(), space_type> +using Iterator = std::string::const_iterator; + +struct dash_ : public qi::symbols<char> { dash_(); }; +struct event_ : public qi::symbols<char, osmoh::TimeEvent::Event> { event_(); }; +struct wdays_ : qi::symbols<char, osmoh::Weekday> { wdays_(); }; +struct month_ : qi::symbols<char, osmoh::MonthDay::Month> { month_(); }; +struct hours_ : qi::symbols<char, osmoh::Time::THours> { hours_(); }; +struct exthours_ : qi::symbols<char, osmoh::Time::THours> { exthours_(); }; +struct minutes_ : qi::symbols<char, osmoh::Time::TMinutes> { minutes_(); }; +struct weeknum_ : qi::symbols<char, unsigned> { weeknum_(); }; +struct daynum_ : qi::symbols<char, MonthDay::TDayNum> { daynum_(); }; + +extern dash_ dash; +extern event_ event; +extern wdays_ wdays; +extern month_ month; +extern hours_ hours; +extern exthours_ exthours; +extern minutes_ minutes; +extern weeknum_ weeknum; +extern daynum_ daynum; + + +class year_selector_parser : public qi::grammar<Iterator, osmoh::TYearRanges(), space_type> { protected: qi::rule<Iterator, osmoh::YearRange(), space_type> year_range; qi::rule<Iterator, osmoh::TYearRanges(), space_type> main; public: - year_selector() : year_selector::base_type(main) - { - using qi::uint_; - using qi::lit; - using qi::_1; - using qi::_2; - using qi::_3; - using qi::_val; - using osmoh::YearRange; - - static const qi::int_parser<unsigned, 10, 4, 4> year = {}; - - year_range = (year >> dash >> year >> '/' >> uint_) [bind(&YearRange::SetStart, _val, _1), - bind(&YearRange::SetEnd, _val, _2), - bind(&YearRange::SetPeriod, _val, _3)] - | (year >> dash >> year) [bind(&YearRange::SetStart, _val, _1), - bind(&YearRange::SetEnd, _val, _2)] - | (year >> lit('+')) [bind(&YearRange::SetStart, _val, _1), - bind(&YearRange::SetPlus, _val, true)] - | year [bind(&YearRange::SetStart, _val, _1)] - ; - - main %= (year_range % ','); - } + year_selector_parser(); }; -template <typename Iterator> -class week_selector : public qi::grammar<Iterator, osmoh::TWeekRanges(), space_type> +class week_selector_parser : public qi::grammar<Iterator, osmoh::TWeekRanges(), space_type> { protected: qi::rule<Iterator, osmoh::WeekRange(), space_type> week; qi::rule<Iterator, osmoh::TWeekRanges(), space_type> main; public: - week_selector() : week_selector::base_type(main) - { - using qi::uint_; - using qi::lit; - using qi::_1; - using qi::_2; - using qi::_3; - using qi::_val; - using osmoh::WeekRange; - - week = (weeknum >> dash >> weeknum >> '/' >> uint_) [bind(&WeekRange::SetStart, _val, _1), - bind(&WeekRange::SetEnd, _val, _2), - bind(&WeekRange::SetPeriod, _val, _3)] - | (weeknum >> dash >> weeknum) [bind(&WeekRange::SetStart, _val, _1), - bind(&WeekRange::SetEnd, _val, _2)] - | weeknum [bind(&WeekRange::SetStart, _val, _1)] - ; - - main %= charset::no_case[lit("week")] >> (week % ','); - } + week_selector_parser(); }; -template <typename Iterator> -class month_selector : public qi::grammar<Iterator, TMonthdayRanges(), space_type> +class month_selector_parser : public qi::grammar<Iterator, TMonthdayRanges(), space_type> { protected: qi::rule<Iterator, int32_t(), space_type, qi::locals<int32_t>> day_offset; @@ -118,102 +76,10 @@ protected: qi::rule<Iterator, TMonthdayRanges(), space_type> main; public: - month_selector() : month_selector::base_type(main) - { - using qi::_1; - using qi::_2; - using qi::_3; - using qi::_a; - using qi::_val; - using qi::uint_; - using qi::ushort_; - using qi::lit; - using qi::double_; - using qi::lexeme; - using osmoh::DateOffset; - using osmoh::MonthDay; - using osmoh::MonthdayRange; - - static const qi::int_parser<unsigned, 10, 4, 4> year = {}; - - day_offset = ((lit('+')[_a = 1] | lit('-')[_a = -1]) >> - ushort_ >> charset::no_case[(lit("days") | lit("day"))]) [_val = _a * _1]; - - date_offset = ((lit('+')[_a = true] | lit('-')[_a = false]) - >> charset::no_case[wdays] >> day_offset) - [bind(&DateOffset::SetWDayOffset, _val, _1), - bind(&DateOffset::SetOffset, _val, _2), - bind(&DateOffset::SetWDayOffsetPositive, _val, _a)] - | ((lit('+')[_a = true] | lit('-') [_a = false]) >> charset::no_case[wdays]) - [bind(&DateOffset::SetWDayOffset, _val, _1), - bind(&DateOffset::SetWDayOffsetPositive, _val, _a)] - | day_offset [bind(&DateOffset::SetOffset, _val, _1)] - ; - - date_left = (year >> charset::no_case[month]) [bind(&MonthDay::SetYear, _val, _1), - bind(&MonthDay::SetMonth, _val, _2)] - - | charset::no_case[month] [bind(&MonthDay::SetMonth, _val, _1)] - ; - - date_right = charset::no_case[month] [bind(&MonthDay::SetMonth, _val, _1)] - ; - - date_from = (date_left >> (daynum >> !(lit(':') >> qi::digit))) - [_val = _1, bind(&MonthDay::SetDayNum, _val, _2)] - | (year >> charset::no_case[lit("easter")]) [bind(&MonthDay::SetYear, _val, _1), - bind(&MonthDay::SetVariableDate, _val, - MonthDay::VariableDate::Easter)] - | charset::no_case[lit("easter")] [bind(&MonthDay::SetVariableDate, _val, - MonthDay::VariableDate::Easter)] - ; - - date_to = date_from [_val = _1] - | (daynum >> !(lit(':') >> qi::digit)) [bind(&MonthDay::SetDayNum, _val, _1)] - ; - - date_from_with_offset = (date_from >> date_offset) - [_val = _1, bind(&MonthDay::SetOffset, _val, _2)] - | date_from [_val = _1] - ; - - date_to_with_offset = (date_to >> date_offset) - [_val = _1, bind(&MonthDay::SetOffset, _val, _2)] - | date_to [_val = _1] - ; - - monthday_range = (date_from_with_offset >> dash >> date_to_with_offset) - [bind(&MonthdayRange::SetStart, _val, _1), - bind(&MonthdayRange::SetEnd, _val, _2)] - | (date_from_with_offset >> '+') [bind(&MonthdayRange::SetStart, _val, _1), - bind(&MonthdayRange::SetPlus, _val, true)] - | (date_left >> dash >> date_right >> '/' >> uint_) - [bind(&MonthdayRange::SetStart, _val, _1), - bind(&MonthdayRange::SetEnd, _val, _2), - bind(&MonthdayRange::SetPeriod, _val, _3)] - | (date_left >> lit("-") >> date_right) [bind(&MonthdayRange::SetStart, _val, _1), - bind(&MonthdayRange::SetEnd, _val, _2)] - | date_from [bind(&MonthdayRange::SetStart, _val, _1)] - | date_left [bind(&MonthdayRange::SetStart, _val, _1)] - ; - - main %= (monthday_range % ','); - - BOOST_SPIRIT_DEBUG_NODE(main); - BOOST_SPIRIT_DEBUG_NODE(monthday_range); - BOOST_SPIRIT_DEBUG_NODE(day_offset); - BOOST_SPIRIT_DEBUG_NODE(date_offset); - BOOST_SPIRIT_DEBUG_NODE(date_left); - BOOST_SPIRIT_DEBUG_NODE(date_right); - BOOST_SPIRIT_DEBUG_NODE(date_from); - BOOST_SPIRIT_DEBUG_NODE(date_to); - BOOST_SPIRIT_DEBUG_NODE(date_from_with_offset); - BOOST_SPIRIT_DEBUG_NODE(date_to_with_offset); - } + month_selector_parser(); }; -template <typename Iterator> -class weekday_selector : public qi::grammar<Iterator, osmoh::Weekdays(), space_type> +class weekday_selector_parser : public qi::grammar<Iterator, osmoh::Weekdays(), space_type> { protected: qi::rule<Iterator, osmoh::NthWeekdayOfTheMonthEntry::NthDayOfTheMonth(), space_type> nth; @@ -226,73 +92,10 @@ protected: qi::rule<Iterator, osmoh::Weekdays(), space_type> main; public: - weekday_selector() : weekday_selector::base_type(main) - { - using qi::_a; - using qi::_1; - using qi::_2; - using qi::_val; - using qi::lit; - using qi::ushort_; - using boost::phoenix::bind; - using osmoh::NthWeekdayOfTheMonthEntry; - using osmoh::Holiday; - using osmoh::WeekdayRange; - using osmoh::Weekdays; - - nth = ushort_(1)[_val = NthWeekdayOfTheMonthEntry::NthDayOfTheMonth::First] - | ushort_(2) [_val = NthWeekdayOfTheMonthEntry::NthDayOfTheMonth::Second] - | ushort_(3) [_val = NthWeekdayOfTheMonthEntry::NthDayOfTheMonth::Third] - | ushort_(4) [_val = NthWeekdayOfTheMonthEntry::NthDayOfTheMonth::Fourth] - | ushort_(5) [_val = NthWeekdayOfTheMonthEntry::NthDayOfTheMonth::Fifth]; - - nth_entry = (nth >> dash >> nth) [bind(&NthWeekdayOfTheMonthEntry::SetStart, _val, _1), - bind(&NthWeekdayOfTheMonthEntry::SetEnd, _val, _2)] - | (lit('-') >> nth) [bind(&NthWeekdayOfTheMonthEntry::SetEnd, _val, _1)] - | nth [bind(&NthWeekdayOfTheMonthEntry::SetStart, _val, _1)] - ; - - day_offset = - ( (lit('+')[_a = 1] | lit('-') [_a = -1]) >> - ushort_ [_val = _1 * _a] >> - charset::no_case[(lit("days") | lit("day"))] ) - ; - - holiday = (charset::no_case[lit("SH")] [bind(&Holiday::SetPlural, _val, false)] - >> -day_offset [bind(&Holiday::SetOffset, _val, _1)]) - | charset::no_case[lit("PH")] [bind(&Holiday::SetPlural, _val, true)] - ; - - holiday_sequence %= (holiday % ','); - - weekday_range = - ( charset::no_case[wdays] [bind(&WeekdayRange::SetStart, _val, _1)] >> - '[' >> (nth_entry [bind(&WeekdayRange::AddNth, _val, _1)]) % ',') >> ']' >> - -(day_offset [bind(&WeekdayRange::SetOffset, _val, _1)]) - | charset::no_case[(wdays >> dash >> wdays)] [bind(&WeekdayRange::SetStart, _val, _1), - bind(&WeekdayRange::SetEnd, _val, _2)] - | charset::no_case[wdays] [bind(&WeekdayRange::SetStart, _val, _1)] - ; - - weekday_sequence %= (weekday_range % ',') >> !qi::no_skip[charset::alpha] - ; - - main = (holiday_sequence >> -lit(',') >> weekday_sequence) - [bind(&Weekdays::SetHolidays, _val, _1), - bind(&Weekdays::SetWeekdayRanges, _val, _2)] - | holiday_sequence [bind(&Weekdays::SetHolidays, _val, _1)] - | weekday_sequence [bind(&Weekdays::SetWeekdayRanges, _val, _1)] - ; - - BOOST_SPIRIT_DEBUG_NODE(main); - BOOST_SPIRIT_DEBUG_NODE(weekday_sequence); - BOOST_SPIRIT_DEBUG_NODE(weekday_range); - BOOST_SPIRIT_DEBUG_NODE(holiday_sequence); - } + weekday_selector_parser(); }; -template <typename Iterator> -class time_selector : public qi::grammar<Iterator, osmoh::TTimespans(), space_type> +class time_selector_parser : public qi::grammar<Iterator, osmoh::TTimespans(), space_type> { protected: qi::rule<Iterator, osmoh::HourMinutes(), space_type> hour_minutes; @@ -304,186 +107,9 @@ protected: qi::rule<Iterator, osmoh::TTimespans(), space_type> main; public: - time_selector() : time_selector::base_type(main) - { - using qi::int_; - using qi::_1; - using qi::_2; - using qi::_3; - using qi::_a; - using qi::_val; - using qi::lit; - using charset::char_; - using boost::phoenix::bind; - using boost::phoenix::construct; - using osmoh::HourMinutes; - using osmoh::TimeEvent; - using osmoh::Time; - using osmoh::Timespan; - - hour_minutes = - (hours >> lit(':') >> minutes) [bind(&HourMinutes::AddDuration, _val, _1), - bind(&HourMinutes::AddDuration, _val, _2)] - ; - - extended_hour_minutes = - (exthours >> lit(':') >> minutes)[bind(&HourMinutes::AddDuration, _val, _1), - bind(&HourMinutes::AddDuration, _val, _2)] - ; - - variable_time = - ( lit('(') - >> charset::no_case[event] [bind(&TimeEvent::SetEvent, _val, _1)] - >> ( (lit('+') >> hour_minutes) [bind(&TimeEvent::SetOffset, _val, _1)] - | (lit('-') >> hour_minutes) [bind(&TimeEvent::SetOffset, _val, -_1)] ) - >> lit(')') - ) - | charset::no_case[event][bind(&TimeEvent::SetEvent, _val, _1)] - ; - - extended_time = extended_hour_minutes [bind(&Time::SetHourMinutes, _val, _1)] - | variable_time [bind(&Time::SetEvent, _val, _1)] - ; - - time = hour_minutes [bind(&Time::SetHourMinutes, _val, _1)] - | variable_time [bind(&Time::SetEvent, _val, _1)] - ; - - timespan = - (time >> dash >> extended_time >> '/' >> hour_minutes) - [bind(&Timespan::SetStart, _val, _1), - bind(&Timespan::SetEnd, _val, _2), - bind(&Timespan::SetPeriod, _val, _3)] - - | (time >> dash >> extended_time >> '/' >> minutes) - [bind(&Timespan::SetStart, _val, _1), - bind(&Timespan::SetEnd, _val, _2), - bind(&Timespan::SetPeriod, _val, _3)] - - | (time >> dash >> extended_time >> '+') - [bind(&Timespan::SetStart, _val, _1), - bind(&Timespan::SetEnd, _val, _2), - bind(&Timespan::SetPlus, _val, true)] - - | (time >> dash >> extended_time) - [bind(&Timespan::SetStart, _val, _1), - bind(&Timespan::SetEnd, _val, _2)] - - | (time >> '+') - [bind(&Timespan::SetStart, _val, _1), - bind(&Timespan::SetPlus, _val, true)] - - // This rule is only used for collection_times tag wish is not in our interest. - // | time[bind(&Timespan::SetStart, _val, _1)] - ; - - main %= timespan % ','; - - BOOST_SPIRIT_DEBUG_NODE(main); - BOOST_SPIRIT_DEBUG_NODE(timespan); - BOOST_SPIRIT_DEBUG_NODE(time); - BOOST_SPIRIT_DEBUG_NODE(extended_time); - BOOST_SPIRIT_DEBUG_NODE(variable_time); - BOOST_SPIRIT_DEBUG_NODE(extended_hour_minutes); - } + time_selector_parser(); }; -template <typename Iterator> -class time_domain : public qi::grammar<Iterator, osmoh::TRuleSequences(), space_type> -{ -protected: - weekday_selector<Iterator> weekday_selector; - time_selector<Iterator> time_selector; - year_selector<Iterator> year_selector; - month_selector<Iterator> month_selector; - week_selector<Iterator> week_selector; - - qi::rule<Iterator, std::string()> comment; - qi::rule<Iterator, std::string(), space_type> separator; - - qi::rule<Iterator, qi::unused_type(osmoh::RuleSequence &), space_type> small_range_selectors; - qi::rule<Iterator, qi::unused_type(osmoh::RuleSequence &), space_type> wide_range_selectors; - qi::rule<Iterator, qi::unused_type(osmoh::RuleSequence &), space_type> rule_modifier; - - qi::rule<Iterator, osmoh::RuleSequence(), space_type> rule_sequence; - qi::rule<Iterator, osmoh::TRuleSequences(), space_type> main; - -public: - time_domain() : time_domain::base_type(main) - { - using qi::lit; - using qi::lexeme; - using qi::_1; - using qi::_a; - using qi::_r1; - using qi::_val; - using charset::char_; - using qi::eps; - using qi::lazy; - using phx::back; - using phx::push_back; - using phx::construct; - using osmoh::RuleSequence; - - using Modifier = RuleSequence::Modifier; - - comment %= '"' >> +(char_ - '"') >> '"' - ; - - separator %= charset::string(";") - | charset::string("||") - | charset::string(",") - ; - - wide_range_selectors = - ( -(year_selector [bind(&RuleSequence::SetYears, _r1, _1)]) >> - -(month_selector [bind(&RuleSequence::SetMonths, _r1, _1)]) >> - -(week_selector [bind(&RuleSequence::SetWeeks, _r1, _1)]) >> - -(lit(':') [bind(&RuleSequence::SetSeparatorForReadability, _r1, true)])) - | (comment >> ':') [bind(&RuleSequence::SetComment, _r1, _1)] - ; - - small_range_selectors = - ( -(weekday_selector [bind(&RuleSequence::SetWeekdays, _r1, _1)]) >> - -(time_selector [bind(&RuleSequence::SetTimes, _r1, _1)])) - ; - - rule_modifier = - (charset::no_case[lit("open")] - [bind(&RuleSequence::SetModifier, _r1, Modifier::Open)] >> - -(comment [bind(&RuleSequence::SetModifierComment, _r1, _1)])) - - | ((charset::no_case[lit("closed") | lit("off")]) - [bind(&RuleSequence::SetModifier, _r1, Modifier::Closed)] >> - -(comment [bind(&RuleSequence::SetModifierComment, _r1, _1)])) - - | (charset::no_case[lit("unknown")] - [bind(&RuleSequence::SetModifier, _r1, Modifier::Unknown)] >> - -(comment [bind(&RuleSequence::SetModifierComment, _r1, _1)])) - - | comment [bind(&RuleSequence::SetModifier, _r1, Modifier::Comment), - bind(&RuleSequence::SetModifierComment, _r1, _1)] - ; - - rule_sequence = - ( lit("24/7") [bind(&RuleSequence::SetTwentyFourHours, _val, true)] - | ( -wide_range_selectors(_val) >> - -small_range_selectors(_val) )) >> - -rule_modifier(_val) - ; - - main = ( -(lit("opening_hours") >> lit('=')) >> - (rule_sequence [push_back(_val, _1)] % - (separator [phx::bind(&RuleSequence::SetAnySeparator, back(_val), _1)]))) - ; - - BOOST_SPIRIT_DEBUG_NODE(main); - BOOST_SPIRIT_DEBUG_NODE(rule_sequence); - BOOST_SPIRIT_DEBUG_NODE(rule_modifier); - BOOST_SPIRIT_DEBUG_NODE(small_range_selectors); - BOOST_SPIRIT_DEBUG_NODE(wide_range_selectors); - } -}; } // namespace parsing } // namespace osmoh #undef BOOST_SPIRIT_USE_PHOENIX_V3 diff --git a/3party/opening_hours/opening_hours_parsers_terminals.cpp b/3party/opening_hours/opening_hours_parsers_terminals.cpp new file mode 100644 index 0000000000..856bbc356f --- /dev/null +++ b/3party/opening_hours/opening_hours_parsers_terminals.cpp @@ -0,0 +1,111 @@ +#include "opening_hours_parsers.hpp" + +namespace osmoh +{ +namespace parsing +{ +dash_::dash_() +{ + add + ("-") + /* not standard */ + // (L"–")(L"—")(L"-")(L"~")(L"~")(L"〜")(L"to")(L"às")(L"ás")(L"as")(L"a")(L"ate")(L"bis") + ; +} + +event_::event_() +{ + add + ("dawn", osmoh::TimeEvent::Event::Sunrise) + ("sunrise", osmoh::TimeEvent::Event::Sunrise) + ("sunset", osmoh::TimeEvent::Event::Sunset) + ("dusk", osmoh::TimeEvent::Event::Sunset) + ; +} + +wdays_::wdays_() +{ + add + ("su", 1_weekday)("mo", 2_weekday)("tu", 3_weekday)("we", 4_weekday)("th", 5_weekday)("fr", 6_weekday)("sa", 7_weekday) // en + // (L"mon", 0)(L"tue", 1)(L"wed", 2)(L"thu", 3)(L"fri", 4)(L"sat", 5)(L"sun", 6) // en + // (L"пн", 0)(L"вт", 1)(L"ср", 2)(L"чт", 3)(L"пт", 4)(L"сб", 5)(L"вс", 6) // ru + // (L"пн.", 0)(L"вт.", 1)(L"ср.", 2)(L"чт.", 3)(L"пт.", 4)(L"сб.", 5)(L"вс.", 6) // ru + // (L"lu", 0)(L"ma", 1)(L"me", 2)(L"je", 3)(L"ve", 4)(L"sa", 5)(L"di", 6) // fr + // (L"lu", 0)(L"ma", 1)(L"me", 2)(L"gi", 3)(L"ve", 4)(L"sa", 5)(L"do", 6) // it + // (L"lu", 0)(L"ma", 1)(L"mi", 2)(L"ju", 3)(L"vie", 4)(L"sá", 5)(L"do", 6) // sp + // (L"週一", 0)(L"週二", 1)(L"週三", 2)(L"週四", 3)(L"週五", 4)(L"週六", 5)(L"週日", 6) // ch traditional + // (L"senin", 0)(L"selasa", 1)(L"rabu", 2)(L"kamis", 3)(L"jum'at", 4)(L"sabtu", 5)(L"minggu", 6) // indonesian + + // (L"wd", 2) + + ; +} + +month_::month_() +{ + add + ("jan", 1_M)("feb", 2_M)("mar", 3_M)("apr", 4_M)("may", 5_M)("jun", 6_M) + ("jul", 7_M)("aug", 8_M)("sep", 9_M)("oct", 10_M)("nov", 11_M)("dec", 12_M) + ; +} + +hours_::hours_() +{ + add + ( "0", 0_h)( "1", 1_h)( "2", 2_h)( "3", 3_h)( "4", 4_h)( "5", 5_h)( "6", 6_h)( "7", 7_h)( "8", 8_h)( "9", 9_h) /* not standard */ + ("00", 0_h)("01", 1_h)("02", 2_h)("03", 3_h)("04", 4_h)("05", 5_h)("06", 6_h)("07", 7_h)("08", 8_h)("09", 9_h) + ("10", 10_h)("11", 11_h)("12", 12_h)("13", 13_h)("14", 14_h)("15", 15_h)("16", 16_h)("17", 17_h)("18", 18_h)("19", 19_h) + ("20", 20_h)("21", 21_h)("22", 22_h)("23", 23_h)("24", 24_h) + ; +} + +exthours_::exthours_() +{ + add + ( "0", 0_h)( "1", 1_h)( "2", 2_h)( "3", 3_h)( "4", 4_h)( "5", 5_h)( "6", 6_h)( "7", 7_h)( "8", 8_h)( "9", 9_h) /* not standard */ + ("00", 0_h)("01", 1_h)("02", 2_h)("03", 3_h)("04", 4_h)("05", 5_h)("06", 6_h)("07", 7_h)("08", 8_h)("09", 9_h) + ("10", 10_h)("11", 11_h)("12", 12_h)("13", 13_h)("14", 14_h)("15", 15_h)("16", 16_h)("17", 17_h)("18", 18_h)("19", 19_h) + ("20", 20_h)("21", 21_h)("22", 22_h)("23", 23_h)("24", 24_h)("25", 25_h)("26", 26_h)("27", 27_h)("28", 28_h)("29", 29_h) + ("30", 30_h)("31", 31_h)("32", 32_h)("33", 33_h)("34", 34_h)("35", 35_h)("36", 36_h)("37", 37_h)("38", 38_h)("39", 39_h) + ("40", 40_h)("41", 41_h)("42", 42_h)("43", 43_h)("44", 44_h)("45", 45_h)("46", 46_h)("47", 47_h)("48", 48_h) + ; +} + +minutes_::minutes_() +{ + add + ( "0", 0_min)( "1", 1_min)( "2", 2_min)( "3", 3_min)( "4", 4_min)( "5", 5_min)( "6", 6_min)( "7", 7_min)( "8", 8_min)( "9", 9_min) /* not standard */ + ("00", 0_min)("01", 1_min)("02", 2_min)("03", 3_min)("04", 4_min)("05", 5_min)("06", 6_min)("07", 7_min)("08", 8_min)("09", 9_min) + ("10", 10_min)("11", 11_min)("12", 12_min)("13", 13_min)("14", 14_min)("15", 15_min)("16", 16_min)("17", 17_min)("18", 18_min)("19", 19_min) + ("20", 20_min)("21", 21_min)("22", 22_min)("23", 23_min)("24", 24_min)("25", 25_min)("26", 26_min)("27", 27_min)("28", 28_min)("29", 29_min) + ("30", 30_min)("31", 31_min)("32", 32_min)("33", 33_min)("34", 34_min)("35", 35_min)("36", 36_min)("37", 37_min)("38", 38_min)("39", 39_min) + ("40", 40_min)("41", 41_min)("42", 42_min)("43", 43_min)("44", 44_min)("45", 45_min)("46", 46_min)("47", 47_min)("48", 48_min)("49", 49_min) + ("50", 50_min)("51", 51_min)("52", 52_min)("53", 53_min)("54", 54_min)("55", 55_min)("56", 56_min)("57", 57_min)("58", 58_min)("59", 59_min) + ; +} + +weeknum_::weeknum_() +{ + add + ( "1", 1)( "2", 2)( "3", 3)( "4", 4)( "5", 5)( "6", 6)( "7", 7)( "8", 8)( "9", 9) + ("01", 1)("02", 2)("03", 3)("04", 4)("05", 5)("06", 6)("07", 7)("08", 8)("09", 9) + ("10", 10)("11", 11)("12", 12)("13", 13)("14", 14)("15", 15)("16", 16)("17", 17)("18", 18)("19", 19) + ("20", 20)("21", 21)("22", 22)("23", 23)("24", 24)("25", 25)("26", 26)("27", 27)("28", 28)("29", 29) + ("30", 30)("31", 31)("32", 32)("33", 33)("34", 34)("35", 35)("36", 36)("37", 37)("38", 38)("39", 39) + ("40", 40)("41", 41)("42", 42)("43", 43)("44", 44)("45", 45)("46", 46)("47", 47)("48", 48)("49", 49) + ("50", 50)("51", 51)("52", 52)("53", 53) + ; +} + +daynum_::daynum_() +{ + add + ("1", 1)("2", 2)("3", 3)("4", 4)("5", 5)("6", 6)("7", 7)("8", 8)("9", 9) + ("01", 1)("02", 2)("03", 3)("04", 4)("05", 5)("06", 6)("07", 7)("08", 8)("09", 9) + ("10", 10)("11", 11)("12", 12)("13", 13)("14", 14)("15", 15)("16", 16)("17", 17)("18", 18)("19", 19) + ("20", 20)("21", 21)("22", 22)("23", 23)("24", 24)("25", 25)("26", 26)("27", 27)("28", 28)("29", 29) + ("30", 30)("31", 31) + ; +} +} // namespace parsing +} // namespace osmoh diff --git a/3party/opening_hours/opening_hours_parsers_terminals.hpp b/3party/opening_hours/opening_hours_parsers_terminals.hpp deleted file mode 100644 index dfeea50d5a..0000000000 --- a/3party/opening_hours/opening_hours_parsers_terminals.hpp +++ /dev/null @@ -1,143 +0,0 @@ - -// This header file should be used only with opening_hours_parsers.hpp. -// It's only purpose is to avoid polution opening_hours_parsers.hpp with -// it's content. - -namespace osmoh -{ -namespace parsing -{ -namespace qi = boost::spirit::qi; - -struct dash_ : public qi::symbols<char> -{ - dash_() - { - add - ("-") - /* not standard */ - // (L"–")(L"—")(L"-")(L"~")(L"~")(L"〜")(L"to")(L"às")(L"ás")(L"as")(L"a")(L"ate")(L"bis") - ; - } -} dash; - -struct event_ : public qi::symbols<char, osmoh::TimeEvent::Event> -{ - event_() - { - add - ("dawn", osmoh::TimeEvent::Event::Sunrise) - ("sunrise", osmoh::TimeEvent::Event::Sunrise) - ("sunset", osmoh::TimeEvent::Event::Sunset) - ("dusk", osmoh::TimeEvent::Event::Sunset) - ; - } -} event; - -struct wdays_ : qi::symbols<char, osmoh::Weekday> -{ - wdays_() - { - add - ("su", 1_weekday)("mo", 2_weekday)("tu", 3_weekday)("we", 4_weekday)("th", 5_weekday)("fr", 6_weekday)("sa", 7_weekday) // en - // (L"mon", 0)(L"tue", 1)(L"wed", 2)(L"thu", 3)(L"fri", 4)(L"sat", 5)(L"sun", 6) // en - // (L"пн", 0)(L"вт", 1)(L"ср", 2)(L"чт", 3)(L"пт", 4)(L"сб", 5)(L"вс", 6) // ru - // (L"пн.", 0)(L"вт.", 1)(L"ср.", 2)(L"чт.", 3)(L"пт.", 4)(L"сб.", 5)(L"вс.", 6) // ru - // (L"lu", 0)(L"ma", 1)(L"me", 2)(L"je", 3)(L"ve", 4)(L"sa", 5)(L"di", 6) // fr - // (L"lu", 0)(L"ma", 1)(L"me", 2)(L"gi", 3)(L"ve", 4)(L"sa", 5)(L"do", 6) // it - // (L"lu", 0)(L"ma", 1)(L"mi", 2)(L"ju", 3)(L"vie", 4)(L"sá", 5)(L"do", 6) // sp - // (L"週一", 0)(L"週二", 1)(L"週三", 2)(L"週四", 3)(L"週五", 4)(L"週六", 5)(L"週日", 6) // ch traditional - // (L"senin", 0)(L"selasa", 1)(L"rabu", 2)(L"kamis", 3)(L"jum'at", 4)(L"sabtu", 5)(L"minggu", 6) // indonesian - - // (L"wd", 2) - - ; - } -} wdays; - -struct month_ : qi::symbols<char, osmoh::MonthDay::Month> -{ - month_() - { - add - ("jan", 1_M)("feb", 2_M)("mar", 3_M)("apr", 4_M)("may", 5_M)("jun", 6_M) - ("jul", 7_M)("aug", 8_M)("sep", 9_M)("oct", 10_M)("nov", 11_M)("dec", 12_M) - ; - } -} month; - -struct hours_ : qi::symbols<char, osmoh::Time::THours> -{ - hours_() - { - add - ( "0", 0_h)( "1", 1_h)( "2", 2_h)( "3", 3_h)( "4", 4_h)( "5", 5_h)( "6", 6_h)( "7", 7_h)( "8", 8_h)( "9", 9_h) /* not standard */ - ("00", 0_h)("01", 1_h)("02", 2_h)("03", 3_h)("04", 4_h)("05", 5_h)("06", 6_h)("07", 7_h)("08", 8_h)("09", 9_h) - ("10", 10_h)("11", 11_h)("12", 12_h)("13", 13_h)("14", 14_h)("15", 15_h)("16", 16_h)("17", 17_h)("18", 18_h)("19", 19_h) - ("20", 20_h)("21", 21_h)("22", 22_h)("23", 23_h)("24", 24_h) - ; - } -} hours; - -struct exthours_ : qi::symbols<char, osmoh::Time::THours> -{ - exthours_() - { - add - ( "0", 0_h)( "1", 1_h)( "2", 2_h)( "3", 3_h)( "4", 4_h)( "5", 5_h)( "6", 6_h)( "7", 7_h)( "8", 8_h)( "9", 9_h) /* not standard */ - ("00", 0_h)("01", 1_h)("02", 2_h)("03", 3_h)("04", 4_h)("05", 5_h)("06", 6_h)("07", 7_h)("08", 8_h)("09", 9_h) - ("10", 10_h)("11", 11_h)("12", 12_h)("13", 13_h)("14", 14_h)("15", 15_h)("16", 16_h)("17", 17_h)("18", 18_h)("19", 19_h) - ("20", 20_h)("21", 21_h)("22", 22_h)("23", 23_h)("24", 24_h)("25", 25_h)("26", 26_h)("27", 27_h)("28", 28_h)("29", 29_h) - ("30", 30_h)("31", 31_h)("32", 32_h)("33", 33_h)("34", 34_h)("35", 35_h)("36", 36_h)("37", 37_h)("38", 38_h)("39", 39_h) - ("40", 40_h)("41", 41_h)("42", 42_h)("43", 43_h)("44", 44_h)("45", 45_h)("46", 46_h)("47", 47_h)("48", 48_h) - ; - } -} exthours; - -struct minutes_ : qi::symbols<char, osmoh::Time::TMinutes> -{ - minutes_() - { - add - ( "0", 0_min)( "1", 1_min)( "2", 2_min)( "3", 3_min)( "4", 4_min)( "5", 5_min)( "6", 6_min)( "7", 7_min)( "8", 8_min)( "9", 9_min) /* not standard */ - ("00", 0_min)("01", 1_min)("02", 2_min)("03", 3_min)("04", 4_min)("05", 5_min)("06", 6_min)("07", 7_min)("08", 8_min)("09", 9_min) - ("10", 10_min)("11", 11_min)("12", 12_min)("13", 13_min)("14", 14_min)("15", 15_min)("16", 16_min)("17", 17_min)("18", 18_min)("19", 19_min) - ("20", 20_min)("21", 21_min)("22", 22_min)("23", 23_min)("24", 24_min)("25", 25_min)("26", 26_min)("27", 27_min)("28", 28_min)("29", 29_min) - ("30", 30_min)("31", 31_min)("32", 32_min)("33", 33_min)("34", 34_min)("35", 35_min)("36", 36_min)("37", 37_min)("38", 38_min)("39", 39_min) - ("40", 40_min)("41", 41_min)("42", 42_min)("43", 43_min)("44", 44_min)("45", 45_min)("46", 46_min)("47", 47_min)("48", 48_min)("49", 49_min) - ("50", 50_min)("51", 51_min)("52", 52_min)("53", 53_min)("54", 54_min)("55", 55_min)("56", 56_min)("57", 57_min)("58", 58_min)("59", 59_min) - ; - } -} minutes; - -struct weeknum_ : qi::symbols<char, unsigned> -{ - weeknum_() - { - add - ( "1", 1)( "2", 2)( "3", 3)( "4", 4)( "5", 5)( "6", 6)( "7", 7)( "8", 8)( "9", 9) - ("01", 1)("02", 2)("03", 3)("04", 4)("05", 5)("06", 6)("07", 7)("08", 8)("09", 9) - ("10", 10)("11", 11)("12", 12)("13", 13)("14", 14)("15", 15)("16", 16)("17", 17)("18", 18)("19", 19) - ("20", 20)("21", 21)("22", 22)("23", 23)("24", 24)("25", 25)("26", 26)("27", 27)("28", 28)("29", 29) - ("30", 30)("31", 31)("32", 32)("33", 33)("34", 34)("35", 35)("36", 36)("37", 37)("38", 38)("39", 39) - ("40", 40)("41", 41)("42", 42)("43", 43)("44", 44)("45", 45)("46", 46)("47", 47)("48", 48)("49", 49) - ("50", 50)("51", 51)("52", 52)("53", 53) - ; - } -} weeknum; - -struct daynum_ : qi::symbols<char, MonthDay::TDayNum> -{ - daynum_() - { - add - ("1", 1)("2", 2)("3", 3)("4", 4)("5", 5)("6", 6)("7", 7)("8", 8)("9", 9) - ("01", 1)("02", 2)("03", 3)("04", 4)("05", 5)("06", 6)("07", 7)("08", 8)("09", 9) - ("10", 10)("11", 11)("12", 12)("13", 13)("14", 14)("15", 15)("16", 16)("17", 17)("18", 18)("19", 19) - ("20", 20)("21", 21)("22", 22)("23", 23)("24", 24)("25", 25)("26", 26)("27", 27)("28", 28)("29", 29) - ("30", 30)("31", 31) - ; - } -} daynum; -} // namespace parsing -} // namespace osmoh diff --git a/3party/opening_hours/parse_months.cpp b/3party/opening_hours/parse_months.cpp new file mode 100644 index 0000000000..d16e1864e8 --- /dev/null +++ b/3party/opening_hours/parse_months.cpp @@ -0,0 +1,110 @@ +#include "parse_opening_hours.hpp" +#include "opening_hours_parsers.hpp" + +#define BOOST_SPIRIT_USE_PHOENIX_V3 +#include <boost/spirit/include/phoenix_bind.hpp> +#include <boost/spirit/include/phoenix_operator.hpp> + +namespace osmoh +{ + namespace parsing + { + month_selector_parser::month_selector_parser() : month_selector_parser::base_type(main) + { + using qi::_1; + using qi::_2; + using qi::_3; + using qi::_a; + using qi::_val; + using qi::uint_; + using qi::ushort_; + using qi::lit; + using qi::double_; + using qi::lexeme; + using osmoh::DateOffset; + using osmoh::MonthDay; + using osmoh::MonthdayRange; + + static const qi::int_parser<unsigned, 10, 4, 4> year = {}; + + day_offset = ((lit('+')[_a = 1] | lit('-')[_a = -1]) >> + ushort_ >> charset::no_case[(lit("days") | lit("day"))]) [_val = _a * _1]; + + date_offset = ((lit('+')[_a = true] | lit('-')[_a = false]) + >> charset::no_case[wdays] >> day_offset) + [bind(&DateOffset::SetWDayOffset, _val, _1), + bind(&DateOffset::SetOffset, _val, _2), + bind(&DateOffset::SetWDayOffsetPositive, _val, _a)] + | ((lit('+')[_a = true] | lit('-') [_a = false]) >> charset::no_case[wdays]) + [bind(&DateOffset::SetWDayOffset, _val, _1), + bind(&DateOffset::SetWDayOffsetPositive, _val, _a)] + | day_offset [bind(&DateOffset::SetOffset, _val, _1)] + ; + + date_left = (year >> charset::no_case[month]) [bind(&MonthDay::SetYear, _val, _1), + bind(&MonthDay::SetMonth, _val, _2)] + + | charset::no_case[month] [bind(&MonthDay::SetMonth, _val, _1)] + ; + + date_right = charset::no_case[month] [bind(&MonthDay::SetMonth, _val, _1)] + ; + + date_from = (date_left >> (daynum >> !(lit(':') >> qi::digit))) + [_val = _1, bind(&MonthDay::SetDayNum, _val, _2)] + | (year >> charset::no_case[lit("easter")]) [bind(&MonthDay::SetYear, _val, _1), + bind(&MonthDay::SetVariableDate, _val, + MonthDay::VariableDate::Easter)] + | charset::no_case[lit("easter")] [bind(&MonthDay::SetVariableDate, _val, + MonthDay::VariableDate::Easter)] + ; + + date_to = date_from [_val = _1] + | (daynum >> !(lit(':') >> qi::digit)) [bind(&MonthDay::SetDayNum, _val, _1)] + ; + + date_from_with_offset = (date_from >> date_offset) + [_val = _1, bind(&MonthDay::SetOffset, _val, _2)] + | date_from [_val = _1] + ; + + date_to_with_offset = (date_to >> date_offset) + [_val = _1, bind(&MonthDay::SetOffset, _val, _2)] + | date_to [_val = _1] + ; + + monthday_range = (date_from_with_offset >> dash >> date_to_with_offset) + [bind(&MonthdayRange::SetStart, _val, _1), + bind(&MonthdayRange::SetEnd, _val, _2)] + | (date_from_with_offset >> '+') [bind(&MonthdayRange::SetStart, _val, _1), + bind(&MonthdayRange::SetPlus, _val, true)] + | (date_left >> dash >> date_right >> '/' >> uint_) + [bind(&MonthdayRange::SetStart, _val, _1), + bind(&MonthdayRange::SetEnd, _val, _2), + bind(&MonthdayRange::SetPeriod, _val, _3)] + | (date_left >> lit("-") >> date_right) [bind(&MonthdayRange::SetStart, _val, _1), + bind(&MonthdayRange::SetEnd, _val, _2)] + | date_from [bind(&MonthdayRange::SetStart, _val, _1)] + | date_left [bind(&MonthdayRange::SetStart, _val, _1)] + ; + + main %= (monthday_range % ','); + + BOOST_SPIRIT_DEBUG_NODE(main); + BOOST_SPIRIT_DEBUG_NODE(monthday_range); + BOOST_SPIRIT_DEBUG_NODE(day_offset); + BOOST_SPIRIT_DEBUG_NODE(date_offset); + BOOST_SPIRIT_DEBUG_NODE(date_left); + BOOST_SPIRIT_DEBUG_NODE(date_right); + BOOST_SPIRIT_DEBUG_NODE(date_from); + BOOST_SPIRIT_DEBUG_NODE(date_to); + BOOST_SPIRIT_DEBUG_NODE(date_from_with_offset); + BOOST_SPIRIT_DEBUG_NODE(date_to_with_offset); + } + } + + bool Parse(std::string const & str, TMonthdayRanges & context) + { + return osmoh::ParseImpl<parsing::month_selector_parser>(str, context); + } +} // namespace osmoh diff --git a/3party/opening_hours/parse_opening_hours.cpp b/3party/opening_hours/parse_opening_hours.cpp index fd93d3d0f4..0030d797da 100644 --- a/3party/opening_hours/parse_opening_hours.cpp +++ b/3party/opening_hours/parse_opening_hours.cpp @@ -1,98 +1,123 @@ #include "parse_opening_hours.hpp" #include "opening_hours_parsers.hpp" -namespace -{ -template <typename Context, typename Iterator> -struct context_parser; - -template<typename Iterator> struct context_parser<osmoh::TTimespans, Iterator> -{ - using type = osmoh::parsing::time_selector<Iterator>; -}; - -template<typename Iterator> struct context_parser<osmoh::Weekdays, Iterator> -{ - using type = osmoh::parsing::weekday_selector<Iterator>; -}; - -template<typename Iterator> struct context_parser<osmoh::TMonthdayRanges, Iterator> -{ - using type = osmoh::parsing::month_selector<Iterator>; -}; - -template<typename Iterator> struct context_parser<osmoh::TYearRanges, Iterator> -{ - using type = osmoh::parsing::year_selector<Iterator>; -}; - -template<typename Iterator> struct context_parser<osmoh::TWeekRanges, Iterator> -{ - using type = osmoh::parsing::week_selector<Iterator>; -}; - -template<typename Iterator> struct context_parser<osmoh::TRuleSequences, Iterator> -{ - using type = osmoh::parsing::time_domain<Iterator>; -}; - - -template <typename Context, typename Iterator> -using context_parser_t = typename context_parser<Context, Iterator>::type; - -template <typename Context> -bool ParseImp(std::string const & str, Context & context) -{ - using boost::spirit::qi::phrase_parse; - using boost::spirit::standard_wide::space; - - context_parser_t<Context, decltype(begin(str))> parser; -#ifndef NDEBUG - boost::spirit::qi::what(parser); -#endif - - auto first = begin(str); - auto const last = end(str); - auto parsed = phrase_parse(first, last, parser, - space, context); - - if (!parsed || first != last) - return false; - - return true; -} -} // namespace - +#define BOOST_SPIRIT_USE_PHOENIX_V3 +#include <boost/spirit/include/phoenix_bind.hpp> +#include <boost/spirit/include/phoenix_operator.hpp> +#include <boost/spirit/include/phoenix_stl.hpp> namespace osmoh { -bool Parse(std::string const & str, TTimespans & s) -{ - return ParseImp(str, s); -} - -bool Parse(std::string const & str, Weekdays & w) -{ - return ParseImp(str, w); -} - -bool Parse(std::string const & str, TMonthdayRanges & m) -{ - return ParseImp(str, m); -} - -bool Parse(std::string const & str, TYearRanges & y) +namespace parsing { - return ParseImp(str, y); -} - -bool Parse(std::string const & str, TWeekRanges & w) -{ - return ParseImp(str, w); -} - -bool Parse(std::string const & str, TRuleSequences & r) + dash_ dash; + event_ event; + wdays_ wdays; + month_ month; + hours_ hours; + exthours_ exthours; + minutes_ minutes; + weeknum_ weeknum; + daynum_ daynum; + + class time_domain : public qi::grammar<Iterator, osmoh::TRuleSequences(), space_type> + { + protected: + weekday_selector_parser weekday_selector; + time_selector_parser time_selector; + year_selector_parser year_selector; + month_selector_parser month_selector; + week_selector_parser week_selector; + + qi::rule<Iterator, std::string()> comment; + qi::rule<Iterator, std::string(), space_type> separator; + + qi::rule<Iterator, qi::unused_type(osmoh::RuleSequence &), space_type> small_range_selectors; + qi::rule<Iterator, qi::unused_type(osmoh::RuleSequence &), space_type> wide_range_selectors; + qi::rule<Iterator, qi::unused_type(osmoh::RuleSequence &), space_type> rule_modifier; + + qi::rule<Iterator, osmoh::RuleSequence(), space_type> rule_sequence; + qi::rule<Iterator, osmoh::TRuleSequences(), space_type> main; + + public: + time_domain() : time_domain::base_type(main) + { + using qi::lit; + using qi::lexeme; + using qi::_1; + using qi::_a; + using qi::_r1; + using qi::_val; + using charset::char_; + using qi::eps; + using qi::lazy; + using phx::back; + using phx::push_back; + using osmoh::RuleSequence; + + using Modifier = RuleSequence::Modifier; + + comment %= '"' >> +(char_ - '"') >> '"' + ; + + separator %= charset::string(";") + | charset::string("||") + | charset::string(",") + ; + + wide_range_selectors = + ( -(year_selector [bind(&RuleSequence::SetYears, _r1, _1)]) >> + -(month_selector [bind(&RuleSequence::SetMonths, _r1, _1)]) >> + -(week_selector [bind(&RuleSequence::SetWeeks, _r1, _1)]) >> + -(lit(':') [bind(&RuleSequence::SetSeparatorForReadability, _r1, true)])) + | (comment >> ':') [bind(&RuleSequence::SetComment, _r1, _1)] + ; + + small_range_selectors = + ( -(weekday_selector [bind(&RuleSequence::SetWeekdays, _r1, _1)]) >> + -(time_selector [bind(&RuleSequence::SetTimes, _r1, _1)])) + ; + + rule_modifier = + (charset::no_case[lit("open")] + [bind(&RuleSequence::SetModifier, _r1, Modifier::Open)] >> + -(comment [bind(&RuleSequence::SetModifierComment, _r1, _1)])) + + | ((charset::no_case[lit("closed") | lit("off")]) + [bind(&RuleSequence::SetModifier, _r1, Modifier::Closed)] >> + -(comment [bind(&RuleSequence::SetModifierComment, _r1, _1)])) + + | (charset::no_case[lit("unknown")] + [bind(&RuleSequence::SetModifier, _r1, Modifier::Unknown)] >> + -(comment [bind(&RuleSequence::SetModifierComment, _r1, _1)])) + + | comment [bind(&RuleSequence::SetModifier, _r1, Modifier::Comment), + bind(&RuleSequence::SetModifierComment, _r1, _1)] + ; + + rule_sequence = + ( lit("24/7") [bind(&RuleSequence::SetTwentyFourHours, _val, true)] + | ( -wide_range_selectors(_val) >> + -small_range_selectors(_val) )) >> + -rule_modifier(_val) + ; + + main = ( -(lit("opening_hours") >> lit('=')) >> + (rule_sequence [push_back(_val, _1)] % + (separator [phx::bind(&RuleSequence::SetAnySeparator, back(_val), _1)]))) + ; + + BOOST_SPIRIT_DEBUG_NODE(main); + BOOST_SPIRIT_DEBUG_NODE(rule_sequence); + BOOST_SPIRIT_DEBUG_NODE(rule_modifier); + BOOST_SPIRIT_DEBUG_NODE(small_range_selectors); + BOOST_SPIRIT_DEBUG_NODE(wide_range_selectors); + } + }; +} // namespace parsing + +bool Parse(std::string const & str, TRuleSequences & context) { - return ParseImp(str, r); + return osmoh::ParseImpl<parsing::time_domain>(str, context); } } // namespace osmoh diff --git a/3party/opening_hours/parse_opening_hours.hpp b/3party/opening_hours/parse_opening_hours.hpp index 02d742f5a1..fedc55a4ba 100644 --- a/3party/opening_hours/parse_opening_hours.hpp +++ b/3party/opening_hours/parse_opening_hours.hpp @@ -2,9 +2,32 @@ #include "opening_hours.hpp" #include <string> +#include <boost/spirit/include/qi.hpp> + namespace osmoh { +template<typename Parser, typename Context> +bool ParseImpl(std::string const & str, Context & context) +{ + using boost::spirit::qi::phrase_parse; + using boost::spirit::standard_wide::space; + + Parser parser; +#ifndef NDEBUG + boost::spirit::qi::what(parser); +#endif + + auto first = begin(str); + auto const last = end(str); + auto parsed = phrase_parse(first, last, parser, space, context); + + if (!parsed || first != last) + return false; + + return true; +} + bool Parse(std::string const &, TTimespans &); bool Parse(std::string const &, Weekdays &); bool Parse(std::string const &, TMonthdayRanges &); diff --git a/3party/opening_hours/parse_timespans.cpp b/3party/opening_hours/parse_timespans.cpp new file mode 100644 index 0000000000..7c1af6b5f5 --- /dev/null +++ b/3party/opening_hours/parse_timespans.cpp @@ -0,0 +1,99 @@ +#include "parse_opening_hours.hpp" +#include "opening_hours_parsers.hpp" + +#define BOOST_SPIRIT_USE_PHOENIX_V3 +#include <boost/spirit/include/phoenix_bind.hpp> +#include <boost/spirit/include/phoenix_operator.hpp> + + +namespace osmoh +{ + namespace parsing + { + time_selector_parser::time_selector_parser() : time_selector_parser::base_type(main) + { + using qi::int_; + using qi::_1; + using qi::_2; + using qi::_3; + using qi::_a; + using qi::_val; + using qi::lit; + using charset::char_; + using osmoh::HourMinutes; + using osmoh::TimeEvent; + using osmoh::Time; + using osmoh::Timespan; + + hour_minutes = + (hours >> lit(':') >> minutes) [bind(&HourMinutes::AddDuration, _val, _1), + bind(&HourMinutes::AddDuration, _val, _2)] + ; + + extended_hour_minutes = + (exthours >> lit(':') >> minutes)[bind(&HourMinutes::AddDuration, _val, _1), + bind(&HourMinutes::AddDuration, _val, _2)] + ; + + variable_time = + ( lit('(') + >> charset::no_case[event] [bind(&TimeEvent::SetEvent, _val, _1)] + >> ( (lit('+') >> hour_minutes) [bind(&TimeEvent::SetOffset, _val, _1)] + | (lit('-') >> hour_minutes) [bind(&TimeEvent::SetOffset, _val, -_1)] ) + >> lit(')') + ) + | charset::no_case[event][bind(&TimeEvent::SetEvent, _val, _1)] + ; + + extended_time = extended_hour_minutes [bind(&Time::SetHourMinutes, _val, _1)] + | variable_time [bind(&Time::SetEvent, _val, _1)] + ; + + time = hour_minutes [bind(&Time::SetHourMinutes, _val, _1)] + | variable_time [bind(&Time::SetEvent, _val, _1)] + ; + + timespan = + (time >> dash >> extended_time >> '/' >> hour_minutes) + [bind(&Timespan::SetStart, _val, _1), + bind(&Timespan::SetEnd, _val, _2), + bind(&Timespan::SetPeriod, _val, _3)] + + | (time >> dash >> extended_time >> '/' >> minutes) + [bind(&Timespan::SetStart, _val, _1), + bind(&Timespan::SetEnd, _val, _2), + bind(&Timespan::SetPeriod, _val, _3)] + + | (time >> dash >> extended_time >> '+') + [bind(&Timespan::SetStart, _val, _1), + bind(&Timespan::SetEnd, _val, _2), + bind(&Timespan::SetPlus, _val, true)] + + | (time >> dash >> extended_time) + [bind(&Timespan::SetStart, _val, _1), + bind(&Timespan::SetEnd, _val, _2)] + + | (time >> '+') + [bind(&Timespan::SetStart, _val, _1), + bind(&Timespan::SetPlus, _val, true)] + + // This rule is only used for collection_times tag wish is not in our interest. + // | time[bind(&Timespan::SetStart, _val, _1)] + ; + + main %= timespan % ','; + + BOOST_SPIRIT_DEBUG_NODE(main); + BOOST_SPIRIT_DEBUG_NODE(timespan); + BOOST_SPIRIT_DEBUG_NODE(time); + BOOST_SPIRIT_DEBUG_NODE(extended_time); + BOOST_SPIRIT_DEBUG_NODE(variable_time); + BOOST_SPIRIT_DEBUG_NODE(extended_hour_minutes); + } + } + + bool Parse(std::string const & str, TTimespans & context) + { + return osmoh::ParseImpl<parsing::time_selector_parser>(str, context); + } +} // namespace osmoh diff --git a/3party/opening_hours/parse_weekdays.cpp b/3party/opening_hours/parse_weekdays.cpp new file mode 100644 index 0000000000..e27ee7070b --- /dev/null +++ b/3party/opening_hours/parse_weekdays.cpp @@ -0,0 +1,80 @@ +#include "parse_opening_hours.hpp" +#include "opening_hours_parsers.hpp" + +#define BOOST_SPIRIT_USE_PHOENIX_V3 +#include <boost/spirit/include/phoenix_bind.hpp> +#include <boost/spirit/include/phoenix_operator.hpp> + +namespace osmoh +{ + namespace parsing + { + weekday_selector_parser::weekday_selector_parser() : weekday_selector_parser::base_type(main) + { + using qi::_a; + using qi::_1; + using qi::_2; + using qi::_val; + using qi::lit; + using qi::ushort_; + using osmoh::NthWeekdayOfTheMonthEntry; + using osmoh::Holiday; + using osmoh::WeekdayRange; + using osmoh::Weekdays; + + nth = ushort_(1)[_val = NthWeekdayOfTheMonthEntry::NthDayOfTheMonth::First] + | ushort_(2) [_val = NthWeekdayOfTheMonthEntry::NthDayOfTheMonth::Second] + | ushort_(3) [_val = NthWeekdayOfTheMonthEntry::NthDayOfTheMonth::Third] + | ushort_(4) [_val = NthWeekdayOfTheMonthEntry::NthDayOfTheMonth::Fourth] + | ushort_(5) [_val = NthWeekdayOfTheMonthEntry::NthDayOfTheMonth::Fifth]; + + nth_entry = (nth >> dash >> nth) [bind(&NthWeekdayOfTheMonthEntry::SetStart, _val, _1), + bind(&NthWeekdayOfTheMonthEntry::SetEnd, _val, _2)] + | (lit('-') >> nth) [bind(&NthWeekdayOfTheMonthEntry::SetEnd, _val, _1)] + | nth [bind(&NthWeekdayOfTheMonthEntry::SetStart, _val, _1)] + ; + + day_offset = + ( (lit('+')[_a = 1] | lit('-') [_a = -1]) >> + ushort_ [_val = _1 * _a] >> + charset::no_case[(lit("days") | lit("day"))] ) + ; + + holiday = (charset::no_case[lit("SH")] [bind(&Holiday::SetPlural, _val, false)] + >> -day_offset [bind(&Holiday::SetOffset, _val, _1)]) + | charset::no_case[lit("PH")] [bind(&Holiday::SetPlural, _val, true)] + ; + + holiday_sequence %= (holiday % ','); + + weekday_range = + ( charset::no_case[wdays] [bind(&WeekdayRange::SetStart, _val, _1)] >> + '[' >> (nth_entry [bind(&WeekdayRange::AddNth, _val, _1)]) % ',') >> ']' >> + -(day_offset [bind(&WeekdayRange::SetOffset, _val, _1)]) + | charset::no_case[(wdays >> dash >> wdays)] [bind(&WeekdayRange::SetStart, _val, _1), + bind(&WeekdayRange::SetEnd, _val, _2)] + | charset::no_case[wdays] [bind(&WeekdayRange::SetStart, _val, _1)] + ; + + weekday_sequence %= (weekday_range % ',') >> !qi::no_skip[charset::alpha] + ; + + main = (holiday_sequence >> -lit(',') >> weekday_sequence) + [bind(&Weekdays::SetHolidays, _val, _1), + bind(&Weekdays::SetWeekdayRanges, _val, _2)] + | holiday_sequence [bind(&Weekdays::SetHolidays, _val, _1)] + | weekday_sequence [bind(&Weekdays::SetWeekdayRanges, _val, _1)] + ; + + BOOST_SPIRIT_DEBUG_NODE(main); + BOOST_SPIRIT_DEBUG_NODE(weekday_sequence); + BOOST_SPIRIT_DEBUG_NODE(weekday_range); + BOOST_SPIRIT_DEBUG_NODE(holiday_sequence); + } + } + + bool Parse(std::string const & str, Weekdays & context) + { + return osmoh::ParseImpl<parsing::weekday_selector_parser>(str, context); + } +} // namespace osmoh diff --git a/3party/opening_hours/parse_weeks.cpp b/3party/opening_hours/parse_weeks.cpp new file mode 100644 index 0000000000..69b55b4189 --- /dev/null +++ b/3party/opening_hours/parse_weeks.cpp @@ -0,0 +1,37 @@ +#include "parse_opening_hours.hpp" +#include "opening_hours_parsers.hpp" + +#define BOOST_SPIRIT_USE_PHOENIX_V3 +#include <boost/spirit/include/phoenix_bind.hpp> + +namespace osmoh +{ + namespace parsing + { + week_selector_parser::week_selector_parser() : week_selector_parser::base_type(main) + { + using qi::uint_; + using qi::lit; + using qi::_1; + using qi::_2; + using qi::_3; + using qi::_val; + using osmoh::WeekRange; + + week = (weeknum >> dash >> weeknum >> '/' >> uint_) [bind(&WeekRange::SetStart, _val, _1), + bind(&WeekRange::SetEnd, _val, _2), + bind(&WeekRange::SetPeriod, _val, _3)] + | (weeknum >> dash >> weeknum) [bind(&WeekRange::SetStart, _val, _1), + bind(&WeekRange::SetEnd, _val, _2)] + | weeknum [bind(&WeekRange::SetStart, _val, _1)] + ; + + main %= charset::no_case[lit("week")] >> (week % ','); + } + } + + bool Parse(std::string const & str, TWeekRanges & context) + { + return osmoh::ParseImpl<parsing::week_selector_parser>(str, context); + } +} // namespace osmoh diff --git a/3party/opening_hours/parse_years.cpp b/3party/opening_hours/parse_years.cpp new file mode 100644 index 0000000000..90d5f186a5 --- /dev/null +++ b/3party/opening_hours/parse_years.cpp @@ -0,0 +1,42 @@ +#include "parse_opening_hours.hpp" +#include "opening_hours_parsers.hpp" + +#define BOOST_SPIRIT_USE_PHOENIX_V3 +#include <boost/spirit/include/phoenix_bind.hpp> + +namespace osmoh +{ + namespace parsing + { + year_selector_parser::year_selector_parser() : year_selector_parser::base_type(main) + { + using qi::uint_; + using qi::lit; + using qi::_1; + using qi::_2; + using qi::_3; + using qi::_val; + using osmoh::YearRange; + + static const qi::int_parser<unsigned, 10, 4, 4> year = {}; + + year_range = (year >> dash >> year >> '/' >> uint_) [bind(&YearRange::SetStart, _val, _1), + bind(&YearRange::SetEnd, _val, _2), + bind(&YearRange::SetPeriod, _val, _3)] + | (year >> dash >> year) [bind(&YearRange::SetStart, _val, _1), + bind(&YearRange::SetEnd, _val, _2)] + | (year >> lit('+')) [bind(&YearRange::SetStart, _val, _1), + bind(&YearRange::SetPlus, _val, true)] + | year [bind(&YearRange::SetStart, _val, _1)] + ; + + main %= (year_range % ','); + } + + } + + bool Parse(std::string const & str, TYearRanges & context) + { + return osmoh::ParseImpl<parsing::year_selector_parser>(str, context); + } +} // namespace osmoh diff --git a/xcode/api/api.xcodeproj/project.pbxproj b/xcode/api/api.xcodeproj/project.pbxproj index 86c200a410..4417fadddf 100644 --- a/xcode/api/api.xcodeproj/project.pbxproj +++ b/xcode/api/api.xcodeproj/project.pbxproj @@ -268,6 +268,7 @@ 3496AB8B1DC1F6CE00C5DDBA /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; 675347121A40577A00A0A8C3 /* Build configuration list for PBXProject "api" */ = { isa = XCConfigurationList; diff --git a/xcode/opening_hours/opening_hours.xcodeproj/project.pbxproj b/xcode/opening_hours/opening_hours.xcodeproj/project.pbxproj index e50d91257a..31cbb22c1f 100644 --- a/xcode/opening_hours/opening_hours.xcodeproj/project.pbxproj +++ b/xcode/opening_hours/opening_hours.xcodeproj/project.pbxproj @@ -7,7 +7,12 @@ objects = { /* Begin PBXBuildFile section */ - E91738901BECCB5400717F6E /* opening_hours_parsers_terminals.hpp in Headers */ = {isa = PBXBuildFile; fileRef = E91738861BECCB5400717F6E /* opening_hours_parsers_terminals.hpp */; }; + 675879CB1DE5CCA000CA757C /* parse_timespans.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 675879CA1DE5CCA000CA757C /* parse_timespans.cpp */; }; + 675879CD1DE5D9F300CA757C /* parse_weekdays.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 675879CC1DE5D9F300CA757C /* parse_weekdays.cpp */; }; + 675879CF1DE5DF3900CA757C /* parse_months.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 675879CE1DE5DF3900CA757C /* parse_months.cpp */; }; + 675879D11DE5DF8400CA757C /* parse_years.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 675879D01DE5DF8400CA757C /* parse_years.cpp */; }; + 675879D31DE5DFE400CA757C /* parse_weeks.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 675879D21DE5DFE400CA757C /* parse_weeks.cpp */; }; + 675879D51DE5F8E300CA757C /* opening_hours_parsers_terminals.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E91738861BECCB5400717F6E /* opening_hours_parsers_terminals.cpp */; }; E91738911BECCB5400717F6E /* opening_hours_parsers.hpp in Headers */ = {isa = PBXBuildFile; fileRef = E91738871BECCB5400717F6E /* opening_hours_parsers.hpp */; }; E91738921BECCB5400717F6E /* opening_hours.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E91738881BECCB5400717F6E /* opening_hours.cpp */; }; E91738931BECCB5400717F6E /* opening_hours.hpp in Headers */ = {isa = PBXBuildFile; fileRef = E91738891BECCB5400717F6E /* opening_hours.hpp */; }; @@ -66,7 +71,12 @@ 34F558651DBF460300A4FC11 /* common-release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "common-release.xcconfig"; path = "../common-release.xcconfig"; sourceTree = "<group>"; }; 670C61E71AC3511700C38A8C /* libopening_hours.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libopening_hours.a; sourceTree = BUILT_PRODUCTS_DIR; }; 670C61FF1AC351AC00C38A8C /* opening_hours_test */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = opening_hours_test; sourceTree = BUILT_PRODUCTS_DIR; }; - E91738861BECCB5400717F6E /* opening_hours_parsers_terminals.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = opening_hours_parsers_terminals.hpp; sourceTree = "<group>"; }; + 675879CA1DE5CCA000CA757C /* parse_timespans.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = parse_timespans.cpp; sourceTree = "<group>"; }; + 675879CC1DE5D9F300CA757C /* parse_weekdays.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = parse_weekdays.cpp; sourceTree = "<group>"; }; + 675879CE1DE5DF3900CA757C /* parse_months.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = parse_months.cpp; sourceTree = "<group>"; }; + 675879D01DE5DF8400CA757C /* parse_years.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = parse_years.cpp; sourceTree = "<group>"; }; + 675879D21DE5DFE400CA757C /* parse_weeks.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = parse_weeks.cpp; sourceTree = "<group>"; }; + E91738861BECCB5400717F6E /* opening_hours_parsers_terminals.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = opening_hours_parsers_terminals.cpp; sourceTree = "<group>"; }; E91738871BECCB5400717F6E /* opening_hours_parsers.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = opening_hours_parsers.hpp; sourceTree = "<group>"; }; E91738881BECCB5400717F6E /* opening_hours.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = opening_hours.cpp; sourceTree = "<group>"; }; E91738891BECCB5400717F6E /* opening_hours.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = opening_hours.hpp; sourceTree = "<group>"; }; @@ -167,7 +177,7 @@ 670C61E91AC3511700C38A8C /* opening_hours */ = { isa = PBXGroup; children = ( - E91738861BECCB5400717F6E /* opening_hours_parsers_terminals.hpp */, + E91738861BECCB5400717F6E /* opening_hours_parsers_terminals.cpp */, E91738871BECCB5400717F6E /* opening_hours_parsers.hpp */, E91738881BECCB5400717F6E /* opening_hours.cpp */, E91738891BECCB5400717F6E /* opening_hours.hpp */, @@ -176,6 +186,11 @@ E917388D1BECCB5400717F6E /* rules_evaluation_private.hpp */, E917388E1BECCB5400717F6E /* rules_evaluation.cpp */, E917388F1BECCB5400717F6E /* rules_evaluation.hpp */, + 675879CA1DE5CCA000CA757C /* parse_timespans.cpp */, + 675879CC1DE5D9F300CA757C /* parse_weekdays.cpp */, + 675879CE1DE5DF3900CA757C /* parse_months.cpp */, + 675879D01DE5DF8400CA757C /* parse_years.cpp */, + 675879D21DE5DFE400CA757C /* parse_weeks.cpp */, ); name = opening_hours; path = ../../3party/opening_hours; @@ -227,7 +242,6 @@ E91738981BECCB5400717F6E /* rules_evaluation.hpp in Headers */, E91738911BECCB5400717F6E /* opening_hours_parsers.hpp in Headers */, E91738931BECCB5400717F6E /* opening_hours.hpp in Headers */, - E91738901BECCB5400717F6E /* opening_hours_parsers_terminals.hpp in Headers */, E91738951BECCB5400717F6E /* parse_opening_hours.hpp in Headers */, E91738961BECCB5400717F6E /* rules_evaluation_private.hpp in Headers */, ); @@ -413,8 +427,14 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 675879D51DE5F8E300CA757C /* opening_hours_parsers_terminals.cpp in Sources */, E91738941BECCB5400717F6E /* parse_opening_hours.cpp in Sources */, + 675879D31DE5DFE400CA757C /* parse_weeks.cpp in Sources */, E91738921BECCB5400717F6E /* opening_hours.cpp in Sources */, + 675879D11DE5DF8400CA757C /* parse_years.cpp in Sources */, + 675879CF1DE5DF3900CA757C /* parse_months.cpp in Sources */, + 675879CD1DE5D9F300CA757C /* parse_weekdays.cpp in Sources */, + 675879CB1DE5CCA000CA757C /* parse_timespans.cpp in Sources */, E91738971BECCB5400717F6E /* rules_evaluation.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; |