Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Pizzaandy/Gobo
Gobo is an opinionated code formatter for GameMaker Language.
https://github.com/Pizzaandy/Gobo
Last synced: 2 months ago
JSON representation
Gobo is an opinionated code formatter for GameMaker Language.
- Host: GitHub
- URL: https://github.com/Pizzaandy/Gobo
- Owner: Pizzaandy
- License: mit
- Created: 2023-06-06T03:01:57.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-03-28T05:46:28.000Z (9 months ago)
- Last Synced: 2024-05-21T13:38:34.414Z (8 months ago)
- Language: C#
- Homepage: https://pizzaandy.github.io/Gobo/
- Size: 615 MB
- Stars: 19
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-gamemaker - Gobo - An opinionated code formatter for GML. (Debugging / Recommendations)
README
## Gobo: GML Formatter
[Try the formatter here!](https://pizzaandy.github.io/Gobo/)
Gobo is an opinionated formatter for GameMaker Language. It enforces a consistent style by parsing and re-printing your code with its own rules, taking maximum line length into account.
By using Gobo, you agree to cede control over the nitty-gritty details of formatting. In return, Gobo gives you speed, determinism, and smaller git diffs. End style debates with your team and save mental energy for what's important!
Gobo provides a few basic formatting options and has no plans to add more. It follows the [Option Philosophy](https://prettier.io/docs/en/option-philosophy.html) of Prettier.
### Input
```js
x = a and b or c a=0xFG=1 var var var i := 0
do begin
;;;;show_debug_message(i)
;;;;++constructor
end until not constructor < 10 returncall()
```### Output
```js
x = a && b || c;
a = 0xF;
G = 1;
var i = 0;
do {
show_debug_message(i);
++constructor;
} until (!constructor < 10)
return call();
```## How does it work?
Gobo is written in C# and compiles to a self-contained binary using Native AOT in .NET 8.Gobo uses a custom GML parser to read your code and ensure that formatted code is equivalent to the original. The parser is designed to only accept valid GML (with a few exceptions) to ensure correctness. There is no officially-documented format for GML's syntax tree, so Gobo uses a format similar to JavaScript parsers.
Gobo converts your code into an intermediate "Doc" format to make decisions about wrapping lines and printing comments. The doc printing algorithm is taken from [CSharpier](https://github.com/belav/csharpier), which is itself adapted from Prettier.
## Limitations
Gobo cannot parse code that relies on macro expansion to be valid. Any standalone expression will be formatted with a semicolon, even if the expression is a macro.
```js
THESE_MACROS;
ARE.VALID;
BECAUSE_THEY_ARE_EXPRESSIONS()
```