{"id":32939283,"url":"https://github.com/gap-system/tree-sitter-gap","last_synced_at":"2025-11-12T07:31:23.869Z","repository":{"id":141750277,"uuid":"229478685","full_name":"gap-system/tree-sitter-gap","owner":"gap-system","description":"GAP grammar for tree-sitter","archived":false,"fork":false,"pushed_at":"2025-04-08T14:58:40.000Z","size":1019,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-08T15:48:06.793Z","etag":null,"topics":["gap","parser","syntax-highlighting","tree-sitter"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gap-system.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-12-21T20:19:03.000Z","updated_at":"2025-04-08T14:58:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"c2040b50-e888-4714-874c-af340067f16f","html_url":"https://github.com/gap-system/tree-sitter-gap","commit_stats":null,"previous_names":["gap-system/tree-sitter-gap","fingolfin/tree-sitter-gap"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/gap-system/tree-sitter-gap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gap-system%2Ftree-sitter-gap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gap-system%2Ftree-sitter-gap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gap-system%2Ftree-sitter-gap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gap-system%2Ftree-sitter-gap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gap-system","download_url":"https://codeload.github.com/gap-system/tree-sitter-gap/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gap-system%2Ftree-sitter-gap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":283997630,"owners_count":26929852,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-12T02:00:06.336Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gap","parser","syntax-highlighting","tree-sitter"],"created_at":"2025-11-12T07:31:23.033Z","updated_at":"2025-11-12T07:31:23.863Z","avatar_url":"https://github.com/gap-system.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tree-sitter-gap\n\n![CI](https://github.com/gap-system/tree-sitter-gap/actions/workflows/ci.yml/badge.svg)\n\n[tree-sitter](https://github.com/tree-sitter/tree-sitter) grammar for [GAP system](https://www.gap-system.org/) files.\n\n## Example\n\n![Example of a parse tree generated with `tree-sitter-gap`](image-example-parse.svg)\n\nThe above is a parse tree generated using the `tree-sitter-gap` grammar for the following code snippet:\n\n```gap\nG := Group((1, 2, 3), (1, 2)(3, 4));\nIsNormal(SymmetricGroup(4), G);\n```\n\n## Installing for use with editors\n\nSee the [`tree-sitter-gap` wiki](https://github.com/gap-system/tree-sitter-gap/wiki/Using-the-grammar-with-editors)\npage for information on installing the grammar for syntax highlighting in neovim and other editors.\n\n## Want to help improve this?\n\n- Install `tree-sitter` (version \u003e= 0.22.2), [official instructions](https://tree-sitter.github.io/tree-sitter/creating-parsers#installation);\n- Read [\"how to create a parser\"](https://tree-sitter.github.io/tree-sitter/creating-parsers);\n- Resolve the TODOs in source and test files;\n- Add more missing language features;\n- Validate by running on the whole `GAP` library and on packages, see [Tests](#tests) section below.\n\nFiles to edit are\n\n- `grammar.js`, the main file defining the grammar, [documentation](https://tree-sitter.github.io/tree-sitter/creating-parsers#the-grammar-dsl);\n- `src/scanner.c`, an external scanner used for scanning tokens that are not\n  easily recognized by the built in rules, [documentation](https://tree-sitter.github.io/tree-sitter/creating-parsers#external-scanners);\n- `tests/corpus/*.txt`, test files containing annotated syntax trees used to\n  validate the grammar, ideally a test case should be added here prior to\n  changing the `grammar.js` or `scanner.c` files, [documentation](https://tree-sitter.github.io/tree-sitter/creating-parsers#command-test);\n- `queries/*.scm`, queries used for syntax highlighting etc, [documentation](https://tree-sitter.github.io/tree-sitter/syntax-highlighting#queries);\n- `tests/highlight/*`, tests for syntax highlighting, [documentation](https://tree-sitter.github.io/tree-sitter/syntax-highlighting#unit-testing);\n- `examples/*`, assortment of various example `gap` files, also used to store `GAP` library and package corpus for tests, see [Tests](#tests) below.\n\nAlmost everything else was generated automatically by `tree-sitter generate`.\n\nBits of the `GAP` syntax are documented in [Chapter 4](https://docs.gap-system.org/doc/ref/chap4_mj.html) of the GAP manual.\nA more in-depth look at the `GAP` grammar can be obtained by studying the `GAP-system` source files, especially\n\n- [`read.c`](https://github.com/gap-system/gap/blob/master/src/read.c) for parsing keywords and high level language constructs;\n- [`scanner.c`](https://github.com/gap-system/gap/blob/master/src/scanner.c) for matters relating to scanning literals and identifiers;\n- [`io.c`](https://github.com/gap-system/gap/blob/master/src/io.c) for handling whitespace and line continuation characters.\n\n## Tests\n\nTo run syntax tree and highlighting tests run\n\n```\nmake test_quick\n```\n\nnote that highlighting tests will only be run once all syntax tree tests pass.\n\nTo run tests against the `GAP` library and `GAP` package corpus do\n\n```\nmake corpus \u0026\u0026 make test_all\n```\n\nthe first command will checkout a copy of\n[`GAP`](https://github.com/gap-system/gap) and download a package archive, then\nrecursively copy `GAP` files into the appropriate `examples/` subdirectory. The\nsecond command will then parse each of these files using the `tree-sitter`\ngrammar. The output of `make test_all` is a list of `GAP` files that the\ngrammar fails to parse, along with some statistics on failing and succeeding\nparses.\n\n## Troubleshooting\n\n### Issues finding grammar in external tools\n\nTry specifying the grammar name as lowercase `gap`, instead of uppercase `GAP`.\n\n### Highlighting tests fail\n\nMake sure you are using `tree-sitter` 0.22.2 or above. A breaking change in\nhighlight group priority was introduces with version 0.22.2, which means that\nolder versions of the `tree-sitter` tool will incorrectly highlight the\nexisting test files.\n\n## Acknowledgements\n\nWriting this `tree-sitter` grammar and associated query files was made significantly easier by studying the\nexisting parsers, especially [`tree-sitter-python`](https://github.com/tree-sitter/tree-sitter-python),\n[`tree-sitter-ruby`](https://github.com/tree-sitter/tree-sitter-ruby)\nand [`tree-sitter-c`](https://github.com/tree-sitter/tree-sitter-c), from which\ncertain code snippets have been taken verbatim. We would like to thank the authors and maintainers\nof these packages.\n\n[ci]: https://img.shields.io/github/actions/workflow/status/gap-system/tree-sitter-gap/ci.yml?logo=github\u0026label=CI\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgap-system%2Ftree-sitter-gap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgap-system%2Ftree-sitter-gap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgap-system%2Ftree-sitter-gap/lists"}