Skip to content

Regex messes up highlighting for most of the rest of the page #2839

@TWiStErRob

Description

@TWiStErRob

This regex messes up highlighting for most of the rest of the page:

state :descriptors do
# a full-form tag
rule /!<[0-9A-Za-z;\/?:@&=+$,_.!~*'()\[\]%-]+>/, Keyword::Type
# a tag in the form '!', '!suffix' or '!handle!suffix'
rule %r(
  (?:![\w-]+)? # handle
  !(?:[\w;/?:@&=+$,.!~*\'()\[\]%-]*) # suffix
)x, Keyword::Type
# an anchor
rule /&[\w-]+/, Name::Label
# an alias
rule /\*[\w-]+/, Name::Variable
end

from https://github.com/jneen/rouge/blob/master/lib/rouge/lexers/yaml.rb#L152

That apostrophe which starts the single quoted string (blue colored from there on) is in a character class (delimited by []), so it shouldn't have any special meaning. If I remove the apostrophe then the percent sign does the same. If I remove all special chars from the character class, it still breaks because of the >/ which I can't explain.

I reported it to GitHub support, which lead me here:

We use open source TextMate-style language grammars for syntax highlighting, which are available here:
https://github.com/github/linguist/blob/master/grammars.yml
Linguist pulls in grammar updates with each new release, which usually happens every couple of weeks.

So based on https://github.com/github/linguist/blob/master/grammars.yml#L480
The code is at https://github.com/aroben/ruby.tmbundle/tree/4636a3023153c3034eb6ffc613899ba9cf33b41f

The problem is that I see that it is a fork and is on a branch.
It's about 20 commits behind and 2 minor commits ahead of the official master which is so much improvement in the offical that GitHub can't even show the diff:
aroben/ruby.tmbundle@pl...textmate:master

Syntaxes/Ruby.plist
2,663 additions, 1,710 deletions not shown because the diff is too large.
Please use a local Git client to view these changes.

It's possible that this issue was already fixed by those 20 commits, would it be possible to pull those 2 minor changes to the original repo and use that so the updates are received from other contributors?

/cc @aroben

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions