Skip to content

Commit

Permalink
Merge pull request #4210 from JGoutin/CythonSyntaxhighlighters
Browse files Browse the repository at this point in the history
PR: Fix syntax highlighter missing Cython keywords
  • Loading branch information
ccordoba12 authored Feb 28, 2017
2 parents 8ab558b + 521b370 commit 590bc78
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions spyder/utils/syntaxhighlighters.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,13 +551,17 @@ def rehighlight(self):
#==============================================================================
# Cython syntax highlighter
#==============================================================================
C_TYPES = 'bool char double enum float int long mutable short signed struct unsigned void'
C_TYPES = 'bool char double enum float int long mutable short signed struct unsigned void NULL'

class CythonSH(PythonSH):
"""Cython Syntax Highlighter"""
ADDITIONAL_KEYWORDS = ["cdef", "ctypedef", "cpdef", "inline", "cimport",
"DEF"]
ADDITIONAL_BUILTINS = C_TYPES.split()
ADDITIONAL_KEYWORDS = [
"cdef", "ctypedef", "cpdef", "inline", "cimport", "extern",
"include", "begin", "end", "by", "gil", "nogil", "const", "public",
"readonly", "fused ", "static", "api", "DEF", "IF", "ELIF", "ELSE"]

ADDITIONAL_BUILTINS = C_TYPES.split() + [
"array", "bint", "Py_ssize_t", "intern", "reload", "sizeof"]
PROG = re.compile(make_python_patterns(ADDITIONAL_KEYWORDS,
ADDITIONAL_BUILTINS), re.S)
IDPROG = re.compile(r"\s+([\w\.]+)", re.S)
Expand Down

0 comments on commit 590bc78

Please sign in to comment.