Browse Source

Add some samples to test latest changes.

mingodad 8 years ago
parent
commit
08e2e5d017

+ 6 - 0
SquiLu/samples/test-enum-type.nut

@@ -0,0 +1,6 @@
+{
+  enum option_type { OPT_FLAG=1, OPT_INT};
+  option_type opt = option_type.OPT_FLAG;
+  print("opt", opt, option_type.OPT_INT);
+  print(type(opt));
+}

+ 57 - 0
SquiLu/samples/test-ifdef.nut

@@ -0,0 +1,57 @@
+//#include "test-ifdef.nut"
+
+# define DEBUG
+
+print("Top !");
+#ifndef ANY
+	print("Any !");
+	#ifdef SOME
+		print("Some !");
+		#define ANY3
+		#ifdef NESTED
+			print("Some nested !");
+			#ifdef NESTED2
+				print("Some nested2 !");
+			#else
+				print("Else Some nested2 !");
+			#endif
+		#else
+			#ifdef NESTED3
+				print("Some nested3 !");
+			#else
+				print("Else Some nested3 !");
+			#endif
+			print("Else Some nested !");
+		#endif
+	#endif
+	print("Another any !");
+	#ifndef ANY2
+		print("Any2 !");
+		#ifdef ANY3
+			print("Any3 !");
+		#else
+			print("Esle Any3 !");
+		#endif
+		#ifndef ANY4
+			print("Any4 !");
+		#else
+			print("Esle Any4 !");
+		#endif
+		print("Another any2 !");
+	#endif
+#endif
+#ifdef DEBUG
+	print("Debug code");
+#else
+	print("Non debug code");
+#endif
+
+#undef DEBUG
+
+#ifdef DEBUG
+	print("Debug code2");
+#else
+	print("Non debug code2");
+#endif
+
+print("Botton !");

+ 13 - 0
SquiLu/samples/test-nested-comments.nut

@@ -0,0 +1,13 @@
+/*
+A comment
+/*
+	A nested comment
+	/*
+		Another nested comment
+	*/
+*/
+*/
+
+local a = 3;
+local b = 4;
+print(a, b);