You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* In order to avoid negative recusrion, we return a boolean.
197
200
* This way, we can refer to `escaping(pos - 1).booleanNot()`
198
201
* rather than to a negated version of `escaping(pos)`.
202
+
* Does not take into account escape characters inside quote sequences.
199
203
*/
200
204
privatebooleanescaping(intpos){
201
205
pos=-1andresult=false
@@ -205,14 +209,62 @@ abstract class RegexString extends Expr {
205
209
this.getChar(pos)!="\\"andresult=false
206
210
}
207
211
212
+
/**
213
+
* Helper predicate for `quoteSequence`.
214
+
* Holds if the char at `pos` could be the beginning of a quote delimiter, i.e. `\Q` (non-escaped) or `\E` (escaping not checked, as quote sequences turn off escapes).
215
+
* Result is `true` for `\Q` and `false` for `\E`.
216
+
*/
217
+
privatebooleanquote_delimiter(intpos){
218
+
result=trueand
219
+
this.escaping(pos)=trueand
220
+
this.getChar(pos+1)="Q"
221
+
or
222
+
result=falseand
223
+
this.getChar(pos)="\\"and
224
+
this.getChar(pos+1)="E"
225
+
}
226
+
227
+
/**
228
+
* Helper predicate for `quoteSequence`.
229
+
* Holds if the char at `pos` is the one-based `index`th occourence of a quote delimiter (`\Q` or `\E`)
0 commit comments