Lines Matching full:lines
53 def RemoveCommentsEmptyLinesAndWhitespace(lines): argument
54 lines = re.sub(r'\n+', '\n', lines) # empty lines
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 lines = re.sub(r'\n\s+', '\n', lines) # initial whitespace
59 return lines
65 lines = file.read()
68 return lines
77 def Validate(lines): argument
80 if EVAL_PATTERN.search(lines):
82 if WITH_PATTERN.search(lines):
84 invalid_error = INVALID_ERROR_MESSAGE_PATTERN.search(lines)
87 if NEW_ERROR_PATTERN.search(lines):
89 # Pass lines through unchanged.
90 return lines
93 def ExpandConstants(lines, constants): argument
95 lines = key.sub(str(value), lines)
96 return lines
99 def ExpandMacroDefinition(lines, pos, name_pattern, macro, expander): argument
100 pattern_match = name_pattern.search(lines, pos)
106 assert lines[end - 1] == '('
113 lineno = lines.count(os.linesep, 0, start) + 1
118 while end < len(lines) and height > 0:
120 if lines[end] == ',' and height == 1:
121 add_arg(lines[last_match:end])
123 elif lines[end] in ['(', '{', '[']:
125 elif lines[end] in [')', '}', ']']:
129 add_arg(lines[last_match:end-1])
131 lineno = lines.count(os.linesep, 0, start) + 1
135 lines = lines[:start] + result + lines[end:]
136 pattern_match = name_pattern.search(lines, start + len(result))
137 return lines
139 def ExpandMacros(lines, macros): argument
145 lines = ExpandMacroDefinition(lines, 0, name_pattern, macro, expander)
146 return lines
164 def ReadMacros(lines): argument
167 for line in lines.split('\n'):
191 def ReadMessageTemplates(lines): argument
194 for line in lines.split('\n'):
206 def ExpandInlineMacros(lines): argument
209 macro_match = INLINE_MACRO_PATTERN.search(lines, pos)
212 return lines
215 end_macro_match = INLINE_MACRO_END_PATTERN.search(lines, macro_match.end());
218 body = lines[macro_match.end():end_macro_match.start()]
221 lines = lines[:macro_match.start()] + lines[end_macro_match.end():]
230 lines = ExpandMacroDefinition(lines, pos, name_pattern, macro, non_expander)
235 def ExpandInlineConstants(lines): argument
238 const_match = INLINE_CONSTANT_PATTERN.search(lines, pos)
241 return lines
247 lines = (lines[:const_match.start()] +
248 re.sub(name_pattern, replacement, lines[const_match.end():]))
430 lines = filters(contents)
434 result.modules.append(lines)