Implement STRFMT and more printf-like format specifiers for string interpolation (#646)

Fixes #570
Fixes #178

Use errors for inapplicable format spec flags instead of -Wstring-format
This commit is contained in:
Rangi
2020-12-29 16:53:15 -05:00
committed by GitHub
parent aa27e714d4
commit c0ce1da4c3
16 changed files with 675 additions and 84 deletions

View File

@@ -0,0 +1,15 @@
n equ 300
m equ -42
f equ -123.0456
s equs "hello"
printt "<{ -6d:n}> <{+06u:n}> <{5x:n}> <{#16b:n}>\n"
printt "<{u:m}> <{+3d:m}> <{#016o:m}>\n"
printt "<{f:_PI}> <{06f:f}> <{.10f:f}>\n"
printt "<{#-10s:s}> <{10s:s}>\n"
foo: macro
printt "<{\1}>\n"
endm
foo -6d:n ; space is trimmed