Skip to content

Fix variable option values starting with a number or boolean#5113

Open
eyupcanakman wants to merge 1 commit into
Orange-OpenSource:masterfrom
eyupcanakman:fix/options-variable-string-5028
Open

Fix variable option values starting with a number or boolean#5113
eyupcanakman wants to merge 1 commit into
Orange-OpenSource:masterfrom
eyupcanakman:fix/options-variable-string-5028

Conversation

@eyupcanakman

Copy link
Copy Markdown
Contributor

A variable value in an [Options] section that starts with a number or boolean but continues with other characters, like 11aa or true_is_true, was rejected with an expecting 'line_terminator' error.

These values are now read as strings.

Fixes #5028

A variable value that starts with a number or boolean but has more characters was rejected with an error. These values are now read as strings.

Fixes Orange-OpenSource#5028
@jcamiel jcamiel requested a review from fabricereix June 22, 2026 15:43

@jcamiel jcamiel left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @eyupcanakman thanks for the PR, I've a quick comment on it, but @fabricereix will review it more thoughtfully

// the start of an unquoted string, so return a recoverable error to fall back to it.
fn literal_value<T>(reader: &mut Reader, value: T) -> ParseResult<T> {
match reader.peek() {
None | Some(' ' | '\t' | '\r' | '\n' | '#') => Ok(value),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless mistake, I think we should not take # into account here:

GET http://localhost:8000
[Options]
variable: foo=true#this_is_not_a_comment

foo should be equal to the string true#this_is_not_a_comment and not be parsed as a bool

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At first, I would have excluded it.
But in the shell, it is not treated as comment

  $ value=true#this_is_not_a_comment
  $ echo "$value"
  true#this_is_not_a_comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By "not take # into account here" I mean not use in this pattern Some(' ' | '\t' | '\r' | '\n' | '#').

variable: foo=true#this_is_not_a_comment should create a string variable with value true#this_is_not_a_comment

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.

Accept options variables like 111xxx or truexxx

3 participants