diff --git a/doc/idetools.txt b/doc/idetools.txt index 59e2ee49e3..4d2315a0c7 100644 --- a/doc/idetools.txt +++ b/doc/idetools.txt @@ -295,6 +295,22 @@ posterior instances of the iterator. col 7: "iterates over any unicode character of the string `s`." +skLabel +------- + +| **Third column**: module + [n scope nesting] + name. +| **Fourth column**: always the empty string. +| **Docstring**: always the empty string. + +.. code-block:: nimrod + proc test(text: string) = + var found = -1 + block loops: + --> col 2: $MODULE.test.loops + col 3: "" + col 7: "" + + skLet ----- diff --git a/tests/caas/idetools_api.nim b/tests/caas/idetools_api.nim index 6327f4c227..351ec05830 100644 --- a/tests/caas/idetools_api.nim +++ b/tests/caas/idetools_api.nim @@ -41,3 +41,15 @@ proc newLit(x: int): PLiteral = PLiteral(x: x) proc newPlus(a, b: PExpr): PPlusExpr = PPlusExpr(a: a, b: b) echo eval(newPlus(newPlus(newLit(1), newLit(2)), newLit(4))) + +proc findVowelPosition(text: string) = + var found = -1 + block loops: + for i, letter in pairs(text): + for j in ['a', 'e', 'i', 'o', 'u']: + if letter == j: + found = i + break loops # leave both for-loops + echo found + +findVowelPosition("Zerg") # should output 1, position of vowel. diff --git a/tests/caas/idetools_api.txt b/tests/caas/idetools_api.txt index c4c22399e8..f4a2ee69e4 100644 --- a/tests/caas/idetools_api.txt +++ b/tests/caas/idetools_api.txt @@ -42,3 +42,9 @@ def\tskField\t$MODULE.TPerson.name\tbad_string\t > idetools --track:$TESTNIM,43,7 --def $SILENT def\tskMethod\t$MODULE.eval\tproc \(PPlusExpr\): int\t + +> idetools --track:$TESTNIM,47,8 --def $SILENT +def\tskLabel\t$MODULE.findVowelPosition.loops\t\t +# For some reason the use of the label with break displaces its position. +> idetools --track:$TESTNIM,52,16 --def $SILENT +def\tskLabel\t$MODULE.findVowelPosition.loops\t\t