left factor identifier and app parsers
This commit is contained in:
parent
a296b1ec31
commit
df1f948b5d
|
@ -126,18 +126,12 @@ which parses as a typed literal
|
||||||
> literal :: Parser ValueExpr
|
> literal :: Parser ValueExpr
|
||||||
> literal = number <|> stringValue <|> interval
|
> literal = number <|> stringValue <|> interval
|
||||||
|
|
||||||
== identifiers
|
== Names
|
||||||
|
|
||||||
Uses the identifierString 'lexer'. See this function for notes on
|
|
||||||
identifiers.
|
|
||||||
|
|
||||||
> name :: Parser Name
|
> name :: Parser Name
|
||||||
> name = choice [QName <$> quotedIdentifier
|
> name = choice [QName <$> quotedIdentifier
|
||||||
> ,Name <$> identifierBlacklist blacklist]
|
> ,Name <$> identifierBlacklist blacklist]
|
||||||
|
|
||||||
> iden :: Parser ValueExpr
|
|
||||||
> iden = Iden <$> name
|
|
||||||
|
|
||||||
== star
|
== star
|
||||||
|
|
||||||
used in select *, select x.*, and agg(*) variations, and some other
|
used in select *, select x.*, and agg(*) variations, and some other
|
||||||
|
@ -175,11 +169,10 @@ The parsing for the aggregate extensions is here as well:
|
||||||
|
|
||||||
aggregate([all|distinct] args [order by orderitems])
|
aggregate([all|distinct] args [order by orderitems])
|
||||||
|
|
||||||
> aggOrApp :: Parser ValueExpr
|
> aggOrApp :: Name -> Parser ValueExpr
|
||||||
> aggOrApp =
|
> aggOrApp n =
|
||||||
> makeApp
|
> makeApp n
|
||||||
> <$> name
|
> <$> parens ((,,) <$> duplicates
|
||||||
> <*> parens ((,,) <$> duplicates
|
|
||||||
> <*> choice [commaSep valueExpr]
|
> <*> choice [commaSep valueExpr]
|
||||||
> <*> (optionMaybe orderBy))
|
> <*> (optionMaybe orderBy))
|
||||||
> where
|
> where
|
||||||
|
@ -238,8 +231,20 @@ always used with the optionSuffix combinator.
|
||||||
> mkFrame rs c = c rs
|
> mkFrame rs c = c rs
|
||||||
> windowSuffix _ = fail ""
|
> windowSuffix _ = fail ""
|
||||||
|
|
||||||
> app :: Parser ValueExpr
|
> app :: Name -> Parser ValueExpr
|
||||||
> app = aggOrApp >>= optionSuffix windowSuffix
|
> app x = aggOrApp x >>= optionSuffix windowSuffix
|
||||||
|
|
||||||
|
== iden prefix term
|
||||||
|
|
||||||
|
all the value expressions which start with an identifier
|
||||||
|
|
||||||
|
(todo: really put all of them here instead of just some of them)
|
||||||
|
|
||||||
|
> idenPrefixTerm :: Parser ValueExpr
|
||||||
|
> idenPrefixTerm = do
|
||||||
|
> n <- name
|
||||||
|
> choice [app n
|
||||||
|
> ,return $ Iden n]
|
||||||
|
|
||||||
== case expression
|
== case expression
|
||||||
|
|
||||||
|
@ -586,12 +591,11 @@ fragile and could at least do with some heavy explanation.
|
||||||
> ,hostParameter
|
> ,hostParameter
|
||||||
> ,caseValue
|
> ,caseValue
|
||||||
> ,cast
|
> ,cast
|
||||||
> ,try specialOpKs
|
|
||||||
> ,parensTerm
|
> ,parensTerm
|
||||||
> ,subquery
|
> ,subquery
|
||||||
> ,try app
|
> ,try specialOpKs
|
||||||
> ,star
|
> ,star
|
||||||
> ,iden]
|
> ,idenPrefixTerm]
|
||||||
> <?> "value expression"
|
> <?> "value expression"
|
||||||
|
|
||||||
expose the b expression for window frame clause range between
|
expose the b expression for window frame clause range between
|
||||||
|
|
Loading…
Reference in a new issue