-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Print warning if non-FQN namespace remapping passed #248
Changes from all commits
b50acaf
15da6d1
ba4ee35
d838bd1
fd8fd58
24385eb
81aabf8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -222,8 +222,15 @@ rcl_lexer_lookahead2_expect( | |
return ret; | ||
} | ||
if (type != lexeme) { | ||
if (RCL_LEXEME_NONE == lexeme || RCL_LEXEME_EOF == lexeme) { | ||
RCL_SET_ERROR_MSG_WITH_FORMAT_STRING( | ||
buffer->impl->allocator, "Expected lexeme type (%d) not found, search ended at index %lu", | ||
type, buffer->impl->text_idx); | ||
return RCL_RET_WRONG_LEXEME; | ||
} | ||
RCL_SET_ERROR_MSG_WITH_FORMAT_STRING( | ||
buffer->impl->allocator, "Expected %d got %d at %lu", type, lexeme, buffer->impl->text_idx); | ||
buffer->impl->allocator, "Expected lexeme type %d, got %d at index %lu", type, lexeme, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does the motivation for a separate error message come from the difficulty of reading the lexeme types in the current message? If it output strings ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Certainly just printing the type as a number instead of a string was the main motivation for separating the messages (because I had to go find the type to come to the conclusion that it wasn't found), but even printing strings I think it'd be clearer to the user to say explicitly that it wasn't found (as opposed to them having to infer it from the types). I also thought that it might deserve a different return code in some situations but that's just hypothetical :) |
||
buffer->impl->text_idx); | ||
return RCL_RET_WRONG_LEXEME; | ||
} | ||
return rcl_lexer_lookahead2_accept(buffer, lexeme_text, lexeme_text_length); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sloretz I added this when I noticed that parsing argv[0] was always giving:
That was the EOF case; perhaps the NONE case actually shouldn't be treated the same?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NONE
might deserve separate handling since it means there was text left but there's no way it could be a valid lexeme. Adding the text index to the message would give enough info to differentiate the two.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, that's the difference, thanks. I tried to point it out in docs https://github.com/ros2/rcl/pull/248/files#diff-b5f802bb85e2a3c95df3c6bbfd75b826R33, but I admit to not being aware of the different ways in which they're used; if the distinction is not so simple, we can remove that comment