> On 25 Feb 2016, at 14:51, Martin Bjorklund <[email protected]> wrote:
>
> Ladislav Lhotka <[email protected]> wrote:
>>
>>> 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.
>
> Correct. But we can only do so much in the grammar... For example, we
> cannot verify that the name and number of keys are correct.
Yes, but these are already semantic constraints. I think the new productions
below are in fact easier to comprehend. Perhaps a production like
quoted-string = (DQUOTE string DQUOTE) / (SQUOTE string SQUOTE)
would also be an improvement.
Lada
>
> It would be:
>
> instance-identifier = 1*("/" (node-identifier [1*key-predicate /
> leaf-list-predicate /
> pos]))
>
> key-predicate = "[" *WSP key-predicate-expr *WSP "]"
>
> key-predicate-expr = node-identifier *WSP "=" *WSP
> ((DQUOTE string DQUOTE) /
> (SQUOTE string SQUOTE))
>
> leaf-list-predicate = "[" *WSP leaf-list-predicate-expr *WSP "]"
>
> leaf-list-predicate-expr = "." *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