summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAmr Hesham <amr96@programmer.net>2023-03-02 15:44:12 +0200
committerGitHub <noreply@github.com>2023-03-02 14:44:12 +0100
commit2a0503bf066510a3f0af6c7112d623d17a5058b7 (patch)
tree05288082305ebd29824f637a188234bbf3c2a258 /tests
parent12a4d51be7f931cffca4dc9e6ca07ece75e8352a (diff)
downloadpygments-git-2a0503bf066510a3f0af6c7112d623d17a5058b7.tar.gz
Add support for more declarations and access modifiers in Carbon lexer (#2366)
Diffstat (limited to 'tests')
-rw-r--r--tests/examplefiles/carbon/declarations.carbon30
-rw-r--r--tests/examplefiles/carbon/declarations.carbon.output248
2 files changed, 278 insertions, 0 deletions
diff --git a/tests/examplefiles/carbon/declarations.carbon b/tests/examplefiles/carbon/declarations.carbon
new file mode 100644
index 00000000..4f61d307
--- /dev/null
+++ b/tests/examplefiles/carbon/declarations.carbon
@@ -0,0 +1,30 @@
+package ExplorerTest api;
+
+choice MyOptionalElement(ZZ:! type, YY:! type) {
+ None(YY),
+ Element(ZZ)
+}
+
+abstract class C {
+ var a: i32;
+}
+
+base class B {
+ var value_b: i32;
+}
+
+interface Vector {
+ fn Zero() -> Self;
+ fn Add[self: Self](b: Self) -> Self;
+ fn Scale[self: Self](v: i32) -> Self;
+}
+
+class Pal {
+ private var x: i32;
+ protected var y: i32;
+ friend Buddy;
+}
+
+abstract class MyAbstractClass {
+ protected fn Create() -> partial Self { }
+} \ No newline at end of file
diff --git a/tests/examplefiles/carbon/declarations.carbon.output b/tests/examplefiles/carbon/declarations.carbon.output
new file mode 100644
index 00000000..d6012526
--- /dev/null
+++ b/tests/examplefiles/carbon/declarations.carbon.output
@@ -0,0 +1,248 @@
+'package' Keyword.Namespace
+' ' Text.Whitespace
+'ExplorerTest' Name.Other
+' ' Text.Whitespace
+'api' Keyword.Namespace
+';' Punctuation
+'\n' Text.Whitespace
+
+'\n' Text.Whitespace
+
+'choice' Keyword.Declaration
+' ' Text.Whitespace
+'MyOptionalElement' Name.Other
+'(' Punctuation
+'ZZ' Name.Other
+':' Punctuation
+'!' Punctuation
+' ' Text.Whitespace
+'type' Name.Other
+',' Punctuation
+' ' Text.Whitespace
+'YY' Name.Other
+':' Punctuation
+'!' Punctuation
+' ' Text.Whitespace
+'type' Name.Other
+')' Punctuation
+' ' Text.Whitespace
+'{' Punctuation
+'\n' Text.Whitespace
+
+' ' Text.Whitespace
+'None' Name.Other
+'(' Punctuation
+'YY' Name.Other
+')' Punctuation
+',' Punctuation
+'\n' Text.Whitespace
+
+' ' Text.Whitespace
+'Element' Name.Other
+'(' Punctuation
+'ZZ' Name.Other
+')' Punctuation
+'\n' Text.Whitespace
+
+'}' Punctuation
+'\n' Text.Whitespace
+
+'\n' Text.Whitespace
+
+'abstract' Keyword.Declaration
+' ' Text.Whitespace
+'class' Keyword.Declaration
+' ' Text.Whitespace
+'C' Name.Other
+' ' Text.Whitespace
+'{' Punctuation
+'\n' Text.Whitespace
+
+' ' Text.Whitespace
+'var' Keyword.Declaration
+' ' Text.Whitespace
+'a' Name.Other
+':' Punctuation
+' ' Text.Whitespace
+'i32' Keyword.Type
+';' Punctuation
+'\n' Text.Whitespace
+
+'}' Punctuation
+'\n' Text.Whitespace
+
+'\n' Text.Whitespace
+
+'base' Keyword.Declaration
+' ' Text.Whitespace
+'class' Keyword.Declaration
+' ' Text.Whitespace
+'B' Name.Other
+' ' Text.Whitespace
+'{' Punctuation
+'\n' Text.Whitespace
+
+' ' Text.Whitespace
+'var' Keyword.Declaration
+' ' Text.Whitespace
+'value_b' Name.Other
+':' Punctuation
+' ' Text.Whitespace
+'i32' Keyword.Type
+';' Punctuation
+'\n' Text.Whitespace
+
+'}' Punctuation
+'\n' Text.Whitespace
+
+'\n' Text.Whitespace
+
+'interface' Keyword.Declaration
+' ' Text.Whitespace
+'Vector' Name.Other
+' ' Text.Whitespace
+'{' Punctuation
+'\n' Text.Whitespace
+
+' ' Text.Whitespace
+'fn' Keyword.Declaration
+' ' Text.Whitespace
+'Zero' Name.Other
+'(' Punctuation
+')' Punctuation
+' ' Text.Whitespace
+'-' Operator
+'>' Punctuation
+' ' Text.Whitespace
+'Self' Keyword
+';' Punctuation
+'\n' Text.Whitespace
+
+' ' Text.Whitespace
+'fn' Keyword.Declaration
+' ' Text.Whitespace
+'Add' Name.Other
+'[' Punctuation
+'self' Keyword.Pseudo
+':' Punctuation
+' ' Text.Whitespace
+'Self' Keyword
+']' Punctuation
+'(' Punctuation
+'b' Name.Other
+':' Punctuation
+' ' Text.Whitespace
+'Self' Keyword
+')' Punctuation
+' ' Text.Whitespace
+'-' Operator
+'>' Punctuation
+' ' Text.Whitespace
+'Self' Keyword
+';' Punctuation
+'\n' Text.Whitespace
+
+' ' Text.Whitespace
+'fn' Keyword.Declaration
+' ' Text.Whitespace
+'Scale' Name.Other
+'[' Punctuation
+'self' Keyword.Pseudo
+':' Punctuation
+' ' Text.Whitespace
+'Self' Keyword
+']' Punctuation
+'(' Punctuation
+'v' Name.Other
+':' Punctuation
+' ' Text.Whitespace
+'i32' Keyword.Type
+')' Punctuation
+' ' Text.Whitespace
+'-' Operator
+'>' Punctuation
+' ' Text.Whitespace
+'Self' Keyword
+';' Punctuation
+'\n' Text.Whitespace
+
+'}' Punctuation
+'\n' Text.Whitespace
+
+'\n' Text.Whitespace
+
+'class' Keyword.Declaration
+' ' Text.Whitespace
+'Pal' Name.Other
+' ' Text.Whitespace
+'{' Punctuation
+'\n' Text.Whitespace
+
+' ' Text.Whitespace
+'private' Keyword
+' ' Text.Whitespace
+'var' Keyword.Declaration
+' ' Text.Whitespace
+'x' Name.Other
+':' Punctuation
+' ' Text.Whitespace
+'i32' Keyword.Type
+';' Punctuation
+'\n' Text.Whitespace
+
+' ' Text.Whitespace
+'protected' Keyword
+' ' Text.Whitespace
+'var' Keyword.Declaration
+' ' Text.Whitespace
+'y' Name.Other
+':' Punctuation
+' ' Text.Whitespace
+'i32' Keyword.Type
+';' Punctuation
+'\n' Text.Whitespace
+
+' ' Text.Whitespace
+'friend' Keyword
+' ' Text.Whitespace
+'Buddy' Name.Other
+';' Punctuation
+'\n' Text.Whitespace
+
+'}' Punctuation
+'\n' Text.Whitespace
+
+'\n' Text.Whitespace
+
+'abstract' Keyword.Declaration
+' ' Text.Whitespace
+'class' Keyword.Declaration
+' ' Text.Whitespace
+'MyAbstractClass' Name.Other
+' ' Text.Whitespace
+'{' Punctuation
+'\n' Text.Whitespace
+
+' ' Text.Whitespace
+'protected' Keyword
+' ' Text.Whitespace
+'fn' Keyword.Declaration
+' ' Text.Whitespace
+'Create' Name.Other
+'(' Punctuation
+')' Punctuation
+' ' Text.Whitespace
+'-' Operator
+'>' Punctuation
+' ' Text.Whitespace
+'partial' Keyword
+' ' Text.Whitespace
+'Self' Keyword
+' ' Text.Whitespace
+'{' Punctuation
+' ' Text.Whitespace
+'}' Punctuation
+'\n' Text.Whitespace
+
+'}' Punctuation
+'\n' Text.Whitespace