/*============================================================================= Copyright (c) 2011-2014 Bolero MURAKAMI https://github.com/bolero-MURAKAMI/Sprout Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ #ifndef SPROUT_BRAINFUCK_MISA_HPP #define SPROUT_BRAINFUCK_MISA_HPP #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace sprout { namespace brainfuck { namespace misa { // // to_brainfuck // template inline SPROUT_CONSTEXPR sprout::pair::type, bool> to_brainfuck(InputIterator first, InputIterator last, Result const& result) { return sprout::brainfuck::detail::parsed_to_brainfuck( sprout::weed::parse( first, last, *sprout::weed::lim::static_size>( sprout::weed::replace('>') [sprout::weed::lit('>') | "\x81\xA8"/*"→"*/ | "\x81\x60"/*"〜"*/ | "\x81\5B"/*"ー"*/] | sprout::weed::replace('<') [sprout::weed::lit('<') | "\x81\xA9"/*"←"*/ | "\x81\x9A"/*"★"*/ | "\x81\x99"/*"☆"*/] | sprout::weed::replace('+') [sprout::weed::lit('+') | "\x82\xA0"/*"あ"*/ | "\x82\x9F"/*"ぁ"*/ | "\x82\xA8"/*"お"*/ | "\x82\xA7"/*"ぉ"*/] | sprout::weed::replace('-') [sprout::weed::lit('-') | "\x82\xC1"/*"っ"*/ | "\x83\x62"/*"ッ"*/] | sprout::weed::replace('.') [sprout::weed::lit('.') | "\x81\x49"/*"!"*/] | sprout::weed::replace(',') [sprout::weed::lit(',') | "\x81\x48"/*"?"*/] | sprout::weed::replace('[') [sprout::weed::lit('[') | "\x81\x75"/*"「"*/ | "\x81\x77"/*"『"*/] | sprout::weed::replace(']') [sprout::weed::lit(']') | "\x81\x76"/*"」"*/ | "\x81\x78"/*"』"*/] | sprout::weed::replace(' ') [sprout::weed::char_] ) ), result ); } // // exec_range // template inline SPROUT_CONSTEXPR typename sprout::fixed::results::algorithm::type exec_range(BidirectionalRangeSource const& source, Output const& output, InputRangeInput const& input) { typedef typename sprout::container_construct_traits::copied_type copied_type; return sprout::brainfuck::exec_range( sprout::brainfuck::misa::to_brainfuck(sprout::begin(source), sprout::end(source), sprout::pit()).first, output, input ); } template inline SPROUT_CONSTEXPR typename sprout::fixed::results::algorithm::type exec_range(BidirectionalRangeSource const& source, Output const& output) { typedef typename sprout::container_construct_traits::copied_type copied_type; return sprout::brainfuck::exec_range( sprout::brainfuck::misa::to_brainfuck(sprout::begin(source), sprout::end(source), sprout::pit()).first, output ); } template inline SPROUT_CONSTEXPR typename sprout::fixed::results::algorithm< sprout::array::value_type, BufferSize> >::type exec_range(BidirectionalRangeSource const& source) { typedef typename sprout::container_construct_traits::copied_type copied_type; return sprout::brainfuck::exec_range( sprout::brainfuck::misa::to_brainfuck(sprout::begin(source), sprout::end(source), sprout::pit()).first ); } } // namespace misa } // namespace brainfuck } // namespace sprout #endif // #ifndef SPROUT_BRAINFUCK_MISA_HPP