==============================================
Simple import statement
==============================================

import { foo } from './bar.bicep'

---

(infrastructure
  (import_functionality
    (identifier)
    (string
      (string_content))))

==============================================
Simple alias import statement
==============================================

import { foo as bar } from './bar.bicep'

---

(infrastructure
  (import_functionality
    (identifier)
    (identifier)
    (string
      (string_content))))

==============================================
Simple wildcard import statement
==============================================

import * as bar from './bar.bicep'

---

(infrastructure
  (import_functionality
    (identifier)
    (string
      (string_content))))

==============================================
Simple provider import
==============================================

provider 'sys@1.0.0'

---

(infrastructure
  (import_statement
    (string
      (string_content))))

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

var foo = null

---

(infrastructure
  (variable_declaration
    (identifier)
    (null)))

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

var foo = 'aaa'

---

(infrastructure
  (variable_declaration
    (identifier)
    (string
      (string_content))))

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

var foo = ''

---

(infrastructure
  (variable_declaration
    (identifier)
    (string)))

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

var foo = 'a\'a'

---

(infrastructure
  (variable_declaration
    (identifier)
    (string
      (string_content)
      (escape_sequence)
      (string_content))))

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

var foo = '''aaa'''

---

(infrastructure
  (variable_declaration
    (identifier)
    (string
      (string_content))))

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

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

---

(infrastructure
  (variable_declaration
    (identifier)
    (object
      (object_property
        (identifier)
        (string
          (string_content)))
      (object_property
        (identifier)
        (boolean)))))

==============================================
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
  }
}]

---

(infrastructure
  (resource_declaration
    (identifier)
    (string
      (string_content))
    (for_statement
      (identifier)
      (identifier)
      (object
        (object_property
          (identifier)
          (identifier))
        (object_property
          (identifier)
          (identifier))
        (object_property
          (identifier)
          (object
            (object_property
              (identifier)
              (identifier))))
        (object_property
          (identifier)
          (string
            (string_content)))
        (object_property
          (identifier)
          (object
            (object_property
              (identifier)
              (boolean))))))))

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

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

---

(infrastructure
  (variable_declaration
    (identifier)
    (number))
  (variable_declaration
    (identifier)
    (number))
  (variable_declaration
    (identifier)
    (number)))

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

var myVar = false
var myVar2 = true

---

(infrastructure
  (variable_declaration
    (identifier)
    (boolean))
  (variable_declaration
    (identifier)
    (boolean)))

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

var myArray = [
  5983
  3923
  -241
]

var myEmptyArray = [
]

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

---

(infrastructure
  (variable_declaration
    (identifier)
    (array
      (number)
      (number)
      (number)))
  (variable_declaration
    (identifier)
    (array))
  (variable_declaration
    (identifier)
    (array
      (identifier)
      (string
        (string_content))
      (boolean)
      (number))))

==============================================
Nested resource
==============================================

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

---

(infrastructure
  (resource_declaration
    (identifier)
    (string
      (string_content))
    (object
      (object_property
        (resource_declaration
          (identifier)
          (string
            (string_content))
          (object
            (object_property
              (identifier)
              (string
                (string_content)))))))))

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

var a = storageAccountVulnerabilityAssessments.listKeys().foo

---

(infrastructure
  (variable_declaration
    (identifier)
    (member_expression
      (call_expression
        (member_expression
          (identifier)
          (property_identifier))
        (arguments))
      (property_identifier))))

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

var surrogate_codepoint = '\u{10437}'

---

(infrastructure
  (variable_declaration
    (identifier)
    (string
      (escape_sequence))))

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

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

---

(infrastructure
  (variable_declaration
    (identifier)
    (string
      (string_content))))

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

var foo = 'about $3 fiddy'

---

(infrastructure
  (variable_declaration
    (identifier)
    (string
      (string_content)
      (string_content)
      (string_content))))

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

var foo = '$3 fiddy'

---

(infrastructure
  (variable_declaration
    (identifier)
    (string
      (string_content)
      (string_content))))

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

var foo = 'mucho $'

---

(infrastructure
  (variable_declaration
    (identifier)
    (string
      (string_content)
      (string_content))))

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

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

---

(infrastructure
  (variable_declaration
    (identifier)
    (string
      (string_content)
      (interpolation
        (string
          (string_content))))))

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

var a = '/*'

---

(infrastructure
  (variable_declaration
    (identifier)
    (string
      (string_content))))

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

var a = '''/*'''

---

(infrastructure
  (variable_declaration
    (identifier)
    (string
      (string_content))))

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

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

---

(infrastructure
  (variable_declaration
    (identifier)
    (array
      (boolean)
      (array
        (string
          (string_content))
        (boolean)))))

==============================================
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

---

(infrastructure
  (resource_declaration
    (identifier)
    (string
      (string_content))
    (object
      (object_property
        (identifier)
        (string
          (string_content)))
      (object_property
        (identifier)
        (string
          (string_content)))
      (comment)
      (object_property
        (resource_declaration
          (identifier)
          (string
            (string_content))
          (object
            (object_property
              (identifier)
              (string
                (string_content)))
            (object_property
              (identifier)
              (object
                (object_property
                  (identifier)
                  (string
                    (string_content))))))))
      (comment)
      (object_property
        (resource_declaration
          (identifier)
          (string
            (string_content))
          (object
            (object_property
              (identifier)
              (string
                (string_content)))
            (object_property
              (identifier)
              (object
                (object_property
                  (identifier)
                  (string
                    (string_content)
                    (interpolation
                      (member_expression
                        (member_expression
                          (identifier)
                          (property_identifier))
                        (property_identifier))))))))))))
  (comment)
  (output_declaration
    (identifier)
    (type
      (primitive_type))
    (member_expression
      (member_expression
        (resource_expression
          (identifier)
          (identifier))
        (property_identifier))
      (property_identifier))))
