Skip to content

tomjcleveland/crush

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Crush

Crush Go source files into a single line.

Lol why

Quickstart

package main

import (
	"fmt"

	"github.com/tomjcleveland/crush"
)

const helloWorld = `package main

import "fmt"

func main() {
    fmt.Println("Hello, world!")
}`

func main() {
	crushed, _ := crush.String(helloWorld)
	fmt.Println(crushed)
	// package main;import "fmt";func main() {fmt.Println("Hello, world!");};
}

API

Yeah it's pretty complicated better check the Godocs.

Aside

If you ever decided to compile a formal EBNF description using the Go Spec, you'd actually discover that pretty much nothing we would call Go conforms to this grammar, because most of us use newlines (\n) instead of semicolons (;).

The Go people sell this as a feature, which ok I guess it is, but then can't you update the frigging EBNF?

I'm working on a tool that validates code based on EBNF, but it doesn't work for Go unless I crush it first, so that's actually why I wrote this.

About

Crush Go source files into a single line.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages