Skip to content

[Ruby] Modulo of negative number (e.g. "15%-4") incorrectly highlighted as start of percent string #1166

Open
@Nnnes

Description

@Nnnes
%-string content- # good highlighting; equivalent to "string content"
15 % -4 - 6 == -7 # good highlighting
15"4 " 6==-7      # good highlighting (despite broken syntax)
15%-4 - 6==-7     # bad highlighting; highlighted in the same way as the above line

The highlighting appears incorrectly in GitHub the same way that it does in Sublime Text. A true fix is likely not feasible:

int = 15

def str(arg)
  "string: #{arg}"
end

puts int %-4 #-
puts str %-4 #-

is interpreted the same as

int = 15

def str(arg)
  "string: #{arg}"
end

puts int % -4
puts str("4 #")

so both output

-1
string: 4 #

Metadata

Metadata

Assignees

No one assigned

    Labels

    C: SyntaxT: bugA bug in an existing language featureon holdSomething that can't be done, or done correctly, right now

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions