1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2025-08-03 12:49:50 +00:00

fix char literal implementation

This commit is contained in:
bolero-MURAKAMI 2014-10-27 10:16:49 +09:00
parent 773855410b
commit 897d1e25b6
18 changed files with 325 additions and 95 deletions

View file

@ -14,6 +14,7 @@
#include <sprout/iterator/operation.hpp>
#include <sprout/iterator/type_traits/category.hpp>
#include <sprout/utility/pair/pair.hpp>
#include <sprout/detail/char_literal.hpp>
namespace sprout {
namespace weed {
@ -27,7 +28,7 @@ namespace sprout {
{
return found != first ? found
: pivot == 0 ? (
*first == T('-') ? *sprout::prev(first) <= value && *sprout::next(first) >= value
*first == SPROUT_CHAR_LITERAL('-', T) ? *sprout::prev(first) <= value && *sprout::next(first) >= value
: *first == value
) ? first : last
: sprout::weed::detail::find_character_set_impl_ra(
@ -66,7 +67,7 @@ namespace sprout {
typedef sprout::pair<BidirectionalIterator, bool> type;
return current.second || current.first == last ? current
: n == 1 ? (
*current.first == T('-') ? *sprout::prev(current.first) <= value && *sprout::next(current.first) >= value
*current.first == SPROUT_CHAR_LITERAL('-', T) ? *sprout::prev(current.first) <= value && *sprout::next(current.first) >= value
: *current.first == value
) ? type(current.first, true) : type(sprout::next(current.first), false)
: sprout::weed::detail::find_character_set_impl_1(

View file

@ -15,6 +15,7 @@
#include <sprout/weed/unused.hpp>
#include <sprout/weed/parser_result.hpp>
#include <sprout/weed/parser/parser_base.hpp>
#include <sprout/detail/char_literal.hpp>
namespace sprout {
namespace weed {
@ -45,13 +46,13 @@ namespace sprout {
typedef typename attribute<Context, Iterator>::type attribute_type;
typedef typename std::iterator_traits<Iterator>::value_type elem_type;
return first != last
? *first == elem_type('\r')
? *first == SPROUT_CHAR_LITERAL('\r', elem_type)
? sprout::next(first) != last
? *sprout::next(first) == elem_type('\n')
? *sprout::next(first) == SPROUT_CHAR_LITERAL('\n', elem_type)
? result_type(true, sprout::next(sprout::next(first)), attribute_type())
: result_type(true, sprout::next(first), attribute_type())
: result_type(true, sprout::next(first), attribute_type())
: *first == elem_type('\n')
: *first == SPROUT_CHAR_LITERAL('\n', elem_type)
? result_type(true, sprout::next(first), attribute_type())
: result_type(false, first, attribute_type())
: result_type(false, first, attribute_type())

View file

@ -18,6 +18,7 @@
#include <sprout/weed/parser_result.hpp>
#include <sprout/weed/parser/parser_base.hpp>
#include <sprout/weed/detail/ndigits.hpp>
#include <sprout/detail/char_literal.hpp>
namespace sprout {
namespace weed {
@ -203,14 +204,14 @@ namespace sprout {
typedef typename result<Context, Iterator>::type result_type;
typedef typename attribute<Context, Iterator>::type attribute_type;
return first != last
? *first == elem_type('+')
? *first == SPROUT_CHAR_LITERAL('+', elem_type)
? call<Context>(
sprout::next(first),
last,
first,
1
)
: *first == elem_type('-')
: *first == SPROUT_CHAR_LITERAL('-', elem_type)
? call<Context>(
sprout::next(first),
last,