• Home
  • Raw
  • Download

Lines Matching refs:line

420         self._row_lengths = [len(line) + 1 for line in trimmed_lines]
718 def is_cpp_string(line): argument
731 line = line.replace(r'\\', 'XX') # after this, \\" does not match to \"
732 return ((line.count('"') - line.count(r'\"') - line.count("'\"'")) & 1) == 1
779 def cleanse_comments(line): argument
788 comment_position = line.find('//')
789 if comment_position != -1 and not is_cpp_string(line[:comment_position]):
790 line = line[:comment_position]
792 return _RE_PATTERN_CLEANSE_LINE_C_COMMENTS.sub('', line)
854 line = elided[position.row]
855 start_character = line[position.column]
868 for line in elided[position.row:]:
869 line = line[current_column:]
873 next_enclosing_character = search(enclosing_character_regex, line)
878 line = line[next_enclosing_character.end(0):]
898 for line in xrange(1, min(len(lines), 11)):
899 if re.search(r'Copyright', lines[line], re.I):
950 for line_number, line in enumerate(lines):
951 line_split = line.split()
987 for line_number, line in enumerate(lines):
988 if u'\ufffd' in line:
1026 line = clean_lines.elided[line_number]
1030 line = line.replace('\\\\', '')
1032 if line.count('/*') > line.count('*/'):
1040 if (line.count('"') - line.count('\\"')) % 2:
1078 line = clean_lines.elided[line_number]
1080 index = line.find(single_thread_function)
1082 if index >= 0 and (index == 0 or (not line[index - 1].isalnum()
1083 and line[index - 1] not in ('_', '.', '>'))):
1111 line = clean_lines.elided[line_number]
1112 if _RE_PATTERN_INVALID_INCREMENT.match(line):
1181 for line in self._clean_lines.elided:
1184 if line.startswith("@") or line.startswith("#import"):
1226 line = clean_lines.lines[line_number]
1228 if search(r'printf\s*\(.*".*%[-+ ]?\d*q', line):
1232 if search(r'printf\s*\(.*".*%\d+\$', line):
1237 line = line.replace('\\\\', '')
1239 if search(r'("|\').*\\(%|\[|\(|{)', line):
1244 line = clean_lines.elided[line_number]
1250 line):
1254 if match(r'\s*#\s*endif\s*[^/\s]+', line):
1258 if match(r'\s*class\s+(\w+\s*::\s*)+\w+\s*;', line):
1262 if search(r'(\w+|[+-]?\d+(\.\d*)?)\s*(<|>)\?=?\s*(\w+|[+-]?\d+)(\.\d*)?', line):
1274 r'\s*(template\s*<[\w\s<>,:]*>\s*)?(class|struct)\s+(\w+(::\w+)*)', line)
1290 if line.find(';') != -1:
1293 classinfo.seen_open_brace = (line.find('{') != -1)
1295 if search('(^|[^:]):($|[^:])', line):
1308 line)
1317 if search(r'\bvirtual\b', line):
1322 if search(r'~%s\s*\(' % base_classname, line):
1327 brace_depth = brace_depth + line.count('{') - line.count('}')
1346 def check_spacing_for_function_call(line, line_number, error): argument
1359 function_call = line # if there's no control flow construct, look at whole line
1365 matched = search(pattern, line)
1406 def is_blank_line(line): argument
1418 return not line or line.isspace()
1444 line = lines[line_number]
1453 match_result = match(regexp, line)
1473 line_with_no_templates = iteratively_replace_matches_with_char(r'<[^<>]*>', '_', line)
1480 function = line[match_function.start(1):match_function.end(1)]
1531 line = lines[line_number]
1538 elif not match(r'^\s*$', line):
1635 line = lines[line_number]
1637 matched_pass_ptr = match(r'^\s*Pass([A-Z][A-Za-z]*)Ptr<', line)
1662 line = raw[line_number]
1667 if is_blank_line(line):
1731 comment_position = line.find('//')
1735 …if (line.count('"', 0, comment_position) - line.count('\\"', 0, comment_position)) % 2 == 0: # n…
1737 if (not match(r'^\s*$', line[:comment_position])
1739 and ((line[comment_position - 1] not in string.whitespace)
1741 and line[comment_position - 2] in string.whitespace)))):
1746 if commentend < len(line) and not line[commentend] == ' ':
1752 matched = (search(r'[=/-]{4,}\s*$', line[commentend:])
1753 or search(r'^/+ ', line[commentend:]))
1759 if search('[.!?,;:]\s\s', line[comment_position:]):
1763 line = clean_lines.elided[line_number] # get rid of comments and strings
1766line = sub(r'operator(==|!=|<|<<|<=|>=|>>|>|\+=|-=|\*=|/=|%=|&=|\|=|^=|<<=|>>=)\(', 'operator\(',
1769 if match(r'\s*#\s*(?:include|import)', line):
1771 if search(r'[\w.]=[\w.]', line):
1781 … = search(r'[^<>=!\s](==|!=|\+=|-=|\*=|/=|/|\|=|&=|<<=|>>=|<=|>=|\|\||\||&&|>>|<<)[^<>=!\s]', line)
1787 if not search(r'<[^<]*,\s*$', line): # template params spill
1788 matched = search(r'[^<>=!\s](<)[^<>=!\s]([^>]|->)*$', line)
1794 matched = search(r'(!\s|~\s|[\s]--[\s;]|[\s]\+\+[\s;])', line)
1800 matched = search(r' (if\(|for\(|foreach\(|while\(|switch\()', line)
1810 matched = search(r'\b(?P<statement>if|for|foreach|while|switch)\s*\((?P<remainder>.*)$', line)
1831 in_preprocessor_directive = match(r'\s*#', line)
1837 if search(r',[^\s]', line):
1841 matched = search(r'^\s*(?P<token1>[a-zA-Z0-9_\*&]+)\s\s+(?P<token2>[a-zA-Z0-9_\*&]+)', line)
1848 matched = match(r'\s*\w+(?<!\breturn|\bdelete)\s+(?P<pointer_operator>\*|\&)\w+', line)
1855 matched = search(r'^\s*\w+\*\s+\w+', line)
1861 check_spacing_for_function_call(line, line_number, error)
1866 if search(r'[^ ({]{', line):
1871 if search(r'}else', line):
1877 if search(r'\w\s+\[', line) and not search(r'delete\s+\[', line):
1884 if search(r':\s*;\s*$', line):
1887 elif search(r'^\s*;\s*$', line):
1891 elif (search(r'\s+;\s*$', line) and not search(r'\bfor\b', line)):
1895 elif (search(r'\b(for|while)\s*\(.*\)\s*;\s*$', line)
1896 and line.count('(') == line.count(')')
1898 and not search(r'}\s*while', line)):
1938 line = clean_lines.elided[line_number] # Get rid of comments and strings.
1940 namespace_match = match(r'(?P<namespace_indentation>\s*)namespace\s+\S+\s*{\s*$', line)
1990 line = clean_lines.elided[line_number] # Get rid of comments and strings.
1992 using_std_match = match(r'\s*using\s+std::(?P<method_name>\S+)\s*;\s*$', line)
2016 line = clean_lines.elided[line_number] # Get rid of comments and strings.
2018 max_min_macros_search = search(r'\b(?P<max_min_macro>(MAX|MIN))\s*\(', line)
2038 line = clean_lines.elided[line_number] # Get rid of comments and strings.
2040 switch_match = match(r'(?P<switch_indentation>\s*)switch\s*\(.+\)\s*{\s*$', line)
2108 line = clean_lines.elided[line_number] # Get rid of comments and strings.
2110 if match(r'\s*{\s*$', line):
2125 elif (search(r'\)\s*(const\s*)?{\s*$', line)
2126 and line.count('(') == line.count(')')
2127 and not search(r'\b(if|for|foreach|while|switch)\b', line)
2128 and not match(r'\s+[A-Z_][A-Z_0-9]+\b', line)):
2132 if (match(r'\s*}\s*(else\s*({\s*)?)?$', line) and line_number > 1):
2143 if match(r'\s*else\s*', line):
2150 if search(r'\belse [^\s{]', line) and not search(r'\belse if\b', line):
2155 if match(r'\s*do [^\s{]', line):
2165 if match(r'\s+{.*}\s*;', line) and not previous_line.count(';'):
2166 line = previous_line + line
2169 if (search(r'{.*}\s*;', line)
2170 and line.count('{') == line.count('}')
2171 and not search(r'struct|class|enum|\s*=\s*{', line)):
2187 line = clean_lines.elided[line_number] # Get rid of comments and strings.
2189 …e_match = match(r'(?P<else_indentation>\s*)(\}\s*)?else(\s+if\s*\(|(?P<else>\s*(\{\s*)?\Z))', line)
2265 def replaceable_check(operator, macro, line): argument
2297 return match(match_this, line) and not search(r'NULL|&&|\|\|', line)
2320 line = clean_lines.elided[line_number] # get rid of comments and strings
2324 if replaceable_check(operator, current_macro, line):
2334 line = clean_lines.elided[line_number]
2337 …if search(r'[=!]=\s*(NULL|0|true|false)\W', line) or search(r'\W(NULL|0|true|false)\s*[=!]=', line
2347 line = clean_lines.elided[line_number]
2350 if search(r'\bg(_[a-z]+)+\b', line):
2354 if search(r'\bgst_\w+_many\b', line):
2358 if search(r'\bg_str(join|concat)\b', line):
2362 if search(r'\bgdk_pixbuf_save_to\w+\b', line):
2366 if search(r'\bgtk_widget_style_get\(\w+\b', line):
2369 if search(r'\bNULL\b', line):
2373 line = clean_lines.raw_lines[line_number]
2377 if search(r'\bNULL\b', line) and search(r'\bNULL\b', CleansedLines.collapse_strings(line)):
2380 def get_line_width(line): argument
2390 if isinstance(line, unicode):
2392 for c in unicodedata.normalize('NFC', line):
2398 return len(line)
2420 line = raw_lines[line_number]
2422 if line.find('\t') != -1:
2440 while initial_spaces < len(line) and line[initial_spaces] == ' ':
2442 if line and line[-1].isspace():
2452 elif not initial_spaces and line[:2] != '//':
2453 label_match = match(r'(?P<label>[^:]+):\s*$', line)
2475 and not (match(r'.*\(.*\).*{.*.}', line)
2477 and line.count('{') == line.count('}'))
2633 line = clean_lines.lines[line_number]
2635 matched = _RE_PATTERN_INCLUDE.search(line)
2697 if previous_header_type == _OTHER_HEADER and previous_line.strip() > line.strip():
2731 line = clean_lines.elided[line_number]
2732 if not line:
2735 matched = _RE_PATTERN_INCLUDE.search(line)
2747 r'\b(int|float|double|bool|char|int32|uint32|int64|uint64)\([^)]', line)
2752 if not match(r'^\s*MOCK_(CONST_)?METHOD\d+(_T)?\(', line):
2758 check_c_style_cast(line_number, line, clean_lines.raw_lines[line_number],
2763 check_c_style_cast(line_number, line, clean_lines.raw_lines[line_number],
2770 r'(&\([^)]+\)[\w(])|(&(static|dynamic|reinterpret)_cast\b)', line):
2781 line)
2793 if search(r'\bdynamic_cast<', line):
2799 if search(r'\b([A-Za-z0-9_]*_)\(\1\)', line):
2811 if search(r'\bshort port\b', line):
2812 if not search(r'\bunsigned short port\b', line):
2817 matched = search(r'snprintf\s*\(([^,]*),\s*([0-9]*)\s*,', line)
2824 if search(r'\bsprintf\b', line):
2827 matched = search(r'\b(strcpy|strcat)\b', line)
2832 if search(r'\bsscanf\b', line):
2838 if search(r'\}\s*if\s*\(', line):
2845 matched = re.search(r'\b((?:string)?printf)\s*\(([\w.\->()]+)\)', line, re.I)
2852 matched = search(r'memset\s*\(([^,]*),\s*([^,]*),\s*0\s*\)', line)
2859 matched = match(r'\s*(.+::)?(\w+) [a-z]\w*\[(.+)];', line)
2909 and search(r'\bnamespace\s*{', line)
2910 and line[-1] != '\\'):
2916 check_identifier_name_in_declaration(filename, line_number, line, file_state, error)
2919 def check_identifier_name_in_declaration(filename, line_number, line, file_state, error): argument
2935 if match(r'\s*(return|delete)\b', line):
2945 line = sub(r'long (long )?(?=long|double|int)', '', line)
2947 line = sub(r'(unsigned|signed) (?=char|short|int|long)', '', line)
2948line = sub(r'\b(inline|using|static|const|volatile|auto|register|extern|typedef|restrict|struct|cl…
2951 line = sub(r'new\s*(\([^)]*\))?', '', line)
2956 line, number_of_replacements = subn(r'<([\w\s:]|::)+\s*[*&]*\s*>', '', line)
2973 line = sub(r'^\s*for\s*\(', '', line)
2974 line, control_statement = subn(r'^\s*(while|else if|if|switch)\s*\(', '', line)
2993 matched = match(declaration_regexp, line)
3038 line = line[matched.end():]
3040 def check_c_style_cast(line_number, line, raw_line, cast_type, pattern, argument
3055 matched = search(pattern, line)
3060 sizeof_match = match(r'.*sizeof\s*$', line[0:matched.start(1) - 1])
3066 remainder = line[matched.end(0):]
3230 for line in header_file:
3232 clean_line = cleanse_comments(line)
3261 line = clean_lines.elided[line_number]
3262 if not line or line[0] == '#':
3266 if _RE_PATTERN_STRING.search(line):
3270 if pattern.search(line):
3274 if not '<' in line: # Reduces the cpu time usage by skipping lines.
3278 if pattern.search(line):
3331 clean_lines, line, include_state, function_state,
3352 detect_functions(clean_lines, line, function_state, error)
3353 check_for_function_lengths(clean_lines, line, function_state, error)
3354 if search(r'\bNOLINT\b', raw_lines[line]): # ignore nolint lines
3356 check_function_definition(filename, file_extension, clean_lines, line, function_state, error)
3357 check_pass_ptr_usage(clean_lines, line, function_state, error)
3358 check_for_multiline_comments_and_strings(clean_lines, line, error)
3359 check_style(clean_lines, line, file_extension, class_state, file_state, error)
3360 check_language(filename, clean_lines, line, file_extension, include_state,
3362 check_for_non_standard_constructs(clean_lines, line, class_state, error)
3363 check_posix_threading(clean_lines, line, error)
3364 check_invalid_increment(clean_lines, line, error)
3392 for line in xrange(clean_lines.num_lines()):
3393 process_line(filename, file_extension, clean_lines, line,