diff --git a/src/ast.rs b/src/ast.rs index fdd5855..88a8aa4 100644 --- a/src/ast.rs +++ b/src/ast.rs @@ -16,6 +16,16 @@ use string::String; use vec::Vec; use boxed::Box; +/// The maximum recursion depth used when parsing. +/// +/// See [`ParseContext`](struct.ParseContext.html). +const MAX_RECURSION_PARSE: u32 = 192; + +/// The maximum recursion depth used when demangling a parsed AST. +/// +/// See [`DemangleContext`](struct.DemangleContext.html). +const MAX_RECURSION_DEMANGLE: u32 = 192; + struct AutoLogParse; #[cfg(feature = "logging")] @@ -177,7 +187,7 @@ pub struct ParseContext { impl Default for ParseContext { fn default() -> ParseContext { ParseContext { - max_recursion: 64, + max_recursion: MAX_RECURSION_PARSE, state: Cell::new(ParseContextState::default()), } } @@ -583,7 +593,7 @@ where ) -> DemangleContext<'a, W> { DemangleContext { subs: subs, - max_recursion: 128, + max_recursion: MAX_RECURSION_DEMANGLE, inner: vec![], input: input, source_name: None, diff --git a/tests/tests.rs b/tests/tests.rs index df7f2c9..5e52464 100755 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -564,3 +564,23 @@ demangles!( ___ZN19URLConnectionClient33_clientInterface_cancelConnectionEP16dispatch_queue_sU13block_pointerFvvE_block_invoke14, "invocation function for block in URLConnectionClient::_clientInterface_cancelConnection(dispatch_queue_s*, void () block_pointer)" ); + +demangles!( + _ZNK8xxxxxxxx14xxxxxxxxxxxxxxINS_14xxxxxxxxxxxxxxINS1_INS1_INS1_INS1_INS1_INS_10xxxxxxxxxxE32xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxEES3_EE22xxxxxxxxxxxxxxxxxxxxxxEES6_EE13xxxxxxxxxxxxxEE17xxxxxxxxxxxxxxxxxEE14xxxxxxxxxxxxxxE8xxxxxxxxE7xxxxxxxRKN4xxxx5xxxxxEb, + "xxxxxxxx::xxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>, xxxxxxxxxxxxxxxxxxxxxx>, xxxxxxxxxxxxxxxxxxxxxx>, xxxxxxxxxxxxx>, xxxxxxxxxxxxxxxxx>, xxxxxxxxxxxxxx>::xxxxxxxx(xxxxxxx, xxxx::xxxxx const&, bool) const" +); + +demangles!( + _ZN5boost7variantIiJljdbNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_17basic_string_viewIcS4_EElmxyNS_10filesystem4pathEEEC2IS6_EEOT_PNS_9enable_ifINS_3mpl3or_INSG_4and_INS_19is_rvalue_referenceISE_EENSG_4not_INS_8is_constISD_EEEENSL_INS_7is_sameISD_SB_EEEENS_6detail7variant29is_variant_constructible_fromISE_NSG_6l_itemIN4mpl_5long_ILl12EEEiNSV_INSX_ILl11EEElNSV_INSX_ILl10EEEjNSV_INSX_ILl9EEEdNSV_INSX_ILl8EEEbNSV_INSX_ILl7EEES6_NSV_INSX_ILl6EEES8_NSV_INSX_ILl5EEElNSV_INSX_ILl4EEEmNSV_INSX_ILl3EEExNSV_INSX_ILl2EEEyNSV_INSX_ILl1EEESA_NSG_5l_endEEEEEEEEEEEEEEEEEEEEEEEEEEENSW_5bool_ILb1EEEEENSP_ISD_NS_18recursive_variant_EEENS1O_ILb0EEES1T_S1T_EEvE4typeE, + "boost::variant, std::allocator >, boost::basic_string_view >, long, unsigned long, long long, unsigned long long, boost::filesystem::path>::variant, std::allocator > >(boost::enable_if, std::allocator >&&>, boost::mpl::not_, std::allocator > > >, boost::mpl::not_, std::allocator >, boost::variant, std::allocator >, boost::basic_string_view >, long, unsigned long, long long, unsigned long long, boost::filesystem::path> > >, boost::detail::variant::is_variant_constructible_from, std::allocator >&&, boost::mpl::l_item, int, boost::mpl::l_item, long, boost::mpl::l_item, unsigned int, boost::mpl::l_item, double, boost::mpl::l_item, bool, boost::mpl::l_item, std::__cxx11::basic_string, std::allocator >, boost::mpl::l_item, boost::basic_string_view >, boost::mpl::l_item, long, boost::mpl::l_item, unsigned long, boost::mpl::l_item, long long, boost::mpl::l_item, unsigned long long, boost::mpl::l_item, boost::filesystem::path, boost::mpl::l_end> > > > > > > > > > > > >, mpl_::bool_ >, boost::is_same, std::allocator >, boost::recursive_variant_>, mpl_::bool_, mpl_::bool_, mpl_::bool_ >, void>::type*)" +); + +demangles!( + _ZN5boost6detail7variant21make_initializer_node5applyINS_3mpl4pairINS3_INS5_INS3_INS5_INS3_INS5_INS3_INS5_INS3_INS5_INS1_16initializer_rootEN4mpl_4int_ILi0EEEEENS4_6l_iterINS4_6list12IixjdbNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_17basic_string_viewIcSG_EElmxyNS_10filesystem4pathEEEEEE16initializer_nodeENS8_ILi1EEEEENSB_INS4_6list11IxjdbSI_SK_lmxySM_EEEEE16initializer_nodeENS8_ILi2EEEEENSB_INS4_6list10IjdbSI_SK_lmxySM_EEEEE16initializer_nodeENS8_ILi3EEEEENSB_INS4_5list9IdbSI_SK_lmxySM_EEEEE16initializer_nodeENS8_ILi4EEEEENSB_INS4_5list8IbSI_SK_lmxySM_EEEEE16initializer_nodeENS8_ILi5EEEEENSB_INS4_5list7ISI_SK_lmxySM_EEEEE16initializer_node10initializeEPvRKSI_, + "boost::detail::variant::make_initializer_node::apply >, boost::mpl::l_iter, std::allocator >, boost::basic_string_view >, long, unsigned long, long long, unsigned long long, boost::filesystem::path> > >::initializer_node, mpl_::int_<1> >, boost::mpl::l_iter, std::allocator >, boost::basic_string_view >, long, unsigned long, long long, unsigned long long, boost::filesystem::path> > >::initializer_node, mpl_::int_<2> >, boost::mpl::l_iter, std::allocator >, boost::basic_string_view >, long, unsigned long, long long, unsigned long long, boost::filesystem::path> > >::initializer_node, mpl_::int_<3> >, boost::mpl::l_iter, std::allocator >, boost::basic_string_view >, long, unsigned long, long long, unsigned long long, boost::filesystem::path> > >::initializer_node, mpl_::int_<4> >, boost::mpl::l_iter, std::allocator >, boost::basic_string_view >, long, unsigned long, long long, unsigned long long, boost::filesystem::path> > >::initializer_node, mpl_::int_<5> >, boost::mpl::l_iter, std::allocator >, boost::basic_string_view >, long, unsigned long, long long, unsigned long long, boost::filesystem::path> > >::initializer_node::initialize(void*, std::__cxx11::basic_string, std::allocator > const&)" +); + +demangles!( + _ZN5boost6detail7variant15visitation_implIN4mpl_4int_ILi0EEENS1_20visitation_impl_stepINS_3mpl6l_iterINS7_6l_itemINS3_5long_ILl12EEEiNS9_INSA_ILl11EEExNS9_INSA_ILl10EEEjNS9_INSA_ILl9EEEdNS9_INSA_ILl8EEEbNS9_INSA_ILl7EEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS9_INSA_ILl6EEENS_17basic_string_viewIcSK_EENS9_INSA_ILl5EEElNS9_INSA_ILl4EEEmNS9_INSA_ILl3EEExNS9_INSA_ILl2EEEyNS9_INSA_ILl1EEENS_10filesystem4pathENS7_5l_endEEEEEEEEEEEEEEEEEEEEEEEEEEENS8_ISX_EEEENS_7variantIiJxjdbSM_SP_lmxySW_EE8assignerEPKvNS1E_18has_fallback_type_EEENT1_11result_typeEiiRS1J_T2_NS3_5bool_ILb0EEET3_PT_PT0_, + "boost::variant, std::allocator >, boost::basic_string_view >, long, unsigned long, long long, unsigned long long, boost::filesystem::path>::assigner::result_type boost::detail::variant::visitation_impl, boost::detail::variant::visitation_impl_step, int, boost::mpl::l_item, long long, boost::mpl::l_item, unsigned int, boost::mpl::l_item, double, boost::mpl::l_item, bool, boost::mpl::l_item, std::__cxx11::basic_string, std::allocator >, boost::mpl::l_item, boost::basic_string_view >, boost::mpl::l_item, long, boost::mpl::l_item, unsigned long, boost::mpl::l_item, long long, boost::mpl::l_item, unsigned long long, boost::mpl::l_item, boost::filesystem::path, boost::mpl::l_end> > > > > > > > > > > > >, boost::mpl::l_iter >, boost::variant, std::allocator >, boost::basic_string_view >, long, unsigned long, long long, unsigned long long, boost::filesystem::path>::assigner, void const*, boost::variant, std::allocator >, boost::basic_string_view >, long, unsigned long, long long, unsigned long long, boost::filesystem::path>::has_fallback_type_>(int, int, boost::variant, std::allocator >, boost::basic_string_view >, long, unsigned long, long long, unsigned long long, boost::filesystem::path>::assigner&, void const*, mpl_::bool_, boost::variant, std::allocator >, boost::basic_string_view >, long, unsigned long, long long, unsigned long long, boost::filesystem::path>::has_fallback_type_, mpl_::int_<0>*, boost::detail::variant::visitation_impl_step, int, boost::mpl::l_item, long long, boost::mpl::l_item, unsigned int, boost::mpl::l_item, double, boost::mpl::l_item, bool, boost::mpl::l_item, std::__cxx11::basic_string, std::allocator >, boost::mpl::l_item, boost::basic_string_view >, boost::mpl::l_item, long, boost::mpl::l_item, unsigned long, boost::mpl::l_item, long long, boost::mpl::l_item, unsigned long long, boost::mpl::l_item, boost::filesystem::path, boost::mpl::l_end> > > > > > > > > > > > >, boost::mpl::l_iter >*)" +);