Fix parsing of members starting with string
This commit is contained in:
parent
1de7380138
commit
a0c4516e2f
@ -169,7 +169,7 @@ octet_type
|
|||||||
|
|
||||||
string_type
|
string_type
|
||||||
= 'string' '<' expression '>'
|
= 'string' '<' expression '>'
|
||||||
/ 'string'
|
/ 'string\b'
|
||||||
|
|
||||||
scoped_name
|
scoped_name
|
||||||
= identifier '::' scoped_name
|
= identifier '::' scoped_name
|
||||||
|
|||||||
@ -154,6 +154,17 @@ module test_msgs {
|
|||||||
};
|
};
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
IDL_STRINGARRAY = """
|
||||||
|
module test_msgs {
|
||||||
|
module msg {
|
||||||
|
typedef string string__3[3];
|
||||||
|
struct Strings {
|
||||||
|
string__3 values;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
def test_parse_empty_msg() -> None:
|
def test_parse_empty_msg() -> None:
|
||||||
"""Test msg parser with empty message."""
|
"""Test msg parser with empty message."""
|
||||||
@ -291,6 +302,13 @@ def test_parse_idl() -> None:
|
|||||||
assert fields[0][0] == 'i'
|
assert fields[0][0] == 'i'
|
||||||
assert fields[0][1][1] == 'int'
|
assert fields[0][1][1] == 'int'
|
||||||
|
|
||||||
|
ret = get_types_from_idl(IDL_STRINGARRAY)
|
||||||
|
consts, fields = ret['test_msgs/msg/Strings']
|
||||||
|
assert consts == []
|
||||||
|
assert len(fields) == 1
|
||||||
|
assert fields[0][0] == 'values'
|
||||||
|
assert fields[0][1] == (Nodetype.ARRAY, ((Nodetype.NAME, 'string'), 3))
|
||||||
|
|
||||||
|
|
||||||
def test_register_types() -> None:
|
def test_register_types() -> None:
|
||||||
"""Test type registeration."""
|
"""Test type registeration."""
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user