module Parser
where
import Data.Maybe
import UU.Parsing
import UU.Parsing.Machine(RealParser(..),RealRecogn(..),anaDynE,mkPR)
import ConcreteSyntax
import CommonTypes
import Patterns
import UU.Pretty(text,PP_Doc,empty,(>-<))
import TokenDef
import Data.List (intersperse)
import Data.Char
import Scanner (Input(..),scanLit,input)
import System.FilePath
import Data.List
import Expression
import Macro
import UU.Scanner.Token
import UU.Scanner.TokenParser
import UU.Scanner.GenToken
import UU.Scanner.GenTokenOrd
import UU.Scanner.GenTokenParser
import UU.Scanner.Position
import UU.Scanner.TokenShow()
import System.Directory
import System.FilePath
import HsTokenScanner
import Options
import Scanner(lowercaseKeywords)
type AGParser = AnaParser Input Pair Token Pos
pIdentifier, pIdentifierU, pIdentifierExcl :: AGParser Identifier
pIdentifierU :: AGParser Identifier
pIdentifierU = (String -> Pos -> Identifier) -> (String, Pos) -> Identifier
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry String -> Pos -> Identifier
Ident ((String, Pos) -> Identifier)
-> AnaParser Input Pair Token Pos (String, Pos)
-> AGParser Identifier
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos (String, Pos)
forall (p :: * -> *). IsParser p Token => p (String, Pos)
pConidPos
pIdentifier :: AGParser Identifier
pIdentifier = AGParser Identifier
pIdentifierExcl
pIdentifierExcl :: AGParser Identifier
pIdentifierExcl = (String -> Pos -> Identifier) -> (String, Pos) -> Identifier
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry String -> Pos -> Identifier
Ident ((String, Pos) -> Identifier)
-> AnaParser Input Pair Token Pos (String, Pos)
-> AGParser Identifier
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos (String, Pos)
forall (p :: * -> *). IsParser p Token => p (String, Pos)
pVaridPos
pKeywordAsIdent :: AGParser Identifier
pKeywordAsIdent :: AGParser Identifier
pKeywordAsIdent = (String -> AGParser Identifier) -> [String] -> AGParser Identifier
forall (p :: * -> *) s a a1.
IsParser p s =>
(a -> p a1) -> [a] -> p a1
pAny (\String
nm -> String -> Pos -> Identifier
Ident String
nm (Pos -> Identifier)
-> AnaParser Input Pair Token Pos Pos -> AGParser Identifier
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *). IsParser p Token => String -> p Pos
pKeyPos String
nm) [String]
lowercaseKeywords
parseAG :: Options -> [FilePath] -> String -> IO (AG,[Message Token Pos])
parseAG :: Options -> [String] -> String -> IO (AG, [Message Token Pos])
parseAG Options
opts [String]
searchPath String
file = do
([Elem]
es,[String]
_,[String]
_,Maybe String
_,[Message Token Pos]
mesg) <- Bool
-> Options
-> [String]
-> String
-> IO
([Elem], [String], [String], Maybe String, [Message Token Pos])
parseFile Bool
False Options
opts [String]
searchPath String
file
(AG, [Message Token Pos]) -> IO (AG, [Message Token Pos])
forall (m :: * -> *) a. Monad m => a -> m a
return ([Elem] -> AG
AG [Elem]
es, [Message Token Pos]
mesg)
parseAGI :: Options -> [FilePath] -> String -> IO (AG, Maybe String)
parseAGI :: Options -> [String] -> String -> IO (AG, Maybe String)
parseAGI Options
opts [String]
searchPath String
file
= do ([Elem]
es,[String]
_,[String]
_,Maybe String
ext,[Message Token Pos]
_) <- Bool
-> Options
-> [String]
-> String
-> IO
([Elem], [String], [String], Maybe String, [Message Token Pos])
parseFile Bool
True Options
opts [String]
searchPath String
file
(AG, Maybe String) -> IO (AG, Maybe String)
forall (m :: * -> *) a. Monad m => a -> m a
return ([Elem] -> AG
AG [Elem]
es, Maybe String
ext)
depsAG :: Options -> [FilePath] -> String -> IO ([String], [Message Token Pos])
depsAG :: Options -> [String] -> String -> IO ([String], [Message Token Pos])
depsAG Options
opts [String]
searchPath String
file
= do let fn :: String
fn = String -> String
normalise String
file
([Elem]
_,[String]
_,[String]
fs,Maybe String
_,[Message Token Pos]
mesgs) <- Bool
-> Options
-> [String]
-> String
-> IO
([Elem], [String], [String], Maybe String, [Message Token Pos])
parseFile Bool
False Options
opts [String]
searchPath String
fn
([String], [Message Token Pos])
-> IO ([String], [Message Token Pos])
forall (m :: * -> *) a. Monad m => a -> m a
return ((String -> Bool) -> [String] -> [String]
forall a. (a -> Bool) -> [a] -> [a]
filter (String -> String -> Bool
forall a. Eq a => a -> a -> Bool
/= String
fn) [String]
fs, [Message Token Pos]
mesgs)
parseFile :: Bool -> Options -> [FilePath] -> String -> IO ([Elem],[String],[String], Maybe String,[Message Token Pos ])
parseFile :: Bool
-> Options
-> [String]
-> String
-> IO
([Elem], [String], [String], Maybe String, [Message Token Pos])
parseFile = [String]
-> Bool
-> Options
-> [String]
-> String
-> IO
([Elem], [String], [String], Maybe String, [Message Token Pos])
parseFile' []
parseFile' :: [String] -> Bool -> Options -> [FilePath] -> String -> IO ([Elem],[String],[String], Maybe String,[Message Token Pos ])
parseFile' :: [String]
-> Bool
-> Options
-> [String]
-> String
-> IO
([Elem], [String], [String], Maybe String, [Message Token Pos])
parseFile' [String]
parsedfiles Bool
agi Options
opts [String]
searchPath String
filename
= do String
file <- String -> String
normalise (String -> String) -> IO String -> IO String
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
`fmap` Options -> [String] -> String -> IO String
resolveFile Options
opts [String]
searchPath String
filename
if String
file String -> [String] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [String]
parsedfiles
then ([Elem], [String], [String], Maybe String, [Message Token Pos])
-> IO
([Elem], [String], [String], Maybe String, [Message Token Pos])
forall (m :: * -> *) a. Monad m => a -> m a
return ([], [], [String]
parsedfiles, Maybe String
forall a. Maybe a
Nothing, [])
else do
String
txt <- String -> IO String
readFile String
file
let searchPath' :: [String]
searchPath' = String -> String
takeDirectory String
file String -> [String] -> [String]
forall a. a -> [a] -> [a]
: [String]
searchPath
litMode :: Bool
litMode = String
".lag" String -> String -> Bool
forall a. Eq a => [a] -> [a] -> Bool
`isSuffixOf` String
file
([String]
files,String
text) = if Bool
litMode then String -> ([String], String)
scanLit String
txt
else ([],String
txt)
tokens :: Input
tokens = Options -> Pos -> String -> Input
input Options
opts (String -> Pos
initPos String
file) String
text
steps :: Steps
(Pair ([Elem], [String], Maybe String) (Pair Input ())) Token Pos
steps = AnaParser Input Pair Token Pos ([Elem], [String], Maybe String)
-> Input
-> Steps
(Pair ([Elem], [String], Maybe String) (Pair Input ())) Token Pos
forall s inp pos a.
(Symbol s, InputState inp s pos) =>
AnaParser inp Pair s pos a
-> inp -> Steps (Pair a (Pair inp ())) s pos
parse (Bool
-> AnaParser Input Pair Token Pos ([Elem], [String], Maybe String)
pElemsFiles Bool
agi) Input
tokens
stop :: (a, t a, c, d, e) -> Bool
stop (a
_,t a
fs,c
_,d
_,e
_) = t a -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null t a
fs
cont :: ([Elem], [String], [String], d, [Message Token Pos])
-> IO ([Elem], [String], [String], d, [Message Token Pos])
cont ([Elem]
es,String
f:[String]
fs,[String]
allfs,d
ext,[Message Token Pos]
msg)
= do ([Elem]
ess,[String]
fss,[String]
allfss,Maybe String
_, [Message Token Pos]
msgs) <- [String]
-> Bool
-> Options
-> [String]
-> String
-> IO
([Elem], [String], [String], Maybe String, [Message Token Pos])
parseFile' [String]
allfs Bool
agi Options
opts [String]
searchPath' String
f
([Elem], [String], [String], d, [Message Token Pos])
-> IO ([Elem], [String], [String], d, [Message Token Pos])
forall (m :: * -> *) a. Monad m => a -> m a
return ([Elem]
ess [Elem] -> [Elem] -> [Elem]
forall a. [a] -> [a] -> [a]
++ [Elem]
es, [String]
fss [String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ [String]
fs, [String]
allfss, d
ext, [Message Token Pos]
msg [Message Token Pos] -> [Message Token Pos] -> [Message Token Pos]
forall a. [a] -> [a] -> [a]
++ [Message Token Pos]
msgs)
let (Pair ([Elem]
es,[String]
fls,Maybe String
ext) Pair Input ()
_ ,[Message Token Pos]
mesg) = Steps
(Pair ([Elem], [String], Maybe String) (Pair Input ())) Token Pos
-> (Pair ([Elem], [String], Maybe String) (Pair Input ()),
[Message Token Pos])
forall s p a.
(Eq s, Show s, Show p) =>
Steps a s p -> (a, [Message s p])
evalStepsMessages Steps
(Pair ([Elem], [String], Maybe String) (Pair Input ())) Token Pos
steps
(([Elem], [String], [String], Maybe String, [Message Token Pos])
-> Bool)
-> (([Elem], [String], [String], Maybe String, [Message Token Pos])
-> IO
([Elem], [String], [String], Maybe String, [Message Token Pos]))
-> ([Elem], [String], [String], Maybe String, [Message Token Pos])
-> IO
([Elem], [String], [String], Maybe String, [Message Token Pos])
forall a. (a -> Bool) -> (a -> IO a) -> a -> IO a
loopp ([Elem], [String], [String], Maybe String, [Message Token Pos])
-> Bool
forall (t :: * -> *) a a c d e.
Foldable t =>
(a, t a, c, d, e) -> Bool
stop ([Elem], [String], [String], Maybe String, [Message Token Pos])
-> IO
([Elem], [String], [String], Maybe String, [Message Token Pos])
forall d.
([Elem], [String], [String], d, [Message Token Pos])
-> IO ([Elem], [String], [String], d, [Message Token Pos])
cont ([Elem]
es,[String]
files [String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ [String]
fls,String
file String -> [String] -> [String]
forall a. a -> [a] -> [a]
: [String]
parsedfiles, Maybe String
ext,[Message Token Pos]
mesg)
where
pElemsFiles :: Bool -> AGParser ([Elem],[String],Maybe String)
pElemsFiles :: Bool
-> AnaParser Input Pair Token Pos ([Elem], [String], Maybe String)
pElemsFiles Bool
agi = ((([Elem], [String], Maybe String)
-> ([Elem], [String], Maybe String))
-> ([Elem], [String], Maybe String)
-> ([Elem], [String], Maybe String),
([Elem], [String], Maybe String))
-> AnaParser
Input
Pair
Token
Pos
(([Elem], [String], Maybe String)
-> ([Elem], [String], Maybe String))
-> AnaParser Input Pair Token Pos ([Elem], [String], Maybe String)
forall (p :: * -> *) s a b.
IsParser p s =>
(a -> b -> b, b) -> p a -> p b
pFoldr ((([Elem], [String], Maybe String)
-> ([Elem], [String], Maybe String))
-> ([Elem], [String], Maybe String)
-> ([Elem], [String], Maybe String)
forall a b. (a -> b) -> a -> b
($),([],[],Maybe String
forall a. Maybe a
Nothing)) AnaParser
Input
Pair
Token
Pos
(([Elem], [String], Maybe String)
-> ([Elem], [String], Maybe String))
pElem'
where pElem' :: AnaParser
Input
Pair
Token
Pos
(([Elem], [String], Maybe String)
-> ([Elem], [String], Maybe String))
pElem' = Elem
-> ([Elem], [String], Maybe String)
-> ([Elem], [String], Maybe String)
forall a b c. a -> ([a], b, c) -> ([a], b, c)
addElem (Elem
-> ([Elem], [String], Maybe String)
-> ([Elem], [String], Maybe String))
-> AnaParser Input Pair Token Pos Elem
-> AnaParser
Input
Pair
Token
Pos
(([Elem], [String], Maybe String)
-> ([Elem], [String], Maybe String))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos Elem
pElem
AnaParser
Input
Pair
Token
Pos
(([Elem], [String], Maybe String)
-> ([Elem], [String], Maybe String))
-> AnaParser
Input
Pair
Token
Pos
(([Elem], [String], Maybe String)
-> ([Elem], [String], Maybe String))
-> AnaParser
Input
Pair
Token
Pos
(([Elem], [String], Maybe String)
-> ([Elem], [String], Maybe String))
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> AnaParser Input Pair Token Pos Pos
pINCLUDE AnaParser Input Pair Token Pos Pos
-> AnaParser
Input
Pair
Token
Pos
(([Elem], [String], Maybe String)
-> ([Elem], [String], Maybe String))
-> AnaParser
Input
Pair
Token
Pos
(([Elem], [String], Maybe String)
-> ([Elem], [String], Maybe String))
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> ((String, Pos)
-> ([Elem], [String], Maybe String)
-> ([Elem], [String], Maybe String)
forall b a c. (String, b) -> (a, [String], c) -> (a, [String], c)
addInc ((String, Pos)
-> ([Elem], [String], Maybe String)
-> ([Elem], [String], Maybe String))
-> AnaParser Input Pair Token Pos (String, Pos)
-> AnaParser
Input
Pair
Token
Pos
(([Elem], [String], Maybe String)
-> ([Elem], [String], Maybe String))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos (String, Pos)
forall (p :: * -> *). IsParser p Token => p (String, Pos)
pStringPos)
AnaParser
Input
Pair
Token
Pos
(([Elem], [String], Maybe String)
-> ([Elem], [String], Maybe String))
-> AnaParser
Input
Pair
Token
Pos
(([Elem], [String], Maybe String)
-> ([Elem], [String], Maybe String))
-> AnaParser
Input
Pair
Token
Pos
(([Elem], [String], Maybe String)
-> ([Elem], [String], Maybe String))
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> AnaParser Input Pair Token Pos Pos
pEXTENDS AnaParser Input Pair Token Pos Pos
-> AnaParser
Input
Pair
Token
Pos
(([Elem], [String], Maybe String)
-> ([Elem], [String], Maybe String))
-> AnaParser
Input
Pair
Token
Pos
(([Elem], [String], Maybe String)
-> ([Elem], [String], Maybe String))
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> ((String, Pos)
-> ([Elem], [String], Maybe String)
-> ([Elem], [String], Maybe String)
forall b a.
(String, b)
-> (a, [String], Maybe String) -> (a, [String], Maybe String)
addExt ((String, Pos)
-> ([Elem], [String], Maybe String)
-> ([Elem], [String], Maybe String))
-> AnaParser Input Pair Token Pos (String, Pos)
-> AnaParser
Input
Pair
Token
Pos
(([Elem], [String], Maybe String)
-> ([Elem], [String], Maybe String))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos (String, Pos)
forall (p :: * -> *). IsParser p Token => p (String, Pos)
pStringPos)
addElem :: a -> ([a], b, c) -> ([a], b, c)
addElem a
e ([a]
es,b
fs,c
ext) = (a
ea -> [a] -> [a]
forall a. a -> [a] -> [a]
:[a]
es, b
fs, c
ext)
addInc :: (String, b) -> (a, [String], c) -> (a, [String], c)
addInc (String
fn,b
_) (a
es,[String]
fs,c
ext)
| Options -> Bool
noIncludes Options
opts = (a
es, [String]
fs, c
ext)
| Bool
otherwise = (a
es,String -> String
normalise String
fnString -> [String] -> [String]
forall a. a -> [a] -> [a]
:[String]
fs, c
ext)
addExt :: (String, b)
-> (a, [String], Maybe String) -> (a, [String], Maybe String)
addExt (String
fn,b
_) (a
es,[String]
fs,Maybe String
ext)
| Options -> Bool
noIncludes Options
opts = (a
es, [String]
fs, Maybe String
ext)
| Bool
otherwise = if Bool
agi then (a
es,[String]
fs, String -> Maybe String
forall a. a -> Maybe a
Just String
fn') else (a
es,String
fn'String -> [String] -> [String]
forall a. a -> [a] -> [a]
:[String]
fs, Maybe String
ext)
where fn' :: String
fn' = String -> String
normalise String
fn
pCodescrapL :: AnaParser Input Pair Token Pos (String, Pos)
pCodescrapL = (\(ValToken EnumValToken
_ String
str Pos
pos) -> (String
str, Pos
pos))(Token -> (String, Pos))
-> AnaParser Input Pair Token Pos Token
-> AnaParser Input Pair Token Pos (String, Pos)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
AnaParser Input Pair Token Pos Token
parseScrapL AnaParser Input Pair Token Pos (String, Pos)
-> String -> AnaParser Input Pair Token Pos (String, Pos)
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"a code block"
parseScrapL :: AGParser Token
parseScrapL :: AnaParser Input Pair Token Pos Token
parseScrapL
= let p :: (Token -> a -> b) -> (Input -> Steps a s p) -> Input -> Steps b s p
p Token -> a -> b
acc = (\Input -> Steps a s p
k (Input Pos
pos String
str Maybe (Token, Input)
next) ->
let (Token
sc,Input
rest) = case Maybe (Token, Input)
next of
Just (t :: Token
t@(ValToken EnumValToken
TkTextln String
_ Pos
_), Input
rs) -> (Token
t,Input
rs)
Maybe (Token, Input)
_ -> let (Token
tok,Pos
p2,String
inp2) = Pos -> String -> (Token, Pos, String)
codescrapL Pos
pos String
str
in (Token
tok, Options -> Pos -> String -> Input
input Options
opts Pos
p2 String
inp2)
steps :: Steps a s p
steps = Input -> Steps a s p
k ( Input
rest)
in ((a -> b) -> Steps a s p -> Steps b s p
forall a b s p. (a -> b) -> Steps a s p -> Steps b s p
val (Token -> a -> b
acc Token
sc) Steps a s p
steps)
)
in ParsRec Input Pair Token Pos Token
-> AnaParser Input Pair Token Pos Token
forall state (result :: * -> * -> *) s p a.
ParsRec state result s p a -> AnaParser state result s p a
anaDynE ((RealParser Input Token Pos Token, RealRecogn Input Token Pos)
-> ParsRec Input Pair Token Pos Token
forall (result :: * -> * -> *) state s p a.
OutputState result =>
(RealParser state s p a, RealRecogn state s p)
-> ParsRec state result s p a
mkPR ((forall r' r''.
(Token -> r'' -> r')
-> (Input -> Steps r'' Token Pos) -> Input -> Steps r' Token Pos)
-> RealParser Input Token Pos Token
forall state s p a.
(forall r' r''.
(a -> r'' -> r')
-> (state -> Steps r'' s p) -> state -> Steps r' s p)
-> RealParser state s p a
P ((Token -> r'' -> r')
-> (Input -> Steps r'' Token Pos) -> Input -> Steps r' Token Pos
forall a b s p.
(Token -> a -> b) -> (Input -> Steps a s p) -> Input -> Steps b s p
p ), (forall r.
(Input -> Steps r Token Pos) -> Input -> Steps r Token Pos)
-> RealRecogn Input Token Pos
forall state s p.
(forall r. (state -> Steps r s p) -> state -> Steps r s p)
-> RealRecogn state s p
R ((Token -> r -> r)
-> (Input -> Steps r Token Pos) -> Input -> Steps r Token Pos
forall a b s p.
(Token -> a -> b) -> (Input -> Steps a s p) -> Input -> Steps b s p
p ((r -> r) -> Token -> r -> r
forall a b. a -> b -> a
const r -> r
forall a. a -> a
id))))
pElems :: AGParser Elems
pElems :: AGParser [Elem]
pElems = AnaParser Input Pair Token Pos Elem -> AGParser [Elem]
forall (p :: * -> *) s a. IsParser p s => p a -> p [a]
pList_ng AnaParser Input Pair Token Pos Elem
pElem
pComplexType :: AnaParser Input Pair Token Pos ComplexType
pComplexType = Type -> ComplexType
List (Type -> ComplexType)
-> AnaParser Input Pair Token Pos Type
-> AnaParser Input Pair Token Pos ComplexType
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos Type
-> AnaParser Input Pair Token Pos Type
forall (p :: * -> *) a. IsParser p Token => p a -> p a
pBracks AnaParser Input Pair Token Pos Type
pTypeEncapsulated
AnaParser Input Pair Token Pos ComplexType
-> AnaParser Input Pair Token Pos ComplexType
-> AnaParser Input Pair Token Pos ComplexType
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Type -> ComplexType
Maybe (Type -> ComplexType)
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos (Type -> ComplexType)
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ AnaParser Input Pair Token Pos Pos
pMAYBE AnaParser Input Pair Token Pos (Type -> ComplexType)
-> AnaParser Input Pair Token Pos Type
-> AnaParser Input Pair Token Pos ComplexType
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos Type
pType
AnaParser Input Pair Token Pos ComplexType
-> AnaParser Input Pair Token Pos ComplexType
-> AnaParser Input Pair Token Pos ComplexType
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Type -> Type -> ComplexType
Either (Type -> Type -> ComplexType)
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos (Type -> Type -> ComplexType)
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ AnaParser Input Pair Token Pos Pos
pEITHER AnaParser Input Pair Token Pos (Type -> Type -> ComplexType)
-> AnaParser Input Pair Token Pos Type
-> AnaParser Input Pair Token Pos (Type -> ComplexType)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos Type
pType AnaParser Input Pair Token Pos (Type -> ComplexType)
-> AnaParser Input Pair Token Pos Type
-> AnaParser Input Pair Token Pos ComplexType
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos Type
pType
AnaParser Input Pair Token Pos ComplexType
-> AnaParser Input Pair Token Pos ComplexType
-> AnaParser Input Pair Token Pos ComplexType
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Type -> Type -> ComplexType
Map (Type -> Type -> ComplexType)
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos (Type -> Type -> ComplexType)
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ AnaParser Input Pair Token Pos Pos
pMAP AnaParser Input Pair Token Pos (Type -> Type -> ComplexType)
-> AnaParser Input Pair Token Pos Type
-> AnaParser Input Pair Token Pos (Type -> ComplexType)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos Type
pTypePrimitive AnaParser Input Pair Token Pos (Type -> ComplexType)
-> AnaParser Input Pair Token Pos Type
-> AnaParser Input Pair Token Pos ComplexType
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos Type
pType
AnaParser Input Pair Token Pos ComplexType
-> AnaParser Input Pair Token Pos ComplexType
-> AnaParser Input Pair Token Pos ComplexType
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Type -> ComplexType
IntMap (Type -> ComplexType)
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos (Type -> ComplexType)
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ AnaParser Input Pair Token Pos Pos
pINTMAP AnaParser Input Pair Token Pos (Type -> ComplexType)
-> AnaParser Input Pair Token Pos Type
-> AnaParser Input Pair Token Pos ComplexType
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos Type
pType
AnaParser Input Pair Token Pos ComplexType
-> AnaParser Input Pair Token Pos ComplexType
-> AnaParser Input Pair Token Pos ComplexType
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Type -> ComplexType
OrdSet (Type -> ComplexType)
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos (Type -> ComplexType)
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ AnaParser Input Pair Token Pos Pos
pSET AnaParser Input Pair Token Pos (Type -> ComplexType)
-> AnaParser Input Pair Token Pos Type
-> AnaParser Input Pair Token Pos ComplexType
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos Type
pType
AnaParser Input Pair Token Pos ComplexType
-> AnaParser Input Pair Token Pos ComplexType
-> AnaParser Input Pair Token Pos ComplexType
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> ComplexType
IntSet ComplexType
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos ComplexType
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ AnaParser Input Pair Token Pos Pos
pINTSET
AnaParser Input Pair Token Pos ComplexType
-> AnaParser Input Pair Token Pos ComplexType
-> AnaParser Input Pair Token Pos ComplexType
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> [(Maybe Identifier, Type)] -> ComplexType
tuple ([(Maybe Identifier, Type)] -> ComplexType)
-> AnaParser Input Pair Token Pos [(Maybe Identifier, Type)]
-> AnaParser Input Pair Token Pos ComplexType
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos [(Maybe Identifier, Type)]
-> AnaParser Input Pair Token Pos [(Maybe Identifier, Type)]
forall (p :: * -> *) a. IsParser p Token => p a -> p a
pParens (AnaParser Input Pair Token Pos String
-> AnaParser Input Pair Token Pos (Maybe Identifier, Type)
-> AnaParser Input Pair Token Pos [(Maybe Identifier, Type)]
forall (p :: * -> *) s a a1. IsParser p s => p a -> p a1 -> p [a1]
pListSep AnaParser Input Pair Token Pos String
forall (p :: * -> *). IsParser p Token => p String
pComma AnaParser Input Pair Token Pos (Maybe Identifier, Type)
field)
where field :: AnaParser Input Pair Token Pos (Maybe Identifier, Type)
field = (,) (Maybe Identifier -> Type -> (Maybe Identifier, Type))
-> AnaParser Input Pair Token Pos (Maybe Identifier)
-> AnaParser
Input Pair Token Pos (Type -> (Maybe Identifier, Type))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ((Identifier -> Maybe Identifier
forall a. a -> Maybe a
Just (Identifier -> Maybe Identifier)
-> AGParser Identifier
-> AnaParser Input Pair Token Pos (Maybe Identifier)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AGParser Identifier
pIdentifier AnaParser Input Pair Token Pos (Maybe Identifier)
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos (Maybe Identifier)
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* AnaParser Input Pair Token Pos Pos
pTypeColon) AnaParser Input Pair Token Pos (Maybe Identifier)
-> Maybe Identifier
-> AnaParser Input Pair Token Pos (Maybe Identifier)
forall (p :: * -> *) s a. IsParser p s => p a -> a -> p a
`opt` Maybe Identifier
forall a. Maybe a
Nothing) AnaParser Input Pair Token Pos (Type -> (Maybe Identifier, Type))
-> AnaParser Input Pair Token Pos Type
-> AnaParser Input Pair Token Pos (Maybe Identifier, Type)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos Type
pTypeEncapsulated
tuple :: [(Maybe Identifier, Type)] -> ComplexType
tuple [(Maybe Identifier, Type)]
xs = [(Identifier, Type)] -> ComplexType
Tuple [(Identifier -> Maybe Identifier -> Identifier
forall a. a -> Maybe a -> a
fromMaybe (String -> Pos -> Identifier
Ident (String
"x"String -> String -> String
forall a. [a] -> [a] -> [a]
++Integer -> String
forall a. Show a => a -> String
show Integer
n) Pos
noPos) Maybe Identifier
f, Type
t)
| (Integer
n,(Maybe Identifier
f,Type
t)) <- [Integer]
-> [(Maybe Identifier, Type)]
-> [(Integer, (Maybe Identifier, Type))]
forall a b. [a] -> [b] -> [(a, b)]
zip [Integer
1..] [(Maybe Identifier, Type)]
xs
]
pOptClassContext' :: AGParser ClassContext
pOptClassContext' :: AGParser ClassContext
pOptClassContext'
| Options -> Bool
ocaml Options
opts = ClassContext -> AGParser ClassContext
forall (p :: * -> *) s a. IsParser p s => a -> p a
pSucceed []
| Bool
otherwise = AGParser ClassContext
pOptClassContext
pTyVars :: AGParser [Identifier]
pTyVars :: AGParser [Identifier]
pTyVars
| Options -> Bool
ocaml Options
opts = Identifier -> [Identifier]
forall (m :: * -> *) a. Monad m => a -> m a
return (Identifier -> [Identifier])
-> AGParser Identifier -> AGParser [Identifier]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AGParser Identifier
pTypeVar
AGParser [Identifier]
-> AGParser [Identifier] -> AGParser [Identifier]
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> [Identifier] -> AGParser [Identifier]
forall (p :: * -> *) s a. IsParser p s => a -> p a
pSucceed []
AGParser [Identifier]
-> AGParser [Identifier] -> AGParser [Identifier]
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> AGParser [Identifier] -> AGParser [Identifier]
forall (p :: * -> *) a. IsParser p Token => p a -> p a
pParens (AnaParser Input Pair Token Pos String
-> AGParser Identifier -> AGParser [Identifier]
forall (p :: * -> *) s a a1. IsParser p s => p a -> p a1 -> p [a1]
pListSep AnaParser Input Pair Token Pos String
forall (p :: * -> *). IsParser p Token => p String
pComma AGParser Identifier
pTypeVar)
| Bool
otherwise = AGParser Identifier -> AGParser [Identifier]
forall (p :: * -> *) s a. IsParser p s => p a -> p [a]
pList AGParser Identifier
pIdentifier
pElem :: AGParser Elem
pElem :: AnaParser Input Pair Token Pos Elem
pElem
= (\(Pos
pos, ConstructorType
ct) -> Pos
-> ConstructorType
-> ClassContext
-> NontSet
-> [Identifier]
-> Attrs
-> Alts
-> Bool
-> Elem
Data Pos
pos ConstructorType
ct)
((Pos, ConstructorType)
-> ClassContext
-> NontSet
-> [Identifier]
-> Attrs
-> Alts
-> Bool
-> Elem)
-> AnaParser Input Pair Token Pos (Pos, ConstructorType)
-> AnaParser
Input
Pair
Token
Pos
(ClassContext
-> NontSet -> [Identifier] -> Attrs -> Alts -> Bool -> Elem)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ( (\Pos
x -> (Pos
x, ConstructorType
DataConstructor)) (Pos -> (Pos, ConstructorType))
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos (Pos, ConstructorType)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (AnaParser Input Pair Token Pos Pos
pDATA AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos Pos
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> AnaParser Input Pair Token Pos Pos
pTYPE)
AnaParser Input Pair Token Pos (Pos, ConstructorType)
-> AnaParser Input Pair Token Pos (Pos, ConstructorType)
-> AnaParser Input Pair Token Pos (Pos, ConstructorType)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (\Pos
x -> (Pos
x, ConstructorType
RecordConstructor)) (Pos -> (Pos, ConstructorType))
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos (Pos, ConstructorType)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos Pos
pRECORD
)
AnaParser
Input
Pair
Token
Pos
(ClassContext
-> NontSet -> [Identifier] -> Attrs -> Alts -> Bool -> Elem)
-> AGParser ClassContext
-> AnaParser
Input
Pair
Token
Pos
(NontSet -> [Identifier] -> Attrs -> Alts -> Bool -> Elem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AGParser ClassContext
pOptClassContext'
AnaParser
Input
Pair
Token
Pos
(NontSet -> [Identifier] -> Attrs -> Alts -> Bool -> Elem)
-> AnaParser Input Pair Token Pos NontSet
-> AnaParser
Input
Pair
Token
Pos
([Identifier] -> Attrs -> Alts -> Bool -> Elem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos NontSet
pNontSet
AnaParser
Input
Pair
Token
Pos
([Identifier] -> Attrs -> Alts -> Bool -> Elem)
-> AGParser [Identifier]
-> AnaParser Input Pair Token Pos (Attrs -> Alts -> Bool -> Elem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AGParser [Identifier]
pTyVars
AnaParser Input Pair Token Pos (Attrs -> Alts -> Bool -> Elem)
-> AnaParser Input Pair Token Pos Attrs
-> AnaParser Input Pair Token Pos (Alts -> Bool -> Elem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos Attrs
pOptAttrs
AnaParser Input Pair Token Pos (Alts -> Bool -> Elem)
-> AnaParser Input Pair Token Pos Alts
-> AnaParser Input Pair Token Pos (Bool -> Elem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos Alts
pAlts
AnaParser Input Pair Token Pos (Bool -> Elem)
-> AnaParser Input Pair Token Pos Bool
-> AnaParser Input Pair Token Pos Elem
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Bool -> AnaParser Input Pair Token Pos Bool
forall (p :: * -> *) s a. IsParser p s => a -> p a
pSucceed Bool
False
AnaParser Input Pair Token Pos Elem
-> AnaParser Input Pair Token Pos Elem
-> AnaParser Input Pair Token Pos Elem
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Pos -> ClassContext -> NontSet -> [String] -> Attrs -> Elem
Attr (Pos -> ClassContext -> NontSet -> [String] -> Attrs -> Elem)
-> AnaParser Input Pair Token Pos Pos
-> AnaParser
Input
Pair
Token
Pos
(ClassContext -> NontSet -> [String] -> Attrs -> Elem)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos Pos
pATTR
AnaParser
Input
Pair
Token
Pos
(ClassContext -> NontSet -> [String] -> Attrs -> Elem)
-> AGParser ClassContext
-> AnaParser
Input Pair Token Pos (NontSet -> [String] -> Attrs -> Elem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AGParser ClassContext
pOptClassContext'
AnaParser
Input Pair Token Pos (NontSet -> [String] -> Attrs -> Elem)
-> AnaParser Input Pair Token Pos NontSet
-> AnaParser Input Pair Token Pos ([String] -> Attrs -> Elem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos NontSet
pNontSet
AnaParser Input Pair Token Pos ([String] -> Attrs -> Elem)
-> AnaParser Input Pair Token Pos [String]
-> AnaParser Input Pair Token Pos (Attrs -> Elem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos [String]
pOptQuantifiers
AnaParser Input Pair Token Pos (Attrs -> Elem)
-> AnaParser Input Pair Token Pos Attrs
-> AnaParser Input Pair Token Pos Elem
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos Attrs
pAttrs
AnaParser Input Pair Token Pos Elem
-> AnaParser Input Pair Token Pos Elem
-> AnaParser Input Pair Token Pos Elem
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Pos
-> ClassContext
-> Identifier
-> [Identifier]
-> ComplexType
-> Elem
Type (Pos
-> ClassContext
-> Identifier
-> [Identifier]
-> ComplexType
-> Elem)
-> AnaParser Input Pair Token Pos Pos
-> AnaParser
Input
Pair
Token
Pos
(ClassContext -> Identifier -> [Identifier] -> ComplexType -> Elem)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos Pos
pTYPE
AnaParser
Input
Pair
Token
Pos
(ClassContext -> Identifier -> [Identifier] -> ComplexType -> Elem)
-> AGParser ClassContext
-> AnaParser
Input
Pair
Token
Pos
(Identifier -> [Identifier] -> ComplexType -> Elem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AGParser ClassContext
pOptClassContext'
AnaParser
Input
Pair
Token
Pos
(Identifier -> [Identifier] -> ComplexType -> Elem)
-> AGParser Identifier
-> AnaParser
Input Pair Token Pos ([Identifier] -> ComplexType -> Elem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AGParser Identifier
pTypeCon
AnaParser
Input Pair Token Pos ([Identifier] -> ComplexType -> Elem)
-> AGParser [Identifier]
-> AnaParser Input Pair Token Pos (ComplexType -> Elem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AGParser [Identifier]
pTyVars
AnaParser Input Pair Token Pos (ComplexType -> Elem)
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos (ComplexType -> Elem)
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* AnaParser Input Pair Token Pos Pos
pEquals
AnaParser Input Pair Token Pos (ComplexType -> Elem)
-> AnaParser Input Pair Token Pos ComplexType
-> AnaParser Input Pair Token Pos Elem
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos ComplexType
pComplexType
AnaParser Input Pair Token Pos Elem
-> AnaParser Input Pair Token Pos Elem
-> AnaParser Input Pair Token Pos Elem
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Pos
-> ClassContext -> NontSet -> Attrs -> [String] -> SemAlts -> Elem
Sem (Pos
-> ClassContext -> NontSet -> Attrs -> [String] -> SemAlts -> Elem)
-> AnaParser Input Pair Token Pos Pos
-> AnaParser
Input
Pair
Token
Pos
(ClassContext -> NontSet -> Attrs -> [String] -> SemAlts -> Elem)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos Pos
pSEM
AnaParser
Input
Pair
Token
Pos
(ClassContext -> NontSet -> Attrs -> [String] -> SemAlts -> Elem)
-> AGParser ClassContext
-> AnaParser
Input
Pair
Token
Pos
(NontSet -> Attrs -> [String] -> SemAlts -> Elem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AGParser ClassContext
pOptClassContext'
AnaParser
Input
Pair
Token
Pos
(NontSet -> Attrs -> [String] -> SemAlts -> Elem)
-> AnaParser Input Pair Token Pos NontSet
-> AnaParser
Input Pair Token Pos (Attrs -> [String] -> SemAlts -> Elem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos NontSet
pNontSet
AnaParser
Input Pair Token Pos (Attrs -> [String] -> SemAlts -> Elem)
-> AnaParser Input Pair Token Pos Attrs
-> AnaParser Input Pair Token Pos ([String] -> SemAlts -> Elem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos Attrs
pOptAttrs
AnaParser Input Pair Token Pos ([String] -> SemAlts -> Elem)
-> AnaParser Input Pair Token Pos [String]
-> AnaParser Input Pair Token Pos (SemAlts -> Elem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos [String]
pOptQuantifiers
AnaParser Input Pair Token Pos (SemAlts -> Elem)
-> AnaParser Input Pair Token Pos SemAlts
-> AnaParser Input Pair Token Pos Elem
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos SemAlts
pSemAlts
AnaParser Input Pair Token Pos Elem
-> AnaParser Input Pair Token Pos Elem
-> AnaParser Input Pair Token Pos Elem
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Pos -> Identifier -> Bool -> NontSet -> Elem
Set (Pos -> Identifier -> Bool -> NontSet -> Elem)
-> AnaParser Input Pair Token Pos Pos
-> AnaParser
Input Pair Token Pos (Identifier -> Bool -> NontSet -> Elem)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos Pos
pSET
AnaParser
Input Pair Token Pos (Identifier -> Bool -> NontSet -> Elem)
-> AGParser Identifier
-> AnaParser Input Pair Token Pos (Bool -> NontSet -> Elem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AGParser Identifier
pTypeCon
AnaParser Input Pair Token Pos (Bool -> NontSet -> Elem)
-> AnaParser Input Pair Token Pos Bool
-> AnaParser Input Pair Token Pos (NontSet -> Elem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ( Bool
False Bool
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos Bool
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ AnaParser Input Pair Token Pos Pos
pEquals
AnaParser Input Pair Token Pos Bool
-> AnaParser Input Pair Token Pos Bool
-> AnaParser Input Pair Token Pos Bool
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Bool
True Bool
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos Bool
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ AnaParser Input Pair Token Pos Pos
pColon
)
AnaParser Input Pair Token Pos (NontSet -> Elem)
-> AnaParser Input Pair Token Pos NontSet
-> AnaParser Input Pair Token Pos Elem
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos NontSet
pNontSet
AnaParser Input Pair Token Pos Elem
-> AnaParser Input Pair Token Pos Elem
-> AnaParser Input Pair Token Pos Elem
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Pos -> NontSet -> [Identifier] -> Elem
Deriving
(Pos -> NontSet -> [Identifier] -> Elem)
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos (NontSet -> [Identifier] -> Elem)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos Pos
pDERIVING
AnaParser Input Pair Token Pos (NontSet -> [Identifier] -> Elem)
-> AnaParser Input Pair Token Pos NontSet
-> AnaParser Input Pair Token Pos ([Identifier] -> Elem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos NontSet
pNontSet
AnaParser Input Pair Token Pos ([Identifier] -> Elem)
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos ([Identifier] -> Elem)
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* AnaParser Input Pair Token Pos Pos
pColon
AnaParser Input Pair Token Pos ([Identifier] -> Elem)
-> AGParser [Identifier] -> AnaParser Input Pair Token Pos Elem
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos String
-> AGParser Identifier -> AGParser [Identifier]
forall (p :: * -> *) s a a1. IsParser p s => p a -> p a1 -> p [a1]
pListSep AnaParser Input Pair Token Pos String
forall (p :: * -> *). IsParser p Token => p String
pComma AGParser Identifier
pIdentifierU
AnaParser Input Pair Token Pos Elem
-> AnaParser Input Pair Token Pos Elem
-> AnaParser Input Pair Token Pos Elem
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Pos -> NontSet -> Elem
Wrapper
(Pos -> NontSet -> Elem)
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos (NontSet -> Elem)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos Pos
pWRAPPER
AnaParser Input Pair Token Pos (NontSet -> Elem)
-> AnaParser Input Pair Token Pos NontSet
-> AnaParser Input Pair Token Pos Elem
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos NontSet
pNontSet
AnaParser Input Pair Token Pos Elem
-> AnaParser Input Pair Token Pos Elem
-> AnaParser Input Pair Token Pos Elem
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Pos -> NontSet -> Elem
Nocatas
(Pos -> NontSet -> Elem)
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos (NontSet -> Elem)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos Pos
pNOCATAS
AnaParser Input Pair Token Pos (NontSet -> Elem)
-> AnaParser Input Pair Token Pos NontSet
-> AnaParser Input Pair Token Pos Elem
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos NontSet
pNontSet
AnaParser Input Pair Token Pos Elem
-> AnaParser Input Pair Token Pos Elem
-> AnaParser Input Pair Token Pos Elem
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Pos -> [Identifier] -> Elem
Pragma
(Pos -> [Identifier] -> Elem)
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos ([Identifier] -> Elem)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos Pos
pPRAGMA
AnaParser Input Pair Token Pos ([Identifier] -> Elem)
-> AGParser [Identifier] -> AnaParser Input Pair Token Pos Elem
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AGParser Identifier -> AGParser [Identifier]
forall (p :: * -> *) s a. IsParser p s => p a -> p [a]
pList1 AGParser Identifier
pIdentifier
AnaParser Input Pair Token Pos Elem
-> AnaParser Input Pair Token Pos Elem
-> AnaParser Input Pair Token Pos Elem
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Pos -> String -> String -> String -> Elem
Module
(Pos -> String -> String -> String -> Elem)
-> AnaParser Input Pair Token Pos Pos
-> AnaParser
Input Pair Token Pos (String -> String -> String -> Elem)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos Pos
pMODULE
AnaParser Input Pair Token Pos (String -> String -> String -> Elem)
-> AnaParser Input Pair Token Pos String
-> AnaParser Input Pair Token Pos (String -> String -> Elem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos String
pCodescrap'
AnaParser Input Pair Token Pos (String -> String -> Elem)
-> AnaParser Input Pair Token Pos String
-> AnaParser Input Pair Token Pos (String -> Elem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos String
pCodescrap'
AnaParser Input Pair Token Pos (String -> Elem)
-> AnaParser Input Pair Token Pos String
-> AnaParser Input Pair Token Pos Elem
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos String
pCodescrap'
AnaParser Input Pair Token Pos Elem
-> AnaParser Input Pair Token Pos Elem
-> AnaParser Input Pair Token Pos Elem
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> BlockKind -> Maybe Identifier -> (String, Pos) -> Elem
codeBlock (BlockKind -> Maybe Identifier -> (String, Pos) -> Elem)
-> AnaParser Input Pair Token Pos BlockKind
-> AnaParser
Input Pair Token Pos (Maybe Identifier -> (String, Pos) -> Elem)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos BlockKind
pBlockKind AnaParser
Input Pair Token Pos (Maybe Identifier -> (String, Pos) -> Elem)
-> AnaParser Input Pair Token Pos (Maybe Identifier)
-> AnaParser Input Pair Token Pos ((String, Pos) -> Elem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ((Identifier -> Maybe Identifier
forall a. a -> Maybe a
Just (Identifier -> Maybe Identifier)
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos (Identifier -> Maybe Identifier)
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ AnaParser Input Pair Token Pos Pos
pATTACH AnaParser Input Pair Token Pos (Identifier -> Maybe Identifier)
-> AGParser Identifier
-> AnaParser Input Pair Token Pos (Maybe Identifier)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AGParser Identifier
pTypeCon) AnaParser Input Pair Token Pos (Maybe Identifier)
-> AnaParser Input Pair Token Pos (Maybe Identifier)
-> AnaParser Input Pair Token Pos (Maybe Identifier)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Maybe Identifier
-> AnaParser Input Pair Token Pos (Maybe Identifier)
forall (p :: * -> *) s a. IsParser p s => a -> p a
pSucceed Maybe Identifier
forall a. Maybe a
Nothing) AnaParser Input Pair Token Pos ((String, Pos) -> Elem)
-> AnaParser Input Pair Token Pos (String, Pos)
-> AnaParser Input Pair Token Pos Elem
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos (String, Pos)
pCodeBlock AnaParser Input Pair Token Pos Elem
-> String -> AnaParser Input Pair Token Pos Elem
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"a statement"
where codeBlock :: BlockKind -> Maybe Identifier -> (String, Pos) -> Elem
codeBlock BlockKind
knd Maybe Identifier
mbNt (String
txt,Pos
pos) = Pos -> BlockKind -> Maybe Identifier -> [String] -> Elem
Txt Pos
pos BlockKind
knd Maybe Identifier
mbNt (String -> [String]
lines String
txt)
pBlockKind :: AGParser BlockKind
pBlockKind :: AnaParser Input Pair Token Pos BlockKind
pBlockKind =
BlockKind
BlockPragma BlockKind
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos BlockKind
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ AnaParser Input Pair Token Pos Pos
pOPTPRAGMAS
AnaParser Input Pair Token Pos BlockKind
-> AnaParser Input Pair Token Pos BlockKind
-> AnaParser Input Pair Token Pos BlockKind
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> BlockKind
BlockImport BlockKind
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos BlockKind
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ AnaParser Input Pair Token Pos Pos
pIMPORTS
AnaParser Input Pair Token Pos BlockKind
-> AnaParser Input Pair Token Pos BlockKind
-> AnaParser Input Pair Token Pos BlockKind
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> BlockKind
BlockMain BlockKind
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos BlockKind
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ AnaParser Input Pair Token Pos Pos
pTOPLEVEL
AnaParser Input Pair Token Pos BlockKind
-> AnaParser Input Pair Token Pos BlockKind
-> AnaParser Input Pair Token Pos BlockKind
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> BlockKind
BlockData BlockKind
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos BlockKind
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ AnaParser Input Pair Token Pos Pos
pDATABLOCK
AnaParser Input Pair Token Pos BlockKind
-> AnaParser Input Pair Token Pos BlockKind
-> AnaParser Input Pair Token Pos BlockKind
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> BlockKind
BlockRec BlockKind
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos BlockKind
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ AnaParser Input Pair Token Pos Pos
pRECBLOCK
AnaParser Input Pair Token Pos BlockKind
-> AnaParser Input Pair Token Pos BlockKind
-> AnaParser Input Pair Token Pos BlockKind
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> BlockKind -> AnaParser Input Pair Token Pos BlockKind
forall (p :: * -> *) s a. IsParser p s => a -> p a
pSucceed BlockKind
BlockOther
pAttrs :: AGParser Attrs
pAttrs :: AnaParser Input Pair Token Pos Attrs
pAttrs
= Pos -> AttrNames -> AttrNames -> AttrNames -> Attrs
Attrs (Pos -> AttrNames -> AttrNames -> AttrNames -> Attrs)
-> AnaParser Input Pair Token Pos Pos
-> AnaParser
Input Pair Token Pos (AttrNames -> AttrNames -> AttrNames -> Attrs)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *). IsParser p Token => p Pos
pOBrackPos AnaParser
Input Pair Token Pos (AttrNames -> AttrNames -> AttrNames -> Attrs)
-> AnaParser Input Pair Token Pos AttrNames
-> AnaParser Input Pair Token Pos (AttrNames -> AttrNames -> Attrs)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ([AttrNames] -> AttrNames
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([AttrNames] -> AttrNames)
-> AnaParser Input Pair Token Pos [AttrNames]
-> AnaParser Input Pair Token Pos AttrNames
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos AttrNames
-> AnaParser Input Pair Token Pos [AttrNames]
forall (p :: * -> *) s a. IsParser p s => p a -> p [a]
pList AnaParser Input Pair Token Pos AttrNames
pInhAttrNames AnaParser Input Pair Token Pos AttrNames
-> String -> AnaParser Input Pair Token Pos AttrNames
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"inherited attribute declarations")
AnaParser Input Pair Token Pos (AttrNames -> AttrNames -> Attrs)
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos (AttrNames -> AttrNames -> Attrs)
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* AnaParser Input Pair Token Pos Pos
pBar AnaParser Input Pair Token Pos (AttrNames -> AttrNames -> Attrs)
-> AnaParser Input Pair Token Pos AttrNames
-> AnaParser Input Pair Token Pos (AttrNames -> Attrs)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ([AttrNames] -> AttrNames
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([AttrNames] -> AttrNames)
-> AnaParser Input Pair Token Pos [AttrNames]
-> AnaParser Input Pair Token Pos AttrNames
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos AttrNames
-> AnaParser Input Pair Token Pos [AttrNames]
forall (p :: * -> *) s a. IsParser p s => p a -> p [a]
pList AnaParser Input Pair Token Pos AttrNames
pAttrNames AnaParser Input Pair Token Pos AttrNames
-> String -> AnaParser Input Pair Token Pos AttrNames
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"chained attribute declarations" )
AnaParser Input Pair Token Pos (AttrNames -> Attrs)
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos (AttrNames -> Attrs)
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* AnaParser Input Pair Token Pos Pos
pBar AnaParser Input Pair Token Pos (AttrNames -> Attrs)
-> AnaParser Input Pair Token Pos AttrNames
-> AnaParser Input Pair Token Pos Attrs
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ([AttrNames] -> AttrNames
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([AttrNames] -> AttrNames)
-> AnaParser Input Pair Token Pos [AttrNames]
-> AnaParser Input Pair Token Pos AttrNames
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos AttrNames
-> AnaParser Input Pair Token Pos [AttrNames]
forall (p :: * -> *) s a. IsParser p s => p a -> p [a]
pList AnaParser Input Pair Token Pos AttrNames
pAttrNames AnaParser Input Pair Token Pos AttrNames
-> String -> AnaParser Input Pair Token Pos AttrNames
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"synthesised attribute declarations" )
AnaParser Input Pair Token Pos Attrs
-> AnaParser Input Pair Token Pos String
-> AnaParser Input Pair Token Pos Attrs
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* AnaParser Input Pair Token Pos String
forall (p :: * -> *). IsParser p Token => p String
pCBrack
AnaParser Input Pair Token Pos Attrs
-> AnaParser Input Pair Token Pos Attrs
-> AnaParser Input Pair Token Pos Attrs
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (\[(Pos, (AttrNames, AttrNames, AttrNames))]
ds -> Pos -> AttrNames -> AttrNames -> AttrNames -> Attrs
Attrs ((Pos, (AttrNames, AttrNames, AttrNames)) -> Pos
forall a b. (a, b) -> a
fst ((Pos, (AttrNames, AttrNames, AttrNames)) -> Pos)
-> (Pos, (AttrNames, AttrNames, AttrNames)) -> Pos
forall a b. (a -> b) -> a -> b
$ [(Pos, (AttrNames, AttrNames, AttrNames))]
-> (Pos, (AttrNames, AttrNames, AttrNames))
forall a. [a] -> a
head [(Pos, (AttrNames, AttrNames, AttrNames))]
ds) [(Identifier, Type, (String, String, String))
n | (Pos
_,(AttrNames
nms,AttrNames
_,AttrNames
_)) <- [(Pos, (AttrNames, AttrNames, AttrNames))]
ds, (Identifier, Type, (String, String, String))
n <- AttrNames
nms] [(Identifier, Type, (String, String, String))
n | (Pos
_,(AttrNames
_,AttrNames
nms,AttrNames
_)) <- [(Pos, (AttrNames, AttrNames, AttrNames))]
ds, (Identifier, Type, (String, String, String))
n <- AttrNames
nms] [(Identifier, Type, (String, String, String))
n | (Pos
_,(AttrNames
_,AttrNames
_,AttrNames
nms)) <- [(Pos, (AttrNames, AttrNames, AttrNames))]
ds, (Identifier, Type, (String, String, String))
n <- AttrNames
nms]) ([(Pos, (AttrNames, AttrNames, AttrNames))] -> Attrs)
-> AnaParser
Input Pair Token Pos [(Pos, (AttrNames, AttrNames, AttrNames))]
-> AnaParser Input Pair Token Pos Attrs
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser
Input Pair Token Pos (Pos, (AttrNames, AttrNames, AttrNames))
-> AnaParser
Input Pair Token Pos [(Pos, (AttrNames, AttrNames, AttrNames))]
forall (p :: * -> *) s a. IsParser p s => p a -> p [a]
pList1 AnaParser
Input Pair Token Pos (Pos, (AttrNames, AttrNames, AttrNames))
pSingleAttrDefs
pSingleAttrDefs :: AGParser (Pos, (AttrNames, AttrNames, AttrNames))
pSingleAttrDefs :: AnaParser
Input Pair Token Pos (Pos, (AttrNames, AttrNames, AttrNames))
pSingleAttrDefs
= (\Pos
p AttrNames
is -> (Pos
p, (AttrNames
is,[],[]))) (Pos -> AttrNames -> (Pos, (AttrNames, AttrNames, AttrNames)))
-> AnaParser Input Pair Token Pos Pos
-> AnaParser
Input
Pair
Token
Pos
(AttrNames -> (Pos, (AttrNames, AttrNames, AttrNames)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos Pos
pINH AnaParser
Input
Pair
Token
Pos
(AttrNames -> (Pos, (AttrNames, AttrNames, AttrNames)))
-> AnaParser Input Pair Token Pos AttrNames
-> AnaParser
Input Pair Token Pos (Pos, (AttrNames, AttrNames, AttrNames))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos String
-> AnaParser
Input Pair Token Pos (Identifier, Type, (String, String, String))
-> AnaParser Input Pair Token Pos AttrNames
forall (p :: * -> *) s a a1. IsParser p s => p a -> p a1 -> p [a1]
pList1Sep AnaParser Input Pair Token Pos String
forall (p :: * -> *). IsParser p Token => p String
pComma AnaParser
Input Pair Token Pos (Identifier, Type, (String, String, String))
pSingleInhAttrDef
AnaParser
Input Pair Token Pos (Pos, (AttrNames, AttrNames, AttrNames))
-> AnaParser
Input Pair Token Pos (Pos, (AttrNames, AttrNames, AttrNames))
-> AnaParser
Input Pair Token Pos (Pos, (AttrNames, AttrNames, AttrNames))
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (\Pos
p AttrNames
is -> (Pos
p, ([],[],AttrNames
is))) (Pos -> AttrNames -> (Pos, (AttrNames, AttrNames, AttrNames)))
-> AnaParser Input Pair Token Pos Pos
-> AnaParser
Input
Pair
Token
Pos
(AttrNames -> (Pos, (AttrNames, AttrNames, AttrNames)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos Pos
pSYN AnaParser
Input
Pair
Token
Pos
(AttrNames -> (Pos, (AttrNames, AttrNames, AttrNames)))
-> AnaParser Input Pair Token Pos AttrNames
-> AnaParser
Input Pair Token Pos (Pos, (AttrNames, AttrNames, AttrNames))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos String
-> AnaParser
Input Pair Token Pos (Identifier, Type, (String, String, String))
-> AnaParser Input Pair Token Pos AttrNames
forall (p :: * -> *) s a a1. IsParser p s => p a -> p a1 -> p [a1]
pList1Sep AnaParser Input Pair Token Pos String
forall (p :: * -> *). IsParser p Token => p String
pComma AnaParser
Input Pair Token Pos (Identifier, Type, (String, String, String))
pSingleSynAttrDef
AnaParser
Input Pair Token Pos (Pos, (AttrNames, AttrNames, AttrNames))
-> AnaParser
Input Pair Token Pos (Pos, (AttrNames, AttrNames, AttrNames))
-> AnaParser
Input Pair Token Pos (Pos, (AttrNames, AttrNames, AttrNames))
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (\Pos
p AttrNames
is -> (Pos
p, ([],AttrNames
is,[]))) (Pos -> AttrNames -> (Pos, (AttrNames, AttrNames, AttrNames)))
-> AnaParser Input Pair Token Pos Pos
-> AnaParser
Input
Pair
Token
Pos
(AttrNames -> (Pos, (AttrNames, AttrNames, AttrNames)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos Pos
pCHN AnaParser
Input
Pair
Token
Pos
(AttrNames -> (Pos, (AttrNames, AttrNames, AttrNames)))
-> AnaParser Input Pair Token Pos AttrNames
-> AnaParser
Input Pair Token Pos (Pos, (AttrNames, AttrNames, AttrNames))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos String
-> AnaParser
Input Pair Token Pos (Identifier, Type, (String, String, String))
-> AnaParser Input Pair Token Pos AttrNames
forall (p :: * -> *) s a a1. IsParser p s => p a -> p a1 -> p [a1]
pList1Sep AnaParser Input Pair Token Pos String
forall (p :: * -> *). IsParser p Token => p String
pComma AnaParser
Input Pair Token Pos (Identifier, Type, (String, String, String))
pSingleChnAttrDef
pSingleInhAttrDef :: AGParser (Identifier,Type,(String,String,String))
pSingleInhAttrDef :: AnaParser
Input Pair Token Pos (Identifier, Type, (String, String, String))
pSingleInhAttrDef
= (\Identifier
v Type
tp -> (Identifier
v,Type
tp,(String
"",String
"",String
""))) (Identifier
-> Type -> (Identifier, Type, (String, String, String)))
-> AGParser Identifier
-> AnaParser
Input
Pair
Token
Pos
(Type -> (Identifier, Type, (String, String, String)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AGParser Identifier
pAttrIdentifier AnaParser
Input
Pair
Token
Pos
(Type -> (Identifier, Type, (String, String, String)))
-> AnaParser Input Pair Token Pos Pos
-> AnaParser
Input
Pair
Token
Pos
(Type -> (Identifier, Type, (String, String, String)))
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* AnaParser Input Pair Token Pos Pos
pTypeColon AnaParser
Input
Pair
Token
Pos
(Type -> (Identifier, Type, (String, String, String)))
-> AnaParser Input Pair Token Pos Type
-> AnaParser
Input Pair Token Pos (Identifier, Type, (String, String, String))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos Type
pTypeOrSelf AnaParser
Input Pair Token Pos (Identifier, Type, (String, String, String))
-> String
-> AnaParser
Input Pair Token Pos (Identifier, Type, (String, String, String))
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"inh attribute declaration"
pSingleSynAttrDef :: AGParser (Identifier,Type,(String,String,String))
pSingleSynAttrDef :: AnaParser
Input Pair Token Pos (Identifier, Type, (String, String, String))
pSingleSynAttrDef
= (\Identifier
v (String, String, String)
u Type
tp -> (Identifier
v,Type
tp,(String, String, String)
u)) (Identifier
-> (String, String, String)
-> Type
-> (Identifier, Type, (String, String, String)))
-> AGParser Identifier
-> AnaParser
Input
Pair
Token
Pos
((String, String, String)
-> Type -> (Identifier, Type, (String, String, String)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AGParser Identifier
pAttrIdentifier AnaParser
Input
Pair
Token
Pos
((String, String, String)
-> Type -> (Identifier, Type, (String, String, String)))
-> AnaParser Input Pair Token Pos (String, String, String)
-> AnaParser
Input
Pair
Token
Pos
(Type -> (Identifier, Type, (String, String, String)))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos (String, String, String)
pUse AnaParser
Input
Pair
Token
Pos
(Type -> (Identifier, Type, (String, String, String)))
-> AnaParser Input Pair Token Pos Pos
-> AnaParser
Input
Pair
Token
Pos
(Type -> (Identifier, Type, (String, String, String)))
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* AnaParser Input Pair Token Pos Pos
pTypeColon AnaParser
Input
Pair
Token
Pos
(Type -> (Identifier, Type, (String, String, String)))
-> AnaParser Input Pair Token Pos Type
-> AnaParser
Input Pair Token Pos (Identifier, Type, (String, String, String))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos Type
pTypeOrSelf AnaParser
Input Pair Token Pos (Identifier, Type, (String, String, String))
-> String
-> AnaParser
Input Pair Token Pos (Identifier, Type, (String, String, String))
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"syn attribute declaration"
pSingleChnAttrDef :: AGParser (Identifier,Type,(String,String,String))
pSingleChnAttrDef :: AnaParser
Input Pair Token Pos (Identifier, Type, (String, String, String))
pSingleChnAttrDef
= (\Identifier
v Type
tp -> (Identifier
v,Type
tp,(String
"",String
"",String
""))) (Identifier
-> Type -> (Identifier, Type, (String, String, String)))
-> AGParser Identifier
-> AnaParser
Input
Pair
Token
Pos
(Type -> (Identifier, Type, (String, String, String)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AGParser Identifier
pAttrIdentifier AnaParser
Input
Pair
Token
Pos
(Type -> (Identifier, Type, (String, String, String)))
-> AnaParser Input Pair Token Pos Pos
-> AnaParser
Input
Pair
Token
Pos
(Type -> (Identifier, Type, (String, String, String)))
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* AnaParser Input Pair Token Pos Pos
pTypeColon AnaParser
Input
Pair
Token
Pos
(Type -> (Identifier, Type, (String, String, String)))
-> AnaParser Input Pair Token Pos Type
-> AnaParser
Input Pair Token Pos (Identifier, Type, (String, String, String))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos Type
pTypeOrSelf AnaParser
Input Pair Token Pos (Identifier, Type, (String, String, String))
-> String
-> AnaParser
Input Pair Token Pos (Identifier, Type, (String, String, String))
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"chn attribute declaration"
pOptAttrs :: AGParser Attrs
pOptAttrs :: AnaParser Input Pair Token Pos Attrs
pOptAttrs = AnaParser Input Pair Token Pos Attrs
pAttrs AnaParser Input Pair Token Pos Attrs
-> Attrs -> AnaParser Input Pair Token Pos Attrs
forall (p :: * -> *) s a. IsParser p s => p a -> a -> p a
`opt` Pos -> AttrNames -> AttrNames -> AttrNames -> Attrs
Attrs Pos
noPos [] [] []
pInhAttrNames :: AGParser AttrNames
pInhAttrNames :: AnaParser Input Pair Token Pos AttrNames
pInhAttrNames
= (\[Identifier]
vs Type
tp -> (Identifier -> (Identifier, Type, (String, String, String)))
-> [Identifier] -> AttrNames
forall a b. (a -> b) -> [a] -> [b]
map (\Identifier
v -> (Identifier
v,Type
tp,(String
"",String
"",String
""))) [Identifier]
vs)
([Identifier] -> Type -> AttrNames)
-> AGParser [Identifier]
-> AnaParser Input Pair Token Pos (Type -> AttrNames)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AGParser [Identifier]
pAttrIdentifiers AnaParser Input Pair Token Pos (Type -> AttrNames)
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos (Type -> AttrNames)
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* AnaParser Input Pair Token Pos Pos
pTypeColon AnaParser Input Pair Token Pos (Type -> AttrNames)
-> AnaParser Input Pair Token Pos Type
-> AnaParser Input Pair Token Pos AttrNames
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos Type
pTypeOrSelf AnaParser Input Pair Token Pos AttrNames
-> String -> AnaParser Input Pair Token Pos AttrNames
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"attribute declarations"
pAttrNames :: AGParser AttrNames
pAttrNames :: AnaParser Input Pair Token Pos AttrNames
pAttrNames
= (\[Identifier]
vs (String, String, String)
use Type
tp -> (Identifier -> (Identifier, Type, (String, String, String)))
-> [Identifier] -> AttrNames
forall a b. (a -> b) -> [a] -> [b]
map (\Identifier
v -> (Identifier
v,Type
tp,(String, String, String)
use)) [Identifier]
vs)
([Identifier] -> (String, String, String) -> Type -> AttrNames)
-> AGParser [Identifier]
-> AnaParser
Input
Pair
Token
Pos
((String, String, String) -> Type -> AttrNames)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AGParser [Identifier]
pAttrIdentifiers AnaParser
Input
Pair
Token
Pos
((String, String, String) -> Type -> AttrNames)
-> AnaParser Input Pair Token Pos (String, String, String)
-> AnaParser Input Pair Token Pos (Type -> AttrNames)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos (String, String, String)
pUse AnaParser Input Pair Token Pos (Type -> AttrNames)
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos (Type -> AttrNames)
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* AnaParser Input Pair Token Pos Pos
pTypeColon AnaParser Input Pair Token Pos (Type -> AttrNames)
-> AnaParser Input Pair Token Pos Type
-> AnaParser Input Pair Token Pos AttrNames
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos Type
pTypeOrSelf AnaParser Input Pair Token Pos AttrNames
-> String -> AnaParser Input Pair Token Pos AttrNames
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"attribute declarations"
pAlt :: AGParser Alt
pAlt :: AGParser Alt
pAlt = (Pos
-> ConstructorSet -> [Identifier] -> Fields -> MaybeMacro -> Alt
Alt (Pos
-> ConstructorSet -> [Identifier] -> Fields -> MaybeMacro -> Alt)
-> AnaParser Input Pair Token Pos Pos
-> AnaParser
Input
Pair
Token
Pos
(ConstructorSet -> [Identifier] -> Fields -> MaybeMacro -> Alt)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos Pos
pBar AnaParser
Input
Pair
Token
Pos
(ConstructorSet -> [Identifier] -> Fields -> MaybeMacro -> Alt)
-> AnaParser Input Pair Token Pos ConstructorSet
-> AnaParser
Input Pair Token Pos ([Identifier] -> Fields -> MaybeMacro -> Alt)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos ConstructorSet
pSimpleConstructorSet AnaParser
Input Pair Token Pos ([Identifier] -> Fields -> MaybeMacro -> Alt)
-> AGParser [Identifier]
-> AnaParser Input Pair Token Pos (Fields -> MaybeMacro -> Alt)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (AGParser Identifier -> AGParser [Identifier]
forall (p :: * -> *) s a. IsParser p s => p a -> p [a]
pList1_ng AGParser Identifier
pTypeVar AGParser [Identifier]
-> AnaParser Input Pair Token Pos Pos -> AGParser [Identifier]
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* AnaParser Input Pair Token Pos Pos
pDot AGParser [Identifier]
-> AGParser [Identifier] -> AGParser [Identifier]
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> [Identifier] -> AGParser [Identifier]
forall (p :: * -> *) s a. IsParser p s => a -> p a
pSucceed []) AnaParser Input Pair Token Pos (Fields -> MaybeMacro -> Alt)
-> AnaParser Input Pair Token Pos Fields
-> AnaParser Input Pair Token Pos (MaybeMacro -> Alt)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos Fields
pFields AnaParser Input Pair Token Pos (MaybeMacro -> Alt)
-> AnaParser Input Pair Token Pos MaybeMacro -> AGParser Alt
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos MaybeMacro
pMaybeMacro AGParser Alt -> String -> AGParser Alt
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"a datatype alternative")
pAlts :: AGParser Alts
pAlts :: AnaParser Input Pair Token Pos Alts
pAlts = AGParser Alt -> AnaParser Input Pair Token Pos Alts
forall (p :: * -> *) s a. IsParser p s => p a -> p [a]
pList_ng AGParser Alt
pAlt AnaParser Input Pair Token Pos Alts
-> String -> AnaParser Input Pair Token Pos Alts
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"datatype alternatives"
pFields :: AGParser Fields
pFields :: AnaParser Input Pair Token Pos Fields
pFields = [Fields] -> Fields
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([Fields] -> Fields)
-> AnaParser Input Pair Token Pos [Fields]
-> AnaParser Input Pair Token Pos Fields
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos Fields
-> AnaParser Input Pair Token Pos [Fields]
forall (p :: * -> *) s a. IsParser p s => p a -> p [a]
pList_ng AnaParser Input Pair Token Pos Fields
pField AnaParser Input Pair Token Pos Fields
-> String -> AnaParser Input Pair Token Pos Fields
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"fields"
pField :: AGParser Fields
pField :: AnaParser Input Pair Token Pos Fields
pField
= (\[Identifier]
nms Type
tp -> (Identifier -> Field) -> [Identifier] -> Fields
forall a b. (a -> b) -> [a] -> [b]
map (\Identifier
nm -> Identifier -> Type -> Field
FChild Identifier
nm Type
tp) [Identifier]
nms) ([Identifier] -> Type -> Fields)
-> AGParser [Identifier]
-> AnaParser Input Pair Token Pos (Type -> Fields)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AGParser [Identifier]
pAttrIdentifiers AnaParser Input Pair Token Pos (Type -> Fields)
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos (Type -> Fields)
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* AnaParser Input Pair Token Pos Pos
pTypeColon AnaParser Input Pair Token Pos (Type -> Fields)
-> AnaParser Input Pair Token Pos Type
-> AnaParser Input Pair Token Pos Fields
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos Type
pType
AnaParser Input Pair Token Pos Fields
-> AnaParser Input Pair Token Pos Fields
-> AnaParser Input Pair Token Pos Fields
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (\Identifier
s -> [Identifier -> Type -> Field
FChild (String -> Pos -> Identifier
Ident (String -> String
mklower (String -> String) -> String -> String
forall a b. (a -> b) -> a -> b
$ Identifier -> String
getName Identifier
s) (Identifier -> Pos
getPos Identifier
s)) (Identifier -> [String] -> Bool -> Type
NT Identifier
s [] Bool
False)]) (Identifier -> Fields)
-> AGParser Identifier -> AnaParser Input Pair Token Pos Fields
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AGParser Identifier
pIdentifierU
AnaParser Input Pair Token Pos Fields
-> AnaParser Input Pair Token Pos Fields
-> AnaParser Input Pair Token Pos Fields
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (\Type
t -> [[Type] -> Field
FCtx [Type
t]]) (Type -> Fields)
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos (Type -> Fields)
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ AnaParser Input Pair Token Pos Pos
pSmallerEqual AnaParser Input Pair Token Pos (Type -> Fields)
-> AnaParser Input Pair Token Pos Type
-> AnaParser Input Pair Token Pos Fields
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos Type
pTypePrimitive
pSemAlt :: AGParser SemAlt
pSemAlt :: AGParser SemAlt
pSemAlt = Pos -> ConstructorSet -> SemDefs -> SemAlt
SemAlt (Pos -> ConstructorSet -> SemDefs -> SemAlt)
-> AnaParser Input Pair Token Pos Pos
-> AnaParser
Input Pair Token Pos (ConstructorSet -> SemDefs -> SemAlt)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos Pos
pBar AnaParser
Input Pair Token Pos (ConstructorSet -> SemDefs -> SemAlt)
-> AnaParser Input Pair Token Pos ConstructorSet
-> AnaParser Input Pair Token Pos (SemDefs -> SemAlt)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos ConstructorSet
pConstructorSet AnaParser Input Pair Token Pos (SemDefs -> SemAlt)
-> AnaParser Input Pair Token Pos SemDefs -> AGParser SemAlt
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos SemDefs
pSemDefs AGParser SemAlt -> String -> AGParser SemAlt
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"SEM alternative"
pSemAlts :: AGParser SemAlts
pSemAlts :: AnaParser Input Pair Token Pos SemAlts
pSemAlts = AGParser SemAlt -> AnaParser Input Pair Token Pos SemAlts
forall (p :: * -> *) s a. IsParser p s => p a -> p [a]
pList AGParser SemAlt
pSemAlt AnaParser Input Pair Token Pos SemAlts
-> String -> AnaParser Input Pair Token Pos SemAlts
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"SEM alternatives"
pSemDef :: AGParser [SemDef]
pSemDef :: AnaParser Input Pair Token Pos SemDefs
pSemDef
= (\Maybe Identifier
x Identifier
y [Maybe Identifier -> Identifier -> SemDef]
fs -> ((Maybe Identifier -> Identifier -> SemDef) -> SemDef)
-> [Maybe Identifier -> Identifier -> SemDef] -> SemDefs
forall a b. (a -> b) -> [a] -> [b]
map (\Maybe Identifier -> Identifier -> SemDef
f -> Maybe Identifier -> Identifier -> SemDef
f Maybe Identifier
x Identifier
y) [Maybe Identifier -> Identifier -> SemDef]
fs) (Maybe Identifier
-> Identifier
-> [Maybe Identifier -> Identifier -> SemDef]
-> SemDefs)
-> AnaParser Input Pair Token Pos (Maybe Identifier)
-> AnaParser
Input
Pair
Token
Pos
(Identifier
-> [Maybe Identifier -> Identifier -> SemDef] -> SemDefs)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos (Maybe Identifier)
pMaybeRuleName AnaParser
Input
Pair
Token
Pos
(Identifier
-> [Maybe Identifier -> Identifier -> SemDef] -> SemDefs)
-> AGParser Identifier
-> AnaParser
Input
Pair
Token
Pos
([Maybe Identifier -> Identifier -> SemDef] -> SemDefs)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AGParser Identifier
pFieldIdentifier AnaParser
Input
Pair
Token
Pos
([Maybe Identifier -> Identifier -> SemDef] -> SemDefs)
-> AnaParser
Input Pair Token Pos [Maybe Identifier -> Identifier -> SemDef]
-> AnaParser Input Pair Token Pos SemDefs
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser
Input Pair Token Pos (Maybe Identifier -> Identifier -> SemDef)
-> AnaParser
Input Pair Token Pos [Maybe Identifier -> Identifier -> SemDef]
forall (p :: * -> *) s a. IsParser p s => p a -> p [a]
pList1 AnaParser
Input Pair Token Pos (Maybe Identifier -> Identifier -> SemDef)
pAttrDef
AnaParser Input Pair Token Pos SemDefs
-> AnaParser Input Pair Token Pos SemDefs
-> AnaParser Input Pair Token Pos SemDefs
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> AnaParser Input Pair Token Pos Pos
pLOC AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos SemDefs
-> AnaParser Input Pair Token Pos SemDefs
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> AnaParser Input Pair Token Pos SemDef
-> AnaParser Input Pair Token Pos SemDefs
forall (p :: * -> *) s a. IsParser p s => p a -> p [a]
pList1 AnaParser Input Pair Token Pos SemDef
pLocDecl
AnaParser Input Pair Token Pos SemDefs
-> AnaParser Input Pair Token Pos SemDefs
-> AnaParser Input Pair Token Pos SemDefs
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> AnaParser Input Pair Token Pos Pos
pINST AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos SemDefs
-> AnaParser Input Pair Token Pos SemDefs
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> AnaParser Input Pair Token Pos SemDef
-> AnaParser Input Pair Token Pos SemDefs
forall (p :: * -> *) s a. IsParser p s => p a -> p [a]
pList1 AnaParser Input Pair Token Pos SemDef
pInstDecl
AnaParser Input Pair Token Pos SemDefs
-> AnaParser Input Pair Token Pos SemDefs
-> AnaParser Input Pair Token Pos SemDefs
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> AnaParser Input Pair Token Pos Pos
pSEMPRAGMA AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos SemDefs
-> AnaParser Input Pair Token Pos SemDefs
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> AnaParser Input Pair Token Pos SemDef
-> AnaParser Input Pair Token Pos SemDefs
forall (p :: * -> *) s a. IsParser p s => p a -> p [a]
pList1 ([Identifier] -> SemDef
SemPragma ([Identifier] -> SemDef)
-> AGParser [Identifier] -> AnaParser Input Pair Token Pos SemDef
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AGParser [Identifier]
pNames)
AnaParser Input Pair Token Pos SemDefs
-> AnaParser Input Pair Token Pos SemDefs
-> AnaParser Input Pair Token Pos SemDefs
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (\Identifier
n Expression
e -> [Identifier -> Expression -> SemDef
AugmentDef Identifier
n Expression
e]) (Identifier -> Expression -> SemDefs)
-> AnaParser Input Pair Token Pos ()
-> AnaParser
Input Pair Token Pos (Identifier -> Expression -> SemDefs)
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ AnaParser Input Pair Token Pos ()
pAugmentToken AnaParser
Input Pair Token Pos (Identifier -> Expression -> SemDefs)
-> AGParser Identifier
-> AnaParser Input Pair Token Pos (Expression -> SemDefs)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AGParser Identifier
pAttrIdentifier AnaParser Input Pair Token Pos (Expression -> SemDefs)
-> AnaParser Input Pair Token Pos Bool
-> AnaParser Input Pair Token Pos (Expression -> SemDefs)
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* AnaParser Input Pair Token Pos Bool
pAssign AnaParser Input Pair Token Pos (Expression -> SemDefs)
-> AnaParser Input Pair Token Pos Expression
-> AnaParser Input Pair Token Pos SemDefs
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos Expression
pExpr
AnaParser Input Pair Token Pos SemDefs
-> AnaParser Input Pair Token Pos SemDefs
-> AnaParser Input Pair Token Pos SemDefs
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (\Identifier
n Expression
e -> [Identifier -> Expression -> SemDef
AroundDef Identifier
n Expression
e]) (Identifier -> Expression -> SemDefs)
-> AnaParser Input Pair Token Pos Pos
-> AnaParser
Input Pair Token Pos (Identifier -> Expression -> SemDefs)
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ AnaParser Input Pair Token Pos Pos
pAROUND AnaParser
Input Pair Token Pos (Identifier -> Expression -> SemDefs)
-> AGParser Identifier
-> AnaParser Input Pair Token Pos (Expression -> SemDefs)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AGParser Identifier
pAttrIdentifier AnaParser Input Pair Token Pos (Expression -> SemDefs)
-> AnaParser Input Pair Token Pos Bool
-> AnaParser Input Pair Token Pos (Expression -> SemDefs)
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* AnaParser Input Pair Token Pos Bool
pAssign AnaParser Input Pair Token Pos (Expression -> SemDefs)
-> AnaParser Input Pair Token Pos Expression
-> AnaParser Input Pair Token Pos SemDefs
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos Expression
pExpr
AnaParser Input Pair Token Pos SemDefs
-> AnaParser Input Pair Token Pos SemDefs
-> AnaParser Input Pair Token Pos SemDefs
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (\[Occurrence]
a Occurrence
b -> [[Occurrence] -> [Occurrence] -> SemDef
AttrOrderBefore [Occurrence]
a [Occurrence
b]]) ([Occurrence] -> Occurrence -> SemDefs)
-> AnaParser Input Pair Token Pos [Occurrence]
-> AnaParser Input Pair Token Pos (Occurrence -> SemDefs)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos Occurrence
-> AnaParser Input Pair Token Pos [Occurrence]
forall (p :: * -> *) s a. IsParser p s => p a -> p [a]
pList1 AnaParser Input Pair Token Pos Occurrence
pAttrOrIdent AnaParser Input Pair Token Pos (Occurrence -> SemDefs)
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos (Occurrence -> SemDefs)
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* AnaParser Input Pair Token Pos Pos
pSmaller AnaParser Input Pair Token Pos (Occurrence -> SemDefs)
-> AnaParser Input Pair Token Pos Occurrence
-> AnaParser Input Pair Token Pos SemDefs
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos Occurrence
pAttrOrIdent
AnaParser Input Pair Token Pos SemDefs
-> AnaParser Input Pair Token Pos SemDefs
-> AnaParser Input Pair Token Pos SemDefs
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (\[Identifier]
sources Identifier
target Identifier
nt Expression
expr -> [Identifier -> Identifier -> [Identifier] -> Expression -> SemDef
MergeDef Identifier
target Identifier
nt [Identifier]
sources Expression
expr]) ([Identifier] -> Identifier -> Identifier -> Expression -> SemDefs)
-> AnaParser Input Pair Token Pos Pos
-> AnaParser
Input
Pair
Token
Pos
([Identifier] -> Identifier -> Identifier -> Expression -> SemDefs)
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ AnaParser Input Pair Token Pos Pos
pMERGE AnaParser
Input
Pair
Token
Pos
([Identifier] -> Identifier -> Identifier -> Expression -> SemDefs)
-> AGParser [Identifier]
-> AnaParser
Input
Pair
Token
Pos
(Identifier -> Identifier -> Expression -> SemDefs)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (AGParser Identifier -> AGParser [Identifier]
forall (p :: * -> *) s a. IsParser p s => p a -> p [a]
pList1_ng AGParser Identifier
pIdentifier AGParser [Identifier]
-> AnaParser Input Pair Token Pos Pos -> AGParser [Identifier]
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* AnaParser Input Pair Token Pos Pos
pAS AGParser [Identifier]
-> AGParser [Identifier] -> AGParser [Identifier]
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> [Identifier] -> AGParser [Identifier]
forall (p :: * -> *) s a. IsParser p s => a -> p a
pSucceed []) AnaParser
Input
Pair
Token
Pos
(Identifier -> Identifier -> Expression -> SemDefs)
-> AGParser Identifier
-> AnaParser
Input Pair Token Pos (Identifier -> Expression -> SemDefs)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AGParser Identifier
pIdentifier AnaParser
Input Pair Token Pos (Identifier -> Expression -> SemDefs)
-> AnaParser Input Pair Token Pos Pos
-> AnaParser
Input Pair Token Pos (Identifier -> Expression -> SemDefs)
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* AnaParser Input Pair Token Pos Pos
pTypeColon AnaParser
Input Pair Token Pos (Identifier -> Expression -> SemDefs)
-> AGParser Identifier
-> AnaParser Input Pair Token Pos (Expression -> SemDefs)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AGParser Identifier
pIdentifierU AnaParser Input Pair Token Pos (Expression -> SemDefs)
-> AnaParser Input Pair Token Pos Bool
-> AnaParser Input Pair Token Pos (Expression -> SemDefs)
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* AnaParser Input Pair Token Pos Bool
pAssign AnaParser Input Pair Token Pos (Expression -> SemDefs)
-> AnaParser Input Pair Token Pos Expression
-> AnaParser Input Pair Token Pos SemDefs
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos Expression
pExpr
AnaParser Input Pair Token Pos SemDefs
-> AnaParser Input Pair Token Pos SemDefs
-> AnaParser Input Pair Token Pos SemDefs
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (\Maybe Identifier
mbNm () -> Pattern
pat (Bool
owrt,Pos
pos,Bool
pur,Bool
eager) Expression
exp -> [Pos
-> Maybe Identifier
-> Pattern
-> Expression
-> Bool
-> Bool
-> Bool
-> SemDef
Def Pos
pos Maybe Identifier
mbNm (() -> Pattern
pat ()) Expression
exp Bool
owrt Bool
pur Bool
eager]) (Maybe Identifier
-> (() -> Pattern)
-> (Bool, Pos, Bool, Bool)
-> Expression
-> SemDefs)
-> AnaParser Input Pair Token Pos (Maybe Identifier)
-> AnaParser
Input
Pair
Token
Pos
((() -> Pattern)
-> (Bool, Pos, Bool, Bool) -> Expression -> SemDefs)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos (Maybe Identifier)
pMaybeRuleName AnaParser
Input
Pair
Token
Pos
((() -> Pattern)
-> (Bool, Pos, Bool, Bool) -> Expression -> SemDefs)
-> AnaParser Input Pair Token Pos (() -> Pattern)
-> AnaParser
Input
Pair
Token
Pos
((Bool, Pos, Bool, Bool) -> Expression -> SemDefs)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AGParser (() -> (Identifier, Identifier))
-> AnaParser Input Pair Token Pos (() -> Pattern)
forall a.
AGParser (a -> (Identifier, Identifier)) -> AGParser (a -> Pattern)
pPattern ((Identifier, Identifier) -> () -> (Identifier, Identifier)
forall a b. a -> b -> a
const ((Identifier, Identifier) -> () -> (Identifier, Identifier))
-> AnaParser Input Pair Token Pos (Identifier, Identifier)
-> AGParser (() -> (Identifier, Identifier))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos (Identifier, Identifier)
pAttr) AnaParser
Input
Pair
Token
Pos
((Bool, Pos, Bool, Bool) -> Expression -> SemDefs)
-> AnaParser Input Pair Token Pos (Bool, Pos, Bool, Bool)
-> AnaParser Input Pair Token Pos (Expression -> SemDefs)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos (Bool, Pos, Bool, Bool)
pRuleSym AnaParser Input Pair Token Pos (Expression -> SemDefs)
-> AnaParser Input Pair Token Pos Expression
-> AnaParser Input Pair Token Pos SemDefs
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos Expression
pExpr
pMaybeRuleName :: AGParser (Maybe Identifier)
pMaybeRuleName :: AnaParser Input Pair Token Pos (Maybe Identifier)
pMaybeRuleName
= (Identifier -> Maybe Identifier
forall a. a -> Maybe a
Just (Identifier -> Maybe Identifier)
-> AGParser Identifier
-> AnaParser Input Pair Token Pos (Maybe Identifier)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AGParser Identifier
pIdentifier AnaParser Input Pair Token Pos (Maybe Identifier)
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos (Maybe Identifier)
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* AnaParser Input Pair Token Pos Pos
pColon AnaParser Input Pair Token Pos (Maybe Identifier)
-> String -> AnaParser Input Pair Token Pos (Maybe Identifier)
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"rule name")
AnaParser Input Pair Token Pos (Maybe Identifier)
-> AnaParser Input Pair Token Pos (Maybe Identifier)
-> AnaParser Input Pair Token Pos (Maybe Identifier)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Maybe Identifier
-> AnaParser Input Pair Token Pos (Maybe Identifier)
forall (p :: * -> *) s a. IsParser p s => a -> p a
pSucceed Maybe Identifier
forall a. Maybe a
Nothing
pAttrDef :: AGParser (Maybe Identifier -> Identifier -> SemDef)
pAttrDef :: AnaParser
Input Pair Token Pos (Maybe Identifier -> Identifier -> SemDef)
pAttrDef
= (\Identifier -> Pattern
pat (Bool
owrt,Pos
pos,Bool
pur,Bool
eager) Expression
exp Maybe Identifier
mbNm Identifier
fld -> Pos
-> Maybe Identifier
-> Pattern
-> Expression
-> Bool
-> Bool
-> Bool
-> SemDef
Def Pos
pos Maybe Identifier
mbNm (Identifier -> Pattern
pat Identifier
fld) Expression
exp Bool
owrt Bool
pur Bool
eager)
((Identifier -> Pattern)
-> (Bool, Pos, Bool, Bool)
-> Expression
-> Maybe Identifier
-> Identifier
-> SemDef)
-> AnaParser Input Pair Token Pos Pos
-> AnaParser
Input
Pair
Token
Pos
((Identifier -> Pattern)
-> (Bool, Pos, Bool, Bool)
-> Expression
-> Maybe Identifier
-> Identifier
-> SemDef)
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ AnaParser Input Pair Token Pos Pos
pDot AnaParser
Input
Pair
Token
Pos
((Identifier -> Pattern)
-> (Bool, Pos, Bool, Bool)
-> Expression
-> Maybe Identifier
-> Identifier
-> SemDef)
-> AnaParser Input Pair Token Pos (Identifier -> Pattern)
-> AnaParser
Input
Pair
Token
Pos
((Bool, Pos, Bool, Bool)
-> Expression -> Maybe Identifier -> Identifier -> SemDef)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos (Identifier -> Pattern)
pattern AnaParser
Input
Pair
Token
Pos
((Bool, Pos, Bool, Bool)
-> Expression -> Maybe Identifier -> Identifier -> SemDef)
-> AnaParser Input Pair Token Pos (Bool, Pos, Bool, Bool)
-> AnaParser
Input
Pair
Token
Pos
(Expression -> Maybe Identifier -> Identifier -> SemDef)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos (Bool, Pos, Bool, Bool)
pRuleSym AnaParser
Input
Pair
Token
Pos
(Expression -> Maybe Identifier -> Identifier -> SemDef)
-> AnaParser Input Pair Token Pos Expression
-> AnaParser
Input Pair Token Pos (Maybe Identifier -> Identifier -> SemDef)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos Expression
pExpr
where pattern :: AnaParser Input Pair Token Pos (Identifier -> Pattern)
pattern = AGParser (Identifier -> (Identifier, Identifier))
-> AnaParser Input Pair Token Pos (Identifier -> Pattern)
forall a.
AGParser (a -> (Identifier, Identifier)) -> AGParser (a -> Pattern)
pPattern AGParser (Identifier -> (Identifier, Identifier))
pVar
AnaParser Input Pair Token Pos (Identifier -> Pattern)
-> AnaParser Input Pair Token Pos (Identifier -> Pattern)
-> AnaParser Input Pair Token Pos (Identifier -> Pattern)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (\Pattern -> Pattern
ir Identifier
a Identifier
fld -> Pattern -> Pattern
ir (Pattern -> Pattern) -> Pattern -> Pattern
forall a b. (a -> b) -> a -> b
$ Identifier -> Identifier -> Pattern -> Pattern
Alias Identifier
fld Identifier
a (Pos -> Pattern
Underscore Pos
noPos)) ((Pattern -> Pattern) -> Identifier -> Identifier -> Pattern)
-> AnaParser Input Pair Token Pos (Pattern -> Pattern)
-> AnaParser
Input Pair Token Pos (Identifier -> Identifier -> Pattern)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ((Pattern -> Pattern
Irrefutable (Pattern -> Pattern)
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos (Pattern -> Pattern)
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ AnaParser Input Pair Token Pos Pos
pTilde) AnaParser Input Pair Token Pos (Pattern -> Pattern)
-> (Pattern -> Pattern)
-> AnaParser Input Pair Token Pos (Pattern -> Pattern)
forall (p :: * -> *) s a. IsParser p s => p a -> a -> p a
`opt` Pattern -> Pattern
forall a. a -> a
id) AnaParser
Input Pair Token Pos (Identifier -> Identifier -> Pattern)
-> AGParser Identifier
-> AnaParser Input Pair Token Pos (Identifier -> Pattern)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AGParser Identifier
pAttrIdentifier
pLocDecl :: AGParser SemDef
pLocDecl :: AnaParser Input Pair Token Pos SemDef
pLocDecl = AnaParser Input Pair Token Pos Pos
pDot AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos (Pos -> SemDef)
-> AnaParser Input Pair Token Pos SemDef
forall (f :: * -> *) a b. Applicative f => f a -> f (a -> b) -> f b
<**> (AGParser Identifier
pIdentifier AGParser Identifier
-> AnaParser Input Pair Token Pos (Identifier -> Pos -> SemDef)
-> AnaParser Input Pair Token Pos (Pos -> SemDef)
forall (f :: * -> *) a b. Applicative f => f a -> f (a -> b) -> f b
<**> (AnaParser Input Pair Token Pos Pos
pTypeColon AnaParser Input Pair Token Pos Pos
-> AnaParser
Input Pair Token Pos (Pos -> Identifier -> Pos -> SemDef)
-> AnaParser Input Pair Token Pos (Identifier -> Pos -> SemDef)
forall (f :: * -> *) a b. Applicative f => f a -> f (a -> b) -> f b
<**> ( (\(Type
tp,Pos
pos) Pos
_ Identifier
ident Pos
_ -> Pos -> Identifier -> Type -> SemDef
TypeDef Pos
pos Identifier
ident Type
tp) ((Type, Pos) -> Pos -> Identifier -> Pos -> SemDef)
-> AnaParser Input Pair Token Pos (Type, Pos)
-> AnaParser
Input Pair Token Pos (Pos -> Identifier -> Pos -> SemDef)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos (Type, Pos)
pLocType
AnaParser Input Pair Token Pos (Pos -> Identifier -> Pos -> SemDef)
-> AnaParser
Input Pair Token Pos (Pos -> Identifier -> Pos -> SemDef)
-> AnaParser
Input Pair Token Pos (Pos -> Identifier -> Pos -> SemDef)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (\Identifier
ref Pos
_ Identifier
ident Pos
_ -> Identifier -> Identifier -> SemDef
UniqueDef Identifier
ident Identifier
ref) (Identifier -> Pos -> Identifier -> Pos -> SemDef)
-> AnaParser Input Pair Token Pos Pos
-> AnaParser
Input
Pair
Token
Pos
(Identifier -> Pos -> Identifier -> Pos -> SemDef)
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ AnaParser Input Pair Token Pos Pos
pUNIQUEREF AnaParser
Input
Pair
Token
Pos
(Identifier -> Pos -> Identifier -> Pos -> SemDef)
-> AGParser Identifier
-> AnaParser
Input Pair Token Pos (Pos -> Identifier -> Pos -> SemDef)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AGParser Identifier
pIdentifier )))
pLocType :: AGParser (Type, Pos)
pLocType :: AnaParser Input Pair Token Pos (Type, Pos)
pLocType = (\Identifier
u -> (String -> Type
Haskell (String -> Type) -> String -> Type
forall a b. (a -> b) -> a -> b
$ Identifier -> String
getName Identifier
u, Identifier -> Pos
getPos Identifier
u)) (Identifier -> (Type, Pos))
-> AGParser Identifier
-> AnaParser Input Pair Token Pos (Type, Pos)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AGParser Identifier
pTypeCon
AnaParser Input Pair Token Pos (Type, Pos)
-> AnaParser Input Pair Token Pos (Type, Pos)
-> AnaParser Input Pair Token Pos (Type, Pos)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (\(String
s,Pos
p) -> (String -> Type
Haskell String
s,Pos
p)) ((String, Pos) -> (Type, Pos))
-> AnaParser Input Pair Token Pos (String, Pos)
-> AnaParser Input Pair Token Pos (Type, Pos)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos (String, Pos)
pCodescrap AnaParser Input Pair Token Pos (Type, Pos)
-> String -> AnaParser Input Pair Token Pos (Type, Pos)
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"a type"
pInstDecl :: AGParser SemDef
pInstDecl :: AnaParser Input Pair Token Pos SemDef
pInstDecl = (\Identifier
ident Type
tp -> Pos -> Identifier -> Type -> SemDef
TypeDef (Identifier -> Pos
getPos Identifier
ident) Identifier
ident Type
tp)
(Identifier -> Type -> SemDef)
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos (Identifier -> Type -> SemDef)
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ AnaParser Input Pair Token Pos Pos
pDot AnaParser Input Pair Token Pos (Identifier -> Type -> SemDef)
-> AGParser Identifier
-> AnaParser Input Pair Token Pos (Type -> SemDef)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AGParser Identifier
pIdentifier AnaParser Input Pair Token Pos (Type -> SemDef)
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos (Type -> SemDef)
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* AnaParser Input Pair Token Pos Pos
pTypeColon AnaParser Input Pair Token Pos (Type -> SemDef)
-> AnaParser Input Pair Token Pos Type
-> AnaParser Input Pair Token Pos SemDef
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos Type
pTypeNt
pSemDefs :: AGParser SemDefs
pSemDefs :: AnaParser Input Pair Token Pos SemDefs
pSemDefs = [SemDefs] -> SemDefs
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([SemDefs] -> SemDefs)
-> AnaParser Input Pair Token Pos [SemDefs]
-> AnaParser Input Pair Token Pos SemDefs
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos SemDefs
-> AnaParser Input Pair Token Pos [SemDefs]
forall (p :: * -> *) s a. IsParser p s => p a -> p [a]
pList_ng AnaParser Input Pair Token Pos SemDefs
pSemDef AnaParser Input Pair Token Pos SemDefs
-> String -> AnaParser Input Pair Token Pos SemDefs
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"attribute rules"
pExpr :: AGParser Expression
pExpr :: AnaParser Input Pair Token Pos Expression
pExpr = (\(String
str,Pos
pos) -> Pos -> [HsToken] -> Expression
Expression Pos
pos (Options -> Pos -> String -> [HsToken]
lexTokens Options
opts Pos
pos String
str)) ((String, Pos) -> Expression)
-> AnaParser Input Pair Token Pos (String, Pos)
-> AnaParser Input Pair Token Pos Expression
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos (String, Pos)
pCodescrapL AnaParser Input Pair Token Pos Expression
-> String -> AnaParser Input Pair Token Pos Expression
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"an expression"
pTypeColon :: AGParser Pos
pTypeColon :: AnaParser Input Pair Token Pos Pos
pTypeColon
= if Options -> Bool
doubleColons Options
opts
then AnaParser Input Pair Token Pos Pos
pDoubleColon
else AnaParser Input Pair Token Pos Pos
pColon
pMaybeMacro :: AGParser MaybeMacro
pMaybeMacro :: AnaParser Input Pair Token Pos MaybeMacro
pMaybeMacro = Macro -> MaybeMacro
forall a. a -> Maybe a
Just (Macro -> MaybeMacro)
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos (Macro -> MaybeMacro)
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ AnaParser Input Pair Token Pos Pos
pDoubleArrow AnaParser Input Pair Token Pos (Macro -> MaybeMacro)
-> AnaParser Input Pair Token Pos Macro
-> AnaParser Input Pair Token Pos MaybeMacro
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos Macro
pMacro
AnaParser Input Pair Token Pos MaybeMacro
-> AnaParser Input Pair Token Pos MaybeMacro
-> AnaParser Input Pair Token Pos MaybeMacro
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> MaybeMacro -> AnaParser Input Pair Token Pos MaybeMacro
forall (p :: * -> *) s a. IsParser p s => a -> p a
pSucceed MaybeMacro
forall a. Maybe a
Nothing
pMacro :: AGParser Macro
pMacro :: AnaParser Input Pair Token Pos Macro
pMacro
= Identifier -> MacroChildren -> Macro
Macro (Identifier -> MacroChildren -> Macro)
-> AGParser Identifier
-> AnaParser Input Pair Token Pos (MacroChildren -> Macro)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AGParser Identifier
pIdentifierU
AnaParser Input Pair Token Pos (MacroChildren -> Macro)
-> AnaParser Input Pair Token Pos MacroChildren
-> AnaParser Input Pair Token Pos Macro
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos MacroChild
-> AnaParser Input Pair Token Pos MacroChildren
forall (p :: * -> *) s a. IsParser p s => p a -> p [a]
pList1 AnaParser Input Pair Token Pos MacroChild
pMacroChild
AnaParser Input Pair Token Pos Macro
-> String -> AnaParser Input Pair Token Pos Macro
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"macro"
pMacroChild :: AGParser MacroChild
pMacroChild :: AnaParser Input Pair Token Pos MacroChild
pMacroChild
= (AGParser Identifier
pIdentifier AGParser Identifier
-> AnaParser Input Pair Token Pos Pos -> AGParser Identifier
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* AnaParser Input Pair Token Pos Pos
pEquals) AGParser Identifier
-> AnaParser Input Pair Token Pos (Identifier -> MacroChild)
-> AnaParser Input Pair Token Pos MacroChild
forall (f :: * -> *) a b. Applicative f => f a -> f (a -> b) -> f b
<**>
((Identifier -> Macro -> MacroChild)
-> Macro -> Identifier -> MacroChild
forall a b c. (a -> b -> c) -> b -> a -> c
flip Identifier -> Macro -> MacroChild
RuleChild (Macro -> Identifier -> MacroChild)
-> AnaParser Input Pair Token Pos Macro
-> AnaParser Input Pair Token Pos (Identifier -> MacroChild)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos Macro
pMacro AnaParser Input Pair Token Pos (Identifier -> MacroChild)
-> AnaParser Input Pair Token Pos (Identifier -> MacroChild)
-> AnaParser Input Pair Token Pos (Identifier -> MacroChild)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|>
(Identifier -> Identifier -> MacroChild)
-> Identifier -> Identifier -> MacroChild
forall a b c. (a -> b -> c) -> b -> a -> c
flip Identifier -> Identifier -> MacroChild
ChildChild (Identifier -> Identifier -> MacroChild)
-> AGParser Identifier
-> AnaParser Input Pair Token Pos (Identifier -> MacroChild)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AGParser Identifier
pIdentifier AnaParser Input Pair Token Pos (Identifier -> MacroChild)
-> AnaParser Input Pair Token Pos (Identifier -> MacroChild)
-> AnaParser Input Pair Token Pos (Identifier -> MacroChild)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|>
(Identifier -> String -> MacroChild)
-> String -> Identifier -> MacroChild
forall a b c. (a -> b -> c) -> b -> a -> c
flip Identifier -> String -> MacroChild
ValueChild (String -> Identifier -> MacroChild)
-> AnaParser Input Pair Token Pos String
-> AnaParser Input Pair Token Pos (Identifier -> MacroChild)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos String
pCodescrap' )
pTypeNt :: AGParser Type
pTypeNt :: AnaParser Input Pair Token Pos Type
pTypeNt
= ((\Identifier
nt -> Identifier -> [String] -> Type
mkNtType Identifier
nt []) (Identifier -> Type)
-> AGParser Identifier -> AnaParser Input Pair Token Pos Type
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AGParser Identifier
pTypeCon AnaParser Input Pair Token Pos Type
-> String -> AnaParser Input Pair Token Pos Type
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"nonterminal name (no brackets)")
AnaParser Input Pair Token Pos Type
-> AnaParser Input Pair Token Pos Type
-> AnaParser Input Pair Token Pos Type
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (AnaParser Input Pair Token Pos Type
-> AnaParser Input Pair Token Pos Type
forall (p :: * -> *) a. IsParser p Token => p a -> p a
pParens (Identifier -> [String] -> Type
mkNtType (Identifier -> [String] -> Type)
-> AGParser Identifier
-> AnaParser Input Pair Token Pos ([String] -> Type)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AGParser Identifier
pTypeCon AnaParser Input Pair Token Pos ([String] -> Type)
-> AnaParser Input Pair Token Pos [String]
-> AnaParser Input Pair Token Pos Type
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos String
-> AnaParser Input Pair Token Pos [String]
forall (p :: * -> *) s a. IsParser p s => p a -> p [a]
pList AnaParser Input Pair Token Pos String
pTypeHaskellAnyAsString) AnaParser Input Pair Token Pos Type
-> String -> AnaParser Input Pair Token Pos Type
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"nonterminal name with parameters (using parenthesis)")
pTypeCon :: AGParser Identifier
pTypeCon :: AGParser Identifier
pTypeCon
| Options -> Bool
ocaml Options
opts = AGParser Identifier
pIdentifierExcl
| Bool
otherwise = AGParser Identifier
pIdentifierU
pTypeVar :: AGParser Identifier
pTypeVar :: AGParser Identifier
pTypeVar
| Options -> Bool
ocaml Options
opts = (\(String
nm, Pos
pos) -> String -> Pos -> Identifier
Ident String
nm Pos
pos) ((String, Pos) -> Identifier)
-> AnaParser Input Pair Token Pos (String, Pos)
-> AGParser Identifier
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos (String, Pos)
forall (p :: * -> *). IsParser p Token => p (String, Pos)
pTextnmPos
| Bool
otherwise = AGParser Identifier
pIdentifier
pTypeHaskellAnyAsString :: AGParser String
pTypeHaskellAnyAsString :: AnaParser Input Pair Token Pos String
pTypeHaskellAnyAsString
= Identifier -> String
getName (Identifier -> String)
-> AGParser Identifier -> AnaParser Input Pair Token Pos String
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AGParser Identifier
pTypeVar
AnaParser Input Pair Token Pos String
-> AnaParser Input Pair Token Pos String
-> AnaParser Input Pair Token Pos String
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Identifier -> String
getName (Identifier -> String)
-> AGParser Identifier -> AnaParser Input Pair Token Pos String
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AGParser Identifier
pTypeCon
AnaParser Input Pair Token Pos String
-> AnaParser Input Pair Token Pos String
-> AnaParser Input Pair Token Pos String
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> AnaParser Input Pair Token Pos String
pCodescrap' AnaParser Input Pair Token Pos String
-> String -> AnaParser Input Pair Token Pos String
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"a type"
pTypeEncapsulated :: AGParser Type
pTypeEncapsulated :: AnaParser Input Pair Token Pos Type
pTypeEncapsulated
= AnaParser Input Pair Token Pos Type
-> AnaParser Input Pair Token Pos Type
forall (p :: * -> *) a. IsParser p Token => p a -> p a
pParens AnaParser Input Pair Token Pos Type
pTypeEncapsulated
AnaParser Input Pair Token Pos Type
-> AnaParser Input Pair Token Pos Type
-> AnaParser Input Pair Token Pos Type
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Identifier -> [String] -> Type
mkNtType (Identifier -> [String] -> Type)
-> AGParser Identifier
-> AnaParser Input Pair Token Pos ([String] -> Type)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AGParser Identifier
pTypeCon AnaParser Input Pair Token Pos ([String] -> Type)
-> AnaParser Input Pair Token Pos [String]
-> AnaParser Input Pair Token Pos Type
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos String
-> AnaParser Input Pair Token Pos [String]
forall (p :: * -> *) s a. IsParser p s => p a -> p [a]
pList AnaParser Input Pair Token Pos String
pTypeHaskellAnyAsString
AnaParser Input Pair Token Pos Type
-> AnaParser Input Pair Token Pos Type
-> AnaParser Input Pair Token Pos Type
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (String -> Type
Haskell (String -> Type) -> (Identifier -> String) -> Identifier -> Type
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Identifier -> String
getName) (Identifier -> Type)
-> AGParser Identifier -> AnaParser Input Pair Token Pos Type
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AGParser Identifier
pTypeVar
AnaParser Input Pair Token Pos Type
-> AnaParser Input Pair Token Pos Type
-> AnaParser Input Pair Token Pos Type
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> AnaParser Input Pair Token Pos Type
pTypePrimitive
pTypePrimitive :: AGParser Type
pTypePrimitive :: AnaParser Input Pair Token Pos Type
pTypePrimitive
= String -> Type
Haskell (String -> Type)
-> AnaParser Input Pair Token Pos String
-> AnaParser Input Pair Token Pos Type
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos String
pCodescrap' AnaParser Input Pair Token Pos Type
-> String -> AnaParser Input Pair Token Pos Type
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"a type"
pType :: AGParser Type
pType :: AnaParser Input Pair Token Pos Type
pType = AnaParser Input Pair Token Pos Type
pTypeNt
AnaParser Input Pair Token Pos Type
-> AnaParser Input Pair Token Pos Type
-> AnaParser Input Pair Token Pos Type
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> AnaParser Input Pair Token Pos Type
pTypePrimitive
pTypeOrSelf :: AGParser Type
pTypeOrSelf :: AnaParser Input Pair Token Pos Type
pTypeOrSelf = AnaParser Input Pair Token Pos Type
pType AnaParser Input Pair Token Pos Type
-> AnaParser Input Pair Token Pos Type
-> AnaParser Input Pair Token Pos Type
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Type
Self Type
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos Type
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ AnaParser Input Pair Token Pos Pos
pSELF
pOptClassContext :: AGParser ClassContext
pOptClassContext :: AGParser ClassContext
pOptClassContext
= AGParser ClassContext
pClassContext AGParser ClassContext
-> AnaParser Input Pair Token Pos Pos -> AGParser ClassContext
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* AnaParser Input Pair Token Pos Pos
pDoubleArrow
AGParser ClassContext
-> AGParser ClassContext -> AGParser ClassContext
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> ClassContext -> AGParser ClassContext
forall (p :: * -> *) s a. IsParser p s => a -> p a
pSucceed []
pClassContext :: AGParser ClassContext
pClassContext :: AGParser ClassContext
pClassContext
= AnaParser Input Pair Token Pos String
-> AnaParser Input Pair Token Pos (Identifier, [String])
-> AGParser ClassContext
forall (p :: * -> *) s a a1. IsParser p s => p a -> p a1 -> p [a1]
pListSep AnaParser Input Pair Token Pos String
forall (p :: * -> *). IsParser p Token => p String
pComma ((,) (Identifier -> [String] -> (Identifier, [String]))
-> AGParser Identifier
-> AnaParser
Input Pair Token Pos ([String] -> (Identifier, [String]))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AGParser Identifier
pIdentifierU AnaParser Input Pair Token Pos ([String] -> (Identifier, [String]))
-> AnaParser Input Pair Token Pos [String]
-> AnaParser Input Pair Token Pos (Identifier, [String])
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos String
-> AnaParser Input Pair Token Pos [String]
forall (p :: * -> *) s a. IsParser p s => p a -> p [a]
pList AnaParser Input Pair Token Pos String
pTypeHaskellAnyAsString)
pNontSet :: AnaParser Input Pair Token Pos NontSet
pNontSet = AnaParser Input Pair Token Pos NontSet
set0 where
set0 :: AnaParser Input Pair Token Pos NontSet
set0 = AnaParser Input Pair Token Pos (NontSet -> NontSet -> NontSet)
-> AnaParser Input Pair Token Pos NontSet
-> AnaParser Input Pair Token Pos NontSet
forall (p :: * -> *) s c.
IsParser p s =>
p (c -> c -> c) -> p c -> p c
pChainr (NontSet -> NontSet -> NontSet
Intersect (NontSet -> NontSet -> NontSet)
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos (NontSet -> NontSet -> NontSet)
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ AnaParser Input Pair Token Pos Pos
pIntersect) AnaParser Input Pair Token Pos NontSet
set1
set1 :: AnaParser Input Pair Token Pos NontSet
set1 = AnaParser Input Pair Token Pos (NontSet -> NontSet -> NontSet)
-> AnaParser Input Pair Token Pos NontSet
-> AnaParser Input Pair Token Pos NontSet
forall (p :: * -> *) s c.
IsParser p s =>
p (c -> c -> c) -> p c -> p c
pChainl (NontSet -> NontSet -> NontSet
Difference (NontSet -> NontSet -> NontSet)
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos (NontSet -> NontSet -> NontSet)
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ AnaParser Input Pair Token Pos Pos
pMinus) AnaParser Input Pair Token Pos NontSet
set2
set2 :: AnaParser Input Pair Token Pos NontSet
set2 = AnaParser Input Pair Token Pos (NontSet -> NontSet -> NontSet)
-> AnaParser Input Pair Token Pos NontSet
-> AnaParser Input Pair Token Pos NontSet
forall (p :: * -> *) s c.
IsParser p s =>
p (c -> c -> c) -> p c -> p c
pChainr ((NontSet -> NontSet -> NontSet)
-> AnaParser Input Pair Token Pos (NontSet -> NontSet -> NontSet)
forall (p :: * -> *) s a. IsParser p s => a -> p a
pSucceed NontSet -> NontSet -> NontSet
Union) AnaParser Input Pair Token Pos NontSet
set3
set3 :: AnaParser Input Pair Token Pos NontSet
set3 = AGParser Identifier
pTypeCon AGParser Identifier
-> AnaParser Input Pair Token Pos (Identifier -> NontSet)
-> AnaParser Input Pair Token Pos NontSet
forall (f :: * -> *) a b. Applicative f => f a -> f (a -> b) -> f b
<**> AnaParser Input Pair Token Pos (Identifier -> NontSet)
-> (Identifier -> NontSet)
-> AnaParser Input Pair Token Pos (Identifier -> NontSet)
forall (p :: * -> *) s a. IsParser p s => p a -> a -> p a
opt ((Identifier -> Identifier -> NontSet)
-> Identifier -> Identifier -> NontSet
forall a b c. (a -> b -> c) -> b -> a -> c
flip Identifier -> Identifier -> NontSet
Path (Identifier -> Identifier -> NontSet)
-> AnaParser Input Pair Token Pos Pos
-> AnaParser
Input Pair Token Pos (Identifier -> Identifier -> NontSet)
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ AnaParser Input Pair Token Pos Pos
pArrow AnaParser
Input Pair Token Pos (Identifier -> Identifier -> NontSet)
-> AGParser Identifier
-> AnaParser Input Pair Token Pos (Identifier -> NontSet)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AGParser Identifier
pTypeCon) Identifier -> NontSet
NamedSet
AnaParser Input Pair Token Pos NontSet
-> AnaParser Input Pair Token Pos NontSet
-> AnaParser Input Pair Token Pos NontSet
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> NontSet
All NontSet
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos NontSet
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ AnaParser Input Pair Token Pos Pos
pStar
AnaParser Input Pair Token Pos NontSet
-> AnaParser Input Pair Token Pos NontSet
-> AnaParser Input Pair Token Pos NontSet
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> AnaParser Input Pair Token Pos NontSet
-> AnaParser Input Pair Token Pos NontSet
forall (p :: * -> *) a. IsParser p Token => p a -> p a
pParens AnaParser Input Pair Token Pos NontSet
set0
resolveFile :: Options -> [FilePath] -> FilePath -> IO FilePath
resolveFile :: Options -> [String] -> String -> IO String
resolveFile Options
opts [String]
path String
fname = [String] -> IO String
search ([String]
path [String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ [String
"."])
where search :: [String] -> IO String
search (String
p:[String]
ps) = do let filename :: String
filename = [String] -> String
joinPath [String
p, String
fname]
Bool
fExists <- String -> IO Bool
doesFileExist String
filename
if Bool
fExists
then String -> IO String
forall (m :: * -> *) a. Monad m => a -> m a
return String
filename
else do let filename' :: String
filename' = [String] -> String
joinPath [String
p, String -> String -> String
replaceExtension String
fname String
"ag"]
Bool
fExists' <- String -> IO Bool
doesFileExist String
filename'
if Bool
fExists'
then String -> IO String
forall (m :: * -> *) a. Monad m => a -> m a
return String
filename'
else [String] -> IO String
search [String]
ps
search [] = do
Options -> String -> IO ()
outputStr Options
opts (String
"File: " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String -> String
forall a. Show a => a -> String
show String
fname String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" not found in search path: " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String -> String
forall a. Show a => a -> String
show ([String] -> String
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat (String -> [String] -> [String]
forall a. a -> [a] -> [a]
intersperse String
";" ([String]
path [String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ [String
"."]))) String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"\n")
Options -> Int -> IO ()
failWithCode Options
opts Int
1
String -> IO String
forall (m :: * -> *) a. Monad m => a -> m a
return (String -> String
forall a. HasCallStack => String -> a
error String
"resolveFile: file not found")
evalStepsMessages :: (Eq s, Show s, Show p) => Steps a s p -> (a,[Message s p])
evalStepsMessages :: Steps a s p -> (a, [Message s p])
evalStepsMessages Steps a s p
steps = case Steps a s p
steps of
OkVal a -> a
v Steps a s p
rest -> let (a
arg,[Message s p]
ms) = Steps a s p -> (a, [Message s p])
forall s p a.
(Eq s, Show s, Show p) =>
Steps a s p -> (a, [Message s p])
evalStepsMessages Steps a s p
rest
in (a -> a
v a
arg,[Message s p]
ms)
Ok Steps a s p
rest -> Steps a s p -> (a, [Message s p])
forall s p a.
(Eq s, Show s, Show p) =>
Steps a s p -> (a, [Message s p])
evalStepsMessages Steps a s p
rest
Cost Int#
_ Steps a s p
rest -> Steps a s p -> (a, [Message s p])
forall s p a.
(Eq s, Show s, Show p) =>
Steps a s p -> (a, [Message s p])
evalStepsMessages Steps a s p
rest
StRepair Int#
_ Message s p
msg Steps a s p
rest -> let (a
v,[Message s p]
ms) = Steps a s p -> (a, [Message s p])
forall s p a.
(Eq s, Show s, Show p) =>
Steps a s p -> (a, [Message s p])
evalStepsMessages Steps a s p
rest
in (a
v, Message s p
msgMessage s p -> [Message s p] -> [Message s p]
forall a. a -> [a] -> [a]
:[Message s p]
ms)
Best Steps a s p
_ Steps a s p
rest Steps a s p
_ -> Steps a s p -> (a, [Message s p])
forall s p a.
(Eq s, Show s, Show p) =>
Steps a s p -> (a, [Message s p])
evalStepsMessages Steps a s p
rest
NoMoreSteps a
v -> (a
v,[])
loopp ::(a->Bool) -> (a->IO a) -> a -> IO a
loopp :: (a -> Bool) -> (a -> IO a) -> a -> IO a
loopp a -> Bool
pred a -> IO a
cont a
x | a -> Bool
pred a
x = a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return a
x
| Bool
otherwise = do a
x' <- a -> IO a
cont a
x
(a -> Bool) -> (a -> IO a) -> a -> IO a
forall a. (a -> Bool) -> (a -> IO a) -> a -> IO a
loopp a -> Bool
pred a -> IO a
cont a
x'
codescrapL :: Pos -> String -> (Token, Pos, String)
codescrapL Pos
p [] = (EnumValToken -> String -> Pos -> Token
valueToken EnumValToken
TkTextln String
"" Pos
p,Pos
p,[])
codescrapL Pos
p (Char
x:String
xs) | Char -> Bool
isSpace Char
x = (Char
-> Pos
-> (Pos -> String -> (Token, Pos, String))
-> String
-> (Token, Pos, String)
forall a. Char -> Pos -> (Pos -> a) -> a
updPos' Char
x Pos
p) Pos -> String -> (Token, Pos, String)
codescrapL String
xs
| Bool
otherwise = let refcol :: Int
refcol = Pos -> Int
forall p. Position p => p -> Int
column Pos
p
(Pos
p',String
sc,String
rest) = Int -> Pos -> String -> (Pos, String, String)
scrapL Int
refcol Pos
p (Char
xChar -> String -> String
forall a. a -> [a] -> [a]
:String
xs)
in (EnumValToken -> String -> Pos -> Token
valueToken EnumValToken
TkTextln String
sc Pos
p,Pos
p',String
rest)
scrapL :: Int -> Pos -> String -> (Pos, String, String)
scrapL Int
ref Pos
p (Char
x:String
xs) | Char -> Bool
isSpace Char
x Bool -> Bool -> Bool
|| Pos -> Int
forall p. Position p => p -> Int
column Pos
p Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
ref =
let (Pos
p'',String
sc,String
inp) = Char
-> Pos
-> (Pos -> String -> (Pos, String, String))
-> String
-> (Pos, String, String)
forall a. Char -> Pos -> (Pos -> a) -> a
updPos' Char
x Pos
p (Int -> Pos -> String -> (Pos, String, String)
scrapL Int
ref) String
xs
in (Pos
p'',Char
xChar -> String -> String
forall a. a -> [a] -> [a]
:String
sc,String
inp)
| Bool
otherwise =(Pos
p,[],Char
xChar -> String -> String
forall a. a -> [a] -> [a]
:String
xs)
scrapL Int
ref Pos
p [] = (Pos
p,[],[])
pNames :: AGParser [Identifier]
pNames :: AGParser [Identifier]
pNames = AGParser [Identifier]
pIdentifiers
pCodeBlock :: AGParser (String,Pos)
pCodeBlock :: AnaParser Input Pair Token Pos (String, Pos)
pCodeBlock = Int
-> EnumValToken
-> String
-> AnaParser Input Pair Token Pos (String, Pos)
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> tp -> val -> p (val, Pos)
pCostValToken Int
90 EnumValToken
TkTextln String
"" AnaParser Input Pair Token Pos (String, Pos)
-> String -> AnaParser Input Pair Token Pos (String, Pos)
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"a code block"
pOptQuantifiers :: AGParser [String]
pOptQuantifiers :: AnaParser Input Pair Token Pos [String]
pOptQuantifiers = (String -> [String]
forall (m :: * -> *) a. Monad m => a -> m a
return (String -> [String])
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos (String -> [String])
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ AnaParser Input Pair Token Pos Pos
pDoubleColon AnaParser Input Pair Token Pos (String -> [String])
-> AnaParser Input Pair Token Pos String
-> AnaParser Input Pair Token Pos [String]
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos String
pCodescrap') AnaParser Input Pair Token Pos [String]
-> [String] -> AnaParser Input Pair Token Pos [String]
forall (p :: * -> *) s a. IsParser p s => p a -> a -> p a
`opt` []
pIdentifiers :: AGParser [Identifier]
pIdentifiers :: AGParser [Identifier]
pIdentifiers = AnaParser Input Pair Token Pos String
-> AGParser Identifier -> AGParser [Identifier]
forall (p :: * -> *) s a a1. IsParser p s => p a -> p a1 -> p [a1]
pList1Sep AnaParser Input Pair Token Pos String
forall (p :: * -> *). IsParser p Token => p String
pComma AGParser Identifier
pIdentifier AGParser [Identifier] -> String -> AGParser [Identifier]
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"lowercase identifiers"
pAttrIdentifier :: AGParser Identifier
pAttrIdentifier :: AGParser Identifier
pAttrIdentifier = AGParser Identifier
pIdentifier
AGParser Identifier -> AGParser Identifier -> AGParser Identifier
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (\Pos
pos -> String -> Pos -> Identifier
Ident String
"imports" Pos
pos) (Pos -> Identifier)
-> AnaParser Input Pair Token Pos Pos -> AGParser Identifier
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos Pos
pIMPORTS
AGParser Identifier -> AGParser Identifier -> AGParser Identifier
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (\Pos
pos -> String -> Pos -> Identifier
Ident String
"toplevel" Pos
pos) (Pos -> Identifier)
-> AnaParser Input Pair Token Pos Pos -> AGParser Identifier
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos Pos
pTOPLEVEL
pAttrIdentifiers :: AGParser [Identifier]
pAttrIdentifiers :: AGParser [Identifier]
pAttrIdentifiers = AnaParser Input Pair Token Pos String
-> AGParser Identifier -> AGParser [Identifier]
forall (p :: * -> *) s a a1. IsParser p s => p a -> p a1 -> p [a1]
pList1Sep AnaParser Input Pair Token Pos String
forall (p :: * -> *). IsParser p Token => p String
pComma AGParser Identifier
pAttrIdentifier AGParser [Identifier] -> String -> AGParser [Identifier]
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"lowercase identifiers"
pUse :: AGParser (String,String,String)
pUse :: AnaParser Input Pair Token Pos (String, String, String)
pUse = ( (\Pos
u String
x String
y->(String
x,String
y,Pos -> String
forall a. Show a => a -> String
show Pos
u)) (Pos -> String -> String -> (String, String, String))
-> AnaParser Input Pair Token Pos Pos
-> AnaParser
Input Pair Token Pos (String -> String -> (String, String, String))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos Pos
pUSE AnaParser
Input Pair Token Pos (String -> String -> (String, String, String))
-> AnaParser Input Pair Token Pos String
-> AnaParser
Input Pair Token Pos (String -> (String, String, String))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos String
pCodescrap' AnaParser Input Pair Token Pos (String -> (String, String, String))
-> AnaParser Input Pair Token Pos String
-> AnaParser Input Pair Token Pos (String, String, String)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos String
pCodescrap') AnaParser Input Pair Token Pos (String, String, String)
-> (String, String, String)
-> AnaParser Input Pair Token Pos (String, String, String)
forall (p :: * -> *) s a. IsParser p s => p a -> a -> p a
`opt` (String
"",String
"",String
"") AnaParser Input Pair Token Pos (String, String, String)
-> String
-> AnaParser Input Pair Token Pos (String, String, String)
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"USE declaration"
mklower :: String -> String
mklower :: String -> String
mklower (Char
x:String
xs) = Char -> Char
toLower Char
x Char -> String -> String
forall a. a -> [a] -> [a]
: String
xs
mklower [] = []
pSimpleConstructorSet :: AGParser ConstructorSet
pSimpleConstructorSet :: AnaParser Input Pair Token Pos ConstructorSet
pSimpleConstructorSet = Identifier -> ConstructorSet
CName (Identifier -> ConstructorSet)
-> AGParser Identifier
-> AnaParser Input Pair Token Pos ConstructorSet
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AGParser Identifier
pIdentifierU
AnaParser Input Pair Token Pos ConstructorSet
-> AnaParser Input Pair Token Pos ConstructorSet
-> AnaParser Input Pair Token Pos ConstructorSet
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> ConstructorSet
CAll ConstructorSet
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos ConstructorSet
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ AnaParser Input Pair Token Pos Pos
pStar
AnaParser Input Pair Token Pos ConstructorSet
-> AnaParser Input Pair Token Pos ConstructorSet
-> AnaParser Input Pair Token Pos ConstructorSet
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> AnaParser Input Pair Token Pos ConstructorSet
-> AnaParser Input Pair Token Pos ConstructorSet
forall (p :: * -> *) a. IsParser p Token => p a -> p a
pParens AnaParser Input Pair Token Pos ConstructorSet
pConstructorSet
pConstructorSet :: AGParser ConstructorSet
pConstructorSet :: AnaParser Input Pair Token Pos ConstructorSet
pConstructorSet = AnaParser
Input
Pair
Token
Pos
(ConstructorSet -> ConstructorSet -> ConstructorSet)
-> AnaParser Input Pair Token Pos ConstructorSet
-> AnaParser Input Pair Token Pos ConstructorSet
forall (p :: * -> *) s c.
IsParser p s =>
p (c -> c -> c) -> p c -> p c
pChainl (ConstructorSet -> ConstructorSet -> ConstructorSet
CDifference (ConstructorSet -> ConstructorSet -> ConstructorSet)
-> AnaParser Input Pair Token Pos Pos
-> AnaParser
Input
Pair
Token
Pos
(ConstructorSet -> ConstructorSet -> ConstructorSet)
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ AnaParser Input Pair Token Pos Pos
pMinus) AnaParser Input Pair Token Pos ConstructorSet
term2
where term2 :: AnaParser Input Pair Token Pos ConstructorSet
term2 = AnaParser
Input
Pair
Token
Pos
(ConstructorSet -> ConstructorSet -> ConstructorSet)
-> AnaParser Input Pair Token Pos ConstructorSet
-> AnaParser Input Pair Token Pos ConstructorSet
forall (p :: * -> *) s c.
IsParser p s =>
p (c -> c -> c) -> p c -> p c
pChainr ((ConstructorSet -> ConstructorSet -> ConstructorSet)
-> AnaParser
Input
Pair
Token
Pos
(ConstructorSet -> ConstructorSet -> ConstructorSet)
forall (p :: * -> *) s a. IsParser p s => a -> p a
pSucceed ConstructorSet -> ConstructorSet -> ConstructorSet
CUnion) AnaParser Input Pair Token Pos ConstructorSet
term1
term1 :: AnaParser Input Pair Token Pos ConstructorSet
term1 = Identifier -> ConstructorSet
CName (Identifier -> ConstructorSet)
-> AGParser Identifier
-> AnaParser Input Pair Token Pos ConstructorSet
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AGParser Identifier
pIdentifierU
AnaParser Input Pair Token Pos ConstructorSet
-> AnaParser Input Pair Token Pos ConstructorSet
-> AnaParser Input Pair Token Pos ConstructorSet
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> ConstructorSet
CAll ConstructorSet
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos ConstructorSet
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ AnaParser Input Pair Token Pos Pos
pStar
pFieldIdentifier :: AGParser Identifier
pFieldIdentifier :: AGParser Identifier
pFieldIdentifier = AGParser Identifier
pIdentifier
AGParser Identifier -> AGParser Identifier -> AGParser Identifier
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Pos -> Identifier
Ident String
"lhs" (Pos -> Identifier)
-> AnaParser Input Pair Token Pos Pos -> AGParser Identifier
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos Pos
pLHS
AGParser Identifier -> AGParser Identifier -> AGParser Identifier
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Pos -> Identifier
Ident String
"loc" (Pos -> Identifier)
-> AnaParser Input Pair Token Pos Pos -> AGParser Identifier
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos Pos
pLOC
AGParser Identifier -> AGParser Identifier -> AGParser Identifier
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> Pos -> Identifier
Ident String
"inst" (Pos -> Identifier)
-> AnaParser Input Pair Token Pos Pos -> AGParser Identifier
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos Pos
pINST
pAugmentToken :: AGParser ()
pAugmentToken :: AnaParser Input Pair Token Pos ()
pAugmentToken = () ()
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos ()
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ (AnaParser Input Pair Token Pos Pos
pAUGMENT AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos Pos
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> AnaParser Input Pair Token Pos Pos
pPlus)
pAttr :: AnaParser Input Pair Token Pos (Identifier, Identifier)
pAttr = (,) (Identifier -> Identifier -> (Identifier, Identifier))
-> AGParser Identifier
-> AGParser (Identifier -> (Identifier, Identifier))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AGParser Identifier
pFieldIdentifier AGParser (Identifier -> (Identifier, Identifier))
-> AnaParser Input Pair Token Pos Pos
-> AGParser (Identifier -> (Identifier, Identifier))
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* AnaParser Input Pair Token Pos Pos
pDot AGParser (Identifier -> (Identifier, Identifier))
-> AGParser Identifier
-> AnaParser Input Pair Token Pos (Identifier, Identifier)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AGParser Identifier
pAttrIdentifier
pAttrOrIdent :: AnaParser Input Pair Token Pos Occurrence
pAttrOrIdent
= Identifier -> Identifier -> Occurrence
OccAttr (Identifier -> Identifier -> Occurrence)
-> AGParser Identifier
-> AnaParser Input Pair Token Pos (Identifier -> Occurrence)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AGParser Identifier
pFieldIdentifier AnaParser Input Pair Token Pos (Identifier -> Occurrence)
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos (Identifier -> Occurrence)
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* AnaParser Input Pair Token Pos Pos
pDot AnaParser Input Pair Token Pos (Identifier -> Occurrence)
-> AGParser Identifier -> AnaParser Input Pair Token Pos Occurrence
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AGParser Identifier
pAttrIdentifier
AnaParser Input Pair Token Pos Occurrence
-> AnaParser Input Pair Token Pos Occurrence
-> AnaParser Input Pair Token Pos Occurrence
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Identifier -> Occurrence
OccRule (Identifier -> Occurrence)
-> AGParser Identifier -> AnaParser Input Pair Token Pos Occurrence
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AGParser Identifier
pIdentifier
nl2sp :: Char -> Char
nl2sp :: Char -> Char
nl2sp Char
'\n' = Char
' '
nl2sp Char
'\r' = Char
' '
nl2sp Char
x = Char
x
pVar :: AGParser (Identifier -> (Identifier, Identifier))
pVar :: AGParser (Identifier -> (Identifier, Identifier))
pVar = (\Identifier
att Identifier
fld -> (Identifier
fld,Identifier
att)) (Identifier -> Identifier -> (Identifier, Identifier))
-> AGParser Identifier
-> AGParser (Identifier -> (Identifier, Identifier))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AGParser Identifier
pAttrIdentifier
pAssign :: AGParser Bool
pAssign :: AnaParser Input Pair Token Pos Bool
pAssign = Bool
False Bool
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos Bool
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
key -> p Pos
pReserved String
"="
AnaParser Input Pair Token Pos Bool
-> AnaParser Input Pair Token Pos Bool
-> AnaParser Input Pair Token Pos Bool
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Bool
True Bool
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos Bool
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
key -> p Pos
pReserved String
":="
pRuleSym :: AGParser (Bool, Pos, Bool, Bool)
pRuleSym :: AnaParser Input Pair Token Pos (Bool, Pos, Bool, Bool)
pRuleSym = (\Pos
p -> (Bool
False, Pos
p, Bool
True, Bool
False)) (Pos -> (Bool, Pos, Bool, Bool))
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos (Bool, Pos, Bool, Bool)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
key -> p Pos
pReserved String
"="
AnaParser Input Pair Token Pos (Bool, Pos, Bool, Bool)
-> AnaParser Input Pair Token Pos (Bool, Pos, Bool, Bool)
-> AnaParser Input Pair Token Pos (Bool, Pos, Bool, Bool)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (\Pos
p -> (Bool
True, Pos
p, Bool
True, Bool
False)) (Pos -> (Bool, Pos, Bool, Bool))
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos (Bool, Pos, Bool, Bool)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
key -> p Pos
pReserved String
":="
AnaParser Input Pair Token Pos (Bool, Pos, Bool, Bool)
-> AnaParser Input Pair Token Pos (Bool, Pos, Bool, Bool)
-> AnaParser Input Pair Token Pos (Bool, Pos, Bool, Bool)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (\Pos
p -> (Bool
False, Pos
p, Bool
True, Bool
False)) (Pos -> (Bool, Pos, Bool, Bool))
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos (Bool, Pos, Bool, Bool)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
key -> p Pos
pReserved String
"<-"
AnaParser Input Pair Token Pos (Bool, Pos, Bool, Bool)
-> AnaParser Input Pair Token Pos (Bool, Pos, Bool, Bool)
-> AnaParser Input Pair Token Pos (Bool, Pos, Bool, Bool)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (\Pos
p -> (Bool
False, Pos
p, Bool
True, Bool
True)) (Pos -> (Bool, Pos, Bool, Bool))
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos (Bool, Pos, Bool, Bool)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
key -> p Pos
pReserved String
"<<-"
pPattern :: AGParser (a -> (Identifier,Identifier)) -> AGParser (a -> Pattern)
pPattern :: AGParser (a -> (Identifier, Identifier)) -> AGParser (a -> Pattern)
pPattern AGParser (a -> (Identifier, Identifier))
pvar = AGParser (a -> Pattern)
pPattern2 where
pPattern0 :: AGParser (a -> Pattern)
pPattern0 = (\Identifier
i [a -> Pattern]
pats a
a -> Identifier -> Patterns -> Pattern
Constr Identifier
i (((a -> Pattern) -> Pattern) -> [a -> Pattern] -> Patterns
forall a b. (a -> b) -> [a] -> [b]
map ((a -> Pattern) -> a -> Pattern
forall a b. (a -> b) -> a -> b
$ a
a) [a -> Pattern]
pats))
(Identifier -> [a -> Pattern] -> a -> Pattern)
-> AGParser Identifier
-> AnaParser Input Pair Token Pos ([a -> Pattern] -> a -> Pattern)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AGParser Identifier
pIdentifierU AnaParser Input Pair Token Pos ([a -> Pattern] -> a -> Pattern)
-> AnaParser Input Pair Token Pos [a -> Pattern]
-> AGParser (a -> Pattern)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AGParser (a -> Pattern)
-> AnaParser Input Pair Token Pos [a -> Pattern]
forall (p :: * -> *) s a. IsParser p s => p a -> p [a]
pList AGParser (a -> Pattern)
pPattern1
AGParser (a -> Pattern)
-> AGParser (a -> Pattern) -> AGParser (a -> Pattern)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> AGParser (a -> Pattern)
pPattern1 AGParser (a -> Pattern) -> String -> AGParser (a -> Pattern)
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"a pattern"
pPattern1 :: AGParser (a -> Pattern)
pPattern1 = AGParser (a -> Pattern)
pvariable
AGParser (a -> Pattern)
-> AGParser (a -> Pattern) -> AGParser (a -> Pattern)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> AGParser (a -> Pattern)
pPattern2
pvariable :: AGParser (a -> Pattern)
pvariable = (\Pattern -> Pattern
ir a -> (Identifier, Identifier)
var a -> Pattern
pat a
a -> case a -> (Identifier, Identifier)
var a
a of (Identifier
fld,Identifier
att) -> Pattern -> Pattern
ir (Pattern -> Pattern) -> Pattern -> Pattern
forall a b. (a -> b) -> a -> b
$ Identifier -> Identifier -> Pattern -> Pattern
Alias Identifier
fld Identifier
att (a -> Pattern
pat a
a))
((Pattern -> Pattern)
-> (a -> (Identifier, Identifier))
-> (a -> Pattern)
-> a
-> Pattern)
-> AnaParser Input Pair Token Pos (Pattern -> Pattern)
-> AnaParser
Input
Pair
Token
Pos
((a -> (Identifier, Identifier)) -> (a -> Pattern) -> a -> Pattern)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ((Pattern -> Pattern
Irrefutable (Pattern -> Pattern)
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos (Pattern -> Pattern)
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ AnaParser Input Pair Token Pos Pos
pTilde) AnaParser Input Pair Token Pos (Pattern -> Pattern)
-> (Pattern -> Pattern)
-> AnaParser Input Pair Token Pos (Pattern -> Pattern)
forall (p :: * -> *) s a. IsParser p s => p a -> a -> p a
`opt` Pattern -> Pattern
forall a. a -> a
id) AnaParser
Input
Pair
Token
Pos
((a -> (Identifier, Identifier)) -> (a -> Pattern) -> a -> Pattern)
-> AGParser (a -> (Identifier, Identifier))
-> AnaParser Input Pair Token Pos ((a -> Pattern) -> a -> Pattern)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AGParser (a -> (Identifier, Identifier))
pvar AnaParser Input Pair Token Pos ((a -> Pattern) -> a -> Pattern)
-> AGParser (a -> Pattern) -> AGParser (a -> Pattern)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ((AnaParser Input Pair Token Pos Pos
pAt AnaParser Input Pair Token Pos Pos
-> AGParser (a -> Pattern) -> AGParser (a -> Pattern)
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> AGParser (a -> Pattern)
pPattern1) AGParser (a -> Pattern)
-> (a -> Pattern) -> AGParser (a -> Pattern)
forall (p :: * -> *) s a. IsParser p s => p a -> a -> p a
`opt` Pattern -> a -> Pattern
forall a b. a -> b -> a
const (Pos -> Pattern
Underscore Pos
noPos))
pPattern2 :: AGParser (a -> Pattern)
pPattern2 = (Pos -> [a -> Pattern] -> a -> Pattern
forall a. Pos -> [a -> Pattern] -> a -> Pattern
mkTuple (Pos -> [a -> Pattern] -> a -> Pattern)
-> AnaParser Input Pair Token Pos Pos
-> AnaParser Input Pair Token Pos ([a -> Pattern] -> a -> Pattern)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *). IsParser p Token => p Pos
pOParenPos AnaParser Input Pair Token Pos ([a -> Pattern] -> a -> Pattern)
-> AnaParser Input Pair Token Pos [a -> Pattern]
-> AGParser (a -> Pattern)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AnaParser Input Pair Token Pos String
-> AGParser (a -> Pattern)
-> AnaParser Input Pair Token Pos [a -> Pattern]
forall (p :: * -> *) s a a1. IsParser p s => p a -> p a1 -> p [a1]
pListSep AnaParser Input Pair Token Pos String
forall (p :: * -> *). IsParser p Token => p String
pComma AGParser (a -> Pattern)
pPattern0 AGParser (a -> Pattern)
-> AnaParser Input Pair Token Pos String -> AGParser (a -> Pattern)
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* AnaParser Input Pair Token Pos String
forall (p :: * -> *). IsParser p Token => p String
pCParen )
AGParser (a -> Pattern)
-> AGParser (a -> Pattern) -> AGParser (a -> Pattern)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (Pattern -> a -> Pattern
forall a b. a -> b -> a
const (Pattern -> a -> Pattern)
-> (Pos -> Pattern) -> Pos -> a -> Pattern
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Pos -> Pattern
Underscore) (Pos -> a -> Pattern)
-> AnaParser Input Pair Token Pos Pos -> AGParser (a -> Pattern)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos Pos
pUScore AGParser (a -> Pattern) -> String -> AGParser (a -> Pattern)
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"a pattern"
where mkTuple :: Pos -> [a -> Pattern] -> a -> Pattern
mkTuple Pos
_ [a -> Pattern
x] a
a = a -> Pattern
x a
a
mkTuple Pos
p [a -> Pattern]
xs a
a = Pos -> Patterns -> Pattern
Product Pos
p (((a -> Pattern) -> Pattern) -> [a -> Pattern] -> Patterns
forall a b. (a -> b) -> [a] -> [b]
map ((a -> Pattern) -> a -> Pattern
forall a b. (a -> b) -> a -> b
$ a
a) [a -> Pattern]
xs)
pCostSym' :: Int# -> s -> p s
pCostSym' Int#
c s
t = Int# -> s -> s -> p s
forall (p :: * -> *) s. IsParser p s => Int# -> s -> s -> p s
pCostSym Int#
c s
t s
t
pCodescrap' :: AGParser String
pCodescrap' :: AnaParser Input Pair Token Pos String
pCodescrap' = (String, Pos) -> String
forall a b. (a, b) -> a
fst ((String, Pos) -> String)
-> AnaParser Input Pair Token Pos (String, Pos)
-> AnaParser Input Pair Token Pos String
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AnaParser Input Pair Token Pos (String, Pos)
pCodescrap
pCodescrap :: AGParser (String,Pos)
pCodescrap :: AnaParser Input Pair Token Pos (String, Pos)
pCodescrap = AnaParser Input Pair Token Pos (String, Pos)
pCodeBlock
pSEM, pATTR, pDATA, pRECORD, pUSE, pLOC,pINCLUDE, pTYPE, pEquals, pColonEquals, pTilde,
pEXTENDS,
pBar, pColon, pLHS,pINST,pSET,pDERIVING,pMinus,pIntersect,pDoubleArrow,pArrow,
pDot, pUScore, pEXT,pAt,pStar, pSmaller, pWRAPPER, pNOCATAS, pPRAGMA, pMAYBE, pEITHER, pMAP, pINTMAP,
pMODULE, pATTACH, pUNIQUEREF, pINH, pSYN, pAUGMENT, pPlus, pAROUND, pSEMPRAGMA, pMERGE, pAS, pSELF,
pIMPORTS, pOPTPRAGMAS, pSmallerEqual, pINTSET, pDATABLOCK, pRECBLOCK
:: AGParser Pos
pSET :: AnaParser Input Pair Token Pos Pos
pSET = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
90 String
"SET" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"SET"
pDERIVING :: AnaParser Input Pair Token Pos Pos
pDERIVING = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
90 String
"DERIVING"AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"DERIVING"
pWRAPPER :: AnaParser Input Pair Token Pos Pos
pWRAPPER = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
90 String
"WRAPPER" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"WRAPPER"
pNOCATAS :: AnaParser Input Pair Token Pos Pos
pNOCATAS = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
90 String
"NOCATAS" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"NOCATAS"
pPRAGMA :: AnaParser Input Pair Token Pos Pos
pPRAGMA = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
90 String
"PRAGMA" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"PRAGMA"
pSEMPRAGMA :: AnaParser Input Pair Token Pos Pos
pSEMPRAGMA = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
90 String
"SEMPRAGMA" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"SEMPRAGMA"
pATTACH :: AnaParser Input Pair Token Pos Pos
pATTACH = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
90 String
"ATTACH" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"ATTACH"
pDATA :: AnaParser Input Pair Token Pos Pos
pDATA = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
90 String
"DATA" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"DATA"
pRECORD :: AnaParser Input Pair Token Pos Pos
pRECORD = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
90 String
"RECORD" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"RECORD"
pEXT :: AnaParser Input Pair Token Pos Pos
pEXT = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
90 String
"EXT" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"EXT"
pATTR :: AnaParser Input Pair Token Pos Pos
pATTR = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
90 String
"ATTR" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"ATTR"
pSEM :: AnaParser Input Pair Token Pos Pos
pSEM = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
90 String
"SEM" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"SEM"
pINCLUDE :: AnaParser Input Pair Token Pos Pos
pINCLUDE = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
90 String
"INCLUDE" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"INCLUDE"
pEXTENDS :: AnaParser Input Pair Token Pos Pos
pEXTENDS = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
90 String
"EXTENDS" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"EXTENDS"
pTYPE :: AnaParser Input Pair Token Pos Pos
pTYPE = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
90 String
"TYPE" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"TYPE"
pINH :: AnaParser Input Pair Token Pos Pos
pINH = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
90 String
"INH" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"INH"
pSYN :: AnaParser Input Pair Token Pos Pos
pSYN = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
90 String
"SYN" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"SYN"
pCHN :: AnaParser Input Pair Token Pos Pos
pCHN = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
90 String
"CHN" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"CHN"
pMAYBE :: AnaParser Input Pair Token Pos Pos
pMAYBE = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
5 String
"MAYBE" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"MAYBE"
pEITHER :: AnaParser Input Pair Token Pos Pos
pEITHER = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
5 String
"EITHER" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"EITHER"
pMAP :: AnaParser Input Pair Token Pos Pos
pMAP = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
5 String
"MAP" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"MAP"
pINTMAP :: AnaParser Input Pair Token Pos Pos
pINTMAP = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
5 String
"INTMAP" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"INTMAP"
pINTSET :: AnaParser Input Pair Token Pos Pos
pINTSET = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
5 String
"INTSET" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"INTSET"
pUSE :: AnaParser Input Pair Token Pos Pos
pUSE = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
5 String
"USE" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"USE"
pLOC :: AnaParser Input Pair Token Pos Pos
pLOC = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
5 String
"loc" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"loc"
pLHS :: AnaParser Input Pair Token Pos Pos
pLHS = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
5 String
"lhs" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"loc"
pINST :: AnaParser Input Pair Token Pos Pos
pINST = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
5 String
"inst" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"inst"
pAt :: AnaParser Input Pair Token Pos Pos
pAt = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
5 String
"@" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"@"
pDot :: AnaParser Input Pair Token Pos Pos
pDot = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
5 String
"." AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"."
pUScore :: AnaParser Input Pair Token Pos Pos
pUScore = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
5 String
"_" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"_"
pColon :: AnaParser Input Pair Token Pos Pos
pColon = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
5 String
":" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
":"
pDoubleColon :: AnaParser Input Pair Token Pos Pos
pDoubleColon = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
5 String
"::" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"::"
pEquals :: AnaParser Input Pair Token Pos Pos
pEquals = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
5 String
"=" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"="
pColonEquals :: AnaParser Input Pair Token Pos Pos
pColonEquals = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
5 String
":=" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
":="
pTilde :: AnaParser Input Pair Token Pos Pos
pTilde = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
5 String
"~" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"~"
pPlus :: AnaParser Input Pair Token Pos Pos
pPlus = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
5 String
"+" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"+"
pBar :: AnaParser Input Pair Token Pos Pos
pBar = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
5 String
"|" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"|"
pIntersect :: AnaParser Input Pair Token Pos Pos
pIntersect = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
5 String
"/\\" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"/\\"
pMinus :: AnaParser Input Pair Token Pos Pos
pMinus = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
5 String
"-" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"-"
pDoubleArrow :: AnaParser Input Pair Token Pos Pos
pDoubleArrow = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
5 String
"=>" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"=>"
pSmallerEqual :: AnaParser Input Pair Token Pos Pos
pSmallerEqual= Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
5 String
"<=" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"<="
pArrow :: AnaParser Input Pair Token Pos Pos
pArrow = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
5 String
"->" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"->"
pStar :: AnaParser Input Pair Token Pos Pos
pStar = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
5 String
"*" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"*"
pSmaller :: AnaParser Input Pair Token Pos Pos
pSmaller = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
5 String
"<" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"<"
pMODULE :: AnaParser Input Pair Token Pos Pos
pMODULE = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
5 String
"MODULE" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"MODULE"
pUNIQUEREF :: AnaParser Input Pair Token Pos Pos
pUNIQUEREF = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
5 String
"UNIQUEREF" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"UNIQUEREF"
pAUGMENT :: AnaParser Input Pair Token Pos Pos
pAUGMENT = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
5 String
"AUGMENT" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"AUGMENT"
pAROUND :: AnaParser Input Pair Token Pos Pos
pAROUND = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
5 String
"AROUND" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"AROUND"
pMERGE :: AnaParser Input Pair Token Pos Pos
pMERGE = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
5 String
"MERGE" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"MERGE"
pAS :: AnaParser Input Pair Token Pos Pos
pAS = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
5 String
"AS" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"AS"
pSELF :: AnaParser Input Pair Token Pos Pos
pSELF = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
5 String
"SELF" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"SELF"
pIMPORTS :: AnaParser Input Pair Token Pos Pos
pIMPORTS = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
5 String
"imports" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"imports"
pOPTPRAGMAS :: AnaParser Input Pair Token Pos Pos
pOPTPRAGMAS = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
5 String
"optpragmas" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"optpragmas"
pTOPLEVEL :: AnaParser Input Pair Token Pos Pos
pTOPLEVEL = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
5 String
"toplevel" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"toplevel"
pDATABLOCK :: AnaParser Input Pair Token Pos Pos
pDATABLOCK = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
5 String
"datablock" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"datadecl block"
pRECBLOCK :: AnaParser Input Pair Token Pos Pos
pRECBLOCK = Int -> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) key tp val.
IsParser p (GenToken key tp val) =>
Int -> key -> p Pos
pCostReserved Int
5 String
"recblock" AnaParser Input Pair Token Pos Pos
-> String -> AnaParser Input Pair Token Pos Pos
forall (p :: * -> *) s v. IsParser p s => p v -> String -> p v
<?> String
"recursive block"