language-kort-0.1.0.0: Parser and serializer for the Kort information language.

Safe HaskellNone
LanguageHaskell2010

Language.Kort.Parser

Synopsis

Documentation

parseString :: String -> ParseResult Source

Parse Kort source text from a String.

parseText :: Text -> ParseResult Source

Parse Kort source text from Text.

parseFile :: FilePath -> IO ParseResult Source

Parse Kort source text read from a file.

toSmaoinValue :: String -> Resource -> Either String Value Source

Parse a Kort literal into a typed value. Return an error message if the literal body format doesn't match the type.

toSmaoinModel :: Document -> ([Statement], [Statement], [Statement], [Statement], [Statement]) Source

Convert from the Kort document model to a list of Smaoin statements.

This function doesn't handle Uid generation or other shortcuts. It just collects statements invalid for Smaoin and statements with generators into separate lists. If you want Uids to be generated, use the functions in Language.Kort.UidGen.

5 lists are returned:

  1. Kort statements which don't have exactly 2 elements
  2. Kort statements with 2 elements, but containing generators
  3. Kort statements with 2 elements, but the 1st is a value, not a resource
  4. Kort statement with 2 elements, but invalid object value
  5. Successfully converted Smaoin statements

Kort comments are ignored and dropped.