#simplify

-- empty.input --
-- out/format/empty.golden --

-- comments.input --
// Package line 1 group 1
// Package line 2 group 1

// Package line 1 - group 2
// Package line 2 - group 2
package comments

// Emit line 1 group 1

// Emit line 1 group 2
// Emit line 2 group 2
{
    // Inside Emit
}

a: 3 // a line comment

b: 4 // line comment that is last in the file.
cc: 555 // align comments

// don't simplify
a: {
    b: 2
}

// simplify
a: {
    b: c: {
        d: 1
    }
}

// unchanged
a: b: [1]

// don't simplify
a: b: {
    c: 2
}

// rewrite okay
a: b: c: {
    d: 2
}

m: {
}
m: {
    // empty with comment
}

// Issue #478
struct1: {
    // This is a comment

    // This is a comment

    // Another comment

    something: {
    }
    // extra comment
}

struct2: {
    // This is a comment

    // This is a comment

    // Another comment
    something: {
    }

    // extra comment
}

list1: [
    // Comment1

    // Comment2

    // Another comment
    {
    },

    // Comment 3
]

list2: [
    // foo
]

list3: [
    // foo

    // bar
]

list4: [
  1, // number
  a.b, // selector
  (a), // paren
  +1, // unary
  a[0], // index
  a[2:3],  // slice
  strings.Sort([1, 2]), // call

  a.b,
  // under selector

  a.b,
  // multiple
  // under

  // selector
]

funcArg1: foo(
    // Comment1

    // Comment2
    3

    // Comment3
)

funcArg2: foo(
    // Comment1

    // Comment2

    3
    // Comment3
)

funcArg3: foo(
    2,

    // Comment1

    // Comment2
    3

    // Comment3
)

//	comment including		some tabs


// issue #2567
foo: [
 	bar["baz"], //some comment
]

[
	if true // inline comment
	{}]

{
    // comments
    ... // surrounding

    // an ellipsis

    foo: {
        // some
        [string]: _ // comment
    }
}
-- out/format/comments.golden --
// Package line 1 group 1
// Package line 2 group 1

// Package line 1 - group 2
// Package line 2 - group 2
package comments

// Emit line 1 group 1

// Emit line 1 group 2
// Emit line 2 group 2
{
	// Inside Emit
}

a: 3 // a line comment

b:  4   // line comment that is last in the file.
cc: 555 // align comments

// don't simplify
a: {
	b: 2
}

// simplify
a: {
	b: c: d: 1
}

// unchanged
a: b: [1]

// don't simplify
a: b: c: 2

// rewrite okay
a: b: c: d: 2

m: {}
m: {
	// empty with comment
}

// Issue #478
struct1: {
	// This is a comment

	// This is a comment

	// Another comment

	something: {}
	// extra comment
}

struct2: {
	// This is a comment

	// This is a comment

	// Another comment
	something: {}

	// extra comment
}

list1: [
	// Comment1

	// Comment2

	// Another comment
	{},

	// Comment 3
]

list2: [
	// foo
]

list3: [
	// foo

	// bar
]

list4: [
	1,                    // number
	a.b,                  // selector
	(a),                  // paren
	+1,                   // unary
	a[0],                 // index
	a[2:3],               // slice
	strings.Sort([1, 2]), // call

	a.b,
	// under selector

	a.b,
	// multiple
	// under

	// selector
]

funcArg1: foo(
		// Comment1

	// Comment2
	3,

	// Comment3
	)

funcArg2: foo(
		// Comment1

	// Comment2

	3,
	// Comment3
	)

funcArg3: foo(
		2,

	// Comment1

	// Comment2
	3,

	// Comment3
	)

//	comment including		some tabs

// issue #2567
foo: [
	bar["baz"], //some comment
]

[
	if true {}, // inline comment
]

{

	foo: {
		// some
		... // comment
	}
	// comments
	... // surrounding

	// an ellipsis
}
-- comment_alone.input --
// Just one comment on its own.
-- out/format/comment_alone.golden --
// Just one comment on its own.
-- comment_field.input --
// Just one comment on a field.
foo: string
-- out/format/comment_field.golden --
// Just one comment on a field.
foo: string
-- comments_alone.input --
// Just a few comments
// on their own.
-- out/format/comments_alone.golden --
// Just a few comments
// on their own.
-- comments_field.input --
// Just a few comments
// on a field.
foo: string
-- out/format/comments_field.golden --
// Just a few comments
// on a field.
foo: string
