minor improvement for nim pretty
This commit is contained in:
parent
31db3aeade
commit
8925d0e103
4 changed files with 13 additions and 5 deletions
|
|
@ -124,7 +124,7 @@ type
|
||||||
hintLineTooLong, hintXDeclaredButNotUsed, hintConvToBaseNotNeeded,
|
hintLineTooLong, hintXDeclaredButNotUsed, hintConvToBaseNotNeeded,
|
||||||
hintConvFromXtoItselfNotNeeded, hintExprAlwaysX, hintQuitCalled,
|
hintConvFromXtoItselfNotNeeded, hintExprAlwaysX, hintQuitCalled,
|
||||||
hintProcessing, hintCodeBegin, hintCodeEnd, hintConf, hintPath,
|
hintProcessing, hintCodeBegin, hintCodeEnd, hintConf, hintPath,
|
||||||
hintConditionAlwaysTrue, hintPattern,
|
hintConditionAlwaysTrue, hintName, hintPattern,
|
||||||
hintUser
|
hintUser
|
||||||
|
|
||||||
const
|
const
|
||||||
|
|
@ -405,6 +405,7 @@ const
|
||||||
hintConf: "used config file \'$1\' [Conf]",
|
hintConf: "used config file \'$1\' [Conf]",
|
||||||
hintPath: "added path: '$1' [Path]",
|
hintPath: "added path: '$1' [Path]",
|
||||||
hintConditionAlwaysTrue: "condition is always true: '$1' [CondTrue]",
|
hintConditionAlwaysTrue: "condition is always true: '$1' [CondTrue]",
|
||||||
|
hintName: "name should be: '$1' [Name]",
|
||||||
hintPattern: "$1 [Pattern]",
|
hintPattern: "$1 [Pattern]",
|
||||||
hintUser: "$1 [User]"]
|
hintUser: "$1 [User]"]
|
||||||
|
|
||||||
|
|
@ -420,10 +421,10 @@ const
|
||||||
"ProveInit", "ProveField", "ProveIndex", "GcUnsafe", "GcUnsafe2", "Uninit",
|
"ProveInit", "ProveField", "ProveIndex", "GcUnsafe", "GcUnsafe2", "Uninit",
|
||||||
"GcMem", "User"]
|
"GcMem", "User"]
|
||||||
|
|
||||||
HintsToStr*: array[0..15, string] = ["Success", "SuccessX", "LineTooLong",
|
HintsToStr*: array[0..16, string] = ["Success", "SuccessX", "LineTooLong",
|
||||||
"XDeclaredButNotUsed", "ConvToBaseNotNeeded", "ConvFromXtoItselfNotNeeded",
|
"XDeclaredButNotUsed", "ConvToBaseNotNeeded", "ConvFromXtoItselfNotNeeded",
|
||||||
"ExprAlwaysX", "QuitCalled", "Processing", "CodeBegin", "CodeEnd", "Conf",
|
"ExprAlwaysX", "QuitCalled", "Processing", "CodeBegin", "CodeEnd", "Conf",
|
||||||
"Path", "CondTrue", "Pattern",
|
"Path", "CondTrue", "Name", "Pattern",
|
||||||
"User"]
|
"User"]
|
||||||
|
|
||||||
const
|
const
|
||||||
|
|
|
||||||
|
|
@ -90,10 +90,10 @@ proc beautifyName(s: string, k: TSymKind): string =
|
||||||
result.add s[i]
|
result.add s[i]
|
||||||
inc i
|
inc i
|
||||||
|
|
||||||
proc checkStyle*(info: TLineInfo, s: string, k: TSymKind) =
|
proc checkStyle(info: TLineInfo, s: string, k: TSymKind) =
|
||||||
let beau = beautifyName(s, k)
|
let beau = beautifyName(s, k)
|
||||||
if s != beau:
|
if s != beau:
|
||||||
message(info, errGenerated, "name should be: " & beau)
|
message(info, hintName, beau)
|
||||||
|
|
||||||
proc checkDef*(n: PNode; s: PSym) =
|
proc checkDef*(n: PNode; s: PSym) =
|
||||||
# operators stay as they are:
|
# operators stay as they are:
|
||||||
|
|
|
||||||
|
|
@ -192,6 +192,7 @@ proc high*[T](x: T): T {.magic: "High", noSideEffect.}
|
||||||
## returns the highest possible index of an array, a sequence, a string or
|
## returns the highest possible index of an array, a sequence, a string or
|
||||||
## the highest possible value of an ordinal value `x`. As a special
|
## the highest possible value of an ordinal value `x`. As a special
|
||||||
## semantic rule, `x` may also be a type identifier.
|
## semantic rule, `x` may also be a type identifier.
|
||||||
|
## ``high(int)`` is Nim's way of writing `INT_MAX`:idx: or `MAX_INT`:idx:.
|
||||||
|
|
||||||
proc low*[T](x: T): T {.magic: "Low", noSideEffect.}
|
proc low*[T](x: T): T {.magic: "Low", noSideEffect.}
|
||||||
## returns the lowest possible index of an array, a sequence, a string or
|
## returns the lowest possible index of an array, a sequence, a string or
|
||||||
|
|
|
||||||
6
todo.txt
6
todo.txt
|
|
@ -1,3 +1,9 @@
|
||||||
|
version 0.10
|
||||||
|
============
|
||||||
|
|
||||||
|
- Test nim pretty on various babel packages
|
||||||
|
|
||||||
|
|
||||||
version 0.9.6
|
version 0.9.6
|
||||||
=============
|
=============
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue