d005dc1706
add parse function for parsing multiple query expressions separated by semicolon add parser for substring operator tweak the layout for pretty printing binary operators add sql file with tpch queries in it add simple exe to parse and pretty print multiple query expressions
18 lines
501 B
Plaintext
18 lines
501 B
Plaintext
> import System.Environment
|
|
|
|
> import Language.SQL.SimpleSQL.Pretty
|
|
> import Language.SQL.SimpleSQL.Parser
|
|
> import Data.List
|
|
|
|
> main :: IO ()
|
|
> main = do
|
|
> args <- getArgs
|
|
> case args of
|
|
> [f] -> do
|
|
> src <- readFile f
|
|
> either (error . peFormattedError
|
|
> )
|
|
> (putStrLn . intercalate "\n" . map prettyQueryExpr)
|
|
> $ parseQueryExprs f Nothing src
|
|
> _ -> error "please pass filename to prettify"
|