File tree Expand file tree Collapse file tree 1 file changed +23
-2
lines changed Expand file tree Collapse file tree 1 file changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,11 @@ pub fn ParsedQuery(comptime tmp_query: []const u8) type {
53
53
var pos = 0 ;
54
54
var state = .start ;
55
55
56
+ // This holds the starting character of the string while
57
+ // state is .inside_string so that we know which type of
58
+ // string we're exiting from
59
+ var string_starting_character = null ;
60
+
56
61
var current_bind_marker_type : [256 ]u8 = undefined ;
57
62
var current_bind_marker_type_pos = 0 ;
58
63
@@ -75,6 +80,7 @@ pub fn ParsedQuery(comptime tmp_query: []const u8) type {
75
80
},
76
81
'\' ' , '"' , '[' , '`' = > {
77
82
state = .inside_string ;
83
+ string_starting_character = c ;
78
84
buf [pos ] = c ;
79
85
pos += 1 ;
80
86
},
@@ -84,8 +90,23 @@ pub fn ParsedQuery(comptime tmp_query: []const u8) type {
84
90
},
85
91
},
86
92
.inside_string = > switch (c ) {
87
- '\' ' , '"' , ']' , '`' = > {
88
- state = .start ;
93
+ '\' ' = > {
94
+ if (string_starting_character == '\' ' ) state = .start ;
95
+ buf [pos ] = c ;
96
+ pos += 1 ;
97
+ },
98
+ '"' = > {
99
+ if (string_starting_character == '"' ) state = .start ;
100
+ buf [pos ] = c ;
101
+ pos += 1 ;
102
+ },
103
+ ']' = > {
104
+ if (string_starting_character == '[' ) state = .start ;
105
+ buf [pos ] = c ;
106
+ pos += 1 ;
107
+ },
108
+ '`' = > {
109
+ if (string_starting_character == '`' ) state = .start ;
89
110
buf [pos ] = c ;
90
111
pos += 1 ;
91
112
},
You can’t perform that action at this time.
0 commit comments