-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate-shell-parser.sh
More file actions
executable file
·17 lines (13 loc) · 805 Bytes
/
generate-shell-parser.sh
File metadata and controls
executable file
·17 lines (13 loc) · 805 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash
cd "$(dirname "$0")"
source ./script/setup.sh
./script/install-dep.sh --antlr
./.deps/python-venv/bin/antlr4 -v "$antlr_version" -no-listener -Dlanguage=Swift \
-o ./ShellParserGenerated/Sources/ShellParserGenerated \
./grammar/ShellLexer.g4 \
./grammar/ShellParser.g4
mv ./ShellParserGenerated/Sources/ShellParserGenerated/grammar/*.swift ./ShellParserGenerated/Sources/ShellParserGenerated/
rm -rf ./ShellParserGenerated/Sources/ShellParserGenerated/grammar # Antlr generates weird *.interp and *.tokens files
# Sources/ShellParserGenerated/ShellParser.swift:557:7: warning: variable '_prevctx' was written to, but never read
# var _prevctx: CmdContext = _localctx
sed -i '' '/_prevctx/d' ./ShellParserGenerated/Sources/ShellParserGenerated/ShellParser.swift