Copyright | (c) David Janssen 2019 |
---|---|
License | MIT |
Maintainer | janssen.dhj@gmail.com |
Stability | experimental |
Portability | non-portable (MPTC with FD, FFI to Linux-only c-code) |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
KMonad.Args.Parser
Description
We perform configuration parsing in 2 steps: - 1. We turn the text-file into a token representation - 2. We check the tokens and turn them into an AppCfg
This module covers step 1.
Synopsis
- parseTokens :: Text -> Either ParseError [KExpr]
- loadTokens :: FilePath -> RIO e [KExpr]
- symbol :: Text -> Parser ()
- numP :: Parser Int
- otokens :: [(Text, Parser OToken)]
- itokens :: [(Text, Parser IToken)]
- buttonP :: Parser DefButton
- implArndButtons :: [(Text, ImplArnd, DefButton -> DefButton -> DefButton)]
- keywordButtons :: [(Text, Parser DefButton)]
- noKeywordButtons :: [Parser DefButton]
Parsing KExpr
s
parseTokens :: Text -> Either ParseError [KExpr] Source #
loadTokens :: FilePath -> RIO e [KExpr] Source #
Load a set of tokens from file, throw an error on parse-fail
Building Parsers
Parsers for Tokens and Buttons
otokens :: [(Text, Parser OToken)] Source #
Output tokens to parse; the format is (keyword, how to parse the token)
itokens :: [(Text, Parser IToken)] Source #
Input tokens to parse; the format is (keyword, how to parse the token)
keywordButtons :: [(Text, Parser DefButton)] Source #
Parsers for buttons that have a keyword at the start; the format is
(keyword, how to parse the token)
noKeywordButtons :: [Parser DefButton] Source #
Parsers for buttons that do not have a keyword at the start