Consider adding omit, prefix and suffix template parameters to all parsers

Open
#160 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
30/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
cpp

Research direction

Start by examining Parser, omit_parser::call(), omit_parser, and expect_parser, along with the if_(cond) expansion described in the issue. Profile the existing call paths and determine whether moving these parameters into every parser provides a measurable improvement without changing parser behavior; the issue does not name specific files or tests.

Written by the indexing model from the issue text.

Description

The new parameters would be something like:

bool Omit, typename Prefix, typename Suffix, ...

It turns out that the omit_parser::call() shows up pretty high in profiling of Parser. If each parser knew if it was wrapped in a notional omit[], omit[] could just take a parser, and return a copy with true for the template parameter Omit. This means that the actual function call to omit_parser::call() (and omit_parser itself) goes away.

No so sure the other two would be as big a win, but a lot of parsers are something like eps(cond) >> p (that's what if_(cond) expands to). If all those instances, and expect_parser itself, were just built in to every parser (with a nope when there's no prefix and/or sufffix condition(s)), that might similarly speed things up. expect_parser would just go away in that case.

Dominant language
C++
Stars
182
Forks
28
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from boostorg/parser

All issues in boostorg/parser

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.