X3 automatic attribute assignment

Maarten Verhage <[email protected]> Sat, 16 Jun 2018 12:54:17 +0000
Newsgroups gmane.comp.parsers.spirit.general
Message-ID <AM5P192MB0131189BCB4C59042EF21406BA730@AM5P192MB0131.EURP192.PROD.OUTLOOK.COM>
Hi Y’all.

Just a little question today. I’ll try to be as clear as possible.

Ok regarding the Spirit X3 employee example. This example uses the 5 
argument version of phrase_parse like this:

bool r = phrase_parse( iter, end, employee, space, emp );

Now when I don’t have any semantic action in the grammar, Spirit 
automatically assigns Context _attr to Context _val (the latter being the 
reference to emp).

Now what I found is when I add any semantic action somewhere in the grammar. 
Spirit completely takes its hands off this automatic assignment process. 
Even when I don’t assign Context _val myself.

This is how it’s designed to be, correct?

When I call phrase_parse without the emp argument then obviously Spirit 
cannot assign anything and there is no side effect when I add the first 
semantic action.

I wonder if there is more in Spirit X3 to control whether the attributes are 
automatically assigned or not.

I don’t have a problem with it I just want to understand the behavior 
clearly.

Best regards,
Maarten Verhage 


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot