use single backtick (#17100)

This commit is contained in:
flywind
2021-02-19 00:47:21 -06:00
committed by GitHub
parent 35ded02074
commit 9450bf6c08
10 changed files with 81 additions and 81 deletions

View File

@@ -11,7 +11,7 @@
## (`RTTI`:idx:). See the `marshal <marshal.html>`_ module for an example of
## what this module allows you to do.
##
## Note that even though ``Any`` and its operations hide the nasty low level
## Note that even though `Any` and its operations hide the nasty low level
## details from its clients, it remains inherently unsafe! Also, Nim's
## runtime type information will evolve and may eventually be deprecated.
## As an alternative approach to programmatically understanding and
@@ -28,10 +28,10 @@ include "system/hti.nim"
{.pop.}
type
AnyKind* = enum ## what kind of ``any`` it is
AnyKind* = enum ## what kind of `any` it is
akNone = 0, ## invalid any
akBool = 1, ## any represents a ``bool``
akChar = 2, ## any represents a ``char``
akBool = 1, ## any represents a `bool`
akChar = 2, ## any represents a `char`
akEnum = 14, ## any represents an enum
akArray = 16, ## any represents an array
akObject = 17, ## any represents an object
@@ -63,7 +63,7 @@ type
Any* = object ## can represent any nim value; NOTE: the wrapped
## value can be modified with its wrapper! This means
## that ``Any`` keeps a non-traced pointer to its
## that `Any` keeps a non-traced pointer to its
## wrapped value and **must not** live longer than
## its wrapped value.
value: pointer
@@ -134,7 +134,7 @@ proc selectBranch(aa: pointer, n: ptr TNimNode): ptr TNimNode =
if discr <% n.len:
result = n.sons[discr]
if result == nil: result = n.sons[n.len]
# n.sons[n.len] contains the ``else`` part (but may be nil)
# n.sons[n.len] contains the `else` part (but may be nil)
else:
result = n.sons[n.len]
@@ -144,17 +144,17 @@ proc newAny(value: pointer, rawType: PNimType): Any {.inline.} =
when declared(system.VarSlot):
proc toAny*(x: VarSlot): Any {.inline.} =
## Constructs a ``Any`` object from a variable slot ``x``.
## Constructs a `Any` object from a variable slot `x`.
## This captures `x`'s address, so `x` can be modified with its
## ``Any`` wrapper! The client needs to ensure that the wrapper
## `Any` wrapper! The client needs to ensure that the wrapper
## **does not** live longer than `x`!
## This is provided for easier reflection capabilities of a debugger.
result.value = x.address
result.rawType = x.typ
proc toAny*[T](x: var T): Any {.inline.} =
## Constructs a ``Any`` object from `x`. This captures `x`'s address, so
## `x` can be modified with its ``Any`` wrapper! The client needs to ensure
## Constructs a `Any` object from `x`. This captures `x`'s address, so
## `x` can be modified with its `Any` wrapper! The client needs to ensure
## that the wrapper **does not** live longer than `x`!
newAny(addr(x), cast[PNimType](getTypeInfo(x)))
@@ -167,7 +167,7 @@ proc size*(x: Any): int {.inline.} =
result = x.rawType.size
proc baseTypeKind*(x: Any): AnyKind {.inline.} =
## Gets the base type's kind; ``akNone`` is returned if `x` has no base type.
## Gets the base type's kind; `akNone` is returned if `x` has no base type.
if x.rawType.base != nil:
result = AnyKind(ord(x.rawType.base.kind))
@@ -177,7 +177,7 @@ proc baseTypeSize*(x: Any): int {.inline.} =
result = x.rawType.base.size
proc invokeNew*(x: Any) =
## Performs ``new(x)``. `x` needs to represent a ``ref``.
## Performs `new(x)`. `x` needs to represent a `ref`.
assert x.rawType.kind == tyRef
when defined(gcDestructors):
cast[ppointer](x.value)[] = nimNewObj(x.rawType.base.size, x.rawType.base.align)
@@ -186,7 +186,7 @@ proc invokeNew*(x: Any) =
genericAssign(x.value, addr(z), x.rawType)
proc invokeNewSeq*(x: Any, len: int) =
## Performs ``newSeq(x, len)``. `x` needs to represent a ``seq``.
## Performs `newSeq(x, len)`. `x` needs to represent a `seq`.
assert x.rawType.kind == tySequence
when defined(gcDestructors):
var s = cast[ptr NimSeqV2Reimpl](x.value)
@@ -198,7 +198,7 @@ proc invokeNewSeq*(x: Any, len: int) =
genericShallowAssign(x.value, addr(z), x.rawType)
proc extendSeq*(x: Any) =
## Performs ``setLen(x, x.len+1)``. `x` needs to represent a ``seq``.
## Performs `setLen(x, x.len+1)`. `x` needs to represent a `seq`.
assert x.rawType.kind == tySequence
when defined(gcDestructors):
var s = cast[ptr NimSeqV2Reimpl](x.value)
@@ -318,16 +318,16 @@ const
tySequence, tyProc}
proc getPointer*(x: Any): pointer =
## Retrieves the pointer value out of `x`. ``x`` needs to be of kind
## ``akString``, ``akCString``, ``akProc``, ``akRef``, ``akPtr``,
## ``akPointer``, ``akSequence``.
## Retrieves the pointer value out of `x`. `x` needs to be of kind
## `akString`, `akCString`, `akProc`, `akRef`, `akPtr`,
## `akPointer`, `akSequence`.
assert x.rawType.kind in pointerLike
result = cast[ppointer](x.value)[]
proc setPointer*(x: Any, y: pointer) =
## Sets the pointer value of `x`. ``x`` needs to be of kind
## ``akString``, ``akCString``, ``akProc``, ``akRef``, ``akPtr``,
## ``akPointer``, ``akSequence``.
## Sets the pointer value of `x`. `x` needs to be of kind
## `akString`, `akCString`, `akProc`, `akRef`, `akPtr`,
## `akPointer`, `akSequence`.
assert x.rawType.kind in pointerLike
if y != nil and x.rawType.kind != tyPointer:
genericAssign(x.value, y, x.rawType)
@@ -456,7 +456,7 @@ proc getInt64*(x: Any): int64 =
proc getBiggestInt*(x: Any): BiggestInt =
## Retrieves the integer value out of `x`. `x` needs to represent
## some integer, a bool, a char, an enum or a small enough bit set.
## The value might be sign-extended to ``BiggestInt``.
## The value might be sign-extended to `BiggestInt`.
var t = skipRange(x.rawType)
case t.kind
of tyInt: result = BiggestInt(cast[ptr int](x.value)[])
@@ -578,7 +578,7 @@ proc skipRange*(x: Any): Any =
proc getEnumOrdinal*(x: Any, name: string): int =
## Gets the enum field ordinal from `name`. `x` needs to represent an enum
## but is only used to access the type information. In case of an error
## ``low(int)`` is returned.
## `low(int)` is returned.
var typ = skipRange(x.rawType)
assert typ.kind == tyEnum
var n = typ.node
@@ -630,7 +630,7 @@ proc getFloat64*(x: Any): float64 =
proc getBiggestFloat*(x: Any): BiggestFloat =
## Retrieves the float value out of `x`. `x` needs to represent
## some float. The value is extended to ``BiggestFloat``.
## some float. The value is extended to `BiggestFloat`.
case skipRange(x.rawType).kind
of tyFloat: result = BiggestFloat(cast[ptr float](x.value)[])
of tyFloat32: result = BiggestFloat(cast[ptr float32](x.value)[])
@@ -666,7 +666,7 @@ proc getCString*(x: Any): cstring =
result = cast[ptr cstring](x.value)[]
proc assign*(x, y: Any) =
## Copies the value of `y` to `x`. The assignment operator for ``Any``
## Copies the value of `y` to `x`. The assignment operator for `Any`
## does NOT do this; it performs a shallow copy instead!
assert y.rawType == x.rawType
genericAssign(x.value, y.value, y.rawType)

