99      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~(c) Ogma Project, 2016MIT experimentalSafe,g$Mostly in order to deal with typographic spaces, main punctuation marks are tokenized during the parsing of an Ogmarkup document.The character ;The character ,The character ?The character !The character "The character " The character  or the sequence -- The character  or the sequence --- The character , The character . The character -  Two or more . or the character & The characters ' or  The strange character  = , obtained ?! or ?!The character , obtained with ??{An Atom is the atomic component of a Ogmarkup document. It can be either a punctuation mark or a word, that is a string.Note that, by construction,  and  are not valid 2 values here. Indeed, they are implicit with the e constructor. This design allows the parser to enforce that an opened quote needs to be closed.A wrapped stringA punctuation markA nested formatted text3No particular emphasis is required on this sequenceSurrounded by *.Surrounded by **.A character's line of dialogue. A reply may contain a descriptive part, which is not part of what the character actually says or thinks. We call the latter a "with say" reply untill someone gives use a better name for it.$A reply of the form: "Good morning."=A reply of the form: "Good morning," she says. "How are you?"gA Component is either a narrative text, a character's line of dialogue or a character's inner thought.We also embed an error Component in case we fail to parse a valid component. This way, we can resume parsing when we meet a new paragraph.A narrative descriptionA dialogue replyInner dialogue of the characteruIf none of the above matched, then output what follows as-is, the parsing will be resumed at the next paragraph ,A Paragraph is just a sequence of Component.!A Section within an ogmarkup document is a sequence of paragraphs. It can be part of the story or an aside section like a letter, a song, etc. We make the distinction between the two cases because we want to be able to apply different style depending on the situation."The story as it goes#1Something else. Maybe a letter, a flashback, etc.%aA ogmarkup document internal representation waiting to be used in order to generate an output.&  !$#"%&%!"#$   !"#$(c) Ogma Project, 2016MIT experimentalNone<FTXc*2An ogmarkup parser processes  tokens and carries a 3.3+Keep track of the currently opened formats.5"Already parsing text with emphasis6,Already parsing text with strong emphasis7Already parsing a quote8 Update the 3" to guard against nested emphasis.9 Update the 30 to be able to parse input with emphasis again.: Update the 3) to guard against nested strong emphasis.; Update the 37 to be able to parse input with strong emphasis again.< Update the 3' to guard against nested quoted inputs.= Update the 3: to be able to parse an input surrounded by quotes again.>QA initial ParserState instance to be used at the begining of a document parsing.?A wrapper around the " function of Megaparsec. It uses > as an initial state.@vTry its best to parse an ogmarkup document. When it encounters an error, it returns an Ast and the remaining input.See %.ASee !.BSee #.CSee ".DSee  .ESee .FSee .GParse the rest of the current paragraph with no regards for the ogmarkup syntax. This Parser is used when the document is ill-formed, to find a new point of synchronization.HSee .ISee .JSee .KK c c' constr wraps a reply surrounded by c and c' inside constr (either  or ).L{Parse the name of the character which speaks or thinks. According to the ogmarkup syntax, it is surrounded by parentheses.MM parses a .NSee .OSee .PSee .QSee .RSee .SSee .TSee _. This parser does not consume the following spaces, so the caller needs to take care of it.U Wrap a raw string surrounded by ` inside a .parse longword "" "`test *ei*`"Right (Ast.Word "test *ei*") Therefore, `O can be used to insert normally reserved symbol inside a generated document.VSee . Be aware that V9 does not parse the quotes because they are processed R.WSee 0. This parser consumes the following blank (see [) and skip the result.XSee 0. This parser consumes the following blank (see [) and skip the result.YAn aside section (see #{) is a particular region surrounded by two lines of underscores (at least three). This parser consumes one such line.Z{The end of a paragraph is the end of the document or two blank lines or an aside separator, that is a line of underscores.[dThis parser consumes all the white spaces until it finds either an aside surrounding marker (see #c), the end of the document or one blank line. The latter marks the end of the current paragraph.\skip p parses p and skips the result.K+A character to mark the begining of a reply&A character to mark the end of a replyEither  or  according to the situation+23476589:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\+34567289:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\34567(c) Ogma Project, 2016MIT experimentalSafe]qK]mA Typography is a data type that tells the caller what space should be privileged before and after a text._ For a given W, returns a tuple with the spaces to use before and after the punctuation mark.`7Give an output representation of the punctuation markalWhich mark to use to open a dialogue. If the parameter is True, there were another dialogue just before.bjWhich mark to use to close a dialogue. If the parameter is True, there is another dialogue just after.cDeal with typographic spaces, especially when it comes to separating two texts. Because Space derives Ord, it is possible to use min and max to determine which one to use in case of a conflict.d@A normal space that can be turned into a newline for displaying.e:A non breakable space, it cannot be turned into a newline.fNo space at all.gLFrom a Typography, it gives the space to privilege before the input Text.hKFrom a Typography, it gives the space to privilege after the input Text.i;Normalize the input in order to add it to a generated Text.jA proposal for the French typography. It can be used with several generation approaches, as it remains very generic. Requires the output type to be an instance of .mA proposal for the English typography. It can be used with several generation approaches, as it remains very generic. Requires the output type to be an instance of .pApply the function to each  output value]^ba`_cfedghijklmnocdef]^_`abpghijklmno]^_`abcdef(c) Ogma Project, 2016MIT experimentalSafe>?AysAn instance of the s- typeclass can be given as a parameter to a . In order to prevent GHC to overabstract this typeclass, there can be only one instance of GenConf for one datatype. In other words, one datatype can only handle one return type c.For each template, we give a prefered layout and some hints about the default implementation (which is almost always the identity function, ignoring all the parameters but the generated output.Warning: s! is a multiparam typeclass (see MultiParamTypeClasses^ GHC extension). In order to make new instances, the following extensions need to be enabled: FlexibleInstances MultiParamTypeClasses7Otherwise, GHC will not accept your instance statement.t Returns a ] instance to be used by the .Default implementation: returns m.uDThis template is used once the output has been completely generated.Layout: blockDefault implementation: the identity functionvThis template is used on the ill-formed portion of the ogmarkup document which have been ignored during the best-effort compilation.Layout: inlineDefault implementation: the identity functionwLThis template is used on regular sections which focus on telling the story.Layout: blockDefault implementation: the identity functionxhThis template is used on aside sections which may comprised flashbacks, letters or songs, for instance.Layout: blockDefault implementation:9 the identity function (it ignores the class name)y5This template is used on paragraphs within a section.Layout: blockDefault implementation: the identity functionzHThis template is used on the narrative portion of an ogmarkup document.Layout: inlineDefault implementation: the identity function{This template is used on audible dialogue. The class name is mandatory even if the character name is optional for dialogues and thoughts in the ogmarkup grammar. The a function is used by the generator to get a default value when no character names are provided.Layout: inlineDefault implementation: the identity function|1This template is used on unaudible dialogue. See {A to get more information on why the class name is not optional.Layout: inlineDefault implementation: the identity function~Return a marker to insert between two consecutive dialogues. The default use case is to return the concatenation of the ending mark and the opening mark of a paragraph. a paragrapLayout: inlineDefault implementation: 1A template to apply emphasis to an piece of text.Default implementation: the identity functionCA template to apply stong emphasis (often bold) to a piece of text.Layout: inlineDefault implementation: ^This function is called by a Generator to derive a class name for an optional character name.Default implementation:7 simply unwrap the Maybe value, if Nothing return .Generate an output from a c.A 0 is just synonym for a template of one argument.xAn optional class name{The class name produced by |The class name produced by s~}|{zyxwvutstuvwxyz{|}~stuvwxyz{|}~(c) Ogma Project, 2016MIT experimentalNone>?KQVhThe  Monad is eventually used to generate an output from a given 'Ast.Document. Internally, it keeps track of the previous processed ' in order to deal with atom separation.Run a S monad and get the generated output. The output type has to implement the class  because the  monad uses the > constant as the initial state of the output and then uses 5 to expand the result as it processes the generation.*Apply a template to the result of a given ; before appending it to the previously generated output.,Forget about the past and consider the next ! as the first to be processed.0Append a new sub-output to the generated output. Process an x and deal with the space to use to separate it from the paramter of the previous call (that is the last processed ).Call  if the parameter is not . Otherwise, do nothing.Process a sequence of . Process a .Process a sequence of . Process a . Process a . Process a   and deal with sequence of .Process a sequence of  . Process a !.Process a sequence of !. Process a %', that is a complete Ogmarkup document.The  to run The outputThe  to applyThe  to runAsub-output to append)Was the last component a piece of dialog?-Will the next component be a piece of dialog? The current component to process(c) Ogma Project, 2016MIT experimentalNone <>?FQTVhFrom a String, parse and generate an output according to a generation configuration. The inner definitions of the parser and the generator imply that the output type has to be an instance of the  and  classes.If you don t want to use the TypeApplicationsX pragma, you can use this functions insead (but of course, it itself uses the pragma)The input stringThe input string3 ]^_`abcdefjklmnostuvwxyz{|}~3stuvwxyz{|}~jklmno]^_`ab cdef      !"#$%&'()*+,-./0123456789:;;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcddefghijklmnopqrstuvwxyz{|}~VZUTLKHG#ogmarkup-5.0-9KaaLQIg2Ly8ulqRo7YdzQText.Ogmarkup.Private.AstText.Ogmarkup.Private.Parser Text.Ogmarkup.Private.TypographyText.Ogmarkup.Private.ConfigText.Ogmarkup.Private.Generator Text.Ogmarkup GeneratorMark SemicolonColonQuestion Exclamation OpenQuote CloseQuoteDashLongDashCommaPointHyphenSuspensionPoints Apostrophe InterrobangIronyAtomWord PunctuationFormatRawEmph StrongEmphQuoteReplySimpleWithSay ComponentTellerDialogueThought IllFormed ParagraphSectionStoryAsideFailingDocument $fShowMark$fEqMark $fShowAtom$fEqAtom $fShowFormat $fEqFormat $fEqReply $fShowReply $fEqComponent$fShowComponent $fEqSection $fShowSectionOgmarkupParser ParserState parseWithEmphparseWithStrongEmphparseWithinQuote enterEmph leaveEmphenterStrongEmphleaveStrongEmph enterQuote leaveQuoteinitParserStateparsedocumentsectionasidestory paragraph component illformedrestOfParagraphtellerdialoguethoughttalk characterNamereplyformatrawemph strongEmphquoteatomwordlongwordmark openQuote closeQuoteasideSeparatorendOfParagraphblankskip Typographydecideoutput openDialogue closeDialogueSpaceNormalNbspNone beforeAtom afterAtom normalizeAtom frenchTypounicodeFrenchTypohtmlFrenchTypo englishTypounicodeEnglishTypohtmlEnglishTypo$fFunctorTypography $fEqSpace $fOrdSpaceGenConf typographydocumentTemplate errorTemplate storyTemplate asideTemplateparagraphTemplatetellerTemplatedialogueTemplatethoughtTemplate replyTemplatebetweenDialogue emphTemplatestrongEmphTemplateauthorNormalize printSpaceTemplategetState runGeneratorapplyreset maybeAtomatomsformats paragraphssections$fFunctorGenerator$fApplicativeGenerator$fMonadGenerator$fMonadStateGeneratorogmarkup ogmarkup'ghc-prim GHC.TypesChar&megaparsec-6.4.0-xl4HlJBghw88uZEZB1lRfText.Megaparsec runParserbase Data.StringIsStringGHC.BasememptyMonoidmappendNothing