fix some imports and exports, particularly stop reexporting all the dialect stuff everywhere
This commit is contained in:
parent
f58e19f33b
commit
9df04a3040
|
@ -24,8 +24,8 @@ directly without the separately testing lexing stage.
|
||||||
> ,prettyToken
|
> ,prettyToken
|
||||||
> ,prettyTokens
|
> ,prettyTokens
|
||||||
> ,ParseError(..)
|
> ,ParseError(..)
|
||||||
> ,Dialect(..)
|
|
||||||
> ,tokenListWillPrintAndLex
|
> ,tokenListWillPrintAndLex
|
||||||
|
> ,ansi2011
|
||||||
> ) where
|
> ) where
|
||||||
|
|
||||||
> import Language.SQL.SimpleSQL.Dialect
|
> import Language.SQL.SimpleSQL.Dialect
|
||||||
|
|
|
@ -192,20 +192,21 @@ fixing them in the syntax but leaving them till the semantic checking
|
||||||
> ,try,many,many1,(<|>),choice,eof
|
> ,try,many,many1,(<|>),choice,eof
|
||||||
> ,optionMaybe,optional,runParser
|
> ,optionMaybe,optional,runParser
|
||||||
> ,chainl1, chainr1,(<?>))
|
> ,chainl1, chainr1,(<?>))
|
||||||
> -- import Text.Parsec.String (Parser)
|
|
||||||
> import Text.Parsec.Perm (permute,(<$?>), (<|?>))
|
> import Text.Parsec.Perm (permute,(<$?>), (<|?>))
|
||||||
> import Text.Parsec.Prim (getState, token)
|
> import Text.Parsec.Prim (getState, token)
|
||||||
> import Text.Parsec.Pos (newPos)
|
> import Text.Parsec.Pos (newPos)
|
||||||
> import qualified Text.Parsec.Expr as E
|
> import qualified Text.Parsec.Expr as E
|
||||||
> import Data.List (intercalate,sort,groupBy)
|
> import Data.List (intercalate,sort,groupBy)
|
||||||
> import Data.Function (on)
|
> import Data.Function (on)
|
||||||
|
> import Data.Maybe
|
||||||
|
> import Text.Parsec.String (GenParser)
|
||||||
|
|
||||||
> import Language.SQL.SimpleSQL.Syntax
|
> import Language.SQL.SimpleSQL.Syntax
|
||||||
> import Language.SQL.SimpleSQL.Combinators
|
> import Language.SQL.SimpleSQL.Combinators
|
||||||
> import Language.SQL.SimpleSQL.Errors
|
> import Language.SQL.SimpleSQL.Errors
|
||||||
> --import Language.SQL.SimpleSQL.Dialect
|
> import Language.SQL.SimpleSQL.Dialect
|
||||||
> import qualified Language.SQL.SimpleSQL.Lex as L
|
> import qualified Language.SQL.SimpleSQL.Lex as L
|
||||||
> import Data.Maybe
|
|
||||||
> import Text.Parsec.String (GenParser)
|
|
||||||
|
|
||||||
= Public API
|
= Public API
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
|
|
||||||
TODO: there should be more comments in this file, especially the bits
|
TODO: there should be more comments in this file, especially the bits
|
||||||
which have been changed to try to improve the layout of the output.
|
which have been changed to try to improve the layout of the output.
|
||||||
|
Try to do this when this code is ported to a modern pretty printing lib.
|
||||||
|
|
||||||
> import Language.SQL.SimpleSQL.Syntax
|
|
||||||
> --import Language.SQL.SimpleSQL.Dialect
|
> --import Language.SQL.SimpleSQL.Dialect
|
||||||
> import Text.PrettyPrint (render, vcat, text, (<>), (<+>), empty, parens,
|
> import Text.PrettyPrint (render, vcat, text, (<>), (<+>), empty, parens,
|
||||||
> nest, Doc, punctuate, comma, sep, quotes,
|
> nest, Doc, punctuate, comma, sep, quotes,
|
||||||
|
@ -22,6 +22,11 @@ which have been changed to try to improve the layout of the output.
|
||||||
> import Data.Maybe (maybeToList, catMaybes)
|
> import Data.Maybe (maybeToList, catMaybes)
|
||||||
> import Data.List (intercalate)
|
> import Data.List (intercalate)
|
||||||
|
|
||||||
|
|
||||||
|
> import Language.SQL.SimpleSQL.Syntax
|
||||||
|
> import Language.SQL.SimpleSQL.Dialect
|
||||||
|
|
||||||
|
|
||||||
> -- | Convert a query expr ast to concrete syntax.
|
> -- | Convert a query expr ast to concrete syntax.
|
||||||
> prettyQueryExpr :: Dialect -> QueryExpr -> String
|
> prettyQueryExpr :: Dialect -> QueryExpr -> String
|
||||||
> prettyQueryExpr d = render . queryExpr d
|
> prettyQueryExpr d = render . queryExpr d
|
||||||
|
|
|
@ -57,14 +57,11 @@
|
||||||
> ,PrivilegeAction(..)
|
> ,PrivilegeAction(..)
|
||||||
> ,AdminOptionFor(..)
|
> ,AdminOptionFor(..)
|
||||||
> ,GrantOptionFor(..)
|
> ,GrantOptionFor(..)
|
||||||
> -- * Dialects
|
|
||||||
> ,module Language.SQL.SimpleSQL.Dialect
|
|
||||||
> -- * Comment
|
> -- * Comment
|
||||||
> ,Comment(..)
|
> ,Comment(..)
|
||||||
> ) where
|
> ) where
|
||||||
|
|
||||||
> import Data.Data
|
> import Data.Data
|
||||||
> import Language.SQL.SimpleSQL.Dialect
|
|
||||||
|
|
||||||
> -- | Represents a value expression. This is used for the expressions
|
> -- | Represents a value expression. This is used for the expressions
|
||||||
> -- in select lists. It is also used for expressions in where, group
|
> -- in select lists. It is also used for expressions in where, group
|
||||||
|
|
|
@ -18,13 +18,9 @@ indent: parse then pretty print sql
|
||||||
|
|
||||||
> import Language.SQL.SimpleSQL.Pretty
|
> import Language.SQL.SimpleSQL.Pretty
|
||||||
> import Language.SQL.SimpleSQL.Parse
|
> import Language.SQL.SimpleSQL.Parse
|
||||||
> import Language.SQL.SimpleSQL.Syntax
|
|
||||||
> import Language.SQL.SimpleSQL.Lex
|
> import Language.SQL.SimpleSQL.Lex
|
||||||
|
|
||||||
|
|
||||||
> dialect :: Dialect
|
|
||||||
> dialect = ansi2011
|
|
||||||
|
|
||||||
> main :: IO ()
|
> main :: IO ()
|
||||||
> main = do
|
> main = do
|
||||||
> args <- getArgs
|
> args <- getArgs
|
||||||
|
@ -71,7 +67,7 @@ indent: parse then pretty print sql
|
||||||
> (f,src) <- getInput args
|
> (f,src) <- getInput args
|
||||||
> either (error . peFormattedError)
|
> either (error . peFormattedError)
|
||||||
> (putStrLn . ppShow)
|
> (putStrLn . ppShow)
|
||||||
> $ parseStatements dialect f Nothing src
|
> $ parseStatements ansi2011 f Nothing src
|
||||||
> )
|
> )
|
||||||
|
|
||||||
> lexCommand :: (String,[String] -> IO ())
|
> lexCommand :: (String,[String] -> IO ())
|
||||||
|
@ -81,7 +77,7 @@ indent: parse then pretty print sql
|
||||||
> (f,src) <- getInput args
|
> (f,src) <- getInput args
|
||||||
> either (error . peFormattedError)
|
> either (error . peFormattedError)
|
||||||
> (putStrLn . intercalate ",\n" . map show)
|
> (putStrLn . intercalate ",\n" . map show)
|
||||||
> $ lexSQL dialect f Nothing src
|
> $ lexSQL ansi2011 f Nothing src
|
||||||
> )
|
> )
|
||||||
|
|
||||||
|
|
||||||
|
@ -91,7 +87,7 @@ indent: parse then pretty print sql
|
||||||
> ,\args -> do
|
> ,\args -> do
|
||||||
> (f,src) <- getInput args
|
> (f,src) <- getInput args
|
||||||
> either (error . peFormattedError)
|
> either (error . peFormattedError)
|
||||||
> (putStrLn . prettyStatements dialect)
|
> (putStrLn . prettyStatements ansi2011)
|
||||||
> $ parseStatements dialect f Nothing src
|
> $ parseStatements ansi2011 f Nothing src
|
||||||
|
|
||||||
> )
|
> )
|
||||||
|
|
Loading…
Reference in a new issue