mirror of
https://github.com/LucasVbr/croissant.git
synced 2026-05-13 17:12:10 +00:00
feat: Add Assign
This commit is contained in:
@@ -25,6 +25,7 @@ let string_of_binary_operator = function
|
|||||||
| LessThanEquals -> "LessThanEquals"
|
| LessThanEquals -> "LessThanEquals"
|
||||||
| GreaterThan -> "GreaterThan"
|
| GreaterThan -> "GreaterThan"
|
||||||
| GreaterThanEquals -> "GreaterThanEquals"
|
| GreaterThanEquals -> "GreaterThanEquals"
|
||||||
|
| Assign -> "Assign"
|
||||||
|
|
||||||
(** [string_of_unary_operator op] returns a string representation of the unary operator [op]. *)
|
(** [string_of_unary_operator op] returns a string representation of the unary operator [op]. *)
|
||||||
let string_of_unary_operator = function Negate -> "Negate" | Not -> "Not"
|
let string_of_unary_operator = function Negate -> "Negate" | Not -> "Not"
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ type binary_operator =
|
|||||||
| LessThanEquals
|
| LessThanEquals
|
||||||
| GreaterThan
|
| GreaterThan
|
||||||
| GreaterThanEquals
|
| GreaterThanEquals
|
||||||
|
| Assign
|
||||||
|
|
||||||
type unary_operator = Negate | Not
|
type unary_operator = Negate | Not
|
||||||
|
|
||||||
|
|||||||
@@ -114,3 +114,4 @@ binary_expression:
|
|||||||
| e1=expression "<=" e2=expression { BinaryExpression(LessThanEquals, e1, e2) }
|
| e1=expression "<=" e2=expression { BinaryExpression(LessThanEquals, e1, e2) }
|
||||||
| e1=expression ">" e2=expression { BinaryExpression(GreaterThan, e1, e2) }
|
| e1=expression ">" e2=expression { BinaryExpression(GreaterThan, e1, e2) }
|
||||||
| e1=expression ">=" e2=expression { BinaryExpression(GreaterThanEquals, e1, e2) }
|
| e1=expression ">=" e2=expression { BinaryExpression(GreaterThanEquals, e1, e2) }
|
||||||
|
| e1=expression "=" e2=expression { BinaryExpression(Assign, e1, e2) }
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ let test_string_of_binary_operator () =
|
|||||||
("<=", "LessThanEquals", LessThanEquals);
|
("<=", "LessThanEquals", LessThanEquals);
|
||||||
(">", "GreaterThan", GreaterThan);
|
(">", "GreaterThan", GreaterThan);
|
||||||
(">=", "GreaterThanEquals", GreaterThanEquals);
|
(">=", "GreaterThanEquals", GreaterThanEquals);
|
||||||
|
("=", "Assign", Assign);
|
||||||
]
|
]
|
||||||
in
|
in
|
||||||
List.iter
|
List.iter
|
||||||
|
|||||||
Reference in New Issue
Block a user