================================================================================
api/xmlRenderer2b
================================================================================

import "pkl:xml"

local renderer = new xml.Renderer {
  converters {
    ["^apple"] = (it) -> it.toUpperCase()
    ["^[*].apple"] = (it) -> it.toUpperCase()
    ["^[apple]"] = (it) -> it.toUpperCase()
  }
}

local properties = renderer.renderDocument(
  new Dynamic {
    apple = "yes"
    banana {
      apple = "no"
    }
  })

res1 = properties.contains("YES")
res2 = properties.contains("no")
res3 = !properties.contains("yes")
res4 = !properties.contains("NO")

local elements = renderer.renderDocument(
  new Dynamic {
    new {
      apple = "yes"
    }
    new {
      new {
        apple = "no"
      }
    }
  })

res5 = elements.contains("YES")
res6 = elements.contains("no")
res7 = !elements.contains("yes")
res8 = !elements.contains("NO")

local entries = renderer.renderValue(
  new Dynamic {
    ["apple"] = "yes"
    ["banana"] {
      ["apple"] = "no"
    }
  })

res9 = entries.contains("YES")
res10 = entries.contains("no")
res11 = !entries.contains("yes")
res12 = !entries.contains("NO")

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

(module
  (importClause
    (stringConstant))
  (classProperty
    (modifier)
    (identifier)
    (newExpr
      (type
        (qualifiedIdentifier
          (identifier)
          (identifier)))
      (objectBody
        (objectProperty
          (identifier)
          (objectBody
            (objectEntry
              (slStringLiteral)
              (functionLiteral
                (parameterList
                  (typedIdentifier
                    (identifier)))
                (methodCallExpr
                  (variableExpr
                    (identifier))
                  (identifier)
                  (argumentList))))
            (objectEntry
              (slStringLiteral)
              (functionLiteral
                (parameterList
                  (typedIdentifier
                    (identifier)))
                (methodCallExpr
                  (variableExpr
                    (identifier))
                  (identifier)
                  (argumentList))))
            (objectEntry
              (slStringLiteral)
              (functionLiteral
                (parameterList
                  (typedIdentifier
                    (identifier)))
                (methodCallExpr
                  (variableExpr
                    (identifier))
                  (identifier)
                  (argumentList)))))))))
  (classProperty
    (modifier)
    (identifier)
    (methodCallExpr
      (variableExpr
        (identifier))
      (identifier)
      (argumentList
        (newExpr
          (type
            (qualifiedIdentifier
              (identifier)))
          (objectBody
            (objectProperty
              (identifier)
              (slStringLiteral))
            (objectProperty
              (identifier)
              (objectBody
                (objectProperty
                  (identifier)
                  (slStringLiteral)))))))))
  (classProperty
    (identifier)
    (methodCallExpr
      (variableExpr
        (identifier))
      (identifier)
      (argumentList
        (slStringLiteral))))
  (classProperty
    (identifier)
    (methodCallExpr
      (variableExpr
        (identifier))
      (identifier)
      (argumentList
        (slStringLiteral))))
  (classProperty
    (identifier)
    (methodCallExpr
      (unaryExpr
        (variableExpr
          (identifier)))
      (identifier)
      (argumentList
        (slStringLiteral))))
  (classProperty
    (identifier)
    (methodCallExpr
      (unaryExpr
        (variableExpr
          (identifier)))
      (identifier)
      (argumentList
        (slStringLiteral))))
  (classProperty
    (modifier)
    (identifier)
    (methodCallExpr
      (variableExpr
        (identifier))
      (identifier)
      (argumentList
        (newExpr
          (type
            (qualifiedIdentifier
              (identifier)))
          (objectBody
            (objectElement
              (newExpr
                (objectBody
                  (objectProperty
                    (identifier)
                    (slStringLiteral)))))
            (objectElement
              (newExpr
                (objectBody
                  (objectElement
                    (newExpr
                      (objectBody
                        (objectProperty
                          (identifier)
                          (slStringLiteral)))))))))))))
  (classProperty
    (identifier)
    (methodCallExpr
      (variableExpr
        (identifier))
      (identifier)
      (argumentList
        (slStringLiteral))))
  (classProperty
    (identifier)
    (methodCallExpr
      (variableExpr
        (identifier))
      (identifier)
      (argumentList
        (slStringLiteral))))
  (classProperty
    (identifier)
    (methodCallExpr
      (unaryExpr
        (variableExpr
          (identifier)))
      (identifier)
      (argumentList
        (slStringLiteral))))
  (classProperty
    (identifier)
    (methodCallExpr
      (unaryExpr
        (variableExpr
          (identifier)))
      (identifier)
      (argumentList
        (slStringLiteral))))
  (classProperty
    (modifier)
    (identifier)
    (methodCallExpr
      (variableExpr
        (identifier))
      (identifier)
      (argumentList
        (newExpr
          (type
            (qualifiedIdentifier
              (identifier)))
          (objectBody
            (objectEntry
              (slStringLiteral)
              (slStringLiteral))
            (objectEntry
              (slStringLiteral)
              (objectBody
                (objectEntry
                  (slStringLiteral)
                  (slStringLiteral)))))))))
  (classProperty
    (identifier)
    (methodCallExpr
      (variableExpr
        (identifier))
      (identifier)
      (argumentList
        (slStringLiteral))))
  (classProperty
    (identifier)
    (methodCallExpr
      (variableExpr
        (identifier))
      (identifier)
      (argumentList
        (slStringLiteral))))
  (classProperty
    (identifier)
    (methodCallExpr
      (unaryExpr
        (variableExpr
          (identifier)))
      (identifier)
      (argumentList
        (slStringLiteral))))
  (classProperty
    (identifier)
    (methodCallExpr
      (unaryExpr
        (variableExpr
          (identifier)))
      (identifier)
      (argumentList
        (slStringLiteral)))))
