From 40c64c76317d29d929d11bbcae44179275275215 Mon Sep 17 00:00:00 2001 From: Jake Wheat Date: Thu, 19 Dec 2013 17:50:25 +0200 Subject: [PATCH] rename qeFetch to qeFetchFirst --- Language/SQL/SimpleSQL/Fixity.lhs | 30 ++++++++++++++++++- Language/SQL/SimpleSQL/Syntax.lhs | 6 ++-- TODO | 7 +++++ .../SQL/SimpleSQL/QueryExprComponents.lhs | 2 +- 4 files changed, 40 insertions(+), 5 deletions(-) diff --git a/Language/SQL/SimpleSQL/Fixity.lhs b/Language/SQL/SimpleSQL/Fixity.lhs index 71afe24..cb2ad17 100644 --- a/Language/SQL/SimpleSQL/Fixity.lhs +++ b/Language/SQL/SimpleSQL/Fixity.lhs @@ -38,9 +38,37 @@ because the parser applies the fixity fix to every 'top level' value expr, we don't need to descend into query exprs to find the value exprs inside them. -start creating test list +start creating test list: +create tests with an explicit fixity table to check the features of +the fixity code, then create tests for sql value expressions which +sanity check the fixity applied to these expressions. +basic fixity tests: + +a + b + c +a + b * c +a * b + c +a + b + c * d +a * b + c + d + +try also with right assocative + +a HI b PostfixLow + +a low b PostfixHigh + +a LOWEST b HI c PostfixMEDIUM ++ variations + +same with prefix +same with chained binops + +---- + +now sanity check the basic operators (these use BinOp, PrefixOp, +PostfixOp) then sanity check all the other operators which take part +in the fixity > {-# LANGUAGE TupleSections #-} diff --git a/Language/SQL/SimpleSQL/Syntax.lhs b/Language/SQL/SimpleSQL/Syntax.lhs index 53e3fc1..3e3d0e2 100644 --- a/Language/SQL/SimpleSQL/Syntax.lhs +++ b/Language/SQL/SimpleSQL/Syntax.lhs @@ -211,7 +211,7 @@ This would make some things a bit cleaner? > ,qeHaving :: Maybe ValueExpr > ,qeOrderBy :: [SortSpec] > ,qeOffset :: Maybe ValueExpr -> ,qeFetch :: Maybe ValueExpr +> ,qeFetchFirst :: Maybe ValueExpr > } > | CombineQueryExpr > {qe0 :: QueryExpr @@ -244,7 +244,7 @@ I'm not sure if this is valid syntax or not. > -- > ,qeHaving = Nothing > -- > ,qeOrderBy = [] > -- > ,qeOffset = Nothing -> -- > ,qeFetch = Nothing} +> -- > ,qeFetchFirst = Nothing} > makeSelect :: QueryExpr > makeSelect = Select {qeSetQuantifier = All @@ -255,7 +255,7 @@ I'm not sure if this is valid syntax or not. > ,qeHaving = Nothing > ,qeOrderBy = [] > ,qeOffset = Nothing -> ,qeFetch = Nothing} +> ,qeFetchFirst = Nothing} > -- | Represents the Distinct or All keywords, which can be used diff --git a/TODO b/TODO index 544e13c..2ce0038 100644 --- a/TODO +++ b/TODO @@ -5,6 +5,11 @@ check fixity in query expr level? check fixity in tablerefs try and use the proper css theme + create a header like in the haddock with simple-sql-parser + + contents link + change the toc gen so that it works the same as in haddock (same + div, no links on the actual titles + fix the page margins, and the table stuff: patches to the css? release checklist: hlint @@ -92,6 +97,8 @@ a collation in ansi sql is a optional qualifier plus identifier, not a string have to do fixity for this to work +see what schema.fun(a) parses to and decide if this is correct + all ansi string literal syntax? check ansi standard for operators (keywords and symbols) diff --git a/tools/Language/SQL/SimpleSQL/QueryExprComponents.lhs b/tools/Language/SQL/SimpleSQL/QueryExprComponents.lhs index c209cd1..1714eb7 100644 --- a/tools/Language/SQL/SimpleSQL/QueryExprComponents.lhs +++ b/tools/Language/SQL/SimpleSQL/QueryExprComponents.lhs @@ -138,7 +138,7 @@ These are a few misc tests which don't fit anywhere else. > {qeSelectList = [(Nothing,Iden "a")] > ,qeFrom = [TRSimple "t"] > ,qeOffset = o -> ,qeFetch = l} +> ,qeFetchFirst = l} > combos :: TestItem > combos = Group "combos" $ map (uncurry TestQueryExpr)