CodeQL library for Ruby
codeql/ruby-all 0.8.15-dev (changelog, source)
Search

Member predicate RegExp::charSetStart

Helper predicate for charSetStart(int start, int end).

In order to identify left brackets (‘[’) which actually start a character class, we perform a left to right scan of the string.

To avoid negative recursion we return a boolean. See escaping, the helper for escapingChar, for a clean use of this pattern.

result is true for those start chars that actually mark a start of a char set.

boolean charSetStart(int pos)