MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / ParseCCCharacter

Method ParseCCCharacter

extern/re2/re2/parse.cc:1858–1874  ·  view source on GitHub ↗

Parses a character inside a character class. There are fewer special characters here than in the rest of the regexp. Sets *s to span the remainder of the string. Sets *rp to the character.

Source from the content-addressed store, hash-verified

1856// Sets *s to span the remainder of the string.
1857// Sets *rp to the character.
1858bool Regexp::ParseState::ParseCCCharacter(StringPiece* s, Rune *rp,
1859 const StringPiece& whole_class,
1860 RegexpStatus* status) {
1861 if (s->empty()) {
1862 status->set_code(kRegexpMissingBracket);
1863 status->set_error_arg(whole_class);
1864 return false;
1865 }
1866
1867 // Allow regular escape sequences even though
1868 // many need not be escaped in this context.
1869 if ((*s)[0] == '\\')
1870 return ParseEscape(s, rp, status, rune_max_);
1871
1872 // Otherwise take the next rune.
1873 return StringPieceToRune(rp, s, status) >= 0;
1874}
1875
1876// Parses a character class character, or, if the character
1877// is followed by a hyphen, parses a character class range.

Callers

nothing calls this directly

Calls 5

ParseEscapeFunction · 0.85
StringPieceToRuneFunction · 0.85
set_codeMethod · 0.80
set_error_argMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected