diff --git a/.github/workflows/ci-backend.yml b/.github/workflows/ci-backend.yml index 6fd30306be3fe..e1552b332f597 100644 --- a/.github/workflows/ci-backend.yml +++ b/.github/workflows/ci-backend.yml @@ -152,14 +152,14 @@ jobs: cd antlr curl -o antlr.jar https://www.antlr.org/download/antlr-$ANTLR_VERSION-complete.jar export PWD=`pwd` - echo '#!/bin/bash' > antlr4 - echo "java -jar $PWD/antlr.jar \$*" >> antlr4 - chmod +x antlr4 + echo '#!/bin/bash' > antlr + echo "java -jar $PWD/antlr.jar \$*" >> antlr + chmod +x antlr export CLASSPATH=".:$PWD/antlr.jar:$CLASSPATH" export PATH="$PWD:$PATH" cd ../current - antlr4 | grep "Version" + antlr | grep "Version" npm run grammar:build && git diff --exit-code check-migrations: diff --git a/package.json b/package.json index aa4db18d5e35e..bc72f59eeee60 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "schema:build": "pnpm run schema:build:json && pnpm run schema:build:python", "schema:build:json": "ts-json-schema-generator -f tsconfig.json --path 'frontend/src/*.ts' --type 'QuerySchema' --no-type-check > frontend/src/queries/schema.json && prettier --write frontend/src/queries/schema.json", "schema:build:python": "datamodel-codegen --collapse-root-models --disable-timestamp --use-subclass-enum --input frontend/src/queries/schema.json --input-file-type jsonschema --output posthog/schema.py && black posthog/schema.py", - "grammar:build": "cd posthog/hogql/grammar && antlr4 -Dlanguage=Python3 HogQLLexer.g4 && antlr4 -visitor -no-listener -Dlanguage=Python3 HogQLParser.g4", + "grammar:build": "cd posthog/hogql/grammar && antlr -Dlanguage=Python3 HogQLLexer.g4 && antlr -visitor -no-listener -Dlanguage=Python3 HogQLParser.g4", "packages:build": "pnpm packages:build:apps-common && pnpm packages:build:lemon-ui", "packages:build:apps-common": "cd frontend/@posthog/apps-common && pnpm i && pnpm build", "packages:build:lemon-ui": "cd frontend/@posthog/lemon-ui && pnpm i && pnpm build", diff --git a/posthog/hogql/grammar/README.md b/posthog/hogql/grammar/README.md index 20bc3020aab24..d02e0f23386cf 100644 --- a/posthog/hogql/grammar/README.md +++ b/posthog/hogql/grammar/README.md @@ -2,7 +2,7 @@ Grammar is located inside `HogQLLexer.g4` and `HogQLParser.g4` files. -To generate source code you need to install locally the `antlr4` binary: +To generate source code you need to install locally the `antlr` binary: ```bash brew install antlr @@ -18,9 +18,9 @@ mkdir antlr cd antlr curl -o antlr.jar https://www.antlr.org/download/antlr-$ANTLR_VERSION-complete.jar export PWD=`pwd` -echo '#!/bin/bash' > antlr4 -echo "java -jar $PWD/antlr.jar \$*" >> antlr4 -chmod +x antlr4 +echo '#!/bin/bash' > antlr +echo "java -jar $PWD/antlr.jar \$*" >> antlr +chmod +x antlr export CLASSPATH=".:$PWD/antlr.jar:$CLASSPATH" export PATH="$PWD:$PATH" ``` @@ -35,8 +35,8 @@ Or mess around with: ```bash cd posthog/hogql/grammar -antlr4 -Dlanguage=Python3 HogQLLexer.g4 -antlr4 -visitor -Dlanguage=Python3 HogQLParser.g4 +antlr -Dlanguage=Python3 HogQLLexer.g4 +antlr -visitor -Dlanguage=Python3 HogQLParser.g4 ``` Original ClickHouse ANTLR grammar from: https://github.com/ClickHouse/ClickHouse/blob/master/utils/antlr/ClickHouseParser.g4