Implement ToString function

This commit is contained in:
Pijus Kamandulis
2024-02-23 00:11:14 +02:00
parent 59632ec966
commit 16f41a5479
7 changed files with 277 additions and 139 deletions

View File

@@ -309,6 +309,7 @@ BooleanLiteral <- ("true"i / "false"i) {
FunctionCall <- StringFunctions / IsDefined
StringFunctions <- StringEqualsExpression
/ ToStringExpression
/ ConcatExpression
/ ThreeArgumentStringFunctionExpression
@@ -316,6 +317,10 @@ StringEqualsExpression <- StringEquals ws "(" ws ex1:SelectItem ws "," ws ex2:Se
return parsers.FunctionCall{Type: parsers.FunctionCallStringEquals, Arguments: []interface{}{ex1, ex2, ignoreCase}}, nil
}
ToStringExpression <- "TOSTRING"i ws "(" ws ex:SelectItem ws ")" {
return parsers.FunctionCall{Type: parsers.FunctionCallToString, Arguments: []interface{}{ex}}, nil
}
ConcatExpression <- "CONCAT"i ws "(" ws ex1:SelectItem others:(ws "," ws ex:SelectItem { return ex, nil })+ ws ")" {
arguments := append([]interface{}{ex1}, others.([]interface{})...)
return parsers.FunctionCall{Type: parsers.FunctionCallConcat, Arguments: arguments}, nil