From d69f1752a589c84ee62fada7bc4afff988164d9b Mon Sep 17 00:00:00 2001 From: Jake Wheat Date: Sat, 19 Apr 2014 22:24:10 +0300 Subject: [PATCH] start working on new sql 2011 tests --- changelog | 2 +- tools/Language/SQL/SimpleSQL/SQL2011.lhs | 3196 ++++++++++++++++++++++ 2 files changed, 3197 insertions(+), 1 deletion(-) create mode 100644 tools/Language/SQL/SimpleSQL/SQL2011.lhs diff --git a/changelog b/changelog index 27abad6..f6c5b68 100644 --- a/changelog +++ b/changelog @@ -1,5 +1,5 @@ 0.4.0-dev (updated to 705724197463cd19dd8749dfd51e2eb8f1d02b8e) - completely remove dependency on haskell-src-exts + remove dependency on haskell-src-exts improve the error messages a great deal fix some trailing whitespace issues in the keyword style functions, e.g. extract(day from x), dealing with trailing whitespace on diff --git a/tools/Language/SQL/SimpleSQL/SQL2011.lhs b/tools/Language/SQL/SimpleSQL/SQL2011.lhs new file mode 100644 index 0000000..2d108d8 --- /dev/null +++ b/tools/Language/SQL/SimpleSQL/SQL2011.lhs @@ -0,0 +1,3196 @@ + +This file goes through the grammar for SQL 2011 (using the draft standard). + +We are only looking at the query syntax, and no other parts. + +The goal is to create some example tests for each bit of grammar, with +some areas getting more comprehensive coverage tests, and also to note +which parts aren't currently supported. + + +> module Language.SQL.SimpleSQL.SQL2003 (sql2011Tests) where + +> import Language.SQL.SimpleSQL.TestTypes +> import Language.SQL.SimpleSQL.Syntax + +> sql2011Tests :: TestItem +> sql2011Tests = Group "sql2011 tests" +> [literals +> ,Group "value expressions" +> [typeNameTests +> ,parenthesizedValueExpression +> ,someGeneralValues +> ,targetSpecification +> ,contextuallyTypeValueSpec +> ,moduleColumnRef +> ,groupingOperation +> --,windowFunction +> --,caseExpression +> --,castSpecification +> ,nextValueExpression +> -- subtype treatment, method invoc, static m i, new spec, attrib/method ref, deref, method ref, ref res +> ,arrayElementReference +> ,multisetElementReference +> ,numericValueExpression +> --,numericValueFunction +> --,stringValueExpression +> --,stringValueFunction +> --,datetimeValueExpression +> --,datetimeValueFunction +> --,intervalValueExpression +> --,intervalValueFunction +> --,booleanValueExpression +> --arrayValueExpression +> ,arrayValueConstructor +> ,multisetValueExpression +> ,multisetValueFunction +> ,multisetValueConstructor +> ],Group "query expressions" +> [ +> -- rowValueConstructor +> --,rowValueExpression +> --,tableValueConstructor +> --,fromClause +> --,joinedTable +> --,whereClause +> groupbyClause +> --,havingClause +> --,windowClause +> --,querySpecification +> --,querySpecifications +> --,setOperations +> --,withExpressions +> ],Group "predicates" +> [--comparisonPredicate +> --,betweenPredicate +> --,inPredicate +> --,likePredicate +> --,similarPredicae +> --,nullPredicate +> quantifiedComparisonPredicate +> --,existsPredicate +> ,uniquePredicate +> --,normalizedPredicate +> ,matchPredicate +> --,overlapsPredicate +> --,distinctPredicate +> --,memberPredicate +> --,submultisetPredicate +> --,setPredicate +> ,collateClause +> ,aggregateFunctions +> ,sortSpecificationList +> ] +> ] + += 5 Lexical Elements + +Basic definitions of characters used, tokens, symbols, etc. Most of this section would normally be handled within the lexical analyzer rather than in the grammar proper. Further, the original document does not quote the various single characters, which makes it hard to process automatically. + +[There seems to be a lot of unused stuff here, so skip this section +and only do bits which are needed by other bits] + +5.1 + + ::= + + ::= | | + + ::= | + + ::= + A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z + + ::= + a | b | c | d | e | f | g | h | i | j | k | l | m | n | o | p | q | r | s | t | u | v | w | x | y | z + + ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 + + ::= + + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + + ::= !! See the Syntax Rules. + + ::= " + + ::= % + + ::= & + + ::= ' + + ::= ( + + ::= ) + + ::= * + + ::= + + + ::= , + + ::= - + + ::= . + + ::= / + + ::= \ + + ::= : + + ::= ; + + ::= < + + ::= = + + ::= > + + ::= ? + + ::= | + + ::= | + + ::= [ + + ::= ??( + + ::= ] + + ::= ??) + + ::= ^ + + ::= _ + + ::= /* Nothing */ | + + ::= { + + ::= } + + + +5.2 and + +Specifying lexical units (tokens and separators) that participate in SQL language. + + ::= | + + ::= + + | + | + | + | + | + | + | + | + + + ::= + ::= [ ... ] + + ::= + + | + + ::= !! See the Syntax Rules. + + ::= !! See the Syntax Rules. + + ::= ... + + ::= K | M | G | T | P + + + ::= + + ::= ... + + ::= | + + ::= + U + + + ::= [ UESCAPE ] + + ::= ... + + ::= | + + ::= + + | + | + + ::= + + ::= + + + ::= + + ::= !! See the Syntax Rules + + ::= !! See the Syntax Rules. + + ::= + + ::= + + | + |