mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-31 22:15:23 +00:00
[#745] Finished conversion to BNF
This commit is contained in:
committed by
Tomek Mrugalski
parent
54b02254ca
commit
47a5186cc2
@@ -9,7 +9,7 @@
|
|||||||
# Get BNF grammars from bison files
|
# Get BNF grammars from bison files
|
||||||
|
|
||||||
# Check if there is one argument only
|
# Check if there is one argument only
|
||||||
if [ $# -ne 1]; then
|
if [ $# -ne 1 ]; then
|
||||||
echo "extract_bnf.sh <bison-file-base-name>"
|
echo "extract_bnf.sh <bison-file-base-name>"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -35,6 +35,8 @@ fi
|
|||||||
# - remove line numbers
|
# - remove line numbers
|
||||||
# - remove intermediate productions
|
# - remove intermediate productions
|
||||||
# - remove intermediate non-terminals
|
# - remove intermediate non-terminals
|
||||||
|
# - replace standard tokens
|
||||||
|
# - replace : by BNF ::=
|
||||||
# - squeeze multiple blank lines
|
# - squeeze multiple blank lines
|
||||||
|
|
||||||
cat $output |\
|
cat $output |\
|
||||||
@@ -42,4 +44,14 @@ cat $output |\
|
|||||||
@AWK@ '// { gsub("^ +[0-9]+ ", ""); print }' |\
|
@AWK@ '// { gsub("^ +[0-9]+ ", ""); print }' |\
|
||||||
@AWK@ '/^\$@[0-9]+:/ { next }; // { print }' |\
|
@AWK@ '/^\$@[0-9]+:/ { next }; // { print }' |\
|
||||||
@AWK@ '// { gsub(" \\$@[0-9]+ ", " ") ; 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
|
cat -s
|
||||||
|
Reference in New Issue
Block a user