Skip to content

Commit 1e07fba

Browse files
committed
Add Cython UDL with sample, functionList and unittest
1 parent d227a55 commit 1e07fba

File tree

5 files changed

+151
-0
lines changed

5 files changed

+151
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"leaves":["int myCyFunction(int i, int j)","int myOtherCyFunction(int i, int j)","myPyFunction()"],"nodes":[{"leaves":["public double[:] myCyClassMethod(self)","myPyClassMethod(self)"],"name":"MyCythonClass"},{"leaves":["_visibleNestedClassMethod(self)","myPyClassMethod(self)"],"name":"MyPythonClass"}],"root":"unitTest"}

UDL-samples/Cython_byFrederikLauf.pyx

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
cdef double myVariable = 5.5
2+
3+
cdef int myCyFunction(int i, int j):
4+
if i == j:
5+
return 1
6+
else:
7+
return 0
8+
9+
cpdef int myOtherCyFunction(int i, int j):
10+
if i == j:
11+
return 1
12+
else:
13+
return 0
14+
15+
def myPyFunction():
16+
pass
17+
18+
cdef class MyCythonClass():
19+
20+
cdef public int invisible_variable
21+
22+
cdef public double[:] myCyClassMethod(self):
23+
pass
24+
25+
def myPyClassMethod(self):
26+
pass
27+
28+
class MyPythonClass():
29+
30+
class _invisibleNestedClass:
31+
def _visibleNestedClassMethod(self):
32+
pass
33+
34+
def myPyClassMethod(self):
35+
pass

