summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRalf Gommers <ralf.gommers@gmail.com>2022-08-15 09:45:42 +0300
committerGitHub <noreply@github.com>2022-08-15 08:45:42 +0200
commit54a6200facc795988000b826f54fd291bf54bd46 (patch)
tree7ecf0e8b9352925361ed0eebcf2e33277eb9481a
parent7eabf7d806ec8ac8567b638711092c9312112ce9 (diff)
Add support for Cython (#927)
Co-authored-by: XAMPPRocky <4464295+XAMPPRocky@users.noreply.github.com>
-rw-r--r--README.md1
-rw-r--r--languages.json7
-rw-r--r--tests/data/cython.pyx29
3 files changed, 37 insertions, 0 deletions
diff --git a/README.md b/README.md
index c66767f..1d28f04 100644
--- a/README.md
+++ b/README.md
@@ -343,6 +343,7 @@ CSharp
CShell
Css
Cuda
+Cython
D
DAML
Dart
diff --git a/languages.json b/languages.json
index f409664..7cd260e 100644
--- a/languages.json
+++ b/languages.json
@@ -287,6 +287,13 @@
"quotes": [["\\\"", "\\\""]],
"extensions": ["cu"]
},
+ "Cython": {
+ "line_comment": ["#"],
+ "doc_quotes": [["\\\"\\\"\\\"", "\\\"\\\"\\\""], ["'''", "'''"]],
+ "quotes": [["\\\"", "\\\""], ["'", "'"]],
+ "env": ["cython"],
+ "extensions": ["pyx", "pxd", "pxi"]
+ },
"D": {
"line_comment": ["//"],
"multi_line_comments": [["/*", "*/"]],
diff --git a/tests/data/cython.pyx b/tests/data/cython.pyx
new file mode 100644
index 0000000..dfa6c7a
--- /dev/null
+++ b/tests/data/cython.pyx
@@ -0,0 +1,29 @@
+# 29 lines, 21 code, 3 comments, 5 blanks
+
+
+def add(x, y):
+ '''
+ Hello World
+ # Real Second line
+ Second line
+ '''
+ string = "Hello World #\
+ "
+ y += len(string)
+ # Add the two numbers.
+ x + y
+
+
+cdef add2(x, y):
+ """
+ Hello World
+ # Real Second line
+ Second line
+
+ Note that docstring lines are counted as code
+ """
+
+ string = "Hello World"
+ y += len(string)
+ # Add the two numbers.
+ x + y