1
Fork 0

small tidyups

This commit is contained in:
Jake Wheat 2013-12-14 20:20:41 +02:00
parent 3fa7086a48
commit 3f0ff9aec0
6 changed files with 11 additions and 17 deletions

View file

@ -312,7 +312,6 @@ keyword.
> binOpMultiKeywordNames :: [[String]] > binOpMultiKeywordNames :: [[String]]
> binOpMultiKeywordNames = map words > binOpMultiKeywordNames = map words
> ["not like" > ["not like"
> ,"not similar"
> ,"is similar to" > ,"is similar to"
> ,"is not similar to" > ,"is not similar to"
> ,"is distinct from" > ,"is distinct from"
@ -353,6 +352,10 @@ The parsers:
> opSymbol = choice (map (try . symbol) prefixUnOpSymbolNames > opSymbol = choice (map (try . symbol) prefixUnOpSymbolNames
> ++ map (try . keyword) prefixUnOpKeywordNames) > ++ map (try . keyword) prefixUnOpKeywordNames)
TODO: the handling of multikeyword args is different in
postfixopsuffix and binaryoperatorsuffix. It should be the same in
both cases
> postfixOpSuffix :: ScalarExpr -> P ScalarExpr > postfixOpSuffix :: ScalarExpr -> P ScalarExpr
> postfixOpSuffix e = > postfixOpSuffix e =
> try $ choice $ map makeOp opPairs > try $ choice $ map makeOp opPairs
@ -463,9 +466,6 @@ expression tree (for efficiency and code clarity).
= query expressions = query expressions
TODO: maybe refactor all the parsers. A parser wouldn't usually be
optional or use try itself. The caller could do this.
== select lists == select lists
> selectItem :: P (Maybe String, ScalarExpr) > selectItem :: P (Maybe String, ScalarExpr)

View file

@ -1,7 +1,4 @@
This is the pretty printer code which takes AST values and turns them
back into SQL source text. It attempts to format the output nicely.
> -- | These is the pretty printing functions, which produce SQL > -- | These is the pretty printing functions, which produce SQL
> -- source from ASTs. The code attempts to format the output in a > -- source from ASTs. The code attempts to format the output in a
> -- readable way. > -- readable way.

2
README
View file

@ -1,5 +1,5 @@
A parser for SQL queries in Haskell. A parser for SQL queries in Haskell.
Homepage: https://github.com/JakeWheat/simple_sql_parser Homepage: http://jakewheat.github.io/simple_sql_parser/
Contact: jakewheatmail@gmail.com Contact: jakewheatmail@gmail.com

9
TODO
View file

@ -2,15 +2,16 @@
first release: first release:
add automated tests to cabal add automated tests to cabal
check the order of exports, imports and functions/cases in the files
fix up the import namespaces/explicit names nicely
do some tests for parse errors?
website with haddock and table of parsing tests
---- ----
Later general tasks: Later general tasks:
check the order of exports, imports and functions/cases in the files
fix up the import namespaces/explicit names nicely
do some tests for parse errors?
dialect switching dialect switching
left factor parsing code in remaining places left factor parsing code in remaining places

View file

@ -1,5 +1,5 @@
> module Tests (testData, runTests) where > module Tests (testData, TestItem(..), runTests) where
> import Language.SQL.SimpleSQL.Syntax > import Language.SQL.SimpleSQL.Syntax
> import Language.SQL.SimpleSQL.Pretty > import Language.SQL.SimpleSQL.Pretty

View file

@ -2,10 +2,6 @@ name: simple-sql-parser
version: 0.1.0.0 version: 0.1.0.0
synopsis: A parser for SQL queries synopsis: A parser for SQL queries
description: A parser for SQL queries, using Parsec. Also includes
pretty printer. Aims to support most of SQL:2003
queries plus other SQL dialects.
homepage: https://github.com/JakeWheat/simple_sql_parser homepage: https://github.com/JakeWheat/simple_sql_parser
license: BSD3 license: BSD3
license-file: LICENSE license-file: LICENSE