summaryrefslogtreecommitdiff
path: root/tests/examplefiles/example.ceylon
diff options
context:
space:
mode:
authorEnrique Zamudio <alterbass@gmail.com>2012-08-20 10:30:20 -0500
committerEnrique Zamudio <alterbass@gmail.com>2012-08-20 10:30:20 -0500
commit58a678a814b4e021f96558037e7212b21222f896 (patch)
treec040ec512785fa50a4a165f591faf958332866a1 /tests/examplefiles/example.ceylon
parent166c2e48c97e8ccc5f39d0fc04bd2760a1dd0c15 (diff)
downloadpygments-58a678a814b4e021f96558037e7212b21222f896.tar.gz
Example file for Ceylon lexer
Diffstat (limited to 'tests/examplefiles/example.ceylon')
-rw-r--r--tests/examplefiles/example.ceylon33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/examplefiles/example.ceylon b/tests/examplefiles/example.ceylon
new file mode 100644
index 00000000..b136b995
--- /dev/null
+++ b/tests/examplefiles/example.ceylon
@@ -0,0 +1,33 @@
+doc "A top-level function,
+ with multi-line documentation."
+void topLevel(String? a, Integer b=5, String... seqs) {
+ function nested(String s) {
+ print(s[1..2]);
+ return true;
+ }
+ for (s in seqs.filter((String x) x.size > 2)) {
+ nested(s);
+ }
+ value uppers = seqs.sequence[].uppercased;
+ String|Nothing z = a;
+ Sequence<Integer> ints = { 1, 2, 3, 4, 5 };
+}
+
+shared class Example<Element>(name, element) satisfies Comparable<Example<Element>>
+ given Element satisfies Comparable<Element> {
+ shared String name;
+ shared Element element;
+
+ shared actual Comparison compare(Example<Element> other) {
+ return element <=> other.element;
+ }
+
+ shared actual String string {
+ return "Example with " + element.string;
+ }
+}
+
+Example<Integer> instance = Example {
+ name = "Named args call";
+ element = 5;
+};