editor/test/files/syntax_highlighting.d
2025-09-15 17:44:02 +10:00

74 lines
923 B
D

import std.stdio;
@nogc: bool
Test()
{
int x = 5;
int y = 10;
x = x + y;
x = x - y;
x = x / y;
x = x * y;
x = x % y;
x += y;
x -= y;
x /= y;
x *= y;
x %= y;
x = x & y;
x = x | y;
x = x ^ y;
x = ~x;
x ~= x;
// Commented here
if(x > 1L && y < 2u || x <= 3U && y >= 4Lu || x == 5LU && x != 6uL || x == 7UL)
{
return true;
}
float z = 10.5F;
float w = 11.25f;
real r = 200.55L;
z = e+102.5;
z = e-00.25;
int hex = 0x555;
int hex2 = 0X555;
int hexp = p+0X5555-;
hexp = p-0x555;
string str_literal = r"Teststring";
string str = "test string";
char ch = 'c';
u8[] array = [
1, 2, 3, 4, 5
];
array[5] = 22;
int value = WithParameters(z, str);
int h = MacroFunc!(int)(x);
int g = MacroFunc!int(x);
return false;
}
int WithParameters(float x, string y)
{
assert(y.length > 0, "String must not be empty");
return cast(int)(x) - y[0];
}
T MacroFunc(T)(T x)
{
return x;
}