@@ -122,7 +122,7 @@ setmetatable(_G, {__newindex=function(_G, k, v)
122122end}) 
123123--]] 
124124
125- local  VERSION  =  " 1.11.2 " 
125+ local  VERSION  =  " 1.12.0 " 
126126
127127local  MAX_DUPLICATE_FILE_INSERTS  =  1000  --  @Incomplete: Make this a parameter for processFile()/processString().
128128
@@ -252,7 +252,7 @@ function printTraceback(message, level)
252252	print (message )
253253	print (" stack traceback:"  )
254254
255- 	for  level  =  1 + (level  or  1 ), math.huge  do 
255+ 	for  level  =  1 + (level  or  1 ), 1 / 0  do 
256256		local  info  =  debug.getinfo (level , " nSl"  )
257257		if  not  info  then   break   end 
258258
@@ -799,9 +799,9 @@ function serialize(buffer, v)
799799
800800		table.insert (buffer , ' "' .. s .. ' "'  )
801801
802- 	elseif  v  ==  math.huge  then 
802+ 	elseif  v  ==  1 / 0  then 
803803		table.insert (buffer , " (1/0)"  )
804- 	elseif  v  ==  - math.huge  then 
804+ 	elseif  v  ==  - 1 / 0  then 
805805		table.insert (buffer , " (-1/0)"  )
806806	elseif  v  ~=  v  then 
807807		table.insert (buffer , " (0/0)"  ) --  NaN.
@@ -956,8 +956,8 @@ function getNextUsableToken(tokens, i, iLimit, dir)
956956
957957	iLimit 
958958		=    dir  <  0 
959- 		and  math.max ((iLimit  or  1 ), 1 )
960- 		or   math.min ((iLimit  or  math.huge ), # tokens )
959+ 		and  math.max ((iLimit  or  1    ), 1 )
960+ 		or   math.min ((iLimit  or  1 / 0 ), # tokens )
961961
962962	for  i  =  i , iLimit , dir  do 
963963		if  not  USELESS_TOKENS [tokens [i ].type ] then 
@@ -1275,11 +1275,16 @@ end
12751275-- 
12761276--  Number formats:
12771277--    "integer"      E.g. 42
1278+ --    "int"          Same as integer, e.g. 42
12781279--    "float"        E.g. 3.14
12791280--    "scientific"   E.g. 0.7e+12
12801281--    "SCIENTIFIC"   E.g. 0.7E+12 (upper case)
1282+ --    "e"            Same as scientific, e.g. 0.7e+12
1283+ --    "E"            Same as SCIENTIFIC, e.g. 0.7E+12 (upper case)
12811284--    "hexadecimal"  E.g. 0x19af
12821285--    "HEXADECIMAL"  E.g. 0x19AF (upper case)
1286+ --    "hex"          Same as hexadecimal, e.g. 0x19af
1287+ --    "HEX"          Same as HEXADECIMAL, e.g. 0x19AF (upper case)
12831288--    "auto"         Note: Infinite numbers and NaN always get automatic format.
12841289-- 
12851290function  metaFuncs .newToken (tokType , ...)
@@ -1335,15 +1340,20 @@ function metaFuncs.newToken(tokType, ...)
13351340		--  @Incomplete: Hexadecimal floats.
13361341		local  numStr 
13371342			=   n             ~=  n              and  " (0/0)" 
1338- 			or  n             ==  math.huge      and  " (1/0)" 
1339- 			or  n             ==  - math.huge     and  " (-1/0)" 
1343+ 			or  n             ==  1 / 0             and  " (1/0)" 
1344+ 			or  n             ==  - 1 / 0            and  " (-1/0)" 
13401345			or  numberFormat  ==  " auto"         and  tostring (n )
13411346			or  numberFormat  ==  " integer"      and  F (" %d"  , n )
1347+ 			or  numberFormat  ==  " int"          and  F (" %d"  , n )
13421348			or  numberFormat  ==  " float"        and  F (" %f"  , n ):gsub (" (%d)0+$"  , " %1"  )
13431349			or  numberFormat  ==  " scientific"   and  F (" %e"  , n ):gsub (" (%d)0+e"  , " %1e"  ):gsub (" 0+(%d+)$"  , " %1"  )
13441350			or  numberFormat  ==  " SCIENTIFIC"   and  F (" %E"  , n ):gsub (" (%d)0+E"  , " %1E"  ):gsub (" 0+(%d+)$"  , " %1"  )
1351+ 			or  numberFormat  ==  " e"            and  F (" %e"  , n ):gsub (" (%d)0+e"  , " %1e"  ):gsub (" 0+(%d+)$"  , " %1"  )
1352+ 			or  numberFormat  ==  " E"            and  F (" %E"  , n ):gsub (" (%d)0+E"  , " %1E"  ):gsub (" 0+(%d+)$"  , " %1"  )
13451353			or  numberFormat  ==  " hexadecimal"  and  (n  ==  math.floor (n ) and  F (" 0x%x"  , n ) or  error (" Hexadecimal floats not supported yet."  ))
13461354			or  numberFormat  ==  " HEXADECIMAL"  and  (n  ==  math.floor (n ) and  F (" 0x%X"  , n ) or  error (" Hexadecimal floats not supported yet."  ))
1355+ 			or  numberFormat  ==  " hex"          and  (n  ==  math.floor (n ) and  F (" 0x%x"  , n ) or  error (" Hexadecimal floats not supported yet."  ))
1356+ 			or  numberFormat  ==  " HEX"          and  (n  ==  math.floor (n ) and  F (" 0x%X"  , n ) or  error (" Hexadecimal floats not supported yet."  ))
13471357			or  error (F (" Invalid number format '%s'."  , numberFormat ))
13481358
13491359		return  {type = " number"  , representation = numStr , value = n }
0 commit comments