rouge-ruby / rouge

A pure Ruby code highlighter that is compatible with Pygments
https://rouge.jneen.net/
Other
3.3k stars 732 forks source link

C++ lexer doesn't recognize the first function name #1967

Open egor-tensin opened 1 year ago

egor-tensin commented 1 year ago

Name of the lexer cpp

Code sample

namespace {

void f1() {
}

void f2() {
}

void f3() {
}

}

rouge.jneen.net doesn't seem to work.

# bundle exec rougify version
4.1.2

The first function f1 doesn't get recognized as a function name here (f2 and f3 do).

# bundle exec rougify highlight -i test1.cpp --formatter-preset html
<span class="k">namespace</span> <span class="p">{</span>

<span class="kt">void</span> <span class="n">f1</span><span class="p">()</span> <span class="p">{</span>
<span class="p">}</span>

<span class="kt">void</span> <span class="nf">f2</span><span class="p">()</span> <span class="p">{</span>
<span class="p">}</span>

<span class="kt">void</span> <span class="nf">f3</span><span class="p">()</span> <span class="p">{</span>
<span class="p">}</span>

<span class="p">}</span>

Notice how f1 has the span class of n, while f2 & f3 have the correct class nf.