summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAmr Hesham <amr96@programmer.net>2023-03-01 22:35:39 +0200
committerGitHub <noreply@github.com>2023-03-01 21:35:39 +0100
commit5713f523534229794b81d7944feac2c313e0d8a1 (patch)
tree1e2047bc58dd1a587a336bcf5cfc1aca6c84e38e /tests
parent97eb3d5ec7c1b3ea4fcf9dee30a2309cf92bd194 (diff)
downloadpygments-git-5713f523534229794b81d7944feac2c313e0d8a1.tar.gz
Add support for Carbon Programming Language (#2362)
Diffstat (limited to 'tests')
-rw-r--r--tests/examplefiles/carbon/example.carbon19
-rw-r--r--tests/examplefiles/carbon/example.carbon.output219
2 files changed, 238 insertions, 0 deletions
diff --git a/tests/examplefiles/carbon/example.carbon b/tests/examplefiles/carbon/example.carbon
new file mode 100644
index 00000000..9f906023
--- /dev/null
+++ b/tests/examplefiles/carbon/example.carbon
@@ -0,0 +1,19 @@
+package Sorting api;
+
+fn Partition[T: !Comparable & Movable](s : Slice(T)) -> i64 {
+ var i: i64 = -1;
+ for (e: T in s) {
+ ++i;
+ Swap(&s[i], &e);
+ }
+ return i;
+}
+
+fb QuickSort[T: !Comparable & Movable](s : Slice(T)) {
+ if (s.Size() <= 1) {
+ return;
+ }
+ let p: i64 = Partition(s);
+ QuickSort(s[:p - 1]);
+ QuickSort(s[p + 1:]);
+} \ No newline at end of file
diff --git a/tests/examplefiles/carbon/example.carbon.output b/tests/examplefiles/carbon/example.carbon.output
new file mode 100644
index 00000000..70d0db25
--- /dev/null
+++ b/tests/examplefiles/carbon/example.carbon.output
@@ -0,0 +1,219 @@
+'package' Keyword.Namespace
+' ' Text.Whitespace
+'Sorting' Name.Other
+' ' Text.Whitespace
+'api' Keyword.Namespace
+';' Punctuation
+'\n' Text.Whitespace
+
+'\n' Text.Whitespace
+
+'fn' Keyword.Declaration
+' ' Text.Whitespace
+'Partition' Name.Other
+'[' Punctuation
+'T' Name.Other
+':' Punctuation
+' ' Text.Whitespace
+'!' Punctuation
+'Comparable' Name.Other
+' ' Text.Whitespace
+'&' Operator
+' ' Text.Whitespace
+'Movable' Name.Other
+']' Punctuation
+'(' Punctuation
+'s' Name.Other
+' ' Text.Whitespace
+':' Punctuation
+' ' Text.Whitespace
+'Slice' Name.Other
+'(' Punctuation
+'T' Name.Other
+')' Punctuation
+')' Punctuation
+' ' Text.Whitespace
+'-' Operator
+'>' Punctuation
+' ' Text.Whitespace
+'i64' Keyword.Type
+' ' Text.Whitespace
+'{' Punctuation
+'\n' Text.Whitespace
+
+' ' Text.Whitespace
+'var' Keyword.Declaration
+' ' Text.Whitespace
+'i' Name.Other
+':' Punctuation
+' ' Text.Whitespace
+'i64' Keyword.Type
+' ' Text.Whitespace
+'=' Punctuation
+' ' Text.Whitespace
+'-' Operator
+'1' Literal.Number.Integer
+';' Punctuation
+'\n' Text.Whitespace
+
+' ' Text.Whitespace
+'for' Keyword
+' ' Text.Whitespace
+'(' Punctuation
+'e' Name.Other
+':' Punctuation
+' ' Text.Whitespace
+'T' Name.Other
+' ' Text.Whitespace
+'in' Keyword
+' ' Text.Whitespace
+'s' Name.Other
+')' Punctuation
+' ' Text.Whitespace
+'{' Punctuation
+'\n' Text.Whitespace
+
+' ' Text.Whitespace
+'++' Operator
+'i' Name.Other
+';' Punctuation
+'\n' Text.Whitespace
+
+' ' Text.Whitespace
+'Swap' Name.Other
+'(' Punctuation
+'&' Operator
+'s' Name.Other
+'[' Punctuation
+'i' Name.Other
+']' Punctuation
+',' Punctuation
+' ' Text.Whitespace
+'&' Operator
+'e' Name.Other
+')' Punctuation
+';' Punctuation
+'\n' Text.Whitespace
+
+' ' Text.Whitespace
+'}' Punctuation
+'\n' Text.Whitespace
+
+' ' Text.Whitespace
+'return' Keyword
+' ' Text.Whitespace
+'i' Name.Other
+';' Punctuation
+'\n' Text.Whitespace
+
+'}' Punctuation
+'\n' Text.Whitespace
+
+'\n' Text.Whitespace
+
+'fb' Name.Other
+' ' Text.Whitespace
+'QuickSort' Name.Other
+'[' Punctuation
+'T' Name.Other
+':' Punctuation
+' ' Text.Whitespace
+'!' Punctuation
+'Comparable' Name.Other
+' ' Text.Whitespace
+'&' Operator
+' ' Text.Whitespace
+'Movable' Name.Other
+']' Punctuation
+'(' Punctuation
+'s' Name.Other
+' ' Text.Whitespace
+':' Punctuation
+' ' Text.Whitespace
+'Slice' Name.Other
+'(' Punctuation
+'T' Name.Other
+')' Punctuation
+')' Punctuation
+' ' Text.Whitespace
+'{' Punctuation
+'\n' Text.Whitespace
+
+' ' Text.Whitespace
+'if' Keyword
+' ' Text.Whitespace
+'(' Punctuation
+'s' Name.Other
+'.' Punctuation
+'Size' Name.Other
+'(' Punctuation
+')' Punctuation
+' ' Text.Whitespace
+'<=' Operator
+' ' Text.Whitespace
+'1' Literal.Number.Integer
+')' Punctuation
+' ' Text.Whitespace
+'{' Punctuation
+'\n' Text.Whitespace
+
+' ' Text.Whitespace
+'return' Keyword
+';' Punctuation
+'\n' Text.Whitespace
+
+' ' Text.Whitespace
+'}' Punctuation
+'\n' Text.Whitespace
+
+' ' Text.Whitespace
+'let' Keyword.Declaration
+' ' Text.Whitespace
+'p' Name.Other
+':' Punctuation
+' ' Text.Whitespace
+'i64' Keyword.Type
+' ' Text.Whitespace
+'=' Punctuation
+' ' Text.Whitespace
+'Partition' Name.Other
+'(' Punctuation
+'s' Name.Other
+')' Punctuation
+';' Punctuation
+'\n' Text.Whitespace
+
+' ' Text.Whitespace
+'QuickSort' Name.Other
+'(' Punctuation
+'s' Name.Other
+'[' Punctuation
+':' Punctuation
+'p' Name.Other
+' ' Text.Whitespace
+'-' Operator
+' ' Text.Whitespace
+'1' Literal.Number.Integer
+']' Punctuation
+')' Punctuation
+';' Punctuation
+'\n' Text.Whitespace
+
+' ' Text.Whitespace
+'QuickSort' Name.Other
+'(' Punctuation
+'s' Name.Other
+'[' Punctuation
+'p' Name.Other
+' ' Text.Whitespace
+'+' Operator
+' ' Text.Whitespace
+'1' Literal.Number.Integer
+':' Punctuation
+']' Punctuation
+')' Punctuation
+';' Punctuation
+'\n' Text.Whitespace
+
+'}' Punctuation
+'\n' Text.Whitespace