update-parser.sh 1015 Bytes
Newer Older
1 2
#!/bin/bash

Daniel Salzman's avatar
Daniel Salzman committed
3 4
### ZSCANNER ###

5
IN="./scanner.rl"
Daniel Salzman's avatar
Daniel Salzman committed
6 7
OUT_T0="./scanner.c.t0"
OUT_G2="./scanner.c.g2"
8

9 10
pushd ../src/zscanner/

Daniel Salzman's avatar
Daniel Salzman committed
11 12 13 14 15
# Generate slower/small zone parser.
ragel -T0 -s -o $OUT_T0 $IN

# Remove redundant comments and unused constants (clang warnings).
sed -i '/#line/d' $OUT_T0
16
sed -i '/static\ const\ int\ zone_scanner_/d' $OUT_T0
Daniel Salzman's avatar
Daniel Salzman committed
17

18 19 20
# Remove trailing white spaces.
sed -i 's/\s*$//g' $OUT_T0

Daniel Salzman's avatar
Daniel Salzman committed
21 22 23 24 25
# Generate fast/huge zone parser.
ragel -G2 -s -o $OUT_G2 $IN

# Remove redundant comments and unused constants (clang warnings).
sed -i '/#line/d' $OUT_G2
26
sed -i '/static\ const\ int\ zone_scanner_/d' $OUT_G2
Daniel Salzman's avatar
Daniel Salzman committed
27

28 29 30
# Remove trailing white spaces.
sed -i 's/\s*$//g' $OUT_G2

Daniel Salzman's avatar
Daniel Salzman committed
31 32 33 34 35 36
popd

### YPARSER ###

IN_Y="./ypbody.rl"
OUT_Y="./ypbody.c"
37

38
pushd ../src/libknot/yparser/
39

Daniel Salzman's avatar
Daniel Salzman committed
40 41
# Generate yparser.
ragel -T0 -s -o $OUT_Y $IN_Y
42

Daniel Salzman's avatar
Daniel Salzman committed
43 44 45
# Remove redundant comments and unused constants (clang warnings).
sed -i '/#line/d' $OUT_Y
sed -i '/static\ const\ int\ yparser_/d' $OUT_Y
46

47 48 49
# Remove trailing white spaces.
sed -i 's/\s*$//g' $OUT_Y

50
popd