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

[
  345,
  10.1,
  10,
  -10,
  null,
  true,
  false,
  { "stuff": "good" }
]

---

(document (array
  (number)
  (number)
  (number)
  (number)
  (null)
  (true)
  (false)
  (object (pair (path (string)) (value (string))))))

=====================
String content
=====================

[
  "",
  "abc",
  "def\n",
  "ghi\t",
  "jkl\f"
]

----

(document
  (array
    (string)
    (string)
    (string (escape_sequence))
    (string (escape_sequence))
    (string (escape_sequence))))

================================
Top-level object
================================

{
  "Jake": "the dog",
  "Finn" = "the human"
}

---

(document (object
  (pair (path (string)) (value (string)))
  (pair (path (string)) (value (string)))
))

================================
Top-level omit curly braces
================================

"Jake": "the dog",
"Finn" = "the human"

---

(document
  (pair (path (string)) (value (string)))
  (pair (path (string)) (value (string)))
)

================================
Omit pair separator on object
================================

{
  "Jake": {
    "the": "dog"
  },
  "Finn" {
    "the" = "human"
  }
}

---

(document (object
  (pair
    (path (string) )
    (value (object (pair (path (string)) (value (string))))))
  (pair
    (path (string) )
    (value (object (pair (path (string)) (value (string))))))
))

================================
New line and comma as pair separator
================================

"Jake": "the dog",

"Finn" = "the human"

"Marceline" : "the Vampire Queen"

---

(document
  (pair (path (string)) (value (string)))
  (pair (path (string)) (value (string)))
  (pair (path (string)) (value (string)))
)

================================
New line and comma as arr separator
================================

[ 
  Scarlet
  Root sword,
  Demon blood sword,
  Grass sword
  Finn sword
  Small sword,
  Night Sword
]

---

(document (array
  (unquoted_string)
  (unquoted_string)
  (unquoted_string)
  (unquoted_string)
  (unquoted_string)
  (unquoted_string)
  (unquoted_string)
  (unquoted_string)
  (unquoted_string)
  (unquoted_string)
  (unquoted_string)
  (unquoted_string)
  (unquoted_string)
  (unquoted_string)
))

================================
New line and comma as obj separator
================================
{
  "Jake": "the dog"
  "Finn" = "the human"

  "Marceline" : "the Vampire Queen",
}
---

(document (object
  (pair (path (string)) (value (string)))
  (pair (path (string)) (value (string)))
  (pair (path (string)) (value (string)))
))

================================
Unquoted strings
================================
{
  "Jake": the dog,
  Finn = the human
  "Marceline" : "the Vampire Queen",
  Princess.Bubblegum: [
    PB // most common
    Peebles / P-Bubs
    Bub-Bubs
    Princess Bonnibel 'Bonnie' Bubblegum # full name
  ]
}
---

(document (object
  (pair (path (string)) (value (unquoted_string) (unquoted_string)))
  (pair (path (unquoted_path)) (value (unquoted_string) (unquoted_string)))
  (pair (path (string)) (value (string)))
  (pair (path (unquoted_path)) (value (array
    (unquoted_string)
    (comment)
    (unquoted_string)
    (unquoted_string)
    (unquoted_string)
    (unquoted_string)
    (unquoted_string)
    (unquoted_string)
    (unquoted_string)
    (unquoted_string)
    (comment)
  )))
))

================================
Multiline strings
================================

"song" : """
          Come along with me
          And the butterflies and bees
          We can wander through the forest
          And do so as we please
          " $ \ \t // 
        """
"Jake": the dog,

---

(document
  (pair
    (path (string))
    (value (multiline_string)))
  (pair
    (path (string))
    (value (unquoted_string) (unquoted_string)))
)

================================
Substitutions
================================

"Jake": the ${"dog"},
Finn = [${the} hu${?ma}n]
"Marceline" : ${the Vampire Queen},

---

(document
  (pair
    (path (string))
    (value
      (unquoted_string)
      (substitution (path (string)))))
  (pair
    (path (unquoted_path))
    (value (array
      (substitution (path (unquoted_path)))
      (unquoted_string)
      (substitution (path (unquoted_path)))
      (unquoted_string)
    )))
  (pair
    (path (string))
    (value (substitution (path (unquoted_path)))))
)

================================
Top-level includes
================================

include "candy_kingdom"
Finn = the human
"Jake": the dog
include required(url("BMO's website"))

