# Boolean literals

true
false

==>
Program(
  BoolLiteral,
  BoolLiteral,
)


# Integer number literals

0b01
0o01234567
0123456789
123_456_789
0x0123456789_abcdef_ABCDEF

==>
Program(
  IntegerLiteral,
  IntegerLiteral,
  IntegerLiteral,
  IntegerLiteral,
  IntegerLiteral,
)


# Float number literals

0123456789.
.0123456789
0123456789.0123456789

9e10
9E-1
9f10
9f-1

.1e10
1.1e10
1.e10

0x0123456789_abcdef.ABCDEFp0
0x0123456789_abcdef_ABCDEF.p-1
0x.0123456789_abcdef_ABCDEFp1

0x1.8P3
0x0.0000000000000P+0
0x.aP-1064

==>
Program(
  FloatLiteral,
  FloatLiteral,
  FloatLiteral,
  FloatLiteral,
  FloatLiteral,
  FloatLiteral,
  FloatLiteral,
  FloatLiteral,
  FloatLiteral,
  FloatLiteral,
  FloatLiteral,
  FloatLiteral,
  FloatLiteral,
  FloatLiteral,
  FloatLiteral,
  FloatLiteral,
)


# Character literals

' '
'o'
'\t'
'\u0'
'\uffff'

==>
Program(
  CharLiteral,
  CharLiteral,
  CharLiteral,
  CharLiteral,
  CharLiteral,
)


# String literals

""
"foo
 bar"

==>
Program(
  StringLiteral,
  StringLiteral,
)


# String literals - Escape sequences

"\""
"this is a \"string\"."
"\\" # I am a comment "

==>
Program(
  StringLiteral(EscapeSequence),
  StringLiteral(EscapeSequence, EscapeSequence),
  StringLiteral(EscapeSequence),
  LineComment,
)


# String literals - Interpolations

band = "Interpol"
"$band is a cool band"
"$(2*π) is a cool number"
"cells interlinked within $("cells interlinked whithin $("cells interlinked whithin one stem")")"

==>
Program(
  Assignment(Identifier, AssignmentOp, StringLiteral),
  StringLiteral(Identifier),
  StringLiteral(ParenExpression(BinaryExpression(IntegerLiteral, TimesOp, Identifier))),
  StringLiteral(ParenExpression(StringLiteral(ParenExpression(StringLiteral)))),
)


# String literals - Assignment inside interpolation

"a $(b = c)"

==>

Program(
  StringLiteral(ParenExpression(Assignment(Identifier, AssignmentOp, Identifier))),
)


# String literals - Triple quote delimiters

"""
a "quoted" string"""
"""a $name string"""
"""a $(a + b) string"""
"""a \$name string"""

==>
Program(
  StringLiteral,
  StringLiteral(Identifier),
  StringLiteral(ParenExpression(BinaryExpression(Identifier, UnaryPlusOp, Identifier))),
  StringLiteral(EscapeSequence),
)


# Non-standard string literals

trailing_ws = r"\s+$"
version = v"1.0"
text = md"-- $(x) --"
K"\\"
r"fo*"i

==>
Program(
  Assignment(Identifier, AssignmentOp, NsStringLiteral(Identifier)),
  Assignment(Identifier, AssignmentOp, NsStringLiteral(Identifier)),
  Assignment(Identifier, AssignmentOp, NsStringLiteral(Identifier)),
  NsStringLiteral(Identifier, EscapeSequence),
  NsStringLiteral(Identifier, Identifier),
)


# Command string literals

`pwd`
m`pwd`
`cd $dir`
`echo \`cmd\``
```
echo "\033[31mred\033[m"
```
`foo $(a + b) bar`
`foo \$name bar`

==>
Program(
  CommandLiteral
  NsCommandLiteral(Identifier),
  CommandLiteral(Identifier),
  CommandLiteral(EscapeSequence, EscapeSequence),
  CommandLiteral(EscapeSequence, EscapeSequence),
  CommandLiteral(ParenExpression(BinaryExpression(Identifier, UnaryPlusOp, Identifier))),
  CommandLiteral(EscapeSequence),
)


# Comments

# line comment
#= block comment =#

x = #= inline block comment =# 1

#==#

#=
multi line comment
=#

#= nested #= block #= comments =# =# =#

==>
Program(
  LineComment
  BlockComment
  Assignment(Identifier, AssignmentOp, BlockComment, IntegerLiteral),
  BlockComment,
  BlockComment,
  BlockComment(BlockComment(BlockComment)),
)
