]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#745] Automated BNF extraction
authorTomek Mrugalski <tomek@isc.org>
Mon, 21 Jun 2021 17:49:24 +0000 (19:49 +0200)
committerTomek Mrugalski <tomek@isc.org>
Wed, 23 Jun 2021 10:04:18 +0000 (12:04 +0200)
doc/Makefile.am
doc/sphinx/grammar/grammar.rst [new file with mode: 0644]
doc/sphinx/index.rst

index 56a91d3cbf301ce1fb9f6744e6a84aa0da30e3cc..1858c2218dd9d8bb9275850a54a9d1a6e07ac38b 100644 (file)
@@ -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 (file)
index 0000000..931b7fa
--- /dev/null
@@ -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
index daead80bffdf1811bcfb3b2bf603a14c2032617d..a7f22b8ce4d948ac59f5030469778e42a08b6e67 100644 (file)
@@ -53,6 +53,7 @@ Kea, can be found in ISC's `Knowledgebase <https://kb.isc.org/docs/kea-administr
    kea-messages
    umls
    arm/acknowledgments
+   grammar/grammar