Skip to content

Add Cython UDL with sample, functionList and unittest #318

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +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"}
35 changes: 35 additions & 0 deletions UDL-samples/Cython_byFrederikLauf.pyx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
cdef double myVariable = 5.5

cdef int myCyFunction(int i, int j):
if i == j:
return 1
else:
return 0

cpdef int myOtherCyFunction(int i, int j):
if i == j:
return 1
else:
return 0

def myPyFunction():
pass

cdef class MyCythonClass():

cdef public int invisible_variable

cdef public double[:] myCyClassMethod(self):
pass

def myPyClassMethod(self):
pass

class MyPythonClass():

class _invisibleNestedClass:
def _visibleNestedClassMethod(self):
pass

def myPyClassMethod(self):
pass
64 changes: 64 additions & 0 deletions UDLs/Cython_byFrederikLauf.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<NotepadPlus>
<UserLang name="Cython" ext="pyx pxd pxi" udlVersion="2.1">
<Settings>
<Global caseIgnored="no" allowFoldOfComments="no" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
<Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
</Settings>
<KeywordLists>
<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>
<Keywords name="Numbers, prefix1"></Keywords>
<Keywords name="Numbers, prefix2"></Keywords>
<Keywords name="Numbers, extras1"></Keywords>
<Keywords name="Numbers, extras2"></Keywords>
<Keywords name="Numbers, suffix1"></Keywords>
<Keywords name="Numbers, suffix2"></Keywords>
<Keywords name="Numbers, range"></Keywords>
<Keywords name="Operators1">+ - * / % @ &lt; &gt; &amp; | ^ ~ : = ! ( ) [ ] { } , : . ; \</Keywords>
<Keywords name="Operators2"></Keywords>
<Keywords name="Folders in code1, open"></Keywords>
<Keywords name="Folders in code1, middle"></Keywords>
<Keywords name="Folders in code1, close"></Keywords>
<Keywords name="Folders in code2, open"></Keywords>
<Keywords name="Folders in code2, middle"></Keywords>
<Keywords name="Folders in code2, close"></Keywords>
<Keywords name="Folders in comment, open"></Keywords>
<Keywords name="Folders in comment, middle"></Keywords>
<Keywords name="Folders in comment, close"></Keywords>
<Keywords name="Keywords1">False True None NotImplemented Ellipsis __debug__ quit exit help copyright credits license</Keywords>
<Keywords name="Keywords2">NULL</Keywords>
<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>
<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>
<Keywords name="Keywords5">int float complex bool list tuple range str bytes bytearray memoryview set frozenset dict</Keywords>
<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>
<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>
<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>
<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>
</KeywordLists>
<Styles>
<WordsStyle name="DEFAULT" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="COMMENTS" fgColor="FF8040" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="LINE COMMENTS" fgColor="008000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="NUMBERS" fgColor="FF0000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS1" fgColor="800080" bgColor="FFFFFF" fontStyle="1" nesting="0" />
<WordsStyle name="KEYWORDS2" fgColor="800080" bgColor="FFFFFF" fontStyle="1" nesting="0" />
<WordsStyle name="KEYWORDS3" fgColor="0000FF" bgColor="FFFFFF" fontStyle="1" nesting="0" />
<WordsStyle name="KEYWORDS4" fgColor="0000FF" bgColor="FFFFFF" fontStyle="1" nesting="0" />
<WordsStyle name="KEYWORDS5" fgColor="00D2D2" bgColor="FFFFFF" fontStyle="1" nesting="0" />
<WordsStyle name="KEYWORDS6" fgColor="00D2D2" bgColor="FFFFFF" fontStyle="1" nesting="0" />
<WordsStyle name="KEYWORDS7" fgColor="800080" bgColor="FFFFFF" fontStyle="1" nesting="0" />
<WordsStyle name="KEYWORDS8" fgColor="800080" bgColor="FFFFFF" fontStyle="1" nesting="0" />
<WordsStyle name="OPERATORS" fgColor="000080" bgColor="FFFFFF" fontStyle="1" nesting="0" />
<WordsStyle name="FOLDER IN CODE1" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="FOLDER IN CODE2" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="FOLDER IN COMMENT" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS1" fgColor="808080" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS2" fgColor="808080" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS3" fgColor="808080" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS4" fgColor="808080" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS5" fgColor="808080" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS6" fgColor="808080" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS7" fgColor="808080" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS8" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
</Styles>
</UserLang>
</NotepadPlus>
41 changes: 41 additions & 0 deletions functionList/Cython_byFrederikLauf.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!-- ==========================================================================\
|
| To learn how to make your own language parser, please check the following
| link:
| https://npp-user-manual.org/docs/function-list/
|
\=========================================================================== -->
<NotepadPlus>
<functionList>
<!-- ====================================================== [ Cython ] -->

