summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xtools/idl_parser/idl_node.py8
-rwxr-xr-xtools/idl_parser/idl_parser.py2
-rwxr-xr-xtools/idl_parser/idl_ppapi_parser.py11
-rw-r--r--tools/idl_parser/test_parser/enum_ppapi.idl7
4 files changed, 17 insertions, 11 deletions
diff --git a/tools/idl_parser/idl_node.py b/tools/idl_parser/idl_node.py
index 2e31d9a..83aefa5 100755
--- a/tools/idl_parser/idl_node.py
+++ b/tools/idl_parser/idl_node.py
@@ -148,13 +148,13 @@ class IDLNode(object):
tab = ''.rjust(self.depth * 2)
self.out.append(tab + str(node))
if self.props:
+ proplist = []
for key, value in node.GetProperties().iteritems():
- proplist = []
if key in self.props:
proplist.append(tab + ' %s: %s' % (key, str(value)))
- if proplist:
- self.out.append(tab + ' PROPERTIES')
- self.out.extend(proplist)
+ if proplist:
+ self.out.append(tab + ' PROPERTIES')
+ self.out.extend(proplist)
if filter_nodes == None:
filter_nodes = ['Comment', 'Copyright']
diff --git a/tools/idl_parser/idl_parser.py b/tools/idl_parser/idl_parser.py
index 22f7262..f1ec51e 100755
--- a/tools/idl_parser/idl_parser.py
+++ b/tools/idl_parser/idl_parser.py
@@ -401,7 +401,7 @@ class IDLParser(object):
def p_BooleanLiteral(self, p):
"""BooleanLiteral : TRUE
| FALSE"""
- value = self.BuildAttribute('NAME', Boolean(p[1] == 'true'))
+ value = self.BuildAttribute('VALUE', Boolean(p[1] == 'true'))
p[0] = ListFromConcat(self.BuildAttribute('TYPE', 'boolean'), value)
# [29]
diff --git a/tools/idl_parser/idl_ppapi_parser.py b/tools/idl_parser/idl_ppapi_parser.py
index 9cfe953..0e5116c 100755
--- a/tools/idl_parser/idl_ppapi_parser.py
+++ b/tools/idl_parser/idl_ppapi_parser.py
@@ -117,21 +117,20 @@ class IDLPPAPIParser(IDLParser):
val = str(p[1])
if len(p) > 2:
val = "%s %s %s" % (p[1], p[2], p[3])
-
p[0] = ListFromConcat(self.BuildAttribute('TYPE', 'integer'),
- self.BuildAttribute('NAME', val))
+ self.BuildAttribute('VALUE', val))
def p_ConstValueStr(self, p):
"""ConstValue : string"""
p[0] = ListFromConcat(self.BuildAttribute('TYPE', 'string'),
- self.BuildAttribute('NAME', p[1]))
+ self.BuildAttribute('VALUE', p[1]))
+ # Boolean & Float Literals area already BuildAttributes
def p_ConstValueLiteral(self, p):
"""ConstValue : FloatLiteral
| BooleanLiteral """
p[0] = p[1]
-
# [21]
def p_EnumValueList(self, p):
"""EnumValueList : EnumValue EnumValues"""
@@ -149,7 +148,7 @@ class IDLPPAPIParser(IDLParser):
| ExtendedAttributeList identifier '=' ConstValue"""
p[0] = self.BuildNamed('EnumItem', p, 2, p[1])
if len(p) > 3:
- p[0].AddChildren(self.BuildAttribute('VALUE', p[4]))
+ p[0].AddChildren(p[4])
def p_PrimitiveType(self, p):
"""PrimitiveType : IntegerType
@@ -229,7 +228,7 @@ def main(argv):
ast = IDLNode('AST', '__AST__', 0, 0, nodes)
- print '\n'.join(ast.Tree(accept_props=['PROD','VALUE']))
+ print '\n'.join(ast.Tree(accept_props=['PROD', 'TYPE', 'VALUE']))
if errors:
print '\nFound %d errors.\n' % errors
diff --git a/tools/idl_parser/test_parser/enum_ppapi.idl b/tools/idl_parser/test_parser/enum_ppapi.idl
index 394e680..1b088b8 100644
--- a/tools/idl_parser/test_parser/enum_ppapi.idl
+++ b/tools/idl_parser/test_parser/enum_ppapi.idl
@@ -117,3 +117,10 @@ enum MealType3 {
other = 012 << 777
};
+/* BUILD Enum(MealType4) */
+enum MealType4 {
+ /* BUILD EnumItem(rice) */
+ rice = true,
+ /* BUILD EnumItem(noodles) */
+ noodles = false
+};