License | BSD-3-Clause |
---|---|
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Parser for the Swarm world description DSL.
Synopsis
- type Parser = Parsec Void Text
- type ParserError = ParseErrorBundle Text Void
- reservedWords :: [Text]
- sc :: Parser ()
- lexeme :: Parser a -> Parser a
- symbol :: Text -> Parser Text
- operatorChar :: Parser Char
- operator :: Text -> Parser Text
- integerOrFloat :: Parser (Either Integer Double)
- reserved :: Text -> Parser ()
- identifier :: Parser Var
- brackets :: Parser a -> Parser a
- parens :: Parser a -> Parser a
- braces :: Parser a -> Parser a
- comma :: Parser ()
- parseWExpAtom :: Parser WExp
- parseWExp :: Parser WExp
- parseCell :: Parser WExp
- parseCellItem :: Parser (Maybe CellTag, Text)
- parseCellTag :: Parser CellTag
- parseName :: Parser Text
- parseIf :: Parser WExp
- parsePerlin :: Parser WExp
- parseAbs :: Parser WExp
- parseLet :: Parser WExp
- parseOverlay :: Parser WExp
- parseMask :: Parser WExp
- parseImport :: Parser WExp
- runParser :: Parser a -> Text -> Either ParserError a
Documentation
type ParserError = ParseErrorBundle Text Void Source #
reservedWords :: [Text] Source #
lexeme :: Parser a -> Parser a Source #
In general, we follow the convention that every token parser
assumes no leading whitespace and consumes all trailing
whitespace. Concretely, we achieve this by wrapping every token
parser using lexeme
.
reserved :: Text -> Parser () Source #
Parse a case-insensitive reserved word, making sure it is not a prefix of a longer variable name, and allowing the parser to backtrack if it fails.
identifier :: Parser Var Source #
Parse an identifier, i.e. any non-reserved string containing alphanumeric characters and underscores and not starting with a number.
parsePerlin :: Parser WExp Source #
parseImport :: Parser WExp Source #