ptera-th-0.6.0.0: A parser generator
Safe HaskellNone
LanguageHaskell2010

Language.Parser.Ptera.TH

Documentation

modifyAction :: (ctx -> ctx) -> ActionTask ctx () #

newtype ActionTask ctx a #

Constructors

ActionTask 

Fields

Instances

Instances details
Monad (ActionTask ctx) 
Instance details

Defined in Language.Parser.Ptera.Syntax

Methods

(>>=) :: 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) 
Instance details

Defined in Language.Parser.Ptera.Syntax

Methods

fmap :: (a -> b) -> ActionTask ctx a -> ActionTask ctx b #

(<$) :: a -> ActionTask ctx b -> ActionTask ctx a #

Applicative (ActionTask ctx) 
Instance details

Defined in Language.Parser.Ptera.Syntax

Methods

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

Instances details
Functor (ActionTaskResult ctx) 
Instance details

Defined in Language.Parser.Ptera.Syntax

Methods

fmap :: (a -> b) -> ActionTaskResult ctx a -> ActionTaskResult ctx b #

(<$) :: a -> ActionTaskResult ctx b -> ActionTaskResult ctx a #

(Eq a, Eq ctx) => Eq (ActionTaskResult ctx a) 
Instance details

Defined in Language.Parser.Ptera.Syntax

Methods

(==) :: ActionTaskResult ctx a -> ActionTaskResult ctx a -> Bool #

(/=) :: ActionTaskResult ctx a -> ActionTaskResult ctx a -> Bool #

(Show a, Show ctx) => Show (ActionTaskResult ctx a) 
Instance details

Defined in Language.Parser.Ptera.Syntax

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 #

Methods

tokenToTerminal :: Proxy tokens -> elem -> T (TokensTag tokens) #

type family RuleExprReturnType rules (v :: Symbol) #

class KnownSymbol v => HasRuleExprField rules (v :: Symbol) where #

Minimal complete definition

getExprField

Associated Types

type RuleExprReturnType rules (v :: Symbol) #

Methods

getExprField :: rules -> proxy v -> RuleExprType rules (RuleExprReturnType rules v) #

nonTerminalName :: rules -> proxy v -> String #

class MemberInitials rules (initials :: [Symbol]) where #

Methods

memberInitials :: T (DictF (HasRuleExprField rules)) initials #

class Rules rules where #

Methods

generateRules :: T (DictF (HasRuleExprField rules)) (RulesTag rules) #

class TokensMember tokens (t :: Symbol) where #

Methods

tokensMembership :: Proxy# '(tokens, t) -> Membership (TokensTag tokens) t #

data DictF (a :: k -> Constraint) (b :: k) where #

Constructors

DictF :: forall k (a :: k -> Constraint) (b :: k). a b => DictF a b 

data HFList (a :: k -> Type) (b :: [k]) where #

Constructors

