Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Lex GLua into MTokens
Synopsis
- type LParser a = P (Str Char String LineColPos) a
- parseWhitespace :: LParser String
- parseOptionalWhitespace :: LParser String
- parseAnyChar :: LParser Char
- pIdentifierCharacter :: LParser Char
- pNonDigitIdentifierCharacter :: LParser Char
- between :: Char -> Char -> Char -> Bool
- parseCBlockComment :: LParser String
- parseBlockComment :: LParser Token
- pUntilEnd :: LParser String
- parseLineComment :: String -> LParser String
- nestedString :: LParser String
- parseComment :: LParser Token
- parseLineString :: Char -> LParser String
- parseString :: LParser Token
- parseNumber :: LParser Token
- parseNumberSuffix :: LParser String
- parseKeyword :: Token -> String -> LParser Token
- parseIdentifier :: LParser String
- parseLabel :: LParser String
- parseDots :: LParser Token
- parseToken :: LParser Token
- annotated :: (Region -> a -> b) -> LParser a -> LParser b
- parseMToken :: LParser MToken
- parseTokens :: LParser [MToken]
- parseHashBang :: LParser String
- lexFromString :: LParser a -> String -> (a, [Error LineColPos])
- execParseTokens :: String -> ([MToken], [Error LineColPos])
Documentation
parseWhitespace :: LParser String Source #
Whitespace parser that requires at least one whitespace character
parseOptionalWhitespace :: LParser String Source #
Whitespace parser that requires 0 or more whitespace characters
parseAnyChar :: LParser Char Source #
Blanco parser. Parses anything. Used in parsing comments.
parseCBlockComment :: LParser String Source #
Parses a C-style block comment.
parseBlockComment :: LParser Token Source #
Try to parse a block comment. Might actually return a single line Dash comment, because for example the following line is a line comment, rather than a block comment [===== <- missing the last '[' bracket.
pUntilEnd :: LParser String Source #
Parse the string until the end. Used in parseLineComment among others.
parseLineComment :: String -> LParser String Source #
A comment that spans until the end of the line.
nestedString :: LParser String Source #
Parses a multiline string except for its first character (e.g. =[ string ]=]) This is because the first [ could also just be parsed as a square bracket.
parseComment :: LParser Token Source #
Parse any kind of comment.
parseString :: LParser Token Source #
Single and multiline strings.
parseNumber :: LParser Token Source #
Parse any kind of number.
parseKeyword :: Token -> String -> LParser Token Source #
Parse a keyword. Note: It must really a keyword! This parser makes sure to return an identifier when it's actually an identifier that starts with that keyword.
parseIdentifier :: LParser String Source #
Parse just an identifier.
parseLabel :: LParser String Source #
Parse a label.
parseDots :: LParser Token Source #
Parse anything to do with dots. Indexaction (.), concatenation (..) or varargs (...)
parseToken :: LParser Token Source #
Parse any kind of token.
annotated :: (Region -> a -> b) -> LParser a -> LParser b Source #
A thing of which the region is to be parsed
parseMToken :: LParser MToken Source #
parse located MToken
parseTokens :: LParser [MToken] Source #
Parse a list of tokens and turn them into MTokens.
parseHashBang :: LParser String Source #
Parse the potential #!comment on the first line Lua ignores the first line if it starts with #
lexFromString :: LParser a -> String -> (a, [Error LineColPos]) Source #
Lex a string with a given lexer
execParseTokens :: String -> ([MToken], [Error LineColPos]) Source #
Parse a string into MTokens. Also returns parse errors.