syntax: handle labels for for, while and closures
authorJean Privat <jean@pryen.org>
Mon, 27 Jul 2009 03:41:19 +0000 (23:41 -0400)
committerJean Privat <jean@pryen.org>
Mon, 27 Jul 2009 07:36:23 +0000 (03:36 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

47 files changed:
src/syntax/escape.nit
src/syntax/typing.nit
tests/base_label_closure.nit [new file with mode: 0644]
tests/base_label_closure2.nit [new file with mode: 0644]
tests/base_label_closure3.nit [new file with mode: 0644]
tests/base_label_for.nit [new file with mode: 0644]
tests/base_label_while.nit [new file with mode: 0644]
tests/sav/base_label_closure.sav [new file with mode: 0644]
tests/sav/base_label_closure2.sav [new file with mode: 0644]
tests/sav/base_label_closure2_alt1.sav [new file with mode: 0644]
tests/sav/base_label_closure2_alt2.sav [new file with mode: 0644]
tests/sav/base_label_closure2_alt3.sav [new file with mode: 0644]
tests/sav/base_label_closure2_alt4.sav [new file with mode: 0644]
tests/sav/base_label_closure2_alt5.sav [new file with mode: 0644]
tests/sav/base_label_closure2_alt6.sav [new file with mode: 0644]
tests/sav/base_label_closure2_alt7.sav [new file with mode: 0644]
tests/sav/base_label_closure3.sav [new file with mode: 0644]
tests/sav/base_label_closure3_alt1.sav [new file with mode: 0644]
tests/sav/base_label_closure3_alt2.sav [new file with mode: 0644]
tests/sav/base_label_closure3_alt3.sav [new file with mode: 0644]
tests/sav/base_label_closure3_alt4.sav [new file with mode: 0644]
tests/sav/base_label_closure3_alt5.sav [new file with mode: 0644]
tests/sav/base_label_closure3_alt6.sav [new file with mode: 0644]
tests/sav/base_label_closure3_alt7.sav [new file with mode: 0644]
tests/sav/base_label_closure_alt1.sav [new file with mode: 0644]
tests/sav/base_label_closure_alt2.sav [new file with mode: 0644]
tests/sav/base_label_closure_alt3.sav [new file with mode: 0644]
tests/sav/base_label_closure_alt4.sav [new file with mode: 0644]
tests/sav/base_label_closure_alt5.sav [new file with mode: 0644]
tests/sav/base_label_closure_alt6.sav [new file with mode: 0644]
tests/sav/base_label_closure_alt7.sav [new file with mode: 0644]
tests/sav/base_label_for.sav [new file with mode: 0644]
tests/sav/base_label_for_alt1.sav [new file with mode: 0644]
tests/sav/base_label_for_alt2.sav [new file with mode: 0644]
tests/sav/base_label_for_alt3.sav [new file with mode: 0644]
tests/sav/base_label_for_alt4.sav [new file with mode: 0644]
tests/sav/base_label_for_alt5.sav [new file with mode: 0644]
tests/sav/base_label_for_alt6.sav [new file with mode: 0644]
tests/sav/base_label_for_alt7.sav [new file with mode: 0644]
tests/sav/base_label_while.sav [new file with mode: 0644]
tests/sav/base_label_while_alt1.sav [new file with mode: 0644]
tests/sav/base_label_while_alt2.sav [new file with mode: 0644]
tests/sav/base_label_while_alt3.sav [new file with mode: 0644]
tests/sav/base_label_while_alt4.sav [new file with mode: 0644]
tests/sav/base_label_while_alt5.sav [new file with mode: 0644]
tests/sav/base_label_while_alt6.sav [new file with mode: 0644]
tests/sav/base_label_while_alt7.sav [new file with mode: 0644]

index 8ae7c09..9cc40a7 100644 (file)
@@ -24,10 +24,27 @@ class EscapableContext
        # Stack of blocks
        var _stack: Array[EscapableBlock] = new Array[EscapableBlock]
 
+       # Known labels
+       # (all labels, even out of scopes ones)
+       # Used to find duplicates
+       var _labels: Array[ALabel] = new Array[ALabel]
+
        # Push a new escapable block
-       fun push(block: EscapableBlock)
+       # Display error message if tere is a problem with the label
+       fun push(block: EscapableBlock, n_label: nullable ALabel)
        do
                _stack.push(block)
+               if n_label != null then
+                       var lab = n_label.n_id.to_symbol
+                       for nl in _labels do
+                               if n_label != nl and lab == nl.n_id.to_symbol then
+                                       visitor.error(n_label, "Syntax error: label {lab} already defined at {nl.location.relative_to(n_label.location)}.")
+                                       return
+                               end
+                       end
+                       _labels.add(n_label)
+                       block._lab = lab
+               end
        end
 
        # Is there no block in the stack?
@@ -39,6 +56,22 @@ class EscapableContext
                return _stack.last
        end
 
+       # Return the block associed to a label
+       # Output an error end return null if the label is not known
+       fun get_by_label(nl: ALabel): nullable EscapableBlock
+       do
+               var i = _stack.length - 1
+               var block: nullable EscapableBlock = null
+               var lab = nl.n_id.to_symbol
+               while i >= 0 do
+                       var b = _stack[i]
+                       if b.lab == lab then return b
+                       i -= 1
+               end
+               visitor.error(nl, "Syntax error: invalid label {lab}.")
+               return null
+       end
+
        # Remove the last block (the last stacked)
        fun pop
        do
@@ -60,6 +93,10 @@ class EscapableBlock
        # The syntax node of the block
        readable var _node: ANode
 
+       # The label of the block (if any)
+       # Set by the push in EscapableContext
+       readable var _lab: nullable Symbol
+
        # Is self a break closure ?
        fun is_break_block: Bool do return false
 
@@ -100,7 +137,7 @@ end
 ###############################################################################
 
 class AEscapeExpr
-special ANode
+special ALabelable
        # The associated escapable block
        readable var _escapable: nullable EscapableBlock
 
@@ -110,12 +147,16 @@ special ANode
        # Compute, set and return the associated escapable block
        fun compute_escapable_block(lctx: EscapableContext): nullable EscapableBlock
        do
-               var block: EscapableBlock
-               if lctx.is_empty then
+               var block: nullable EscapableBlock
+               var nl = n_label
+               if nl != null then
+                       block = lctx.get_by_label(nl)
+               else if lctx.is_empty then
                        lctx.visitor.error(self, "Syntax Error: '{kwname}' statment outside block.")
                        return null
+               else
+                       block = lctx.head
                end
-               block = lctx.head
                _escapable = block
                return block
        end
index cdb4378..4038123 100644 (file)
@@ -273,7 +273,7 @@ redef class AClosureDecl
 
                var escapable = new EscapableClosure(self, variable.closure, null)
                _escapable = escapable
-               v.escapable_ctx.push(escapable)
+               v.escapable_ctx.push(escapable, null)
 
                super
 
@@ -502,7 +502,7 @@ redef class AWhileExpr
        do
                var escapable = new EscapableBlock(self)
                _escapable = escapable
-               v.escapable_ctx.push(escapable)
+               v.escapable_ctx.push(escapable, n_label)
                var old_var_ctx = v.variable_ctx
                var old_base_var_ctx = v.base_variable_ctx
                v.base_variable_ctx = v.variable_ctx
@@ -539,7 +539,7 @@ redef class AForExpr
        do
                var escapable = new EscapableBlock(self)
                _escapable = escapable
-               v.escapable_ctx.push(escapable)
+               v.escapable_ctx.push(escapable, n_label)
 
                var old_var_ctx = v.variable_ctx
                var old_base_var_ctx = v.base_variable_ctx
@@ -1090,12 +1090,15 @@ redef class AAbsAbsSendExpr
                                var break_list: nullable Array[ABreakExpr] = null
                                if t != null then break_list = new Array[ABreakExpr]
 
+                               # The n_label, is any in only set on the last decl
+                               var n_label = if arity > 0 then cd[arity-1].n_label else null
+
                                # Process each closure definition
                                for i in [0..arity[ do
                                        var csi = cs[i]
                                        var cdi = cd[i]
                                        var esc = new EscapableClosure(cdi, csi, break_list)
-                                       v.escapable_ctx.push(esc)
+                                       v.escapable_ctx.push(esc, n_label)
                                        cdi.accept_typing2(v, esc)
                                        v.escapable_ctx.pop
                                end
diff --git a/tests/base_label_closure.nit b/tests/base_label_closure.nit
new file mode 100644 (file)
index 0000000..20bc3f9
--- /dev/null
@@ -0,0 +1,44 @@
+# 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
+       with bar
+do
+       bar with do 'X'.output
+end
+
+1.output
+foo with do
+       2.output
+       foo with do
+               3.output
+               foo with do end label l3
+               #alt1#break label l2
+               #alt2#break label l3
+               #alt3#break label l4
+               #alt4#break
+               #alt5#continue label l1
+               break label l1
+               4.output
+       end label l2#!alt6#
+       #alt6#end label l1
+       5.output
+end label l1
+6.output
+
+#alt7#foo with do end label l1
diff --git a/tests/base_label_closure2.nit b/tests/base_label_closure2.nit
new file mode 100644 (file)
index 0000000..75f09b3
--- /dev/null
@@ -0,0 +1,52 @@
+# 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
+       with bar: Int
+do
+       var i = bar with do 'X'.output
+       return i * 10
+end
+
+1.output
+var i = foo with do
+       2.output
+       var j = foo with do
+               3.output
+               foo with do
+                       continue 0
+               end label l3
+               #alt1#break label l2 10
+               #alt2#break label l3 10
+               #alt3#break label l4 10
+               #alt4#break 10
+               #alt5#continue label l1 10
+               break label l1 10
+               4.output
+       end label l2#!alt6#
+       #alt6#end label l1
+       j.output
+       5.output
+       continue 20
+end label l1
+i.output
+6.output
+
+#alt7#foo with do
+#alt7# continue 0
+#alt7#end label l1
diff --git a/tests/base_label_closure3.nit b/tests/base_label_closure3.nit
new file mode 100644 (file)
index 0000000..faafed4
--- /dev/null
@@ -0,0 +1,50 @@
+# 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
+       with bar do end
+       with baz do end
+do
+       bar
+       baz
+end
+
+1.output
+foo with do
+       2.output
+       foo with do
+               3.output
+               foo with do end label l3
+               #alt1#break label l2
+               #alt2#break label l3
+               #alt3#break label l4
+               #alt4#break
+               #alt5#continue label l1
+               break label l1
+               4.output
+       with do
+               40.output
+       end label l2#!alt6#
+       #alt6#end label l1
+       5.output
+with do
+       50.output
+end label l1
+6.output
+
+#alt7#foo with do end label l1
diff --git a/tests/base_label_for.nit b/tests/base_label_for.nit
new file mode 100644 (file)
index 0000000..129f463
--- /dev/null
@@ -0,0 +1,39 @@
+# 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 abstract_collection
+
+var a = new Container[Int](1)
+1.output
+for i in a do
+       2.output
+       for j in a do
+               3.output
+               for k in a do end label l3
+               #alt1#break label l2
+               #alt2#break label l3
+               #alt3#break label l4
+               #alt4#break
+               #alt5#continue label l1
+               break label l1
+               4.output
+       end label l2#!alt6#
+       #alt6#end label l1
+       5.output
+end label l1
+6.output
+
+#alt7#for k in a do end label l1
diff --git a/tests/base_label_while.nit b/tests/base_label_while.nit
new file mode 100644 (file)
index 0000000..164c0f4
--- /dev/null
@@ -0,0 +1,41 @@
+# 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
+
+var a = 1
+1.output
+while a == 1 do
+       a = 2
+       2.output
+       while a == 2 do
+               a = 3
+               3.output
+               while false do end label l3
+               #alt1#break label l2
+               #alt2#break label l3
+               #alt3#break label l4
+               #alt4#break
+               #alt5#continue label l1
+               break label l1
+               4.output
+       end label l2#!alt6#
+       #alt6#end label l1
+       5.output
+end label l1
+6.output
+
+#alt7#while false do end label l1
diff --git a/tests/sav/base_label_closure.sav b/tests/sav/base_label_closure.sav
new file mode 100644 (file)
index 0000000..f1d4cb9
--- /dev/null
@@ -0,0 +1,4 @@
+1
+2
+3
+XX6
diff --git a/tests/sav/base_label_closure2.sav b/tests/sav/base_label_closure2.sav
new file mode 100644 (file)
index 0000000..0abb928
--- /dev/null
@@ -0,0 +1,5 @@
+1
+2
+3
+XX10
+6
diff --git a/tests/sav/base_label_closure2_alt1.sav b/tests/sav/base_label_closure2_alt1.sav
new file mode 100644 (file)
index 0000000..cecbc5a
--- /dev/null
@@ -0,0 +1,7 @@
+1
+2
+3
+X10
+5
+200
+6
diff --git a/tests/sav/base_label_closure2_alt2.sav b/tests/sav/base_label_closure2_alt2.sav
new file mode 100644 (file)
index 0000000..aaf9a05
--- /dev/null
@@ -0,0 +1 @@
+alt/base_label_closure2_alt2.nit:35,9--16: Syntax error: invalid label l3.
diff --git a/tests/sav/base_label_closure2_alt3.sav b/tests/sav/base_label_closure2_alt3.sav
new file mode 100644 (file)
index 0000000..0ae681d
--- /dev/null
@@ -0,0 +1 @@
+alt/base_label_closure2_alt3.nit:36,9--16: Syntax error: invalid label l4.
diff --git a/tests/sav/base_label_closure2_alt4.sav b/tests/sav/base_label_closure2_alt4.sav
new file mode 100644 (file)
index 0000000..cecbc5a
--- /dev/null
@@ -0,0 +1,7 @@
+1
+2
+3
+X10
+5
+200
+6
diff --git a/tests/sav/base_label_closure2_alt5.sav b/tests/sav/base_label_closure2_alt5.sav
new file mode 100644 (file)
index 0000000..3f394b5
--- /dev/null
@@ -0,0 +1,5 @@
+1
+2
+3
+X100
+6
diff --git a/tests/sav/base_label_closure2_alt6.sav b/tests/sav/base_label_closure2_alt6.sav
new file mode 100644 (file)
index 0000000..50a7db3
--- /dev/null
@@ -0,0 +1 @@
+alt/base_label_closure2_alt6.nit:41,6--13: Syntax error: label l1 already defined at 45,5--12.
diff --git a/tests/sav/base_label_closure2_alt7.sav b/tests/sav/base_label_closure2_alt7.sav
new file mode 100644 (file)
index 0000000..3a86a1e
--- /dev/null
@@ -0,0 +1 @@
+alt/base_label_closure2_alt7.nit:52,5--12: Syntax error: label l1 already defined at 46,5--12.
diff --git a/tests/sav/base_label_closure3.sav b/tests/sav/base_label_closure3.sav
new file mode 100644 (file)
index 0000000..c65db77
--- /dev/null
@@ -0,0 +1,4 @@
+1
+2
+3
+6
diff --git a/tests/sav/base_label_closure3_alt1.sav b/tests/sav/base_label_closure3_alt1.sav
new file mode 100644 (file)
index 0000000..ecc7eb1
--- /dev/null
@@ -0,0 +1,6 @@
+1
+2
+3
+5
+50
+6
diff --git a/tests/sav/base_label_closure3_alt2.sav b/tests/sav/base_label_closure3_alt2.sav
new file mode 100644 (file)
index 0000000..f8d8654
--- /dev/null
@@ -0,0 +1 @@
+alt/base_label_closure3_alt2.nit:34,9--16: Syntax error: invalid label l3.
diff --git a/tests/sav/base_label_closure3_alt3.sav b/tests/sav/base_label_closure3_alt3.sav
new file mode 100644 (file)
index 0000000..0f140ff
--- /dev/null
@@ -0,0 +1 @@
+alt/base_label_closure3_alt3.nit:35,9--16: Syntax error: invalid label l4.
diff --git a/tests/sav/base_label_closure3_alt4.sav b/tests/sav/base_label_closure3_alt4.sav
new file mode 100644 (file)
index 0000000..ecc7eb1
--- /dev/null
@@ -0,0 +1,6 @@
+1
+2
+3
+5
+50
+6
diff --git a/tests/sav/base_label_closure3_alt5.sav b/tests/sav/base_label_closure3_alt5.sav
new file mode 100644 (file)
index 0000000..caf22b9
--- /dev/null
@@ -0,0 +1,5 @@
+1
+2
+3
+50
+6
diff --git a/tests/sav/base_label_closure3_alt6.sav b/tests/sav/base_label_closure3_alt6.sav
new file mode 100644 (file)
index 0000000..b94eeee
--- /dev/null
@@ -0,0 +1,2 @@
+alt/base_label_closure3_alt6.nit:42,6--13: Syntax error: label l1 already defined at 46,5--12.
+alt/base_label_closure3_alt6.nit:42,6--13: Syntax error: label l1 already defined at 46,5--12.
diff --git a/tests/sav/base_label_closure3_alt7.sav b/tests/sav/base_label_closure3_alt7.sav
new file mode 100644 (file)
index 0000000..ee5bf63
--- /dev/null
@@ -0,0 +1 @@
+alt/base_label_closure3_alt7.nit:50,17--24: Syntax error: label l1 already defined at 47,5--12.
diff --git a/tests/sav/base_label_closure_alt1.sav b/tests/sav/base_label_closure_alt1.sav
new file mode 100644 (file)
index 0000000..d18fd4e
--- /dev/null
@@ -0,0 +1,5 @@
+1
+2
+3
+X5
+6
diff --git a/tests/sav/base_label_closure_alt2.sav b/tests/sav/base_label_closure_alt2.sav
new file mode 100644 (file)
index 0000000..764211d
--- /dev/null
@@ -0,0 +1 @@
+alt/base_label_closure_alt2.nit:32,9--16: Syntax error: invalid label l3.
diff --git a/tests/sav/base_label_closure_alt3.sav b/tests/sav/base_label_closure_alt3.sav
new file mode 100644 (file)
index 0000000..80a5645
--- /dev/null
@@ -0,0 +1 @@
+alt/base_label_closure_alt3.nit:33,9--16: Syntax error: invalid label l4.
diff --git a/tests/sav/base_label_closure_alt4.sav b/tests/sav/base_label_closure_alt4.sav
new file mode 100644 (file)
index 0000000..d18fd4e
--- /dev/null
@@ -0,0 +1,5 @@
+1
+2
+3
+X5
+6
diff --git a/tests/sav/base_label_closure_alt5.sav b/tests/sav/base_label_closure_alt5.sav
new file mode 100644 (file)
index 0000000..9ca0188
--- /dev/null
@@ -0,0 +1,4 @@
+1
+2
+3
+X6
diff --git a/tests/sav/base_label_closure_alt6.sav b/tests/sav/base_label_closure_alt6.sav
new file mode 100644 (file)
index 0000000..48961b5
--- /dev/null
@@ -0,0 +1 @@
+alt/base_label_closure_alt6.nit:38,6--13: Syntax error: label l1 already defined at 40,5--12.
diff --git a/tests/sav/base_label_closure_alt7.sav b/tests/sav/base_label_closure_alt7.sav
new file mode 100644 (file)
index 0000000..45cb516
--- /dev/null
@@ -0,0 +1 @@
+alt/base_label_closure_alt7.nit:44,17--24: Syntax error: label l1 already defined at 41,5--12.
diff --git a/tests/sav/base_label_for.sav b/tests/sav/base_label_for.sav
new file mode 100644 (file)
index 0000000..c65db77
--- /dev/null
@@ -0,0 +1,4 @@
+1
+2
+3
+6
diff --git a/tests/sav/base_label_for_alt1.sav b/tests/sav/base_label_for_alt1.sav
new file mode 100644 (file)
index 0000000..150a5fb
--- /dev/null
@@ -0,0 +1,5 @@
+1
+2
+3
+5
+6
diff --git a/tests/sav/base_label_for_alt2.sav b/tests/sav/base_label_for_alt2.sav
new file mode 100644 (file)
index 0000000..c53076d
--- /dev/null
@@ -0,0 +1 @@
+alt/base_label_for_alt2.nit:27,9--16: Syntax error: invalid label l3.
diff --git a/tests/sav/base_label_for_alt3.sav b/tests/sav/base_label_for_alt3.sav
new file mode 100644 (file)
index 0000000..9f68341
--- /dev/null
@@ -0,0 +1 @@
+alt/base_label_for_alt3.nit:28,9--16: Syntax error: invalid label l4.
diff --git a/tests/sav/base_label_for_alt4.sav b/tests/sav/base_label_for_alt4.sav
new file mode 100644 (file)
index 0000000..150a5fb
--- /dev/null
@@ -0,0 +1,5 @@
+1
+2
+3
+5
+6
diff --git a/tests/sav/base_label_for_alt5.sav b/tests/sav/base_label_for_alt5.sav
new file mode 100644 (file)
index 0000000..c65db77
--- /dev/null
@@ -0,0 +1,4 @@
+1
+2
+3
+6
diff --git a/tests/sav/base_label_for_alt6.sav b/tests/sav/base_label_for_alt6.sav
new file mode 100644 (file)
index 0000000..a9b06dc
--- /dev/null
@@ -0,0 +1 @@
+alt/base_label_for_alt6.nit:33,6--13: Syntax error: label l1 already defined at 35,5--12.
diff --git a/tests/sav/base_label_for_alt7.sav b/tests/sav/base_label_for_alt7.sav
new file mode 100644 (file)
index 0000000..d4eacf2
--- /dev/null
@@ -0,0 +1 @@
+alt/base_label_for_alt7.nit:39,19--26: Syntax error: label l1 already defined at 36,5--12.
diff --git a/tests/sav/base_label_while.sav b/tests/sav/base_label_while.sav
new file mode 100644 (file)
index 0000000..c65db77
--- /dev/null
@@ -0,0 +1,4 @@
+1
+2
+3
+6
diff --git a/tests/sav/base_label_while_alt1.sav b/tests/sav/base_label_while_alt1.sav
new file mode 100644 (file)
index 0000000..150a5fb
--- /dev/null
@@ -0,0 +1,5 @@
+1
+2
+3
+5
+6
diff --git a/tests/sav/base_label_while_alt2.sav b/tests/sav/base_label_while_alt2.sav
new file mode 100644 (file)
index 0000000..1de23c1
--- /dev/null
@@ -0,0 +1 @@
+alt/base_label_while_alt2.nit:29,9--16: Syntax error: invalid label l3.
diff --git a/tests/sav/base_label_while_alt3.sav b/tests/sav/base_label_while_alt3.sav
new file mode 100644 (file)
index 0000000..724490f
--- /dev/null
@@ -0,0 +1 @@
+alt/base_label_while_alt3.nit:30,9--16: Syntax error: invalid label l4.
diff --git a/tests/sav/base_label_while_alt4.sav b/tests/sav/base_label_while_alt4.sav
new file mode 100644 (file)
index 0000000..150a5fb
--- /dev/null
@@ -0,0 +1,5 @@
+1
+2
+3
+5
+6
diff --git a/tests/sav/base_label_while_alt5.sav b/tests/sav/base_label_while_alt5.sav
new file mode 100644 (file)
index 0000000..c65db77
--- /dev/null
@@ -0,0 +1,4 @@
+1
+2
+3
+6
diff --git a/tests/sav/base_label_while_alt6.sav b/tests/sav/base_label_while_alt6.sav
new file mode 100644 (file)
index 0000000..bff5f07
--- /dev/null
@@ -0,0 +1 @@
+alt/base_label_while_alt6.nit:35,6--13: Syntax error: label l1 already defined at 37,5--12.
diff --git a/tests/sav/base_label_while_alt7.sav b/tests/sav/base_label_while_alt7.sav
new file mode 100644 (file)
index 0000000..dea6f91
--- /dev/null
@@ -0,0 +1 @@
+alt/base_label_while_alt7.nit:41,20--27: Syntax error: label l1 already defined at 38,5--12.