https://github.com/klauer/lark-formatter
A quick attempt at a Lark-parser grammar formatter
https://github.com/klauer/lark-formatter
Last synced: about 1 month ago
JSON representation
A quick attempt at a Lark-parser grammar formatter
- Host: GitHub
- URL: https://github.com/klauer/lark-formatter
- Owner: klauer
- Created: 2021-07-21T22:45:52.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-07-27T00:45:17.000Z (almost 5 years ago)
- Last Synced: 2025-12-26T15:13:41.899Z (5 months ago)
- Language: Python
- Size: 4.88 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
lark-formatter
==============
Simple attempt at a lark-parser grammar formatter, using Lark to lex the
grammar.
Installation
------------
Requires:
* Python 3.7+
* lark-parser
```bash
$ pip install .
```
Usage
-----
```bash
$ lark-formatter input_grammar.lark
$ cat input_grammar.lark | lark-formatter
```
Or in vim, to format part of a buffer, make a visual selection and then:
```
:!lark-format
```
(vim will automatically insert ``:'<,'>`` at the front, indicating the visual
selection region)
Notes
-----
* Likely will not work on everything
* No guarantees it won't mess up your grammar. Make sure it's
version-controlled first!
* ``->`` aliases are not aligned
* Spacing between comments and sections could use work
* ``check`` tool probably isn't good enough yet