openEHR / adl-antlr

Antrl4 grammars for ADL
Apache License 2.0
1 stars 4 forks source link

sibling order doesn't parse #6

Closed pieterbos closed 8 years ago

pieterbos commented 8 years ago

If you write a sibling order before the first occuring attribute, it gets parsed.

If you put one between two attributes, it results in a parse error, or so it seems:

trying to parse adl2-tests/validity/specialisation/openEHR-EHR-OBSERVATION.spec_test_obs-VSSM_added_nodes_ordered.v1.adls
line 41:3 extraneous input 'before' expecting {'}', SYM_USE_NODE, SYM_USE_ARCHETYPE, SYM_ALLOW_ARCHETYPE, ALPHA_UC_ID}
line 41:11 mismatched input 'id8' expecting ALPHA_LC_ID
line 42:3 mismatched input 'ELEMENT' expecting SYM_MATCHES
line 42:11 mismatched input 'id0.3' expecting ALPHA_LC_ID
line 43:4 mismatched input 'value' expecting '['
line 47:2 mismatched input '}' expecting SYM_TERMINOLOGY
definition
    OBSERVATION[id1.1] matches {    -- specialisation containing ordered extension nodes
        /data/events[id3]/data/items matches {
            after [id1000]
            ELEMENT[id0.1] matches {    -- Text field 2
                value matches {
                    DV_TEXT[id0.1]  -- Text field 2
                }
            }
            ELEMENT[id0.2] matches {    -- Quantity 2
                value matches {
                    DV_QUANTITY[id0.2]  -- Quantity 2
                }
            }
            before [id8]
            ELEMENT[id0.3] matches {    -- Text field 3
                value matches {
                    DV_TEXT[id0.3]  -- Text field 3
                }
            }
        }
    }
wolandscat commented 8 years ago

This should now work.

pieterbos commented 8 years ago

This works (though yet to be implemented in my parser). A lot of thanks for the quick and many fixes!