Skip to content

Commit

Permalink
DOC, BLD: fix templated C highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
mattip committed Sep 16, 2020
1 parent bd26391 commit a182f32
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,15 +367,15 @@ def linkcode_resolve(domain, info):
numpy.__version__, fn, linespec)

from pygments.lexers import CLexer
import copy
from pygments.lexer import inherit, bygroups
from pygments.token import Comment

class NumPyLexer(CLexer):
name = 'NUMPYLEXER'

tokens = copy.deepcopy(CLexer.tokens)
# Extend the regex for valid identifiers with @
for k, val in tokens.items():
for i, v in enumerate(val):
if isinstance(v, tuple):
if isinstance(v[0], str):
val[i] = (v[0].replace('a-zA-Z', 'a-zA-Z@'),) + v[1:]
tokens = {
'statements': [
(r'@[a-zA-Z_]*@', Comment.Preproc, 'macro'),
inherit,
],
}

0 comments on commit a182f32

Please sign in to comment.