[ 
https://issues.apache.org/jira/browse/DAFFODIL-1590?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Steve Lawrence resolved DAFFODIL-1590.
--------------------------------------
    Resolution: Fixed

I've confirmed that this is fixed. Automated testing of this particular 
ordering is difficult, but I was able to manually verify. Using this schema:

{code:xml}
  <annotation>
    <appinfo source="http://www.ogf.org/dfdl/";>
      <dfdl:format ref="ex:GeneralFormat" />
      <dfdl:defineVariable name="oneValue" type="xs:int" />
    </appinfo>
  </annotation>

  <element name="root">
    <complexType>
      <sequence>
        <element name="one" type="xs:int" dfdl:lengthKind="explicit" 
dfdl:length="1" dfdl:terminator="%NL;">
          <annotation>
            <appinfo source="http://www.ogf.org/dfdl/";>
              <dfdl:setVariable ref="ex:oneValue" value="{.}" />
            </appinfo>
          </annotation>
        </element>
        <element name="two" type="xs:int" dfdl:inputValueCalc="{ $ex:oneValue 
}" />
      </sequence>
    </complexType>
  </element>
{code}

And stepping through the parse with the debugger, the order of execution of the 
relevant parsers is:
# <one parser='StringOfSpecifiedLengthParser' />
# <ConvertTextStandardNumberParser/>
# <terminator/>
# <SetVariableParser/>

The set variable parser definitely happens after the terminator parser. I'm not 
sure when this was fixed, but I tested as far back as v3.6.0 and it still had 
the correct ordering, so this has been fixed for a while.


> setVar evaluates before element terminator
> ------------------------------------------
>
>                 Key: DAFFODIL-1590
>                 URL: https://issues.apache.org/jira/browse/DAFFODIL-1590
>             Project: Daffodil
>          Issue Type: Bug
>          Components: Back End, General, Unparsing
>            Reporter: Mike Beckerle
>            Assignee: Josh Adams
>            Priority: Major
>             Fix For: 4.1.0
>
>
> So there's a bug here. if setVar is supposed to evaluate (for elements) after 
> the entire element, then we shouldn't be passing setVar grammar terms to the 
> element combinator, but putting them in the grammar after the element's 
> terminator.
> Actually, we need the grammar to pass the grammar regions that include the 
> element's initiator and terminator to the ElementCombinator, so that the 
> unparseEnd can happen after the setVar, but the setVars happen after the 
> terminator. 
> So some grammar refactoring is required.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to