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

Unified Diff: tools/json_schema_compiler/idl_schema.py

Issue 2649373002: Re-land: Update json_schema_compiler to handle the Automation extension API (Closed)
Patch Set: Fix presubmit Created 3 years, 11 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 | « third_party/closure_compiler/externs/automation.js ('k') | tools/json_schema_compiler/idl_schema_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/json_schema_compiler/idl_schema.py
diff --git a/tools/json_schema_compiler/idl_schema.py b/tools/json_schema_compiler/idl_schema.py
index 58efe28598f1660e9f4481e412f30fa715195668..fcad49bef4e2fde5eb75f8fa359c5ee2d97e3266 100755
--- a/tools/json_schema_compiler/idl_schema.py
+++ b/tools/json_schema_compiler/idl_schema.py
@@ -50,13 +50,20 @@ def ProcessComment(comment):
Returns: A tuple that looks like:
(
- "The processed comment, minus all |parameter| mentions.",
+ "The processed comment, minus all |parameter| mentions and jsexterns.",
+ "Any block wrapped in <jsexterns></jsexterns>.",
{
'parameter_name_1': "The comment that followed |parameter_name_1|:",
...
}
)
'''
+ jsexterns = None
+ match = re.search('<jsexterns>(.*)</jsexterns>', comment, re.DOTALL)
+ if match:
+ jsexterns = match.group(1).strip()
+ comment = comment[:match.start()] + comment[match.end():]
+
def add_paragraphs(content):
paragraphs = content.split('\n\n')
if len(paragraphs) < 2:
@@ -85,7 +92,7 @@ def ProcessComment(comment):
add_paragraphs(comment[param_comment_start:param_comment_end].strip())
.replace('\n', ''))
- return (parent_comment, params)
+ return (parent_comment, jsexterns, params)
class Callspec(object):
@@ -195,8 +202,10 @@ class Member(object):
parameter_comments = OrderedDict()
for node in self.node.GetChildren():
if node.cls == 'Comment':
- (parent_comment, parameter_comments) = ProcessComment(node.GetName())
+ (parent_comment, jsexterns, parameter_comments) = ProcessComment(
+ node.GetName())
properties['description'] = parent_comment
+ properties['jsexterns'] = jsexterns
elif node.cls == 'Callspec':
name, parameters, return_type = (Callspec(node, parameter_comments)
.process(callbacks))
« no previous file with comments | « third_party/closure_compiler/externs/automation.js ('k') | tools/json_schema_compiler/idl_schema_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698