Added (% as hex) and fixed bug with text interpolation codegen not
adding parens around indexchains.
This commit is contained in:
parent
2305f075b7
commit
2b4196bc20
@ -48,6 +48,14 @@ test:
|
|||||||
test:
|
test:
|
||||||
assume "\n" == (newline)
|
assume "\n" == (newline)
|
||||||
|
|
||||||
|
test:
|
||||||
|
assume (0xDEADBEEF as hex) == "0xDEADBEEF"
|
||||||
|
externally (%num as hex) means:
|
||||||
|
if (%num < 0):
|
||||||
|
return ("-0x%X"::formatted with (- %num))
|
||||||
|
..else:
|
||||||
|
return ("0x%X"::formatted with %num)
|
||||||
|
|
||||||
# Text literals
|
# Text literals
|
||||||
%escapes = {..}
|
%escapes = {..}
|
||||||
nl: "\n", newline: "\n", tab: "\t", bell: "\a", cr: "\r", "carriage return": "\r"
|
nl: "\n", newline: "\n", tab: "\t", bell: "\a", cr: "\r", "carriage return": "\r"
|
||||||
|
@ -392,7 +392,7 @@ tree_to_nomsu = function(tree)
|
|||||||
if type(tree[i + 1]) == 'string' and not match(tree[i + 1], "^[ \n\t,.:;#(){}[%]]") then
|
if type(tree[i + 1]) == 'string' and not match(tree[i + 1], "^[ \n\t,.:;#(){}[%]]") then
|
||||||
interp_nomsu:parenthesize()
|
interp_nomsu:parenthesize()
|
||||||
end
|
end
|
||||||
elseif bit.type == "EscapedNomsu" or bit.type == "Block" then
|
elseif bit.type == "EscapedNomsu" or bit.type == "Block" or bit.type == "IndexChain" then
|
||||||
interp_nomsu:parenthesize()
|
interp_nomsu:parenthesize()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -309,7 +309,7 @@ tree_to_nomsu = (tree)->
|
|||||||
if bit.type == "Var"
|
if bit.type == "Var"
|
||||||
if type(tree[i+1]) == 'string' and not match(tree[i+1], "^[ \n\t,.:;#(){}[%]]")
|
if type(tree[i+1]) == 'string' and not match(tree[i+1], "^[ \n\t,.:;#(){}[%]]")
|
||||||
interp_nomsu\parenthesize!
|
interp_nomsu\parenthesize!
|
||||||
elseif bit.type == "EscapedNomsu" or bit.type == "Block"
|
elseif bit.type == "EscapedNomsu" or bit.type == "Block" or bit.type == "IndexChain"
|
||||||
interp_nomsu\parenthesize!
|
interp_nomsu\parenthesize!
|
||||||
nomsu\append interp_nomsu
|
nomsu\append interp_nomsu
|
||||||
if interp_nomsu\is_multiline!
|
if interp_nomsu\is_multiline!
|
||||||
|
Loading…
Reference in New Issue
Block a user