================================================================================
api/yamlRendererStream2
================================================================================

amends ".../snippetTest.pkl"

local class Foo

local renderer = new YamlRenderer { isStream = true }

examples {
  ["multiline string at end of document"] {
    renderer.renderDocument(new Listing {
      new Dynamic {
        x = "one\ntwo"
      }
      new Dynamic {
        x = "other"
      }
    })
  }
  ["multiline string at end of stream"] {
    renderer.renderDocument(new Listing {
      new Dynamic {
        x = "other"
      }
      new Dynamic {
        x = "one\ntwo"
      }
    })
  }
  ["invalid top level value"] {
    module.catch(() -> renderer.renderDocument(5))
    module.catch(() -> renderer.renderDocument(new Foo {}))
  }
}

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

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