| OLD | NEW |
| 1 # Copyright 2012 the V8 project authors. All rights reserved. | 1 # Copyright 2012 the V8 project authors. All rights reserved. |
| 2 # Redistribution and use in source and binary forms, with or without | 2 # Redistribution and use in source and binary forms, with or without |
| 3 # modification, are permitted provided that the following conditions are | 3 # modification, are permitted provided that the following conditions are |
| 4 # met: | 4 # met: |
| 5 # | 5 # |
| 6 # * Redistributions of source code must retain the above copyright | 6 # * Redistributions of source code must retain the above copyright |
| 7 # notice, this list of conditions and the following disclaimer. | 7 # notice, this list of conditions and the following disclaimer. |
| 8 # * Redistributions in binary form must reproduce the above | 8 # * Redistributions in binary form must reproduce the above |
| 9 # copyright notice, this list of conditions and the following | 9 # copyright notice, this list of conditions and the following |
| 10 # disclaimer in the documentation and/or other materials provided | 10 # disclaimer in the documentation and/or other materials provided |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 self.section = False | 379 self.section = False |
| 380 self.out = cStringIO.StringIO() | 380 self.out = cStringIO.StringIO() |
| 381 | 381 |
| 382 def OpenGlobal(self): | 382 def OpenGlobal(self): |
| 383 if self.init: return | 383 if self.init: return |
| 384 self.WriteComment() | 384 self.WriteComment() |
| 385 print >> self.out, "[" | 385 print >> self.out, "[" |
| 386 self.init = True | 386 self.init = True |
| 387 | 387 |
| 388 def CloseGlobal(self): | 388 def CloseGlobal(self): |
| 389 if not self.init: return | 389 if not self.init: self.OpenGlobal() |
| 390 print >> self.out, "]" | 390 print >> self.out, "]" |
| 391 self.init = False | 391 self.init = False |
| 392 | 392 |
| 393 def OpenSection(self, condition="ALWAYS"): | 393 def OpenSection(self, condition="ALWAYS"): |
| 394 if self.section: return | 394 if self.section: return |
| 395 self.OpenGlobal() | 395 self.OpenGlobal() |
| 396 if type(condition) != str: | 396 if type(condition) != str: |
| 397 condition = "'%s'" % condition.string(True) | 397 condition = "'%s'" % condition.string(True) |
| 398 print >> self.out, "%s[%s, {" % (self.indent, condition) | 398 print >> self.out, "%s[%s, {" % (self.indent, condition) |
| 399 self.indent += " " * 2 | 399 self.indent += " " * 2 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 continue | 451 continue |
| 452 prefix_match = PREFIX_PATTERN.match(line) | 452 prefix_match = PREFIX_PATTERN.match(line) |
| 453 if prefix_match: | 453 if prefix_match: |
| 454 continue | 454 continue |
| 455 print "Malformed line: '%s'." % line | 455 print "Malformed line: '%s'." % line |
| 456 self.CloseSection() | 456 self.CloseSection() |
| 457 self.CloseGlobal() | 457 self.CloseGlobal() |
| 458 result = self.out.getvalue() | 458 result = self.out.getvalue() |
| 459 self.out.close() | 459 self.out.close() |
| 460 return result | 460 return result |
| OLD | NEW |