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 0556236be4fa25bb35cdc4ac5d5514f2b3465397..44a4a55eaec8e06523919a621c9e450aeaa6637e 100644 |
--- a/tools/json_schema_compiler/idl_schema.py |
+++ b/tools/json_schema_compiler/idl_schema.py |
@@ -10,7 +10,6 @@ import re |
import sys |
from json_parse import OrderedDict |
-import schema_util |
# This file is a peer to json_schema.py. Each of these files understands a |
# certain format describing APIs (either JSON or IDL), reads files written |
@@ -85,6 +84,7 @@ def ProcessComment(comment): |
.replace('\n', '')) |
return (parent_comment, params) |
+ |
class Callspec(object): |
''' |
Given a Callspec node representing an IDL function declaration, converts into |
@@ -106,7 +106,7 @@ class Callspec(object): |
# Instead we infer any object return values to be optional. |
# TODO(asargent): fix the IDL parser to support optional return types. |
if return_type.get('type') == 'object' or '$ref' in return_type: |
- return_type['optional'] = True; |
+ return_type['optional'] = True |
for node in self.node.children: |
parameter = Param(node).process(callbacks) |
if parameter['name'] in self.comment: |
@@ -114,6 +114,7 @@ class Callspec(object): |
parameters.append(parameter) |
return (self.node.GetName(), parameters, return_type) |
+ |
class Param(object): |
''' |
Given a Param node representing a function parameter, converts into a Python |
@@ -127,6 +128,7 @@ class Param(object): |
self.node, |
{'name': self.node.GetName()}).process(callbacks) |
+ |
class Dictionary(object): |
''' |
Given an IDL Dictionary node, converts into a Python dictionary that the JSON |
@@ -151,6 +153,7 @@ class Dictionary(object): |
return result |
+ |
class Member(object): |
''' |
Given an IDL dictionary or interface member, converts into a name/value pair |
@@ -204,6 +207,7 @@ class Member(object): |
properties['enum'] = enum_values |
return name, properties |
+ |
class Typeref(object): |
''' |
Given a TYPEREF property representing the type of dictionary member or |
@@ -350,6 +354,7 @@ class Namespace(object): |
members.append(properties) |
return members |
+ |
class IDLSchema(object): |
''' |
Given a list of IDLNodes and IDLAttributes, converts into a Python list |
@@ -390,6 +395,7 @@ class IDLSchema(object): |
sys.exit('Did not process %s %s' % (node.cls, node)) |
return namespaces |
+ |
def Load(filename): |
''' |
Given the filename of an IDL file, parses it and returns an equivalent |
@@ -404,6 +410,7 @@ def Load(filename): |
idl_schema = IDLSchema(idl) |
return idl_schema.process() |
+ |
def Main(): |
''' |
Dump a json serialization of parse result for the IDL files whose names |
@@ -413,5 +420,6 @@ def Main(): |
schema = Load(filename) |
print json.dumps(schema, indent=2) |
+ |
if __name__ == '__main__': |
Main() |