Boost logo

Boost Users :

Subject: Re: [Boost-users] [Spirit] Semantic actions (binary parser) - user error or bug?
From: Hartmut Kaiser (hartmut.kaiser_at_[hidden])
Date: 2011-05-01 10:30:48


> > Seems perfectly normal to me. You need omit[] around stuff that you
> > don't want to appear as part of the attribute for a rule. Since your
> > rule's attribute is only a byte, including big_dword as part of the
> > rule without omit would mean that its part of the attribute for the
> > rule too and that doesn't match the layout of the test struct.
>
> Hi,
>
> What's wrong with the following code, and how can I fix it? The semantic
> actions seem to be inconsistent (or maybe I'm using them wrong).
> No omit, but no value?

Semantic actions in Karma are supposed to _supply_ the attribute value to generate output from. Therefore your start rule needs to be written as:

    start = big_dword >> big_dword[_1 = ref(temp)];

Regards Hartmut
---------------
http://boost-spirit.com


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net