3rdparty
lexy
include
lexy
dsl
sign.hpp
Go to the documentation of this file.
1
// Copyright (C) 2020-2024 Jonathan Müller and lexy contributors
2
// SPDX-License-Identifier: BSL-1.0
3
4
#ifndef LEXY_DSL_SIGN_HPP_INCLUDED
5
#define LEXY_DSL_SIGN_HPP_INCLUDED
6
7
#include <
lexy/dsl/base.hpp
>
8
#include <
lexy/dsl/choice.hpp
>
9
#include <
lexy/dsl/if.hpp
>
10
#include <
lexy/dsl/literal.hpp
>
11
#include <
lexy/dsl/operator.hpp
>
12
13
namespace
lexy
14
{
15
template
<
int
I>
16
struct
_sign
17
{
18
constexpr
operator
int()
const
19
{
20
return
I;
21
}
22
};
23
24
struct
plus_sign
:
_sign
<+1>
25
{};
26
struct
minus_sign
:
_sign
<-1>
27
{};
28
}
// namespace lexy
29
30
namespace
lexyd
31
{
32
struct
_plus
: decltype(op<lexy::plus_sign>(LEXY_LIT("+")))
33
{};
34
struct
_minus
: decltype(op<lexy::minus_sign>(LEXY_LIT("-")))
35
{};
36
38
constexpr
auto
plus_sign
=
if_
(
_plus
{});
40
constexpr
auto
minus_sign
=
if_
(
_minus
{});
41
43
constexpr
auto
sign
=
if_
(
_plus
{} | _minus{});
44
}
// namespace lexyd
45
46
#endif // LEXY_DSL_SIGN_HPP_INCLUDED
47
choice.hpp
if.hpp
literal.hpp
lexyd::minus_sign
constexpr auto minus_sign
Matches a minus sign or nothing, producing +1 or -1.
Definition:
sign.hpp:40
lexyd::_minus
Definition:
sign.hpp:34
lexyd::_plus
Definition:
sign.hpp:32
lexy::plus_sign
Definition:
sign.hpp:24
lexy
Definition:
any_ref.hpp:12
lexyd::plus_sign
constexpr auto plus_sign
Matches a plus sign or nothing, producing +1.
Definition:
sign.hpp:38
operator.hpp
base.hpp
lexy::_sign
Definition:
sign.hpp:16
lexyd::if_
constexpr auto if_(Branch)
If the branch condition matches, matches the branch then.
Definition:
if.hpp:37
lexyd
Definition:
trace.hpp:22
lexyd::sign
constexpr auto sign
Matches a plus or minus sign or nothing, producing +1 or -1.
Definition:
sign.hpp:43
lexy::minus_sign
Definition:
sign.hpp:26
behaviortree_cpp_v4
Author(s): Davide Faconti
autogenerated on Fri Dec 13 2024 03:19:17