Home | History | Annotate | Download | only in tools

Lines Matching refs:lines

39 def ToCAsciiArray(lines):
41 for chr in lines:
48 def ToCArray(lines):
50 for chr in lines:
55 def RemoveCommentsAndTrailingWhitespace(lines):
56 lines = re.sub(r'//.*\n', '\n', lines) # end-of-line comments
57 lines = re.sub(re.compile(r'/\*.*?\*/', re.DOTALL), '', lines) # comments.
58 lines = re.sub(r'\s+\n+', '\n', lines) # trailing whitespace
59 return lines
65 lines = file.read()
68 return lines
101 def Validate(lines, file):
102 lines = RemoveCommentsAndTrailingWhitespace(lines)
105 eval_match = EVAL_PATTERN.search(lines)
108 with_match = WITH_PATTERN.search(lines)
113 def ExpandConstants(lines, constants):
115 lines = key.sub(str(value), lines)
116 return lines
119 def ExpandMacroDefinition(lines, pos, name_pattern, macro, expander):
120 pattern_match = name_pattern.search(lines, pos)
126 assert lines[end - 1] == '('
135 while end < len(lines) and height > 0:
137 if lines[end] == ',' and height == 1:
138 add_arg(lines[last_match:end])
140 elif lines[end] in ['(', '{', '[']:
142 elif lines[end] in [')', '}', ']']:
146 add_arg(lines[last_match:end-1])
149 lines = lines[:start] + result + lines[end:]
150 pattern_match = name_pattern.search(lines, start + len(result))
151 return lines
153 def ExpandMacros(lines, macros):
159 lines = ExpandMacroDefinition(lines, 0, name_pattern, macro, expander)
160 return lines
187 def ReadMacros(lines):
190 for line in lines:
222 def ExpandInlineMacros(lines, filename):
225 macro_match = INLINE_MACRO_PATTERN.search(lines, pos)
228 return lines
231 end_macro_match = INLINE_MACRO_END_PATTERN.search(lines, macro_match.end());
234 body = lines[macro_match.end():end_macro_match.start()]
237 lines = lines[:macro_match.start()] + lines[end_macro_match.end():]
246 lines = ExpandMacroDefinition(lines, pos, name_pattern, macro, non_expander)
359 lines = ReadFile(filename)
360 lines = ExpandConstants(lines, consts)
361 lines = ExpandMacros(lines, macros)
362 lines = RemoveCommentsAndTrailingWhitespace(lines)
363 lines = ExpandInlineMacros(lines, filename)
364 Validate(lines, filename)
365 lines = minifier.JSMinify(lines)
368 raw_length = len(lines)
373 all_sources.append(lines)