Skip to content

Accept double-quoted string literals in scripts again - #1306

Open
dvadovsz wants to merge 1 commit into
BehaviorTree:masterfrom
dvadovsz:fix/script-double-quoted-strings
Open

dvadovsz wants to merge 1 commit into
BehaviorTree:masterfrom
dvadovsz:fix/script-double-quoted-strings

Conversation

@dvadovsz

@dvadovsz dvadovsz commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Fixes #1305.

The tokenizer now accepts "..." as well as '...', and the closing quote must match the opening one. A string can then hold the other kind of quote: 'say "hello"' and "it's ready" both work. This matches the lexy grammar through 4.8.4, which accepted dsl::single_quoted(...) | dsl::quoted(...).

Tests in script_parser_test.cpp:

  • StringLiteralQuotes: both delimiters, empty strings, a string holding the other quote, concatenation of the two kinds, and rejection of unterminated and mismatched quotes.
  • DoubleQuotedStringsInXml: " strings in a Script and in _failureIf and _successIf preconditions.

Both fail on master and pass with the fix. pre-commit and clang-tidy-21 are clean. There is no API or ABI change. Scripts that use only single quotes behave as before.

The lexy grammar accepted both 'single' and "double" quoted strings (dsl::single_quoted | dsl::quoted in any_types.hpp). The hand-written tokenizer from BehaviorTree#1099 only recognizes single quotes, so scripts that worked in 4.8, such as label := "item "..index, now fail with Invalid token '"'. Recognize both delimiters and require the closing quote to match the opening one.

Fixes BehaviorTree#1305

Co-Authored-By: David Vadovszki <david.vadovszki@picknik.ai>
@dvadovsz
dvadovsz marked this pull request as ready for review December 2, 2026 23:46

This branch has not been deployed

No deployments
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.

Scripts no longer accept double-quoted strings since 4.9.0

2 participants