Markdown code blocks part 4 (#20189)
No logic was added, just 8 more files have been migrated.
This commit is contained in:
parent
8155837cde
commit
713f39083e
9 changed files with 365 additions and 341 deletions
194
doc/idetools.md
194
doc/idetools.md
|
|
@ -10,10 +10,7 @@
|
|||
.. contents::
|
||||
|
||||
|
||||
.. raw:: html
|
||||
<blockquote><p>
|
||||
"yes, I'm the creator" -- Araq, 2013-07-26 19:28:32.
|
||||
</p></blockquote>
|
||||
> "yes, I'm the creator" -- Araq, 2013-07-26 19:28:32.
|
||||
|
||||
Note: this is mostly outdated, see instead `nimsuggest <nimsuggest.html>`_
|
||||
|
||||
|
|
@ -246,11 +243,12 @@ skConst
|
|||
| **Fourth column**: the type of the const value.
|
||||
| **Docstring**: always the empty string.
|
||||
|
||||
.. code-block:: nim
|
||||
const SOME_SEQUENCE = @[1, 2]
|
||||
--> col 2: $MODULE.SOME_SEQUENCE
|
||||
col 3: seq[int]
|
||||
col 7: ""
|
||||
```nim
|
||||
const SOME_SEQUENCE = @[1, 2]
|
||||
--> col 2: $MODULE.SOME_SEQUENCE
|
||||
col 3: seq[int]
|
||||
col 7: ""
|
||||
```
|
||||
|
||||
|
||||
skEnumField
|
||||
|
|
@ -260,11 +258,12 @@ skEnumField
|
|||
| **Fourth column**: enum type grouping other enum fields.
|
||||
| **Docstring**: always the empty string.
|
||||
|
||||
.. code-block:: nim
|
||||
Open(filename, fmWrite)
|
||||
--> col 2: system.FileMode.fmWrite
|
||||
col 3: FileMode
|
||||
col 7: ""
|
||||
```nim
|
||||
Open(filename, fmWrite)
|
||||
--> col 2: system.FileMode.fmWrite
|
||||
col 3: FileMode
|
||||
col 7: ""
|
||||
```
|
||||
|
||||
|
||||
skForVar
|
||||
|
|
@ -274,13 +273,14 @@ skForVar
|
|||
| **Fourth column**: type of the var.
|
||||
| **Docstring**: always the empty string.
|
||||
|
||||
.. code-block:: nim
|
||||
proc looper(filename = "tests.nim") =
|
||||
for letter in filename:
|
||||
echo letter
|
||||
--> col 2: $MODULE.looper.letter
|
||||
col 3: char
|
||||
col 7: ""
|
||||
```nim
|
||||
proc looper(filename = "tests.nim") =
|
||||
for letter in filename:
|
||||
echo letter
|
||||
--> col 2: $MODULE.looper.letter
|
||||
col 3: char
|
||||
col 7: ""
|
||||
```
|
||||
|
||||
|
||||
skIterator, skClosureIterator
|
||||
|
|
@ -295,13 +295,14 @@ posterior instances of the iterator.
|
|||
| **Fourth column**: signature of the iterator including return type.
|
||||
| **Docstring**: docstring if available.
|
||||
|
||||
.. code-block:: nim
|
||||
let
|
||||
text = "some text"
|
||||
letters = toSeq(runes(text))
|
||||
--> col 2: unicode.runes
|
||||
col 3: iterator (string): Rune
|
||||
col 7: "iterates over any unicode character of the string `s`."
|
||||
```nim
|
||||
let
|
||||
text = "some text"
|
||||
letters = toSeq(runes(text))
|
||||
--> col 2: unicode.runes
|
||||
col 3: iterator (string): Rune
|
||||
col 7: "iterates over any unicode character of the string `s`."
|
||||
```
|
||||
|
||||
|
||||
skLabel
|
||||
|
|
@ -311,13 +312,14 @@ skLabel
|
|||
| **Fourth column**: always the empty string.
|
||||
| **Docstring**: always the empty string.
|
||||
|
||||
.. code-block:: nim
|
||||
proc test(text: string) =
|
||||
var found = -1
|
||||
block loops:
|
||||
--> col 2: $MODULE.test.loops
|
||||
col 3: ""
|
||||
col 7: ""
|
||||
```nim
|
||||
proc test(text: string) =
|
||||
var found = -1
|
||||
block loops:
|
||||
--> col 2: $MODULE.test.loops
|
||||
col 3: ""
|
||||
col 7: ""
|
||||
```
|
||||
|
||||
|
||||
skLet
|
||||
|
|
@ -327,12 +329,13 @@ skLet
|
|||
| **Fourth column**: the type of the let variable.
|
||||
| **Docstring**: always the empty string.
|
||||
|
||||
.. code-block:: nim
|
||||
let
|
||||
text = "some text"
|
||||
--> col 2: $MODULE.text
|
||||
col 3: string
|
||||
col 7: ""
|
||||
```nim
|
||||
let
|
||||
text = "some text"
|
||||
--> col 2: $MODULE.text
|
||||
col 3: string
|
||||
col 7: ""
|
||||
```
|
||||
|
||||
|
||||
skMacro
|
||||
|
|
@ -347,12 +350,13 @@ posterior instances of the macro.
|
|||
| **Fourth column**: signature of the macro including return type.
|
||||
| **Docstring**: docstring if available.
|
||||
|
||||
.. code-block:: nim
|
||||
proc testMacro() =
|
||||
expect(EArithmetic):
|
||||
--> col 2: idetools_api.expect
|
||||
col 3: proc (varargs[expr], stmt): stmt
|
||||
col 7: ""
|
||||
```nim
|
||||
proc testMacro() =
|
||||
expect(EArithmetic):
|
||||
--> col 2: idetools_api.expect
|
||||
col 3: proc (varargs[expr], stmt): stmt
|
||||
col 7: ""
|
||||
```
|
||||
|
||||
|
||||
skMethod
|
||||
|
|
@ -384,14 +388,15 @@ This may change in the future.
|
|||
| **Fourth column**: signature of the method including return type.
|
||||
| **Docstring**: docstring if available.
|
||||
|
||||
.. code-block:: nim
|
||||
method eval(e: PExpr): int = quit "to override!"
|
||||
method eval(e: PLiteral): int = e.x
|
||||
method eval(e: PPlusExpr): int = eval(e.a) + eval(e.b)
|
||||
echo eval(newPlus(newPlus(newLit(1), newLit(2)), newLit(4)))
|
||||
--> col 2: $MODULE.eval
|
||||
col 3: proc (PPlusExpr): int
|
||||
col 7: ""
|
||||
```nim
|
||||
method eval(e: PExpr): int = quit "to override!"
|
||||
method eval(e: PLiteral): int = e.x
|
||||
method eval(e: PPlusExpr): int = eval(e.a) + eval(e.b)
|
||||
echo eval(newPlus(newPlus(newLit(1), newLit(2)), newLit(4)))
|
||||
--> col 2: $MODULE.eval
|
||||
col 3: proc (PPlusExpr): int
|
||||
col 7: ""
|
||||
```
|
||||
|
||||
|
||||
skParam
|
||||
|
|
@ -401,12 +406,13 @@ skParam
|
|||
| **Fourth column**: the type of the parameter.
|
||||
| **Docstring**: always the empty string.
|
||||
|
||||
.. code-block:: nim
|
||||
proc reader(filename = "tests.nim") =
|
||||
let text = readFile(filename)
|
||||
--> col 2: $MODULE.reader.filename
|
||||
col 3: string
|
||||
col 7: ""
|
||||
```nim
|
||||
proc reader(filename = "tests.nim") =
|
||||
let text = readFile(filename)
|
||||
--> col 2: $MODULE.reader.filename
|
||||
col 3: string
|
||||
col 7: ""
|
||||
```
|
||||
|
||||
|
||||
skProc
|
||||
|
|
@ -425,15 +431,16 @@ returned by idetools returns also the pragmas for the proc.
|
|||
| **Fourth column**: signature of the proc including return type.
|
||||
| **Docstring**: docstring if available.
|
||||
|
||||
.. code-block:: nim
|
||||
open(filename, fmWrite)
|
||||
--> col 2: system.Open
|
||||
col 3: proc (var File, string, FileMode, int): bool
|
||||
col 7:
|
||||
"Opens a file named `filename` with given `mode`.
|
||||
```nim
|
||||
open(filename, fmWrite)
|
||||
--> col 2: system.Open
|
||||
col 3: proc (var File, string, FileMode, int): bool
|
||||
col 7:
|
||||
"Opens a file named `filename` with given `mode`.
|
||||
|
||||
Default mode is readonly. Returns true iff the file could be opened.
|
||||
This throws no exception if the file could not be opened."
|
||||
Default mode is readonly. Returns true iff the file could be opened.
|
||||
This throws no exception if the file could not be opened."
|
||||
```
|
||||
|
||||
|
||||
skResult
|
||||
|
|
@ -443,12 +450,13 @@ skResult
|
|||
| **Fourth column**: the type of the result.
|
||||
| **Docstring**: always the empty string.
|
||||
|
||||
.. code-block:: nim
|
||||
proc getRandomValue() : int =
|
||||
return 4
|
||||
--> col 2: $MODULE.getRandomValue.result
|
||||
col 3: int
|
||||
col 7: ""
|
||||
```nim
|
||||
proc getRandomValue() : int =
|
||||
return 4
|
||||
--> col 2: $MODULE.getRandomValue.result
|
||||
col 3: int
|
||||
col 7: ""
|
||||
```
|
||||
|
||||
|
||||
skTemplate
|
||||
|
|
@ -463,7 +471,7 @@ posterior instances of the template.
|
|||
| **Fourth column**: signature of the template including return type.
|
||||
| **Docstring**: docstring if available.
|
||||
|
||||
.. code-block:: nim
|
||||
`````nim
|
||||
let
|
||||
text = "some text"
|
||||
letters = toSeq(runes(text))
|
||||
|
|
@ -474,13 +482,15 @@ posterior instances of the template.
|
|||
|
||||
Example:
|
||||
|
||||
.. code-block:: nim
|
||||
```nim
|
||||
let
|
||||
numeric = @[1, 2, 3, 4, 5, 6, 7, 8, 9]
|
||||
odd_numbers = toSeq(filter(numeric) do (x: int) -> bool:
|
||||
if x mod 2 == 1:
|
||||
result = true)
|
||||
assert odd_numbers == @[1, 3, 5, 7, 9]"
|
||||
```
|
||||
`````
|
||||
|
||||
|
||||
skType
|
||||
|
|
@ -490,12 +500,13 @@ skType
|
|||
| **Fourth column**: the type.
|
||||
| **Docstring**: always the empty string.
|
||||
|
||||
.. code-block:: nim
|
||||
proc writeTempFile() =
|
||||
var output: File
|
||||
--> col 2: system.File
|
||||
col 3: File
|
||||
col 7: ""
|
||||
```nim
|
||||
proc writeTempFile() =
|
||||
var output: File
|
||||
--> col 2: system.File
|
||||
col 3: File
|
||||
col 7: ""
|
||||
```
|
||||
|
||||
|
||||
skVar
|
||||
|
|
@ -505,14 +516,15 @@ skVar
|
|||
| **Fourth column**: the type of the var.
|
||||
| **Docstring**: always the empty string.
|
||||
|
||||
.. code-block:: nim
|
||||
proc writeTempFile() =
|
||||
var output: File
|
||||
output.open("/tmp/somefile", fmWrite)
|
||||
output.write("test")
|
||||
--> col 2: $MODULE.writeTempFile.output
|
||||
col 3: File
|
||||
col 7: ""
|
||||
```nim
|
||||
proc writeTempFile() =
|
||||
var output: File
|
||||
output.open("/tmp/somefile", fmWrite)
|
||||
output.write("test")
|
||||
--> col 2: $MODULE.writeTempFile.output
|
||||
col 3: File
|
||||
col 7: ""
|
||||
```
|
||||
|
||||
|
||||
Test suite
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue