3 # This file is part of NIT ( http://www.nitlanguage.org ).
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # Test case for syntax highlighters.
19 # Also test spell-checking and comment recognition.
21 # TODO: Fix the annotations so the module actually compiles.
23 # SEE: [Nit](http://nitlanguage.org)
26 new_annotation new_annotation
45 no_warning
("fictive-module")
48 pkgconfig
("a libray from outer space")
50 ldflags
"-framework Foundation"
57 intrude import core
::abstract_collection
64 #import <Foundation/Foundation.h>
67 abstract class Blurry[ELEM_ENT: nullable Object]
68 super core
::kernel
::Object
76 new do return new Concrete[Bool]
78 # Stromgol says "Dou, dou, dou…"
79 var stromgol
: String = "Dou, dou, dou…"
81 fun isset_stromgol
: Bool do return isset _stromgol
83 var foo
: Int is writable, noinit
87 protected fun shield
(x
, y
: Int) do return 42 * x
- y
93 public
fun redundant
(hello
: Float) do
94 if hello
.to_i
.to_c
== 'z' then
96 var z
= "hello = {hello}"
101 else if true and not false or hello
<= hello implies
true then
102 assert (123.digit_count
(10) <=> 3) == 0
103 var decimal
= -2442.42e24
104 var hexadecimal
= 0xCAFE_BABE
107 var byte
= (0XBEEFu
8).as(not null)
108 var long_string
= """
110 print "Hello {{{"#" + (octal * hexadecimal).to_s}}}"
113 var long_string2
= '''
114 """print "Hello {{{"#" + (octal * hexadecimal).to_s}}}"
125 with y
= self.stromgol
do
130 fun is_ghost
: Bool is abstract
138 fun answer
do return once
42
140 redef fun is_ghost
do return false
142 var camelCase
: nullable Char = null
145 extern class CString `{ char * `}
147 fun c_foo is extern import CString.to_s, Object.output `{
149 Object_output(CString_to_s(self));
153 fun cpp_foo import Object.output in "C++" `{
155 char
*s
= dynamic_cast
<char
*>(self);
159 fun java_foo in "Java" `{
160 if (!System.out instanceof java
.io
.PrintStream) {
161 throw
new ClassCastException();
165 fun ojbc_foo in "ObjC" `{
167 NSLog(@
"Hello World!");
172 interface Protocol end
180 fun output_value(value: Object) do value.output
184 __debug__ type Int: x