================================================================================
api/yamlParser5
================================================================================

amends ".../snippetTest.pkl"

import "pkl:yaml"

local parser: yaml.Parser = new {
  maxCollectionAliases = 1
}

examples {
  ["maxCollectionAliases -- happy path"] {
    parser.parse("""
      lol1: &lol1 ["lol"]
      lol2: *lol1
      """
    )
  }
  ["maxCollectionAliases -- failing"] {
    module.catch(() -> parser.parse("""
      lol1: &lol1 ["lol"]
      lol2: *lol1
      lol3: *lol1
      """))
  }
}

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

(module
  (moduleHeader
    (extendsOrAmendsClause
      (stringConstant)))
  (importClause
    (stringConstant))
  (classProperty
    (modifier)
    (identifier)
    (typeAnnotation
      (type
        (qualifiedIdentifier
          (identifier)
          (identifier))))
    (newExpr
      (objectBody
        (objectProperty
          (identifier)
          (intLiteral)))))
  (classProperty
    (identifier)
    (objectBody
      (objectEntry
        (slStringLiteral)
        (objectBody
          (objectElement
            (methodCallExpr
              (variableExpr
                (identifier))
              (identifier)
              (argumentList
                (mlStringLiteral))))))
      (objectEntry
        (slStringLiteral)
        (objectBody
          (objectElement
            (methodCallExpr
              (moduleExpr)
              (identifier)
              (argumentList
                (functionLiteral
                  (parameterList)
                  (methodCallExpr
                    (variableExpr
                      (identifier))
                    (identifier)
                    (argumentList
                      (mlStringLiteral))))))))))))
