Make bitwise_expression forwards compatible
Skip syms for tmath Skip more syms Add casting back for cast_expression. Disable cast test on Nim < 1.0.0 Skip more syms for cast expressions on Nim < 1.0.0
This commit is contained in:
parent
aa1086fae3
commit
208098b3eb
3 changed files with 18 additions and 5 deletions
|
|
@ -258,7 +258,7 @@ proc processParenthesizedExpr(exprParser: ExprParser, node: TSNode, typeofNode:
|
||||||
result.add(exprParser.processTSNode(node[i], typeofNode))
|
result.add(exprParser.processTSNode(node[i], typeofNode))
|
||||||
|
|
||||||
proc processCastExpression(exprParser: ExprParser, node: TSNode, typeofNode: var PNode): PNode =
|
proc processCastExpression(exprParser: ExprParser, node: TSNode, typeofNode: var PNode): PNode =
|
||||||
result = nkCall.newTree(
|
result = nkCast.newTree(
|
||||||
exprParser.processTSNode(node[0], typeofNode),
|
exprParser.processTSNode(node[0], typeofNode),
|
||||||
exprParser.processTSNode(node[1], typeofNode)
|
exprParser.processTSNode(node[1], typeofNode)
|
||||||
)
|
)
|
||||||
|
|
@ -455,7 +455,9 @@ proc processTSNode(exprParser: ExprParser, node: TSNode, typeofNode: var PNode):
|
||||||
result = exprParser.processParenthesizedExpr(node, typeofNode)
|
result = exprParser.processParenthesizedExpr(node, typeofNode)
|
||||||
of "sizeof_expression":
|
of "sizeof_expression":
|
||||||
result = exprParser.processSizeofExpression(node, typeofNode)
|
result = exprParser.processSizeofExpression(node, typeofNode)
|
||||||
of "bitwise_expression", "equality_expression":
|
# binary_expression from the new treesitter upgrade should work here
|
||||||
|
# once we upgrade
|
||||||
|
of "bitwise_expression", "equality_expression", "binary_expression":
|
||||||
result = exprParser.processBitwiseExpression(node, typeofNode)
|
result = exprParser.processBitwiseExpression(node, typeofNode)
|
||||||
of "math_expression":
|
of "math_expression":
|
||||||
result = exprParser.processMathExpression(node, typeofNode)
|
result = exprParser.processMathExpression(node, typeofNode)
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,16 @@ import macros, os, sets, strutils
|
||||||
import nimterop/[cimport]
|
import nimterop/[cimport]
|
||||||
|
|
||||||
static:
|
static:
|
||||||
|
# Skip casting on lower nim compilers because
|
||||||
|
# the VM does not support it
|
||||||
|
when (NimMajor, NimMinor, NimPatch) < (1, 0, 0):
|
||||||
|
cSkipSymbol @["CASTEXPR"]
|
||||||
cDebug()
|
cDebug()
|
||||||
|
|
||||||
const
|
const
|
||||||
path = currentSourcePath.parentDir() / "include" / "tast2.h"
|
path = currentSourcePath.parentDir() / "include" / "tast2.h"
|
||||||
|
|
||||||
|
|
||||||
when defined(HEADER):
|
when defined(HEADER):
|
||||||
cDefine("HEADER")
|
cDefine("HEADER")
|
||||||
const
|
const
|
||||||
|
|
@ -118,6 +123,8 @@ assert BINEXPR == 5
|
||||||
assert BOOL == true
|
assert BOOL == true
|
||||||
assert MATHEXPR == -99
|
assert MATHEXPR == -99
|
||||||
assert ANDEXPR == 96
|
assert ANDEXPR == 96
|
||||||
|
|
||||||
|
when (NimMajor, NimMinor, NimPatch) >= (1, 0, 0):
|
||||||
assert CASTEXPR == 34.chr
|
assert CASTEXPR == 34.chr
|
||||||
|
|
||||||
assert TRICKYSTR == "N\x1C\nfoo\x00\'\"\c\v\a\b\e\f\t\\\\?bar"
|
assert TRICKYSTR == "N\x1C\nfoo\x00\'\"\c\v\a\b\e\f\t\\\\?bar"
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,10 @@ when defined(windows):
|
||||||
complex = object
|
complex = object
|
||||||
|
|
||||||
static:
|
static:
|
||||||
|
when (NimMajor, NimMinor, NimPatch) < (1, 0, 0):
|
||||||
|
cSkipSymbol @["mingw_choose_expr", "EXCEPTION_DEFINED", "COMPLEX_DEFINED", "matherr", "HUGE", "FP_ILOGB0", "FP_ILOGBNAN"]
|
||||||
|
else:
|
||||||
|
cSkipSymbol @["mingw_choose_expr", "EXCEPTION_DEFINED", "COMPLEX_DEFINED", "matherr", "HUGE"]
|
||||||
cDebug()
|
cDebug()
|
||||||
cDisableCaching()
|
cDisableCaching()
|
||||||
cAddStdDir()
|
cAddStdDir()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue