Send kea-dev mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.isc.org/mailman/listinfo/kea-dev
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of kea-dev digest..."


Today's Topics:

   1.  trailing commas and unknown_map_entry (Gregor Kling)
   2. Re:  trailing commas and unknown_map_entry (Francis Dupont)


----------------------------------------------------------------------

Message: 1
Date: Tue, 3 Jun 2025 08:52:48 +0200
From: Gregor Kling <[email protected]>
To: [email protected]
Subject: [kea-dev] trailing commas and unknown_map_entry
Message-ID: <[email protected]>
Content-Type: text/plain; charset=UTF-8; format=flowed

Hello,

I am studying the grammar for dhcp4.


1) Just to be sure rules like that:

global_params ::= global_param
 ?????????????? | global_params "," global_param
 ?????????????? | global_params ","

specifically: | global_params "," deals with the kea json format which 
can do trailing commas,

which standard json can not?


2) unknown_map_entry ::= STRING ":" strikes me a little odd.

It is allowed to have - "something":? - with no value part?


gg


-- 
Gregor Kling

Abteilung ITS, Sachgebiet ITS-N
Technische Hochschule Mittelhessen
University of Applied Sciences
Tel: 0641/309-1292
E-Mail: [email protected]



------------------------------

Message: 2
Date: Tue, 03 Jun 2025 10:36:02 +0000
From: Francis Dupont <[email protected]>
To: Gregor Kling <[email protected]>
Cc: [email protected]
Subject: Re: [kea-dev] trailing commas and unknown_map_entry
Message-ID: <[email protected]>
Content-Type: text/plain; charset="UTF-8"

Gregor Kling writes:

> 1) Just to be sure rules like that:
> 
> global_params ::= global_param
>  ?????????????? | global_params "," global_param
>  ?????????????? | global_params ","
>
> specifically: | global_params "," deals with the kea json format which 
> can do trailing commas,
>
> which standard json can not?

=> yes, trailing commas are forbidden by the JSON standard but we decided
to relax this rule in (quoting ChangeLog):
1972.   [func]          andrei
        Kea servers now can accept trailing commas in file
        configurations. While parsing, a warning is printed with the
        location of the comma to give the user the ability to correct
        a mistake.
        (Gitlab #2084)

> 2) unknown_map_entry ::= STRING ":" strikes me a little odd.
> 
> It is allowed to have - "something":? - with no value part?

=> unknown_map_entry catches map entries with an unknown keyword.
Of course - "something": - with no value part is wrong in two different
ways (unknown keyword and no required value part) so the choice of
the error can be considered as arbitrary (in fact not so arbitrary because
the parser is a LALR(1) and error rules can easily trigger conflicts...).

I recommend to look at the full grammar with actions
(src/bin/dhcp4/dhcp4_parser.yy) where error rules are more easy to
distinguish from regular rules. And you can also see extra features
as contexts and types. Bison documentation is useful too because
it provides its own error stuff (for instance the unknown_map_entry
is used to bypass the bison error and emit a more user friendly message).

Regards

Francis Dupont <[email protected]>


------------------------------

Subject: Digest Footer

_______________________________________________
kea-dev mailing list
[email protected]
https://lists.isc.org/mailman/listinfo/kea-dev


------------------------------

End of kea-dev Digest, Vol 94, Issue 1
**************************************

Reply via email to