$ check main
= 0
stacks 0
fn lib.pick none
fn lib.pick2 none
$ fmt
= 0
lang/test/tree_order/bare.g
lang/test/tree_order/beside.g
lang/test/tree_order/blank.g
lang/test/tree_order/group.g
lang/test/tree_order/lib.g
lang/test/tree_order/lone.g
lang/test/tree_order/tabs.g
$ fmt lang/test/tree_order/lib.g
= 0
-- lib: the comment lines at the top of a file, ended by an empty line,
-- are the namespace's.
--
-- An empty comment line is a paragraph's end, not the comment's.

-- A second comment that an empty line ends is free as well: a heading for
-- the definitions after it, kept where it was written.

-- A comment a definition follows on the next line is that definition's.
fn pick n int -> int = pick2 n

fn pick2 n int -> int = n - LIMIT

-- A free comment between two definitions stays between them.

type Pair = rec a int, b int

const LIMIT int = 3

-- A comment after the last definition is free too, and stays at the end.
$ fmt lang/test/tree_order/bare.g
= 0
-- With no empty line after it, a comment at the top is the first
-- definition's, as before every definition, and the definitions stay in
-- the order they were written in.
fn zed -> int = 1

fn alpha -> int = 2
$ fmt lang/test/tree_order/only.g
= 0
-- only: a file of comments alone is its namespace's comment.
$ fmt lang/test/tree_order/empty.g
= 0
--

-- A lone "--" at the top is the namespace's comment, an empty one, so
-- this comment is a heading and not the namespace's.

fn one -> int = 1
$ fmt lang/test/tree_order/lone.g
= 0
fn two -> int = 2
$ fmt lang/test/tree_order/blank.g
= 0
--

-- An empty comment at the top that is kept is written as one line.

fn three -> int = 3
$ fmt lang/test/tree_order/beside.g
= 0
-- A comment beside the ";" goes on over the lines
-- directly under it when an empty line ends them.
const KEY_UP int = 1

-- Without the empty line the next line
const KEY_DOWN int = 0

-- is the next definition's.
-- An empty line after this one frees nothing.
const KEY_NONE int = 2

fn key -> int = KEY_UP + KEY_DOWN + KEY_NONE
$ fmt lang/test/tree_order/tabs.g
= 0
-- A tab parts the dashes from the text as a space does.
--  	After the one that parts them, spaces and tabs are the text's.
-- no space at all
--
fn tabbed -> int = 1
$ fmt lang/test/tree_order/group.g
= 0
fn b -> int = 2

type Kind = rec kind u32

const LINE_ID u32 = 2
const NODE_INPUT u32 = 2

-- A comment parts its definition from both neighbours.
const NODE_RECT u32 = 2

const NODE_TEXT u32 = 4
const NODE_ZED u32 = 5

type Wide = rec
  first u32,
  second u32,
  third u32,
  fourth u32

fn a -> int = 1

fn c -> int = {
  let one = 1
  let two = 2
  let three = 3
  let four = 4
  let five = 5
  return one + two + three + four + five
}

fn d -> int = 4
$ fmt lang/test/tree_order/none.g
= 2
lang: no file lang/test/tree_order/none.g in the tree
$ fmt lib.pick
= 0
-- A comment a definition follows on the next line is that definition's.
fn pick n int -> int = pick2 n
