Expressions

- Added a second parameter to the constructor for `IntegerLiteral`, this takes in the encoding of type `IntegerLiteralEncoding`

Parser

- Updated the `SymbolType.NUMBER_LITERAL` handling code to handle the new constructor for `IntegerLiteral`
This commit is contained in:
Tristan B. Velloza Kildaire 2023-01-30 19:05:31 +02:00
parent be3b2085ad
commit ecbaa5d4de
2 changed files with 7 additions and 2 deletions

View File

@ -1133,12 +1133,16 @@ public final class Parser
// If floating point literal
if(isFloatLiteral(numberLiteralStr))
{
// TODO: Issue #94, siiliar to below for integers
numberLiteral = new FloatingLiteral(getCurrentToken().getToken());
}
// Else, then an integer literal
else
{
numberLiteral = new IntegerLiteral(getCurrentToken().getToken());
// TODO: Issue #94, we should be checking the range here
// ... along with any explicit encoders and setting it
// ... for now default to SIGNED_INTEGER.
numberLiteral = new IntegerLiteral(getCurrentToken().getToken(), IntegerLiteralEncoding.SIGNED_INTEGER);
}
/* Add expression to stack */

View File

@ -97,9 +97,10 @@ public final class IntegerLiteral : NumberLiteral
{
private IntegerLiteralEncoding encoding;
this(string integerLiteral)
this(string integerLiteral, IntegerLiteralEncoding encoding)
{
super(integerLiteral);
this.encoding = encoding;
}
public IntegerLiteralEncoding getEncoding()