================================================================================
Simple variable assignment
================================================================================

var foo = null

--------------------------------------------------------------------------------

(program
  (statement
    (variableDeclaration
      (identifier)
      (nullLiteral))))

================================================================================
Simple string assignment
================================================================================

var foo = 'aaa'

--------------------------------------------------------------------------------

(program
  (statement
    (variableDeclaration
      (identifier)
      (string
        (stringLiteral)))))

================================================================================
Empty string assignment
================================================================================

var foo = ''

--------------------------------------------------------------------------------

(program
  (statement
    (variableDeclaration
      (identifier)
      (string))))

================================================================================
String escape sequence
================================================================================

var foo = 'a\'a'

--------------------------------------------------------------------------------

(program
  (statement
    (variableDeclaration
      (identifier)
      (string
        (stringLiteral)
        (escapeSequence)
        (stringLiteral)))))

================================================================================
Multiline string assignment
================================================================================

var foo = '''aaa'''

--------------------------------------------------------------------------------

(program
  (statement
    (variableDeclaration
      (identifier)
      (string
        (stringLiteral)))))

================================================================================
Object assignment
================================================================================

var foo = {
  name: 'hello'
  location: true
}

--------------------------------------------------------------------------------

(program
  (statement
    (variableDeclaration
      (identifier)
      (object
        (objectProperty
          (identifier)
          (string
            (stringLiteral)))
        (objectProperty
          (identifier)
          (booleanLiteral))))))

================================================================================
For loop
================================================================================

resource sa 'Microsoft.Storage/storageAccounts@2019-06-01' = [for storageName in storageAccounts: {
  name: storageName
  location: location
  sku: {
    name: storageSKU
  }
  kind: 'StorageV2'
  properties: {
    supportsHttpsTrafficOnly: true
  }
}]

--------------------------------------------------------------------------------

(program
  (statement
    (resourceDeclaration
      (identifier)
      (string
        (stringLiteral))
      (for
        (localVariable
          (identifier))
        (variableAccess
          (identifier))
        (object
          (objectProperty
            (identifier)
            (variableAccess
              (identifier)))
          (objectProperty
            (identifier)
            (variableAccess
              (identifier)))
          (objectProperty
            (identifier)
            (object
              (objectProperty
                (identifier)
                (variableAccess
                  (identifier)))))
          (objectProperty
            (identifier)
            (string
              (stringLiteral)))
          (objectProperty
            (identifier)
            (object
              (objectProperty
                (identifier)
                (booleanLiteral)))))))))

================================================================================
Numbers
================================================================================

var myVar = 123
var myVar2 = -454
var mvVar3 = 0

--------------------------------------------------------------------------------

(program
  (statement
    (variableDeclaration
      (identifier)
      (integerLiteral)))
  (statement
    (variableDeclaration
      (identifier)
      (integerLiteral)))
  (statement
    (variableDeclaration
      (identifier)
      (integerLiteral))))

================================================================================
Booleans
================================================================================

var myVar = false
var myVar2 = true

--------------------------------------------------------------------------------

(program
  (statement
    (variableDeclaration
      (identifier)
      (booleanLiteral)))
  (statement
    (variableDeclaration
      (identifier)
      (booleanLiteral))))

================================================================================
Arrays
================================================================================

var myArray = [
  5983
  3923
  -241
]

var myEmptyArray = [
]

var myMixedArray = [
  myVariable
  'hello!'
  true
  1255
]

--------------------------------------------------------------------------------

(program
  (statement
    (variableDeclaration
      (identifier)
      (array
        (arrayItem
          (integerLiteral))
        (arrayItem
          (integerLiteral))
        (arrayItem
          (integerLiteral)))))
  (statement
    (variableDeclaration
      (identifier)
      (array)))
  (statement
    (variableDeclaration
      (identifier)
      (array
        (arrayItem
          (variableAccess
            (identifier)))
        (arrayItem
          (string
            (stringLiteral)))
        (arrayItem
          (booleanLiteral))
        (arrayItem
          (integerLiteral))))))

================================================================================
Nested resource
================================================================================
resource privateEndpoint 'Microsoft.Network/privateEndpoints@2020-06-01' = {
  resource privateDNSZoneGroup 'privateDnsZoneGroups' = {
    name: 'dnsgroupname'
  }
}

--------------------------------------------------------------------------------

(program
  (statement
    (resourceDeclaration
      (identifier)
      (string
        (stringLiteral))
      (object
        (resourceDeclaration
          (identifier)
          (string
            (stringLiteral))
          (object
            (objectProperty
              (identifier)
              (string
                (stringLiteral)))))))))

================================================================================
Function call on property
================================================================================

var a = storageAccountVulnerabilityAssessments.listKeys().foo

