digit.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_DIGIT_HPP_INCLUDED
5 #define LEXY_DSL_DIGIT_HPP_INCLUDED
6 
7 #include <lexy/_detail/swar.hpp>
8 #include <lexy/dsl/base.hpp>
10 #include <lexy/dsl/literal.hpp>
11 #include <lexy/dsl/token.hpp>
12 
13 //=== bases ===//
14 // SWAR matching code adapted from:
15 // https://lemire.me/blog/2018/09/30/quickly-identifying-a-sequence-of-digits-in-a-string-of-characters/
16 namespace lexyd
17 {
18 template <int Radix>
19 struct _d;
20 
21 template <>
22 struct _d<2> : char_class_base<_d<2>>
23 {
25  {
26  return "digit.binary";
27  }
28 
30  {
32  result.insert('0', '1');
33  return result;
34  }
35 
36  static constexpr unsigned digit_radix = 2;
37 
38  template <typename CharT>
39  static constexpr unsigned digit_value(CharT c)
40  {
41  return static_cast<unsigned>(c) - '0';
42  }
43 
44  template <typename CharT>
45  static constexpr bool swar_matches(lexy::_detail::swar_int c)
46  {
47  constexpr auto mask = lexy::_detail::swar_fill_compl(CharT(0xF));
48  constexpr auto expected = lexy::_detail::swar_fill(CharT(0x30));
49  constexpr auto offset = lexy::_detail::swar_fill(CharT(0x0E));
50 
51  return (c & mask) == expected && ((c + offset) & mask) == expected;
52  }
53 };
54 using binary = _d<2>;
55 
56 template <>
57 struct _d<8> : char_class_base<_d<8>>
58 {
60  {
61  return "digit.octal";
62  }
63 
65  {
67  result.insert('0', '7');
68  return result;
69  }
70 
71  static constexpr unsigned digit_radix = 8;
72 
73  template <typename CharT>
74  static constexpr unsigned digit_value(CharT c)
75  {
76  return static_cast<unsigned>(c) - '0';
77  }
78 
79  template <typename CharT>
80  static constexpr bool swar_matches(lexy::_detail::swar_int c)
81  {
82  constexpr auto mask = lexy::_detail::swar_fill_compl(CharT(0xF));
83  constexpr auto expected = lexy::_detail::swar_fill(CharT(0x30));
84  constexpr auto offset = lexy::_detail::swar_fill(CharT(0x08));
85 
86  return (c & mask) == expected && ((c + offset) & mask) == expected;
87  }
88 };
89 using octal = _d<8>;
90 
91 template <>
92 struct _d<10> : char_class_base<_d<10>>
93 {
95  {
96  return "digit.decimal";
97  }
98 
100  {
102  result.insert('0', '9');
103  return result;
104  }
105 
106  static constexpr unsigned digit_radix = 10;
107 
108  template <typename CharT>
109  static constexpr unsigned digit_value(CharT c)
110  {
111  return static_cast<unsigned>(c) - '0';
112  }
113 
114  template <typename CharT>
115  static constexpr bool swar_matches(lexy::_detail::swar_int c)
116  {
117  constexpr auto mask = lexy::_detail::swar_fill_compl(CharT(0xF));
118  constexpr auto expected = lexy::_detail::swar_fill(CharT(0x30));
119  constexpr auto offset = lexy::_detail::swar_fill(CharT(0x06));
120 
121  return (c & mask) == expected && ((c + offset) & mask) == expected;
122  }
123 };
124 using decimal = _d<10>;
125 
126 struct hex_lower : char_class_base<hex_lower>
127 {
129  {
130  return "digit.hex-lower";
131  }
132 
134  {
136  result.insert('0', '9');
137  result.insert('a', 'f');
138  return result;
139  }
140 
141  static constexpr unsigned digit_radix = 16;
142 
143  template <typename CharT>
144  static constexpr unsigned digit_value(CharT c)
145  {
146  if (c >= 'a')
147  return static_cast<unsigned>(c) - 'a' + 10;
148  else if (c <= '9')
149  return static_cast<unsigned>(c) - '0';
150  else
151  return unsigned(-1);
152  }
153 
154  template <typename CharT>
155  static constexpr bool swar_matches(lexy::_detail::swar_int c)
156  {
157  // False negative for hex digits, but that's okay.
158  return _d<10>::swar_matches<CharT>(c);
159  }
160 };
161 
162 struct hex_upper : char_class_base<hex_upper>
163 {
165  {
166  return "digit.hex-upper";
167  }
168 
170  {
172  result.insert('0', '9');
173  result.insert('A', 'F');
174  return result;
175  }
176 
177  static constexpr unsigned digit_radix = 16;
178 
179  template <typename CharT>
180  static constexpr unsigned digit_value(CharT c)
181  {
182  if (c >= 'A')
183  return static_cast<unsigned>(c) - 'A' + 10;
184  else if (c <= '9')
185  return static_cast<unsigned>(c) - '0';
186  else
187  return unsigned(-1);
188  }
189 
190  template <typename CharT>
191  static constexpr bool swar_matches(lexy::_detail::swar_int c)
192  {
193  // False negative for hex digits, but that's okay.
194  return _d<10>::swar_matches<CharT>(c);
195  }
196 };
197 
198 template <>
199 struct _d<16> : char_class_base<_d<16>>
200 {
202  {
203  return "digit.hex";
204  }
205 
207  {
209  result.insert('0', '9');
210  result.insert('a', 'f');
211  result.insert('A', 'F');
212  return result;
213  }
214 
215  static constexpr unsigned digit_radix = 16;
216 
217  template <typename CharT>
218  static constexpr unsigned digit_value(CharT c)
219  {
220  if (c >= 'a')
221  return static_cast<unsigned>(c) - 'a' + 10;
222  else if (c >= 'A')
223  return static_cast<unsigned>(c) - 'A' + 10;
224  else if (c <= '9')
225  return static_cast<unsigned>(c) - '0';
226  else
227  return unsigned(-1);
228  }
229 
230  template <typename CharT>
231  static constexpr bool swar_matches(lexy::_detail::swar_int c)
232  {
233  // False negative for hex digits, but that's okay.
234  return _d<10>::swar_matches<CharT>(c);
235  }
236 };
237 using hex = _d<16>;
238 } // namespace lexyd
239 
240 //=== digit ===//
241 namespace lexyd
242 {
243 struct _zero : char_class_base<_zero>
244 {
246  {
247  return "digit.zero";
248  }
249 
251  {
253  result.insert('0');
254  return result;
255  }
256 };
257 
259 constexpr auto zero = _zero{};
260 
262 template <typename Base = decimal, int = Base::digit_radix>
263 constexpr auto digit = Base{};
264 } // namespace lexyd
265 
266 namespace lexy
267 {
268 template <>
269 inline constexpr auto token_kind_of<lexy::dsl::_zero> = lexy::digits_token_kind;
270 
271 template <int Radix>
272 constexpr auto token_kind_of<lexy::dsl::_d<Radix>> = lexy::digits_token_kind;
273 template <>
274 inline constexpr auto token_kind_of<lexy::dsl::hex_lower> = lexy::digits_token_kind;
275 template <>
276 inline constexpr auto token_kind_of<lexy::dsl::hex_upper> = lexy::digits_token_kind;
277 } // namespace lexy
278 
279 //=== digits ===//
280 namespace lexy
281 {
283 {
284  static LEXY_CONSTEVAL auto name()
285  {
286  return "forbidden leading zero";
287  }
288 };
289 } // namespace lexy
290 
291 namespace lexyd
292 {
293 template <typename Base, typename Reader>
294 constexpr bool _match_digits(Reader& reader)
295 {
296  // Need at least one digit.
297  // Checking for a single digit is also cheaper than doing a SWAR comparison,
298  // so we do that manually in either case.
299  if (!lexy::try_match_token(digit<Base>, reader))
300  return false;
301 
302  // Now we consume as many digits as possible.
303  // First using SWAR...
304  if constexpr (lexy::_detail::is_swar_reader<Reader>)
305  {
306  using char_type = typename Reader::encoding::char_type;
307  while (Base::template swar_matches<char_type>(reader.peek_swar()))
308  reader.bump_swar();
309  }
310 
311  // ... then manually to get any trailing digits.
312  while (lexy::try_match_token(digit<Base>, reader))
313  {
314  }
315 
316  return true;
317 }
318 template <typename Base, typename Sep, typename Reader>
319 constexpr bool _match_digits_sep(Reader& reader)
320 {
321  // Need at least one digit.
322  if (!lexy::try_match_token(digit<Base>, reader))
323  return false;
324 
325  // Might have following digits.
326  while (true)
327  {
328  if (lexy::try_match_token(Sep{}, reader))
329  {
330  // Need a digit after a separator.
331  if (!lexy::try_match_token(digit<Base>, reader))
332  return false;
333  }
334  else
335  {
336  // Attempt to consume as many digits as possible.
337  if constexpr (lexy::_detail::is_swar_reader<Reader>)
338  {
339  using char_type = typename Reader::encoding::char_type;
340  while (Base::template swar_matches<char_type>(reader.peek_swar()))
341  reader.bump_swar();
342  }
343 
344  if (!lexy::try_match_token(digit<Base>, reader))
345  // If we're not having a digit, we're done.
346  break;
347  }
348  }
349 
350  return true;
351 }
352 
353 template <typename Base, typename Sep>
354 struct _digits_st : token_base<_digits_st<Base, Sep>>
355 {
356  template <typename Reader>
357  struct tp
358  {
359  typename Reader::marker end;
361 
362  constexpr explicit tp(const Reader& reader)
363  : end(reader.current()), forbidden_leading_zero(false)
364  {}
365 
366  constexpr bool try_parse(Reader reader)
367  {
368  using char_type = typename Reader::encoding::char_type;
369  auto begin = reader.current();
370  auto result = _match_digits_sep<Base, Sep>(reader);
371  end = reader.current();
372 
373  if (result && lexy::_detail::next(begin.position()) != end.position()
374  && *begin.position() == lexy::_detail::transcode_char<char_type>('0'))
375  {
376  reader.reset(begin);
377  reader.bump();
378  end = reader.current();
379 
380  forbidden_leading_zero = true;
381  return false;
382  }
383 
384  return result;
385  }
386 
387  template <typename Context>
388  constexpr void report_error(Context& context, const Reader& reader)
389  {
391  {
392  auto err = lexy::error<Reader, lexy::forbidden_leading_zero>(reader.position(),
393  end.position());
394  context.on(_ev::error{}, err);
395  }
396  else
397  {
399  Base::char_class_name());
400  context.on(_ev::error{}, err);
401  }
402  }
403  };
404 };
405 
406 template <typename Base, typename Sep>
407 struct _digits_s : token_base<_digits_s<Base, Sep>>
408 {
409  template <typename Reader>
410  struct tp
411  {
412  typename Reader::marker end;
413 
414  constexpr explicit tp(const Reader& reader) : end(reader.current()) {}
415 
416  constexpr bool try_parse(Reader reader)
417  {
418  auto result = _match_digits_sep<Base, Sep>(reader);
419  end = reader.current();
420  return result;
421  }
422 
423  template <typename Context>
424  constexpr void report_error(Context& context, const Reader&)
425  {
427  Base::char_class_name());
428  context.on(_ev::error{}, err);
429  }
430  };
431 
432  constexpr auto no_leading_zero() const
433  {
434  return _digits_st<Base, Sep>{};
435  }
436 };
437 
438 template <typename Base>
439 struct _digits_t : token_base<_digits_t<Base>>
440 {
441  template <typename Reader>
442  struct tp
443  {
444  typename Reader::marker end;
446 
447  constexpr explicit tp(const Reader& reader)
448  : end(reader.current()), forbidden_leading_zero(false)
449  {}
450 
451  constexpr bool try_parse(Reader reader)
452  {
453  using char_type = typename Reader::encoding::char_type;
454  auto begin = reader.current();
455  auto result = _match_digits<Base>(reader);
456  end = reader.current();
457 
458  if (result && lexy::_detail::next(begin.position()) != end.position()
459  && *begin.position() == lexy::_detail::transcode_char<char_type>('0'))
460  {
461  reader.reset(begin);
462  reader.bump();
463  end = reader.current();
464 
465  forbidden_leading_zero = true;
466  return false;
467  }
468 
469  return result;
470  }
471 
472  template <typename Context>
473  constexpr void report_error(Context& context, const Reader& reader)
474  {
476  {
477  auto err = lexy::error<Reader, lexy::forbidden_leading_zero>(reader.position(),
478  end.position());
479  context.on(_ev::error{}, err);
480  }
481  else
482  {
483  auto err = lexy::error<Reader, lexy::expected_char_class>(reader.position(),
484  Base::char_class_name());
485  context.on(_ev::error{}, err);
486  }
487  }
488  };
489 
490  template <typename Token>
491  constexpr auto sep(Token) const
492  {
493  static_assert(lexy::is_token_rule<Token>);
494  return _digits_st<Base, Token>{};
495  }
496 };
497 
498 template <typename Base>
499 struct _digits : token_base<_digits<Base>>
500 {
501  template <typename Reader>
502  struct tp
503  {
504  typename Reader::marker end;
505 
506  constexpr explicit tp(const Reader& reader) : end(reader.current()) {}
507 
508  constexpr bool try_parse(Reader reader)
509  {
510  auto result = _match_digits<Base>(reader);
511  end = reader.current();
512  return result;
513  }
514 
515  template <typename Context>
516  constexpr void report_error(Context& context, const Reader& reader)
517  {
518  auto err = lexy::error<Reader, lexy::expected_char_class>(reader.position(),
519  Base::char_class_name());
520  context.on(_ev::error{}, err);
521  }
522  };
523 
524  template <typename Token>
525  constexpr auto sep(Token) const
526  {
527  static_assert(lexy::is_token_rule<Token>);
528  return _digits_s<Base, Token>{};
529  }
530 
531  constexpr auto no_leading_zero() const
532  {
533  return _digits_t<Base>{};
534  }
535 };
536 
538 template <typename Base = decimal>
539 constexpr auto digits = _digits<Base>{};
540 
541 constexpr auto digit_sep_underscore = LEXY_LIT("_");
542 constexpr auto digit_sep_tick = LEXY_LIT("'");
543 } // namespace lexyd
544 
545 namespace lexy
546 {
547 template <typename Base>
548 constexpr auto token_kind_of<lexy::dsl::_digits<Base>> = lexy::digits_token_kind;
549 template <typename Base>
550 constexpr auto token_kind_of<lexy::dsl::_digits_t<Base>> = lexy::digits_token_kind;
551 template <typename Base, typename Sep>
552 constexpr auto token_kind_of<lexy::dsl::_digits_s<Base, Sep>> = lexy::digits_token_kind;
553 template <typename Base, typename Sep>
554 constexpr auto token_kind_of<lexy::dsl::_digits_st<Base, Sep>> = lexy::digits_token_kind;
555 } // namespace lexy
556 
557 //=== n_digits ===//
558 namespace lexyd
559 {
560 template <std::size_t N, typename Base, typename Sep>
561 struct _ndigits_s : token_base<_ndigits_s<N, Base, Sep>>
562 {
563  template <typename Reader, typename Indices = lexy::_detail::make_index_sequence<N - 1>>
564  struct tp;
565  template <typename Reader, std::size_t... Idx>
566  struct tp<Reader, lexy::_detail::index_sequence<Idx...>>
567  {
568  typename Reader::marker end;
569 
570  constexpr explicit tp(const Reader& reader) : end(reader.current()) {}
571 
572  constexpr bool try_parse(Reader reader)
573  {
574  // Match the Base one time.
575  if (!lexy::try_match_token(digit<Base>, reader))
576  {
577  end = reader.current();
578  return false;
579  }
580 
581  // Match each other digit after a separator.
582  auto success = (((void)Idx, lexy::try_match_token(Sep{}, reader),
583  lexy::try_match_token(digit<Base>, reader))
584  && ...);
585  end = reader.current();
586  return success;
587  }
588 
589  template <typename Context>
590  constexpr void report_error(Context& context, const Reader&)
591  {
593  Base::char_class_name());
594  context.on(_ev::error{}, err);
595  }
596  };
597 };
598 
599 template <std::size_t N, typename Base>
600 struct _ndigits : token_base<_ndigits<N, Base>>
601 {
602  static_assert(N > 1);
603 
604  template <typename Reader, typename Indices = lexy::_detail::make_index_sequence<N>>
605  struct tp;
606  template <typename Reader, std::size_t... Idx>
607  struct tp<Reader, lexy::_detail::index_sequence<Idx...>>
608  {
609  typename Reader::marker end;
610 
611  constexpr explicit tp(const Reader& reader) : end(reader.current()) {}
612 
613  constexpr bool try_parse(Reader reader)
614  {
615  // Match the Base N times.
616  auto success = (((void)Idx, lexy::try_match_token(digit<Base>, reader)) && ...);
617  end = reader.current();
618  return success;
619  }
620 
621  template <typename Context>
622  constexpr void report_error(Context& context, const Reader&)
623  {
625  Base::char_class_name());
626  context.on(_ev::error{}, err);
627  }
628  };
629 
630  template <typename Token>
631  constexpr auto sep(Token) const
632  {
633  static_assert(lexy::is_token_rule<Token>);
635  }
636 };
637 
639 template <std::size_t N, typename Base = decimal>
640 constexpr auto n_digits = _ndigits<N, Base>{};
641 } // namespace lexyd
642 
643 namespace lexy
644 {
645 template <std::size_t N, typename Base>
646 constexpr auto token_kind_of<lexy::dsl::_ndigits<N, Base>> = lexy::digits_token_kind;
647 template <std::size_t N, typename Base, typename Sep>
648 constexpr auto token_kind_of<lexy::dsl::_ndigits_s<N, Base, Sep>> = lexy::digits_token_kind;
649 } // namespace lexy
650 
651 #endif // LEXY_DSL_DIGIT_HPP_INCLUDED
652 
lexyd::_d< 16 >::digit_value
static constexpr unsigned digit_value(CharT c)
Definition: digit.hpp:218
lexyd::_digits_st::tp::end
Reader::marker end
Definition: digit.hpp:359
lexyd::_digits_st::tp::try_parse
constexpr bool try_parse(Reader reader)
Definition: digit.hpp:366
lexyd::hex_upper::swar_matches
static constexpr bool swar_matches(lexy::_detail::swar_int c)
Definition: digit.hpp:191
LEXY_CONSTEVAL
#define LEXY_CONSTEVAL
Definition: config.hpp:98
lexy::_detail::index_sequence
integer_sequence< std::size_t, Indices... > index_sequence
Definition: integer_sequence.hpp:17
lexyd::_digits_st
Definition: digit.hpp:354
lexyd::_d< 10 >::digit_value
static constexpr unsigned digit_value(CharT c)
Definition: digit.hpp:109
token.hpp
lexyd::_digits::tp::tp
constexpr tp(const Reader &reader)
Definition: digit.hpp:506
literal.hpp
LEXY_LIT
#define LEXY_LIT(Str)
Definition: literal.hpp:392
magic_enum::char_type
string_view::value_type char_type
Definition: magic_enum.hpp:145
lexyd::_digits_st::tp::tp
constexpr tp(const Reader &reader)
Definition: digit.hpp:362
lexyd::_d< 10 >::char_class_ascii
static LEXY_CONSTEVAL auto char_class_ascii()
Definition: digit.hpp:99
lexyd::hex_upper::digit_value
static constexpr unsigned digit_value(CharT c)
Definition: digit.hpp:180
lexyd::n_digits
constexpr auto n_digits
Matches exactly N digits.
Definition: digit.hpp:640
lexyd::_d< 2 >::digit_value
static constexpr unsigned digit_value(CharT c)
Definition: digit.hpp:39
lexyd::_digits_st::tp
Definition: digit.hpp:357
lexy::_detail::swar_int
std::uintmax_t swar_int
Definition: swar.hpp:20
lexyd::_digits_s::no_leading_zero
constexpr auto no_leading_zero() const
Definition: digit.hpp:432
lexyd::_zero::char_class_ascii
static LEXY_CONSTEVAL auto char_class_ascii()
Definition: digit.hpp:250
lexyd::_digits_s::tp::try_parse
constexpr bool try_parse(Reader reader)
Definition: digit.hpp:416
lexy::_detail::next
constexpr Iterator next(Iterator iter)
Definition: iterator.hpp:38
lexyd::_ndigits::tp< Reader, lexy::_detail::index_sequence< Idx... > >::report_error
constexpr void report_error(Context &context, const Reader &)
Definition: digit.hpp:622
lexyd::_digits_t::tp::try_parse
constexpr bool try_parse(Reader reader)
Definition: digit.hpp:451
lexyd::_d< 16 >
Definition: digit.hpp:199
lexyd::_d< 2 >::char_class_name
static LEXY_CONSTEVAL auto char_class_name()
Definition: digit.hpp:24
lexyd::_d< 16 >::char_class_name
static LEXY_CONSTEVAL auto char_class_name()
Definition: digit.hpp:201
lexyd::hex_upper
Definition: digit.hpp:162
lexyd::_d< 8 >::char_class_name
static LEXY_CONSTEVAL auto char_class_name()
Definition: digit.hpp:59
lexy::_detail::ascii_set::insert
constexpr void insert(int c)
Definition: char_class.hpp:54
lexyd::_digits_s
Definition: digit.hpp:407
lexyd::_digits::tp::try_parse
constexpr bool try_parse(Reader reader)
Definition: digit.hpp:508
lexy
Definition: any_ref.hpp:12
lexyd::_digits::tp
Definition: digit.hpp:502
lexyd::_zero::char_class_name
static LEXY_CONSTEVAL auto char_class_name()
Definition: digit.hpp:245
lexyd::hex_upper::char_class_ascii
static LEXY_CONSTEVAL auto char_class_ascii()
Definition: digit.hpp:169
lexyd::_digits_t::tp
Definition: digit.hpp:442
lexy::forbidden_leading_zero::name
static LEXY_CONSTEVAL auto name()
Definition: digit.hpp:284
lexy::_detail::make_index_sequence
typename _make_index_sequence< Size >::type make_index_sequence
Definition: integer_sequence.hpp:55
lexy::forbidden_leading_zero
Definition: digit.hpp:282
cx::end
constexpr auto end(const C &c) -> decltype(c.end())
Definition: wildcards.hpp:686
char_class.hpp
detail::void
j template void())
Definition: json.hpp:4893
lexy::error
Generic failure.
Definition: error.hpp:14
lexyd::_ndigits_s::tp< Reader, lexy::_detail::index_sequence< Idx... > >::report_error
constexpr void report_error(Context &context, const Reader &)
Definition: digit.hpp:590
lexyd::_d< 10 >::char_class_name
static LEXY_CONSTEVAL auto char_class_name()
Definition: digit.hpp:94
swar.hpp
lexyd::_digits_t::tp::tp
constexpr tp(const Reader &reader)
Definition: digit.hpp:447
lexyd::_ndigits
Definition: digit.hpp:600
lexyd::_digits_t::tp::forbidden_leading_zero
bool forbidden_leading_zero
Definition: digit.hpp:445
lexyd::_d< 2 >
Definition: digit.hpp:22
lexy::parse_events::error
Definition: dsl/base.hpp:68
lexy::try_match_token
constexpr LEXY_FORCE_INLINE auto try_match_token(TokenRule, Reader &reader)
Definition: dsl/base.hpp:245
lexyd::token_base
Definition: dsl/token.hpp:42
lexyd::digit_sep_underscore
constexpr auto digit_sep_underscore
Definition: digit.hpp:541
lexyd::_ndigits_s::tp
Definition: digit.hpp:564
lexyd::_digits_t
Definition: digit.hpp:439
lexyd::_ndigits_s::tp< Reader, lexy::_detail::index_sequence< Idx... > >::tp
constexpr tp(const Reader &reader)
Definition: digit.hpp:570
lexyd::hex_lower::swar_matches
static constexpr bool swar_matches(lexy::_detail::swar_int c)
Definition: digit.hpp:155
lexyd::_d< 8 >::swar_matches
static constexpr bool swar_matches(lexy::_detail::swar_int c)
Definition: digit.hpp:80
lexyd::_digits_t::tp::report_error
constexpr void report_error(Context &context, const Reader &reader)
Definition: digit.hpp:473
lexyd::_digits_s::tp::report_error
constexpr void report_error(Context &context, const Reader &)
Definition: digit.hpp:424
lexyd::_ndigits_s::tp< Reader, lexy::_detail::index_sequence< Idx... > >::try_parse
constexpr bool try_parse(Reader reader)
Definition: digit.hpp:572
lexy::digits_token_kind
@ digits_token_kind
Definition: grammar.hpp:95
lexyd::_d< 2 >::char_class_ascii
static LEXY_CONSTEVAL auto char_class_ascii()
Definition: digit.hpp:29
lexyd::_d
Definition: digit.hpp:19
lexyd::_digits_s::tp::end
Reader::marker end
Definition: digit.hpp:412
lexyd::digits
constexpr auto digits
Matches a non-empty list of digits.
Definition: digit.hpp:539
lexyd::_ndigits_s
Definition: digit.hpp:561
lexyd::_digits_s::tp::tp
constexpr tp(const Reader &reader)
Definition: digit.hpp:414
lexyd::_zero
Definition: digit.hpp:243
lexyd::_match_digits_sep
constexpr bool _match_digits_sep(Reader &reader)
Definition: digit.hpp:319
lexyd::_digits_st::tp::report_error
constexpr void report_error(Context &context, const Reader &reader)
Definition: digit.hpp:388
lexyd::char_class_base
Definition: char_class.hpp:170
lexyd::hex_upper::char_class_name
static LEXY_CONSTEVAL auto char_class_name()
Definition: digit.hpp:164
lexyd::_d< 2 >::swar_matches
static constexpr bool swar_matches(lexy::_detail::swar_int c)
Definition: digit.hpp:45
cx::begin
constexpr auto begin(const C &c) -> decltype(c.begin())
Definition: wildcards.hpp:661
lexyd::_digits_st::tp::forbidden_leading_zero
bool forbidden_leading_zero
Definition: digit.hpp:360
lexyd::digit
constexpr auto digit
Matches a single digit.
Definition: digit.hpp:263
lexyd::digit_sep_tick
constexpr auto digit_sep_tick
Definition: digit.hpp:542
lexyd::_d< 16 >::char_class_ascii
static LEXY_CONSTEVAL auto char_class_ascii()
Definition: digit.hpp:206
lexyd::_digits_s::tp
Definition: digit.hpp:410
lexyd::hex_lower::char_class_name
static LEXY_CONSTEVAL auto char_class_name()
Definition: digit.hpp:128
lexyd::_ndigits::tp
Definition: digit.hpp:605
base.hpp
lexyd::_ndigits::tp< Reader, lexy::_detail::index_sequence< Idx... > >::tp
constexpr tp(const Reader &reader)
Definition: digit.hpp:611
lexyd::_match_digits
constexpr bool _match_digits(Reader &reader)
Definition: digit.hpp:294
lexyd::_digits::sep
constexpr auto sep(Token) const
Definition: digit.hpp:525
lexyd::_digits_t::sep
constexpr auto sep(Token) const
Definition: digit.hpp:491
lexyd::_d< 8 >::char_class_ascii
static LEXY_CONSTEVAL auto char_class_ascii()
Definition: digit.hpp:64
lexyd::_d< 10 >
Definition: digit.hpp:92
lexyd::_d< 10 >::swar_matches
static constexpr bool swar_matches(lexy::_detail::swar_int c)
Definition: digit.hpp:115
lexyd::hex_lower::digit_radix
static constexpr unsigned digit_radix
Definition: digit.hpp:141
lexyd::hex_lower::char_class_ascii
static LEXY_CONSTEVAL auto char_class_ascii()
Definition: digit.hpp:133
lexyd::_ndigits::sep
constexpr auto sep(Token) const
Definition: digit.hpp:631
lexyd::_digits_t::tp::end
Reader::marker end
Definition: digit.hpp:444
lexyd::_digits
Definition: digit.hpp:499
lexyd::_ndigits_s::tp< Reader, lexy::_detail::index_sequence< Idx... > >::end
Reader::marker end
Definition: digit.hpp:568
lexyd::zero
constexpr auto zero
Matches the zero digit.
Definition: digit.hpp:259
lexyd::hex_lower
Definition: digit.hpp:126
lexyd::_d< 16 >::swar_matches
static constexpr bool swar_matches(lexy::_detail::swar_int c)
Definition: digit.hpp:231
lexyd::hex_lower::digit_value
static constexpr unsigned digit_value(CharT c)
Definition: digit.hpp:144
lexyd::_d< 8 >::digit_value
static constexpr unsigned digit_value(CharT c)
Definition: digit.hpp:74
lexyd
Definition: trace.hpp:22
lexyd::_ndigits::tp< Reader, lexy::_detail::index_sequence< Idx... > >::end
Reader::marker end
Definition: digit.hpp:609
lexyd::_ndigits::tp< Reader, lexy::_detail::index_sequence< Idx... > >::try_parse
constexpr bool try_parse(Reader reader)
Definition: digit.hpp:613
lexy::_detail::swar_fill_compl
constexpr swar_int swar_fill_compl(CharT _c)
Definition: swar.hpp:61
lexyd::hex_upper::digit_radix
static constexpr unsigned digit_radix
Definition: digit.hpp:177
lexyd::_digits::no_leading_zero
constexpr auto no_leading_zero() const
Definition: digit.hpp:531
lexyd::_digits::tp::end
Reader::marker end
Definition: digit.hpp:504
lexyd::_d< 8 >
Definition: digit.hpp:57
lexyd::_digits::tp::report_error
constexpr void report_error(Context &context, const Reader &reader)
Definition: digit.hpp:516
lexy::_detail::ascii_set
Definition: char_class.hpp:14
lexy::_detail::swar_fill
constexpr swar_int swar_fill(CharT _c)
Definition: swar.hpp:46


behaviortree_cpp_v4
Author(s): Davide Faconti
autogenerated on Fri Dec 13 2024 03:19:16