MCPcopy Create free account
hub / github.com/awslabs/aws-lambda-cpp / AtomMatchesChar

Function AtomMatchesChar

tests/gtest/gtest-all.cc:10498–10517  ·  view source on GitHub ↗

Returns true iff the given atom (specified by escaped and pattern) matches ch. The result is undefined if the atom is invalid.

Source from the content-addressed store, hash-verified

10496// Returns true iff the given atom (specified by escaped and pattern)
10497// matches ch. The result is undefined if the atom is invalid.
10498bool AtomMatchesChar(bool escaped, char pattern_char, char ch) {
10499 if (escaped) { // "\\p" where p is pattern_char.
10500 switch (pattern_char) {
10501 case 'd': return IsAsciiDigit(ch);
10502 case 'D': return !IsAsciiDigit(ch);
10503 case 'f': return ch == '\f';
10504 case 'n': return ch == '\n';
10505 case 'r': return ch == '\r';
10506 case 's': return IsAsciiWhiteSpace(ch);
10507 case 'S': return !IsAsciiWhiteSpace(ch);
10508 case 't': return ch == '\t';
10509 case 'v': return ch == '\v';
10510 case 'w': return IsAsciiWordChar(ch);
10511 case 'W': return !IsAsciiWordChar(ch);
10512 }
10513 return IsAsciiPunct(pattern_char) && pattern_char == ch;
10514 }
10515
10516 return (pattern_char == '.' && ch != '\n') || pattern_char == ch;
10517}
10518
10519// Helper function used by ValidateRegex() to format error messages.
10520static std::string FormatRegexSyntaxError(const char* regex, int index) {

Callers 2

MatchRegexAtHeadFunction · 0.85

Calls 4

IsAsciiDigitFunction · 0.85
IsAsciiWhiteSpaceFunction · 0.85
IsAsciiWordCharFunction · 0.85
IsAsciiPunctFunction · 0.85

Tested by

no test coverage detected