Skip to content

Commit

Permalink
automatically makes paths in generated parser files relative
Browse files Browse the repository at this point in the history
  • Loading branch information
ArquintL committed Jan 24, 2025
1 parent 41a583e commit a28445f
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions genparser.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,11 @@ java -jar "$ANTLR4_PATH" "$SCRIPT_DIR"/src/main/antlr4/GobraLexer.g4 -package vi
echo -e "${GREEN}Generating the parser:${RESET}"
java -jar "$ANTLR4_PATH" "$SCRIPT_DIR"/src/main/antlr4/GobraParser.g4 -package viper.gobra.frontend -visitor -no-listener || { echo -e "${RED}Error while generating the parser.${RESET}"; exit 3; }

echo -e "${GREEN}Making path in comments relative:${RESET}"
sed -i '' 's/\/\/ Generated from .*src\/main\/antlr4\/GobraLexer\.g4/\/\/ Generated from src\/main\/antlr4\/GobraLexer\.g4/g' "$SCRIPT_DIR"/src/main/antlr4/GobraLexer.java
sed -i '' 's/\/\/ Generated from .*src\/main\/antlr4\/GobraParser\.g4/\/\/ Generated from src\/main\/antlr4\/GobraParser\.g4/g' "$SCRIPT_DIR"/src/main/antlr4/GobraParser.java
sed -i '' 's/\/\/ Generated from .*src\/main\/antlr4\/GobraParser\.g4/\/\/ Generated from src\/main\/antlr4\/GobraParser\.g4/g' "$SCRIPT_DIR"/src/main/antlr4/GobraParserBaseVisitor.java
sed -i '' 's/\/\/ Generated from .*src\/main\/antlr4\/GobraParser\.g4/\/\/ Generated from src\/main\/antlr4\/GobraParser\.g4/g' "$SCRIPT_DIR"/src/main/antlr4/GobraParserVisitor.java

echo -e "${GREEN}Moving the generated files:${RESET}"
mv -v "$SCRIPT_DIR"/src/main/antlr4/*.java "$SCRIPT_DIR"/src/main/java/viper/gobra/frontend/
2 changes: 1 addition & 1 deletion src/main/java/viper/gobra/frontend/GobraLexer.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated from /Users/joao/code/gobra/src/main/antlr4/GobraLexer.g4 by ANTLR 4.13.1
// Generated from src/main/antlr4/GobraLexer.g4 by ANTLR 4.13.1
package viper.gobra.frontend;
import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.CharStream;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/viper/gobra/frontend/GobraParser.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated from /Users/joao/code/gobra/src/main/antlr4/GobraParser.g4 by ANTLR 4.13.1
// Generated from src/main/antlr4/GobraParser.g4 by ANTLR 4.13.1
package viper.gobra.frontend;
import org.antlr.v4.runtime.atn.*;
import org.antlr.v4.runtime.dfa.DFA;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated from /Users/joao/code/gobra/src/main/antlr4/GobraParser.g4 by ANTLR 4.13.1
// Generated from src/main/antlr4/GobraParser.g4 by ANTLR 4.13.1
package viper.gobra.frontend;
import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor;

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/viper/gobra/frontend/GobraParserVisitor.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated from /Users/joao/code/gobra/src/main/antlr4/GobraParser.g4 by ANTLR 4.13.1
// Generated from src/main/antlr4/GobraParser.g4 by ANTLR 4.13.1
package viper.gobra.frontend;
import org.antlr.v4.runtime.tree.ParseTreeVisitor;

Expand Down

0 comments on commit a28445f

Please sign in to comment.