# Simple commant

// hello world
class A {}

==>

Specification(
    Comment
    Whitespace
    ClassDeclaration(
        class
        Whitespace
        Identifier
        Whitespace
        OpenBrace
        CloseBrace
    )
)

# Leading and trailing comments

// hello
class A {// world
}// again

==>

Specification(
    Comment
    Whitespace
    ClassDeclaration(
        class
        Whitespace
        Identifier
        Whitespace
        OpenBrace
        Comment
        Whitespace
        CloseBrace
    )
    Comment
)


# More leading and trailing comments

class A{// trailing 1
i++;// trailing 2
//leading 1
N=N+// trailing 3
1;}
// trailing 4

==>

Specification(
    ClassDeclaration(
        class
        Whitespace
        Identifier
        OpenBrace
        Comment
        Whitespace
        ExpressionStatement(
            UnaryExpression(
                UnaryExpression(
                    Identifier
                )
                PostfixIncrement
            )
            Semicolon
        )
        Comment
        Whitespace
        Comment
        Whitespace
        ExpressionStatement(
            AssignmentExpression(
                UnaryExpression(
                    Identifier
                )
                Assignment
                BinaryExpression(
                    UnaryExpression(
                        Identifier
                    )
                    Addition
                    Comment
                    Whitespace
                    UnaryExpression(
                        IntegerLiteral
                    )
                )
            )
            Semicolon
        )
        CloseBrace
    )
    Whitespace
    Comment
)


# Multiple comments

class A {}
// hello
// world

==>

Specification(
    ClassDeclaration(
        class
        Whitespace
        Identifier
        Whitespace
        OpenBrace
        CloseBrace
    )
    Whitespace
    Comment
    Whitespace
    Comment
)


# Multiple comments and whitespace

// hello

// world

class A {}

==>

Specification(
    Comment
    Whitespace
    Comment
    Whitespace
    ClassDeclaration(
        class
        Whitespace
        Identifier
        Whitespace
        OpenBrace
        CloseBrace
    )
)


# Comment within comment

// hello // world
class A {}

==>

Specification(
    Comment
    Whitespace
    ClassDeclaration(
        class
        Whitespace
        Identifier
        Whitespace
        OpenBrace
        CloseBrace
    )
)

# Comment at end of line

class A {} // hello

==>

Specification(
    ClassDeclaration(
        class
        Whitespace
        Identifier
        Whitespace
        OpenBrace
        CloseBrace
    )
    Whitespace
    Comment
)

# Comment within syntax element

class A {i // hello
;}

==>

Specification(
    ClassDeclaration(
        class
        Whitespace
        Identifier
        Whitespace
        OpenBrace
        ExpressionStatement(
            UnaryExpression(
                Identifier
            )
            Whitespace
            Comment
            Whitespace
            Semicolon
        )
        CloseBrace
    )
)

# Comment within unary expression syntax element

class A {i++// comment
;}

==>

Specification(
    ClassDeclaration(
        class
        Whitespace
        Identifier
        Whitespace
        OpenBrace
        ExpressionStatement(
            UnaryExpression(
                UnaryExpression(
                    Identifier
                )
                PostfixIncrement
            )
            Comment
            Whitespace
            Semicolon
        )
        CloseBrace
    )
)

# Comment within binary expression does not appear as child of BinaryExpression

class A{N-
1//comment comment comment
;}

==>

Specification(
    ClassDeclaration(
        class
        Whitespace
        Identifier
        OpenBrace
        ExpressionStatement(
            BinaryExpression(
                UnaryExpression(
                    Identifier
                )
                Subtraction
                Whitespace
                UnaryExpression(
                    IntegerLiteral
                )
            )
            Comment
            Whitespace
            Semicolon
        )
        CloseBrace
    )
)

# Comment within binary expression slightly shorter

class A{N-
1//comment comment commen
;}

==>

Specification(
    ClassDeclaration(
        class
        Whitespace
        Identifier
        OpenBrace
        ExpressionStatement(
            BinaryExpression(
                UnaryExpression(
                    Identifier
                )
                Subtraction
                Whitespace
                UnaryExpression(
                    IntegerLiteral
                )
            )
            Comment
            Whitespace
            Semicolon
        )
        CloseBrace
    )
)

# Leading comment

class A{
  // Le lorem ipsum est, en imprimerie, une suite de mots sans signification utilisée
}

==>

Specification(
    ClassDeclaration(
        class
        Whitespace
        Identifier
        OpenBrace
        Whitespace
        Comment
        Whitespace
        CloseBrace
    )
)
