Fix parsing of members starting with string

This commit is contained in:
Marko Durkovic 2022-09-23 12:15:08 +02:00
parent 1de7380138
commit a0c4516e2f
2 changed files with 19 additions and 1 deletions

View File

@ -169,7 +169,7 @@ octet_type
string_type
= 'string' '<' expression '>'
/ 'string'
/ 'string\b'
scoped_name
= identifier '::' scoped_name

View File

@ -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:
"""Test msg parser with empty message."""
@ -291,6 +302,13 @@ def test_parse_idl() -> None:
assert fields[0][0] == 'i'
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:
"""Test type registeration."""