@@ -26,6 +26,7 @@ func ParseFunction(in string, remainder string) (Node, error) {
2626 rightparentheses := 0
2727 singlequotes := 0
2828 doublequotes := 0
29+ backticks := 0
2930
3031 in = strings .TrimSpace (in )
3132 s := ""
@@ -36,10 +37,12 @@ func ParseFunction(in string, remainder string) (Node, error) {
3637
3738 s += string (c )
3839
39- if c == '"' && singlequotes == 0 {
40+ if c == '"' && singlequotes == 0 && backticks == 0 {
4041 doublequotes ^= 1
41- } else if c == '\'' && doublequotes == 0 {
42+ } else if c == '\'' && doublequotes == 0 && backticks == 0 {
4243 singlequotes ^= 1
44+ } else if c == '`' && singlequotes == 0 && doublequotes == 0 {
45+ backticks ^= 1
4346 } else if c == '(' {
4447 leftparentheses += 1
4548
@@ -52,7 +55,7 @@ func ParseFunction(in string, remainder string) (Node, error) {
5255
5356 rightparentheses += 1
5457
55- if singlequotes == 0 && doublequotes == 0 {
58+ if singlequotes == 0 && doublequotes == 0 && backticks == 0 {
5659 if leftparentheses - rightparentheses == 1 {
5760 // if leftparentheses-rightparentheses > 0 {
5861 subFunction , err := ParseFunction (strings .TrimSpace (s ), "" )
@@ -64,7 +67,7 @@ func ParseFunction(in string, remainder string) (Node, error) {
6467 } else if leftparentheses == rightparentheses {
6568 s = strings .TrimSpace (s [0 : len (s )- 1 ])
6669 if len (s ) > 0 {
67- if len (s ) >= 2 && ((strings .HasPrefix (s , "'" ) && strings .HasSuffix (s , "'" )) || (strings .HasPrefix (s , "\" " ) && strings .HasSuffix (s , "\" " ))) {
70+ if len (s ) >= 2 && ((strings .HasPrefix (s , "'" ) && strings .HasSuffix (s , "'" )) || (strings .HasPrefix (s , "\" " ) && strings .HasSuffix (s , "\" " )) || ( strings . HasPrefix ( s , "`" ) && strings . HasSuffix ( s , "`" )) ) {
6871 arguments = append (arguments , & Literal {Value : s [1 : len (s )- 1 ]})
6972 } else if strings .HasPrefix (strings .TrimLeftFunc (s , unicode .IsSpace ), "@" ) {
7073 arguments = append (arguments , & Attribute {Name : strings .TrimLeftFunc (s , unicode .IsSpace )[1 :]})
@@ -84,10 +87,10 @@ func ParseFunction(in string, remainder string) (Node, error) {
8487
8588 //s = ""
8689
87- } else if singlequotes == 0 && doublequotes == 0 && (leftparentheses - rightparentheses ) == 1 && c == ',' {
90+ } else if singlequotes == 0 && doublequotes == 0 && backticks == 0 && (leftparentheses - rightparentheses ) == 1 && c == ',' {
8891 s = strings .TrimSpace (s [0 : len (s )- 1 ])
8992 if len (s ) > 0 {
90- if len (s ) >= 2 && ((strings .HasPrefix (s , "'" ) && strings .HasSuffix (s , "'" )) || (strings .HasPrefix (s , "\" " ) && strings .HasSuffix (s , "\" " ))) {
93+ if len (s ) >= 2 && ((strings .HasPrefix (s , "'" ) && strings .HasSuffix (s , "'" )) || (strings .HasPrefix (s , "\" " ) && strings .HasSuffix (s , "\" " )) || ( strings . HasPrefix ( s , "`" ) && strings . HasSuffix ( s , "`" )) ) {
9194 arguments = append (arguments , & Literal {Value : s [1 : len (s )- 1 ]})
9295 } else if strings .HasPrefix (strings .TrimLeftFunc (s , unicode .IsSpace ), "@" ) {
9396 arguments = append (arguments , & Attribute {Name : strings .TrimLeftFunc (s , unicode .IsSpace )[1 :]})
0 commit comments