]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#745] Finished conversion to BNF
authorFrancis Dupont <fdupont@isc.org>
Mon, 22 Jul 2019 22:26:42 +0000 (00:26 +0200)
committerTomek Mrugalski <tomek@isc.org>
Wed, 23 Jun 2021 10:04:18 +0000 (12:04 +0200)
tools/extract_bnf.sh.in

index 523f2ada6bcfbbf3bb5ef052f0e1071ddabe57a7..e69fba56fbfd5fe4a4cbc8d84bbc9e5d8a868c32 100755 (executable)
@@ -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