Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- class HasField (x :: k) r a | x r -> a where
- getField :: r -> a
- failAction :: ActionTask ctx a
- modifyAction :: (ctx -> ctx) -> ActionTask ctx ()
- getAction :: ActionTask ctx ctx
- newtype ActionTask ctx a = ActionTask {
- runActionTask :: ctx -> ActionTaskResult ctx a
- data ActionTaskResult ctx a
- = ActionTaskFail
- | ActionTaskResult a
- | ActionTaskModifyResult ctx a
- tokA :: forall (t :: Symbol) rules tokens elem. TokensMember tokens t => Expr rules tokens elem '[elem]
- tok :: forall tokens (t :: Symbol) rules elem. Membership (TokensTag tokens) t -> Expr rules tokens elem '[elem]
- varA :: forall (v :: Symbol) rules tokens elem. KnownSymbol v => Expr rules tokens elem '[RuleExprReturnType rules v]
- var :: forall (v :: Symbol) proxy rules tokens elem. KnownSymbol v => proxy v -> Expr rules tokens elem '[RuleExprReturnType rules v]
- (<^>) :: forall rules tokens elem (us1 :: [Type]) (us2 :: [Type]). Expr rules tokens elem us1 -> Expr rules tokens elem us2 -> Expr rules tokens elem (Concat us1 us2)
- ruleExpr :: forall (action :: [Type] -> Type -> Type) rules tokens elem a. [Alt action rules tokens elem a] -> RuleExpr action rules tokens elem a
- fixGrammar :: forall (initials :: [Symbol]) (action :: [Type] -> Type -> Type) rules tokens elem. (MemberInitials rules initials, Rules rules, RuleExprType rules ~ RuleExpr action rules tokens elem) => rules -> Grammar action rules tokens elem initials
- type family TokensTag tokens :: [Symbol]
- type family RulesTag rules :: [Symbol]
- type family RuleExprType rules :: Type -> Type
- class GrammarToken tokens elem where
- tokenToTerminal :: Proxy tokens -> elem -> T (TokensTag tokens)
- type family RuleExprReturnType rules (v :: Symbol)
- class (KnownSymbol v, HasField v rules (RuleExprType rules (RuleExprReturnType rules v))) => HasRuleExprField rules (v :: Symbol) where
- type RuleExprReturnType rules (v :: Symbol)
- nonTerminalName :: rules -> proxy v -> String
- class MemberInitials rules (initials :: [Symbol]) where
- memberInitials :: T (DictF (HasRuleExprField rules)) initials
- class Rules rules where
- generateRules :: T (DictF (HasRuleExprField rules)) (RulesTag rules)
- data Expr rules tokens elem (us :: [Type])
- class TokensMember tokens (t :: Symbol) where
- tokensMembership :: Proxy# '(tokens, t) -> Membership (TokensTag tokens) t
- data DictF (a :: k -> Constraint) (b :: k) where
- DictF :: forall k (a :: k -> Constraint) (b :: k). a b => DictF a b
- data HFList (a :: k -> Type) (b :: [k]) where
- type SemAct = SemActM ()
- data SemActM ctx us a
- newtype TExpQ a = TExpQ {}
- type HTExpList = T TExpQ
- 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 (:*) :: Q (TExp u) -> HTExpList us -> HTExpList (u ': us)
- pattern HNil :: HTExpList '[]
- (<:>) :: Expr rules tokens elem us -> (HTExpList us -> Q (TExp a)) -> AltM ctx rules tokens elem a
- eps :: (HTExpList '[] -> Q (TExp a)) -> AltM ctx rules tokens elem a
- (<::>) :: Expr rules tokens elem us -> (HTExpList us -> Q (TExp (ActionTask ctx a))) -> AltM ctx rules tokens elem a
- epsM :: (HTExpList '[] -> Q (TExp (ActionTask ctx a))) -> AltM ctx rules tokens elem a
- runListScanner :: ListScanner e a -> [e] -> a
- class Monad m => Scanner posMark elem (m :: Type -> Type) | m -> posMark, m -> elem where
- consumeInput :: m (Maybe elem)
- getPosMark :: m posMark
- seekToPosMark :: posMark -> m ()
- scanMode :: ScanMode posMark -> m ()
- data ScanMode posMark
- = ScanModeNoBack
- | ScanModeNeedBack posMark
- newtype ListScanner e a = ListScanner {
- unListScanner :: State [e] a
- runParser :: forall (v :: Symbol) (initials :: [Symbol]) posMark m rules elem proxy. (Member initials v, T posMark elem m) => proxy v -> Runner rules elem initials -> m (Result posMark (RuleExprReturnType rules v))
- runParserM :: forall (v :: Symbol) (initials :: [Symbol]) ctx posMark m rules elem proxy. (Member initials v, T posMark elem m) => proxy v -> RunnerM ctx rules elem initials -> ctx -> m (Result posMark (RuleExprReturnType rules v))
- type Result posMark = ParseResult posMark ()
- data ParseResult posMark altHelp a
- = Parsed a
- | ParseFailed posMark (FailedReason altHelp)
- module Language.Parser.Ptera.TH.ParserLib
- data GenRulesTypes = GenRulesTypes {
- genRulesCtxTy :: Q Type
- genRulesTokensTy :: Q Type
- genRulesTokenTy :: Q Type
- genGrammarToken :: Name -> Q Type -> [(String, Q Pat)] -> Q [Dec]
- genRules :: Name -> GenRulesTypes -> [(Name, String, Q Type)] -> Q [Dec]
- genParsePoints :: Name -> Name -> [String] -> Q [Dec]
- genRunner :: forall initials rules tokens ctx elem. GrammarToken tokens elem => Generate (TokensTag tokens) => GenParam -> GrammarM ctx rules tokens elem initials -> Q [Dec]
- data GenParam = GenParam {}
- defaultCustomCtxTy :: Q Type
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.
failAction :: ActionTask ctx a #
modifyAction :: (ctx -> ctx) -> ActionTask ctx () #
getAction :: ActionTask ctx ctx #
newtype ActionTask ctx a #
ActionTask | |
|
Instances
Monad (ActionTask ctx) | |
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) | |
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) | |
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 # |
data ActionTaskResult ctx a #
Instances
Functor (ActionTaskResult ctx) | |
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) | |
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) | |
Defined in Language.Parser.Ptera.Syntax showsPrec :: Int -> ActionTaskResult ctx a -> ShowS # show :: ActionTaskResult ctx a -> String # showList :: [ActionTaskResult ctx a] -> ShowS # |
tokA :: forall (t :: Symbol) rules tokens elem. TokensMember tokens t => Expr rules tokens elem '[elem] #
tok :: forall tokens (t :: Symbol) rules elem. Membership (TokensTag tokens) t -> Expr rules tokens elem '[elem] #
varA :: forall (v :: Symbol) rules tokens elem. KnownSymbol v => Expr rules tokens elem '[RuleExprReturnType rules v] #
var :: forall (v :: Symbol) proxy rules tokens elem. KnownSymbol v => proxy v -> Expr rules tokens elem '[RuleExprReturnType rules v] #
(<^>) :: forall rules tokens elem (us1 :: [Type]) (us2 :: [Type]). Expr rules tokens elem us1 -> Expr rules tokens elem us2 -> Expr rules tokens elem (Concat us1 us2) infixr 5 #
ruleExpr :: forall (action :: [Type] -> Type -> Type) rules tokens elem a. [Alt action rules tokens elem a] -> RuleExpr action rules tokens elem a #
fixGrammar :: forall (initials :: [Symbol]) (action :: [Type] -> Type -> Type) rules tokens elem. (MemberInitials rules initials, Rules rules, RuleExprType rules ~ RuleExpr action rules tokens elem) => rules -> Grammar action rules tokens elem initials #
type family RuleExprType rules :: Type -> Type #
class GrammarToken tokens elem where #
tokenToTerminal :: Proxy tokens -> elem -> T (TokensTag tokens) #
type family RuleExprReturnType rules (v :: Symbol) #
class (KnownSymbol v, HasField v rules (RuleExprType rules (RuleExprReturnType rules v))) => HasRuleExprField rules (v :: Symbol) where #
Nothing
type RuleExprReturnType rules (v :: Symbol) #
nonTerminalName :: rules -> proxy v -> String #
class MemberInitials rules (initials :: [Symbol]) where #
memberInitials :: T (DictF (HasRuleExprField rules)) initials #
generateRules :: T (DictF (HasRuleExprField rules)) (RulesTag rules) #
class TokensMember tokens (t :: Symbol) where #
tokensMembership :: Proxy# '(tokens, t) -> Membership (TokensTag tokens) t #
data DictF (a :: k -> Constraint) (b :: k) where #
DictF :: forall k (a :: k -> Constraint) (b :: k). a b => DictF a b |
(<:>) :: Expr rules tokens elem us -> (HTExpList us -> Q (TExp a)) -> AltM ctx rules tokens elem a infixl 4 Source #
(<::>) :: Expr rules tokens elem us -> (HTExpList us -> Q (TExp (ActionTask ctx a))) -> AltM ctx rules tokens elem a infixl 4 Source #
runListScanner :: ListScanner e a -> [e] -> a #
class Monad m => Scanner posMark elem (m :: Type -> Type) | m -> posMark, m -> elem where #
Instances
Scanner [e] e (ListScanner e) | |
Defined in Language.Parser.Ptera.Scanner consumeInput :: ListScanner e (Maybe e) # getPosMark :: ListScanner e [e] # seekToPosMark :: [e] -> ListScanner e () # scanMode :: ScanMode [e] -> ListScanner e () # |
ScanModeNoBack | |
ScanModeNeedBack posMark |
newtype ListScanner e a #
ListScanner | |
|
Instances
runParser :: forall (v :: Symbol) (initials :: [Symbol]) posMark m rules elem proxy. (Member initials v, T posMark elem m) => proxy v -> Runner rules elem initials -> m (Result posMark (RuleExprReturnType rules v)) #
runParserM :: forall (v :: Symbol) (initials :: [Symbol]) ctx posMark m rules elem proxy. (Member initials v, T posMark elem m) => proxy v -> RunnerM ctx rules elem initials -> ctx -> m (Result posMark (RuleExprReturnType rules v)) #
type Result posMark = ParseResult posMark () #
data ParseResult posMark altHelp a #
Parsed a | |
ParseFailed posMark (FailedReason altHelp) |
Instances
Functor (ParseResult posMark altHelp) | |
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) | |
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 # |
data GenRulesTypes Source #
GenRulesTypes | |
|
genRunner :: forall initials rules tokens ctx elem. GrammarToken tokens elem => Generate (TokensTag tokens) => GenParam -> GrammarM ctx rules tokens elem initials -> Q [Dec] Source #