HFNil :: forall k (a :: k -> Type). HFList a ('[] :: [k]) 
HFCons :: forall k (a :: k -> Type) (x :: k) (xs :: [k]). a x -> HFList a xs -> HFList a (x ': xs) 

data SemActM ctx us a Source #

newtype TExpQ a Source #

Constructors

TExpQ 

Fields

data TypedExpr rules tokens elem us Source #

type Alt = AltM () Source #

type AltM ctx = Alt (SemActM ctx) Source #

type RuleExprM ctx = RuleExpr (SemActM ctx) Source #

type GrammarM ctx = Grammar (SemActM ctx) Source #

pattern (:*) :: Q (TExp u) -> HTExpList us -> HTExpList (u ': us) infixr 6 Source #

pattern HNil :: HTExpList '[] Source #

eps :: TypedExpr rules tokens elem '[] Source #

(<^>) :: TypedExpr rules tokens elem us1 -> TypedExpr rules tokens elem us2 -> TypedExpr rules tokens elem (Concat us1 us2) infixr 5 Source #

(<:>) :: T ctx => T a => TypedExpr rules tokens elem us -> (HTExpList us -> Q (TExp a)) -> AltM ctx rules tokens elem a infixl 4 Source #

(<::>) :: T ctx => T a => TypedExpr rules tokens elem us -> (HTExpList us -> Q (TExp (ActionTask ctx a))) -> AltM ctx rules tokens elem a infixl 4 Source #

var :: forall v rules tokens elem proxy1 proxy2 a. KnownSymbol v => a ~ RuleExprReturnType rules v => T a => proxy1 rules -> proxy2 v -> TypedExpr rules tokens elem '[a] Source #

varA :: forall v rules tokens elem a. KnownSymbol v => a ~ RuleExprReturnType rules v => T a => TypedExpr rules tokens elem '[a] Source #

tok :: forall t rules tokens elem proxy. T elem => proxy elem -> Membership (TokensTag tokens) t -> TypedExpr rules tokens elem '[elem] Source #

tokA :: forall t rules tokens elem. T elem => TokensMember tokens t => TypedExpr rules tokens elem '[elem] Source #

runListScanner :: ListScanner e a -> [e] -> a #

class Monad m => Scanner posMark elem (m :: Type -> Type) | m -> posMark, m -> elem where #

Methods

consumeInput :: m (Maybe elem) #

getPosMark :: m posMark #

seekToPosMark :: posMark -> m () #

scanMode :: ScanMode posMark -> m () #

Instances

Instances details
Scanner [e] e (ListScanner e) 
Instance details

Defined in Language.Parser.Ptera.Scanner

data ScanMode posMark #

Constructors

ScanModeNoBack 
ScanModeNeedBack posMark 

Instances

Instances details
Eq posMark => Eq (ScanMode posMark) 
Instance details

Defined in Language.Parser.Ptera.Scanner

Methods

(==) :: ScanMode posMark -> ScanMode posMark -> Bool #

(/=) :: ScanMode posMark -> ScanMode posMark -> Bool #

Show posMark => Show (ScanMode posMark) 
Instance details

Defined in Language.Parser.Ptera.Scanner

Methods

showsPrec :: Int -> ScanMode posMark -> ShowS #

show :: ScanMode posMark -> String #

showList :: [ScanMode posMark] -> ShowS #

newtype ListScanner e a #

Constructors

ListScanner 

Fields

Instances

Instances details
Monad (ListScanner e) 
Instance details

Defined in Language.Parser.Ptera.Scanner

Methods

(>>=) :: ListScanner e a -> (a -> ListScanner e b) -> ListScanner e b #

(>>) :: ListScanner e a -> ListScanner e b -> ListScanner e b #

return :: a -> ListScanner e a #

Functor (ListScanner e) 
Instance details

Defined in Language.Parser.Ptera.Scanner

Methods

fmap :: (a -> b) -> ListScanner e a -> ListScanner e b #

(<$) :: a -> ListScanner e b -> ListScanner e a #

Applicative (ListScanner e) 
Instance details

Defined in Language.Parser.Ptera.Scanner

Methods

pure :: a -> ListScanner e a #

(<*>) :: ListScanner e (a -> b) -> ListScanner e a -> ListScanner e b #

liftA2 :: (a -> b -> c) -> ListScanner e a -> ListScanner e b -> ListScanner e c #

(*>) :: ListScanner e a -> ListScanner e b -> ListScanner e b #

(<*) :: ListScanner e a -> ListScanner e b -> ListScanner e a #

Scanner [e] e (ListScanner e) 
Instance details

Defined in Language.Parser.Ptera.Scanner

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 #

Constructors

Parsed a 
ParseFailed posMark (FailedReason altHelp) 

Instances

Instances details
Functor (ParseResult posMark altHelp) 
Instance details

Defined in Language.Parser.Ptera.Runner.RunT

Methods

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) 
Instance details

Defined in Language.Parser.Ptera.Runner.RunT

Methods

showsPrec :: Int -> ParseResult posMark altHelp a -> ShowS #

show :: ParseResult posMark altHelp a -> String #

showList :: [ParseResult posMark altHelp a] -> ShowS #

class LiftType a where Source #

Methods

liftType :: proxy a -> Q Type Source #

Instances

Instances details
LiftType Char Source # 
Instance details

Defined in Language.Parser.Ptera.TH.Class.LiftType

Methods

liftType :: proxy Char -> Q Type Source #

LiftType Int Source # 
Instance details

Defined in Language.Parser.Ptera.TH.Class.LiftType

Methods

liftType :: proxy Int -> Q Type Source #

LiftType Integer Source # 
Instance details

Defined in Language.Parser.Ptera.TH.Class.LiftType

Methods

liftType :: proxy Integer -> Q Type Source #

LiftType () Source # 
Instance details

Defined in Language.Parser.Ptera.TH.Class.LiftType

Methods

liftType :: proxy () -> Q Type Source #

LiftType a => LiftType ([a] :: Type) Source # 
Instance details

Defined in Language.Parser.Ptera.TH.Class.LiftType

Methods

liftType :: proxy [a] -> Q Type0 Source #

LiftType a => LiftType (Maybe a :: Type) Source # 
Instance details

Defined in Language.Parser.Ptera.TH.Class.LiftType

Methods

liftType :: proxy (Maybe a) -> Q Type0 Source #

LiftType a => LiftType (Ratio a :: Type) Source # 
Instance details

Defined in Language.Parser.Ptera.TH.Class.LiftType

Methods

liftType :: proxy (Ratio a) -> Q Type0 Source #

LiftType a => LiftType (Seq a :: Type) Source # 
Instance details

Defined in Language.Parser.Ptera.TH.Class.LiftType

Methods

liftType :: proxy (Seq a) -> Q Type0 Source #

(LiftType a, LiftType b) => LiftType ((a, b) :: Type) Source # 
Instance details

Defined in Language.Parser.Ptera.TH.Class.LiftType

Methods

liftType :: proxy (a, b) -> Q Type0 Source #

(LiftType a, LiftType b, LiftType c) => LiftType ((a, b, c) :: Type) Source # 
Instance details

Defined in Language.Parser.Ptera.TH.Class.LiftType

Methods

liftType :: proxy (a, b, c) -> Q Type0 Source #

genRunner :: forall initials rules tokens ctx elem. GrammarToken tokens elem => Generate (TokensTag tokens) => GenParam -> GrammarM ctx rules tokens elem initials -> Q [Dec] Source #

data GenParam Source #

Constructors

GenParam