3rdparty/lexy/include/lexy/dsl/any.hpp
Go to the documentation of this file.
1 // Copyright (C) 2020-2023 Jonathan Müller and lexy contributors
2 // SPDX-License-Identifier: BSL-1.0
3 
4 #ifndef LEXY_DSL_ANY_HPP_INCLUDED
5 #define LEXY_DSL_ANY_HPP_INCLUDED
6 
7 #include <lexy/_detail/swar.hpp>
8 #include <lexy/dsl/base.hpp>
9 #include <lexy/dsl/token.hpp>
10 
11 namespace lexyd
12 {
13 struct _any : token_base<_any, unconditional_branch_base>
14 {
15  template <typename Reader>
16  struct tp
17  {
18  typename Reader::iterator end;
19 
20  constexpr explicit tp(const Reader& reader) : end(reader.position()) {}
21 
22  constexpr std::true_type try_parse(Reader reader)
23  {
24  using encoding = typename Reader::encoding;
25  if constexpr (lexy::_detail::is_swar_reader<Reader>)
26  {
28  reader.peek_swar()))
29  reader.bump_swar();
30  }
31 
32  while (reader.peek() != encoding::eof())
33  reader.bump();
34 
35  end = reader.position();
36  return {};
37  }
38  };
39 };
40 
42 constexpr auto any = _any{};
43 } // namespace lexyd
44 
45 namespace lexy
46 {
47 template <>
48 inline constexpr auto token_kind_of<lexy::dsl::_any> = lexy::any_token_kind;
49 }
50 
51 #endif // LEXY_DSL_ANY_HPP_INCLUDED
52 
lexyd::position
constexpr auto position
Produces an iterator to the current reader position without parsing anything.
Definition: position.hpp:79
lexy::any_token_kind
@ any_token_kind
Definition: grammar.hpp:79
token.hpp
lexyd::_any
Definition: 3rdparty/lexy/include/lexy/dsl/any.hpp:13
magic_enum::char_type
string_view::value_type char_type
Definition: magic_enum.hpp:145
lexyd::_any::tp::try_parse
constexpr std::true_type try_parse(Reader reader)
Definition: 3rdparty/lexy/include/lexy/dsl/any.hpp:22
lexy
Definition: any_ref.hpp:12
lexy::_detail::swar_has_char
constexpr bool swar_has_char(swar_int v)
Definition: swar.hpp:177
swar.hpp
lexyd::token_base
Definition: dsl/token.hpp:42
lexyd::_any::tp::end
Reader::iterator end
Definition: 3rdparty/lexy/include/lexy/dsl/any.hpp:18
base.hpp
lexyd::_any::tp
Definition: 3rdparty/lexy/include/lexy/dsl/any.hpp:16
lexyd
Definition: trace.hpp:22
lexyd::any
constexpr auto any
Matches anything and consumes all remaining characters.
Definition: 3rdparty/lexy/include/lexy/dsl/any.hpp:42
lexyd::_any::tp::tp
constexpr tp(const Reader &reader)
Definition: 3rdparty/lexy/include/lexy/dsl/any.hpp:20
lexyd::eof
constexpr auto eof
Matches EOF.
Definition: eof.hpp:72


behaviortree_cpp_v4
Author(s): Davide Faconti
autogenerated on Fri Jun 28 2024 02:20:07