char parser for a list of possible chars

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

char parser for a list of possible chars

MM
Hi,

Is there a more compact way to express this parser?
With the target of having 'char' as an attribute?

1. char_('A') | char_('E') | char_('X') 


2. char_("AEX")  // does this parse any of A or E or X?

According to the rules, the synthetized attribute of 1. is variant< char, char, char >.
Does it simplify to char ?

Rds,
MM

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

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

Re: char parser for a list of possible chars

sehe
On 06/17/2015 10:30 AM, MM wrote:
> Hi,
>
> Is there a more compact way to express this parser?
> With the target of having 'char' as an attribute?
>
> 1. char_('A') | char_('E') | char_('X')
>
Yes
>
> 2. char_("AEX")  // does this parse any of A or E or X?
Yes
>
> According to the rules, the synthetized attribute of 1. is variant<
> char, char, char >.
Yes

> Does it simplify to char ?
Yes

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

Re: char parser for a list of possible chars

MM
On 17 June 2015 at 13:23, Seth <[hidden email]> wrote:
On 06/17/2015 10:30 AM, MM wrote:
> Hi,
>
> Is there a more compact way to express this parser?
> With the target of having 'char' as an attribute?
>
> 1. char_('A') | char_('E') | char_('X')
>
Yes
>
> 2. char_("AEX")  // does this parse any of A or E or X?
Yes
>
> According to the rules, the synthetized attribute of 1. is variant<
> char, char, char >.
Yes

> Does it simplify to char ?
Yes

------------------------------------------------------------------------------
Thanks.
How would I go about updating the 5th row here:
to make it clearer? 

MM

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

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

Re: char parser for a list of possible chars

TONGARI J
2015-06-17 20:35 GMT+08:00 MM <[hidden email]>:
On 17 June 2015 at 13:23, Seth <[hidden email]> wrote:
On 06/17/2015 10:30 AM, MM wrote:
> Hi,
>
> Is there a more compact way to express this parser?
> With the target of having 'char' as an attribute?
>
> 1. char_('A') | char_('E') | char_('X')
>
Yes
>
> 2. char_("AEX")  // does this parse any of A or E or X?
Yes
>
> According to the rules, the synthetized attribute of 1. is variant<
> char, char, char >.
Yes

> Does it simplify to char ?
Yes

------------------------------------------------------------------------------
Thanks.
How would I go about updating the 5th row here:
to make it clearer? 

It's in the 7th row (charset), you should look at this:


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

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