akGO      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMN Safe-Inferred(Currently, this is pretty lame: it doesn't track - line number and character number, only byte 1 offset from the beginning of the file. This is  because I don't really understand how to 2 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. +The literal name of the property. This is ( guaranteed to be a non-empty string of  upper-case ASCII characters. The arguments to the property. O1Handy way to convert known-ASCII characters from P to Q, among other  things. RJParse the tree-structure of an SGF file, but without any knowledge of the # semantics of the properties, etc. OSTUVWXYZ[\]^_`ROROSTUVWXYZ[\]^_`RNoneaLTry decoding the given word string with each of the known-good encodings to J see if the decoded name names the encoding used to decode. It should be @ impossible for this to return a list with more than one guess. b,A simple wrapper around the encoding package's c function. defghabijabdefghabij Safe-Inferred See also  and .  See also  and .  See also  and .  See also  and .  See also  and .  See also  and .  See also . DAll properties with propertytype game-info. There must be only one  Just on any path within a . 0All properties with propertytype setup or move. >Positional judgments and comments (as opposed to judgments of 3 particular moves). All properties covered in the "Node annotation"  section. ?How a node should be displayed. All properties covered in the  "Markup" and " Miscellaneous" sections. ?Unspecified properties. The keys in the map must contain only E the characters A-Z (and must be upper-case). The values in the map E may be more or less arbitrary, but any occurrence of the ASCII byte  ']'? must be preceded by an odd number of copies of the ASCII byte  '\' . See also  )http://www.red-bean.com/sgf/sgf4.html#2.2  See also .  See also .  See also .  See also .  See also .  See also .  See also . ?Applications can store and read settings in the first argument E here. This got totally shoehorned into the spec by some particular  viewer, I'm sure, but it'-s in the spec now, so there we go. See also   'http://www.red-bean.com/sgf/hex.html#IS  See also . !CThe name and version number of the application used to create this D game. The version number must be in a format that allows ordinary E string comparison to tell which version is higher or lower. Neither E the application name nor the version number may have newlines. See  also  .http://www.red-bean.com/sgf/properties.html#AP ">The first argument tells whether children (False) or siblings D (True) are variations; the second argument tells whether or not to < show board markup when variations are available. See also   .http://www.red-bean.com/sgf/properties.html#ST #BThe size of the board. For games with a default board size, this  is guaranteed to be a Just . See also   .http://www.red-bean.com/sgf/properties.html#SZ $The actual game tree. % See also  . Presumably, no arrow in the arrows field should ) exactly overlap a line specified in the lines field; however, this is not L explicitly made illegal by the SGF spec. Note that some fields are marked  "inherit"2. These inheritances are not explicitly tracked; Nothing values = indicate that the correct interpretation depends on the node's ancestors, or % on the default if no ancestor has a Just value in this field. '2See also the CR, MA, SL, SQ, and TR properties at   .http://www.red-bean.com/sgf/properties.html#CR (Typically, the String*s will be single letters, but that is not : guaranteed. Labels must not contain newlines. See also   .http://www.red-bean.com/sgf/properties.html#LB );Arrows must not start and end at the same point. See also   .http://www.red-bean.com/sgf/properties.html#AR *CLines must not start and end at the same point. Lines must not be > repeated; the parser guarantees this by only including pairs (p, q)  in which p < q . See also   .http://www.red-bean.com/sgf/properties.html#LN +CShade out (exactly) the given points. This property is inherited,  defaulting to  Set.empty . See also   .http://www.red-bean.com/sgf/properties.html#DD ,@Make (exactly) the given points visible; do not draw any of the E other points. This property is inherited, defaulting to the entire  board, and  Set.empty" resets to the default. See also   .http://www.red-bean.com/sgf/properties.html#VW -CHow move numbers should be printed on the board. This property is  inherited, defaulting to Numbered . See also   .http://www.red-bean.com/sgf/properties.html#PM .When Just5, a new diagram should begin at this move. See also   .http://www.red-bean.com/sgf/properties.html#FG / See also   and the 7 field of 0. This L specifies which points are considered territory for each player. See also  the TB and TW properties at  "http://red-bean.com/sgf/go.html#TB 0 See also  . 26Free-form text describing the current node. See also   -http://www.red-bean.com/sgf/properties.html#C 3BA very short description of the node. Must not contain newlines.  See also  -http://www.red-bean.com/sgf/properties.html#N 4When Just5, this node contains something interesting. Viewers " should show a message. See also   .http://www.red-bean.com/sgf/properties.html#HO 5DA quantitative full-board positional judgment. Positive values are / good for black, negative for white. See also   -http://www.red-bean.com/sgf/properties.html#V 6DA qualitative full-board positional judgment. See also the GB, GW,  DM, and UC properties at   .http://www.red-bean.com/sgf/properties.html#DM 7Game-specific annotations. 8 See also  and the T field of J. :GBlack should be set up with one empty pod on each of these points. An E empty set indicates that this property was not specified. See also   (http://www.red-bean.com/sgf/octi.html#BO ;GWhite should be set up with one empty pod on each of these points. An E empty set indicates that this property was not specified. See also   (http://www.red-bean.com/sgf/octi.html#WO <3How many prongs each player starts with. See also   (http://www.red-bean.com/sgf/octi.html#NP =BHow many pods each player has in reserve to start with. See also   (http://www.red-bean.com/sgf/octi.html#NR >8How many superprongs each player starts with. See also   (http://www.red-bean.com/sgf/octi.html#NS ? See also  and the T field of J. The F specification says that trees representing Hex games will mark which D position the viewer should initially show by setting this field to k. M I think this is probably an error in the specification; there is an obvious K conflict between the requirement to put all game information at the first J node where a game is uniquely identifiable and the requirement to have a L game-information property at the location you want to view first (whenever J these two nodes are not the same node, of course). For this reason, Hex N game trees may have paths containing two nodes whose game information is not  l . See also  'http://www.red-bean.com/sgf/hex.html#IP @ See also  and the T field of J. BWhen this field is ', the viewer should initially show the 9 board position after setup but before any moves. (When , the 6 viewer should display the final position.) See also   'http://www.red-bean.com/sgf/loa.html#IP CWhen this field is k-, the board should be displayed with numbers = increasing from the bottom to the top of the screen. (When m, the * numbers should be decreasing.) See also   'http://www.red-bean.com/sgf/loa.html#IY D>The initial placement of pieces and rule variation. See also   'http://www.red-bean.com/sgf/loa.html#SU E See also   and the T field of J. An M empty list indicates that no match information was specified. The order of N the list is not significant, and there should be only one value of any given  kind of y . See also  *http://red-bean.com/sgf/backgammon.html#MI F See also   and the T field of J. HBSpecifying this does not automatically add stones to the board; a  U node with a non-empty W" field should be specified before  any ^ nodes. See also  "http://red-bean.com/sgf/go.html#HA I See also  "http://red-bean.com/sgf/go.html#KM J See also  7. Each individual game may have at most one node with O associated game info. If it has such a node, it must occur at the first node M where that game is distinguishable from all of the other games in the tree. L,The strength of the black player. See also   .http://www.red-bean.com/sgf/properties.html#BR M,The strength of the white player. See also   .http://www.red-bean.com/sgf/properties.html#WR N?When the game was played. An empty set indicates that no date % information is available. See also   .http://www.red-bean.com/sgf/properties.html#DT O?The round number (for games played in a tournament). See also   .http://www.red-bean.com/sgf/properties.html#RO P*The ruleset used for this game. See also   .http://www.red-bean.com/sgf/properties.html#RU Q1The time limit of the game in seconds. See also   .http://www.red-bean.com/sgf/properties.html#TM RHow the game ended. See also   .http://www.red-bean.com/sgf/properties.html#RE S4Miscellaneous properties with no prescribed format. TFCertain game types specify additional informational properties, which  are stored here. U See also  . U nodes are distinct from ^ nodes in that J they need not correspond to any natural part of the game, and game rules 4 (e.g. for capture) are not applied after executing U nodes. They can M be used for any non-standard changes to the game board or to create illegal 2 board positions. The locations specified in the addBlack, addWhite, and  remove# fields must be pairwise disjoint. WAThis node adds the given black pieces to the board; if the board F before this setup node had any pieces at the locations given by this ' field, they are overridden. See also   .http://www.red-bean.com/sgf/properties.html#AB XAThis node adds the given white pieces to the board; if the board F before this setup node had any pieces at the locations given by this ' field, they are overridden. See also   .http://www.red-bean.com/sgf/properties.html#AW Y?This node specifies locations of the board to clear. See also   .http://www.red-bean.com/sgf/properties.html#AE Z1Specify which player should move next. See also   .http://www.red-bean.com/sgf/properties.html#PL [ See also   and . ^ See also  . `AThe given move should be executed, whether it is illegal or not. $ See also the B and W properties at   -http://www.red-bean.com/sgf/properties.html#B a When set to ), the current move is acknowledged to be  illegal. When set to $, the move may be legal or illegal.  See also  .http://www.red-bean.com/sgf/properties.html#KO bWhen Just), set the current move number. See also   .http://www.red-bean.com/sgf/properties.html#MN c=An annotation telling the quality of the current move. This E annotation makes no bigger-picture positional judgments; for those,  see 01. See also the BM, DO, IT, and TE properties at   .http://www.red-bean.com/sgf/properties.html#BM dATime remaining, in seconds, for the black player after this move  was made. See also  .http://www.red-bean.com/sgf/properties.html#BL eATime remaining, in seconds, for the white player after this move  was made. See also  .http://www.red-bean.com/sgf/properties.html#WL fCNumber of overtime moves left for the black player after this move  was made. See also  .http://www.red-bean.com/sgf/properties.html#OB gCNumber of overtime moves left for the white player after this move  was made. See also  .http://www.red-bean.com/sgf/properties.html#OW h See also %. i+Named figure that overrides the application's figure settings. j5Named figure using the application default settings. k7Unnamed figure using the application default settings. l See also h. mShow hoshi dots. n)Remove captured stones from the diagram. oList moves that can'#t be shown in the diagram as text. pShow the diagram's name. q0Show coordinates around the edges of the board. r See also J. y See also E and   *http://red-bean.com/sgf/backgammon.html#MI z'An unknown piece of match information. {(The score at the beginning of the game. |6The (1-indexed) number of the game within this match. }$The number of points in this match. ~ See also J. (Round information in an unknown format. %Both a round number and a type, like "final", "playoff", or  "league". Only a round number is given.  See also J, especially the L and M fields.  The Eq and Ord< instances are the derived ones, and should not be mistaken $ for semantic equality or ordering. DAny rank that does not fall in the standard categories. This field  must not contain newlines. ARanked in one of the standard ways. Most SGF generators specify  the certainty only when it is  Uncertain. Therefore, it may be  reasonable to treat Nothing and  Just Certain identically.  See also J. /The first argument is the color of the winner.  See also ^.  See also . Games that end normally use Score if there is a 9 natural concept of score differential for that game and  OtherWinType if  not.  See also J. Typical values for the a type variable are  , , and . For games where the 9 valid values of the ruleset field is not specified, the a type variable  will be 0 to ensure that all rulesets are specified as a n.  See also .  See also .  See also , J, and  $http://red-bean.com/sgf/octi.html#RU  See also , J, and   *http://red-bean.com/sgf/backgammon.html#RU The Jacoby rule is being used.  This game is the Crawford game. !The Crawford rule is being used.  See also , J, and   *http://red-bean.com/sgf/properties.html#RU  Ing rules American Go Association rules  See also %. 0Subtract enough multiples of 100 from each move 2 number that the first labeled move is below 100.  Print move numbers as they are. Don't print move numbers.  See also  and  'http://www.red-bean.com/sgf/hex.html#IS !Lock the game against new moves? Display column/row headings? Identify the last cell played?  Show good/bad move markings? ,Identify future moves that have been tried?  See also J, especially the S field. The overtime rules. See also   .http://www.red-bean.com/sgf/properties.html#OT 1A description of the opening moves using the game's vernacular. See  also  .http://www.red-bean.com/sgf/properties.html#ON 5An easily-remembered moniker for the game. See also   .http://www.red-bean.com/sgf/properties.html#GN @The name of the event or tournament at which the game occurred. H Additional information about the game (e.g. that it was in the finals)  should appear in the O field, not here. See also   .http://www.red-bean.com/sgf/properties.html#EV %Where the game was played. See also   .http://www.red-bean.com/sgf/properties.html#PC ;Background information or a summary of the game. See also   .http://www.red-bean.com/sgf/properties.html#GC  See also  .http://www.red-bean.com/sgf/properties.html#CP BThe name of the person or program who entered the game. See also   .http://www.red-bean.com/sgf/properties.html#US HThe name of the source, e.g. the title of the book this game came from.  See also  .http://www.red-bean.com/sgf/properties.html#SO 9The name of the person who annotated the game. See also   .http://www.red-bean.com/sgf/properties.html#AN %See also the PB and PW properties at   .http://www.red-bean.com/sgf/properties.html#PB %See also the BT and WT properties at   .http://www.red-bean.com/sgf/properties.html#BT  See also %. With the exception of , the constructor L names describe a shape whose outline should be shown over the given point. EThe exact appearance of this kind of markup is not specified, though G suggestions include darkening the colors on these points or inverting  the colors on these points.  See also . (Variations are stored in sibling nodes. &Variations are stored in child nodes.  See also @.  See also 0.  See also . In addition to the standard "kyu" and "dan" ranks, 2 this also supports the non-standard (but common) "pro" ranks.  See also @.  See also .  See also ^.  See also .  0-indexed x/)y coordinates that start at the top left  See also .  See also .  See also 5. This enumeration is used for the GM property (see   .http://www.red-bean.com/sgf/properties.html#GM). The Enum instance ; converts to and from the numeric game codes listed there. DA type with no constructors used merely to indicate a lack of data. *  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~     opqrstuvwxyz{|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$ ^_`abcdefgUVWXYZ01234567%&'()*+,-.JKLMNOPQRST []\FGHI/ Ey}|{z@ABCD?89:;<=>     lqponm~rwusxxvxvthkjiT   !"#$% &'()*+,-./0123456789:;<=>?@ABCDEFGHIJ KLMNOPQRSTUVWXYZ[]\^ _`abcdefghkjilqponmr wusxxvxvty}|{z~ (     opqrstuvwxyz{|}~None%Warnings signify recoverable errors. U !"#$%&'()*+,-./0123456789:;<=>?@ABCT !"#$%&'()*+,-./0123456789:;<=>?@ABC010/.-,+*)('&%$#"! 2536748 CBA@?>=<;:9NoneD8Types of properties, as given in the SGF specification. F(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. KParse a P; stream into an SGF collection. A collection is a list of  games; the documentation for ( has more details. There are generally C two kinds of errors in SGF files: recoverable ones (which will be  accumulated in the [], return) and unrecoverable ones (which will  result in parse errors). LIClip to a valid, representable date. Years are clipped to the 0000-9999 J 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). DIf a parsed date is changed by this function, a warning is emitted. M=All properties of each type listed in the SGF specification. N4Just the properties associated with specific games. ?DEFGHIJKLMN5 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMN5KLDJIHGFEMN10/.-,+*)('&%$#"! 8CBA@?>=<;:92536749DJIHGFEKLMNNone0P  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~     K      !"##$%&'()*+,--. /01233456789::;<=>??@ABBCDEFGHIJKLLMNOPQRSTTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~    }  !"#$%&'()*+,-./0123456789:B;LT<=>?@ABCDEF<GHIJKLMNOPQRSTUVWXYZZ[\]^_DE`AabDEcAdefghijklmnopqrstuvwxyyz{|}~WT !IHEFUGDEABABAB sgf-0.1.2Data.SGF.ParseData.SGF.TypesData.SGF.Parse.RawData.SGF.Parse.EncodingsData.SGF.Parse.UtilData.SGFPropertypositionnamevalues NodeOtherNodeOctiNodeHexNodeLinesOfActionNodeBackgammonNodeGoGameNodegameInfoaction annotationmarkupunknown TreeOtherTreeOctiTreeHexTreeLinesOfActionTreeBackgammonTreeGoGameTreeGame application variationTypesizetreeMarkupmarkslabelsarrowslinesdimvisible numberingfigure AnnotationGo AnnotationcommenthotspotvaluejudgmentotherAnnotation GameInfoOcti squaresWhite squaresBlackprongsreserve superProngs GameInfoHexGameInfoLinesOfActioninitialPositionLOA invertYAxisinitialPlacementGameInfoBackgammon GameInfoGohandicapkomiGameInfo rankBlack rankWhitedateroundruleSet timeLimitresultfreeform otherGameInfoSetupaddBlackaddWhiteremovetoPlayMoveGoPlayPassMovemoveillegalnumberquality timeBlack timeWhiteovertimeMovesBlackovertimeMovesWhiteFigure NamedFigureNamedDefaultFigure DefaultFigure FigureFlagHoshiRemoveCaptures HiddenMovesName Coordinates PartialDateDaydayMonthmonthYearyear MatchInfoOtherMatchInfo StartScore GameNumberLengthRound OtherRoundFormattedRound SimpleRoundRank OtherRankRanked GameResultWinUnknownVoidDrawQualityGood InterestingDoubtfulBadWinType OtherWinTypeForfeitTimeResignScoreRuleSet OtherRuleSetKnownMinorVariationOtherMinorVariation SuperprongEdgelessMajorVariationKidsFastFull RuleSetOcti OctiRuleSetRuleSetBackgammonJacoby CrawfordGameCrawford RuleSetGo NewZealandJapaneseChineseGOEAGA Numbering Modulo100Numbered Unnumbered ViewerSettingLockHeadingsLastMoveMarkedTried GameInfoTypeOvertimeOpeningGameNameEventLocationContext CopyrightUserSource Annotator PlayerNameTeamNameMarkTriangleSquareSelectedXCircle VariationTypeSiblingsChildrenInitialPlacementCustomGemma Parachute ScrambledEggsStandardJudgmentUnclearEven GoodForBlack GoodForWhite RankScaleProDanKyuInitialPositionEnd Beginning CertaintyCertain UncertainColorWhiteBlackEmphasisStrongNormal FuzzyBool DefinitelyPossibly AutoMarkupPointVersion Application CollectionGameTypeKropkiGipfTamskDvonnFocusByteSahara TumblingDownChaseTripplesKubaHnefatalExxitHiveGobbletPunctYinshPlateauZertzTwixtGessOctiAmazonsTantrixTrax QuadraturePhilosopher'sFootballNeutronJungleHexAtaxx LinesOfActionShogi ChineseChess BackgammonNineMen'sMorrisGomokuChessOthelloGo emptyMove emptySetup emptyGameInfoemptyAnnotation emptyMarkup emptyGameNodeWarningUnknownNumberingIgnoredDuplicateLabelOmittedExtraPropertyValuesOmittedDuplicateMarkupOmittedExtraPositionalJudgmentOmittedDuplicateSetupOperationsOmittedMovelessAnnotationOmittedNestedRootPropertyOmittedExtraGameInfoOmittedAnnotationWithNoMoveOmittedInvalidDatesClippedDuplicatePointsOmittedPointSpecifiedAsPointRangeUnknownPropertyPreservedPropValueForNonePropertyOmittedDanglingEscapeCharacterOmittedSquareSizeSpecifiedAsRectangleDuplicatePropertyOmittedError UnknownErrorerrorDescription KnownError errorType errorPosition ErrorTypeExtraMoveAnnotationsConcurrentAnnotationsConcurrentBlackAndWhiteMoveConcurrentMoveAndSetupBadlyEncodedValueBadlyFormattedValue OutOfBoundsGameUnsupportedFormatUnsupportedAmbiguousEncodingUnknownEncoding PropertyTypeNoneInheritRoot collectionclipDate propertiesextraPropertiesenumbaseGHC.WordWord8ghc-prim GHC.TypesCharensuresatisfy satisfyCharanyWord exactWordsomeWordnoWord whitespace escapedCharunescapedExceptliteralTextExceptpropertynodegameTree guessEncodingdecodeWordStringExplicitencoding-0.6.7.2Data.Encoding.BasedecodeMyEither MyIHateGHC encodingsguess$fByteSourceStateT$fMonadMyEitherTrue Data.MaybeNothingFalseGHC.BaseStringallGameTypesInSGFOrderallGameInfoTypesallFigureFlagsmapFromFunction $fOrd(->)$fEq(->) $fRead(->) $fShow(->)$fEnumFigureFlag$fBoundedGameInfoType$fEnumGameInfoType$fEnumGameType $fShowVoid $fReadVoid $fOrdVoid$fEqVoid PTranslator TranslatorStateHeaderformatencodingdie dieWithPosdieWith dieWithJusttransMap transMapMulti transMap' transMapList duplicatesOnduplicateProperties duplicates readNumbernewlinetrimdescapedecodeAndDescape splitColons splitColonwarnAboutDuplicatePointscheckPointListhashasAnyconsume consumeSingleunknownPropertiesrealsimpletextnonechoicechoice'doublecolorcomposelistOfelistOfmayBeCompoundPoint listOfPoint elistOfPoint $fErrorError translatetestwarnAll dieEarliest getFormat getEncoding parseHeadergameTypefreeformGameInfoconsumeFreeformGameInfoconsumeUpdateGameInfoconsumeUpdateGameInfoMaybeabbreviateList readRationalrank warnClipDate dateUpdate setupPointsetupPointStone setupFinishaddMarksfigurePTranslator defaultSize ruleSetLookup ruleSetGoruleSetBackgammon ruleSetOctiruleSetDefault gameInfoGopointGomoveGo annotationGogameHexnodeGonodeBackgammonnodeLinesOfActionnodeHexnodeOcti nodeOtherWordWord16Word32Word64containers-0.5.0.0 Data.TreeunfoldForestM_BFunfoldTreeM_BF unfoldForestM unfoldTreeM unfoldForest unfoldTreelevelsflatten drawForestdrawTree subForest rootLabelNodeTreeForest parsec-3.1.3"Text.ParserCombinators.Parsec.Prim runParser