Copyright | © 2019 Albert Krewinkel |
---|---|
License | MIT |
Maintainer | Albert Krewinkel <tarleb@zeitkraut.de> |
Stability | alpha |
Portability | portable |
Safe Haskell | Safe |
Language | Haskell2010 |
Core components of the Jira wiki markup parser.
Synopsis
- type JiraParser = Parsec Text ParserState
- data ParserState = ParserState {}
- defaultState :: ParserState
- parseJira :: JiraParser a -> Text -> Either ParseError a
- withStateFlag :: (Bool -> ParserState -> ParserState) -> JiraParser a -> JiraParser a
- updateLastStrPos :: JiraParser ()
- notAfterString :: JiraParser Bool
- endOfPara :: JiraParser ()
- notFollowedBy' :: Show a => JiraParser a -> JiraParser ()
- blankline :: JiraParser ()
- skipSpaces :: JiraParser ()
- blockNames :: [String]
- parameters :: JiraParser (Maybe Text, [Parameter])
Jira parser and state
type JiraParser = Parsec Text ParserState Source #
Jira Parsec parser
data ParserState Source #
Parser state used to keep track of various parameteres.
ParserState | |
|
defaultState :: ParserState Source #
Default parser state (i.e., start state)
parseJira :: JiraParser a -> Text -> Either ParseError a Source #
Parses a string with the given Jira parser.
withStateFlag :: (Bool -> ParserState -> ParserState) -> JiraParser a -> JiraParser a Source #
Set a flag in the parser to True
before running a parser, then
set the flag's value to False
.
String position tracking
updateLastStrPos :: JiraParser () Source #
Updates the state, marking the current input position as the end of a string.
notAfterString :: JiraParser Bool Source #
Checks whether the parser is directly after a string.
Parsing helpers
endOfPara :: JiraParser () Source #
Succeeds if the parser is looking at the end of a paragraph.
notFollowedBy' :: Show a => JiraParser a -> JiraParser () Source #
Variant of parsec's notFollowedBy
function which properly fails even if
the given parser does not consume any input (like eof
does).
blankline :: JiraParser () Source #
Parses an empty line, i.e., a line with no chars or whitespace only.
skipSpaces :: JiraParser () Source #
Skip zero or more space chars.
blockNames :: [String] Source #
parameters :: JiraParser (Maybe Text, [Parameter]) Source #
Parses a set of panel parameters