Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- class HasField (x :: k) r a | x r -> a where
- getField :: r -> a
- data HFList (a :: k -> Type) (b :: [k]) where
- data DictF (a :: k -> Constraint) (b :: k) where
- DictF :: forall k (a :: k -> Constraint) (b :: k). a b => DictF a b
- class TokensMember tokens t where
- tokensMembership :: Proxy# '(tokens, t) -> Membership (TokensTag tokens) t
- data Expr rules tokens elem us
- class Rules rules where
- generateRules :: T (DictF (HasRuleExprField rules)) (RulesTag rules)
- class MemberInitials rules initials where
- memberInitials :: T (DictF (HasRuleExprField rules)) initials
- class (KnownSymbol v, HasField v rules (RuleExprType rules (RuleExprReturnType rules v))) => HasRuleExprField rules v where
- type RuleExprReturnType rules v :: Type
- nonTerminalName :: rules -> proxy v -> String
- class GrammarToken tokens elem where
- tokenToTerminal :: Proxy tokens -> elem -> T (TokensTag tokens)
- type family RuleExprType (rules :: Type) :: Type -> Type
- type family RulesTag (rules :: Type) :: [Symbol]
- type family TokensTag (tokens :: Type) :: [Symbol]
- fixGrammar :: forall initials action rules tokens elem. MemberInitials rules initials => Rules rules => RuleExprType rules ~ RuleExpr action rules tokens elem => rules -> Grammar action rules tokens elem initials
- ruleExpr :: [Alt action rules tokens elem a] -> RuleExpr action rules tokens elem a
- (<^>) :: Expr rules tokens elem us1 -> Expr rules tokens elem us2 -> Expr rules tokens elem (Concat us1 us2)
- var :: KnownSymbol v => proxy v -> Expr rules tokens elem '[RuleExprReturnType rules v]
- varA :: forall v rules tokens elem. KnownSymbol v => Expr rules tokens elem '[RuleExprReturnType rules v]
- tok :: Membership (TokensTag tokens) t -> Expr rules tokens elem '[elem]
- tokA :: forall t rules tokens elem. TokensMember tokens t => Expr rules tokens elem '[elem]
- data ActionTaskResult ctx a
- = ActionTaskFail
- | ActionTaskResult a
- | ActionTaskModifyResult ctx a
- newtype ActionTask ctx a = ActionTask {
- runActionTask :: ctx -> ActionTaskResult ctx a
- type SemAct = SemActM ()
- newtype SemActM ctx us a = SemActM {
- semanticAction :: HList us -> ActionTask ctx a
- type HList = T Identity
- type Alt = AltM ()
- type RuleExpr = RuleExprM ()
- type Grammar = GrammarM ()
- type AltM ctx = Alt (SemActM ctx)
- type RuleExprM ctx = RuleExpr (SemActM ctx)
- type GrammarM ctx = Grammar (SemActM ctx)
- pattern (:*) :: u -> HList us -> HList (u ': us)
- pattern HNil :: HList '[]
- (<:>) :: Expr rules tokens elem us -> (HList us -> a) -> AltM ctx rules tokens elem a
- eps :: (HList '[] -> a) -> AltM ctx rules tokens elem a
- (<::>) :: Expr rules tokens elem us -> (HList us -> ActionTask ctx a) -> AltM ctx rules tokens elem a
- epsM :: (HList '[] -> ActionTask ctx a) -> AltM ctx rules tokens elem a
- getAction :: ActionTask ctx ctx
- modifyAction :: (ctx -> ctx) -> ActionTask ctx ()
- failAction :: ActionTask ctx a
- data ParseResult posMark altHelp a
- = Parsed a
- | ParseFailed posMark (FailedReason altHelp)
- type Result posMark = ParseResult posMark ()
- runParser :: forall v initials posMark m rules elem proxy. Member initials v => T posMark elem m => proxy v -> Runner rules elem initials -> m (Result posMark (RuleExprReturnType rules v))
- newtype ListScanner e a = ListScanner {
- unListScanner :: State [e] a
- data ScanMode posMark
- = ScanModeNoBack
- | ScanModeNeedBack posMark
- class Monad m => Scanner posMark elem m | m -> posMark, m -> elem where
- consumeInput :: m (Maybe elem)
- getPosMark :: m posMark
- seekToPosMark :: posMark -> m ()
- scanMode :: ScanMode posMark -> m ()
- runListScanner :: ListScanner e a -> [e] -> a
- type Parser = T
- genRunner :: GrammarToken tokens elem => GrammarM ctx rules tokens elem initials -> Either [StringLit] (Parser ctx rules elem initials)
Documentation
class HasField (x :: k) r a | x r -> a where #
Constraint representing the fact that the field x
belongs to
the record type r
and has field type a
. This will be solved
automatically, but manual instances may be provided as well.
data DictF (a :: k -> Constraint) (b :: k) where #
DictF :: forall k (a :: k -> Constraint) (b :: k). a b => DictF a b |
class TokensMember tokens t where Source #
tokensMembership :: Proxy# '(tokens, t) -> Membership (TokensTag tokens) t Source #
class Rules rules where Source #
generateRules :: T (DictF (HasRuleExprField rules)) (RulesTag rules) Source #
class MemberInitials rules initials where Source #
memberInitials :: T (DictF (HasRuleExprField rules)) initials Source #
class (KnownSymbol v, HasField v rules (RuleExprType rules (RuleExprReturnType rules v))) => HasRuleExprField rules v where Source #
Nothing
type RuleExprReturnType rules v :: Type Source #
nonTerminalName :: rules -> proxy v -> String Source #
class GrammarToken tokens elem where Source #
fixGrammar :: forall initials action rules tokens elem. MemberInitials rules initials => Rules rules => RuleExprType rules ~ RuleExpr action rules tokens elem => rules -> Grammar action rules tokens elem initials Source #
(<^>) :: Expr rules tokens elem us1 -> Expr rules tokens elem us2 -> Expr rules tokens elem (Concat us1 us2) infixr 5 Source #
var :: KnownSymbol v => proxy v -> Expr rules tokens elem '[RuleExprReturnType rules v] Source #
varA :: forall v rules tokens elem. KnownSymbol v => Expr rules tokens elem '[RuleExprReturnType rules v] Source #
tokA :: forall t rules tokens elem. TokensMember tokens t => Expr rules tokens elem '[elem] Source #
data ActionTaskResult ctx a Source #
Instances
Functor (ActionTaskResult ctx) Source # | |
Defined in Language.Parser.Ptera.Syntax fmap :: (a -> b) -> ActionTaskResult ctx a -> ActionTaskResult ctx b # (<$) :: a -> ActionTaskResult ctx b -> ActionTaskResult ctx a # | |
(Eq a, Eq ctx) => Eq (ActionTaskResult ctx a) Source # | |
Defined in Language.Parser.Ptera.Syntax (==) :: ActionTaskResult ctx a -> ActionTaskResult ctx a -> Bool # (/=) :: ActionTaskResult ctx a -> ActionTaskResult ctx a -> Bool # | |
(Show a, Show ctx) => Show (ActionTaskResult ctx a) Source # | |
Defined in Language.Parser.Ptera.Syntax showsPrec :: Int -> ActionTaskResult ctx a -> ShowS # show :: ActionTaskResult ctx a -> String # showList :: [ActionTaskResult ctx a] -> ShowS # |
newtype ActionTask ctx a Source #
ActionTask | |
|
Instances
Monad (ActionTask ctx) Source # | |
Defined in Language.Parser.Ptera.Syntax (>>=) :: ActionTask ctx a -> (a -> ActionTask ctx b) -> ActionTask ctx b # (>>) :: ActionTask ctx a -> ActionTask ctx b -> ActionTask ctx b # return :: a -> ActionTask ctx a # | |
Functor (ActionTask ctx) Source # | |
Defined in Language.Parser.Ptera.Syntax fmap :: (a -> b) -> ActionTask ctx a -> ActionTask ctx b # (<$) :: a -> ActionTask ctx b -> ActionTask ctx a # | |
Applicative (ActionTask ctx) Source # | |
Defined in Language.Parser.Ptera.Syntax pure :: a -> ActionTask ctx a # (<*>) :: ActionTask ctx (a -> b) -> ActionTask ctx a -> ActionTask ctx b # liftA2 :: (a -> b -> c) -> ActionTask ctx a -> ActionTask ctx b -> ActionTask ctx c # (*>) :: ActionTask ctx a -> ActionTask ctx b -> ActionTask ctx b # (<*) :: ActionTask ctx a -> ActionTask ctx b -> ActionTask ctx a # |
newtype SemActM ctx us a Source #
SemActM | |
|
(<:>) :: Expr rules tokens elem us -> (HList us -> a) -> AltM ctx rules tokens elem a infixl 4 Source #
(<::>) :: Expr rules tokens elem us -> (HList us -> ActionTask ctx a) -> AltM ctx rules tokens elem a infixl 4 Source #
getAction :: ActionTask ctx ctx Source #
modifyAction :: (ctx -> ctx) -> ActionTask ctx () Source #
failAction :: ActionTask ctx a Source #
data ParseResult posMark altHelp a Source #
Parsed a | |
ParseFailed posMark (FailedReason altHelp) |
Instances
Functor (ParseResult posMark altHelp) Source # | |
Defined in Language.Parser.Ptera.Runner.RunT fmap :: (a -> b) -> ParseResult posMark altHelp a -> ParseResult posMark altHelp b # (<$) :: a -> ParseResult posMark altHelp b -> ParseResult posMark altHelp a # | |
(Show a, Show posMark, Show altHelp) => Show (ParseResult posMark altHelp a) Source # | |
Defined in Language.Parser.Ptera.Runner.RunT showsPrec :: Int -> ParseResult posMark altHelp a -> ShowS # show :: ParseResult posMark altHelp a -> String # showList :: [ParseResult posMark altHelp a] -> ShowS # |
type Result posMark = ParseResult posMark () Source #
runParser :: forall v initials posMark m rules elem proxy. Member initials v => T posMark elem m => proxy v -> Runner rules elem initials -> m (Result posMark (RuleExprReturnType rules v)) Source #
newtype ListScanner e a Source #
ListScanner | |
|
Instances
data ScanMode posMark Source #
ScanModeNoBack | |
ScanModeNeedBack posMark |
class Monad m => Scanner posMark elem m | m -> posMark, m -> elem where Source #
consumeInput :: m (Maybe elem) Source #
getPosMark :: m posMark Source #
seekToPosMark :: posMark -> m () Source #
Instances
Scanner [e] e (ListScanner e) Source # | |
Defined in Language.Parser.Ptera.Scanner consumeInput :: ListScanner e (Maybe e) Source # getPosMark :: ListScanner e [e] Source # seekToPosMark :: [e] -> ListScanner e () Source # scanMode :: ScanMode [e] -> ListScanner e () Source # |
runListScanner :: ListScanner e a -> [e] -> a Source #