Changes between Version 1 and Version 2 of Ticket #12094, comment 1


Ignore:
Timestamp:
Mar 24, 2016, 10:35:33 AM (7 years ago)
Author:
Joel de Guzman

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #12094, comment 1

    v1 v2  
    11It may be unintuitive, but it is not really a bug. Sequences (including expect operators in x3) may accept a tuple or container (e.g. string). If it gets a container, it expects its nodes to have an attribute of either a container, or the container's value type. See http://www.boost.org/doc/libs/1_60_0/libs/spirit/doc/html/spirit/qi/reference/operator/sequence.html
    22
    3 But what is the natural (inherent) attribute type of (r | r)? It is a variant, not a container. That is why X3 got tripped. It can't handle the ambiguity. X3's attribute handling mechanism is not perfect. As it descends into the alternative, it already decided that it's attribute cannot handle the container, and thus tries to pass the element type of the container.
     3But what is the natural (inherent) attribute type of (r | r)? It is a variant, not a container. That is why X3 got tripped. It can't handle the ambiguity. X3's attribute handling mechanism is not perfect. As it descends into the alternative, it already decided that its attribute cannot handle the container, and thus tries to pass the element type of the container.
    44
    55Tip: Don't fight the attribute mechanism. Try to form your attributes as closely as possible to the rules and grammars that models it.