Handle numbers fully as lua
This commit is contained in:
parent
3561979ded
commit
4e331712a8
|
@ -5,7 +5,7 @@ namespace Upsilon.BaseTypes.Number
|
||||||
public class NumberLong : Number
|
public class NumberLong : Number
|
||||||
{
|
{
|
||||||
public long Value { get; }
|
public long Value { get; }
|
||||||
protected override bool IsFloat { get; } = true;
|
protected override bool IsFloat { get; } = false;
|
||||||
|
|
||||||
public NumberLong(long val)
|
public NumberLong(long val)
|
||||||
{
|
{
|
||||||
|
|
|
@ -70,9 +70,13 @@ namespace Upsilon.Binder
|
||||||
switch (value)
|
switch (value)
|
||||||
{
|
{
|
||||||
case double d:
|
case double d:
|
||||||
type = Type.Number;
|
type = Type.Number;
|
||||||
outValue = new NumberDouble(d);
|
outValue = new NumberDouble(d);
|
||||||
break;
|
break;
|
||||||
|
case long l:
|
||||||
|
type = Type.Number;
|
||||||
|
outValue = new NumberLong(l);
|
||||||
|
break;
|
||||||
case bool b:
|
case bool b:
|
||||||
type = Type.Boolean;
|
type = Type.Boolean;
|
||||||
outValue = value;
|
outValue = value;
|
||||||
|
|
|
@ -124,8 +124,13 @@ namespace Upsilon.Parser
|
||||||
numStr.Append(Next);
|
numStr.Append(Next);
|
||||||
_position++;
|
_position++;
|
||||||
}
|
}
|
||||||
var i = double.Parse(numStr.ToString());
|
|
||||||
return new SyntaxToken(SyntaxKind.Number, start, numStr.ToString(), i);
|
object o;
|
||||||
|
if (hasDecimalPoint)
|
||||||
|
o = double.Parse(numStr.ToString());
|
||||||
|
else
|
||||||
|
o = long.Parse(numStr.ToString());
|
||||||
|
return new SyntaxToken(SyntaxKind.Number, start, numStr.ToString(), o);
|
||||||
}
|
}
|
||||||
|
|
||||||
private SyntaxToken LexIdentifierOrKeyword()
|
private SyntaxToken LexIdentifierOrKeyword()
|
||||||
|
|
Loading…
Reference in New Issue