From 13ba6740870d99749f0341b5a38e1e9213162647 Mon Sep 17 00:00:00 2001 From: SoniEx2 Date: Wed, 19 Jun 2024 23:44:42 -0300 Subject: Tokenize numbers as strings "Fixes" Lua 5.2 support, but makes certain number formats non-portable, for example hex floats will not work before Lua 5.3. --- test/testp.lua | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'test') diff --git a/test/testp.lua b/test/testp.lua index 1ab5304..7c4bf48 100644 --- a/test/testp.lua +++ b/test/testp.lua @@ -423,30 +423,30 @@ do -- numbers else -- integers assert(table.remove(state, 1) == luatokens.tokens.TK_INT) - assert(table.remove(state, 1) == 3) + assert(table.remove(state, 1) == "3") assert(table.remove(state, 1) == luatokens.tokens.TK_INT) - assert(table.remove(state, 1) == 345) + assert(table.remove(state, 1) == "345") assert(table.remove(state, 1) == luatokens.tokens.TK_INT) - assert(table.remove(state, 1) == 0xff) + assert(table.remove(state, 1) == "0xff") assert(table.remove(state, 1) == luatokens.tokens.TK_INT) - assert(table.remove(state, 1) == 0xBEBADA) + assert(table.remove(state, 1) == "0xBEBADA") -- floats assert(table.remove(state, 1) == luatokens.tokens.TK_FLT) - assert(table.remove(state, 1) == 3.0) + assert(table.remove(state, 1) == "3.0") assert(table.remove(state, 1) == luatokens.tokens.TK_FLT) - assert(table.remove(state, 1) == 3.1416) + assert(table.remove(state, 1) == "3.1416") assert(table.remove(state, 1) == luatokens.tokens.TK_FLT) - assert(table.remove(state, 1) == 314.16e-2) + assert(table.remove(state, 1) == "314.16e-2") assert(table.remove(state, 1) == luatokens.tokens.TK_FLT) - assert(table.remove(state, 1) == 0.31416E1) + assert(table.remove(state, 1) == "0.31416E1") assert(table.remove(state, 1) == luatokens.tokens.TK_FLT) - assert(table.remove(state, 1) == 34e1) + assert(table.remove(state, 1) == "34e1") assert(table.remove(state, 1) == luatokens.tokens.TK_FLT) - assert(table.remove(state, 1) == 0.1171875) + assert(table.remove(state, 1) == "0x0.1E") assert(table.remove(state, 1) == luatokens.tokens.TK_FLT) - assert(table.remove(state, 1) == 162.1875) + assert(table.remove(state, 1) == "0xA23p-4") assert(table.remove(state, 1) == luatokens.tokens.TK_FLT) - assert(table.remove(state, 1) == math.pi) + assert(table.remove(state, 1) == "0X1.921FB54442D18P+1") assert(table.remove(state, 1) == nil) assert(state.line == 3) end -- cgit 1.4.1