Detecting outcome of parsing

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Detecting outcome of parsing

Callum Jamieson

Hi,

 

I have a parser set up for a command based language which is entered via a command line.  This is all working fine.

 

As the user enters the command I would like to issue feedback to the user as to the correctness of the command syntax written so far and provide feedback at the point where the user tries to enter something that would not successfully parse… provide a beep rather than accepting the keystroke.

 

What I really need is to submit the command to the parser as it is assembled and I need a status which says yes parses ok up until the end of input but needs more input.

 

The bool returned from parse returns true if the command would parse to successful completion…  I want a status which says it parses successfully up to the end of input but needs more input.

 

Anybody know of the best way of achieving this with the spirit parser

 

Many thanks,

Kind Regards,

Callum.

 

 


------------------------------------------------------------------------------

_______________________________________________
Spirit-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-general
Reply | Threaded
Open this post in threaded view
|

Re: Detecting outcome of parsing

Mikael Asplund

Hi!

 

Can't say if it's the best way, but using the on_success() hooks (on the id-objects) would let you signal any sort of progress you like for each successfully parsed rule (and rules only, not smaller parts, but you could make lots of rules :).  This of course wont wont if you're on Visual Studio, until MS comes out with a working compiler...

 

Regards,

  Mikael

 

From: Callum Jamieson [mailto:[hidden email]]
Sent: Friday, April 8, 2016 13:13
To: [hidden email]
Subject: [Spirit-general] Detecting outcome of parsing

 

Hi,

 

I have a parser set up for a command based language which is entered via a command line.  This is all working fine.

 

As the user enters the command I would like to issue feedback to the user as to the correctness of the command syntax written so far and provide feedback at the point where the user tries to enter something that would not successfully parse… provide a beep rather than accepting the keystroke.

 

What I really need is to submit the command to the parser as it is assembled and I need a status which says yes parses ok up until the end of input but needs more input.

 

The bool returned from parse returns true if the command would parse to successful completion…  I want a status which says it parses successfully up to the end of input but needs more input.

 

Anybody know of the best way of achieving this with the spirit parser

 

Many thanks,

Kind Regards,

Callum.

 

 


------------------------------------------------------------------------------

_______________________________________________
Spirit-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-general