diff options
author | Alex Zimin <ziminav@gmail.com> | 2011-06-08 00:05:07 +0800 |
---|---|---|
committer | Alex Zimin <ziminav@gmail.com> | 2011-06-08 00:05:07 +0800 |
commit | dc887220a592b9122b383575136e22246fe861e3 (patch) | |
tree | 81f1512eb12678d1b54ec74fbf53fb322f1c7c0a /tests/examplefiles/nemerle_sample.n | |
parent | 61b7028e766919dde16f7e9e274daa3e086c9690 (diff) | |
download | pygments-dc887220a592b9122b383575136e22246fe861e3.tar.gz |
nemerle sample file
Diffstat (limited to 'tests/examplefiles/nemerle_sample.n')
-rw-r--r-- | tests/examplefiles/nemerle_sample.n | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/tests/examplefiles/nemerle_sample.n b/tests/examplefiles/nemerle_sample.n new file mode 100644 index 00000000..16ed88cd --- /dev/null +++ b/tests/examplefiles/nemerle_sample.n @@ -0,0 +1,85 @@ +using System; + +namespace Demo.Ns +{ + /// sample class + public class ClassSample : Base + { + /* sample multiline comment */ +#region region sample + fieldSample : int; +#endregion + + public virtual someMethod(str : string) : list[double] + { + def x = "simple string"; + def x = $"simple $splice string"; + def x = <# + recursive <# string #> sample + #>; + def x = $<# + recursive $splice <# string #> sample + #>; + + def localFunc(arg) + { + arg + 1; + } + + match (localFunc(2)) + { + | 3 => "ok"; + | _ => "fail"; + } + + using (x = SomeObject()) + { + foreach (item in someCollection) + { + def i = try + { + int.Parse(item) + } + catch + { + | _ is FormatException => 0; + } + when (i > 0xff) + unless (i < 555L) + WriteLine(i); + + } + } + protected override overrideSample() : void + {} + + private privateSample() : void + {} + + public abstract abstractSample() : void + {} + } + + } + + module ModuleSample + { + } + + variant RgbColor { + | Red + | Yellow + | Green + | Different { + red : float; + green : float; + blue : float; + } + } + + macro sampleMacro(expr) + syntax ("write", expr) + { + <[ WriteLine($expr) ]> + } +} |