UDLs/Cython_byFrederikLauf.xml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<NotepadPlus>
2+
<UserLang name="Cython" ext="pyx pxd pxi" udlVersion="2.1">
3+
<Settings>
4+
<Global caseIgnored="no" allowFoldOfComments="no" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
5+
<Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
6+
</Settings>
7+
<KeywordLists>
8+
<Keywords name="Comments">00# 01 02 03&apos;&apos;&apos; 03&quot;&quot;&quot; 03r&apos;&apos;&apos; 03b&apos;&apos;&apos; 03u&apos;&apos;&apos; 03f&apos;&apos;&apos; 03r&quot;&quot;&quot; 03b&quot;&quot;&quot; 03u&quot;&quot;&quot; 03f&quot;&quot;&quot; 03R&apos;&apos;&apos; 03B&apos;&apos;&apos; 03U&apos;&apos;&apos; 03F&apos;&apos;&apos; 03R&quot;&quot;&quot; 03B&quot;&quot;&quot; 03U&quot;&quot;&quot; 03F&quot;&quot;&quot; 03rb&apos;&apos;&apos; 03rf&apos;&apos;&apos; 03br&apos;&apos;&apos; 03fr&apos;&apos;&apos; 03rb&quot;&quot;&quot; 03rf&quot;&quot;&quot; 03br&quot;&quot;&quot; 03fr&quot;&quot;&quot; 03Rb&apos;&apos;&apos; 03Rf&apos;&apos;&apos; 03Br&apos;&apos;&apos; 03Fr&apos;&apos;&apos; 03Rb&quot;&quot;&quot; 03Rf&quot;&quot;&quot; 03Br&quot;&quot;&quot; 03Fr&quot;&quot;&quot; 03rB&apos;&apos;&apos; 03rF&apos;&apos;&apos; 03bR&apos;&apos;&apos; 03fR&apos;&apos;&apos; 03rB&quot;&quot;&quot; 03rF&quot;&quot;&quot; 03bR&quot;&quot;&quot; 03fR&quot;&quot;&quot; 03RB&apos;&apos;&apos; 03RF&apos;&apos;&apos; 03BR&apos;&apos;&apos; 03FR&apos;&apos;&apos; 03RB&quot;&quot;&quot; 03RF&quot;&quot;&quot; 03BR&quot;&quot;&quot; 03FR&quot;&quot;&quot; 04&apos;&apos;&apos; 04&quot;&quot;&quot; 04&apos;&apos;&apos; 04&apos;&apos;&apos; 04&apos;&apos;&apos; 04&apos;&apos;&apos; 04&quot;&quot;&quot; 04&quot;&quot;&quot; 04&quot;&quot;&quot; 04&quot;&quot;&quot; 04&apos;&apos;&apos; 04&apos;&apos;&apos; 04&apos;&apos;&apos; 04&apos;&apos;&apos; 04&quot;&quot;&quot; 04&quot;&quot;&quot; 04&quot;&quot;&quot; 04&quot;&quot;&quot; 04&apos;&apos;&apos; 04&apos;&apos;&apos; 04&apos;&apos;&apos; 04&apos;&apos;&apos; 04&quot;&quot;&quot; 04&quot;&quot;&quot; 04&quot;&quot;&quot; 04&quot;&quot;&quot; 04&apos;&apos;&apos; 04&apos;&apos;&apos; 04&apos;&apos;&apos; 04&apos;&apos;&apos; 04&quot;&quot;&quot; 04&quot;&quot;&quot; 04&quot;&quot;&quot; 04&quot;&quot;&quot; 04&apos;&apos;&apos; 04&apos;&apos;&apos; 04&apos;&apos;&apos; 04&apos;&apos;&apos; 04&quot;&quot;&quot; 04&quot;&quot;&quot; 04&quot;&quot;&quot; 04&quot;&quot;&quot; 04&apos;&apos;&apos; 04&apos;&apos;&apos; 04&apos;&apos;&apos; 04&apos;&apos;&apos; 04&quot;&quot;&quot; 04&quot;&quot;&quot; 04&quot;&quot;&quot; 04&quot;&quot;&quot;</Keywords>
9+
<Keywords name="Numbers, prefix1"></Keywords>
10+
<Keywords name="Numbers, prefix2"></Keywords>
11+
<Keywords name="Numbers, extras1"></Keywords>
12+
<Keywords name="Numbers, extras2"></Keywords>
13+
<Keywords name="Numbers, suffix1"></Keywords>
14+
<Keywords name="Numbers, suffix2"></Keywords>
15+
<Keywords name="Numbers, range"></Keywords>
16+
<Keywords name="Operators1">+ - * / % @ &lt; &gt; &amp; | ^ ~ : = ! ( ) [ ] { } , : . ; \</Keywords>
17+
<Keywords name="Operators2"></Keywords>
18+
<Keywords name="Folders in code1, open"></Keywords>
19+
<Keywords name="Folders in code1, middle"></Keywords>
20+
<Keywords name="Folders in code1, close"></Keywords>
21+
<Keywords name="Folders in code2, open"></Keywords>
22+
<Keywords name="Folders in code2, middle"></Keywords>
23+
<Keywords name="Folders in code2, close"></Keywords>
24+
<Keywords name="Folders in comment, open"></Keywords>
25+
<Keywords name="Folders in comment, middle"></Keywords>
26+
<Keywords name="Folders in comment, close"></Keywords>
27+
<Keywords name="Keywords1">False True None NotImplemented Ellipsis __debug__ quit exit help copyright credits license</Keywords>
28+
<Keywords name="Keywords2">NULL</Keywords>
29+
<Keywords name="Keywords3">False True None and as assert async await break class continue def del elif else except finally for from global if import in is lambda nonlocal not or pass raise return try while with yield</Keywords>
30+
<Keywords name="Keywords4">cdef cpdef extern inline ctypedef include public readonly property nogil gil api cimport except? noexcept namespace cppclass new DEF IF ELIF ELSE __stdcall __cdecl</Keywords>
31+
<Keywords name="Keywords5">int float complex bool list tuple range str bytes bytearray memoryview set frozenset dict</Keywords>
32+
<Keywords name="Keywords6">char short long double size_t Py_ssize_t Py_hash_t Py_UCS4 signed unsigned bint const volatile void fused struct &quot;packed struct&quot; union enum</Keywords>
33+
<Keywords name="Keywords7">abs aiter all anext any ascii bin bool breakpoint bytearray bytes callable chr classmethod compile complex delattr dict dir divmod enumerate eval exec filter float format frozenset getattr globals hasattr hash help hex id input int isinstance issubclass iter len list locals map max memoryview min next object oct open ord pow print property range repr reversed round set setattr slice sorted staticmethod str sum super tuple type vars zip __import__</Keywords>
34+
<Keywords name="Keywords8">BaseException BaseExceptionGroup GeneratorExit KeyboardInterrupt SystemExit Exception ArithmeticError FloatingPointError OverflowError ZeroDivisionError AssertionError AttributeError BufferError EOFError ExceptionGroup BaseExceptionGroup ImportError ModuleNotFoundError LookupError IndexError KeyError MemoryError NameError UnboundLocalError OSError BlockingIOError ChildProcessError ConnectionError BrokenPipeError ConnectionAbortedError ConnectionRefusedError ConnectionResetError FileExistsError FileNotFoundError InterruptedError IsADirectoryError NotADirectoryError PermissionError ProcessLookupError TimeoutError ReferenceError RuntimeError NotImplementedError PythonFinalizationError RecursionError StopAsyncIteration StopIteration SyntaxError IndentationError TabError SystemError TypeError ValueError UnicodeError UnicodeDecodeError UnicodeEncodeError UnicodeTranslateError Warning BytesWarning DeprecationWarning EncodingWarning FutureWarning ImportWarning PendingDeprecationWarning ResourceWarning RuntimeWarning SyntaxWarning UnicodeWarning UserWarning</Keywords>
35+
<Keywords name="Delimiters">00&apos; 00&quot; 01\&apos; 01\&quot; 02&apos; 02&quot; 03r&apos; 03b&apos; 03u&apos; 03f&apos; 03r&quot; 03b&quot; 03u&quot; 03f&quot; 04 05&apos; 05&apos; 05&apos; 05&quot; 05&quot; 05&quot; 06R&apos; 06B&apos; 06U&apos; 06F&apos; 06R&quot; 06B&quot; 06U&quot; 06F&quot; 07 08&apos; 08&apos; 08&apos; 08&quot; 08&quot; 08&quot; 09rb&apos; 09rf&apos; 09br&apos; 09fr&apos; 09rb&quot; 09rf&quot; 09br&quot; 09fr&quot; 10 11&apos; 11&apos; 11&apos; 11&quot; 11&quot; 11&quot; 12Rb&apos; 12Rf&apos; 12Br&apos; 12Fr&apos; 12Rb&quot; 12Rf&quot; 12Br&quot; 12Fr&quot; 13 14&apos; 14&apos; 14&apos; 14&quot; 14&quot; 14&quot; 15rB&apos; 15rF&apos; 15bR&apos; 15fR&apos; 15rB&quot; 15rF&quot; 15bR&quot; 15fR&quot; 16 17&apos; 17&apos; 17&apos; 17&quot; 17&quot; 17&quot; 18RB&apos; 18RF&apos; 18BR&apos; 18FR&apos; 18RB&quot; 18RF&quot; 18BR&quot; 18FR&quot; 19 20&apos; 20&apos; 20&apos; 20&quot; 20&quot; 20&quot; 21 22 23</Keywords>
36+
</KeywordLists>
37+
<Styles>
38+
<WordsStyle name="DEFAULT" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
39+
<WordsStyle name="COMMENTS" fgColor="FF8040" bgColor="FFFFFF" fontStyle="0" nesting="0" />
40+
<WordsStyle name="LINE COMMENTS" fgColor="008000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
41+
<WordsStyle name="NUMBERS" fgColor="FF0000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
42+
<WordsStyle name="KEYWORDS1" fgColor="800080" bgColor="FFFFFF" fontStyle="1" nesting="0" />
43+
<WordsStyle name="KEYWORDS2" fgColor="800080" bgColor="FFFFFF" fontStyle="1" nesting="0" />
44+
<WordsStyle name="KEYWORDS3" fgColor="0000FF" bgColor="FFFFFF" fontStyle="1" nesting="0" />
45+
<WordsStyle name="KEYWORDS4" fgColor="0000FF" bgColor="FFFFFF" fontStyle="1" nesting="0" />
46+
<WordsStyle name="KEYWORDS5" fgColor="00D2D2" bgColor="FFFFFF" fontStyle="1" nesting="0" />
47+
<WordsStyle name="KEYWORDS6" fgColor="00D2D2" bgColor="FFFFFF" fontStyle="1" nesting="0" />
48+
<WordsStyle name="KEYWORDS7" fgColor="800080" bgColor="FFFFFF" fontStyle="1" nesting="0" />
49+
<WordsStyle name="KEYWORDS8" fgColor="800080" bgColor="FFFFFF" fontStyle="1" nesting="0" />
50+
<WordsStyle name="OPERATORS" fgColor="000080" bgColor="FFFFFF" fontStyle="1" nesting="0" />
51+
<WordsStyle name="FOLDER IN CODE1" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
52+
<WordsStyle name="FOLDER IN CODE2" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
53+
<WordsStyle name="FOLDER IN COMMENT" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
54+
<WordsStyle name="DELIMITERS1" fgColor="808080" bgColor="FFFFFF" fontStyle="0" nesting="0" />
55+
<WordsStyle name="DELIMITERS2" fgColor="808080" bgColor="FFFFFF" fontStyle="0" nesting="0" />
56+
<WordsStyle name="DELIMITERS3" fgColor="808080" bgColor="FFFFFF" fontStyle="0" nesting="0" />
57+
<WordsStyle name="DELIMITERS4" fgColor="808080" bgColor="FFFFFF" fontStyle="0" nesting="0" />
58+
<WordsStyle name="DELIMITERS5" fgColor="808080" bgColor="FFFFFF" fontStyle="0" nesting="0" />
59+
<WordsStyle name="DELIMITERS6" fgColor="808080" bgColor="FFFFFF" fontStyle="0" nesting="0" />
60+
<WordsStyle name="DELIMITERS7" fgColor="808080" bgColor="FFFFFF" fontStyle="0" nesting="0" />
61+
<WordsStyle name="DELIMITERS8" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
62+
</Styles>
63+
</UserLang>
64+
</NotepadPlus>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<!-- ==========================================================================\
3+
|
4+
| To learn how to make your own language parser, please check the following
5+
| link:
6+
| https://npp-user-manual.org/docs/function-list/
7+
|
8+
\=========================================================================== -->
9+
<NotepadPlus>
10+
<functionList>
11+
<!-- ====================================================== [ Cython ] -->
12+
13+
<parser
14+
displayName="Cython"
15+
id ="cython_syntax"
16+
commentExpr="(?s:'''.*?''')|(?m-s:#.*?$)"
17+
>
18+
<classRange
19+
mainExpr ="^((cp?)?def )?class \K.*?(?=\n\S|\Z)"
20+
>
21+
<className>
22+
<nameExpr expr="\w+(?=\s*[\(|:])" />
23+
</className>
24+
<function
25+
mainExpr="\s(async )?(cp?)?def \K[^\n]+?\(.*?(?=(:$|,$|:\s*#))"
26+
>
27+
<functionName>
28+
<funcNameExpr expr=".*" />
29+
</functionName>
30+
</function>
31+
</classRange>
32+
<function
33+
mainExpr="^(async )?(cp?)?def \K[^\n]+?\(.*?(?=(:$|,$|:\s*#))"
34+
>
35+
<functionName>
36+
<nameExpr expr=".*" />
37+
</functionName>
38+
</function>
39+
</parser>
40+
</functionList>
41+
</NotepadPlus>

udl-list.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,16 @@
673673
"author": "Tim Ayres",
674674
"homepage": "https://codeberg.org/3DLirious/curv"
675675
},
676+
{
677+
"id-name": "Cython_byFrederikLauf",
678+
"display-name": "Cython",
679+
"version": "v1.00",
680+
"repository": "",
681+
"description": "Cython Syntax Highlighting",
682+
"author": "Frederik Lauf",
683+
"functionList": true,
684+
"sample": "Cython_byFrederikLauf.pyx"
685+
},
676686
{
677687
"id-name": "Dart_Catpuccin-Macchiato",
678688
"display-name": "Dart (Catpuccin-Macchiato theme)",

0 commit comments

Comments
 (0)