=> supports pragmas & names (+ changed behavior) (#14200)
* => supports pragmas & names (+ changed behavior) (x, y: int) is now parsed as (x: int, y: int) instead of (x: auto, y: int) inside => and ->. * fix pragma check * fixes, use since & LHS of -> supports pragmas
This commit is contained in:
parent
b56432bd8a
commit
3e060cfb0a
6 changed files with 96 additions and 55 deletions
|
|
@ -64,7 +64,7 @@ proc getIdent(e: NimNode): string {.compileTime.} =
|
|||
result = getIdent(e[0])
|
||||
for i in 1 .. e.len-1:
|
||||
result.add getIdent(e[i])
|
||||
else: error("cannot extract identifier from node: " & toStrLit(e).strVal)
|
||||
else: error("cannot extract identifier from node: " & toStrLit(e).strVal, e)
|
||||
|
||||
proc delete[T](s: var seq[T], attr: T): bool =
|
||||
var idx = find(s, attr)
|
||||
|
|
@ -96,14 +96,14 @@ proc xmlCheckedTag*(argsList: NimNode, tag: string, optAttr = "", reqAttr = "",
|
|||
result.add(argsList[i][1])
|
||||
result.add(newStrLitNode("\""))
|
||||
else:
|
||||
error("invalid attribute for '" & tag & "' element: " & name)
|
||||
error("invalid attribute for '" & tag & "' element: " & name, argsList[i])
|
||||
# check each required attribute exists:
|
||||
if req.len > 0:
|
||||
error(req[0] & " attribute for '" & tag & "' element expected")
|
||||
error(req[0] & " attribute for '" & tag & "' element expected", argsList)
|
||||
if isLeaf:
|
||||
for i in 0 ..< argsList.len:
|
||||
if argsList[i].kind != nnkExprEqExpr:
|
||||
error("element " & tag & " cannot be nested")
|
||||
error("element " & tag & " cannot be nested", argsList[i])
|
||||
result.add(newStrLitNode(" />"))
|
||||
else:
|
||||
result.add(newStrLitNode(">"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue