1
Fork 0

small tweaks

This commit is contained in:
Jake Wheat 2016-02-12 11:57:09 +02:00
parent c102528d5f
commit 5b786bd11d
3 changed files with 51 additions and 30 deletions

View file

@ -93,13 +93,43 @@
> ,ilFrom :: IntervalTypeField
> ,ilTo :: Maybe IntervalTypeField
> }
> -- | prefix 'typed literal', e.g. int '42'
> | TypedLit TypeName String
> -- | identifier with parts separated by dots
> | Iden [Name]
> -- | star, as in select *, t.*, count(*)
> | Star
> | Parameter -- ^ Represents a ? in a parameterized query
> | HostParameter String (Maybe String) -- ^ represents a host
> -- parameter, e.g. :a. The
> -- Maybe String is for the
> -- indicator, e.g. :var
> -- indicator :nl
> -- | Infix binary operators. This is used for symbol operators
> -- (a + b), keyword operators (a and b) and multiple keyword
> -- operators (a is similar to b)
> | BinOp ValueExpr [Name] ValueExpr
> -- | Prefix unary operators. This is used for symbol
> -- operators, keyword operators and multiple keyword operators.
> | PrefixOp [Name] ValueExpr
> -- | Postfix unary operators. This is used for symbol
> -- operators, keyword operators and multiple keyword operators.
> | PostfixOp [Name] ValueExpr
> -- | Used for ternary, mixfix and other non orthodox
> -- operators. Currently used for row constructors, and for
> -- between.
> | SpecialOp [Name] [ValueExpr]
> -- | function application (anything that looks like c style
> -- function application syntactically)
> | App [Name] [ValueExpr]
> -- | aggregate application, which adds distinct or all, and
> -- order by, to regular function application
> | AggregateApp
@ -125,53 +155,39 @@
> ,wnOrderBy :: [SortSpec] -- ^ order by
> ,wnFrame :: Maybe Frame -- ^ frame clause
> }
> -- | Infix binary operators. This is used for symbol operators
> -- (a + b), keyword operators (a and b) and multiple keyword
> -- operators (a is similar to b)
> | BinOp ValueExpr [Name] ValueExpr
> -- | Prefix unary operators. This is used for symbol
> -- operators, keyword operators and multiple keyword operators.
> | PrefixOp [Name] ValueExpr
> -- | Postfix unary operators. This is used for symbol
> -- operators, keyword operators and multiple keyword operators.
> | PostfixOp [Name] ValueExpr
> -- | Used for ternary, mixfix and other non orthodox
> -- operators. Currently used for row constructors, and for
> -- between.
> | SpecialOp [Name] [ValueExpr]
> -- | Used for the operators which look like functions
> -- except the arguments are separated by keywords instead
> -- of commas. The maybe is for the first unnamed argument
> -- if it is present, and the list is for the keyword argument
> -- pairs.
> | SpecialOpK [Name] (Maybe ValueExpr) [(String,ValueExpr)]
> -- | cast(a as typename)
> | Cast ValueExpr TypeName
> -- | case expression. both flavours supported
> | Case
> {caseTest :: Maybe ValueExpr -- ^ test value
> ,caseWhens :: [([ValueExpr],ValueExpr)] -- ^ when branches
> ,caseElse :: Maybe ValueExpr -- ^ else value
> }
> | Parens ValueExpr
> -- | cast(a as typename)
> | Cast ValueExpr TypeName
> -- | prefix 'typed literal', e.g. int '42'
> | TypedLit TypeName String
> -- | exists, all, any, some subqueries
> | SubQueryExpr SubQueryExprType QueryExpr
> -- | in list literal and in subquery, if the bool is false it
> -- means not in was used ('a not in (1,2)')
> | In Bool ValueExpr InPredValue
> | Parameter -- ^ Represents a ? in a parameterized query
> | HostParameter String (Maybe String) -- ^ represents a host
> -- parameter, e.g. :a. The
> -- Maybe String is for the
> -- indicator, e.g. :var
> -- indicator :nl
> -- | exists, all, any, some subqueries
> | SubQueryExpr SubQueryExprType QueryExpr
> | QuantifiedComparison
> ValueExpr
> [Name] -- operator
> CompPredQuantifier
> QueryExpr
> | Match ValueExpr Bool -- true if unique
> QueryExpr
> | Array ValueExpr [ValueExpr] -- ^ represents an array
@ -180,7 +196,12 @@
> -- valueExpr is the array, the
> -- second is the subscripts/ctor args
> | ArrayCtor QueryExpr -- ^ this is used for the query expression version of array constructors, e.g. array(select * from t)
> | CSStringLit String String
todo: special syntax for like, similar with escape - escape cannot go
in other places
> | Escape ValueExpr Char
> | UEscape ValueExpr Char
> | Collate ValueExpr [Name]

View file

@ -55,7 +55,7 @@ Test-Suite Tests
parsec >=3.1 && <3.2,
mtl >=2.1 && <2.3,
pretty >= 1.1 && < 1.2,
tasty >= 0.10 && < 0.11,
tasty >= 0.10 && < 0.12,
tasty-hunit >= 0.9 && < 0.10
Other-Modules: Language.SQL.SimpleSQL.Pretty,
@ -112,7 +112,7 @@ executable Fixity
mtl >=2.1 && <2.3,
pretty >= 1.1 && < 1.2,
pretty-show >= 1.6 && < 1.7,
tasty >= 0.10 && < 0.11,
tasty >= 0.10 && < 0.12,
tasty-hunit >= 0.9 && < 0.10
other-extensions: TupleSections,DeriveDataTypeable

View file

@ -1100,8 +1100,8 @@ create a list of type name variations:
> -- 1 with and without tz
> ,("time with time zone"
> ,TimeTypeName [Name "time"] Nothing True)
> ,("datetime(3) without time zone"
> ,TimeTypeName [Name "datetime"] (Just 3) False)
> ,("timestamp(3) without time zone"
> ,TimeTypeName [Name "timestamp"] (Just 3) False)
> -- chars: (single/multiname) x prec x charset x collate
> -- 1111
> ,("char varying(5) character set something collate something_insensitive"