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 long Value { get; }
|
||||
protected override bool IsFloat { get; } = true;
|
||||
protected override bool IsFloat { get; } = false;
|
||||
|
||||
public NumberLong(long val)
|
||||
{
|
||||
|
|
|
@ -73,6 +73,10 @@ namespace Upsilon.Binder
|
|||
type = Type.Number;
|
||||
outValue = new NumberDouble(d);
|
||||
break;
|
||||
case long l:
|
||||
type = Type.Number;
|
||||
outValue = new NumberLong(l);
|
||||
break;
|
||||
case bool b:
|
||||
type = Type.Boolean;
|
||||
outValue = value;
|
||||
|
|
|
@ -124,8 +124,13 @@ namespace Upsilon.Parser
|
|||
numStr.Append(Next);
|
||||
_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()
|
||||
|
|
Loading…
Reference in New Issue