Fix comments breaking code
This commit is contained in:
parent
eaecf9ebdf
commit
c55e77e547
3 changed files with 14 additions and 5 deletions
|
|
@ -486,9 +486,17 @@ proc processTSNode(gState: State, node: TSNode, typeofNode: var PNode): PNode =
|
||||||
if node.len == 1:
|
if node.len == 1:
|
||||||
result = gState.processTSNode(node[0], typeofNode)
|
result = gState.processTSNode(node[0], typeofNode)
|
||||||
elif node.len > 1:
|
elif node.len > 1:
|
||||||
result = newNode(nkStmtListExpr)
|
let res = newNode(nkStmtListExpr)
|
||||||
for i in 0 ..< node.len:
|
for i in 0 ..< node.len:
|
||||||
result.add gState.processTSNode(node[i], typeofNode)
|
let node = gState.processTSNode(node[i], typeofNode)
|
||||||
|
if node.kind != nkNone:
|
||||||
|
res.add node
|
||||||
|
if res.len == 1:
|
||||||
|
result = res[0]
|
||||||
|
elif res.len > 1:
|
||||||
|
result = res
|
||||||
|
else:
|
||||||
|
result = newNode(nkNone)
|
||||||
else:
|
else:
|
||||||
raise newException(ExprParseError, &"Node type \"{nodeName}\" has no children")
|
raise newException(ExprParseError, &"Node type \"{nodeName}\" has no children")
|
||||||
of "parenthesized_expression":
|
of "parenthesized_expression":
|
||||||
|
|
@ -543,6 +551,8 @@ proc processTSNode(gState: State, node: TSNode, typeofNode: var PNode): PNode =
|
||||||
result = gState.getExprIdent(node, parent=node.getName())
|
result = gState.getExprIdent(node, parent=node.getName())
|
||||||
if result.kind == nkNone:
|
if result.kind == nkNone:
|
||||||
raise newException(ExprParseError, &"Missing identifier \"{node.val}\"")
|
raise newException(ExprParseError, &"Missing identifier \"{node.val}\"")
|
||||||
|
of "comment":
|
||||||
|
discard
|
||||||
else:
|
else:
|
||||||
raise newException(ExprParseError, &"Unsupported node type \"{nodeName}\" for node \"{node.val}\"")
|
raise newException(ExprParseError, &"Unsupported node type \"{nodeName}\" for node \"{node.val}\"")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,8 @@ extern "C" {
|
||||||
|
|
||||||
#define SIZEOF sizeof(char)
|
#define SIZEOF sizeof(char)
|
||||||
|
|
||||||
#define NULLCHAR '\0'
|
#define NULLCHAR '\0'/* comments should not break things*/
|
||||||
#define OCTCHAR '\012'
|
#define OCTCHAR '\012' // nor should this comment
|
||||||
#define HEXCHAR '\xFE'
|
#define HEXCHAR '\xFE'
|
||||||
#define TRICKYSTR "\x4E\034\nfoo\0\'\"\r\v\a\b\e\f\t\\\?bar"
|
#define TRICKYSTR "\x4E\034\nfoo\0\'\"\r\v\a\b\e\f\t\\\?bar"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ const
|
||||||
pcreH = baseDir/"pcre.h.in"
|
pcreH = baseDir/"pcre.h.in"
|
||||||
|
|
||||||
static:
|
static:
|
||||||
cSkipSymbol @["PCRE_UCHAR16", "PCRE_UCHAR32"]
|
|
||||||
if not pcreH.fileExists():
|
if not pcreH.fileExists():
|
||||||
downloadUrl("https://github.com/svn2github/pcre/raw/master/pcre.h.in", baseDir)
|
downloadUrl("https://github.com/svn2github/pcre/raw/master/pcre.h.in", baseDir)
|
||||||
cDebug()
|
cDebug()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue