summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorFrancis Dupont <fdupont@isc.org>2019-07-23 00:26:42 +0200
committerTomek Mrugalski <tomek@isc.org>2021-06-23 12:04:18 +0200
commit47a5186cc20a909c3e91c7c2033aa9b28f2273b5 (patch)
treee711e55cac73d52b1c52788a48abc4648f0998b8 /tools
parent[#745] BNF notation can now be extracted (diff)
downloadkea-47a5186cc20a909c3e91c7c2033aa9b28f2273b5.tar.xz
kea-47a5186cc20a909c3e91c7c2033aa9b28f2273b5.zip
[#745] Finished conversion to BNF
Diffstat (limited to 'tools')
-rwxr-xr-xtools/extract_bnf.sh.in14
1 files changed, 13 insertions, 1 deletions
diff --git a/tools/extract_bnf.sh.in b/tools/extract_bnf.sh.in
index 523f2ada6b..e69fba56fb 100755
--- a/tools/extract_bnf.sh.in
+++ b/tools/extract_bnf.sh.in
@@ -9,7 +9,7 @@
# Get BNF grammars from bison files
# Check if there is one argument only
-if [ $# -ne 1]; then
+if [ $# -ne 1 ]; then
echo "extract_bnf.sh <bison-file-base-name>"
exit 1
fi
@@ -35,6 +35,8 @@ fi
# - remove line numbers
# - remove intermediate productions
# - remove intermediate non-terminals
+# - replace standard tokens
+# - replace : by BNF ::=
# - squeeze multiple blank lines
cat $output |\
@@ -42,4 +44,14 @@ cat $output |\
@AWK@ '// { gsub("^ +[0-9]+ ", ""); print }' |\
@AWK@ '/^\$@[0-9]+:/ { next }; // { print }' |\
@AWK@ '// { gsub(" \\$@[0-9]+ ", " ") ; print }' |\
+@AWK@ '// { gsub("\"constant string\"", "STRING"); print }' |\
+@AWK@ '// { gsub("\"integer\"", "INTEGER"); print }' |\
+@AWK@ '// { gsub("\"floating point\"", "FLOAT"); print }' |\
+@AWK@ '// { gsub("\"boolean\"", "BOOLEAN"); print }' |\
+@AWK@ '// { gsub("\"constant hexstring\"", "HEXSTRING"); print }' |\
+@AWK@ '// { gsub("\"option name\"", "OPTION_NAME"); print }' |\
+@AWK@ '// { gsub("\"ip address\"", "IP_ADDRESS"); print }' |\
+@AWK@ '// { gsub("\"end of file\"", "EOF"); print }' |\
+@AWK@ '// { gsub("%empty", ""); print }' |\
+@AWK@ '// { gsub(": ", " ::= "); print }' |\
cat -s