parser: tag data members
It's cleaner to differentiate between the different types of member AST by
using the first element as a tag.
diff --git a/utest/test_frontend.py b/utest/test_frontend.py
index 7af5121..2119363 100755
--- a/utest/test_frontend.py
+++ b/utest/test_frontend.py
@@ -85,20 +85,20 @@
['OFPPC_NO_PACKET_IN', 64]]],
['metadata', 'version', '2'],
['struct', 'of_echo_reply', [
- ['uint8_t', 'version'],
- ['uint8_t', 'type'],
- ['uint16_t', 'length'],
- ['uint32_t', 'xid'],
- ['of_octets_t', 'data']]],
+ ['data', 'uint8_t', 'version'],
+ ['data', 'uint8_t', 'type'],
+ ['data', 'uint16_t', 'length'],
+ ['data', 'uint32_t', 'xid'],
+ ['data', 'of_octets_t', 'data']]],
['enum', 'ofp_queue_op_failed_code', [
['OFPQOFC_BAD_PORT', 0],
['OFPQOFC_BAD_QUEUE', 1],
['OFPQOFC_EPERM', 2]]],
['struct', 'of_packet_queue', [
- ['uint32_t', 'queue_id'],
- ['uint16_t', 'len'],
+ ['data', 'uint32_t', 'queue_id'],
+ ['data', 'uint16_t', 'len'],
['pad', 2],
- ['list(of_queue_prop_t)', 'properties']]],
+ ['data', 'list(of_queue_prop_t)', 'properties']]],
]
self.assertEquals(expected_ast, ast)
diff --git a/utest/test_parser.py b/utest/test_parser.py
index da262a4..a4a0e63 100755
--- a/utest/test_parser.py
+++ b/utest/test_parser.py
@@ -46,7 +46,7 @@
"""
ast = parser.parse(src)
self.assertEquals(ast,
- [['struct', 'foo', [['uint32_t', 'bar']]]])
+ [['struct', 'foo', [['data', 'uint32_t', 'bar']]]])
def test_multiple_fields(self):
src = """\
@@ -59,9 +59,9 @@
ast = parser.parse(src)
self.assertEquals(ast,
[['struct', 'foo',
- [['uint32_t', 'bar'],
- ['uint8_t', 'baz'],
- ['uint64_t', 'abc']]]])
+ [['data', 'uint32_t', 'bar'],
+ ['data', 'uint8_t', 'baz'],
+ ['data', 'uint64_t', 'abc']]]])
def test_array_type(self):
src = """\
@@ -71,7 +71,7 @@
"""
ast = parser.parse(src)
self.assertEquals(ast,
- [['struct', 'foo', [['uint32_t[4]', 'bar']]]])
+ [['struct', 'foo', [['data', 'uint32_t[4]', 'bar']]]])
def test_list_type(self):
src = """\
@@ -81,7 +81,7 @@
"""
ast = parser.parse(src)
self.assertEquals(ast,
- [['struct', 'foo', [['list(of_action_t)', 'bar']]]])
+ [['struct', 'foo', [['data', 'list(of_action_t)', 'bar']]]])
def test_pad_type(self):
src = """\
@@ -163,7 +163,7 @@
"""
ast = parser.parse(src)
self.assertEquals(ast,
- [['struct', 'foo', [['uint32_t', 'a']]]])
+ [['struct', 'foo', [['data', 'uint32_t', 'a']]]])
def test_mixed(self):
src = """\