Lines Matching refs:ch

625 // Returns true iff ch appears anywhere in str (excluding the
627 bool IsInSet(char ch, const char* str) {
628 return ch != '\0' && strchr(str, ch) != NULL;
631 // Returns true iff ch belongs to the given classification. Unlike
634 bool IsAsciiDigit(char ch) { return '0' <= ch && ch <= '9'; }
635 bool IsAsciiPunct(char ch) {
636 return IsInSet(ch, "^-!\"#$%&'()*+,./:;<=>?@[\\]_`{|}~");
638 bool IsRepeat(char ch) { return IsInSet(ch, "?*+"); }
639 bool IsAsciiWhiteSpace(char ch) { return IsInSet(ch, " \f\n\r\t\v"); }
640 bool IsAsciiWordChar(char ch) {
641 return ('a' <= ch && ch <= 'z') || ('A' <= ch && ch <= 'Z') ||
642 ('0' <= ch && ch <= '9') || ch == '_';
651 // matches ch. The result is undefined if the atom is invalid.
652 bool AtomMatchesChar(bool escaped, char pattern_char, char ch) {
655 case 'd': return IsAsciiDigit(ch);
656 case 'D': return !IsAsciiDigit(ch);
657 case 'f': return ch == '\f';
658 case 'n': return ch == '\n';
659 case 'r': return ch == '\r';
660 case 's': return IsAsciiWhiteSpace(ch);
661 case 'S': return !IsAsciiWhiteSpace(ch);
662 case 't': return ch == '\t';
663 case 'v': return ch == '\v';
664 case 'w': return IsAsciiWordChar(ch);
665 case 'W': return !IsAsciiWordChar(ch);
667 return IsAsciiPunct(pattern_char) && pattern_char == ch;
670 return (pattern_char == '.' && ch != '\n') || pattern_char == ch;
710 const char ch = regex[i];
712 if (ch == '^' && i > 0) {
716 } else if (ch == '$' && regex[i + 1] != '\0') {
720 } else if (IsInSet(ch, "()[]{}|")) {
722 << "'" << ch << "' is unsupported.";
724 } else if (IsRepeat(ch) && !prev_repeatable) {
726 << "'" << ch << "' can only follow a repeatable token.";
730 prev_repeatable = !IsInSet(ch, "^$?*+");