Expressions
- Added enum type `NumberLiteralEncoding` mimicking that of D's integer literals encoding variations - Added an instance of `NumberLiteralEncoding` to `NumberLiteral` along with a `getEncoding()` method to fetch said field Parser - Added TODO
This commit is contained in:
parent
9d33b05817
commit
d26435b529
|
@ -1114,6 +1114,7 @@ public final class Parser
|
||||||
if (symbol == SymbolType.NUMBER_LITERAL)
|
if (symbol == SymbolType.NUMBER_LITERAL)
|
||||||
{
|
{
|
||||||
/* TODO: Do number checking here to get correct NUmberLiteral */
|
/* TODO: Do number checking here to get correct NUmberLiteral */
|
||||||
|
// TODO: Insert code here for handling various different encodings
|
||||||
NumberLiteral numberLiteral = new NumberLiteral(getCurrentToken().getToken());
|
NumberLiteral numberLiteral = new NumberLiteral(getCurrentToken().getToken());
|
||||||
|
|
||||||
/* Add expression to stack */
|
/* Add expression to stack */
|
||||||
|
|
|
@ -85,9 +85,18 @@ public class BinaryOperatorExpression : OperatorExpression
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum NumberLiteralEncoding
|
||||||
|
{
|
||||||
|
SIGNED_INTEGER,
|
||||||
|
UNSIGNED_INTEGER,
|
||||||
|
SIGNED_LONG,
|
||||||
|
UNSIGNED_LONG
|
||||||
|
}
|
||||||
|
|
||||||
public class NumberLiteral : Expression
|
public class NumberLiteral : Expression
|
||||||
{
|
{
|
||||||
private string numberLiteral;
|
private string numberLiteral;
|
||||||
|
private NumberLiteralEncoding encoding;
|
||||||
|
|
||||||
/* TODO: Take in info like tyoe */
|
/* TODO: Take in info like tyoe */
|
||||||
this(string numberLiteral)
|
this(string numberLiteral)
|
||||||
|
@ -100,9 +109,14 @@ public class NumberLiteral : Expression
|
||||||
return numberLiteral;
|
return numberLiteral;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public NumberLiteralEncoding getEncoding()
|
||||||
|
{
|
||||||
|
return encoding;
|
||||||
|
}
|
||||||
|
|
||||||
public override string toString()
|
public override string toString()
|
||||||
{
|
{
|
||||||
return "[numberLiteral: "~numberLiteral~"]";
|
return "[numberLiteral: "~numberLiteral~" ("~to!(string)(encoding)~")]";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue