Lines Matching refs:ch
134 // Returns true iff ch appears anywhere in str (excluding the
136 bool IsInSet(char ch, const char* str) {
137 return ch != '\0' && strchr(str, ch) != NULL;
140 // Returns true iff ch belongs to the given classification. Unlike
143 bool IsDigit(char ch) { return '0' <= ch && ch <= '9'; }
144 bool IsPunct(char ch) {
145 return IsInSet(ch, "^-!\"#$%&'()*+,./:;<=>?@[\\]_`{|}~");
147 bool IsRepeat(char ch) { return IsInSet(ch, "?*+"); }
148 bool IsWhiteSpace(char ch) { return IsInSet(ch, " \f\n\r\t\v"); }
149 bool IsWordChar(char ch) {
150 return ('a' <= ch && ch <= 'z') || ('A' <= ch && ch <= 'Z') ||
151 ('0' <= ch && ch <= '9') || ch == '_';
160 // matches ch. The result is undefined if the atom is invalid.
161 bool AtomMatchesChar(bool escaped, char pattern_char, char ch) {
164 case 'd': return IsDigit(ch);
165 case 'D': return !IsDigit(ch);
166 case 'f': return ch == '\f';
167 case 'n': return ch == '\n';
168 case 'r': return ch == '\r';
169 case 's': return IsWhiteSpace(ch);
170 case 'S': return !IsWhiteSpace(ch);
171 case 't': return ch == '\t';
172 case 'v': return ch == '\v';
173 case 'w': return IsWordChar(ch);
174 case 'W': return !IsWordChar(ch);
176 return IsPunct(pattern_char) && pattern_char == ch;
179 return (pattern_char == '.' && ch != '\n') || pattern_char == ch;
219 const char ch = regex[i];
221 if (ch == '^' && i > 0) {
225 } else if (ch == '$' && regex[i + 1] != '\0') {
229 } else if (IsInSet(ch, "()[]{}|")) {
231 << "'" << ch << "' is unsupported.";
233 } else if (IsRepeat(ch) && !prev_repeatable) {
235 << "'" << ch << "' can only follow a repeatable token.";
239 prev_repeatable = !IsInSet(ch, "^$?*+");