This repository has been archived on 2024-06-20. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
coffee.pygments/tests/examplefiles/nemerle/nemerle_sample.n
Oleh Prypin 6f43092173
Also add auto-updatable output-based tests to examplefiles (#1689)
Co-authored-by: Georg Brandl <georg@python.org>
2021-01-20 10:48:45 +01:00

87 lines
1.5 KiB
Text

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 $(spliceMethod() + 1)";
def x = <#
recursive <# string #> sample
#>;
def x = $<#
recursive $splice <# string #> sample
..$(lst; "; "; x => $"x * 2 = $(x * 2)") str
#>;
def x = @"somestring \";
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 : dyn)) ]>
}
}