--------------------------------------------------------------------------------

(program
  (statement
    (variableDeclaration
      (identifier)
      (propertyAccess
        (functionCall
          (propertyAccess
            (variableAccess
              (identifier))
            (identifier)))
        (identifier)))))

================================================================================
Unicode escape sequence
================================================================================

var surrogate_codepoint = '\u{10437}'

--------------------------------------------------------------------------------

(program
  (statement
    (variableDeclaration
      (identifier)
      (string
        (escapeSequence)))))

================================================================================
Multiline string with quote
================================================================================

var foo = '''hello'world'''

--------------------------------------------------------------------------------

(program
  (statement
    (variableDeclaration
      (identifier)
      (string
        (stringLiteral)))))

================================================================================
String containing dollar
================================================================================

var foo = 'about $3 fiddy'

--------------------------------------------------------------------------------

(program
  (statement
    (variableDeclaration
      (identifier)
      (string
        (stringLiteral)))))

================================================================================
String starting with dollar
================================================================================

var foo = '$3 fiddy'

--------------------------------------------------------------------------------

(program
  (statement
    (variableDeclaration
      (identifier)
      (string
        (stringLiteral)))))

================================================================================
String ending with dollar
================================================================================

var foo = 'mucho $'

--------------------------------------------------------------------------------

(program
  (statement
    (variableDeclaration
      (identifier)
      (string
        (stringLiteral)))))

================================================================================
String in interpolation
================================================================================

var stringInString = 'abc${'def'}'

--------------------------------------------------------------------------------

(program
  (statement
    (variableDeclaration
      (identifier)
      (string
        (stringLiteral)
        (string
          (stringLiteral))))))

================================================================================
Four quotes
================================================================================

var multilineExtraQuotes = ''''abc''''

--------------------------------------------------------------------------------

(program
  (statement
    (variableDeclaration
      (identifier)
      (string
        (stringLiteral)))))

================================================================================
String literal with starting comment
================================================================================

var a = '/*'

--------------------------------------------------------------------------------

(program
  (statement
    (variableDeclaration
      (identifier)
      (string
        (stringLiteral)))))

================================================================================
Multiline string literal with starting comment
================================================================================

var a = '''/*'''

--------------------------------------------------------------------------------

(program
  (statement
    (variableDeclaration
      (identifier)
      (string
        (stringLiteral)))))

================================================================================
Mixed array
================================================================================


var a = [
    true
    [
      'inner'
      false
    ]
  ]

--------------------------------------------------------------------------------

(program
  (statement
    (variableDeclaration
      (identifier)
      (array
        (arrayItem
          (booleanLiteral))
        (arrayItem
          (array
            (arrayItem
              (string
                (stringLiteral)))
            (arrayItem
              (booleanLiteral))))))))

================================================================================
Nested resource accessor
================================================================================

resource myParent 'My.Rp/parentType@2020-01-01' = {
  name: 'myParent'
  location: 'West US'

  // declares a nested resource inside 'myParent'
  resource myChild 'childType' = {
    name: 'myChild'
    properties: {
      displayName: 'Child Resource'
    }
  }

  // 'myChild' can be referenced inside the body of 'myParent'
  resource mySibling 'childType' = {
    name: 'mySibling'
    properties: {
      displayName: 'Sibling of ${mychild.properties.displayName}'
    }
  }
}

// accessing 'myChild' here requires the resource access operator
output displayName string = myParent::myChild.properties.displayName

--------------------------------------------------------------------------------

(program
  (statement
    (resourceDeclaration
      (identifier)
      (string
        (stringLiteral))
      (object
        (objectProperty
          (identifier)
          (string
            (stringLiteral)))
        (objectProperty
          (identifier)
          (string
            (stringLiteral)))
        (comment)
        (resourceDeclaration
          (identifier)
          (string
            (stringLiteral))
          (object
            (objectProperty
              (identifier)
              (string
                (stringLiteral)))
            (objectProperty
              (identifier)
              (object
                (objectProperty
                  (identifier)
                  (string
                    (stringLiteral)))))))
        (comment)
        (resourceDeclaration
          (identifier)
          (string
            (stringLiteral))
          (object
            (objectProperty
              (identifier)
              (string
                (stringLiteral)))
            (objectProperty
              (identifier)
              (object
                (objectProperty
                  (identifier)
                  (string
                    (stringLiteral)
                    (propertyAccess
                      (propertyAccess
                        (variableAccess
                          (identifier))
                        (identifier))
                      (identifier)))))))))))
  (comment)
  (statement
    (outputDeclaration
      (identifier)
      (type
        (identifier))
      (propertyAccess
        (propertyAccess
          (resourceAccess
            (variableAccess
              (identifier))
            (identifier))
          (identifier))
        (identifier)))))
