/** Example Configration **/

# One line comment
//One line comment
/*
 *  Multi line comment
 */

// Define enumeration
enum Color {
	Red,
	Yellow = 4,
	Green
}

// Define an integer variable
Int = 35;

// Define a float variable
Float = 50.5;

// Define a string variable
String = "Hello";

// Define a path variable
Path = '%JAVA_HOME%/bin';

// Define a enumeration variable
Enum = Color.Green;

// Define a base64 variable
Base64 = b"SGVsbG8gV29ybGQ=";

// Define a tuple variable
Tuple = (12, "ABC", 25.5);

// Define a array variable
Array = [
	"ABC",
	"DEFG",
	"HIJKL",
];

// Define a hash variable
Hash = {
	first : 1,
	second : 2.0,
	third : "3",
};

// Define a node variable
Node : {
	Int = 102;
	Float = 32.9;
	
	Section = node {
		Int = 8;
		String  = "Section";
		Items = [
			"Hello",
			"Good night",
			"Hi",
		];
	};
	
	Nodes = [
		node {
			A = "A character";
			B = "B character";
			ARRAY = [
				node {
					A = 1;
				},
				node {
					B = 5;
				}
			];
		},
		node {
			A = "First";
			C = "Second";
			ARRAY = [
				node {
					A = 10;
				},
				node {
					B = 50;
				}
			];
		},
	];
	
	Hash = {
		abc : node {
			B = "1";
		},
		def : node {
			A = "2";
			B = "5";
		}
	};
}

// Expression examples
Value1 = Int * 5 + 10;
Value2 = "{" + String + "}";
Value3 = Node.Float * Float / 7.0;
Value4 = Array[2];
Value5 = Hash["second"];
Value6 = Node.Int + Node.Section.Int;
Value7 = (Float == 50.5 ? "Ok" : "Ng");
Value8 = Node.Nodes[1].A;
Value9 = Part.Third;
Value10 = Def1000;
Value11 = Value1 < 500 ? "Less" : "Greater";

// If statement example
if(Int >= 20) {
	Value13 = "Greater";
} else {
	Value13 = "Less";
}



//----- Validator definitions -----

StringValidatorArray = [
	"Good", "Hi", "Hello"
];

validator {
	// Mandatory definition with an Int type value between 10 and 100, with a default value of 50.
	Int = int(10, 100) @ 50;
	
	// Optional definition with a Float type value of 50 or more, with a default value of 200.
	Float ? float(50.0, *) @ 200.0;
	
	// Mandatory definition with a String type value that matches the regular expression, with a default value of 'Default'.
	String = string("[a-zA-Z]+") @ "Default;";
	
	// Mandatory definition with a String type value that matches one of the StringValidatorArray elements, with a default value of 'Good'.
	String2 = string(StringValidatorArray) @ "Good";
	
	// Mandatory definition with a Path type value, with a default value of 'C:/'.
	Path = path @ "C:/";
	
	// Optional definition with an Enum type value of 'Color', with a default value of 'Color.Yellow'.
	Enum ? enum Color @ Color.Yellow;
	
	// Mandatory definition with a Base64 type value, with a default value of 'V29ybGQ='.
	Base64 = base64 @ b"V29ybGQ=";
	
	// Mandatory definition with a Tuple type value containing three elements defined below.
	Tuple = tuple(int(10, 20), string("[A-Z]+"), float);
	
	// Optional definition with an array type value consisting of String elements that match the regular expression.
	Array ? array string("[A-Z]+");
	
	// Hash value with an arbitrary definition.
	Hash = hash;
	
	// Node value with a mandatory definition, followed by the one below.
	Node = node {
		
		// Integer value with a mandatory definition, validated by a user-defined function.
		Int = int(@CheckMultiplsOf3) @ 30;
		
		Float = float @ 200.25;
		
		Section = node {
			Int ? int;
			String ? string;
			Items = array;
		};
		
		// It is node array validator
		Nodes = array node {
			A = string @ "(A)";
			B = string @ "(B)";
			C = string("[a-zA-Z\\(\\)]+") @ "(C)";
			
			ARRAY = array node {
				A = int @ 100;
				B = int @ 500;
			};
		};
		
		// It is node hash validator
		Hash = hash node {
			A = string @ "Abc";
			B = string;
		};
		
	};
	
}

