1
Fork 0

Merge branch 'hanjoosten-master'

This commit is contained in:
Jake Wheat 2015-03-14 16:15:53 +02:00
commit 37af90e364
3 changed files with 19 additions and 1 deletions

View file

@ -221,6 +221,8 @@ which have been changed to try to improve the layout of the output.
> valueExpr _ (NextValueFor ns) =
> text "next value for" <+> names ns
> valueExpr d (VEComment cmt v) =
> vcat $ map comment cmt ++ [valueExpr d v]
> doubleUpQuotes :: String -> String
> doubleUpQuotes [] = []
@ -358,6 +360,8 @@ which have been changed to try to improve the layout of the output.
> text "values"
> <+> nest 7 (commaSep (map (parens . commaSep . map (valueExpr d)) vs))
> queryExpr _ (Table t) = text "table" <+> names t
> queryExpr d (QEComment cmt v) =
> vcat $ map comment cmt ++ [queryExpr d v]
> alias :: Alias -> Doc
@ -441,3 +445,6 @@ which have been changed to try to improve the layout of the output.
> me :: (a -> Doc) -> Maybe a -> Doc
> me = maybe empty
> comment :: Comment -> Doc
> comment (BlockComment str) = text "/*" <+> text str <+> text "*/"

View file

@ -32,6 +32,8 @@
> ,JoinCondition(..)
> -- * dialect
> ,Dialect(..)
> -- * comment
> ,Comment(..)
> ) where
> import Data.Data
@ -161,6 +163,7 @@
> | MultisetCtor [ValueExpr]
> | MultisetQueryCtor QueryExpr
> | NextValueFor [Name]
> | VEComment [Comment] ValueExpr
> deriving (Eq,Show,Read,Data,Typeable)
> -- | Represents an identifier name, which can be quoted or unquoted.
@ -292,6 +295,7 @@ This would make some things a bit cleaner?
> ,qeQueryExpression :: QueryExpr}
> | Values [[ValueExpr]]
> | Table [Name]
> | QEComment [Comment] QueryExpr
> deriving (Eq,Show,Read,Data,Typeable)
TODO: add queryexpr parens to deal with e.g.
@ -323,7 +327,6 @@ I'm not sure if this is valid syntax or not.
> ,qeOffset = Nothing
> ,qeFetchFirst = Nothing}
> -- | Represents the Distinct or All keywords, which can be used
> -- before a select list, in an aggregate/window function
> -- application, or in a query expression set operator.
@ -383,3 +386,9 @@ I'm not sure if this is valid syntax or not.
> data Dialect = SQL2011
> | MySQL
> deriving (Eq,Show,Read,Data,Typeable)
> -- | Comment. Useful when generating SQL code programmatically.
> data Comment = BlockComment String
> deriving (Eq,Show,Read,Data,Typeable)

View file

@ -3,6 +3,8 @@ please email jakewheatmail@gmail.com or use the github bug tracker,
https://github.com/JakeWheat/simple-sql-parser/issues.
0.4.1 (unreleased)
simple demonstration of how dialects could be handled internally
add ability to add comments to syntax tree to help with generating
SQL code
0.4.0 (commit 7914898cc8f07bbaf8358d208469392346341964)
now targets SQL:2011
update to ghc 7.8.2