Skip to content

Commit a4b649a

Browse files
authored
Merge pull request #145 from micksmix/master
Updated grammar updater, wrote a README, added Swift grammar, updated Kotlin grammar to v0.3.1
2 parents 1f283e2 + b934799 commit a4b649a

File tree

18 files changed

+1083653
-522185
lines changed

18 files changed

+1083653
-522185
lines changed

.gitignore

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,58 @@
1-
.idea
1+
.idea
2+
3+
# Created by https://www.toptal.com/developers/gitignore/api/visualstudiocode,macos
4+
# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudiocode,macos
5+
6+
### macOS ###
7+
# General
8+
.DS_Store
9+
.AppleDouble
10+
.LSOverride
11+
12+
# Icon must end with two \r
13+
Icon
14+
15+
16+
# Thumbnails
17+
._*
18+
19+
# Files that might appear in the root of a volume
20+
.DocumentRevisions-V100
21+
.fseventsd
22+
.Spotlight-V100
23+
.TemporaryItems
24+
.Trashes
25+
.VolumeIcon.icns
26+
.com.apple.timemachine.donotpresent
27+
28+
# Directories potentially created on remote AFP share
29+
.AppleDB
30+
.AppleDesktop
31+
Network Trash Folder
32+
Temporary Items
33+
.apdisk
34+
35+
### macOS Patch ###
36+
# iCloud generated files
37+
*.icloud
38+
39+
### VisualStudioCode ###
40+
.vscode/*
41+
!.vscode/settings.json
42+
!.vscode/tasks.json
43+
!.vscode/launch.json
44+
!.vscode/extensions.json
45+
!.vscode/*.code-snippets
46+
47+
# Local History for Visual Studio Code
48+
.history/
49+
50+
# Built Visual Studio Code Extensions
51+
*.vsix
52+
53+
### VisualStudioCode Patch ###
54+
# Ignore all local history of files
55+
.history
56+
.ionide
57+
58+
# End of https://www.toptal.com/developers/gitignore/api/visualstudiocode,macos

_automation/README.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Grammar Version Checker
2+
3+
This Go program automates the process of checking and updating grammar versions for various programming languages. It targets specific grammars defined in a JSON configuration file and supports operations like checking for updates and performing updates.
4+
5+
## Features
6+
7+
- **Check for Updates**: Scan through defined grammars and check if there are new versions available.
8+
- **Update Grammar**: Update a specific grammar to its latest version.
9+
- **Update All**: Batch update all grammars to their latest versions.
10+
11+
## Prerequisites
12+
13+
- Go installed on your machine.
14+
- Git installed and accessible from your command line.
15+
16+
## Configuration
17+
18+
The program relies on a JSON file (`_automation/grammars.json`) for the list of grammars to manage. Each grammar should specify its `language`, `url`, `files`, `reference` (tag or branch), and `revision` (commit hash).
19+
20+
Example structure of `grammars.json`:
21+
22+
```json
23+
[
24+
{
25+
"language": "golang",
26+
"url": "https://github.com/tree-sitter/tree-sitter-go",
27+
"files": [
28+
"parser.c"
29+
],
30+
"reference": "master",
31+
"revision": "64457ea6b73ef5422ed1687178d4545c3e91334a",
32+
"updatedBasedOn": "commit", //OPTIONAL: Use "tag" (instead of "commit") to restrict updates to the latest tag and not latest commit
33+
}
34+
]
35+
```
36+
37+
`updatedBasedOn` is an OPTIONAL property. If not provided, updating from the latest commit will be presumed.
38+
39+
## Usage
40+
41+
### To Check for Updates
42+
43+
```bash
44+
go run ./_automation/main.go check-updates
45+
```
46+
47+
### To update a specific grammar
48+
```bash
49+
go run ./_automation/main.go update <language> [--force]
50+
```
51+
52+
### To update all grammars
53+
```bash
54+
go run ./_automation/main.go update-all
55+
```
56+
57+
## Test After Updating
58+
Once you've updated a grammar, it is important to test that the binding tests still pass (`binding_test.go`). Then run:
59+
60+
```bash
61+
go test -v ./...
62+
```

0 commit comments

Comments
 (0)