Skip to content

Make boolean literal parsing case-insensitive - #339

Merged
Carter12s merged 1 commit into
RosLibRust:masterfrom
althea28:update-bool-parsing
Sep 17, 2026
Merged

Carter12s merged 1 commit into
RosLibRust:masterfrom
althea28:update-bool-parsing

Conversation

@althea28

@althea28 althea28 commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Description

Make boolean literal parsing case-insensitive to match official rosidl_adapter.

Currently, roslibrust_codegen cannot parse .msg and .action files that contain capitalized boolean literals (e.g., bool success True). This causes serde_json::from_str to panic with "expected value at line XX column XX".

The official ROS 2 Python parser (rosidl_adapter/parser.py) parses boolean constants case-insensitively by converting the string to lowercase first: if value_string.lower() not in (true_values + false_values):

Because of this, several official ROS 2 packages (such as nav2_msgs in the navigation2 stack) currently use True or False in their definitions, which compile fine in standard ROS 2 but break roslibrust's strict generation. This PR adds a .to_lowercase() call when matching "bool" in parse_ros_value.

Fixes

N/A

Checklist

  • Update CHANGELOG.md (I did not update this as this change does not seem notable enough to include 😅 let me know if I should do this anyway!)

Signed-off-by: Althea Tan <altheatan@google.com>
@Carter12s

Copy link
Copy Markdown
Collaborator

Hey thanks for this contribution! Agreed, this is the appropriate fix and I really appreciate you running it down!

Will get a version with this fix out shortly!

@Carter12s
Carter12s merged commit 859b1af into RosLibRust:master Sep 17, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants