Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Side by Side Diff: build/gn_helpers.py

Issue 1844823002: Fix gn_helpers' parsing of bools. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | build/gn_helpers_unittest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Helper functions useful when writing scripts that integrate with GN. 5 """Helper functions useful when writing scripts that integrate with GN.
6 6
7 The main functions are ToGNString and FromGNString which convert between 7 The main functions are ToGNString and FromGNString which convert between
8 serialized GN veriables and Python variables. 8 serialized GN veriables and Python variables.
9 9
10 To use in a random python file in the build: 10 To use in a random python file in the build:
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 self.ConsumeWhitespace() 273 self.ConsumeWhitespace()
274 274
275 raise GNException("Unterminated list:\n " + self.input) 275 raise GNException("Unterminated list:\n " + self.input)
276 276
277 def _ConstantFollows(self, constant): 277 def _ConstantFollows(self, constant):
278 """Returns true if the given constant follows immediately at the current 278 """Returns true if the given constant follows immediately at the current
279 location in the input. If it does, the text is consumed and the function 279 location in the input. If it does, the text is consumed and the function
280 returns true. Otherwise, returns false and the current position is 280 returns true. Otherwise, returns false and the current position is
281 unchanged.""" 281 unchanged."""
282 end = self.cur + len(constant) 282 end = self.cur + len(constant)
283 if end >= len(self.input): 283 if end > len(self.input):
284 return False # Not enough room. 284 return False # Not enough room.
285 if self.input[self.cur:end] == constant: 285 if self.input[self.cur:end] == constant:
286 self.cur = end 286 self.cur = end
287 return True 287 return True
288 return False 288 return False
OLDNEW
« no previous file with comments | « no previous file | build/gn_helpers_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698