Home | History | Annotate | Download | only in src

Lines Matching refs:ch

174 // Returns true iff ch appears anywhere in str (excluding the
176 bool IsInSet(char ch, const char* str) {
177 return ch != '\0' && strchr(str, ch) != NULL;
180 // Returns true iff ch belongs to the given classification. Unlike
183 bool IsDigit(char ch) { return '0' <= ch && ch <= '9'; }
184 bool IsPunct(char ch) {
185 return IsInSet(ch, "^-!\"#$%&'()*+,./:;<=>?@[\\]_`{|}~");
187 bool IsRepeat(char ch) { return IsInSet(ch, "?*+"); }
188 bool IsWhiteSpace(char ch) { return IsInSet(ch, " \f\n\r\t\v"); }
189 bool IsWordChar(char ch) {
190 return ('a' <= ch && ch <= 'z') || ('A' <= ch && ch <= 'Z') ||
191 ('0' <= ch && ch <= '9') || ch == '_';
200 // matches ch. The result is undefined if the atom is invalid.
201 bool AtomMatchesChar(bool escaped, char pattern_char, char ch) {
204 case 'd': return IsDigit(ch);
205 case 'D': return !IsDigit(ch);
206 case 'f': return ch == '\f';
207 case 'n': return ch == '\n';
208 case 'r': return ch == '\r';
209 case 's': return IsWhiteSpace(ch);
210 case 'S': return !IsWhiteSpace(ch);
211 case 't': return ch == '\t';
212 case 'v': return ch == '\v';
213 case 'w': return IsWordChar(ch);
214 case 'W': return !IsWordChar(ch);
216 return IsPunct(pattern_char) && pattern_char == ch;
219 return (pattern_char == '.' && ch != '\n') || pattern_char == ch;
259 const char ch = regex[i];
261 if (ch == '^' && i > 0) {
265 } else if (ch == '$' && regex[i + 1] != '\0') {
269 } else if (IsInSet(ch, "()[]{}|")) {
271 << "'" << ch << "' is unsupported.";
273 } else if (IsRepeat(ch) && !prev_repeatable) {
275 << "'" << ch << "' can only follow a repeatable token.";
279 prev_repeatable = !IsInSet(ch, "^$?*+");