> On 25 Feb 2016, at 14:16, Martin Bjorklund <[email protected]> wrote: > > Ladislav Lhotka <[email protected]> wrote: >> Martin Bjorklund <[email protected]> writes: >> >>> Ladislav Lhotka <[email protected]> wrote: >>>> Hi, >>>> >>>> another ABNF issue: >>>> >>>> predicate = "[" *WSP (predicate-expr / pos) *WSP "]" >>>> >>>> predicate-expr = (node-identifier / ".") *WSP "=" *WSP >>>> ((DQUOTE string DQUOTE) / >>>> (SQUOTE string SQUOTE)) >>>> >>>> pos = non-negative-integer-value >>>> >>>> non-negative-integer-value = "0" / positive-integer-value >>>> >>>> The value of 0 shouldn't be allowed for 'pos' because context position >>>> in XPath is always positive, i.e. the first list entry is selected >>>> with "[1]". >>> >>> You are right - I have changed this to: >>> >>> pos = positive-integer-value >> >> Actually, there is another problem: the ABNF allows, for example >> >> /if:interfaces/if:interface[1][2] >> >> which doesn't make sense. > > Yes, you're right. > >> So a correct version could be >> >> instance-identifier = 1*("/" (node-identifier (*predicate / pos)) > > this would make pos mandatory after every node-identifier. It should > be: > > instance-identifier = 1*("/" (node-identifier (*predicate / *1pos))) > > or, in order to match the style in the rest of the grammar: > > instance-identifier = 1*("/" (node-identifier [1*predicate / pos]))
If we want to be really precise, then the predicate for a leaf-list [ . = 'foo'] can also appear no more than once. Lada > >> predicate = "[" *WSP predicate-expr *WSP "]" >> >> predicate-expr = (node-identifier / ".") *WSP "=" *WSP >> ((DQUOTE string DQUOTE) / >> (SQUOTE string SQUOTE)) >> >> pos = "[" *WSP positive-integer-value *WSP "]" > > > > /martin -- Ladislav Lhotka, CZ.NIC Labs PGP Key ID: E74E8C0C _______________________________________________ netmod mailing list [email protected] https://www.ietf.org/mailman/listinfo/netmod
