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

Unified Diff: tools/json_comment_eater.py

Issue 13599004: Fix some low hanging inefficiencies in the docs server (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/extensions/docs/server2/preview.py ('k') | tools/json_comment_eater/everything.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/json_comment_eater.py
diff --git a/tools/json_comment_eater.py b/tools/json_comment_eater.py
deleted file mode 100644
index 1b1e07a842a26d2b0da758d190b4dcfe253c87d1..0000000000000000000000000000000000000000
--- a/tools/json_comment_eater.py
+++ /dev/null
@@ -1,40 +0,0 @@
-# Copyright (c) 2012 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-""" Utility to remove comments from JSON files so that they can be parsed by
-json.loads."""
-
-def _ReadString(input, start, output):
- output.append('"')
- in_escape = False
- for pos in xrange(start, len(input)):
- output.append(input[pos])
- if in_escape:
- in_escape = False
- else:
- if input[pos] == '\\':
- in_escape = True
- elif input[pos] == '"':
- return pos + 1
- return pos
-
-def _ReadComment(input, start, output):
- for pos in xrange(start, len(input)):
- if input[pos] in ['\r', '\n']:
- output.append(input[pos])
- return pos + 1
- return pos
-
-def Nom(input):
- output = []
- pos = 0
- while pos < len(input):
- if input[pos] == '"':
- pos = _ReadString(input, pos + 1, output)
- elif input[pos:pos+2] == '//':
- pos = _ReadComment(input, pos + 2, output)
- else:
- output.append(input[pos])
- pos += 1
- return ''.join(output)
« no previous file with comments | « chrome/common/extensions/docs/server2/preview.py ('k') | tools/json_comment_eater/everything.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698