--- /dev/null
+test_pretty/test_mod1.nit
+test_pretty/test_mod2.nit
+test_pretty/test_mod3.nit
+test_pretty/test_class1.nit
+test_pretty/test_class2.nit
+test_pretty/test_class3.nit
+test_pretty/test_prop1.nit
+test_pretty/test_prop2.nit
+test_pretty/test_prop3.nit
+test_pretty/test_loop1.nit
+test_pretty/test_loop2.nit
+test_pretty/test_loop3.nit
+test_pretty/test_call1.nit
+test_pretty/test_call2.nit
+test_pretty/test_if1.nit
+test_pretty/test_if2.nit
+test_pretty/test_if3.nit
+test_pretty/test_op1.nit
+test_pretty/test_op2.nit
+test_pretty/test_op3.nit
+test_pretty/test_extern1.nit
+test_pretty/test_attr1.nit
+test_pretty/test_attr2.nit
+test_pretty/test_comments1.nit
+test_pretty/test_indent1.nit
+test_pretty/test_prims1.nit
+test_pretty/test_annot1.nit
--- /dev/null
+Usage: nitpretty [OPTION]... <file.nit>
+Pretty print Nit code from Nit source files.
+Use --help for help
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# An empty module
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+var a = 1
+var b = 2
+
+while a != b do # comment 1
+ # comment 2
+ var tmp = a
+ a = b
+ b = tmp
+ # comment 3
+end
+
+# comment 4
+while a != b do a = b # comment 5
+
+while a != b do
+ # comment 6
+end # comment 7
+
+# end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+var a = 0
+var b = 2
+
+do # comment 1
+ # comment 2
+ var tmp = a
+ a = b
+ b = tmp
+ # comment 3
+end
+
+# comment 4
+do a = b # comment 5
+
+do
+ # comment 6
+end
+
+if a > b then loop print a # test
+if a > b then loop print a
+if a > b then loop print a
+
+if a > b then
+ loop
+ # comment 7
+ print a
+ end
+end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+var a = 0
+
+for i in [1, 2, 3] do # comment 1
+ # comment 2
+ a += i
+end
+
+# comment 4
+for i in [1..3] do a += i # comment 5
+
+for i in [1..3[ do
+ # comment 6
+end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+class A
+ fun foo do end
+ fun bar(a: Int): Int do return 1
+ fun baz(a, b: Int) do end
+ fun gaz(a: Int, b: Float...) do end
+end
+
+fun top1 do end
+
+fun top2(a: Int) do end
+
+# comment 1
+var a = new A # comment 2
+a.foo # comment 3
+a.bar 1 # comment 4
+a.baz(1, 2) # comment 5
+top1 # comment 6
+top2 10 # comment 7
+print 10 # comment 8
+var b = a.bar(1)
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+class A
+ var attr: Int
+ fun foo1=(i: Int) do end
+ fun foo2=(i, j: Int) do end
+ fun [](a: Int): Int is abstract
+ fun []=(a, b: Int) do end
+end
+
+class B
+ fun [](a, b: Int): Int is abstract
+ fun []=(a, b, c: Int) do end
+end
+
+# comment 1
+var a = new A(10) # comment 2
+a.foo1 = 10 # comment 3
+a.foo2(1) = 10 # comment 4
+print a[1] # comment 5
+a[1] = 2 # comment 6
+a[2] += 3 # comment 7
+var b = new B
+print b[1, 2]
+b[1, 2] = 10
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+var a = 1
+var b = 2
+if a == b then a = b
+
+if a != b then
+ a = b
+ a = b
+end
+
+if a > b then
+ b = a
+ a = b
+else
+ a = b
+ a = b
+end
+
+if a < b then
+ a = b
+ a = b
+else if a == b then
+ b = a
+ a = b
+end
+
+if a < b then
+ a = b
+ a = b
+else if a == b then
+ b = b
+ a = b
+else
+ a = b
+ a = b
+end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# comment
+
+var a = 1 # comment
+# comment
+var b = 2 # comment
+# comment
+if a == b then a = b # comment
+
+# comment
+if a != b then # comment
+ # comment
+ a = b # comment
+ # comment
+ a = b # comment
+ # comment
+end # comment
+
+# comment
+if a > b then # comment
+ # comment
+ b = a # comment
+ # comment
+ a = b # comment
+ # comment
+else # comment
+ # comment
+ a = b # comment
+ # comment
+ a = b # comment
+ # comment
+end # comment
+
+# comment
+if a < b then # comment
+ # comment
+ a = b # comment
+ # comment
+ a = b # comment
+ # comment
+else if a == b then # comment
+ # comment
+ b = a # comment
+ # comment
+ a = b # comment
+ # comment
+end # comment
+
+# comment
+if a < b then # comment
+ # comment
+ a = b # comment
+ # comment
+ a = b # comment
+ # comment
+else if a == b then # comment
+ # comment
+ b = b # comment
+ # comment
+ a = b # comment
+ # comment
+else # comment
+ # comment
+ a = b # comment
+ # comment
+ a = b # comment
+ # comment
+end # comment
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+var a = 1
+var b = 2
+
+# 0
+if a == b then # 1
+ # 2
+else # 3
+ # 4
+end # 5
+
+if a == b then print a # printing a
+
+if a == b then
+ print a # printing a
+end
+
+if a == b then print a # end
+if a == b then a = b
+if a == b then end
+if a == b then end
+if a != b then a = b
+
+if a > b then
+ a = b
+else
+ a = b
+end
+
+if a < b then
+ a = b
+else if a == b then
+ a = b
+end
+
+if a < b then
+ a = b
+else if a == b then
+ a = b
+else
+ a = b
+end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+var a: nullable Int = 1
+var b: nullable Int = a.as(Int)
+var c: nullable Int = a.as(not null)
+assert c isa Int
+assert test1: c isa Int
+assert test2: c isa Int else abort
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+var a = 1
+var b = 2
+assert a == 2
+assert not a < 2 # comment 1
+assert a > 2 and b >= 2
+assert b != 2 or a <= 2
+assert b != null # comment 2
+# comment 3
+print a + b
+print a - b # comment 4
+print a * b
+print a / b
+print a % b
+print -a # comment 5
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Testing only imports
+
+# Module comment
+module test_mod2 # second comment
+
+import standard::kernel
+#import standard::string
+import template # no need for string
+# import standard
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+var a = 1
+var b = 2
+assert not a < 2 and (a == b or a > b) # comment 1
+assert not a < 2 and (a == b or ((a > b) or a <= b))
+assert (a > 2 and b >= 2)
+assert (b >= 2)
+# comment 3
+var c = a + (b - a)
+var d = (a - b) + c # comment 4
+var e = (-a) # comment 5
+var f = -(a - c)
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import end
+intrude import standard::kernel
+private import standard::string
+
+`{`}
+
+`{
+#ifdef truc
+ #undef truc
+#endif
+`}
+
+in "C headers" `{
+ #include <errno.h>
+`}
+
+fun err: Int is extern `{ return 1; `}
+
+fun errno: Int is extern `{
+ return errno;
+`}
+
+fun errnoooooooooooooooooooooooooooooooooooooooooooooooooooooooooo: Int is extern `{
+ return errno;
+`}
+
+private class A
+ var my_attr = 1234
+
+ fun baz(msg: String) import String.length, String.to_cstring, my_attr, my_attr= `{
+ char *c_msg;
+ int msg_len;
+
+ /* String_to_cstring isa a allback to msg.to_cstring */
+ c_msg = String_to_cstring( msg );
+
+ /* String_length is a callback to msg.length */
+ msg_len = String_length( msg );
+
+ printf( "received msg: %s, of length = %d\n", c_msg, msg_len );
+
+ /* A_my_attr is a callback to the getter of self.my_attr */
+ printf( "old attr %d\n", A_my_attr(recv) );
+
+ if(chose)
+ truc;
+ else
+ chose;
+
+ /* A_my_attr is a callback to the setter of self.my_attr= */
+ A_my_attr__assign( recv, msg_len );
+ `}
+end
+
+extern class TimeT `{time_t`}
+ new `{ return time(NULL); `}
+ new from_i(i: Int) `{ return i; `}
+ fun update `{ time(&recv); `}
+
+ fun ctime: String import NativeString.to_s_with_copy `{
+ return NativeString_to_s_with_copy( ctime(&recv) );
+ `}
+
+ # Difference in secondes from start (self if the end time)
+ fun difftime(start: TimeT): Float `{ return difftime(recv, start); `}
+
+ private fun intern_poll(in_fds: Array[Int], out_fds: Array[Int]): nullable Int is extern import
+ Array[Int].length, Array[Int].[], Int.as(nullable Int) `{`}
+end
+
+fun address_is_null: Bool is extern "address_is_null"
+
+fun free `{ free(recv); `}
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+class A
+ var a: Int # comment
+ private var b: nullable Int # happy
+ protected var c = 10 # ending
+ var d: Int = 10
+
+ # Test test...
+ var e: Int writable
+
+ var f: Int protected writable
+
+ # Adoc
+ var k: Int protected writable = 10
+ # more comments
+end # end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+class Foo
+ var _a: Int
+ private var _b: nullable Int
+ protected var _c = 10
+ var _d: Int = 10
+end
+
+var foo = new Foo(1, 2)
+print foo._a
+foo._a = 10
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# toplevel comment
+
+# block
+# block
+# block
+
+# Adoc1
+class A # ending comments
+ super Object
+ # super Int
+ super String
+
+ # super Truc
+
+ # inclass comments
+ # comm
+ # ented
+ # blocks
+
+ # Adoc2
+ fun foo do
+
+ # comment
+
+ var truc
+
+ # comment
+ # comment
+
+ # comment
+
+ var chose
+ # comment
+ end
+
+ # comm
+ # ented
+ # blocks
+
+ fun bar do end
+ fun baz do end
+ # comment before end
+end # ending comments
+
+# comm
+# ented
+# blocks
+
+abstract class B # comment
+end
+
+abstract class C end
+
+abstract class B # comment 2
+end
+
+abstract class C end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+class Foo
+ fun bar: Bool do return true
+
+ fun foo(other: Foo): Foo do
+ if other.bar then
+ return other
+ else
+ return self
+ end
+ end
+
+ fun baz: Int do
+ var nb = 0
+
+ while nb < 10 do
+ print nb
+ nb += 1
+ end # 1
+
+ return nb
+ end
+
+ fun gaz: Int do
+ if bar then # 3
+ return 1
+ else
+ return -1 # 4
+ end
+ end
+end
+
+class Test[E]
+ var heap: ArrayHeap[E]
+ init to(comparator: Comparator[E]) do heap = new ArrayHeap[E](comparator)
+
+ init from(comparator: Comparator[E], items: Collection[E]) do
+ heap = new ArrayHeap[E].from(comparator, items.to_a)
+ end
+
+ fun count(k: E): Int do
+ if heap.has(k) then
+ return 1
+ else
+ return 0
+ end
+ end
+
+ fun node_at_idx(i: Int, k: E) do
+ while heap != null do
+ if heap.is_empty or i == k then # FIXME prefilter because the compiler is not smart enought yet
+ break
+ end
+ end
+ end
+
+ fun save_those_nodes(nodes: Collection[Object]) do for node in nodes do count(node)
+end
+
+fun foo do
+ if last_slash > 0 then
+ return substring(last_slash + 1, length)
+ else
+ return null
+ end
+end
+
+print "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam tincidun" +
+ "t sapien et velit fringilla varius at non eros. Nunc ut ultricies metus, sit a" +
+ "met lacinia felis. Donec in facilisis neque, non laoreet nibh. Etiam nec purus" +
+ " eu orci congue iaculis eu quis lorem. Ut et blandit erat. Cras fermentum pell" +
+ "entesque ante, ut dapibus ipsum placerat sit amet. Vivamus pharetra, sem vitae" +
+ " consequat venenatis, diam risus placerat est, sed hendrerit purus justo vitae" +
+ " lectus. In id quam mattis, rutrum augue eu, vehicula ipsum. Nulla nec egestas" +
+ " turpis, nec ullamcorper odio. Pellentesque vitae arcu justo. Aliquam sed phar" +
+ "etra lacus."
+
+var lorem = "lorem"
+var ipsum = "ipsum" # for fun
+
+print "We also need to handle super strings: {lorem} {ipsum} dolor sit amet, con" +
+ "sectetur adipiscing elit. Aliquam tincidunt sapien et velit fringilla varius a" +
+ "t non eros. Nunc ut ultricies metus, sit amet lacinia felis. Donec in facilisi" +
+ "s neque, non laoreet nibh. Etiam nec purus eu orci congue iaculis eu quis {lorem}" +
+ ". Ut et blandit erat. Cras fermentum pellentesque ante, ut dapibus {ipsum} pla" +
+ "cerat sit amet. Vivamus pharetra, sem vitae consequat venenatis, diam risus pl" +
+ "acerat est, sed hendrerit purus justo vitae lectus. In id quam mattis, rutrum " +
+ "augue eu, vehicula ipsum. Nulla nec egestas turpis, nec ullamcorper odio. Pell" +
+ "entesque vitae arcu justo. Aliquam sed pharetra lacus." # ending
+
+var title = "title"
+var links = new Array[String] # why not?
+
+var body = """
+<!DOCTYPE html>
+<head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
+ <title>{{{title}}}</title>
+</head>
+<body>
+ <div class="container">
+ <h1>{{{title}}}</h1>
+ <ul>
+ <li>{{{links.join("</li>\n\t\t\t<li>")}}}</li>
+ </ul>
+ </div>
+</body>
+</html>"""
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# prims
+
+var a = true
+var b = false
+var c = 10
+var d = -10
+var e = 1.12
+var f = -1.12
+var n = 'a'
+var o = null
+var p = 0x12345678
+
+# strings
+
+var g = "test"
+var h1 = "Hello {g}"
+var h2 = "Hello \"{g}\" Hello"
+var h3 = "Hello {g}"
+var m = """
+bla
+ bla
+
+bla"""
+
+# arrays
+
+var j = [1, 2, 3]
+var k = [1..2[
+var l = [1..2]
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+module test_annot1 is platform("android")
+
+class A
+ fun foo is a, b
+ fun bar is a, b do print "1"
+
+ fun baz is
+ a
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+ do
+ print "2"
+ end
+end
+
+class B
+ fun foo is a, b
+ fun bar is a, b do print "1"
+
+ fun baz is a, b do
+ bar
+ print "2"
+ end
+
+ fun gaz is
+ a
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+ do
+ bar
+ print "2"
+ end
+end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# A simple module
+module test_mod3
+
+# before
+print "Hello World" # comment
+# after
+
+# end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# comment 1
+interface A end
+
+abstract class B # comment 2
+end
+
+class C end # comment 3
+
+enum D end # comment 4
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+module test_class2
+
+# comment
+class A end
+
+class B[T] # comment
+end
+
+private class C[U, V: B[A]] end # comment
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# comment
+class A end
+
+class B[T] # comment
+ # comment
+ super A # comment
+ super C[A, B[A]]
+ # comment
+end
+
+class C[U, V: B[A]] end # comment
+
+class D super A end # comment
+
+class E
+ super A # comment
+end
+
+# end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# comment 1
+class A
+ type FOO: Discrete
+ private var foo: FOO # comment
+
+ # comment 2
+ var bar: Int = 10
+end
+
+class B
+ super A
+
+ redef type FOO: Int
+
+ # comment 3
+ redef fun foo do return bar # comment
+
+ redef fun bar do
+ return 10 # comment 4
+ end
+
+ fun baz do return # comment 5
+ protected fun baz2 do end
+
+ fun other: String do
+ return "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
+ "aaaaaaaaaaaaaaaaaaaaaaaaaa"
+ end
+end
+
+# end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+class A
+ fun foo(a, b: Int): Bool do return true # 1
+ fun foo2(a, b: Int): Bool do return true # 2
+ fun foo3(a, b: Int): Bool do return true
+
+ fun foo4(a, b: Int): Bool do
+ var res = true # 3
+ return res # 4
+ end
+
+ fun foo5 do end # 5
+ # fun foo6 do end
+end
+
+# end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+class A
+ fun foo(aaaaaaaaaaaaaa, bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb: Int): Bool do
+ return true
+ end # comment
+
+ fun foo2(a, b: Int): Bool do return true # comment
+
+ fun foo3(a, b: Int): Bool do # comment
+ return true # comment
+ end # comment
+
+ fun foo4(a, b: Int): Bool do # comment
+ var res = true # comment
+ return res # comment
+ end # comment
+
+ fun foo5 do end # comment
+
+ fun foo6(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: Int) do
+ print 1
+ end
+end # comment
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+module test_annot1 is platform("android")
+
+class A
+ fun foo is a, b
+ fun bar is a, b do print "1"
+ fun baz is a, bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb do print "2"
+end
+
+class B
+ fun foo is
+ a
+ b
+ end
+
+ fun bar is
+ a
+ b
+ do
+ print "1"
+ end
+
+ fun baz is
+ a
+ b
+ do
+ bar
+ print "2"
+ end
+
+ fun gaz is
+ a
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+ do
+ bar
+ print "2"
+ end
+
+end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+class A
+ var a: Int # comment
+ private var b: nullable Int # happy
+ protected var c = 10 # ending
+ var d: Int = 10
+
+
+
+
+
+ # Test test...
+ var e: Int writable
+ var f: Int protected writable
+ # Adoc
+var k: Int protected writable = 10
+
+
+
+# more comments
+ end # end
+
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+class Foo
+ var _a: Int
+ private var _b: nullable Int
+ protected var _c = 10
+ var _d: Int = 10
+end
+
+var foo = new Foo(1, 2)
+print foo._a
+foo._a = 10
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+class A
+ fun foo do end
+ fun bar(a: Int): Int do return 1
+ fun baz(a, b: Int) do end
+ fun gaz(a: Int, b: Float...) do end
+end
+
+fun top1 do end
+fun top2(a: Int) do end
+
+# comment 1
+var a = new A # comment 2
+a.foo # comment 3
+a.bar(1) # comment 4
+a.baz(1, 2) # comment 5
+top1 # comment 6
+top2(10) # comment 7
+
+print 10 # comment 8
+
+var b = a.bar(1)
+
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+class A
+ var attr: Int
+ fun foo1=(i: Int) do end
+ fun foo2=(i, j: Int) do end
+ fun [](a: Int): Int is abstract
+ fun []=(a, b: Int) do end
+end
+
+class B
+ fun [](a, b: Int): Int is abstract
+ fun []=(a, b, c: Int) do end
+end
+
+# comment 1
+var a = new A(10) # comment 2
+
+a.foo1 = 10 # comment 3
+a.foo2(1) = 10 # comment 4
+print a[1] # comment 5
+a[1] = 2 # comment 6
+a[2] += 3 # comment 7
+
+var b = new B
+print b[1, 2]
+b[1, 2] = 10
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# comment 1
+interface A end
+
+abstract class B # comment 2
+end
+
+class C
+end # comment 3
+
+enum D end # comment 4
+
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+module test_class2
+
+
+# comment
+class A end
+
+class B[T] # comment
+end
+
+private class C[U, V: B[A]] end # comment
+
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# comment
+class A
+end
+
+class B[T] # comment
+# comment
+super A # comment
+
+
+ super C[A, B[A]]
+# comment
+end
+
+class C[U, V: B[A]] end # comment
+
+class D
+ super A
+
+
+end # comment
+
+class E
+
+
+
+ super A # comment
+end
+
+ # end
+
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+# toplevel comment
+
+
+
+
+
+
+# block
+# block
+# block
+
+
+
+
+
+# Adoc1
+class A # ending comments
+
+ super Object
+ # super Int
+
+
+ super String
+ # super Truc
+
+
+
+# inclass comments
+ # comm
+ # ented
+ # blocks
+
+
+
+ # Adoc2
+ fun foo do
+
+ # comment
+
+
+
+ var truc
+
+ # comment
+ # comment
+
+
+
+ # comment
+
+
+ var chose
+
+ # comment
+ end
+
+# comm
+# ented
+# blocks
+
+
+ fun bar do end
+
+
+fun baz do end
+# comment before end
+
+end # ending comments
+
+# comm
+# ented
+# blocks
+
+abstract class B # comment
+end
+
+abstract class C
+end
+
+abstract class B # comment 2
+
+end
+
+abstract class C
+
+end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import end
+intrude import standard::kernel
+private import standard::string
+
+`{`}
+
+`{
+#ifdef truc
+ #undef truc
+#endif
+`}
+
+in "C headers" `{
+ #include <errno.h>
+`}
+
+fun err: Int is extern `{ return 1; `}
+
+fun errno: Int is extern `{
+ return errno;
+`}
+
+fun errnoooooooooooooooooooooooooooooooooooooooooooooooooooooooooo: Int is extern `{ return errno; `}
+
+private class A
+ var my_attr = 1234
+
+ fun baz( msg : String ) import String.length, String.to_cstring, my_attr, my_attr= `{
+ char *c_msg;
+ int msg_len;
+
+ /* String_to_cstring isa a allback to msg.to_cstring */
+ c_msg = String_to_cstring( msg );
+
+ /* String_length is a callback to msg.length */
+ msg_len = String_length( msg );
+
+ printf( "received msg: %s, of length = %d\n", c_msg, msg_len );
+
+ /* A_my_attr is a callback to the getter of self.my_attr */
+ printf( "old attr %d\n", A_my_attr(recv) );
+
+ if(chose)
+ truc;
+ else
+ chose;
+
+ /* A_my_attr is a callback to the setter of self.my_attr= */
+ A_my_attr__assign( recv, msg_len );
+ `}
+end
+
+extern class TimeT `{time_t`}
+ new `{ return time(NULL); `}
+ new from_i(i: Int) `{ return i; `}
+
+ fun update `{ time(&recv); `}
+
+ fun ctime: String import NativeString.to_s_with_copy `{
+ return NativeString_to_s_with_copy( ctime(&recv) );
+ `}
+
+ # Difference in secondes from start (self if the end time)
+ fun difftime(start: TimeT): Float `{ return difftime(recv, start); `}
+
+ private fun intern_poll(in_fds: Array[Int], out_fds: Array[Int]) : nullable Int is extern import Array[Int].length, Array[Int].[], Int.as(nullable Int) `{`}
+end
+
+fun address_is_null: Bool is extern "address_is_null"
+
+fun free `{ free(recv); `}
+
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+var a = 1
+var b = 2
+
+if a == b then a = b
+
+if a != b then
+ a = b
+ a = b
+end
+
+if a > b then
+ b = a
+ a = b
+else
+ a = b
+ a = b
+end
+
+if a < b then
+ a = b
+ a = b
+else if a == b then
+ b = a
+ a = b
+end
+
+if a < b then
+ a = b
+ a = b
+else if a == b then
+ b = b
+ a = b
+else
+ a = b
+ a = b
+end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# comment
+var a = 1# comment
+# comment
+var b = 2# comment
+
+# comment
+if a == b then a = b# comment
+
+# comment
+if a != b then# comment
+# comment
+ a = b# comment
+# comment
+ a = b# comment
+# comment
+end# comment
+
+# comment
+if a > b then# comment
+# comment
+ b = a# comment
+# comment
+ a = b# comment
+# comment
+else# comment
+# comment
+ a = b# comment
+# comment
+ a = b# comment
+# comment
+end# comment
+
+# comment
+if a < b then# comment
+# comment
+ a = b# comment
+# comment
+ a = b# comment
+# comment
+else if a == b then# comment
+# comment
+ b = a# comment
+# comment
+ a = b# comment
+# comment
+end# comment
+
+# comment
+if a < b then# comment
+# comment
+ a = b# comment
+# comment
+ a = b# comment
+# comment
+else if a == b then# comment
+# comment
+ b = b# comment
+# comment
+ a = b# comment
+# comment
+else# comment
+# comment
+ a = b# comment
+# comment
+ a = b# comment
+# comment
+end# comment
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+var a = 1
+var b = 2
+
+# 0
+if a == b then # 1
+ # 2
+else # 3
+ # 4
+end # 5
+
+if a == b then print a # printing a
+
+if a == b then
+ print a # printing a
+end
+
+if a == b then
+ print a
+end # end
+
+if a == b then a = b
+
+if a == b then
+
+else
+
+end
+
+if a==b then end
+
+if a != b then
+ a = b
+end
+
+if a > b then
+ a = b
+else
+ a = b
+end
+
+if a < b then
+ a = b
+else if a == b then
+ a = b
+end
+
+if a < b then
+ a = b
+else if a == b then
+ a = b
+else
+ a = b
+end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+class Foo
+ fun bar: Bool do return true
+
+ fun foo(other: Foo): Foo
+ do
+ if other.bar then return other else
+ return self
+ end
+ end
+
+ fun baz: Int do
+ var nb = 0
+ while nb < 10 do
+ print nb
+ nb += 1
+end # 1
+ return nb
+ end
+
+ fun gaz: Int
+ do
+ if bar # 2
+ then # 3
+ return 1
+ else
+ return -1 # 4
+ end
+ end
+end
+
+class Test[E]
+ var heap: ArrayHeap[E]
+
+ init to(comparator: Comparator[E]) do
+ heap = new ArrayHeap[E](comparator)
+ end
+
+ init from(comparator: Comparator[E], items: Collection[E]) do
+ heap = new ArrayHeap[E].from(comparator, items.to_a)
+ end
+
+ fun count(k: E): Int do if heap.has(k) then return 1 else return 0
+
+ fun node_at_idx(i: Int, k: E) do
+ while heap != null do
+ if heap.is_empty or i == k then # FIXME prefilter because the compiler is not smart enought yet
+ break
+ end
+ end
+ end
+
+ fun save_those_nodes(nodes: Collection[Object]) do
+ for node in nodes do count(node)
+ end
+end
+
+fun foo do
+ if last_slash > 0 then
+ return substring( last_slash+1, length )
+ else
+ return null
+ end
+end
+
+print "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam tincidunt sapien et velit fringilla varius at non eros. Nunc ut ultricies metus, sit amet lacinia felis. Donec in facilisis neque, non laoreet nibh. Etiam nec purus eu orci congue iaculis eu quis lorem. Ut et blandit erat. Cras fermentum pellentesque ante, ut dapibus ipsum placerat sit amet. Vivamus pharetra, sem vitae consequat venenatis, diam risus placerat est, sed hendrerit purus justo vitae lectus. In id quam mattis, rutrum augue eu, vehicula ipsum. Nulla nec egestas turpis, nec ullamcorper odio. Pellentesque vitae arcu justo. Aliquam sed pharetra lacus."
+
+var lorem = "lorem"
+var ipsum = "ipsum" # for fun
+
+print "We also need to handle super strings: {lorem} {ipsum} dolor sit amet, consectetur adipiscing elit. Aliquam tincidunt sapien et velit fringilla varius at non eros. Nunc ut ultricies metus, sit amet lacinia felis. Donec in facilisis neque, non laoreet nibh. Etiam nec purus eu orci congue iaculis eu quis {lorem}. Ut et blandit erat. Cras fermentum pellentesque ante, ut dapibus {ipsum} placerat sit amet. Vivamus pharetra, sem vitae consequat venenatis, diam risus placerat est, sed hendrerit purus justo vitae lectus. In id quam mattis, rutrum augue eu, vehicula ipsum. Nulla nec egestas turpis, nec ullamcorper odio. Pellentesque vitae arcu justo. Aliquam sed pharetra lacus." # ending
+
+var title = "title"
+var links = new Array[String] # why not?
+
+var body = """
+<!DOCTYPE html>
+<head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
+ <title>{{{title}}}</title>
+</head>
+<body>
+ <div class="container">
+ <h1>{{{title}}}</h1>
+ <ul>
+ <li>{{{links.join("</li>\n\t\t\t<li>")}}}</li>
+ </ul>
+ </div>
+</body>
+</html>"""
+
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+var a = 1
+var b = 2
+
+while a != b do # comment 1
+ # comment 2
+ var tmp = a
+ a = b
+ b = tmp
+ # comment 3
+end
+
+# comment 4
+while a != b do
+ a = b
+end # comment 5
+
+while a != b do
+ # comment 6
+end # comment 7
+
+# end
+
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+var a = 0
+var b = 2
+
+do # comment 1
+ # comment 2
+ var tmp = a
+ a = b
+ b = tmp
+ # comment 3
+end
+
+# comment 4
+do
+ a = b
+end # comment 5
+
+do
+ # comment 6
+end
+
+if a > b then loop print a # test
+
+if a > b then
+ loop print a
+end
+
+if a > b then
+ loop
+ print a
+ end
+end
+
+if a > b then
+ loop
+ # comment 7
+ print a
+ end
+end
+
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+var a = 0
+
+for i in [1, 2, 3] do# comment 1
+ # comment 2
+ a += i
+end
+
+# comment 4
+for i in [1..3] do
+ a += i
+end # comment 5
+
+for i in [1..3[ do
+ # comment 6
+end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+
+# An empty module
+
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Testing only imports
+
+# Module comment
+module test_mod2 # second comment
+
+ import standard::kernel
+#import standard::string
+
+ import template # no need for string
+# import standard
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# A simple module
+module test_mod3
+
+ # before
+ print "Hello World" # comment
+ # after
+
+ # end
+
+
+
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+var a: nullable Int = 1
+var b: nullable Int = a.as(Int)
+var c: nullable Int = a.as(not null)
+
+assert c isa Int
+assert test1: c isa Int
+assert test2: c isa Int else abort
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+var a = 1
+var b = 2
+
+assert a == 2
+assert not a < 2 # comment 1
+assert a > 2 and b >= 2
+assert b != 2 or a <= 2
+assert b != null # comment 2
+
+# comment 3
+print a + b
+print a - b # comment 4
+print a * b
+print a / b
+print a % b
+
+print -a # comment 5
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+var a = 1
+var b = 2
+
+assert not a < 2 and (a == b or a > b)# comment 1
+assert not a < 2 and (a == b or ((a > b) or a <= b))
+assert (a > 2 and b >= 2)
+assert (b >= 2)
+
+# comment 3
+var c = a + (b - a)
+var d = (a - b) + c # comment 4
+var e = (-a) # comment 5
+var f = -(a - c)
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# prims
+
+var a = true
+var b = false
+
+var c = 10
+ var d = -10
+var e = 1.12
+
+var f = -1.12
+var n = 'a'
+var o = null
+var p = 0x12345678
+
+# strings
+
+var g = "test"
+var h1 = "Hello {g}"
+var h2 = "Hello \"{g}\" Hello"
+var h3 = "Hello {g}"
+ var m = """
+bla
+ bla
+
+bla"""
+
+ # arrays
+
+var j = [1,2,3]
+var k=[ 1 .. 2 [
+var l = [1..2]
+
+
+
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# comment 1
+class A
+type FOO: Discrete
+ private var foo: FOO # comment
+# comment 2
+ var bar: Int = 10
+end
+
+class B
+ super A
+
+ redef type FOO: Int
+# comment 3
+ redef fun foo do return bar # comment
+ redef fun bar
+ do
+ return 10 # comment 4
+ end
+ fun baz do
+ return
+ end # comment 5
+ protected fun baz2 do end
+ fun other: String do return "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+end
+
+# end
+
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+class A
+ fun foo(a, b: Int): Bool do return true # 1
+
+ fun foo2(a, b: Int): Bool do return true end # 2
+
+ fun foo3(a, b: Int): Bool do
+ return true
+ end
+
+ fun foo4(a, b: Int): Bool do
+ var res = true # 3
+ return res # 4
+ end
+
+ fun foo5 do end # 5
+ # fun foo6 do end
+end
+
+# end
+
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+class A
+ fun foo(aaaaaaaaaaaaaa, bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb: Int): Bool do return true # comment
+
+ fun foo2(a, b: Int): Bool do return true end # comment
+
+ fun foo3(a, b: Int): Bool do # comment
+ return true # comment
+ end # comment
+
+ fun foo4(a, b: Int): Bool do # comment
+ var res = true # comment
+ return res # comment
+ end # comment
+
+ fun foo5 do end # comment
+
+ fun foo6(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: Int) do
+ print 1
+ end
+
+end # comment