Lines Matching refs:match
302 # match those on a word boundary.
341 # Match start of assembly blocks
409 def Match(pattern, s):
411 # The regexp compilation caching is inlined in both Match and Search for
416 return _regexp_compile_cache[pattern].match(s)
708 if Match(r'T(EST|est)', self.current_function):
922 line = line.replace(r'\\', 'XX') # after this, \\" does not match to \"
1021 if not _RE_PATTERN_INCLUDE.match(elided):
1195 '#ifndef and #define don\'t match, suggested CPP variable is: %s' %
1352 if _RE_PATTERN_INVALID_INCREMENT.match(line):
1451 and not Match(r'};*\s*(//|/\*).*\bnamespace\b', line)):
1468 if not Match((r'};*\s*(//|/\*).*\bnamespace\s+' + re.escape(self.name) +
1476 if not Match(r'};*\s*(//|/\*).*\bnamespace[\*/\.\\\s]*$', line):
1549 if Match(r'^\s*#\s*(if|ifdef|ifndef)\b', line):
1553 elif Match(r'^\s*#\s*(else|elif)\b', line):
1568 elif Match(r'^\s*#\s*endif\b', line):
1609 _MATCH_ASM.match(line)):
1625 # Match start of namespace. The "\b\s*" below catches namespace
1629 namespace_decl_match = Match(r'^\s*namespace\b\s*([:\w]+)?(.*)$', line)
1662 class_decl_match = Match(
1680 access_match = Match(r'\s*(public|private|protected)\s*:', line)
1686 # Match first brace, semicolon, or closed parenthesis.
1687 matched = Match(r'^[^{;)}]*([{;)}])(.*)$', line)
1700 if _MATCH_ASM.match(line):
1808 if Match(r'\s*#\s*endif\s*[^/\s]+', line):
1812 if Match(r'\s*class\s+(\w+\s*::\s*)+\w+\s*;', line):
1846 args = Match(r'\s+(?:inline\s+)?%s\s*\(([^,()]+)\)'
1851 not Match(r'(const\s+)?%s\s*(?:<\w+>\s*)?&' % re.escape(base_classname),
1876 match = Search(pattern, line)
1877 if match:
1878 fncall = match.group(1) # look inside the parens for function calls
1970 match_result = Match(regexp, line)
1976 not Match(r'[A-Z_]+$', function_name)):
1990 if Match(r'TEST', function): # Handle TEST... macros
2002 elif Match(r'^\}\s*$', line): # function end
2005 elif not Match(r'^\s*$', line):
2021 match = _RE_PATTERN_TODO.match(comment)
2022 if match:
2024 leading_whitespace = match.group(1)
2029 username = match.group(2)
2035 middle_whitespace = match.group(3)
2054 matched = Match((r'\s*(DISALLOW_COPY_AND_ASSIGN|'
2095 match = Search(r'^[^<>(),;\[\]]*([<>(),;\[\]])(.*)$', line)
2096 if match:
2098 operator = match.group(1)
2099 line = match.group(2)
2157 match = Search(r'^(.*)([<>(),;\[\]])[^<>(),;\[\]]*$', line)
2158 if match:
2160 operator = match.group(2)
2161 line = match.group(1)
2249 if Match(r' {6}\w', prev_line): # Initializer list?
2254 and Match(r' {6}\w', elided[search_position])):
2265 exception = (Match(r' {4}\w[^\(]*\)\s*(const\s*)?(\{\s*$|:)',
2267 or Match(r' {4}:', prev_line))
2283 and Match(r'\s*}', next_line)
2288 matched = Match(r'\s*(public|protected|private):', prev_line)
2301 if (not Match(r'^\s*{ //', line) and
2318 match = (Search(r'[=/-]{4,}\s*$', line[commentend:]) or
2321 if not match:
2347 match = Search(r'[^<>=!\s](==|!=|<=|>=)[^<>=!\s]', line)
2348 if match:
2350 'Missing spaces around %s' % match.group(1))
2353 match = Search(r'(\S)(?:L|UL|ULL|l|ul|ull)?<<(\S)', line)
2354 if match and not (match.group(1).isdigit() and match.group(2).isdigit()):
2357 elif not Match(r'#.*include', line):
2365 match = Search(r'[^\s<]<([^\s=<].*)', reduced_line)
2366 if (match and
2367 not FindNextMatchingAngleBracket(clean_lines, linenum, match.group(1))):
2374 match = Search(r'^(.*[^\s>])>[^\s=>]', reduced_line)
2375 if (match and
2377 match.group(1))):
2393 match = Search(r'>>[a-zA-Z_]', line)
2394 if match:
2399 match = Search(r'(!\s|~\s|[\s]--[\s;]|[\s]\+\+[\s;])', line)
2400 if match:
2402 'Extra space for operator %s' % match.group(1))
2405 match = Search(r' (if\(|for\(|while\(|switch\()', line)
2406 if match:
2408 'Missing space before ( in %s' % match.group(1))
2415 match = Search(r'\b(if|for|while|switch)\s*'
2418 if match:
2419 if len(match.group(2)) != len(match.group(4)):
2420 if not (match.group(3) == ';' and
2421 len(match.group(2)) == 1 + len(match.group(4)) or
2422 not match.group(2) and Search(r'\bfor\s*\(.*; \)', line)):
2424 'Mismatching spaces inside () in %s' % match.group(1))
2425 if not len(match.group(2)) in [0, 1]:
2428 match.group(1))
2516 matched = Match(r'\s*(public|protected|private):', clean_lines.lines[linenum])
2579 if Match(r'\s*{\s*$', line):
2589 not Match(r'\s*#', prevline)):
2594 if Match(r'\s*else\s*', line):
2596 if Match(r'\s*}\s*$', prevline):
2602 if Search(r'}\s*else[^{]*$', line) or Match(r'[^}]*else\s*{', line):
2622 if Match(r'\s*do [^\s{]', line):
2632 if Match(r'\s+{.*}\s*;', line) and not prevline.count(';'):
2657 if Match(r'\s*(for|while)\s*\(', line):
2665 if end_pos >= 0 and Match(r';', end_line[end_pos:]):
2688 # Expression to match two sides of the operator with something that
2702 return Match(match_this, line) and not Search(r'NULL|&&|\|\|', line)
2750 if Match(r'^\s*#', line):
2764 for match in _ALT_TOKEN_REPLACEMENT_PATTERN.finditer(line):
2767 _ALT_TOKEN_REPLACEMENT[match.group(1)], match.group(1)))
2822 # if(match($0, " +(error|private|public|protected):")) complain = 0;
2823 # if(match(prev, "&& *$")) complain = 0;
2824 # if(match(prev, "\\|\\| *$")) complain = 0;
2825 # if(match(prev, "[\",=><] *$")) complain = 0;
2826 # if(match($0, " <<")) complain = 0;
2827 # if(match(prev, " +for \\(")) complain = 0;
2828 # if(prevodd && match(prevprev, " +for \\(")) complain = 0;
2838 not Match(r'\s*\w+\s*:\s*$', cleansed_line)):
2869 not Match(r'^\s*//.*http(s?)://\S*$', line) and
2870 not Match(r'^// \$Id:.*#[0-9]+ \$$', line)):
2906 # _RE_FIRST_COMPONENT.match('foo').group(0) == 'foo'
2907 # _RE_FIRST_COMPONENT.match('foo.cc').group(0) == 'foo'
2908 # _RE_FIRST_COMPONENT.match('foo-bar_baz.cc').group(0) == 'foo'
2909 # _RE_FIRST_COMPONENT.match('foo_bar-baz.cc').group(0) == 'foo'
3007 target_first_component = _RE_FIRST_COMPONENT.match(target_base)
3008 include_first_component = _RE_FIRST_COMPONENT.match(include_base)
3044 match = _RE_PATTERN_INCLUDE.search(line)
3045 if match:
3046 include = match.group(2)
3047 is_system = (match.group(1) == '<')
3077 match = _RE_PATTERN_INCLUDE.match(line)
3078 if match:
3079 include = match.group(2)
3080 if Match(r'(f|ind|io|i|o|parse|pf|stdio|str|)?stream$', include):
3096 start_pattern must match string having an open punctuation symbol at the end.
3115 match = re.search(start_pattern, text, re.M)
3116 if not match: # start_pattern not found in text.
3118 start_position = match.end(0)
3139 # punctuations match.
3164 match = _RE_PATTERN_INCLUDE.search(line)
3165 if match:
3211 match = Search(
3214 if match:
3220 if (match.group(1) is None and # If new operator, then this isn't a cast
3221 not (Match(r'^\s*MOCK_(CONST_)?METHOD\d+(_T)?\(', line) or
3222 Match(r'^\s*MockCallback<.*>', line))):
3230 not Match(r'^\s*MOCK_(CONST_)?METHOD\d+(_T)?\(\S+,\s*$',
3235 match.group(2))
3266 match = Match(
3272 if match and not Match(r'\s*(<.*>)?(::[a-zA-Z0-9_]+)?\s*\(([^"]|$)',
3273 match.group(3)):
3277 (match.group(1), match.group(2)))
3305 match = Search(r'\b(short|long(?! +double)|long long)\b', line)
3306 if match:
3308 'Use int16/int64/etc, rather than the C type %s' % match.group(1))
3311 match = Search(r'snprintf\s*\(([^,]*),\s*([0-9]*)\s*,', line)
3312 if match and match.group(2) != '0':
3316 'to snprintf.' % (match.group(1), match.group(2)))
3322 match = Search(r'\b(strcpy|strcat)\b', line)
3323 if match:
3325 'Almost always, snprintf is better than %s' % match.group(1))
3356 match = Match(r'([\w.\->()]+)$', printf_args)
3357 if match and match.group(1) != '__VA_ARGS__':
3362 % (function_name, match.group(1)))
3365 match = Search(r'memset\s*\(([^,]*),\s*([^,]*),\s*0\s*\)', line)
3366 if match and not Match(r"^''|-?[0-9]+|0x[0-9A-Fa-f]$", match.group(2)):
3369 % (match.group(1), match.group(2)))
3377 match = Match(r'\s*(.+::)?(\w+) [a-z]\w*\[(.+)];', line)
3378 if (match and match.group(2) != 'return' and match.group(2) != 'delete' and
3379 match.group(3).find(']') == -1):
3383 tokens = re.split(r'\s|\+|\-|\*|\/|<<|>>]', match.group(3))
3397 if Match(r'\d+', tok): continue
3398 if Match(r'0[xX][0-9a-fA-F]+', tok): continue
3399 if Match(r'k[A-Z0-9]\w*', tok): continue
3400 if Match(r'(.+::)?k[A-Z0-9]\w*', tok): continue
3401 if Match(r'(.+::)?[A-Z][A-Z0-9_]*', tok): continue
3418 match = Match(
3423 if match and linenum + 1 < clean_lines.NumLines():
3433 match.group(1) + ' should be the last thing in the class')
3467 match = Search(pattern, line)
3468 if not match:
3472 sizeof_match = Match(r'.*sizeof\s*$', line[0:match.start(1) - 1])
3479 if (line[0:match.start(1) - 1].endswith(' operator++') or
3480 line[0:match.start(1) - 1].endswith(' operator--')):
3483 remainder = line[match.end(0):]
3497 function_match = Match(r'\s*(\)|=|(const)?\s*(;|\{|throw\(\)|>))', remainder)
3510 (cast_type, match.group(1)))
3557 # Match max<type>(..., ...), max(..., ...), but not foo->max, foo.max or
3648 match = _RE_PATTERN_INCLUDE.search(clean_line)
3649 if match:
3650 include = match.group(2)
3687 # (We check only the first match per line; good enough.)
3767 match = _RE_PATTERN_EXPLICIT_MAKEPAIR.search(line)
3768 if match: