Feat: Add Character, String and float literals

This commit is contained in:
Lucàs
2024-07-09 16:57:13 +02:00
parent 2e76ccf9fc
commit 332dd73f15
6 changed files with 32 additions and 40 deletions
+1 -33
View File
@@ -1,33 +1 @@
1 + 1;
4 * 0;
/*
Root(
SequenceStatement(
ExpressionStatement(
BinaryExpression(
Add,
Literal(
Integer(1)
),
Literal(
Integer(1)
)
)
),
ExpressionStatement(
BinaryExpression(
Multiply,
Literal(
Integer(4)
),
Literal(
Integer(0)
)
)
)
)
)
*/
'a';
+3
View File
@@ -7,6 +7,9 @@ let test_pp_expressions () =
( "Should return \"Literal(...)\"",
"Literal(Integer(1))",
Expressions.Literal (Literals.Integer 1) );
( "Should return \"Identifier(...)\"",
"Identifier(\"myVar\")",
Expressions.Identifier "myVar" );
( "Should return \"UnaryExpression(...)\"",
"UnaryExpression(ArithmeticNegation, Literal(Integer(2)))",
Expressions.UnaryExpression