2020#define avro_parsing_Symbol_hh__
2121
2222#include < algorithm>
23+ #include < any>
2324#include < map>
2425#include < set>
2526#include < sstream>
2627#include < stack>
28+ #include < tuple>
2729#include < utility>
2830#include < vector>
2931
30- #include < boost/any.hpp>
31- #include < boost/tuple/tuple.hpp>
32-
3332#include " Decoder.hh"
3433#include " Exception.hh"
3534#include " Node.hh"
@@ -39,10 +38,10 @@ namespace parsing {
3938
4039class Symbol ;
4140
42- typedef std::vector<Symbol> Production ;
43- typedef std::shared_ptr<Production> ProductionPtr ;
44- typedef boost ::tuple<std::stack<ssize_t >, bool , ProductionPtr, ProductionPtr> RepeaterInfo ;
45- typedef boost ::tuple<ProductionPtr, ProductionPtr> RootInfo ;
41+ using Production = std::vector<Symbol>;
42+ using ProductionPtr = std::shared_ptr<Production>;
43+ using RepeaterInfo = std ::tuple<std::stack<ssize_t >, bool , ProductionPtr, ProductionPtr>;
44+ using RootInfo = std ::tuple<ProductionPtr, ProductionPtr>;
4645
4746class Symbol {
4847public:
@@ -92,7 +91,7 @@ public:
9291
9392private:
9493 Kind kind_;
95- boost ::any extra_;
94+ std ::any extra_;
9695
9796 explicit Symbol (Kind k) : kind_(k) {}
9897 template <typename T>
@@ -105,17 +104,17 @@ public:
105104
106105 template <typename T>
107106 T extra () const {
108- return boost ::any_cast<T>(extra_);
107+ return std ::any_cast<T>(extra_);
109108 }
110109
111110 template <typename T>
112111 T *extrap () {
113- return boost ::any_cast<T>(&extra_);
112+ return std ::any_cast<T>(&extra_);
114113 }
115114
116115 template <typename T>
117116 const T *extrap () const {
118- return boost ::any_cast<T>(&extra_);
117+ return std ::any_cast<T>(&extra_);
119118 }
120119
121120 template <typename T>
@@ -340,8 +339,8 @@ void fixup(Symbol &s, const std::map<T, ProductionPtr> &m,
340339 } break ;
341340 case Symbol::Kind::Repeater: {
342341 const RepeaterInfo &ri = *s.extrap <RepeaterInfo>();
343- fixup_internal (boost::tuples ::get<2 >(ri), m, seen);
344- fixup_internal (boost::tuples ::get<3 >(ri), m, seen);
342+ fixup_internal (std ::get<2 >(ri), m, seen);
343+ fixup_internal (std ::get<3 >(ri), m, seen);
345344 } break ;
346345 case Symbol::Kind::Placeholder: {
347346 typename std::map<T, std::shared_ptr<Production>>::const_iterator it =
@@ -419,7 +418,7 @@ public:
419418 } else {
420419 switch (s.kind ()) {
421420 case Symbol::Kind::Root:
422- append (boost::tuples ::get<0 >(*s.extrap <RootInfo>()));
421+ append (std ::get<0 >(*s.extrap <RootInfo>()));
423422 continue ;
424423 case Symbol::Kind::Indirect: {
425424 ProductionPtr pp =
@@ -437,7 +436,7 @@ public:
437436 continue ;
438437 case Symbol::Kind::Repeater: {
439438 auto *p = s.extrap <RepeaterInfo>();
440- std::stack<ssize_t > &ns = boost::tuples ::get<0 >(*p);
439+ std::stack<ssize_t > &ns = std ::get<0 >(*p);
441440 if (ns.empty ()) {
442441 throw Exception (
443442 " Empty item count stack in repeater advance" );
@@ -447,7 +446,7 @@ public:
447446 " Zero item count in repeater advance" );
448447 }
449448 --ns.top ();
450- append (boost::tuples ::get<2 >(*p));
449+ append (std ::get<2 >(*p));
451450 }
452451 continue ;
453452 case Symbol::Kind::Error:
@@ -527,7 +526,7 @@ public:
527526 }
528527 Symbol &t2 = parsingStack.top ();
529528 auto *p = t2.extrap <RepeaterInfo>();
530- boost::tuples ::get<0 >(*p).push (n);
529+ std ::get<0 >(*p).push (n);
531530 continue ;
532531 }
533532 case Symbol::Kind::ArrayEnd:
@@ -542,7 +541,7 @@ public:
542541 }
543542 Symbol &t2 = parsingStack.top ();
544543 auto *p2 = t2.extrap <RepeaterInfo>();
545- boost::tuples ::get<0 >(*p2).push (n);
544+ std ::get<0 >(*p2).push (n);
546545 continue ;
547546 }
548547 case Symbol::Kind::MapEnd:
@@ -564,19 +563,19 @@ public:
564563 }
565564 case Symbol::Kind::Repeater: {
566565 auto *p = t.extrap <RepeaterInfo>();
567- std::stack<ssize_t > &ns = boost::tuples ::get<0 >(*p);
566+ std::stack<ssize_t > &ns = std ::get<0 >(*p);
568567 if (ns.empty ()) {
569568 throw Exception (
570569 " Empty item count stack in repeater skip" );
571570 }
572571 ssize_t &n = ns.top ();
573572 if (n == 0 ) {
574- n = boost::tuples ::get<1 >(*p) ? d.arrayNext ()
575- : d.mapNext ();
573+ n = std ::get<1 >(*p) ? d.arrayNext ()
574+ : d.mapNext ();
576575 }
577576 if (n != 0 ) {
578577 --n;
579- append (boost::tuples ::get<3 >(*p));
578+ append (std ::get<3 >(*p));
580579 continue ;
581580 } else {
582581 ns.pop ();
@@ -680,7 +679,7 @@ public:
680679 Symbol &s = parsingStack.top ();
681680 assertMatch (Symbol::Kind::Repeater, s.kind ());
682681 auto *p = s.extrap <RepeaterInfo>();
683- std::stack<ssize_t > &nn = boost::tuples ::get<0 >(*p);
682+ std::stack<ssize_t > &nn = std ::get<0 >(*p);
684683 nn.push (n);
685684 }
686685
@@ -689,7 +688,7 @@ public:
689688 Symbol &s = parsingStack.top ();
690689 assertMatch (Symbol::Kind::Repeater, s.kind ());
691690 auto *p = s.extrap <RepeaterInfo>();
692- std::stack<ssize_t > &nn = boost::tuples ::get<0 >(*p);
691+ std::stack<ssize_t > &nn = std ::get<0 >(*p);
693692 if (nn.empty () || nn.top () != 0 ) {
694693 throw Exception (" Wrong number of items" );
695694 }
@@ -701,7 +700,7 @@ public:
701700 Symbol &s = parsingStack.top ();
702701 assertMatch (Symbol::Kind::Repeater, s.kind ());
703702 auto *p = s.extrap <RepeaterInfo>();
704- std::stack<ssize_t > &ns = boost::tuples ::get<0 >(*p);
703+ std::stack<ssize_t > &ns = std ::get<0 >(*p);
705704 if (ns.empty ()) {
706705 throw Exception (" Incorrect number of items (empty)" );
707706 }
@@ -770,7 +769,7 @@ public:
770769 parsingStack.pop ();
771770 }
772771 Symbol &s = parsingStack.top ();
773- append (boost::tuples ::get<0 >(*s.extrap <RootInfo>()));
772+ append (std ::get<0 >(*s.extrap <RootInfo>()));
774773 }
775774};
776775
@@ -790,8 +789,8 @@ inline std::ostream &operator<<(std::ostream &os, const Symbol &s) {
790789 case Symbol::Kind::Repeater: {
791790 const RepeaterInfo &ri = *s.extrap <RepeaterInfo>();
792791 os << ' (' << Symbol::toString (s.kind ())
793- << ' ' << *boost::tuples ::get<2 >(ri)
794- << ' ' << *boost::tuples ::get<3 >(ri)
792+ << ' ' << *std ::get<2 >(ri)
793+ << ' ' << *std ::get<3 >(ri)
795794 << ' )' ;
796795 } break ;
797796 case Symbol::Kind::Indirect: {
0 commit comments