Chromium Code Reviews| 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) |
|
Dan Beam
2017/01/12 03:12:50
oh, i guess this is only on the comment, not the w
Devlin
2017/01/12 17:28:47
I'm not in love with it, but there's also not a gr
dmazzoni
2017/01/13 21:22:53
Great, now down to just two special cases, both ma
|
| + 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)) |