parent
60d71e8029
commit
8f8f715f76
|
@ -66,8 +66,16 @@ proc traversePostfix(postfix: NimNode, typ: NimNode, isDiscriminator: bool,
|
||||||
isCommandOrArgument = false, defaultValue = "",
|
isCommandOrArgument = false, defaultValue = "",
|
||||||
namePragma = ""): ConfFileSection =
|
namePragma = ""): ConfFileSection =
|
||||||
postfix.expectKind nnkPostfix
|
postfix.expectKind nnkPostfix
|
||||||
traverseIdent(postfix[1], typ, isDiscriminator, isCommandOrArgument,
|
|
||||||
defaultValue, namePragma)
|
case postfix[1].kind
|
||||||
|
of nnkIdent:
|
||||||
|
traverseIdent(postfix[1], typ, isDiscriminator, isCommandOrArgument,
|
||||||
|
defaultValue, namePragma)
|
||||||
|
of nnkAccQuoted:
|
||||||
|
traverseIdent(postfix[1][0], typ, isDiscriminator, isCommandOrArgument,
|
||||||
|
defaultValue, namePragma)
|
||||||
|
else:
|
||||||
|
raiseAssert "[Postfix] Unsupported child node:\n" & postfix[1].treeRepr
|
||||||
|
|
||||||
proc shortEnumName(n: NimNode): NimNode =
|
proc shortEnumName(n: NimNode): NimNode =
|
||||||
if n.kind == nnkDotExpr:
|
if n.kind == nnkDotExpr:
|
||||||
|
@ -111,10 +119,14 @@ proc traversePragmaExpr(pragmaExpr: NimNode, typ: NimNode,
|
||||||
pragmaExpr.expectKind nnkPragmaExpr
|
pragmaExpr.expectKind nnkPragmaExpr
|
||||||
let (isCommandOrArgument, defaultValue, namePragma) =
|
let (isCommandOrArgument, defaultValue, namePragma) =
|
||||||
traversePragma(pragmaExpr[1])
|
traversePragma(pragmaExpr[1])
|
||||||
|
|
||||||
case pragmaExpr[0].kind
|
case pragmaExpr[0].kind
|
||||||
of nnkIdent:
|
of nnkIdent:
|
||||||
traverseIdent(pragmaExpr[0], typ, isDiscriminator, isCommandOrArgument,
|
traverseIdent(pragmaExpr[0], typ, isDiscriminator, isCommandOrArgument,
|
||||||
defaultValue, namePragma)
|
defaultValue, namePragma)
|
||||||
|
of nnkAccQuoted:
|
||||||
|
traverseIdent(pragmaExpr[0][0], typ, isDiscriminator, isCommandOrArgument,
|
||||||
|
defaultValue, namePragma)
|
||||||
of nnkPostfix:
|
of nnkPostfix:
|
||||||
traversePostfix(pragmaExpr[0], typ, isDiscriminator, isCommandOrArgument,
|
traversePostfix(pragmaExpr[0], typ, isDiscriminator, isCommandOrArgument,
|
||||||
defaultValue, namePragma)
|
defaultValue, namePragma)
|
||||||
|
@ -130,6 +142,8 @@ proc traverseIdentDefs(identDefs: NimNode, parent: ConfFileSection,
|
||||||
case child.kind
|
case child.kind
|
||||||
of nnkIdent:
|
of nnkIdent:
|
||||||
result.add traverseIdent(child, typ, isDiscriminator)
|
result.add traverseIdent(child, typ, isDiscriminator)
|
||||||
|
of nnkAccQuoted:
|
||||||
|
result.add traverseIdent(child[0], typ, isDiscriminator)
|
||||||
of nnkPostfix:
|
of nnkPostfix:
|
||||||
result.add traversePostfix(child, typ, isDiscriminator)
|
result.add traversePostfix(child, typ, isDiscriminator)
|
||||||
of nnkPragmaExpr:
|
of nnkPragmaExpr:
|
||||||
|
@ -146,7 +160,7 @@ proc traverseOfBranch(ofBranch: NimNode, parent: ConfFileSection): ConfFileSecti
|
||||||
result = ConfFileSection(fieldName: repr(shortEnumName(ofBranch[0])), isCaseBranch: true)
|
result = ConfFileSection(fieldName: repr(shortEnumName(ofBranch[0])), isCaseBranch: true)
|
||||||
for child in ofBranch:
|
for child in ofBranch:
|
||||||
case child.kind:
|
case child.kind:
|
||||||
of nnkIdent, nnkDotExpr:
|
of nnkIdent, nnkDotExpr, nnkAccQuoted:
|
||||||
discard
|
discard
|
||||||
of nnkRecList:
|
of nnkRecList:
|
||||||
result.children.add traverseRecList(child, result)
|
result.children.add traverseRecList(child, result)
|
||||||
|
|
|
@ -27,6 +27,7 @@ type
|
||||||
|
|
||||||
VCStartUpCmd = enum
|
VCStartUpCmd = enum
|
||||||
VCNoCommand
|
VCNoCommand
|
||||||
|
`import`
|
||||||
|
|
||||||
ValidatorKeyPath = TypedInputFile[ValidatorPrivKey, Txt, "privkey"]
|
ValidatorKeyPath = TypedInputFile[ValidatorPrivKey, Txt, "privkey"]
|
||||||
|
|
||||||
|
@ -98,6 +99,24 @@ type
|
||||||
desc: "Delay in seconds between retries after unsuccessful attempts to connect to a beacon node"
|
desc: "Delay in seconds between retries after unsuccessful attempts to connect to a beacon node"
|
||||||
name: "retry-delay" }: int
|
name: "retry-delay" }: int
|
||||||
|
|
||||||
|
of `import`:
|
||||||
|
|
||||||
|
blocksFile* {.
|
||||||
|
argument
|
||||||
|
desc: "Import RLP encoded block(s) from a file, validate, write to database and quit"
|
||||||
|
defaultValue: ""
|
||||||
|
name: "blocks-file" }: InputFile
|
||||||
|
|
||||||
|
`type`* {.
|
||||||
|
desc: "Test nnkAccQuoted of public sub command entry"
|
||||||
|
defaultValue: ""
|
||||||
|
name: "import-type" }: string
|
||||||
|
|
||||||
|
`seq` {.
|
||||||
|
desc: "Test nnkAccQuoted of private sub command entry"
|
||||||
|
defaultValue: ""
|
||||||
|
name: "import-seq" }: string
|
||||||
|
|
||||||
func defaultDataDir(conf: TestConf): string =
|
func defaultDataDir(conf: TestConf): string =
|
||||||
discard
|
discard
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue