sgf-0.1.3.3: SGF (Smart Game Format) parser
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.SGF.Parse

Synopsis

Documentation

collection :: Stream s m Word8 => ParsecT s u m (Collection, [Warning]) Source #

Parse a Word8 stream into an SGF collection. A collection is a list of games; the documentation for Game has more details. There are generally two kinds of errors in SGF files: recoverable ones (which will be accumulated in the [Warning] return) and unrecoverable ones (which will result in parse errors).

clipDate :: PartialDate -> PartialDate Source #

Clip to a valid, representable date. Years are clipped to the 0000-9999 range; months are clipped to the 1-12 range, and days are clipped to the 1-<number of days in the given month> range (accounting for leap years in the case of February).

If a parsed date is changed by this function, a warning is emitted.

data PropertyType Source #

Types of properties, as given in the SGF specification.

Constructors

Move 
Setup 
Root 
GameInfo 
Inherit

Technically, these properties have type "none" and attribute "inherit", but the property index lists them as properties of type "inherit" with no attributes, so we follow that lead.

None 

Instances

Instances details
Bounded PropertyType Source # 
Instance details

Defined in Data.SGF.Parse

Enum PropertyType Source # 
Instance details

Defined in Data.SGF.Parse

Read PropertyType Source # 
Instance details

Defined in Data.SGF.Parse

Show PropertyType Source # 
Instance details

Defined in Data.SGF.Parse

Eq PropertyType Source # 
Instance details

Defined in Data.SGF.Parse

Ord PropertyType Source # 
Instance details

Defined in Data.SGF.Parse

properties :: GameType -> PropertyType -> [String] Source #

All properties of each type listed in the SGF specification.

extraProperties :: GameType -> PropertyType -> [String] Source #

Just the properties associated with specific games.

data Property Source #

Constructors

Property 

Fields

  • position :: SourcePos

    Currently, this is pretty lame: it doesn't track line number and character number, only byte offset from the beginning of the file. This is because I don't really understand how to correctly track line number and character number properly in the face of dynamically changing encodings, whereas byte number is a totally braindead statistic to track.

  • name :: String

    The literal name of the property. This is guaranteed to be a non-empty string of upper-case ASCII characters.

  • values :: [[Word8]]

    The arguments to the property.

Instances

Instances details
Show Property Source # 
Instance details

Defined in Data.SGF.Parse.Raw

Eq Property Source # 
Instance details

Defined in Data.SGF.Parse.Raw

Ord Property Source # 
Instance details

Defined in Data.SGF.Parse.Raw

data ErrorType Source #

Instances

Instances details
Bounded ErrorType Source # 
Instance details

Defined in Data.SGF.Parse.Util

Enum ErrorType Source # 
Instance details

Defined in Data.SGF.Parse.Util

Read ErrorType Source # 
Instance details

Defined in Data.SGF.Parse.Util

Show ErrorType Source # 
Instance details

Defined in Data.SGF.Parse.Util

Eq ErrorType Source # 
Instance details

Defined in Data.SGF.Parse.Util

Ord ErrorType Source # 
Instance details

Defined in Data.SGF.Parse.Util

data Error Source #

Instances

Instances details
Show Error Source # 
Instance details

Defined in Data.SGF.Parse.Util

Methods

showsPrec :: Int -> Error -> ShowS #

show :: Error -> String #

showList :: [Error] -> ShowS #

Eq Error Source # 
Instance details

Defined in Data.SGF.Parse.Util

Methods

(==) :: Error -> Error -> Bool #

(/=) :: Error -> Error -> Bool #

Ord Error Source # 
Instance details

Defined in Data.SGF.Parse.Util

Methods

compare :: Error -> Error -> Ordering #

(<) :: Error -> Error -> Bool #

(<=) :: Error -> Error -> Bool #

(>) :: Error -> Error -> Bool #

(>=) :: Error -> Error -> Bool #

max :: Error -> Error -> Error #

min :: Error -> Error -> Error #

MonadFail (Either Error) Source # 
Instance details

Defined in Data.SGF.Parse

Methods

fail :: String -> Either Error a #

Orphan instances

MonadFail (Either Error) Source # 
Instance details

Methods

fail :: String -> Either Error a #