<parser
displayName="Cython"
id ="cython_syntax"
commentExpr="(?s:'''.*?''')|(?m-s:#.*?$)"
>
<classRange
mainExpr ="^((cp?)?def )?class \K.*?(?=\n\S|\Z)"
>
<className>
<nameExpr expr="\w+(?=\s*[\(|:])" />
</className>
<function
mainExpr="\s(async )?(cp?)?def \K[^\n]+?\(.*?(?=(:$|,$|:\s*#))"
>
<functionName>
<funcNameExpr expr=".*" />
</functionName>
</function>
</classRange>
<function
mainExpr="^(async )?(cp?)?def \K[^\n]+?\(.*?(?=(:$|,$|:\s*#))"
>
<functionName>
<nameExpr expr=".*" />
</functionName>
</function>
</parser>
</functionList>
</NotepadPlus>
20 changes: 15 additions & 5 deletions udl-list.json
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,16 @@
"author": "Tim Ayres",
"homepage": "https://codeberg.org/3DLirious/curv"
},
{
"id-name": "Cython_byFrederikLauf",
"display-name": "Cython",
"version": "v1.00",
"repository": "",
"description": "Cython Syntax Highlighting",
"author": "Frederik Lauf",
"functionList": true,
"sample": "Cython_byFrederikLauf.pyx"
},
{
"id-name": "Dart_Catpuccin-Macchiato",
"display-name": "Dart (Catpuccin-Macchiato theme)",
Expand Down Expand Up @@ -951,7 +961,7 @@
"display-name": "Fobagraph Script DarkMode",
"version": "18/10/2023 17:40:00 GMT",
"sample": "Fobagraph_Script_by_HelloWorldFR.bia",
"repository": "https://github.com/HelloWorldFR/userDefinedLanguages/blob/master/UDLs/Fobagraph_Script_(.bia)_DarkMode_by_HelloWorldFR.xml",
"repository": "",
"description": "Fobagraph Script for laser machine",
"author": "HelloWorldFR",
"homepage": "https://github.com/HelloWorldFR/"
Expand All @@ -962,7 +972,7 @@
"autoCompletion": "fobagraph",
"version": "18/10/2023 17:40:00 GMT",
"sample": "Fobagraph_Script_by_HelloWorldFR.bia",
"repository": "https://github.com/HelloWorldFR/userDefinedLanguages/blob/master/UDLs/Fobagraph_Script_(.bia)_LightMode_by_HelloWorldFR.xml",
"repository": "",
"description": "Fobagraph Script for laser machine",
"author": "HelloWorldFR",
"homepage": "https://github.com/HelloWorldFR/"
Expand Down Expand Up @@ -1899,7 +1909,7 @@
"id-name": "OCI_Terraform_by_robin_s_chatterjee",
"display-name": "OCI_Terraform",
"version": "1.0.0",
"repository": "https://github.com/robinchatterjee/userDefinedLanguages/blob/master/UDLs/OCI_Terraform_by_robin_s_chatterjee.xml",
"repository": "",
"description": "Terraform HCL language with Oracle CLoud Infrastructure OCI specific syntax highlighting",
"autoCompletion": true,
"author": "Robin Saikat Chatterjee",
Expand Down Expand Up @@ -2293,7 +2303,7 @@
"id-name": "RISCV-Light_byAidanDempsey",
"display-name": "RISC-V",
"version": "2023-Mar-04",
"repository": "https://github.com/aidan-d123/riscv_npp/blob/main/RISCV-Light_byAidanDempsey.xml",
"repository": "",
"description": "RISC-V UDL File for Notepad++",
"author": "Aidan Dempsey",
"homepage": "https://github.com/aidan-d123/riscv_npp"
Expand Down Expand Up @@ -2335,7 +2345,7 @@
"id-name": "Rust_byPaoloFalabella",
"display-name": "Rust Language",
"version": "12-30-2013",
"repository": "https://github.com/pfalabella/Rust-notepadplusplus/blob/master/darkThemeCompatible.xml",
"repository": "",
"description": "Rust Language",
"author": "Paolo Falabella",
"homepage": "https://github.com/pfalabella/Rust-notepadplusplus"
Expand Down