diff --git a/Language/SQL/SimpleSQL/Parser.lhs b/Language/SQL/SimpleSQL/Parser.lhs index d18752b..c88c158 100644 --- a/Language/SQL/SimpleSQL/Parser.lhs +++ b/Language/SQL/SimpleSQL/Parser.lhs @@ -411,13 +411,35 @@ typename: used in casts. Special cases for the multi keyword typenames that SQL supports. > typeName :: P TypeName -> typeName = choice -> [TypeName "double precision" -> <$ try (keyword_ "double" <* keyword_ "precision") -> ,TypeName "character varying" -> <$ try (keyword_ "character" <* keyword_ "varying") -> ,TypeName <$> identifierString] >>= optionSuffix precision +> typeName = choice (multiWordParsers +> ++ [TypeName <$> identifierString]) +> >>= optionSuffix precision > where +> multiWordParsers = +> flip map multiWordTypeNames +> $ \ks -> (TypeName . unwords) <$> try (mapM keyword ks) +> multiWordTypeNames = map words +> ["double precision" +> ,"character varying" +> ,"char varying" +> ,"character large object" +> ,"char large object" +> ,"national character" +> ,"national char" +> ,"national character varying" +> ,"national char varying" +> ,"national character large object" +> ,"nchar large object" +> ,"nchar varying" +> ,"bit varying" +> ] + +todo: timestamp types: + + | TIME [