module RelationalScheme.ParseRS
(
parseRSScheme
, testParse
, longTest
)
where
import Common.AS_Annotation
import Common.AnnoState
import Common.Id
import Common.Lexer
import Common.Parsec
import Common.GlobalAnnotations (PrefixMap)
import Control.Monad
import qualified Control.Monad.Fail as Fail
import RelationalScheme.AS
import RelationalScheme.Keywords
import RelationalScheme.Sign
import Text.ParserCombinators.Parsec
import Text.ParserCombinators.Parsec.Error
import qualified Data.Set as Set
import qualified Data.Map as Map
rsVarId :: [String] -> AParser st Token
rsVarId :: [String] -> AParser st Token
rsVarId ks :: [String]
ks =
do
Token
tk <- CharParser (AnnoState st) String -> AParser st Token
forall st. CharParser st String -> CharParser st Token
pToken (CharParser (AnnoState st) String -> AParser st Token)
-> CharParser (AnnoState st) String -> AParser st Token
forall a b. (a -> b) -> a -> b
$ [String]
-> CharParser (AnnoState st) String
-> CharParser (AnnoState st) String
forall st. [String] -> CharParser st String -> CharParser st String
reserved ([String]
ks [String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ [String]
rsKeyWords) CharParser (AnnoState st) String
forall st. CharParser st String
scanAnyWords
AParser st ()
forall st. AParser st ()
addAnnos
Token -> AParser st Token
forall (m :: * -> *) a. Monad m => a -> m a
return Token
tk
parseRSScheme :: PrefixMap -> AParser st RSScheme
_ =
do
ParsecT String (AnnoState st) Identity ()
forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m ()
spaces
Pos
pos1 <- GenParser Char (AnnoState st) Pos
forall tok st. GenParser tok st Pos
getPos
RSTables
tb <- AParser st RSTables
forall st. AParser st RSTables
parseRSTables
RSRelationships
rl <- AParser st RSRelationships
forall st. AParser st RSRelationships
parseRSRelationships
Pos
pos2 <- GenParser Char (AnnoState st) Pos
forall tok st. GenParser tok st Pos
getPos
RSScheme -> AParser st RSScheme
forall (m :: * -> *) a. Monad m => a -> m a
return (RSScheme -> AParser st RSScheme)
-> RSScheme -> AParser st RSScheme
forall a b. (a -> b) -> a -> b
$ RSTables -> RSRelationships -> Range -> RSScheme
RSScheme RSTables
tb RSRelationships
rl (Range -> RSScheme) -> Range -> RSScheme
forall a b. (a -> b) -> a -> b
$ [Pos] -> Range
Range [Pos
pos1, Pos
pos2]
parseRSRelationships :: AParser st RSRelationships
parseRSRelationships :: AParser st RSRelationships
parseRSRelationships =
do
Token
k <- GenParser Char (AnnoState st) Token
-> GenParser Char (AnnoState st) Token
forall tok st a. GenParser tok st a -> GenParser tok st a
try (GenParser Char (AnnoState st) Token
-> GenParser Char (AnnoState st) Token)
-> GenParser Char (AnnoState st) Token
-> GenParser Char (AnnoState st) Token
forall a b. (a -> b) -> a -> b
$ String -> GenParser Char (AnnoState st) Token
forall st. String -> AParser st Token
asKey String
rsRelationships
[Annoted RSRel]
r <- ParsecT String (AnnoState st) Identity (Annoted RSRel)
-> ParsecT String (AnnoState st) Identity [Annoted RSRel]
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m [a]
many ParsecT String (AnnoState st) Identity (Annoted RSRel)
forall st. AParser st (Annoted RSRel)
parseRSRel
RSRelationships -> AParser st RSRelationships
forall (m :: * -> *) a. Monad m => a -> m a
return (RSRelationships -> AParser st RSRelationships)
-> RSRelationships -> AParser st RSRelationships
forall a b. (a -> b) -> a -> b
$ [Annoted RSRel] -> Range -> RSRelationships
RSRelationships [Annoted RSRel]
r (Range -> RSRelationships) -> Range -> RSRelationships
forall a b. (a -> b) -> a -> b
$ [Token] -> Range
catRange [Token
k]
AParser st RSRelationships
-> AParser st RSRelationships -> AParser st RSRelationships
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|>
RSRelationships -> AParser st RSRelationships
forall (m :: * -> *) a. Monad m => a -> m a
return ([Annoted RSRel] -> Range -> RSRelationships
RSRelationships [] Range
nullRange)
parseRSRel :: AParser st (Annoted RSRel)
parseRSRel :: AParser st (Annoted RSRel)
parseRSRel =
do
[Annotation]
la <- AParser st [Annotation]
forall st. AParser st [Annotation]
getAnnos
[RSQualId]
l <- AParser st [RSQualId]
forall st. AParser st [RSQualId]
parseRSQualId
Token
k <- String -> AParser st Token
forall st. String -> AParser st Token
asKey String
rsArrow
[RSQualId]
r <- AParser st [RSQualId]
forall st. AParser st [RSQualId]
parseRSQualId
RSRelType
c <- AParser st RSRelType
forall st. AParser st RSRelType
parseRSRelTypes
[Annotation]
ra <- AParser st [Annotation]
forall st. AParser st [Annotation]
getAnnos
Annoted RSRel -> AParser st (Annoted RSRel)
forall (m :: * -> *) a. Monad m => a -> m a
return (Annoted RSRel -> AParser st (Annoted RSRel))
-> Annoted RSRel -> AParser st (Annoted RSRel)
forall a b. (a -> b) -> a -> b
$ [Annotation] -> [Annotation] -> RSRel -> Annoted RSRel
forall a. [Annotation] -> [Annotation] -> a -> Annoted a
makeAnnoted [Annotation]
la [Annotation]
ra ([RSQualId] -> [RSQualId] -> RSRelType -> Range -> RSRel
RSRel [RSQualId]
l [RSQualId]
r RSRelType
c (Range -> RSRel) -> Range -> RSRel
forall a b. (a -> b) -> a -> b
$ Token -> Range
tokPos Token
k)
parseRSQualId :: AParser st [RSQualId]
parseRSQualId :: AParser st [RSQualId]
parseRSQualId =
do
Token
tn <- [String] -> AParser st Token
forall st. [String] -> AParser st Token
rsVarId []
AParser st Token
forall st. CharParser st Token
oBracketT
[Token]
cn <- AParser st Token
-> AParser st Token
-> ParsecT String (AnnoState st) Identity [Token]
forall s (m :: * -> *) t u a sep.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m sep -> ParsecT s u m [a]
sepBy1 ([String] -> AParser st Token
forall st. [String] -> AParser st Token
rsVarId []) AParser st Token
forall st. CharParser st Token
commaT
AParser st Token
forall st. CharParser st Token
cBracketT
let out :: [RSQualId]
out = (Token -> RSQualId) -> [Token] -> [RSQualId]
forall a b. (a -> b) -> [a] -> [b]
map
(\ x :: Token
x -> Id -> Id -> Range -> RSQualId
RSQualId (Token -> Id
simpleIdToId Token
tn) (Token -> Id
simpleIdToId Token
x) (Range -> RSQualId) -> Range -> RSQualId
forall a b. (a -> b) -> a -> b
$ Token -> Range
tokPos Token
x)
[Token]
cn
[RSQualId] -> AParser st [RSQualId]
forall (m :: * -> *) a. Monad m => a -> m a
return [RSQualId]
out
parseRSTables :: AParser st RSTables
parseRSTables :: AParser st RSTables
parseRSTables =
do
GenParser Char (AnnoState st) Token
-> GenParser Char (AnnoState st) Token
forall tok st a. GenParser tok st a -> GenParser tok st a
try (GenParser Char (AnnoState st) Token
-> GenParser Char (AnnoState st) Token)
-> GenParser Char (AnnoState st) Token
-> GenParser Char (AnnoState st) Token
forall a b. (a -> b) -> a -> b
$ String -> GenParser Char (AnnoState st) Token
forall st. String -> AParser st Token
asKey String
rsTables
[RSTable]
t <- ParsecT String (AnnoState st) Identity RSTable
-> ParsecT String (AnnoState st) Identity [RSTable]
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m [a]
many ParsecT String (AnnoState st) Identity RSTable
forall st. AParser st RSTable
parseRSTable
Set RSTable
ot <- [RSTable] -> ParsecT String (AnnoState st) Identity (Set RSTable)
forall (m :: * -> *). MonadFail m => [RSTable] -> m (Set RSTable)
setConv [RSTable]
t
RSTables -> AParser st RSTables
forall (m :: * -> *) a. Monad m => a -> m a
return RSTables :: Set RSTable -> RSTables
RSTables
{
tables :: Set RSTable
tables = Set RSTable
ot
}
AParser st RSTables -> AParser st RSTables -> AParser st RSTables
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|>
RSTables -> AParser st RSTables
forall (m :: * -> *) a. Monad m => a -> m a
return RSTables :: Set RSTable -> RSTables
RSTables
{
tables :: Set RSTable
tables = Set RSTable
forall a. Set a
Set.empty
}
setCol :: (Fail.MonadFail m) => [RSColumn] -> m (Set.Set RSColumn)
setCol :: [RSColumn] -> m (Set RSColumn)
setCol t :: [RSColumn]
t =
let
names :: [Id]
names = (RSColumn -> Id) -> [RSColumn] -> [Id]
forall a b. (a -> b) -> [a] -> [b]
map RSColumn -> Id
c_name [RSColumn]
t
in
do
(Set Id -> Id -> m (Set Id)) -> Set Id -> [Id] -> m ()
forall (t :: * -> *) (m :: * -> *) b a.
(Foldable t, Monad m) =>
(b -> a -> m b) -> b -> t a -> m ()
foldM_ ((Id -> Set Id -> m (Set Id)) -> Set Id -> Id -> m (Set Id)
forall a b c. (a -> b -> c) -> b -> a -> c
flip Id -> Set Id -> m (Set Id)
forall (m :: * -> *). MonadFail m => Id -> Set Id -> m (Set Id)
insertUnique) Set Id
forall a. Set a
Set.empty [Id]
names
Set RSColumn -> m (Set RSColumn)
forall (m :: * -> *) a. Monad m => a -> m a
return (Set RSColumn -> m (Set RSColumn))
-> Set RSColumn -> m (Set RSColumn)
forall a b. (a -> b) -> a -> b
$ (Set RSColumn -> RSColumn -> Set RSColumn)
-> Set RSColumn -> [RSColumn] -> Set RSColumn
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl ((RSColumn -> Set RSColumn -> Set RSColumn)
-> Set RSColumn -> RSColumn -> Set RSColumn
forall a b c. (a -> b -> c) -> b -> a -> c
flip RSColumn -> Set RSColumn -> Set RSColumn
forall a. Ord a => a -> Set a -> Set a
Set.insert) Set RSColumn
forall a. Set a
Set.empty [RSColumn]
t
setConv :: (Fail.MonadFail m) => [RSTable] -> m (Set.Set RSTable)
setConv :: [RSTable] -> m (Set RSTable)
setConv t :: [RSTable]
t =
let
names :: [Id]
names = (RSTable -> Id) -> [RSTable] -> [Id]
forall a b. (a -> b) -> [a] -> [b]
map RSTable -> Id
t_name [RSTable]
t
in
do
(Set Id -> Id -> m (Set Id)) -> Set Id -> [Id] -> m ()
forall (t :: * -> *) (m :: * -> *) b a.
(Foldable t, Monad m) =>
(b -> a -> m b) -> b -> t a -> m ()
foldM_ ((Id -> Set Id -> m (Set Id)) -> Set Id -> Id -> m (Set Id)
forall a b c. (a -> b -> c) -> b -> a -> c
flip Id -> Set Id -> m (Set Id)
forall (m :: * -> *). MonadFail m => Id -> Set Id -> m (Set Id)
insertUnique) Set Id
forall a. Set a
Set.empty [Id]
names
Set RSTable -> m (Set RSTable)
forall (m :: * -> *) a. Monad m => a -> m a
return (Set RSTable -> m (Set RSTable)) -> Set RSTable -> m (Set RSTable)
forall a b. (a -> b) -> a -> b
$ (Set RSTable -> RSTable -> Set RSTable)
-> Set RSTable -> [RSTable] -> Set RSTable
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl ((RSTable -> Set RSTable -> Set RSTable)
-> Set RSTable -> RSTable -> Set RSTable
forall a b c. (a -> b -> c) -> b -> a -> c
flip RSTable -> Set RSTable -> Set RSTable
forall a. Ord a => a -> Set a -> Set a
Set.insert) Set RSTable
forall a. Set a
Set.empty [RSTable]
t
insertUnique :: (Fail.MonadFail m) => Id -> Set.Set Id -> m (Set.Set Id)
insertUnique :: Id -> Set Id -> m (Set Id)
insertUnique t :: Id
t s :: Set Id
s =
if Id
t Id -> Set Id -> Bool
forall a. Ord a => a -> Set a -> Bool
`Set.notMember` Set Id
s then Set Id -> m (Set Id)
forall (m :: * -> *) a. Monad m => a -> m a
return (Set Id -> m (Set Id)) -> Set Id -> m (Set Id)
forall a b. (a -> b) -> a -> b
$ Id -> Set Id -> Set Id
forall a. Ord a => a -> Set a -> Set a
Set.insert Id
t Set Id
s
else String -> m (Set Id)
forall (m :: * -> *) a. MonadFail m => String -> m a
Fail.fail (String -> m (Set Id)) -> String -> m (Set Id)
forall a b. (a -> b) -> a -> b
$ "Duplicate definition of " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Id -> String
forall a. Show a => a -> String
show Id
t
parseRSTable :: AParser st RSTable
parseRSTable :: AParser st RSTable
parseRSTable =
do
[Annotation]
la <- AParser st [Annotation]
forall st. AParser st [Annotation]
getAnnos
Token
tid <- [String] -> AParser st Token
forall st. [String] -> AParser st Token
rsVarId []
AParser st Token
forall st. CharParser st Token
oParenT
[[RSColumn]]
cl <- ParsecT String (AnnoState st) Identity [RSColumn]
-> AParser st Token
-> ParsecT String (AnnoState st) Identity [[RSColumn]]
forall s (m :: * -> *) t u a sep.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m sep -> ParsecT s u m [a]
sepBy1 ParsecT String (AnnoState st) Identity [RSColumn]
forall st. AParser st [RSColumn]
parseRSColumn AParser st Token
forall st. CharParser st Token
commaT
let ccl :: [RSColumn]
ccl = [[RSColumn]] -> [RSColumn]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat [[RSColumn]]
cl
[RSColumn] -> ParsecT String (AnnoState st) Identity (Set RSColumn)
forall (m :: * -> *). MonadFail m => [RSColumn] -> m (Set RSColumn)
setCol [RSColumn]
ccl
AParser st Token
forall st. CharParser st Token
cParenT
[Annotation]
ra <- AParser st [Annotation]
forall st. AParser st [Annotation]
getAnnos
RSTable -> AParser st RSTable
forall (m :: * -> *) a. Monad m => a -> m a
return RSTable :: Id -> [RSColumn] -> [Annotation] -> Set (Id, RSDatatype) -> RSTable
RSTable
{
t_name :: Id
t_name = Token -> Id
simpleIdToId Token
tid
, columns :: [RSColumn]
columns = [RSColumn]
ccl
, rsannos :: [Annotation]
rsannos = [Annotation]
la [Annotation] -> [Annotation] -> [Annotation]
forall a. [a] -> [a] -> [a]
++ [Annotation]
ra
, t_keys :: Set (Id, RSDatatype)
t_keys = [(Id, RSDatatype)] -> Set (Id, RSDatatype)
forall a. Ord a => [a] -> Set a
Set.fromList
([(Id, RSDatatype)] -> Set (Id, RSDatatype))
-> [(Id, RSDatatype)] -> Set (Id, RSDatatype)
forall a b. (a -> b) -> a -> b
$ (RSColumn -> (Id, RSDatatype)) -> [RSColumn] -> [(Id, RSDatatype)]
forall a b. (a -> b) -> [a] -> [b]
map (\ x :: RSColumn
x -> (RSColumn -> Id
c_name RSColumn
x, RSColumn -> RSDatatype
c_data RSColumn
x))
([RSColumn] -> [(Id, RSDatatype)])
-> [RSColumn] -> [(Id, RSDatatype)]
forall a b. (a -> b) -> a -> b
$ (RSColumn -> Bool) -> [RSColumn] -> [RSColumn]
forall a. (a -> Bool) -> [a] -> [a]
filter RSColumn -> Bool
c_key [RSColumn]
ccl
}
parseEntry :: AParser st (Token, Bool)
parseEntry :: AParser st (Token, Bool)
parseEntry =
do
Bool
iK <- AParser st Bool
forall st. AParser st Bool
look4Key
Token
iid <- [String] -> AParser st Token
forall st. [String] -> AParser st Token
rsVarId []
(Token, Bool) -> AParser st (Token, Bool)
forall (m :: * -> *) a. Monad m => a -> m a
return (Token
iid, Bool
iK)
parseRSColumn :: AParser st [RSColumn]
parseRSColumn :: AParser st [RSColumn]
parseRSColumn =
do
[(Token, Bool)]
iid <- ParsecT String (AnnoState st) Identity (Token, Bool)
-> ParsecT String (AnnoState st) Identity Token
-> ParsecT String (AnnoState st) Identity [(Token, Bool)]
forall s (m :: * -> *) t u a sep.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m sep -> ParsecT s u m [a]
sepBy1 ParsecT String (AnnoState st) Identity (Token, Bool)
forall st. AParser st (Token, Bool)
parseEntry ParsecT String (AnnoState st) Identity Token
forall st. CharParser st Token
commaT
ParsecT String (AnnoState st) Identity Token
forall st. AParser st Token
colonT
RSDatatype
dt <- AParser st RSDatatype
forall st. AParser st RSDatatype
parseRSDatatypes
[RSColumn] -> AParser st [RSColumn]
forall (m :: * -> *) a. Monad m => a -> m a
return ([RSColumn] -> AParser st [RSColumn])
-> [RSColumn] -> AParser st [RSColumn]
forall a b. (a -> b) -> a -> b
$ ((Token, Bool) -> RSColumn) -> [(Token, Bool)] -> [RSColumn]
forall a b. (a -> b) -> [a] -> [b]
map (\ (x :: Token
x, y :: Bool
y) -> Id -> RSDatatype -> Bool -> RSColumn
RSColumn (Token -> Id
simpleIdToId Token
x) RSDatatype
dt Bool
y) [(Token, Bool)]
iid
look4Key :: AParser st Bool
look4Key :: AParser st Bool
look4Key =
do
String -> AParser st Token
forall st. String -> AParser st Token
asKey String
rsKey
Bool -> AParser st Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
True
AParser st Bool -> AParser st Bool -> AParser st Bool
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|>
Bool -> AParser st Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
False
testParse :: GenParser tok (AnnoState ()) a
-> [tok]
-> Either Text.ParserCombinators.Parsec.Error.ParseError a
testParse :: GenParser tok (AnnoState ()) a -> [tok] -> Either ParseError a
testParse par :: GenParser tok (AnnoState ()) a
par = GenParser tok (AnnoState ()) a
-> AnnoState () -> String -> [tok] -> Either ParseError a
forall tok st a.
GenParser tok st a -> st -> String -> [tok] -> Either ParseError a
runParser GenParser tok (AnnoState ()) a
par (() -> AnnoState ()
forall st. st -> AnnoState st
emptyAnnos ()) ""
longTest :: IO (Either ParseError RSScheme)
longTest :: IO (Either ParseError RSScheme)
longTest = do
String
x <- String -> IO String
readFile "RelationalScheme/test/rel.dol"
Either ParseError RSScheme -> IO (Either ParseError RSScheme)
forall (m :: * -> *) a. Monad m => a -> m a
return (Either ParseError RSScheme -> IO (Either ParseError RSScheme))
-> Either ParseError RSScheme -> IO (Either ParseError RSScheme)
forall a b. (a -> b) -> a -> b
$ GenParser Char (AnnoState ()) RSScheme
-> String -> Either ParseError RSScheme
forall tok a.
GenParser tok (AnnoState ()) a -> [tok] -> Either ParseError a
testParse (PrefixMap -> GenParser Char (AnnoState ()) RSScheme
forall st. PrefixMap -> AParser st RSScheme
parseRSScheme PrefixMap
forall k a. Map k a
Map.empty) String
x
parseRSRelTypes :: AParser st RSRelType
parseRSRelTypes :: AParser st RSRelType
parseRSRelTypes =
do
String -> AParser st Token
forall st. String -> AParser st Token
asKey String
rs1to1
RSRelType -> AParser st RSRelType
forall (m :: * -> *) a. Monad m => a -> m a
return RSRelType
RSone_to_one
AParser st RSRelType
-> AParser st RSRelType -> AParser st RSRelType
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|>
do
String -> AParser st Token
forall st. String -> AParser st Token
asKey String
rs1tom
RSRelType -> AParser st RSRelType
forall (m :: * -> *) a. Monad m => a -> m a
return RSRelType
RSone_to_many
AParser st RSRelType
-> AParser st RSRelType -> AParser st RSRelType
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|>
do
String -> AParser st Token
forall st. String -> AParser st Token
asKey String
rsmto1
RSRelType -> AParser st RSRelType
forall (m :: * -> *) a. Monad m => a -> m a
return RSRelType
RSmany_to_one
AParser st RSRelType
-> AParser st RSRelType -> AParser st RSRelType
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|>
do
String -> AParser st Token
forall st. String -> AParser st Token
asKey String
rsmtom
RSRelType -> AParser st RSRelType
forall (m :: * -> *) a. Monad m => a -> m a
return RSRelType
RSmany_to_many
parseRSDatatypes :: AParser st RSDatatype
parseRSDatatypes :: AParser st RSDatatype
parseRSDatatypes =
do
String -> AParser st Token
forall st. String -> AParser st Token
asKey String
rsBool
RSDatatype -> AParser st RSDatatype
forall (m :: * -> *) a. Monad m => a -> m a
return RSDatatype
RSboolean
AParser st RSDatatype
-> AParser st RSDatatype -> AParser st RSDatatype
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|>
do
String -> AParser st Token
forall st. String -> AParser st Token
asKey String
rsBin
RSDatatype -> AParser st RSDatatype
forall (m :: * -> *) a. Monad m => a -> m a
return RSDatatype
RSbinary
AParser st RSDatatype
-> AParser st RSDatatype -> AParser st RSDatatype
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|>
do
String -> AParser st Token
forall st. String -> AParser st Token
asKey String
rsDate
RSDatatype -> AParser st RSDatatype
forall (m :: * -> *) a. Monad m => a -> m a
return RSDatatype
RSdate
AParser st RSDatatype
-> AParser st RSDatatype -> AParser st RSDatatype
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|>
do
String -> AParser st Token
forall st. String -> AParser st Token
asKey String
rsDatetime
RSDatatype -> AParser st RSDatatype
forall (m :: * -> *) a. Monad m => a -> m a
return RSDatatype
RSdatetime
AParser st RSDatatype
-> AParser st RSDatatype -> AParser st RSDatatype
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|>
do
String -> AParser st Token
forall st. String -> AParser st Token
asKey String
rsDecimal
RSDatatype -> AParser st RSDatatype
forall (m :: * -> *) a. Monad m => a -> m a
return RSDatatype
RSdecimal
AParser st RSDatatype
-> AParser st RSDatatype -> AParser st RSDatatype
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|>
do
String -> AParser st Token
forall st. String -> AParser st Token
asKey String
rsFloat
RSDatatype -> AParser st RSDatatype
forall (m :: * -> *) a. Monad m => a -> m a
return RSDatatype
RSfloat
AParser st RSDatatype
-> AParser st RSDatatype -> AParser st RSDatatype
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|>
do
String -> AParser st Token
forall st. String -> AParser st Token
asKey String
rsInteger
RSDatatype -> AParser st RSDatatype
forall (m :: * -> *) a. Monad m => a -> m a
return RSDatatype
RSinteger
AParser st RSDatatype
-> AParser st RSDatatype -> AParser st RSDatatype
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|>
do
String -> AParser st Token
forall st. String -> AParser st Token
asKey String
rsString
RSDatatype -> AParser st RSDatatype
forall (m :: * -> *) a. Monad m => a -> m a
return RSDatatype
RSstring
AParser st RSDatatype
-> AParser st RSDatatype -> AParser st RSDatatype
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|>
do
String -> AParser st Token
forall st. String -> AParser st Token
asKey String
rsText
RSDatatype -> AParser st RSDatatype
forall (m :: * -> *) a. Monad m => a -> m a
return RSDatatype
RStext
AParser st RSDatatype
-> AParser st RSDatatype -> AParser st RSDatatype
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|>
do
String -> AParser st Token
forall st. String -> AParser st Token
asKey String
rsTime
RSDatatype -> AParser st RSDatatype
forall (m :: * -> *) a. Monad m => a -> m a
return RSDatatype
RStime
AParser st RSDatatype
-> AParser st RSDatatype -> AParser st RSDatatype
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|>
do
String -> AParser st Token
forall st. String -> AParser st Token
asKey String
rsTimestamp
RSDatatype -> AParser st RSDatatype
forall (m :: * -> *) a. Monad m => a -> m a
return RSDatatype
RStimestamp
AParser st RSDatatype
-> AParser st RSDatatype -> AParser st RSDatatype
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|>
do
String -> AParser st Token
forall st. String -> AParser st Token
asKey String
rsDouble
RSDatatype -> AParser st RSDatatype
forall (m :: * -> *) a. Monad m => a -> m a
return RSDatatype
RSdouble
AParser st RSDatatype
-> AParser st RSDatatype -> AParser st RSDatatype
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|>
do
String -> AParser st Token
forall st. String -> AParser st Token
asKey String
rsNonPosInteger
RSDatatype -> AParser st RSDatatype
forall (m :: * -> *) a. Monad m => a -> m a
return RSDatatype
RSnonPosInteger
AParser st RSDatatype
-> AParser st RSDatatype -> AParser st RSDatatype
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|>
do
String -> AParser st Token
forall st. String -> AParser st Token
asKey String
rsNonNegInteger
RSDatatype -> AParser st RSDatatype
forall (m :: * -> *) a. Monad m => a -> m a
return RSDatatype
RSnonNegInteger
AParser st RSDatatype
-> AParser st RSDatatype -> AParser st RSDatatype
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|>
do
String -> AParser st Token
forall st. String -> AParser st Token
asKey String
rsLong
RSDatatype -> AParser st RSDatatype
forall (m :: * -> *) a. Monad m => a -> m a
return RSDatatype
RSlong
AParser st RSDatatype
-> AParser st RSDatatype -> AParser st RSDatatype
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|>
do
String -> AParser st Token
forall st. String -> AParser st Token
asKey String
rsPointer
RSDatatype -> AParser st RSDatatype
forall (m :: * -> *) a. Monad m => a -> m a
return RSDatatype
RSPointer
makeAnnoted :: [Annotation] -> [Annotation] -> a -> Annoted a
makeAnnoted :: [Annotation] -> [Annotation] -> a -> Annoted a
makeAnnoted l :: [Annotation]
l r :: [Annotation]
r sen :: a
sen = Annoted :: forall a. a -> Range -> [Annotation] -> [Annotation] -> Annoted a
Annoted
{
item :: a
item = a
sen
, l_annos :: [Annotation]
l_annos = [Annotation]
l
, r_annos :: [Annotation]
r_annos = [Annotation]
r
, opt_pos :: Range
opt_pos = Range
nullRange
}