Stability | experimental |
---|---|
Safe Haskell | None |
Language | Haskell2010 |
A parser for Egison patterns.
Synopsis
- parseExprL :: (Source s, MonadError (Errors s) m) => ParseMode n v e s -> FilePath -> s -> m (ExprL n v e)
- parseExpr :: (Source s, MonadError (Errors s) m) => ParseMode n v e s -> FilePath -> s -> m (Expr n v e)
- data Location = Location {}
- data Position = Position {}
- class IsToken c where
- isSpace :: c -> Bool
- newline :: c
- parenLeft :: c
- parenRight :: c
- underscore :: c
- hash :: c
- question :: c
- exclamation :: c
- and :: c
- vertical :: c
- dollar :: c
- type Tokens s = Tokens s
- type Token s = Token s
- type Source s = (Stream s, IsToken (Token s))
- type Errors s = NonEmpty (Error s)
- data Error s
- data ErrorItem s
- = Tokens (Tokens s)
- | Label String
- | EndOfInput
- data Associativity
- newtype Precedence = Precedence Int
- data Fixity n = Fixity {
- associativity :: Associativity
- precedence :: Precedence
- symbol :: n
- data ParseMode n v e s = ParseMode {
- fixities :: [ParseFixity n s]
- blockComment :: Maybe (Tokens s, Tokens s)
- lineComment :: Maybe (Tokens s)
- varNameParser :: ExtParser s v
- nameParser :: ExtParser s n
- valueExprParser :: ExtParser s e
- data ParseFixity n s = ParseFixity {}
- type ExtParser s a = Tokens s -> Either String a
- type ExprL n v e = Cofree (ExprF n v e) Location
Documentation
parseExprL :: (Source s, MonadError (Errors s) m) => ParseMode n v e s -> FilePath -> s -> m (ExprL n v e) Source #
Parse Expr
with locations annotated.
parseExpr :: (Source s, MonadError (Errors s) m) => ParseMode n v e s -> FilePath -> s -> m (Expr n v e) Source #
Parse Expr
.
Re-exports
Location, a range of positions in source code.
Instances
Eq Location Source # | |
Data Location Source # | |
Defined in Language.Egison.Parser.Pattern.Prim.Location gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Location -> c Location # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Location # toConstr :: Location -> Constr # dataTypeOf :: Location -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Location) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Location) # gmapT :: (forall b. Data b => b -> b) -> Location -> Location # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Location -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Location -> r # gmapQ :: (forall d. Data d => d -> u) -> Location -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Location -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Location -> m Location # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Location -> m Location # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Location -> m Location # | |
Show Location Source # | |
Generic Location Source # | |
type Rep Location Source # | |
Defined in Language.Egison.Parser.Pattern.Prim.Location type Rep Location = D1 (MetaData "Location" "Language.Egison.Parser.Pattern.Prim.Location" "egison-pattern-src-0.1.0.0-inplace" False) (C1 (MetaCons "Location" PrefixI True) (S1 (MetaSel (Just "begin") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Position) :*: S1 (MetaSel (Just "end") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Position))) |
Position in source code.
Instances
Eq Position Source # | |
Data Position Source # | |
Defined in Language.Egison.Parser.Pattern.Prim.Location gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Position -> c Position # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Position # toConstr :: Position -> Constr # dataTypeOf :: Position -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Position) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Position) # gmapT :: (forall b. Data b => b -> b) -> Position -> Position # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Position -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Position -> r # gmapQ :: (forall d. Data d => d -> u) -> Position -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Position -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Position -> m Position # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Position -> m Position # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Position -> m Position # | |
Show Position Source # | |
Generic Position Source # | |
type Rep Position Source # | |
Defined in Language.Egison.Parser.Pattern.Prim.Location type Rep Position = D1 (MetaData "Position" "Language.Egison.Parser.Pattern.Prim.Location" "egison-pattern-src-0.1.0.0-inplace" False) (C1 (MetaCons "Position" PrefixI True) (S1 (MetaSel (Just "line") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int) :*: S1 (MetaSel (Just "column") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int))) |
class IsToken c where Source #
Provide a set of tokens needed to parse pattern expressions.
Instances
IsToken Char Source # | |
Defined in Language.Egison.Parser.Pattern.Token |
Parse error.
Token representation in Error
.
data Associativity Source #
Associativity of infix operators.
Instances
newtype Precedence Source #
A precedence of infix operators.
Instances
Fixity of infix operators.
Fixity | |
|
data ParseMode n v e s Source #
Parser configuration.
ParseMode | |
|