Lines Matching refs:lines
54 def RemoveCommentsAndTrailingWhitespace(lines): argument
55 lines = re.sub(r'//.*\n', '\n', lines) # end-of-line comments
56 lines = re.sub(re.compile(r'/\*.*?\*/', re.DOTALL), '', lines) # comments.
57 lines = re.sub(r'\s+\n+', '\n', lines) # trailing whitespace
58 return lines
64 lines = file.read()
67 return lines
73 def Validate(lines): argument
76 if EVAL_PATTERN.search(lines):
78 if WITH_PATTERN.search(lines):
82 return lines
85 def ExpandConstants(lines, constants): argument
87 lines = key.sub(str(value), lines)
88 return lines
91 def ExpandMacroDefinition(lines, pos, name_pattern, macro, expander): argument
92 pattern_match = name_pattern.search(lines, pos)
98 assert lines[end - 1] == '('
107 while end < len(lines) and height > 0:
109 if lines[end] == ',' and height == 1:
110 add_arg(lines[last_match:end])
112 elif lines[end] in ['(', '{', '[']:
114 elif lines[end] in [')', '}', ']']:
118 add_arg(lines[last_match:end-1])
121 lines = lines[:start] + result + lines[end:]
122 pattern_match = name_pattern.search(lines, start + len(result))
123 return lines
125 def ExpandMacros(lines, macros): argument
131 lines = ExpandMacroDefinition(lines, 0, name_pattern, macro, expander)
132 return lines
159 def ReadMacros(lines): argument
162 for line in lines.split('\n'):
194 def ExpandInlineMacros(lines): argument
197 macro_match = INLINE_MACRO_PATTERN.search(lines, pos)
200 return lines
203 end_macro_match = INLINE_MACRO_END_PATTERN.search(lines, macro_match.end());
206 body = lines[macro_match.end():end_macro_match.start()]
209 lines = lines[:macro_match.start()] + lines[end_macro_match.end():]
218 lines = ExpandMacroDefinition(lines, pos, name_pattern, macro, non_expander)
223 def ExpandInlineConstants(lines): argument
226 const_match = INLINE_CONSTANT_PATTERN.search(lines, pos)
229 return lines
235 lines = (lines[:const_match.start()] +
236 re.sub(name_pattern, replacement, lines[const_match.end():]))
408 lines = filters(source)
412 result.modules.append(lines);