1
Fork 0

get star parsing working everywhere

This commit is contained in:
Jake Wheat 2013-12-17 12:24:37 +02:00
parent abc30b82e6
commit 9461a11c97
3 changed files with 7 additions and 7 deletions

View file

@ -126,7 +126,8 @@ of dots.
== star
used in select *, select x.*, and agg(*) variations.
used in select *, select x.*, and agg(*) variations, and some other
places as well.
> star :: P ScalarExpr
> star = choice [Star <$ symbol "*"
@ -147,8 +148,7 @@ aggregate([all|distinct] args [order by orderitems])
> makeApp
> <$> identifierString
> <*> parens ((,,) <$> try duplicates
> <*> choice [(:[]) <$> try star
> ,commaSep scalarExpr']
> <*> choice [commaSep scalarExpr']
> <*> try (optionMaybe orderBy))
> where
> makeApp i (Nothing,es,Nothing) = App i es
@ -445,6 +445,7 @@ could at least do with some heavy explanation.
> ,prefixUnaryOp
> ,try app
> ,try dottedIden
> ,try star
> ,identifier
> ,sparens]
@ -474,9 +475,7 @@ easy to ensure that this fix is only applied once to each scalar
expression tree (for efficiency and code clarity).
> scalarExpr :: P ScalarExpr
> scalarExpr =
> choice [try star
> ,fixFixities sqlFixities <$> scalarExpr']
> scalarExpr = fixFixities sqlFixities <$> scalarExpr'
-------------------------------------------------

View file

@ -22,7 +22,7 @@ TODO: get all the commented out tests working
> \ FROM states;"
> ,"SELECT ROW(1,2.5,'this is a test');"
> --,"SELECT ROW(t.*, 42) FROM t;" -- needs the .* parsing to be enabled in more contexts
> ,"SELECT ROW(t.*, 42) FROM t;"
> ,"SELECT ROW(t.f1, t.f2, 42) FROM t;"
> ,"SELECT getf1(CAST(ROW(11,'this is a test',2.5) AS myrowtype));"

View file

@ -48,6 +48,7 @@ Tests for parsing scalar expressions
> star = Group "star" $ map (uncurry TestScalarExpr)
> [("*", Star)
> ,("t.*", Star2 "t")
> ,("ROW(t.*,42)", App "ROW" [Star2 "t", NumLit "42"])
> ]
> app :: TestItem