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

  • Home
  • SEARCH
  • 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 8873935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:35:36+00:00 2026-06-14T18:35:36+00:00

I am trying to parse a rule of the form predicate -> action .

  • 0

I am trying to parse a rule of the form predicate -> action.

My problem is that predicate can be any valid mathematical expression, so it may actually include a minus sign or a greater sign (but we have to disallow them in sequence as that’s the token we want to separate predicate from action).

Essentially, I would like predicate to consume all non-spaces until it hits the string "->".

How do I got about doing this?

Is the right approach to fix the line I have commented below or should I better define what a predicate is, in terms of a valid expression, and let the parser fall into "->" when predicate ends, according to that valid expression?

rule %=
  predicate
  >> "->"
  >> action
  ;

predicate %= (+~(qi::char_("-"))); // BAD: works only if no minus sign in predicate
action    %= (+(qi::char_));
  • 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-06-14T18:35:39+00:00Added an answer on June 14, 2026 at 6:35 pm

    Rephrase predicate as follows:

    predicate = +(qi::char_ - "->"); 
    action    = +(qi::char_);
    

    Equivalently,

    predicate = +(!qi::lit("->") >> qi::char_); 
    

    should do the same.

    See the docs

    • Difference Parser (a – b)
    • Not-Predicate Parser (!a)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to parse an HTML document and extract some elements (any links to text
Trying to parse Maplines for an airport. Each airport can have X number of
I am trying to use the no_skip directive to parse input of the form:
I am trying to parse JSON of the following form using aeson {field:{name:...}} or
I'm trying to parse a txt file that represents a grammar to be used
I'm trying to parse a key-value string into a structure. Some key-values may be
I'm trying to create a parser using Treetop that is somewhat recursive. An expression
First I'll state my intention: I'm trying to write a parse rule for potentially
I'm trying to use Parse::RecDescent make a parser which can parse parenthetical expressions and
Trying to figure out how to have a .procmailrc rule that tosses all mail

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.