Skip to content

Commit

Permalink
Merge pull request #65 from dnicolson/python-3-support
Browse files Browse the repository at this point in the history
Add Python 3 support
  • Loading branch information
davideme authored Mar 23, 2021
2 parents 2bdce7a + 6925a1b commit cfbba67
Show file tree
Hide file tree
Showing 13 changed files with 4,358 additions and 3,215 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/commit-grammar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Download ANTLR 4.6
- name: Download ANTLR 4.9.2
working-directory: /tmp
run: |
wget https://www.antlr.org/download/antlr-4.6-complete.jar
wget https://www.antlr.org/download/antlr-4.9.2-complete.jar
- name: Update grammar
working-directory: kin/grammar
run: |
java -jar /tmp/antlr-4.6-complete.jar PBXProj.g4 -Dlanguage=Python2
java -jar /tmp/antlr-4.9.2-complete.jar PBXProj.g4 -Dlanguage=Python3
- name: Commit changes
run: |
git add kin/grammar
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Download ANTLR 4.6
- name: Download ANTLR 4.9.2
working-directory: /tmp
run: |
wget https://www.antlr.org/download/antlr-4.6-complete.jar
wget https://www.antlr.org/download/antlr-4.9.2-complete.jar
- name: Generate grammar
working-directory: kin/grammar
run: |
java -jar /tmp/antlr-4.6-complete.jar PBXProj.g4 -Dlanguage=Python2
java -jar /tmp/antlr-4.9.2-complete.jar PBXProj.g4 -Dlanguage=Python3
- name: Upload grammar
uses: actions/upload-artifact@master
with:
Expand All @@ -40,7 +40,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [2.7]
python-version: ['3.x']

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '2.x'
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,17 @@ Do you want to contribute?

Feel free to add any useful feature to Kin, we will be glad to improve it with your help.

If you modify the grammar file (`PBXProj.g4`), make sure you compile it using [ANTLR](https://www.antlr.org/). ANLTR version 4.6 can be installed with the following commands (the current version is 4.8 but is not compatible):
If you modify the grammar file (`PBXProj.g4`), make sure you compile it using [ANTLR](https://www.antlr.org/). ANLTR can be installed with the following command:

```bash
curl -O https://raw.githubusercontent.com/Homebrew/homebrew-core/92cd4dbae4ae77853e3693b4eb3c24d71855103f/Formula/antlr.rb
sed -i -e 's/EOS.undent/EOS/g' antlr.rb
brew install antlr.rb
brew install antlr
```

After changes have been made to the `PBXProj.g4` file it can be compiled with:

```bash
cd kin/grammar
bash /usr/local/Cellar/antlr/4.6/bin/antlr4 PBXProj.g4 -Dlanguage=Python2
antlr4 PBXProj.g4 -Dlanguage=Python3
```

The updated files can optionally be copied with this command for testing:
Expand Down
Loading

0 comments on commit cfbba67

Please sign in to comment.