end
# sort for blitting, firsts and in the back
+ # FIXME: remove closure
entities.sort !cmp( a, b ) = b.pos.y <=> a.pos.y
return turn
var res = map.keys.to_a
var sorter = new CounterSorter[E](self)
sorter.sort(res)
- #res.sort !cmp a, b = map[a] <=> map[b]
return res
end
return res
end
- fun iterate !each(k, v: String)
- do
- var i = arr.iterator
- while i.is_ok do
- var item = i.item
- each(item.first, item.second)
- i.next
- end
- end
-
fun iterator: MapIterator[String, String] do return new HeaderMapIterator(self)
# Convert Self to a single string used to post http fields
interface ForAbuser[E]
# Starts and control the service
fun iterator: Iterator[E] is abstract
-
- # Starts and contol the service (for `nitc`)
- fun iterate
- !each(e: E)
- do
- var i = iterator
- while i.is_ok do
- each(i.item)
- i.next
- end
- end
end
# Abuser to read a file, see `file_open`
# Get a new iterator on the collection.
fun iterator: Iterator[E] is abstract
- # Iterate over each element of the collection
- fun iterate
- !each(e: E)
- do
- var i = iterator
- while i.is_ok do
- each(i.item)
- i.next
- end
- end
-
# Is there no item in the collection?
#
# assert [1,2,3].is_empty == false
# Get a new iterator on the map.
fun iterator: MapIterator[K, E] is abstract
- # Iterate over each element of the collection
- fun iterate
- !each(k: K, v: E)
- do
- var i = iterator
- while i.is_ok do
- each(i.key, i.item)
- i.next
- end
- end
-
# Return the point of view of self on the values only.
# Note that `self` and `values` are views on the same data;
# therefore any modification of one is visible on the other.
super AbstractArray[E]
super ArrayCapable[E]
- redef fun iterate
- !each(e: E)
- do
- var i = 0
- var l = _length
- var items = _items
- while i < length do
- each(items[i])
- i += 1
- end
- end
-
redef fun [](index)
do
assert index: index >= 0 and index < _length
# The size of `_items`.
var _capacity: Int = 0
-
- # Sort the array using the !cmp function.
- fun sort
- !cmp(e1,e2: E): Int
- do
- sub_sort(0, length-1) !cmp(x,y) = cmp(x, y)
- end
-
- # Sort `array` between `from` and `to` indices
- private fun sub_sort(from: Int, to: Int)
- !cmp(e1,e2: E): Int
- do
- if from >= to then
- return
- else if from + 7 < to then
- var pivot = self[from]
- var i = from
- var j = to
- while j > i do
- while i <= to and cmp(self[i], pivot) <= 0 do i += 1
- while j > i and cmp(self[j], pivot) >= 0 do j -= 1
- if j > i then
- var t = self[i]
- self[i] = self[j]
- self[j] = t
- end
- end
- self[from] = self[i-1]
- self[i-1] = pivot
- sub_sort(from, i-2) !cmp(x,y) = cmp(x, y)
- sub_sort(i, to) !cmp(x,y) = cmp(x, y)
- else
- var i = from
- while i < to do
- var min = i
- var min_v = self[i]
- var j = i
- while j <= to do
- if cmp(min_v, self[j]) > 0 then
- min = j
- min_v = self[j]
- end
- j += 1
- end
- if min != i then
- self[min] = self[i]
- self[i] = min_v
- end
- i += 1
- end
- end
- end
end
# An `Iterator` on `AbstractArray`
redef fun iterator: HashMapIterator[K, V] do return new HashMapIterator[K,V](self)
- redef fun iterate
- !each(k: K, v: V)
- do
- var c = _first_item
- while c != null do
- each(c._key, c._value)
- c = c._next_item
- end
- end
-
redef fun length do return _length
redef fun is_empty do return _length == 0
redef fun iterator do return new IteratorRange[E](self)
- redef fun iterate
- !each(e: E)
- do
- var c = _first
- var l = _last
- while c <= l do
- each(c)
- c = c.succ
- end
- end
-
redef fun length
do
var nb = _first.distance(_after)
end
end
- # Execute 'each' for each integer in [self..last]
- fun enumerate_to(last: Int)
- !each(i: Int)
- do
- var cur = self
- while cur <= last do
- each(cur)
- cur += 1
- end
- end
-
- # Execute 'each' for each integer in [self..after[
- fun enumerate_before(after: Int)
- !each(i: Int)
- do
- var cur = self
- while cur < after do
- each(cur)
- cur += 1
- end
- end
-
# The absolute value of self
#
# assert (-10).abs == 10
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2009 Jean Privat <jean@pryen.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 kernel
-
-class A
- fun foo
- !bar
- do
- 1.output
- bar #alt1#
- #alt2#bar(2)
- #alt3#var x = bar
- 4.output
- end
-end
-
-fun maybe: Bool do return true
-
-fun work
-do
- var a = new A
- a.foo !bar do #alt11#
- #alt11#a.foo !bar x do
- 2.output
- if maybe then
- #alt4#break
- #alt5#break 'x'
- #alt6#continue
- #alt7#continue 'x'
- #alt8#return
- #alt9#return 'x'
- end
- 3.output
- end
- #alt10# a.foo
- #alt12# a.foo !baz do (-1).output
- 5.output
-end
-
-0.output
-work
-6.output
-
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2009 Jean Privat <jean@pryen.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 kernel
-
-fun foo !k
-do
- ' '.output
- '<'.output
- 1.output
- k
- ' '.output
- '>'.output
- 1.output
-end
-
-fun test
-do
- '<'.output
- 0.output
- var i = 0
- while i < 3 do
- foo !k do
- ' '.output
- ' '.output
- '<'.output
- 2.output
- if i == 1 then
- break
- end
- ' '.output
- ' '.output
- '>'.output
- 2.output
- end
- i += 1
- end
- '>'.output
- 0.output
-end
-
-test
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2009 Jean Privat <jean@pryen.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 kernel
-
-fun foo
- !x
-do
- 'F'.output
- 0.output
- bar !y do
- 'F'.output
- 1.output
- x
- 'F'.output
- 1.output
- end
- 'F'.output
- 0.output
-end
-
-fun bar
- !y
-do
- 'B'.output
- 0.output
- y
- 'B'.output
- 0.output
-end
-
-'M'.output
-0.output
-foo !x do
- 'M'.output
- 1.output
- foo !x do
- 'M'.output
- 2.output
- #alt1#break
- #alt2#return
- end
- 'M'.output
- 1.output
-end
-'M'.output
-0.output
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2009 Jean Privat <jean@pryen.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 kernel
-
-class A
- fun foo
- !bar(i: Int)
- do
- 1.output
- bar(2) #alt1#
- #alt2#bar
- #alt12#bar('x')
- #alt3#var x = bar(2)
- 4.output
- end
-end
-
-fun maybe: Bool do return true
-
-fun work
-do
- var a = new A
- a.foo !bar x do #alt11#
- #alt11#a.foo !bar do
- x.output
- if maybe then
- #alt4#break
- #alt5#break 'x'
- #alt6#continue
- #alt7#continue 'x'
- #alt8#return
- #alt9#return 'x'
- end
- (x+1).output
- end
- #alt10# a.foo
- 5.output
-end
-
-0.output
-work
-6.output
-
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2009 Jean Privat <jean@pryen.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 kernel
-
-class A
- fun foo(i, j: Int)
- !bar(k, l: Int, a: A)
- do
- i.output
- bar(i+1, j-1, self)
- #alt1#bar(i+1, j-1)
- j.output
- end
-end
-
-fun maybe: Bool do return true
-
-var a = new A
-0.output
-a.foo(1,8) !bar x, y, b do #alt2#
-#alt2#a.foo(1,8) !bar x, y do
- x.output
- b.foo(x+1, y-1) !bar z, t, c do
- z.output
- if maybe then
- #alt4#break
- #alt5#break 'x'
- #alt6#continue
- #alt7#continue 'x'
- #alt8#return
- #alt9#return 'x'
- end
- t.output
- end
- y.output
-end
-9.output
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2009 Jean Privat <jean@pryen.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 kernel
-
-class A
- fun foo
- !bar: Int
- do
- 1.output
- bar.output #alt1#
- #alt2#bar(2)
- #alt3#var x: Char = bar
- 4.output
- end
-end
-
-fun maybe: Bool do return true
-
-fun work
-do
- var a = new A
- a.foo !bar do #alt11#
- #alt11#a.foo !bar x do
- 2.output
- if maybe then
- #alt4#break
- #alt5#break 'x'
- #alt6#continue
- #alt7#continue 'x'
- #alt8#return
- #alt9#return 'x'
- end
- continue 3
- end
- #alt10# a.foo
- 5.output
-end
-
-0.output
-work
-6.output
-
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2009 Jean Privat <jean@pryen.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 kernel
-
-class A
- fun foo: Int
- !bar: Int
- do
- 1.output
- var r = bar
- 3.output
- return r
- end
-end
-
-fun maybe: Bool do return true
-
-fun work: Int
-do
- var a = new A
- var i = a.foo !bar do
- 2.output
- if maybe then
- #alt1#break
- #alt2#break 'x'
- #alt3#break 100
- #alt4#return
- #alt5#return 'x'
- #alt6#return 200
- #alt7#continue
- #alt8#continue 'x'
- end
- continue 5 #alt9#
- end
- 4.output
- return i
-end
-
-0.output
-work.output
-6.output
-
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2009 Jean Privat <jean@pryen.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 kernel
-
-class A
- fun foo: U
- !bar
- do
- return new U
- end
-end
-
-class T
-end
-
-class U
- super T
-end
-
-class V
- super T
-end
-
-class W
- super U
- super V
-end
-
-fun maybe: Bool do return true
-
-var a = new A
-
-var t: T = new T
-var u: U = new U
-var v: V = new V
-var w: W = new W
-
-var y: Object#alt1#
-#alt1#var y: U
-y = a.foo !bar do 0.output
-y = a.foo !bar do break t
-y = a.foo !bar do break u
-y = a.foo !bar do break v
-y = a.foo !bar do break w
-y = a.foo !bar do
- if maybe then
- break t
- else if maybe then
- break u
- else if maybe then
- break v
- else if maybe then
- break w
- end
-end
-y = a.foo !bar do
- if maybe then
- break u
- else if maybe then
- break v
- else if maybe then
- break w
- end
-end
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2009 Jean Privat <jean@pryen.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 kernel
-
-fun repeat(x: Int)
- !each(i: Int)
-do
- var c = 0
- while c < x do
- each(c)
- c += 1
- end
-end
-
-fun work
-do
- repeat(4) !each i do
- i.output
- repeat(4) !each j do
- if i == 1 and j == 1 then continue
- if i == 2 and j == 2 then break
- if i == 3 and j == 3 then return
- ' '.output
- j.output
- end
- if i == 0 then continue
- '\n'.output
- end
-end
-
-work
-
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2009 Jean Privat <jean@pryen.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 kernel
-
-class A
- fun foo(i: Int)
- !bar
- do
- '['.output
- i.output
- bar !break do
- '!'.output
- i.output
- end
- #alt4#bar !baz do abort
- ']'.output
- i.output
- end
-end
-
-fun maybe: Bool do return true
-
-fun start
-do
- var a = new A
- 0.output
- a.foo(1) !bar do
- 2.output
- a.foo(3) !bar do
- 4.output
- if maybe then
- #alt1#break
- #alt2#continue
- #alt3#return
- end
- 5.output
- end
- 6.output
- end
- 7.output
-end
-
-start
-8.output
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2009 Jean Privat <jean@pryen.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 kernel
-
-class A
- fun indent(i: Int, j, c: Char)
- do
- var ii = i
- while ii > 0 do
- ' '.output
- ii -= 1
- end
- c.output
- j.output
- ','.output
- i.output
- end
-
- fun foo(i: Int, j: Char)
- !bar
- do
- if i >= 3 then
- indent(i, j, '{')
- bar
- indent(i, j, '}')
- return
- end
-
- indent(i, j, '[')
- foo(i+1, 'a') !bar do
- foo(i+1, 'b') !bar do
- foo(i+1, 'c') !bar do
- indent(i, j, '<')
- bar
- indent(i, j, '>')
- end
- end
- end
- indent(i, j, ']')
- end
-end
-
-fun start
-do
- var a = new A
- 0.output
- a.foo(0, 'A') !bar do
- a.foo(0, 'B') !bar do
- a.foo(0, 'C') !bar do
- 1.output
- #alt1# break
- #alt2# return
- end
- end
- end
- 2.output
-end
-
-start
-3.output
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2009 Jean Privat <jean@pryen.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 kernel
-
-class A
- fun foo
- break !bar #alt12#
- #alt12#break !bar: Int
- do
- 1.output
- if maybe then bar #alt1#
- #alt2#if maybe then bar(2)
- #alt3#if maybe then var x = bar
- 4.output
- end
-end
-
-fun maybe: Bool do return true
-
-fun work
-do
- var a = new A
- a.foo !bar do #alt11#
- #alt11#a.foo !bar x do
- 2.output
- if maybe then
- #alt4#break
- #alt5#break 'x'
- #alt6#continue
- #alt7#continue 'x'
- #alt8#return
- #alt9#return 'x'
- end
- 3.output
- break #alt13#
- end
- #alt10# a.foo
- 5.output
-end
-
-0.output
-work
-6.output
-
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2009 Jean Privat <jean@pryen.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 kernel
-
-class A
- fun foo: Int
- break !bar #alt12#
- #alt12#break !bar: Int
- do
- 1.output
- if maybe then bar #alt1#
- #alt2#if maybe then bar(2)
- #alt3#if maybe then var x = bar
- return 4
- end
-end
-
-fun maybe: Bool do return true
-
-fun work
-do
- var a = new A
- var r = a.foo !bar do #alt11#
- #alt11#var r = a.foo !bar x do
- 2.output
- if maybe then
- #alt4#break 4
- #alt5#break 'x'
- #alt6#continue
- #alt7#continue 'x'
- #alt8#return
- #alt9#return 'x'
- end
- 3.output
- break 4 #alt13#
- end
- r.output
- #alt10# a.foo
- 5.output
-end
-
-0.output
-work
-6.output
-
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2009 Jean Privat <jean@pryen.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 kernel
-
-class A
- fun foo
- break !bar do
- if maybe then
- #alt1# return
- #alt2# return 1
- #alt3# abort
- #alt4# continue
- #alt5# continue 20
- #alt6# break
- #alt7# break 1
- end
- 20.output
- end
- do
- 1.output
- if maybe then bar
- 3.output
- end
-end
-
-fun maybe: Bool do return true
-
-var a = new A
-0.output
-a.foo !bar do 2.output
-0.output
-a.foo
-0.output
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2009 Jean Privat <jean@pryen.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 kernel
-
-class A
- fun foo: Int
- break !bar do
- if maybe then
- #alt1# return
- #alt2# return 1
- #alt3# abort
- #alt4# continue
- #alt5# continue 20
- #alt6# break
- #alt7# break 1
- #alt8# break 'x'
- end
- break 20#alt9#
- end
- do
- 1.output
- if maybe then bar
- 3.output
- return 3
- end
-end
-
-fun maybe: Bool do return true
-
-var a = new A
-0.output
-var x = a.foo !bar do break 2
-x.output
-0.output
-x = a.foo
-x.output
-0.output
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2009 Jean Privat <jean@pryen.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 kernel
-
-fun foo
- !f: Int
-do
- f.output
-end
-
-fun bar
- !f(i: Int): Int
-do
- f(1).output
-end
-
-fun baz
- !f do end
- !g: Int = 3
-do
- f
- g.output
-end
-
-foo !f = 1
-bar !f(i) = i + 1
-baz
-baz !f do
- 4.output
-!g = 5
-#alt1#foo !f = 'a'
-#alt2#baz !f = 3
-#alt3#baz !g = 6
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2009 Jean Privat <jean@pryen.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 kernel
-
-class A
- fun foo
- !bar do
- if maybe then
- #alt1# return
- #alt2# return 1
- #alt3# abort
- #alt4# continue
- #alt5# continue 20
- #alt6# break
- #alt7# break 1
- end
- 20.output
- end
- do
- 1.output
- bar
- 3.output
- end
-end
-
-fun maybe: Bool do return true
-
-var a = new A
-0.output
-a.foo !bar do 2.output
-0.output
-a.foo
-0.output
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2009 Jean Privat <jean@pryen.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 kernel
-
-class A
- fun foo
- !bar(i: Int) do
- if maybe then
- #alt1# return
- #alt2# return 1
- #alt3# abort
- #alt4# continue
- #alt5# continue 20
- #alt7# break
- #alt8# break 1
- end
- (i * 10).output
- end
- do
- 1.output
- bar(2)
- #alt6#i.output
- 3.output
- end
-end
-
-fun maybe: Bool do return true
-
-var a = new A
-0.output
-a.foo !bar j do j.output
-0.output
-a.foo
-0.output
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2009 Jean Privat <jean@pryen.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 kernel
-
-class A
- fun foo
- !bar: Int do
- if maybe then
- #alt1# return
- #alt2# return 1
- #alt3# abort
- #alt4# continue
- #alt6# break 1
- end
- #alt5# break
- continue 20 #alt5#
- end
- do
- 1.output
- bar.output
- 3.output
- end
-end
-
-fun maybe: Bool do return true
-
-var a = new A
-0.output
-a.foo !bar do continue 2
-0.output
-a.foo
-0.output
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2009 Jean Privat <jean@pryen.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 kernel
-
-class A
- fun foo
- !bar(i: Int): Int do
- if maybe then
- #alt1# return
- #alt2# return -1
- #alt3# abort
- #alt4# continue
- #alt6# break
- #alt7# break 1
- end
- continue i * 10 #alt5#
- end
- do
- 1.output
- bar(2).output
- 3.output
- end
-end
-
-fun maybe: Bool do return true
-
-var a = new A
-0.output
-a.foo !bar j do continue j
-0.output
-a.foo
-0.output
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2006-2008 Jean Privat <jean@pryen.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 kernel
-
-class Array[E]
- fun sort
- !cmp(a, b: E): Int
- do
- var e1 = _e1
- var e2 = _e2
- if cmp(e1, e2) > 0 then
- _e1 = e2
- _e2 = e1
- end
- end
-
- fun iterate
- !each(e: E)
- do
- each(_e1)
- each(_e2)
- end
-
- var _e1: E
- var _e2: E
-
- init(e1, e2: E)
- do
- _e1 = e1
- _e2 = e2
- end
-
- redef fun output
- do
- '['.output
- _e1.output
- ','.output
- _e2.output
- ']'.output
- '\n'.output
- end
-end
-
-class Map[K, V]
- fun [](k: K): V
- !def: V do abort
- do
- if _k == k then return _v
- var n = _next
- if n != null then return n[k] !def do continue def
- var v = def
- _next = new Map[K, V](k, v)
- return v
- end
- fun has_key(k: K): Bool
- do
- if _k == k then return true
- var n = _next
- if n != null then return n.has_key(k) else return false
- end
- fun iterate
- !each2(k: K, v: V)
- do
- var n: nullable Map[K, V] = self
- while n != null do
- each2(n._k, n._v)
- n = n._next
- end
- end
- var _k: K
- var _v: V
- var _next: nullable Map[K, V]
- init(k: K, v: V)
- do
- _k = k
- _v = v
- end
- redef fun output
- do
- '{'.output
- output_inner
- '}'.output
- '\n'.output
- end
- fun output_inner
- do
- _k.output
- ':'.output
- _v.output
- var n = _next
- if n != null then
- ','.output
- n.output_inner
- end
- end
-end
-
-class File
- readable var _id: Int
- readable var _is_open: Bool
- fun close
- do
- if _is_open then
- 'C'.output
- _id.output
- _is_open = false
- end
- end
- init(id: Int)
- do
- _id = id
- _is_open = id > 0
- end
-end
-
-fun file_open(i: Int)
- !work(f: File)
- break !error(j: Int) do abort
-do
- var f = new File(i)
- if not f.is_open then error(404)
- work(f) !break do f.close
- f.close
-end
-
-##################
-
-fun test_sort
-do
- var a = new Array[Char]('2', '1')
- a.output
- a.sort !cmp(x, y) = x <=> y
- a.output
- a.sort !cmp(x, y) = y <=> x
- a.output
- a.iterate !each i do i.output
- '\n'.output
-end
-
-fun test_map
-do
- var m = new Map[Char, Char]('I', '1')
-
- m.output
-
- if not m.has_key('I') then (-1).output
- 'I'.output
- '='.output
- var i = m['I']
- i.output
- '\n'.output
-
- m.output
-
- if m.has_key('V') then (-2).output
- 'V'.output
- '='.output
- i = m['V'] !def = '5'
- i.output
- '\n'.output
-
- m.output
-
- if not m.has_key('V') then (-3).output
- 'V'.output
- '='.output
- i = m['V'] !def = '6'
- i.output
- '\n'.output
-
- m.output
-
- if m.has_key('X') then (-4).output
- 'X'.output
- '='.output
- i = m['X'] !def do break '0'
- i.output
- '\n'.output
-
- m.output
-
- if m.has_key('X') then (-5).output
-
- m.iterate !each2(k,v) do
- k.output
- '='.output
- v.output
- ';'.output
- end
- '\n'.output
-end
-
-fun test_file(i: Int)
-do
- var f_escape: nullable File = null
- file_open(i) !work(f) do
- 'O'.output
- '?'.output
- f.is_open.output
- f_escape = f
- !error(e) do
- 'E'.output
- e.output
- end
- if f_escape != null then
- 'O'.output
- '?'.output
- f_escape.is_open.output
- end
-end
-
-test_sort
-'\n'.output
-test_map
-'\n'.output
-test_file(1)
-'\n'.output
-test_file(-1)
-
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2009 Jean Privat <jean@pryen.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 kernel
-fun a
- !a1
- !a2 #alt1#
-#alt2# !a3
-#alt6# !a1
-do
- a1
- a2 #alt1#
-#alt2# a3
-end
-
-fun b
- !b1
- !b2
-do
- b1
- b2
-end
-
-fun c
- !c1
-do
- c1
-end
-
-fun d
- !d1
- !d2
- !d3
-do
- d1
- d2
- d3
-end
-
-0.output
-a !a1 do
- b !b1 do
- 1.output
- !b2 do #alt3#
- 2.output #alt3#
-#alt4# !b3 do
-#alt4# 20.output
- end
-!a2 do
- 3.output
-end
-4.output
-c !c1 do
- d !d1 do
- 5.output
- !d2 do
- 6.output
- !d3 do 7.output
-end
-#alt5#a !a2 do
-#alt5#!a1 do
-#alt5#end
-8.output
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2009 Jean Privat <jean@pryen.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 base_closure2
-
-class B
- super A
- redef fun foo
- !bar(i: Int) #alt13# #alt14# #alt15#
- #alt13# !bar
- #alt14# !bar(b: Bool)
- #alt15# !bar(i: Int): Int
- do
- 10.output
- bar(20) #alt1#
- #alt2#bar
- #alt12#bar('x')
- #alt3#var x = bar(2)
- 40.output
- end
-end
-
-fun work2
-do
- var a: A = new B
- a.foo !bar x do #alt11#
- #alt11#a.foo !bar do
- x.output
- if maybe then
- #alt4#break
- #alt5#break 'x'
- #alt6#continue
- #alt7#continue 'x'
- #alt8#return
- #alt9#return 'x'
- end
- (x+1).output
- end
- #alt10# a.foo
- 5.output
-end
-
-0.output
-work2
-6.output
-
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2009 Jean Privat <jean@pryen.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 kernel
-
-fun foo
- !f
-do
- f
-end
-
-fun test: Int
-do
- var i = 1
- i.output
- foo !f do
- return 2
- end
- abort
-end
-
-test.output
+++ /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 kernel
-
-class A
- var v: Int
- fun iterate #alt1#
- #alt1# fun foo
- !each(i: Int) #alt2# #alt5#
- #alt5#!each(i: Int): Int
- do
- each(v)
- end
-end
-
-class B
- var v: Int
- fun iterate
- !each(i: Int, j: Bool)
- do
- each(v, v != 0)
- end
-end
-
-var a = new A(5)
-for i in a do #alt3#
-#alt3#for i, j in a do
- i.output
-end
-
-var b = new B(5)
-for i, j in b do #alt4#
-#alt4#for i in b do
- i.output
- j.output #alt4#
-end
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2009 Jean Privat <jean@pryen.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 kernel
-
-interface Inline__
- fun foo
- !f
- do
- 0.output
- f
- 2.output
- end
-
- fun bar
- !b do 11.output
- do
- 10.output
- b
- 12.output
- end
-end
-
-class A
- super Inline__
-end
-
-var a: A = new A
-a.foo !f do 1.output
-a.bar !b do 1.output
-a.bar
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2009 Jean Privat <jean@pryen.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 kernel
-
-interface Inline__
- fun foo
- !f: Int
- do
- 0.output
- f.output
- 2.output
- end
-
- fun bar
- !b: Int do continue 11
- do
- 10.output
- b.output
- 12.output
- end
-end
-
-class A
- super Inline__
-end
-
-var a: A = new A
-a.foo !f do continue 1
-a.bar !b do continue 1
-a.bar
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2008 Jean Privat <jean@pryen.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 kernel
-
-class Inline__
- fun foo1
- !f
- do
- f
- 5.output
- end
-
- fun foo2
- !f
- do
- f
- 2.output
- end
-end
-
-fun maybe: Bool do return true
-
-var a = new Inline__
-a.foo1 !f do
- do
- a.foo2 !f do
- if maybe then
- #alt1#break label l1
- #alt2#break label l2
- #alt3#break label l3
- #alt4#continue label l1
- #alt5#continue label l2
- end
- 1.output
- end label l1
- 3.output
- end label l3
- 4.output
-end label l2
-6.output
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2008 Jean Privat <jean@pryen.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 kernel
-
-class Inline__
- fun foo1: Int
- !f: Int
- do
- f.output
- return 5
- end
-
- fun foo2: Int
- !f: Int
- do
- f.output
- return 2
- end
-end
-
-fun maybe: Bool do return true
-
-var a = new Inline__
-var x = a.foo1 !f do
- do
- var y = a.foo2 !f do
- if maybe then
- #alt1#break label l1 20
- #alt2#break label l2 50
- #alt3#break label l3
- #alt4#continue label l1 10
- #alt5#continue label l2 40
- end
- continue 1
- end label l1
- y.output
- 3.output
- end label l3
- continue 4
-end label l2
-x.output
-6.output
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2008 Jean Privat <jean@pryen.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 kernel
-
-class Inline__
- fun foo
- !f
- do
- do
- if true then
- f
- break label l0
- end
- 0.output
- end label l0
- 5.output
- end
-end
-
-fun maybe: Bool do return true
-
-var a = new Inline__
-a.foo !f do
- do
- a.foo !f do
- if maybe then
- #alt1#break label l1
- #alt2#break label l2
- #alt3#break label l3
- #alt4#continue label l1
- #alt5#continue label l2
- end
- 1.output
- end label l1
- 3.output
- end label l3
- 4.output
-end label l2
-6.output
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2008 Jean Privat <jean@pryen.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 kernel
-
-class Inline__
- fun foo1
- !f
- do
- f
- f
- end
- fun foo2
- !f
- do
- f
- f
- end
-end
-
-class B
- var _b: Int
- redef fun output do _b.output
-end
-
-var a = new Inline__
-a.foo1 !f do
- var x = new B(1)
- var y = 2
- a.foo2 !f do
- x.output
- y.output
- x = new B(3)
- y = 4
- #alt1#break label l1
- #alt2#break label l2
- #alt3#continue label l1
- #alt4#continue label l2
- end label l1
- x.output
- y.output
-end label l2
-5.output
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2008 Jean Privat <jean@pryen.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 kernel
-
-class Inline__
- fun foo
- !f
- do
- f
- f
- end
-end
-
-class B
- var _b: Int
- redef fun output do _b.output
-end
-
-fun maybe: Bool do return true
-
-var a = new Inline__
-a.foo !f do
- var x = new B(1)
- var y = 2
- a.foo !f do
- x.output
- y.output
- x = new B(3)
- y = 4
- if maybe then
- #alt1#break label l1
- #alt2#break label l2
- #alt3#continue label l1
- #alt4#continue label l2
- end
- end label l1
- x.output
- y.output
-end label l2
-5.output
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2009 Jean Privat <jean@pryen.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 kernel
-
-interface Inline__
- fun foo
- !f
- do
- 0.output
- f
- 2.output
- end
-
- fun bar
- !b do 11.output
- do
- 10.output
- b
- 12.output
- end
-end
-
-class A
- super Inline__
-end
-
-fun test1
-do
- var a: A = new A
- 5.output
- a.bar !b do
- 15.output
- a.bar
- end
-end
-
-fun test2
-do
- var a: A = new A
- a.foo !f do
- 5.output
- a.bar !b do
- 15.output
- a.bar
- end
- end
-end
-
-test1
-test2
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2009 Jean Privat <jean@pryen.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 kernel
-
-class Inline__
- fun foo
- !f
- do
- 0.output
- f
- 2.output
- end
-
- fun bar
- !b do 11.output
- do
- 10.output
- b
- 12.output
- end
-end
-
-class A
- fun baz
- !b
- do
- var inl = new Inline__
- inl.foo !f do b
- inl.bar !b do b
- inl.bar
- inl.foo !f do inl.bar !b do b
- end
-
- fun baz2
- !b do 22.output
- do
- var inl = new Inline__
- inl.foo !f do b
- inl.bar !b do b
- inl.bar
- inl.foo !f do inl.bar !b do b
- end
-end
-
-
-var a = new A
-a.baz !b do 20.output
-'\n'.output
-a.baz2 !b do 21.output
-'\n'.output
-a.baz2
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2009 Jean Privat <jean@pryen.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 range
-
-for i in [0..4] do i.output
-for i in [0..5[ do i.output
-0.enumerate_to(4) !each (i) do i.output
-0.enumerate_before(5) !each (i) do i.output
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2009 Jean Privat <jean@pryen.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 kernel
-
-fun foo
- !bar
-do
- bar !break do 'X'.output
-end
-
-fun maybe: Bool do return true
-
-1.output
-foo !bar do
- 2.output
- foo !bar do
- 3.output
- foo !bar do end label l3
- if maybe then
- #alt1#break label l2
- #alt2#break label l3
- #alt3#break label l4
- #alt4#break
- #alt5#continue label l1
- end
- if maybe then break label l1
- 4.output
- end label l2#alt6#
- #alt6#end label l1
- 5.output
-end label l1
-6.output
-
-#alt7#foo !bar do end label l1
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2009 Jean Privat <jean@pryen.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 kernel
-
-fun foo: Int
- !bar: Int
-do
- var i = bar !break do 'X'.output
- return i * 10
-end
-
-fun maybe: Bool do return true
-
-1.output
-var i = foo !bar do
- 2.output
- var j = foo !bar do
- 3.output
- foo !bar do
- continue 0
- end label l3
- if maybe then
- #alt1#break label l2 10
- #alt2#break label l3 10
- #alt3#break label l4 10
- #alt4#break 10
- #alt5#continue label l1 10
- end
- if maybe then break label l1 10
- 4.output
- break 4
- end label l2#alt6#
- #alt6#end label l1
- j.output
- 5.output
- continue 20
-end label l1
-i.output
-6.output
-
-#alt7#foo !bar do
-#alt7# continue 0
-#alt7#end label l1
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2009 Jean Privat <jean@pryen.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 kernel
-
-fun foo
- !bar do end
- !baz do end
-do
- bar
- baz
-end
-
-fun maybe: Bool do return true
-
-1.output
-foo !bar do
- 2.output
- foo !bar do
- 3.output
- foo !bar do end label l3
- if maybe then
- #alt1#break label l2
- #alt2#break label l3
- #alt3#break label l4
- #alt4#break
- #alt5#continue label l1
- end
- if maybe then break label l1
- 4.output
- !baz do
- 40.output
- end label l2#alt6#
- #alt6#end label l1
- 5.output
-!baz do
- 50.output
-end label l1
-6.output
-
-#alt7#foo !bar do end label l1
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2009 Jean Privat <jean@pryen.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 kernel
-
-fun foo(p1: Int)
- !bar(p2: Int) do (p1+p2).output
- #alt1#!bar(p2: Int) do (p1*p2).output
- #alt2#!p1 do abort
-do
- bar(p1*10)
- #alt3#var bar: Int = p1
- #alt4#p2.output
-end
-
-foo(0)
-var a1: Int = 1
-foo(2) !bar(a2) do
- #alt5#var a1: Int = 3
- #alt6#var a2: Int = 3
- #alt7#foo(3) !bar(a1) do a1.output
- #alt8#foo(4) !bar(a2) do a1.output
- a1.output
- a2.output
-end
-var a2: Int = 5
-a1.output
-a2.output
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2009 Jean Privat <jean@pryen.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.
-
-
-redef class Range[K]
- fun for_each(x: Int)
- !each(i: K)
- do
- var c = first
- var s = after
- while c < s do
- #print((" " * x) + c.to_s)
- each(c)
- c = c.succ
- end
- end
-end
-
-var nb = 5
-if not args.is_empty then nb = args.first.to_i
-
-var cpt = 0
-var r = [0..nb[
-r.for_each(0) !each ii1 do
- r.for_each(1) !each ii2 do
- r.for_each(2) !each ii3 do
- if ii1 == ii2 and ii2 == ii3 then cpt += 1
- end
- end
-end
-
-print cpt
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2005-2009 Jean Privat <jean@pryen.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.
-
-fun get_an_array(nb: Int): Array[Int]
-do
- var res = new Array[Int].with_capacity(nb)
- var j = 64
- while res.length < nb do
- j = (j * 3451 + 234) % 56557
- var k = j % 90 + 10
- res.add(k)
- end
- return res
-end
-
-var q = get_an_array(50)
-print(q.join(" "))
-q.sort !cmp(x,y) = x <=> y
-print(q.join(" "))
-q.sort !cmp(x,y) = (x%10) <=> (y%10)
-print(q.join(" "))
-q.sort !cmp(x,y) = y <=> x
-print(q.join(" "))
-q.sort !cmp(x,y) = (x%10) <=> (y%10)
-print(q.join(" "))
+++ /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 Power
- var number: Int
- var exponent: Int
-
- fun iterate !each(i: Int)
- do
- var res = 1
- for i in [0..self.exponent[ do
- res = res * self.number
- each(res)
- end
- end
-end
-
-for i in new Power(2, 8) do
- print i
-end
+++ /dev/null
-0
-1
-2
-3
-4
-5
-6
+++ /dev/null
-<0
- <1
- <2
- >2
- >1
- <1
- <2
- <1
- <2
- >2
- >1
->0
+++ /dev/null
-M0
-F0
-B0
-F1
-M1
-F0
-B0
-F1
-M2
-F1
-B0
-F0
-M1
-F1
-B0
-F0
-M0
+++ /dev/null
-M0
-F0
-B0
-F1
-M1
-F0
-B0
-F1
-M2
-M1
-F1
-B0
-F0
-M0
+++ /dev/null
-M0
-F0
-B0
-F1
-M1
-F0
-B0
-F1
-M2
+++ /dev/null
-0
-1
-4
-5
-6
+++ /dev/null
-alt/base_closure1_alt10.nit:49,2--6: Error: foo requires 1 blocks.
+++ /dev/null
-alt/base_closure1_alt11.nit:37,9--11: Error: 0 automatic variable names expected, 1 found.
+++ /dev/null
-alt/base_closure1_alt12.nit:50,9--11: Error: no closure named '!baz' in foo; only closure is !bar.
+++ /dev/null
-alt/base_closure1_alt2.nit:25,3--8: Error: arity mismatch; prototype is 'bar'.
+++ /dev/null
-alt/base_closure1_alt3.nit:26,11--13: Type error: expected expression.
+++ /dev/null
-0
-1
-2
-5
-6
+++ /dev/null
-alt/base_closure1_alt5.nit:41,3--11: Error: break without value required in this block.
+++ /dev/null
-0
-1
-2
-4
-5
-6
+++ /dev/null
-alt/base_closure1_alt7.nit:43,3--14: Error: continue without value required in this block.
+++ /dev/null
-0
-1
-2
-6
+++ /dev/null
-alt/base_closure1_alt9.nit:45,3--12: Error: Return with value in a procedure.
+++ /dev/null
-0
-1
-2
-3
-4
-5
-6
+++ /dev/null
-0
-1
-4
-5
-6
+++ /dev/null
-alt/base_closure2_alt10.nit:50,2--6: Error: foo requires 1 blocks.
+++ /dev/null
-alt/base_closure2_alt11.nit:38,9--11: Error: 1 automatic variable names expected, 0 found.
+++ /dev/null
-alt/base_closure2_alt12.nit:26,7--9: Type error: expected Int, got Char
+++ /dev/null
-alt/base_closure2_alt2.nit:25,3--5: Error: arity mismatch; prototype is 'bar(i: Int)'.
+++ /dev/null
-alt/base_closure2_alt3.nit:27,11--16: Type error: expected expression.
+++ /dev/null
-0
-1
-2
-5
-6
+++ /dev/null
-alt/base_closure2_alt5.nit:42,3--11: Error: break without value required in this block.
+++ /dev/null
-0
-1
-2
-4
-5
-6
+++ /dev/null
-alt/base_closure2_alt7.nit:44,3--14: Error: continue without value required in this block.
+++ /dev/null
-0
-1
-2
-6
+++ /dev/null
-alt/base_closure2_alt9.nit:46,3--12: Error: Return with value in a procedure.
+++ /dev/null
-0
-1
-2
-3
-4
-5
-6
-7
-8
-9
+++ /dev/null
-alt/base_closure3_alt1.nit:25,3--15: Error: arity mismatch; prototype is 'bar(k: Int, l: Int, a: A)'.
+++ /dev/null
-alt/base_closure3_alt2.nit:35,13--15: Error: 3 automatic variable names expected, 2 found.
+++ /dev/null
-0
-1
-2
-3
-4
-7
-8
-9
+++ /dev/null
-alt/base_closure3_alt5.nit:41,3--11: Error: break without value required in this block.
+++ /dev/null
-0
-1
-2
-3
-4
-6
-7
-8
-9
+++ /dev/null
-alt/base_closure3_alt7.nit:43,3--14: Error: continue without value required in this block.
+++ /dev/null
-0
-1
-2
-3
-4
+++ /dev/null
-alt/base_closure3_alt9.nit:45,3--12: Error: Return with value in a procedure.
+++ /dev/null
-0
-1
-2
-3
-4
-5
-6
+++ /dev/null
-0
-1
-4
-5
-6
+++ /dev/null
-alt/base_closure4_alt10.nit:49,2--6: Error: foo requires 1 blocks.
+++ /dev/null
-alt/base_closure4_alt11.nit:37,9--11: Error: 0 automatic variable names expected, 1 found.
+++ /dev/null
-alt/base_closure4_alt2.nit:25,3--8: Error: arity mismatch; prototype is 'bar: Int'.
+++ /dev/null
-alt/base_closure4_alt3.nit:26,17--19: Type error: expected Char, got Int
+++ /dev/null
-0
-1
-2
-5
-6
+++ /dev/null
-alt/base_closure4_alt5.nit:41,3--11: Error: break without value required in this block.
+++ /dev/null
-alt/base_closure4_alt6.nit:42,3--10: Error: continue with a value required in this block.
+++ /dev/null
-alt/base_closure4_alt7.nit:43,12--14: Type error: expected Int, got Char
+++ /dev/null
-0
-1
-2
-6
+++ /dev/null
-alt/base_closure4_alt9.nit:45,3--12: Error: Return with value in a procedure.
+++ /dev/null
-0
-1
-2
-3
-4
-5
-6
+++ /dev/null
-alt/base_closure5_alt1.nit:38,3--7: Error: break with a value required in this block.
+++ /dev/null
-alt/base_closure5_alt2.nit:39,9--11: Type error: no most general type. Got Char and Int.
+++ /dev/null
-0
-1
-2
-4
-100
-6
+++ /dev/null
-alt/base_closure5_alt4.nit:41,3--8: Error: Return without value in a function.
+++ /dev/null
-alt/base_closure5_alt5.nit:42,10--12: Type error: expected Int, got Char
+++ /dev/null
-0
-1
-2
-200
-6
+++ /dev/null
-alt/base_closure5_alt7.nit:44,3--10: Error: continue with a value required in this block.
+++ /dev/null
-alt/base_closure5_alt8.nit:45,12--14: Type error: expected Int, got Char
+++ /dev/null
-alt/base_closure5_alt9.nit:35,17--19: Control error: Reached end of block (a 'continue' with a value was expected).
+++ /dev/null
-base_closure6.nit:57,25: Type error: no most general type. Got V and U.
-base_closure6.nit:74,8: Type error: no most general type. Got V and U at 72,8.
+++ /dev/null
-alt/base_closure6_alt1.nit:55,5--25: Type error: expected U, got T
-alt/base_closure6_alt1.nit:57,25: Type error: no most general type. Got V and U.
-alt/base_closure6_alt1.nit:59,5--69,3: Type error: expected U, got T
-alt/base_closure6_alt1.nit:74,8: Type error: no most general type. Got V and U at 72,8.
+++ /dev/null
-0
- 0
- 1
- 2
- 3
-1
- 0
- 2
- 3
-
-2
- 0
- 1
-
-3
- 0
- 1
- 2
+++ /dev/null
-0
-[1
-2
-[3
-4
-5
-]3
-6
-]1
-7
-8
+++ /dev/null
-0
-[1
-2
-[3
-4
-!3
-6
-]1
-7
-8
+++ /dev/null
-0
-[1
-2
-[3
-4
-]3
-6
-]1
-7
-8
+++ /dev/null
-0
-[1
-2
-[3
-4
-!3
-!1
-8
+++ /dev/null
-alt/base_closure8_alt4.nit:29,8--10: Error: no closure named '!baz' in bar; only closure is !break.
+++ /dev/null
-0
-[A,0
- [a,1
- [a,2
- {a,3
- {b,3
- {c,3
- <a,2
- [b,2
- {a,3
- {b,3
- {c,3
- <b,2
- [c,2
- {a,3
- {b,3
- {c,3
- <c,2
- <a,1
- [b,1
- [a,2
- {a,3
- {b,3
- {c,3
- <a,2
- [b,2
- {a,3
- {b,3
- {c,3
- <b,2
- [c,2
- {a,3
- {b,3
- {c,3
- <c,2
- <b,1
- [c,1
- [a,2
- {a,3
- {b,3
- {c,3
- <a,2
- [b,2
- {a,3
- {b,3
- {c,3
- <b,2
- [c,2
- {a,3
- {b,3
- {c,3
- <c,2
- <c,1
-<A,0
-[B,0
- [a,1
- [a,2
- {a,3
- {b,3
- {c,3
- <a,2
- [b,2
- {a,3
- {b,3
- {c,3
- <b,2
- [c,2
- {a,3
- {b,3
- {c,3
- <c,2
- <a,1
- [b,1
- [a,2
- {a,3
- {b,3
- {c,3
- <a,2
- [b,2
- {a,3
- {b,3
- {c,3
- <b,2
- [c,2
- {a,3
- {b,3
- {c,3
- <c,2
- <b,1
- [c,1
- [a,2
- {a,3
- {b,3
- {c,3
- <a,2
- [b,2
- {a,3
- {b,3
- {c,3
- <b,2
- [c,2
- {a,3
- {b,3
- {c,3
- <c,2
- <c,1
-<B,0
-[C,0
- [a,1
- [a,2
- {a,3
- {b,3
- {c,3
- <a,2
- [b,2
- {a,3
- {b,3
- {c,3
- <b,2
- [c,2
- {a,3
- {b,3
- {c,3
- <c,2
- <a,1
- [b,1
- [a,2
- {a,3
- {b,3
- {c,3
- <a,2
- [b,2
- {a,3
- {b,3
- {c,3
- <b,2
- [c,2
- {a,3
- {b,3
- {c,3
- <c,2
- <b,1
- [c,1
- [a,2
- {a,3
- {b,3
- {c,3
- <a,2
- [b,2
- {a,3
- {b,3
- {c,3
- <b,2
- [c,2
- {a,3
- {b,3
- {c,3
- <c,2
- <c,1
-<C,0
-1
->C,0
- >c,1
- >c,2
- }c,3
- }b,3
- }a,3
- ]c,2
- >b,2
- }c,3
- }b,3
- }a,3
- ]b,2
- >a,2
- }c,3
- }b,3
- }a,3
- ]a,2
- ]c,1
- >b,1
- >c,2
- }c,3
- }b,3
- }a,3
- ]c,2
- >b,2
- }c,3
- }b,3
- }a,3
- ]b,2
- >a,2
- }c,3
- }b,3
- }a,3
- ]a,2
- ]b,1
- >a,1
- >c,2
- }c,3
- }b,3
- }a,3
- ]c,2
- >b,2
- }c,3
- }b,3
- }a,3
- ]b,2
- >a,2
- }c,3
- }b,3
- }a,3
- ]a,2
- ]a,1
-]C,0
->B,0
- >c,1
- >c,2
- }c,3
- }b,3
- }a,3
- ]c,2
- >b,2
- }c,3
- }b,3
- }a,3
- ]b,2
- >a,2
- }c,3
- }b,3
- }a,3
- ]a,2
- ]c,1
- >b,1
- >c,2
- }c,3
- }b,3
- }a,3
- ]c,2
- >b,2
- }c,3
- }b,3
- }a,3
- ]b,2
- >a,2
- }c,3
- }b,3
- }a,3
- ]a,2
- ]b,1
- >a,1
- >c,2
- }c,3
- }b,3
- }a,3
- ]c,2
- >b,2
- }c,3
- }b,3
- }a,3
- ]b,2
- >a,2
- }c,3
- }b,3
- }a,3
- ]a,2
- ]a,1
-]B,0
->A,0
- >c,1
- >c,2
- }c,3
- }b,3
- }a,3
- ]c,2
- >b,2
- }c,3
- }b,3
- }a,3
- ]b,2
- >a,2
- }c,3
- }b,3
- }a,3
- ]a,2
- ]c,1
- >b,1
- >c,2
- }c,3
- }b,3
- }a,3
- ]c,2
- >b,2
- }c,3
- }b,3
- }a,3
- ]b,2
- >a,2
- }c,3
- }b,3
- }a,3
- ]a,2
- ]b,1
- >a,1
- >c,2
- }c,3
- }b,3
- }a,3
- ]c,2
- >b,2
- }c,3
- }b,3
- }a,3
- ]b,2
- >a,2
- }c,3
- }b,3
- }a,3
- ]a,2
- ]a,1
-]A,0
-2
-3
+++ /dev/null
-0
-[A,0
- [a,1
- [a,2
- {a,3
- {b,3
- {c,3
- <a,2
- [b,2
- {a,3
- {b,3
- {c,3
- <b,2
- [c,2
- {a,3
- {b,3
- {c,3
- <c,2
- <a,1
- [b,1
- [a,2
- {a,3
- {b,3
- {c,3
- <a,2
- [b,2
- {a,3
- {b,3
- {c,3
- <b,2
- [c,2
- {a,3
- {b,3
- {c,3
- <c,2
- <b,1
- [c,1
- [a,2
- {a,3
- {b,3
- {c,3
- <a,2
- [b,2
- {a,3
- {b,3
- {c,3
- <b,2
- [c,2
- {a,3
- {b,3
- {c,3
- <c,2
- <c,1
-<A,0
-[B,0
- [a,1
- [a,2
- {a,3
- {b,3
- {c,3
- <a,2
- [b,2
- {a,3
- {b,3
- {c,3
- <b,2
- [c,2
- {a,3
- {b,3
- {c,3
- <c,2
- <a,1
- [b,1
- [a,2
- {a,3
- {b,3
- {c,3
- <a,2
- [b,2
- {a,3
- {b,3
- {c,3
- <b,2
- [c,2
- {a,3
- {b,3
- {c,3
- <c,2
- <b,1
- [c,1
- [a,2
- {a,3
- {b,3
- {c,3
- <a,2
- [b,2
- {a,3
- {b,3
- {c,3
- <b,2
- [c,2
- {a,3
- {b,3
- {c,3
- <c,2
- <c,1
-<B,0
-[C,0
- [a,1
- [a,2
- {a,3
- {b,3
- {c,3
- <a,2
- [b,2
- {a,3
- {b,3
- {c,3
- <b,2
- [c,2
- {a,3
- {b,3
- {c,3
- <c,2
- <a,1
- [b,1
- [a,2
- {a,3
- {b,3
- {c,3
- <a,2
- [b,2
- {a,3
- {b,3
- {c,3
- <b,2
- [c,2
- {a,3
- {b,3
- {c,3
- <c,2
- <b,1
- [c,1
- [a,2
- {a,3
- {b,3
- {c,3
- <a,2
- [b,2
- {a,3
- {b,3
- {c,3
- <b,2
- [c,2
- {a,3
- {b,3
- {c,3
- <c,2
- <c,1
-<C,0
-1
->B,0
- >c,1
- >c,2
- }c,3
- }b,3
- }a,3
- ]c,2
- >b,2
- }c,3
- }b,3
- }a,3
- ]b,2
- >a,2
- }c,3
- }b,3
- }a,3
- ]a,2
- ]c,1
- >b,1
- >c,2
- }c,3
- }b,3
- }a,3
- ]c,2
- >b,2
- }c,3
- }b,3
- }a,3
- ]b,2
- >a,2
- }c,3
- }b,3
- }a,3
- ]a,2
- ]b,1
- >a,1
- >c,2
- }c,3
- }b,3
- }a,3
- ]c,2
- >b,2
- }c,3
- }b,3
- }a,3
- ]b,2
- >a,2
- }c,3
- }b,3
- }a,3
- ]a,2
- ]a,1
-]B,0
->A,0
- >c,1
- >c,2
- }c,3
- }b,3
- }a,3
- ]c,2
- >b,2
- }c,3
- }b,3
- }a,3
- ]b,2
- >a,2
- }c,3
- }b,3
- }a,3
- ]a,2
- ]c,1
- >b,1
- >c,2
- }c,3
- }b,3
- }a,3
- ]c,2
- >b,2
- }c,3
- }b,3
- }a,3
- ]b,2
- >a,2
- }c,3
- }b,3
- }a,3
- ]a,2
- ]b,1
- >a,1
- >c,2
- }c,3
- }b,3
- }a,3
- ]c,2
- >b,2
- }c,3
- }b,3
- }a,3
- ]b,2
- >a,2
- }c,3
- }b,3
- }a,3
- ]a,2
- ]a,1
-]A,0
-2
-3
+++ /dev/null
-0
-[A,0
- [a,1
- [a,2
- {a,3
- {b,3
- {c,3
- <a,2
- [b,2
- {a,3
- {b,3
- {c,3
- <b,2
- [c,2
- {a,3
- {b,3
- {c,3
- <c,2
- <a,1
- [b,1
- [a,2
- {a,3
- {b,3
- {c,3
- <a,2
- [b,2
- {a,3
- {b,3
- {c,3
- <b,2
- [c,2
- {a,3
- {b,3
- {c,3
- <c,2
- <b,1
- [c,1
- [a,2
- {a,3
- {b,3
- {c,3
- <a,2
- [b,2
- {a,3
- {b,3
- {c,3
- <b,2
- [c,2
- {a,3
- {b,3
- {c,3
- <c,2
- <c,1
-<A,0
-[B,0
- [a,1
- [a,2
- {a,3
- {b,3
- {c,3
- <a,2
- [b,2
- {a,3
- {b,3
- {c,3
- <b,2
- [c,2
- {a,3
- {b,3
- {c,3
- <c,2
- <a,1
- [b,1
- [a,2
- {a,3
- {b,3
- {c,3
- <a,2
- [b,2
- {a,3
- {b,3
- {c,3
- <b,2
- [c,2
- {a,3
- {b,3
- {c,3
- <c,2
- <b,1
- [c,1
- [a,2
- {a,3
- {b,3
- {c,3
- <a,2
- [b,2
- {a,3
- {b,3
- {c,3
- <b,2
- [c,2
- {a,3
- {b,3
- {c,3
- <c,2
- <c,1
-<B,0
-[C,0
- [a,1
- [a,2
- {a,3
- {b,3
- {c,3
- <a,2
- [b,2
- {a,3
- {b,3
- {c,3
- <b,2
- [c,2
- {a,3
- {b,3
- {c,3
- <c,2
- <a,1
- [b,1
- [a,2
- {a,3
- {b,3
- {c,3
- <a,2
- [b,2
- {a,3
- {b,3
- {c,3
- <b,2
- [c,2
- {a,3
- {b,3
- {c,3
- <c,2
- <b,1
- [c,1
- [a,2
- {a,3
- {b,3
- {c,3
- <a,2
- [b,2
- {a,3
- {b,3
- {c,3
- <b,2
- [c,2
- {a,3
- {b,3
- {c,3
- <c,2
- <c,1
-<C,0
-1
-3
+++ /dev/null
-0
-1
-2
-3
-5
-6
+++ /dev/null
-0
-1
-2
-3
-4
-5
-6
+++ /dev/null
-0
-1
-4
-5
-6
+++ /dev/null
-alt/base_closure_break2_alt10.nit:52,2--6: Error: foo requires 1 blocks.
+++ /dev/null
-alt/base_closure_break2_alt11.nit:38,18--20: Error: 0 automatic variable names expected, 1 found.
+++ /dev/null
-alt/base_closure_break2_alt12.nit:22,3--17: Syntax Error: A break block cannot have a return value.
+++ /dev/null
-alt/base_closure_break2_alt13.nit:37,17--19: Control error: Reached end of break block (a 'break' with a value was expected).
+++ /dev/null
-alt/base_closure_break2_alt2.nit:26,17--22: Error: arity mismatch; prototype is 'bar'.
+++ /dev/null
-alt/base_closure_break2_alt3.nit:27,25--27: Type error: expected expression.
+++ /dev/null
-0
-1
-2
-4
-5
-6
+++ /dev/null
-alt/base_closure_break2_alt5.nit:42,9--11: Type error: no most general type. Got Char and Int at 49,9.
+++ /dev/null
-alt/base_closure_break2_alt6.nit:43,3--10: Error: cannot 'continue', only 'break'.
+++ /dev/null
-alt/base_closure_break2_alt7.nit:44,3--14: Error: cannot 'continue', only 'break'.
+++ /dev/null
-0
-1
-2
-6
+++ /dev/null
-alt/base_closure_break2_alt9.nit:46,3--12: Error: Return with value in a procedure.
+++ /dev/null
-0
-1
-4
-5
-6
+++ /dev/null
-alt/base_closure_break_alt10.nit:51,2--6: Error: foo requires 1 blocks.
+++ /dev/null
-alt/base_closure_break_alt11.nit:38,9--11: Error: 0 automatic variable names expected, 1 found.
+++ /dev/null
-alt/base_closure_break_alt12.nit:22,3--17: Syntax Error: A break block cannot have a return value.
+++ /dev/null
-0
-1
-2
-3
-5
-6
+++ /dev/null
-alt/base_closure_break_alt2.nit:26,17--22: Error: arity mismatch; prototype is 'bar'.
+++ /dev/null
-alt/base_closure_break_alt3.nit:27,25--27: Type error: expected expression.
+++ /dev/null
-0
-1
-2
-5
-6
+++ /dev/null
-alt/base_closure_break_alt5.nit:42,3--11: Error: break without value required in this block.
+++ /dev/null
-alt/base_closure_break_alt6.nit:43,3--10: Error: cannot 'continue', only 'break'.
+++ /dev/null
-alt/base_closure_break_alt7.nit:44,3--14: Error: cannot 'continue', only 'break'.
+++ /dev/null
-0
-1
-2
-6
+++ /dev/null
-alt/base_closure_break_alt9.nit:46,3--12: Error: Return with value in a procedure.
+++ /dev/null
-0
-1
-2
-0
-1
-20
-0
+++ /dev/null
-0
-1
-2
-0
-1
-20
-0
+++ /dev/null
-alt/base_closure_break_default2_alt1.nit:23,4--9: Error: 'return' invalid in default closure definitions. Use 'continue' or 'break'.
+++ /dev/null
-alt/base_closure_break_default2_alt2.nit:24,4--11: Error: 'return' invalid in default closure definitions. Use 'continue' or 'break'.
+++ /dev/null
-Runtime error: Aborted (alt/base_closure_break_default2_alt3.nit:25)
-0
-1
-2
-0
-1
+++ /dev/null
-alt/base_closure_break_default2_alt4.nit:26,4--11: Error: cannot 'continue', only 'break'.
+++ /dev/null
-alt/base_closure_break_default2_alt5.nit:27,4--14: Error: cannot 'continue', only 'break'.
+++ /dev/null
-alt/base_closure_break_default2_alt6.nit:28,4--8: Error: break with a value required in this block.
+++ /dev/null
-0
-1
-2
-0
-1
-1
-0
+++ /dev/null
-alt/base_closure_break_default2_alt8.nit:30,10--12: Type error: expected Int, got Char
+++ /dev/null
-alt/base_closure_break_default2_alt9.nit:21,3--33,5: Control error: Reached end of break block (a 'break' with a value was expected).
+++ /dev/null
-alt/base_closure_break_default_alt1.nit:23,4--9: Error: 'return' invalid in default closure definitions. Use 'continue' or 'break'.
+++ /dev/null
-alt/base_closure_break_default_alt2.nit:24,4--11: Error: 'return' invalid in default closure definitions. Use 'continue' or 'break'.
+++ /dev/null
-Runtime error: Aborted (alt/base_closure_break_default_alt3.nit:25)
-0
-1
-2
-0
-1
+++ /dev/null
-alt/base_closure_break_default_alt4.nit:26,4--11: Error: cannot 'continue', only 'break'.
+++ /dev/null
-alt/base_closure_break_default_alt5.nit:27,4--14: Error: cannot 'continue', only 'break'.
+++ /dev/null
-0
-1
-2
-0
-1
-0
+++ /dev/null
-alt/base_closure_break_default_alt7.nit:29,4--10: Error: break without value required in this block.
+++ /dev/null
-1
-2
-3
-4
-5
+++ /dev/null
-alt/base_closure_continue_assign_alt1.nit:45,10--12: Type error: expected Int, got Char
+++ /dev/null
-alt/base_closure_continue_assign_alt2.nit:46,10: Error: continue without value required in this block.
+++ /dev/null
-1
-2
-3
-4
-5
-6
+++ /dev/null
-0
-1
-2
-3
-0
-1
-20
-3
-0
+++ /dev/null
-alt/base_closure_default1_alt1.nit:23,4--9: Error: 'return' invalid in default closure definitions. Use 'continue' or 'break'.
+++ /dev/null
-alt/base_closure_default1_alt2.nit:24,4--11: Error: 'return' invalid in default closure definitions. Use 'continue' or 'break'.
+++ /dev/null
-Runtime error: Aborted (alt/base_closure_default1_alt3.nit:25)
-0
-1
-2
-3
-0
-1
+++ /dev/null
-0
-1
-2
-3
-0
-1
-3
-0
+++ /dev/null
-alt/base_closure_default1_alt5.nit:27,4--14: Error: continue without value required in this block.
+++ /dev/null
-0
-1
-2
-3
-0
-1
-0
+++ /dev/null
-alt/base_closure_default1_alt7.nit:29,4--10: Error: break without value required in this block.
+++ /dev/null
-0
-1
-2
-3
-0
-1
-20
-3
-0
+++ /dev/null
-alt/base_closure_default2_alt1.nit:23,4--9: Error: 'return' invalid in default closure definitions. Use 'continue' or 'break'.
+++ /dev/null
-alt/base_closure_default2_alt2.nit:24,4--11: Error: 'return' invalid in default closure definitions. Use 'continue' or 'break'.
+++ /dev/null
-Runtime error: Aborted (alt/base_closure_default2_alt3.nit:25)
-0
-1
-2
-3
-0
-1
+++ /dev/null
-0
-1
-2
-3
-0
-1
-3
-0
+++ /dev/null
-alt/base_closure_default2_alt5.nit:27,4--14: Error: continue without value required in this block.
+++ /dev/null
-alt/base_closure_default2_alt6.nit:36,3: Error: Method or variable 'i' unknown in A.
+++ /dev/null
-0
-1
-2
-3
-0
-1
-0
+++ /dev/null
-alt/base_closure_default2_alt8.nit:29,4--10: Error: break without value required in this block.
+++ /dev/null
-0
-1
-2
-3
-0
-1
-20
-3
-0
+++ /dev/null
-alt/base_closure_default3_alt1.nit:23,4--9: Error: 'return' invalid in default closure definitions. Use 'continue' or 'break'.
+++ /dev/null
-alt/base_closure_default3_alt2.nit:24,4--11: Error: 'return' invalid in default closure definitions. Use 'continue' or 'break'.
+++ /dev/null
-Runtime error: Aborted (alt/base_closure_default3_alt3.nit:25)
-0
-1
-2
-3
-0
-1
+++ /dev/null
-alt/base_closure_default3_alt4.nit:26,4--11: Error: continue with a value required in this block.
+++ /dev/null
-0
-1
-2
-3
-0
-1
-0
+++ /dev/null
-alt/base_closure_default3_alt6.nit:27,4--10: Error: break without value required in this block.
+++ /dev/null
-0
-1
-2
-3
-0
-1
-20
-3
-0
+++ /dev/null
-alt/base_closure_default4_alt1.nit:23,4--9: Error: 'return' invalid in default closure definitions. Use 'continue' or 'break'.
+++ /dev/null
-alt/base_closure_default4_alt2.nit:24,4--12: Error: 'return' invalid in default closure definitions. Use 'continue' or 'break'.
+++ /dev/null
-Runtime error: Aborted (alt/base_closure_default4_alt3.nit:25)
-0
-1
-2
-3
-0
-1
+++ /dev/null
-alt/base_closure_default4_alt4.nit:26,4--11: Error: continue with a value required in this block.
+++ /dev/null
-alt/base_closure_default4_alt5.nit:21,3--31,5: Control error: Reached end of block (a 'continue' with a value was expected).
+++ /dev/null
-0
-1
-2
-3
-0
-1
-0
+++ /dev/null
-alt/base_closure_default4_alt7.nit:28,4--10: Error: break without value required in this block.
+++ /dev/null
-[2,1]
-[1,2]
-[2,1]
-21
-
-{I:1}
-I=1
-{I:1}
-V=5
-{I:1,V:5}
-V=5
-{I:1,V:5}
-X=0
-{I:1,V:5}
-I=1;V=5;
-
-O?true
-C1
-O?false
-
-E404
+++ /dev/null
-0
-1
-2
-3
-4
-5
-6
-7
-8
+++ /dev/null
-alt/base_closure_multi_alt1.nit:54,1--64,3: Error: a requires 1 blocks, 2 found.
+++ /dev/null
-alt/base_closure_multi_alt2.nit:54,1--64,3: Error: a requires 3 blocks, 2 found.
+++ /dev/null
-alt/base_closure_multi_alt3.nit:55,2--61,4: Error: b requires 2 blocks, 1 found.
+++ /dev/null
-alt/base_closure_multi_alt4.nit:55,2--61,4: Error: b requires 2 blocks, 3 found.
+++ /dev/null
-alt/base_closure_multi_alt6.nit:22,2--3: Error: A closure '!a1' already defined at 19,3--4.
+++ /dev/null
-0
-1
-2
-10
-1
-12
-10
-11
-12
+++ /dev/null
-0
-1
-2
-10
-1
-12
-10
-11
-12
+++ /dev/null
-1
-2
-3
-4
-5
-6
+++ /dev/null
-1
-2
-3
-4
-5
-6
+++ /dev/null
-20
-3
-4
-5
-6
+++ /dev/null
-10
-2
-3
-4
-5
-6
+++ /dev/null
-1
-5
-3
-4
-5
-6
+++ /dev/null
-3
-4
-5
-6
+++ /dev/null
-5
-3
-4
-5
-6
+++ /dev/null
-3
-4
-5
-6
+++ /dev/null
-2
-3
-4
-5
-6
+++ /dev/null
-1
-2
-3
-4
-3
-4
-1
-2
-3
-4
-3
-4
-5
+++ /dev/null
-1
-2
-3
-4
-3
-4
-1
-2
-3
-4
-3
-4
-5
+++ /dev/null
-1
-2
-3
-4
-1
-2
-3
-4
-5
+++ /dev/null
-1
-2
-3
-4
-3
-4
-1
-2
-3
-4
-3
-4
-5
+++ /dev/null
-1
-2
-1
-2
-5
+++ /dev/null
-1
-2
-3
-4
-1
-2
-3
-4
-5
+++ /dev/null
-1
-2
-3
-4
-3
-4
-1
-2
-3
-4
-3
-4
-5
+++ /dev/null
-1
-2
-1
-2
-5
+++ /dev/null
-5
-10
-15
-10
-11
-12
-12
-0
-5
-10
-15
-10
-11
-12
-12
-2
+++ /dev/null
-0
-20
-2
-10
-20
-12
-10
-11
-12
-0
-10
-20
-12
-2
-
-0
-21
-2
-10
-21
-12
-10
-11
-12
-0
-10
-21
-12
-2
-
-0
-22
-2
-10
-22
-12
-10
-11
-12
-0
-10
-22
-12
-2
+++ /dev/null
-1
-2
-3
-XX6
+++ /dev/null
-1
-2
-3
-XX10
-6
+++ /dev/null
-1
-2
-3
-X10
-5
-200
-6
+++ /dev/null
-alt/base_label_closure2_alt2.nit:38,9--16: Syntax error: invalid label l3.
+++ /dev/null
-alt/base_label_closure2_alt3.nit:39,9--16: Syntax error: invalid label l4.
+++ /dev/null
-1
-2
-3
-X10
-5
-200
-6
+++ /dev/null
-1
-2
-3
-X100
-6
+++ /dev/null
-alt/base_label_closure2_alt6.nit:47,6--13: Syntax error: label l1 already defined at 51,5--12.
+++ /dev/null
-1
-2
-3
-XX10
-6
+++ /dev/null
-1
-2
-3
-6
+++ /dev/null
-1
-2
-3
-5
-50
-6
+++ /dev/null
-alt/base_label_closure3_alt2.nit:37,9--16: Syntax error: invalid label l3.
+++ /dev/null
-alt/base_label_closure3_alt3.nit:38,9--16: Syntax error: invalid label l4.
+++ /dev/null
-1
-2
-3
-5
-50
-6
+++ /dev/null
-1
-2
-3
-50
-6
+++ /dev/null
-alt/base_label_closure3_alt6.nit:47,6--13: Syntax error: label l1 already defined at 51,5--12.
-alt/base_label_closure3_alt6.nit:47,6--13: Syntax error: label l1 already defined at 51,5--12.
+++ /dev/null
-1
-2
-3
-6
+++ /dev/null
-1
-2
-3
-X5
-6
+++ /dev/null
-alt/base_label_closure_alt2.nit:35,9--16: Syntax error: invalid label l3.
+++ /dev/null
-alt/base_label_closure_alt3.nit:36,9--16: Syntax error: invalid label l4.
+++ /dev/null
-1
-2
-3
-X5
-6
+++ /dev/null
-1
-2
-3
-X6
+++ /dev/null
-alt/base_label_closure_alt6.nit:43,6--13: Syntax error: label l1 already defined at 45,5--12.
+++ /dev/null
-1
-2
-3
-XX6
+++ /dev/null
-0
-1
-20
-1
-5
+++ /dev/null
-alt/base_var_closure_alt1.nit:21,3--5: Error: A closure '!bar' already defined at 20,3--5.
+++ /dev/null
-alt/base_var_closure_alt2.nit:22,3--4: Error: 'p1' already defined at 19,9--10.
-alt/base_var_closure_alt2.nit:24,6--7: Type error: expected expression.
+++ /dev/null
-alt/base_var_closure_alt3.nit:25,6--8: Error: 'bar' already defined at 20,3--5.
+++ /dev/null
-alt/base_var_closure_alt4.nit:26,2--3: Error: Method or variable 'p2' unknown in Object.
+++ /dev/null
-alt/base_var_closure_alt5.nit:32,6--7: Error: 'a1' already defined at 30,5--6.
+++ /dev/null
-alt/base_var_closure_alt6.nit:33,6--7: Error: 'a2' already defined at 31,13--14.
+++ /dev/null
-alt/base_var_closure_alt7.nit:34,14--15: Error: 'a1' already defined at 30,5--6.
+++ /dev/null
-alt/base_var_closure_alt8.nit:35,14--15: Error: 'a2' already defined at 31,13--14.
+++ /dev/null
-<0
- <1
- <2
- =10
- >2
- >1
- <1
- <2
- =20
- >2
- >1
- <1
- <2
- =30
- >2
- >1
->0
+++ /dev/null
-<0
- <1
- <2
- =10
- >2
- >1
- <1
- <2
- =20
- <1
- <2
- =30
- >2
- >1
->0
+++ /dev/null
-B:
-true
-blue
-R:
-false
-red
-true
-red
-N:
-false
-black
-false
+++ /dev/null
-Runtime error: Aborted (alt/test_map_closure_default_alt1.nit:19)
-B:
-true
-blue
-R:
-false
-red
-true
-red
-N:
-false
-black
-false
+++ /dev/null
-fun foo !k
-do
- ' '.output
- '<'.output
- 1.output
- k
- ' '.output
- '>'.output
- 1.output
-end
-
-fun test
-do
- var a = [10, 20, 30]
- '<'.output
- 0.output
- var i = 0
- while i < 3 do
- foo !k do
- ' '.output
- ' '.output
- '<'.output
- 2.output
- ' '.output
- ' '.output
- '='.output
- a[i].output # a[i] is usually inlined
- if i == 1 then
- #alt1#break
- end
- ' '.output
- ' '.output
- '>'.output
- 2.output
- end
- i += 1
- end
- '>'.output
- 0.output
-end
-
-test
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2009 Jean Privat <jean@pryen.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.
-
-fun test_iterator(c: Collection[Int])
-do
- var idx = 0
- var it = c.iterator
- while it.is_ok do
- var i = it.item
- print " {idx}->{i}"
- it.next
- idx += 1
- end
-end
-
-fun test_iterate(c: Collection[Int])
-do
- var idx = 0
- c.iterate !each i do
- print " {idx}->{i}"
- idx += 1
- end
-end
-
-fun test_for(c: Collection[Int])
-do
- var idx = 0
- for i in c do
- print " {idx}->{i}"
- idx += 1
- end
-end
-
-fun test_coll(c: Collection[Int], s: String)
-do
- print("{s}: iterator")
- test_iterator(c)
- print("{s}: iterate")
- test_iterate(c)
- print("{s}: for")
- test_for(c)
- print("")
-end
-
-fun init_seq(c: SimpleCollection[Int]): SimpleCollection[Int]
-do
- for i in [0..5[ do
- c.add(i)
- end
- return c
-end
-
-fun init_map(c: Map[Int, Int]): Map[Int, Int]
-do
- for i in [0..5[ do
- c[i*10] = i
- end
- return c
-end
-
-test_coll(init_seq(new Array[Int]), "Array")
-test_coll(init_seq(new List[Int]), "List")
-test_coll(init_seq(new ArraySet[Int]), "ArraySet")
-test_coll(init_seq(new HashSet[Int]), "HashSet")
-test_coll([0..5[, "ORange")
-test_coll([0..4], "CRange")
-test_coll(init_map(new ArrayMap[Int, Int]).values, "ArrayMap")
-test_coll(init_map(new HashMap[Int, Int]).values, "HashMap")
-
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2009 Jean Privat <jean@pryen.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.
-
-redef class Map[K, V]
- fun get(k: K): V
- !def: V do abort
- do
- if has_key(k) then return self[k]
- var d = def
- self[k] = d
- return d
- end
-end
-
-var h = new HashMap[String, String]
-h["bleu"] = "blue"
-
-print "B:"
-
-print h.has_key("bleu")
-var v = h.get("bleu") !def do
- print "Error"
- abort
-end
-print v
-
-print "R:"
-
-print h.has_key("rouge")
-v = h.get("rouge") !def do continue "red"
-print v
-print h.has_key("rouge")
-v = h.get("rouge")
-print v
-
-print "N:"
-
-print h.has_key("noir")
-v = h.get("noir") !def do break "black"
-print v
-print h.has_key("noir")
-
-#alt1#v = h.get("noir")