Boost logo

Boost :

From: Christian Mazakas (christian.mazakas_at_[hidden])
Date: 2024-02-23 17:51:16


> This part could just have been: char_('\x21', '\x7e') | char_('\t') |
> char_(' '). You might want to reorder it for the most common stuff to
> come first. Oh, since you put it in an omit below, it's even simpler:
> char_('\x21', '\x7e') | '\y' | ' '.

I just wanted to chime in and say that this feedback actually worked and
the code is a good bit cleaner now!

    // reason-phrase = 1*( HTAB / SP / VCHAR / obs-text )
    // VCHAR = %x21-7E
    auto const on_reason_phrase = [](auto &ctx) {
      auto sv = _attr(ctx);
      response::metadata &md = _globals(ctx).md_;
      md.reason_phrase_begin_ = sv.begin();
      md.reason_phrase_end_ = sv.end();
      md.status_line_end_ = sv.end();
    };

    auto const reason_phrase =
        parser::string_view[+(parser::char_('\x21', '\x7e') | '\t' | ' ')]
                           [on_reason_phrase];

The `string_view[]` directive was very sorely missing from X3 the last time
I used it in any serious capacity. Thanks for the feedback, Zach! This code
actually looks really nice now.

- Christian


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk