Home | History | Annotate | Download | only in src

Lines Matching refs:ch

176 // Returns true iff ch appears anywhere in str (excluding the
178 bool IsInSet(char ch, const char* str) {
179 return ch != '\0' && strchr(str, ch) != NULL;
182 // Returns true iff ch belongs to the given classification. Unlike
185 bool IsAsciiDigit(char ch) { return '0' <= ch && ch <= '9'; }
186 bool IsAsciiPunct(char ch) {
187 return IsInSet(ch, "^-!\"#$%&'()*+,./:;<=>?@[\\]_`{|}~");
189 bool IsRepeat(char ch) { return IsInSet(ch, "?*+"); }
190 bool IsAsciiWhiteSpace(char ch) { return IsInSet(ch, " \f\n\r\t\v"); }
191 bool IsAsciiWordChar(char ch) {
192 return ('a' <= ch && ch <= 'z') || ('A' <= ch && ch <= 'Z') ||
193 ('0' <= ch && ch <= '9') || ch == '_';
202 // matches ch. The result is undefined if the atom is invalid.
203 bool AtomMatchesChar(bool escaped, char pattern_char, char ch) {
206 case 'd': return IsAsciiDigit(ch);
207 case 'D': return !IsAsciiDigit(ch);
208 case 'f': return ch == '\f';
209 case 'n': return ch == '\n';
210 case 'r': return ch == '\r';
211 case 's': return IsAsciiWhiteSpace(ch);
212 case 'S': return !IsAsciiWhiteSpace(ch);
213 case 't': return ch == '\t';
214 case 'v': return ch == '\v';
215 case 'w': return IsAsciiWordChar(ch);
216 case 'W': return !IsAsciiWordChar(ch);
218 return IsAsciiPunct(pattern_char) && pattern_char == ch;
221 return (pattern_char == '.' && ch != '\n') || pattern_char == ch;
261 const char ch = regex[i];
263 if (ch == '^' && i > 0) {
267 } else if (ch == '$' && regex[i + 1] != '\0') {
271 } else if (IsInSet(ch, "()[]{}|")) {
273 << "'" << ch << "' is unsupported.";
275 } else if (IsRepeat(ch) && !prev_repeatable) {
277 << "'" << ch << "' can only follow a repeatable token.";
281 prev_repeatable = !IsInSet(ch, "^$?*+");