implement reference type name (I think - cannot find any examples or
explanation of what it means, didn't try reading the standard itself, just the grammar)
This commit is contained in:
parent
3b86a06e5c
commit
7a84704516
|
@ -530,7 +530,7 @@ TODO: this need heavy refactoring
|
||||||
|
|
||||||
> typeName :: Parser TypeName
|
> typeName :: Parser TypeName
|
||||||
> typeName =
|
> typeName =
|
||||||
> (rowTypeName <|> intervalTypeName <|> otherTypeName)
|
> (rowTypeName <|> intervalTypeName <|> ref <|> otherTypeName)
|
||||||
> >>= tnSuffix
|
> >>= tnSuffix
|
||||||
> <?> "typename"
|
> <?> "typename"
|
||||||
> where
|
> where
|
||||||
|
@ -542,6 +542,11 @@ TODO: this need heavy refactoring
|
||||||
> intervalTypeName =
|
> intervalTypeName =
|
||||||
> keyword_ "interval" >>
|
> keyword_ "interval" >>
|
||||||
> uncurry IntervalTypeName <$> intervalQualifier
|
> uncurry IntervalTypeName <$> intervalQualifier
|
||||||
|
> ref =
|
||||||
|
> keyword_ "ref" >>
|
||||||
|
> RefTypeName
|
||||||
|
> <$> parens (names)
|
||||||
|
> <*> optionMaybe (keyword_ "scope" *> names)
|
||||||
> -- other type names, which includes:
|
> -- other type names, which includes:
|
||||||
> -- precision, scale, lob scale and units, timezone, character
|
> -- precision, scale, lob scale and units, timezone, character
|
||||||
> -- set and collations
|
> -- set and collations
|
||||||
|
|
|
@ -284,6 +284,11 @@ which have been changed to try to improve the layout of the output.
|
||||||
> typeName (MultisetTypeName tn) =
|
> typeName (MultisetTypeName tn) =
|
||||||
> typeName tn <+> text "multiset"
|
> typeName tn <+> text "multiset"
|
||||||
|
|
||||||
|
> typeName (RefTypeName rt sc) =
|
||||||
|
> text "ref"
|
||||||
|
> <> parens (names rt)
|
||||||
|
> <+> me (\x -> text "scope" <+> names x) sc
|
||||||
|
|
||||||
> intervalTypeField :: IntervalTypeField -> Doc
|
> intervalTypeField :: IntervalTypeField -> Doc
|
||||||
> intervalTypeField (Itf n p) =
|
> intervalTypeField (Itf n p) =
|
||||||
> text n
|
> text n
|
||||||
|
|
|
@ -174,6 +174,7 @@ TODO: add ref and scope, any others?
|
||||||
> | IntervalTypeName IntervalTypeField (Maybe IntervalTypeField)
|
> | IntervalTypeName IntervalTypeField (Maybe IntervalTypeField)
|
||||||
> | ArrayTypeName TypeName (Maybe Integer)
|
> | ArrayTypeName TypeName (Maybe Integer)
|
||||||
> | MultisetTypeName TypeName
|
> | MultisetTypeName TypeName
|
||||||
|
> | RefTypeName [Name] (Maybe [Name])
|
||||||
> deriving (Eq,Show,Read,Data,Typeable)
|
> deriving (Eq,Show,Read,Data,Typeable)
|
||||||
|
|
||||||
> data IntervalTypeField = Itf String (Maybe (Integer, Maybe Integer))
|
> data IntervalTypeField = Itf String (Maybe (Integer, Maybe Integer))
|
||||||
|
|
|
@ -987,8 +987,7 @@ create a list of type name variations:
|
||||||
> ,"timestamp"]
|
> ,"timestamp"]
|
||||||
> --interval -- not allowed without interval qualifier
|
> --interval -- not allowed without interval qualifier
|
||||||
> --row -- not allowed without row type body
|
> --row -- not allowed without row type body
|
||||||
> --ref -- todo
|
> --ref -- not allowed without reference type
|
||||||
> --scope -- todo
|
|
||||||
> -- array -- not allowed on own
|
> -- array -- not allowed on own
|
||||||
> -- multiset -- not allowed on own
|
> -- multiset -- not allowed on own
|
||||||
|
|
||||||
|
@ -1092,6 +1091,8 @@ create a list of type name variations:
|
||||||
> ,("interval year(4) to second(2,3)"
|
> ,("interval year(4) to second(2,3)"
|
||||||
> ,IntervalTypeName (Itf "year" $ Just (4,Nothing))
|
> ,IntervalTypeName (Itf "year" $ Just (4,Nothing))
|
||||||
> (Just $ Itf "second" $ Just (2, Just 3)))
|
> (Just $ Itf "second" $ Just (2, Just 3)))
|
||||||
|
> ,("ref (t)", RefTypeName [Name "t"] Nothing)
|
||||||
|
> ,("ref (t) scope q", RefTypeName [Name "t"] (Just [Name "q"]))
|
||||||
> ]
|
> ]
|
||||||
|
|
||||||
Now test each variation in both cast expression and typed literal
|
Now test each variation in both cast expression and typed literal
|
||||||
|
|
Loading…
Reference in a new issue