Skip to content

Commit

Permalink
fix parsing empty string literal (#409)
Browse files Browse the repository at this point in the history
* fix parsing empty string literal

Signed-off-by: Dirk Thomas <dirk-thomas@users.noreply.github.com>

* add annotation with empty string literal parameter

Signed-off-by: Dirk Thomas <dirk-thomas@users.noreply.github.com>
  • Loading branch information
dirk-thomas authored Sep 9, 2019
1 parent c488b81 commit f445d96
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions rosidl_parser/rosidl_parser/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,8 @@ def get_floating_pt_literal_value(floating_pt_literal):


def get_string_literal_value(string_literal, *, allow_unicode=False):
if len(string_literal.children) == 0:
return ''
assert len(string_literal.children) == 1
child = string_literal.children[0]
assert isinstance(child, Token)
Expand Down
1 change: 1 addition & 0 deletions rosidl_parser/test/msg/MyMessage.idl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module rosidl_parser {
@key
@range ( min=-10, max=10 )
long long_value;
@verbatim (language="comment", text="")
unsigned long unsigned_long_value;
long long long_long_value;
unsigned long long unsigned_long_long_value;
Expand Down

0 comments on commit f445d96

Please sign in to comment.