Lines Matching refs:line
19 test for correctness. Preprocessing works on a single line at a time but
20 maintains state between consecutive lines so it can preprocessess multi-line
23 - Strip C++ style comments from a line.
25 ends on the same line it will be replaced with 'comment'.
46 def __call__ (self, line):
48 Strip the provided line of C and C++ comments. Stripping of multi-line
52 line = self.define_hack_re.sub (r'\1 (', line)
54 line = self.process_strings (line)
58 line = re.sub ("( |\t*)//.*", '', line)
61 open_comment = line.find ('/*')
62 close_comment = line.find ('*/')
65 # Inside a comment block that does not close on this line.
69 # A comment begins on this line but doesn't close on this line.
71 return self.trailing_space_re.sub ('', line [:open_comment])
74 # Currently open comment ends on this line.
76 return self.trailing_space_re.sub ('', line [close_comment + 2:])
79 # Comment begins and ends on this line. Replace it with 'comment'
82 newline = line [:open_comment] + "comment" + line [close_comment + 2:]
85 return line
87 def process_strings (self, line):
89 Given a line of C code, return a string where all literal C strings have
92 for k in range (0, len (line)):
93 if line [k] == '"':
95 for k in range (start + 1, len (line)):
96 if line [k] == '"' and line [k - 1] != '\\':
97 return line [:start + 1] + '"' + self.process_strings (line [k + 1:])
98 return line
130 , ( re.compile ("\s(do|for|if|when)\s.*{$"), "trailing open parenthesis at end of line" )
150 # Open curly at end of line.
151 , ( re.compile ("\)\s*{\s*$"), "open curly brace at end of line" )
182 line = cfile.readline ()
183 if not line:
186 line = self.trailing_newline_re.sub ('', line)
187 self.orig_line = line
189 self.line_checks (preprocess (line))
203 def line_checks (self, line):
205 Run the style checker on provided line of text, but within the context
206 of how the line fits within the file.
209 indent = len (self.indent_re.search (line).group ())
210 if re.search ("^\s+}", line):
219 if check_re.search (line):
222 if re.search ("[a-zA-Z0-9][<>!=^/&\|]{1,2}[a-zA-Z0-9]", line):
223 if not re.search (".*#include.*[a-zA-Z0-9]/[a-zA-Z]", line):