|
@@ -228,8 +228,19 @@ public ref struct Lexer
|
|
|
if (c1 is '0' && c2 is 'x' or 'X') // hex 0x
|
|
if (c1 is '0' && c2 is 'x' or 'X') // hex 0x
|
|
|
{
|
|
{
|
|
|
Advance(1);
|
|
Advance(1);
|
|
|
|
|
+ if (span[offset] is '.') Advance(1);
|
|
|
|
|
+
|
|
|
ReadDigit(ref span, ref offset, out var readCount);
|
|
ReadDigit(ref span, ref offset, out var readCount);
|
|
|
|
|
|
|
|
|
|
+ if (span.Length > offset)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (span[offset] is '.')
|
|
|
|
|
+ {
|
|
|
|
|
+ Advance(1);
|
|
|
|
|
+ ReadDigit(ref span, ref offset, out _);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
if (readCount == 0)
|
|
if (readCount == 0)
|
|
|
{
|
|
{
|
|
|
throw new LuaParseException(ChunkName, this.position, $"error: Illegal hexadecimal number");
|
|
throw new LuaParseException(ChunkName, this.position, $"error: Illegal hexadecimal number");
|
|
@@ -247,6 +258,14 @@ public ref struct Lexer
|
|
|
{
|
|
{
|
|
|
Advance(1);
|
|
Advance(1);
|
|
|
ReadNumber(ref span, ref offset, out _);
|
|
ReadNumber(ref span, ref offset, out _);
|
|
|
|
|
+
|
|
|
|
|
+ if (span.Length > offset && span[offset] is 'e' or 'E')
|
|
|
|
|
+ {
|
|
|
|
|
+ Advance(1);
|
|
|
|
|
+ if (span[offset] is '-' or '+') Advance(1);
|
|
|
|
|
+
|
|
|
|
|
+ ReadNumber(ref span, ref offset, out _);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
else if (c is 'e' or 'E')
|
|
else if (c is 'e' or 'E')
|
|
|
{
|
|
{
|