---

(document
  (include (string))
  (pair
    (path (unquoted_path))
    (value (unquoted_string) (unquoted_string)))
  (pair
    (path (string))
    (value (unquoted_string) (unquoted_string)))
  (include (string)))


================================
Includes inside object
================================

{
  Finn = the human
  include // all citizens of candy kingdom
  "candy_kingdom"
  "Jake": the dog
  include required(url("BMO's website"))
}

---

(document (object
  (pair
    (path (unquoted_path))
    (value (unquoted_string) (unquoted_string)))
  (include (comment) (string))
  (pair
    (path (string))
    (value (unquoted_string) (unquoted_string)))
  (include (string))))

===================
Multiple values in path
===================

"Fi" "nn" the human: Jake the dog

---

(document (pair
  (path (string) (string) (unquoted_path))
  (value (unquoted_string) (unquoted_string) (unquoted_string))
))

===================
Multiple values in value
===================

"Finn the human": Jake ${th "e"} "dog"

---

(document (pair
  (path (string))
  (value (unquoted_string) (substitution (path (unquoted_path) (string))) (string))
))

================================
Text from hocon playground
================================

HOCON = Human-Optimized Config Object Notation

"it's": "a JSON superset",

features: [
    less noisy / less pedantic syntax
    ability to refer to another part of the configuration
    import/include another configuration file into the current file
    a mapping to a flat properties list such as Java's system properties
    ability to get values from environment variables
    # ability to write comments
]


specs url: "https://github.com/lightbend/config/blob/master/HOCON.md"

it's: ${it's}. A ${HOCON}

Try it out: conf is parsed online as you type

---

(document
  (pair
    (path (unquoted_path))
    (value (unquoted_string) (unquoted_string) (unquoted_string) (unquoted_string)))
  (pair
    (path (string))
    (value (string)))
  (pair
    (path (unquoted_path))
    (value (array
      (unquoted_string) (unquoted_string) (unquoted_string) (unquoted_string) (unquoted_string)
      (unquoted_string) (unquoted_string) (unquoted_string) (unquoted_string) (unquoted_string)
      (unquoted_string) (unquoted_string) (unquoted_string) (unquoted_string) (unquoted_string)
      (unquoted_string) (unquoted_string) (unquoted_string) (unquoted_string) (unquoted_string)
      (unquoted_string) (unquoted_string) (unquoted_string) (unquoted_string) (unquoted_string)
      (unquoted_string) (unquoted_string) (unquoted_string) (unquoted_string) (unquoted_string)
      (unquoted_string) (unquoted_string) (unquoted_string) (unquoted_string) (unquoted_string)
      (unquoted_string) (unquoted_string) (unquoted_string) (unquoted_string) (unquoted_string)
      (unquoted_string) (unquoted_string) 
      (comment))))
  (pair
    (path (unquoted_path))
    (value (string)))
  (pair
    (path (unquoted_path))
    (value
      (substitution (path (unquoted_path)))
      (unquoted_string) (unquoted_string) 
      (substitution (path (unquoted_path)))))
  (pair
    (path (unquoted_path))
    (value 
      (unquoted_string) (unquoted_string) (unquoted_string) (unquoted_string)
      (unquoted_string) (unquoted_string) (unquoted_string)))
)

================================
Tabs instead of spaces
================================

bridges.mqtt.egress_br {
	enable = true
	direction = egress
	connector = ${connectors.mqtt.central}
}

rule_engine.rules.egress_rule {
	enable = true
	sql = """
		select * from "$bridges/mqtt:egress_br"
	"""
	actions = [{
		function = republish
		args { topic = "${topic}" }
	}]
}

---

(document
  (pair
    (path (unquoted_path))
    (value
      (object
        (pair (path (unquoted_path)) (value (true)))
        (pair (path (unquoted_path)) (value (unquoted_string)))
        (pair
          (path (unquoted_path))
          (value (substitution (path (unquoted_path))))))))
  (pair
    (path (unquoted_path))
    (value
      (object
        (pair (path (unquoted_path)) (value (true)))
        (pair (path (unquoted_path)) (value (multiline_string)))
        (pair
          (path (unquoted_path))
          (value
            (array
              (object
                (pair (path (unquoted_path)) (value (unquoted_string)))
                (pair
                  (path (unquoted_path))
                  (value
                    (object
                      (pair
                        (path (unquoted_path))
                        (value (string))))))))))))))
