Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6952401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:20:41+00:00 2026-05-27T14:20:41+00:00

The standard ascii::space_type skipper does of course not skip my comments. The docs mention

  • 0

The standard ascii::space_type skipper does of course not skip my comments. The docs mention you can make your own skip parser but there is no example of actually how to do it.

I’d just need an example code or anything, I’ve been googling for 2 hours now.

Please don’t point me to the examples, the few links that work are hopelessly outdated, dealing with Spirit 1.6.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T14:20:41+00:00Added an answer on May 27, 2026 at 2:20 pm

    After some experimentation, I have found a way to specify a custom skipper and will outline it here:

    template<typename Iterator>
    struct pl0_skipper : public qi::grammar<Iterator> {
    
        pl0_skipper() : pl0_skipper::base_type(skip, "PL/0") {
            skip = ascii::space | ('{' >> *(qi::char_ - '}') >> '}');
        }
        qi::rule<Iterator> skip;
    };
    
    template<typename Iterator, typename Skipper = pl0_skipper<Iterator>>
    struct pl0_grammar : public qi::grammar<Iterator, Skipper> {
    
        /* The rules use our skipper */
        qi::rule<Iterator, Skipper> start;
        qi::rule<Iterator, Skipper> block;
        qi::rule<Iterator, Skipper> statement;
    
    };
    

    The secret lies in the call of the parser. For some reason, when you want to parse this using parse_phrase, you have to give a skipper grammar object. I was not aware of this:

    typedef std::string::const_iterator iterator_t;
    typedef parser::pl0_grammar<iterator_t> grammar;
    typedef parser::pl0_skipper<iterator_t> skipper;
    
    grammar g;
    skipper ws;
    
    iterator_t iter = str.begin();
    iterator_t end = str.end();
    bool r = phrase_parse(iter, end, g, ws);
    

    This works.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Standard Java does not offer an object implementing the Queue interface on top of
standard power operation ( ** ) in Python does not work for negative power!
With the C standard library stdio.h , I read that to output ASCII/text data,
Is there really no way to print an ascii string in assembly to standard
I'm trying to make a Win32/*nix console-based ASCII game. I want to use no
I realize UTF-8 is the standard but I have reasons for wanting ASCII. I
I have a 'ascii' error at /@@mail-controlpanel. How can i check the values and
In standard C++ we have char and wchar_t for storing characters. char can store
Does Perl's \w match all alphanumeric characters defined in the Unicode standard? For example,
I need to find and delete all the non standard ascii chars that are

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.