Safe Haskell | None |
---|
- type IdrisParser = StateT IState IdrisInnerParser
- newtype IdrisInnerParser a = IdrisInnerParser {
- runInnerParser :: Parser a
- type MonadicParsing m = (DeltaParsing m, LookAheadParsing m, TokenParsing m, Monad m)
- runparser :: StateT st IdrisInnerParser res -> st -> String -> String -> Result res
- simpleWhiteSpace :: MonadicParsing m => m ()
- isEol :: Char -> Bool
- eol :: MonadicParsing m => m ()
- isDocCommentMarker :: Char -> Bool
- singleLineComment :: MonadicParsing m => m ()
- multiLineComment :: MonadicParsing m => m ()
- docComment :: MonadicParsing m => Char -> m String
- whiteSpace :: MonadicParsing m => m ()
- stringLiteral :: MonadicParsing m => m String
- charLiteral :: MonadicParsing m => m Char
- natural :: MonadicParsing m => m Integer
- integer :: MonadicParsing m => m Integer
- float :: MonadicParsing m => m Double
- idrisStyle :: MonadicParsing m => IdentifierStyle m
- char :: MonadicParsing m => Char -> m Char
- string :: MonadicParsing m => String -> m String
- lchar :: MonadicParsing m => Char -> m Char
- symbol :: MonadicParsing m => String -> m String
- reserved :: MonadicParsing m => String -> m ()
- reservedOp :: MonadicParsing m => String -> m ()
- identifier :: MonadicParsing m => m String
- iName :: MonadicParsing m => [String] -> m Name
- maybeWithNS :: MonadicParsing m => m String -> Bool -> [String] -> m Name
- name :: IdrisParser Name
- initsEndAt :: (a -> Bool) -> [a] -> [[a]]
- mkName :: (String, String) -> Name
- opChars :: String
- operatorLetter :: MonadicParsing m => m Char
- operator :: MonadicParsing m => m String
- fileName :: Delta -> String
- lineNum :: Delta -> Int
- columnNum :: Delta -> Int
- getFC :: MonadicParsing m => m FC
- bindList :: (Name -> PTerm -> PTerm -> PTerm) -> [(Name, PTerm)] -> PTerm -> PTerm
- pushIndent :: IdrisParser ()
- popIndent :: IdrisParser ()
- indent :: IdrisParser Int
- lastIndent :: IdrisParser Int
- indented :: IdrisParser a -> IdrisParser a
- indentedBlock :: IdrisParser a -> IdrisParser [a]
- indentedBlock1 :: IdrisParser a -> IdrisParser [a]
- indentedBlockS :: IdrisParser a -> IdrisParser a
- lookAheadMatches :: MonadicParsing m => m a -> m Bool
- openBlock :: IdrisParser ()
- closeBlock :: IdrisParser ()
- terminator :: IdrisParser ()
- keepTerminator :: IdrisParser ()
- notEndApp :: IdrisParser ()
- notEndBlock :: IdrisParser ()
- data IndentProperty = IndentProperty (Int -> Int -> Bool) String
- indentPropHolds :: IndentProperty -> IdrisParser ()
- gtProp :: IndentProperty
- gteProp :: IndentProperty
- eqProp :: IndentProperty
- ltProp :: IndentProperty
- lteProp :: IndentProperty
- notOpenBraces :: IdrisParser ()
- accessibility :: IdrisParser Accessibility
- addAcc :: Name -> Maybe Accessibility -> IdrisParser ()
- accData :: Maybe Accessibility -> Name -> [Name] -> IdrisParser ()
- fixErrorMsg :: String -> [String] -> String
- collect :: [PDecl] -> [PDecl]
Documentation
type IdrisParser = StateT IState IdrisInnerParserSource
Idris parser with state used during parsing
newtype IdrisInnerParser a Source
IdrisInnerParser | |
|
Monad IdrisInnerParser | |
Functor IdrisInnerParser | |
MonadPlus IdrisInnerParser | |
Applicative IdrisInnerParser | |
Alternative IdrisInnerParser | |
DeltaParsing IdrisInnerParser | |
TokenParsing IdrisInnerParser | |
Parsing IdrisInnerParser | |
CharParsing IdrisInnerParser | |
LookAheadParsing IdrisInnerParser | |
MarkParsing Delta IdrisInnerParser | |
Monoid (IdrisInnerParser a) |
type MonadicParsing m = (DeltaParsing m, LookAheadParsing m, TokenParsing m, Monad m)Source
Generalized monadic parsing constraint type
runparser :: StateT st IdrisInnerParser res -> st -> String -> String -> Result resSource
Helper to run Idris inner parser based stateT parsers
Space, comments and literals (token/lexing like parsers)
simpleWhiteSpace :: MonadicParsing m => m ()Source
Consumes any simple whitespace (any character which satisfies Char.isSpace)
eol :: MonadicParsing m => m ()Source
isDocCommentMarker :: Char -> BoolSource
Checks if a character is a documentation comment marker
singleLineComment :: MonadicParsing m => m ()Source
Consumes a single-line comment
SingleLineComment_t ::= '--' EOL_t | '--' ~DocCommentMarker_t ~EOL_t* EOL_t ;
multiLineComment :: MonadicParsing m => m ()Source
Consumes a multi-line comment
MultiLineComment_t ::= '{ -- }' | '{ -' ~DocCommentMarker_t InCommentChars_t ;
InCommentChars_t ::= '- }' | MultiLineComment_t InCommentChars_t | ~'- }'+ InCommentChars_t ;
docComment :: MonadicParsing m => Char -> m StringSource
Parses a documentation comment (similar to haddoc) given a marker character
DocComment_t ::= '--' DocCommentMarker_t ~EOL_t* EOL_t | '{ -' DocCommentMarket_t ~'- }'* '- }' ;
whiteSpace :: MonadicParsing m => m ()Source
Parses some white space
stringLiteral :: MonadicParsing m => m StringSource
Parses a string literal
charLiteral :: MonadicParsing m => m CharSource
Parses a char literal
natural :: MonadicParsing m => m IntegerSource
Parses a natural number
integer :: MonadicParsing m => m IntegerSource
Parses an integral number
float :: MonadicParsing m => m DoubleSource
Parses a floating point number
Symbols, identifiers, names and operators
idrisStyle :: MonadicParsing m => IdentifierStyle mSource
Idris Style for parsing identifiers/reserved keywords
char :: MonadicParsing m => Char -> m CharSource
string :: MonadicParsing m => String -> m StringSource
lchar :: MonadicParsing m => Char -> m CharSource
Parses a character as a token
symbol :: MonadicParsing m => String -> m StringSource
Parses string as a token
reserved :: MonadicParsing m => String -> m ()Source
Parses a reserved identifier
reservedOp :: MonadicParsing m => String -> m ()Source
Parses a reserved operator
identifier :: MonadicParsing m => m StringSource
Parses an identifier as a token
iName :: MonadicParsing m => [String] -> m NameSource
Parses an identifier with possible namespace as a name
maybeWithNS :: MonadicParsing m => m String -> Bool -> [String] -> m NameSource
Parses an string possibly prefixed by a namespace
name :: IdrisParser NameSource
Parses a name
initsEndAt :: (a -> Bool) -> [a] -> [[a]]Source
List of all initial segments in ascending order of a list. Every such initial segment ends right before an element satisfying the given condition.
mkName :: (String, String) -> NameSource
Create a Name
from a pair of strings representing a base name and its
namespace.
operatorLetter :: MonadicParsing m => m CharSource
operator :: MonadicParsing m => m StringSource
Parses an operator
Position helpers
fileName :: Delta -> StringSource
Get filename from position (returns (interactive) when no source file is given)
getFC :: MonadicParsing m => m FCSource
Get file position as FC
Syntax helpers
bindList :: (Name -> PTerm -> PTerm -> PTerm) -> [(Name, PTerm)] -> PTerm -> PTermSource
Bind constraints to term
Layout helpers
pushIndent :: IdrisParser ()Source
Push indentation to stack
popIndent :: IdrisParser ()Source
Pops indentation from stack
indent :: IdrisParser IntSource
Gets current indentation
lastIndent :: IdrisParser IntSource
Gets last indentation
indented :: IdrisParser a -> IdrisParser aSource
Applies parser in an indented position
indentedBlock :: IdrisParser a -> IdrisParser [a]Source
Applies parser to get a block (which has possibly indented statements)
indentedBlock1 :: IdrisParser a -> IdrisParser [a]Source
Applies parser to get a block with at least one statement (which has possibly indented statements)
indentedBlockS :: IdrisParser a -> IdrisParser aSource
Applies parser to get a block with exactly one (possibly indented) statement
lookAheadMatches :: MonadicParsing m => m a -> m BoolSource
Checks if the following character matches provided parser
openBlock :: IdrisParser ()Source
Parses a start of block
closeBlock :: IdrisParser ()Source
Parses an end of block
terminator :: IdrisParser ()Source
Parses a terminator
keepTerminator :: IdrisParser ()Source
Parses and keeps a terminator
notEndApp :: IdrisParser ()Source
Checks if application expression does not end
notEndBlock :: IdrisParser ()Source
Checks that it is not end of block
data IndentProperty Source
Representation of an operation that can compare the current indentation with the last indentation, and an error message if it fails
IndentProperty (Int -> Int -> Bool) String |
indentPropHolds :: IndentProperty -> IdrisParser ()Source
Allows comparison of indent, and fails if property doesn't hold
gtProp :: IndentPropertySource
Greater-than indent property
gteProp :: IndentPropertySource
Greater-than or equal to indent property
eqProp :: IndentPropertySource
Equal indent property
ltProp :: IndentPropertySource
Less-than indent property
lteProp :: IndentPropertySource
Less-than or equal to indent property
notOpenBraces :: IdrisParser ()Source
Checks that there are no braces that are not closed
accessibility :: IdrisParser AccessibilitySource
Parses an accessibilty modifier (e.g. public, private)
addAcc :: Name -> Maybe Accessibility -> IdrisParser ()Source
Adds accessibility option for function
accData :: Maybe Accessibility -> Name -> [Name] -> IdrisParser ()Source
Add accessbility option for data declarations
(works for classes too - abstract
means the data/class is visible but members not)
Error reporting helpers
fixErrorMsg :: String -> [String] -> StringSource
Error message with possible fixes list