From 5f38d73004f0fcf259acfa12d46feff4c6170273 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 11 Nov 2018 15:25:25 -0800 Subject: Now preserving hex numbers with "0xF00" -> parse -> decompile -> "0xF00", fix for (compile error at ...) --- nomsu.4.peg | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'nomsu.4.peg') diff --git a/nomsu.4.peg b/nomsu.4.peg index e7fc09a..b2e636f 100644 --- a/nomsu.4.peg +++ b/nomsu.4.peg @@ -173,7 +173,9 @@ indented_plain_text (Text): text_interpolation: inline_text_interpolation / ("\" indented_expression (blank_lines =curr_indent "..")?) -number (Number): (("-"? (([0-9]+ "." [0-9]+) / ("." [0-9]+) / "0x" [0-9a-fA-F]+ / ([0-9]+)))-> tonumber) +number (Number): + (&("-"? "0x" [0-9a-fA-F]+) {:hex: '' -> 'yes' :})? + (("-"? (([0-9]+ "." [0-9]+) / ("." [0-9]+) / "0x" [0-9a-fA-F]+ / ([0-9]+)))-> tonumber) -- Variables can be nameless (i.e. just %) and can only contain identifier chars. -- This ensures you don't get weird parsings of `%x+%y` or `%'s thing`. -- cgit v1.2.3