mirror of
https://github.com/pikami/cosmium.git
synced 2025-12-20 09:20:11 +00:00
Implement IN function
This commit is contained in:
@@ -306,7 +306,7 @@ BooleanLiteral <- ("true"i / "false"i) {
|
||||
return parsers.Constant{Type: parsers.ConstantTypeBoolean, Value: boolValue}, nil
|
||||
}
|
||||
|
||||
FunctionCall <- StringFunctions / IsDefined
|
||||
FunctionCall <- StringFunctions / IsDefined / InFunction
|
||||
|
||||
StringFunctions <- StringEqualsExpression
|
||||
/ ToStringExpression
|
||||
@@ -352,6 +352,11 @@ IsDefined <- "IS_DEFINED"i ws "(" ws ex:SelectItem ws ")" {
|
||||
return parsers.FunctionCall{Type: parsers.FunctionCallIsDefined, Arguments: []interface{}{ex}}, nil
|
||||
}
|
||||
|
||||
InFunction <- ex1:SelectProperty ws "IN"i ws "(" ws ex2:SelectItem others:(ws "," ws ex:SelectItem { return ex, nil })* ws ")" {
|
||||
arguments := append([]interface{}{ex1, ex2}, others.([]interface{})...)
|
||||
return parsers.FunctionCall{Type: parsers.FunctionCallIn, Arguments: arguments}, nil
|
||||
}
|
||||
|
||||
Integer <- [0-9]+ {
|
||||
return strconv.Atoi(string(c.text))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user