From: Tomek Mrugalski Date: Mon, 21 Jun 2021 17:49:24 +0000 (+0200) Subject: [#745] Automated BNF extraction X-Git-Tag: Kea-1.9.9~63 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=392dfaef45630f3ecc061e770c36f4f1f2c682ee;p=thirdparty%2Fkea.git [#745] Automated BNF extraction --- diff --git a/doc/Makefile.am b/doc/Makefile.am index 56a91d3cbf..1858c2218d 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -74,3 +74,23 @@ nobase_dist_doc_DATA += examples/netconf/kea-dhcp6-operations/twosubnets.xml nobase_dist_doc_DATA += examples/netconf/comments.json nobase_dist_doc_DATA += examples/netconf/simple-dhcp4.json nobase_dist_doc_DATA += examples/netconf/simple-dhcp6.json + +grammar: +if GENERATE_DOCS +if GENERATE_PARSER + mkdir $(abs_top_srcdir)/doc/sphinx/grammar + $(abs_top_srcdir)/tools/extract_bnf.sh $(abs_top_srcdir)/src/bin/dhcp4/dhcp4_parser > $(abs_top_srcdir)/doc/sphinx/grammar/grammar-dhcp4-parser.txt + $(abs_top_srcdir)/tools/extract_bnf.sh $(abs_top_srcdir)/src/bin/dhcp6/dhcp6_parser > $(abs_top_srcdir)/doc/sphinx/grammar/grammar-dhcp6-parser.txt + $(abs_top_srcdir)/tools/extract_bnf.sh $(abs_top_srcdir)/src/bin/d2/d2_parser > $(abs_top_srcdir)/doc/sphinx/grammar/grammar-d2-parser.txt + $(abs_top_srcdir)/tools/extract_bnf.sh $(abs_top_srcdir)/src/bin/agent/agent_parser > $(abs_top_srcdir)/doc/sphinx/grammar/grammar-ca-parser.txt + $(abs_top_srcdir)/tools/extract_bnf.sh $(abs_top_srcdir)/src/bin/netconf/netconf_parser > $(abs_top_srcdir)/doc/sphinx/grammar/grammar-netconf-parser.txt +else + @echo "ERROR: You need to enable both docs (--enable-generate-docs) and parser (--enable-generate-parser)" + @echo "ERROR: to regenerate grammar documentation." + false +endif +else + @echo "ERROR: You need to enable both docs (--enable-generate-docs) and parser (--enable-generate-parser)" + @echo "ERROR: to regenerate grammar documentation." + false +endif diff --git a/doc/sphinx/grammar/grammar.rst b/doc/sphinx/grammar/grammar.rst new file mode 100644 index 0000000000..931b7fa143 --- /dev/null +++ b/doc/sphinx/grammar/grammar.rst @@ -0,0 +1,43 @@ +.. + Copyright (C) 2021 Internet Systems Consortium, Inc. ("ISC") + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + See the COPYRIGHT file distributed with this work for additional + information regarding copyright ownership. + +.. _bnf-grammar: + +BNF Grammar +=========== + +Here's the Backus-Naur form (BNF) https://en.wikipedia.org/wiki/Backus%E2%80%93Naur_form notation + +BNF Grammar for DHCPv4 +---------------------- + +``` +.. include:: grammar-dhcp4-parser.txt +``` + +BNF Grammar for DHCPv6 +---------------------- + +.. include:: grammar-dhcp6-parser.txt + +BNF Grammar for Control Agent +----------------------------- + +.. include:: grammar-ca-parser.txt + +BNF Grammar for D2 (DHCP-DDNS) +------------------------------ + +.. include:: grammar-d2-parser.txt + +BNF Grammar for Kea-netconf +--------------------------- + +.. include:: grammar-netconf-parser.txt diff --git a/doc/sphinx/index.rst b/doc/sphinx/index.rst index daead80bff..a7f22b8ce4 100644 --- a/doc/sphinx/index.rst +++ b/doc/sphinx/index.rst @@ -53,6 +53,7 @@ Kea, can be found in ISC's `Knowledgebase