From 2b4196bc2027096f070c07fb279cf18d5fb20ee5 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 11 Nov 2018 18:52:45 -0800 Subject: Added (% as hex) and fixed bug with text interpolation codegen not adding parens around indexchains. --- core/text.nom | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'core/text.nom') diff --git a/core/text.nom b/core/text.nom index 86d8d45..50a0ab5 100644 --- a/core/text.nom +++ b/core/text.nom @@ -48,6 +48,14 @@ test: test: 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 %escapes = {..} nl: "\n", newline: "\n", tab: "\t", bell: "\a", cr: "\r", "carriage return": "\r" -- cgit v1.2.3