Skip to content

Cirru/writer.go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cirru Writer

Format Cirru AST into intented format.

GoDoc

Usage

// import "github.com/Cirru/writer"
// import "github.com/Cirru/json-loader"

content, _ := ioutil.ReadFile(filename)
tree := loader.ParseText(content)
return MakeCode(tree)

Read GoDoc for details.

Rules

  • short expressions are inlined with parentheses
a (b c)
  • complicated ones may need to start in new lines
a
  b (c d)
  e f
  • last item in expression can be appended with $
a $ b $ c d
  • only first pair of parentheses are suggested in the same line
a (b c)
  d e
  • use , to simplify structures
a
  b c
  , d
  e f
  • start new lines when theres too many parameters(not yet)
a b c d
  , e f g h
  , i j k
  • add empty lines between top-level expressions
a

b

License

MIT