View File

@@ -10,14 +10,14 @@
## This module implements an algorithm to compute the
## `diff`:idx: between two sequences of lines.
##
## A basic example of ``diffInt`` on 2 arrays of integers:
## A basic example of `diffInt` on 2 arrays of integers:
##
## .. code::nim
##
## import experimental/diff
## echo diffInt([0, 1, 2, 3, 4, 5, 6, 7, 8], [-1, 1, 2, 3, 4, 5, 666, 7, 42])
##
## Another short example of ``diffText`` to diff strings:
## Another short example of `diffText` to diff strings:
##
## .. code::nim
##
@@ -59,7 +59,7 @@ type
Smsrd = object
x, y: int
# template to avoid a seq copy. Required until ``sink`` parameters are ready.
# template to avoid a seq copy. Required until `sink` parameters are ready.
template newDiffData(initData: seq[int]; L: int): DiffData =
DiffData(
data: initData,
@@ -71,9 +71,9 @@ proc len(d: DiffData): int {.inline.} = d.data.len
proc diffCodes(aText: string; h: var Table[string, int]): DiffData =
## This function converts all textlines of the text into unique numbers for every unique textline
## so further work can work only with simple numbers.
## ``aText`` the input text
## ``h`` This extern initialized hashtable is used for storing all ever used textlines.
## ``trimSpace`` ignore leading and trailing space characters
## `aText` the input text
## `h` This extern initialized hashtable is used for storing all ever used textlines.
## `trimSpace` ignore leading and trailing space characters
## Returns a array of integers.
var lastUsedCode = h.len
result.data = newSeq[int]()
@@ -108,14 +108,14 @@ proc optimize(data: var DiffData) =
proc sms(dataA: var DiffData; lowerA, upperA: int; dataB: DiffData; lowerB, upperB: int;
downVector, upVector: var openArray[int]): Smsrd =
## This is the algorithm to find the Shortest Middle Snake (sms).
## ``dataA`` sequence A
## ``lowerA`` lower bound of the actual range in dataA
## ``upperA`` upper bound of the actual range in dataA (exclusive)
## ``dataB`` sequence B
## ``lowerB`` lower bound of the actual range in dataB
## ``upperB`` upper bound of the actual range in dataB (exclusive)
## ``downVector`` a vector for the (0,0) to (x,y) search. Passed as a parameter for speed reasons.
## ``upVector`` a vector for the (u,v) to (N,M) search. Passed as a parameter for speed reasons.
## `dataA` sequence A
## `lowerA` lower bound of the actual range in dataA
## `upperA` upper bound of the actual range in dataA (exclusive)
## `dataB` sequence B
## `lowerB` lower bound of the actual range in dataB
## `upperB` upper bound of the actual range in dataB (exclusive)
## `downVector` a vector for the (0,0) to (x,y) search. Passed as a parameter for speed reasons.
## `upVector` a vector for the (u,v) to (N,M) search. Passed as a parameter for speed reasons.
## Returns a MiddleSnakeData record containing x,y and u,v.
let max = dataA.len + dataB.len + 1
@@ -195,14 +195,14 @@ proc lcs(dataA: var DiffData; lowerA, upperA: int; dataB: var DiffData; lowerB,
## algorithm.
## The published algorithm passes recursively parts of the A and B sequences.
## To avoid copying these arrays the lower and upper bounds are passed while the sequences stay constant.
## ``dataA`` sequence A
## ``lowerA`` lower bound of the actual range in dataA
## ``upperA`` upper bound of the actual range in dataA (exclusive)
## ``dataB`` sequence B
## ``lowerB`` lower bound of the actual range in dataB
## ``upperB`` upper bound of the actual range in dataB (exclusive)
## ``downVector`` a vector for the (0,0) to (x,y) search. Passed as a parameter for speed reasons.
## ``upVector`` a vector for the (u,v) to (N,M) search. Passed as a parameter for speed reasons.
## `dataA` sequence A
## `lowerA` lower bound of the actual range in dataA
## `upperA` upper bound of the actual range in dataA (exclusive)
## `dataB` sequence B
## `lowerB` lower bound of the actual range in dataB
## `upperB` upper bound of the actual range in dataB (exclusive)
## `downVector` a vector for the (0,0) to (x,y) search. Passed as a parameter for speed reasons.
## `upVector` a vector for the (u,v) to (N,M) search. Passed as a parameter for speed reasons.
# make mutable copy:
var lowerA = lowerA
@@ -275,9 +275,9 @@ proc createDiffs(dataA, dataB: DiffData): seq[Item] =
proc diffInt*(arrayA, arrayB: openArray[int]): seq[Item] =
## Find the difference in 2 arrays of integers.
##
## ``arrayA`` A-version of the numbers (usually the old one)
## `arrayA` A-version of the numbers (usually the old one)
##
## ``arrayB`` B-version of the numbers (usually the new one)
## `arrayB` B-version of the numbers (usually the new one)
##
## Returns a sequence of Items that describe the differences.
@@ -304,9 +304,9 @@ proc diffText*(textA, textB: string): seq[Item] =
## textlines into a common hashtable so i can find duplicates in there, and generating a
## new number each time a new textline is inserted.
##
## ``textA`` A-version of the text (usually the old one)
## `textA` A-version of the text (usually the old one)
##
## ``textB`` B-version of the text (usually the new one)
## `textB` B-version of the text (usually the new one)
##
## Returns a seq of Items that describe the differences.

View File

@@ -11,7 +11,7 @@
# This file contains the minimum required definitions
# for interacting with the initial Genode environment.
# It is reserved for use only within the standard
# library. See ``componentConstructHook`` in the system
# library. See `componentConstructHook` in the system
# module for accessing the Genode environment after the
# standard library has finished initializating.
#

View File

@@ -16,8 +16,8 @@
## Parameter substitution
## ======================
##
## All ``db_*`` modules support the same form of parameter substitution.
## That is, using the ``?`` (question mark) to signify the place where a
## All `db_*` modules support the same form of parameter substitution.
## That is, using the `?` (question mark) to signify the place where a
## value should be placed. For example:
##
## .. code-block:: Nim
@@ -179,7 +179,7 @@ iterator fastRows*(db: DbConn, query: SqlQuery,
## if you require **ALL** the rows.
##
## Breaking the fastRows() iterator during a loop will cause the next
## database query to raise an [EDb] exception ``Commands out of sync``.
## database query to raise an [EDb] exception `Commands out of sync`.
rawExec(db, query, args)
var sqlres = mysql.useResult(PMySQL db)
if sqlres != nil:

View File

@@ -22,8 +22,8 @@
## Parameter substitution
## ======================
##
## All ``db_*`` modules support the same form of parameter substitution.
## That is, using the ``?`` (question mark) to signify the place where a
## All `db_*` modules support the same form of parameter substitution.
## That is, using the `?` (question mark) to signify the place where a
## value should be placed. For example:
##
## .. code-block:: Nim
@@ -168,7 +168,7 @@ proc dbError*(db: var DbConn) {.
raise e
proc sqlCheck(db: var DbConn, resVal: TSqlSmallInt) {.raises: [DbError]} =
## Wrapper that raises [EDb] if ``resVal`` is neither SQL_SUCCESS or SQL_NO_DATA
## Wrapper that raises [EDb] if `resVal` is neither SQL_SUCCESS or SQL_NO_DATA
if resVal notIn [SQL_SUCCESS, SQL_NO_DATA]: dbError(db)
proc sqlGetDBMS(db: var DbConn): string {.
@@ -195,7 +195,7 @@ proc dbQuote*(s: string): string {.noSideEffect.} =
proc dbFormat(formatstr: SqlQuery, args: varargs[string]): string {.
noSideEffect.} =
## Replace any ``?`` placeholders with `args`,
## Replace any `?` placeholders with `args`,
## and quotes the arguments
result = ""
var a = 0
@@ -498,7 +498,7 @@ proc open*(connection, user, password, database: string): DbConn {.
## Raises `EDb` if the connection could not be established.
##
## Currently the database parameter is ignored,
## but included to match ``open()`` in the other db_xxxxx library modules.
## but included to match `open()` in the other db_xxxxx library modules.
var
val = SQL_OV_ODBC3
resLen = 0

View File

@@ -16,8 +16,8 @@
## Parameter substitution
## ======================
##
## All ``db_*`` modules support the same form of parameter substitution.
## That is, using the ``?`` (question mark) to signify the place where a
## All `db_*` modules support the same form of parameter substitution.
## That is, using the `?` (question mark) to signify the place where a
## value should be placed. For example:
##
## .. code-block:: Nim
@@ -26,9 +26,9 @@
## **Note**: There are two approaches to parameter substitution support by
## this module.
##
## 1. ``SqlQuery`` using ``?, ?, ?, ...`` (same as all the ``db_*`` modules)
## 1. `SqlQuery` using `?, ?, ?, ...` (same as all the `db_*` modules)
##
## 2. ``SqlPrepared`` using ``$1, $2, $3, ...``
## 2. `SqlPrepared` using `$1, $2, $3, ...`
##
## .. code-block:: Nim
## prepare(db, "myExampleInsert",
@@ -184,8 +184,8 @@ proc setupQuery(db: DbConn, stmtName: SqlPrepared,
proc prepare*(db: DbConn; stmtName: string, query: SqlQuery;
nParams: int): SqlPrepared =
## Creates a new ``SqlPrepared`` statement. Parameter substitution is done
## via ``$1``, ``$2``, ``$3``, etc.
## Creates a new `SqlPrepared` statement. Parameter substitution is done
## via `$1`, `$2`, `$3`, etc.
if nParams > 0 and not string(query).contains("$1"):
dbError("parameter substitution expects \"$1\"")
var res = pqprepare(db, stmtName, query.string, int32(nParams), nil)
@@ -488,8 +488,8 @@ proc tryInsertID*(db: DbConn, query: SqlQuery,
tags: [WriteDbEffect].}=
## executes the query (typically "INSERT") and returns the
## generated ID for the row or -1 in case of an error. For Postgre this adds
## ``RETURNING id`` to the query, so it only works if your primary key is
## named ``id``.
## `RETURNING id` to the query, so it only works if your primary key is
## named `id`.
var x = pqgetvalue(setupQuery(db, SqlQuery(string(query) & " RETURNING id"),
args), 0, 0)
if not isNil(x):
@@ -502,8 +502,8 @@ proc insertID*(db: DbConn, query: SqlQuery,
tags: [WriteDbEffect].} =
## executes the query (typically "INSERT") and returns the
## generated ID for the row. For Postgre this adds
## ``RETURNING id`` to the query, so it only works if your primary key is
## named ``id``.
## `RETURNING id` to the query, so it only works if your primary key is
## named `id`.
result = tryInsertID(db, query, args)
if result < 0: dbError(db)

View File

@@ -22,8 +22,8 @@
## Parameter substitution
## ----------------------
##
## All ``db_*`` modules support the same form of parameter substitution.
## That is, using the ``?`` (question mark) to signify the place where a
## All `db_*` modules support the same form of parameter substitution.
## That is, using the `?` (question mark) to signify the place where a
## value should be placed. For example:
##
## .. code-block:: Nim
@@ -149,7 +149,7 @@
## Note
## ====
## This module does not implement any ORM features such as mapping the types from the schema.
## Instead, a ``seq[string]`` is returned for each row.
## Instead, a `seq[string]` is returned for each row.
##
## The reasoning is as follows:
## 1. it's close to what many DBs offer natively (char**)
@@ -221,7 +221,7 @@ proc dbFormat(formatstr: SqlQuery, args: varargs[string]): string =
add(result, c)
proc prepare*(db: DbConn; q: string): SqlPrepared {.since: (1, 3).} =
## Creates a new ``SqlPrepared`` statement.
## Creates a new `SqlPrepared` statement.
if prepare_v2(db, q, q.len.cint,result.PStmt, nil) != SQLITE_OK:
discard finalize(result.PStmt)
dbError(db)
@@ -310,8 +310,8 @@ iterator fastRows*(db: DbConn, query: SqlQuery,
## if you require **ALL** the rows.
##
## **Note:** Breaking the `fastRows()` iterator during a loop will cause the
## next database query to raise a `DbError` exception ``unable to close due
## to ...``.
## next database query to raise a `DbError` exception `unable to close due
## to ...`.
##
## **Examples:**
##
@@ -674,8 +674,8 @@ proc insertID*(db: DbConn, query: SqlQuery,
## generated ID for the row.
##
## Raises a `DbError` exception when failed to insert row.
## For Postgre this adds ``RETURNING id`` to the query, so it only works
## if your primary key is named ``id``.
## For Postgre this adds `RETURNING id` to the query, so it only works
## if your primary key is named `id`.
##
## **Examples:**
##
@@ -755,7 +755,7 @@ proc open*(connection, user, password, database: string): DbConn {.
## Opens a database connection. Raises a `DbError` exception if the connection
## could not be established.
##
## **Note:** Only the ``connection`` parameter is used for ``sqlite``.
## **Note:** Only the `connection` parameter is used for `sqlite`.
##
## **Examples:**
##

View File

@@ -20,7 +20,7 @@ batchable: false
# by storing them on the heap. For procs, we produce on the fly simple
# trampolines that can be dynamically overwritten to jump to a different
# target. In the host program, all globals and procs are first registered
# here with ``hcrRegisterGlobal`` and ``hcrRegisterProc`` and then the
# here with `hcrRegisterGlobal` and `hcrRegisterProc` and then the
# returned permanent locations are used in every reference to these symbols
# onwards.
#

View File

@@ -12,7 +12,7 @@ batchable: false
#
## Main file to generate a DLL from the standard library.
## The default Nimrtl does not only contain the ``system`` module, but these
## The default Nimrtl does not only contain the `system` module, but these
## too:
##
## * parseutils

View File

@@ -33,7 +33,7 @@ type
lineNumber*: int ## the current line number
sentinel: int
lineStart: int # index of last line start in buffer
offsetBase*: int # use ``offsetBase + bufpos`` to get the offset
offsetBase*: int # use `offsetBase + bufpos` to get the offset
refillChars: set[char]
proc close*(L: var BaseLexer) =