Repository: CrossGL/crosstl

Issue:
Add Parsing for `Assignment Shift Right`  Token
Update the parser to handle the ASSIGN_SHIFT_RIGHT token, allowing it to correctly parse expressions involving the >>= operator.

Discussion:
@samthakur587: @anshikavashistha  working on this 

Solution patch:
diff --git a/crosstl/src/translator/parser.py b/crosstl/src/translator/parser.py
index a46a9d2f..d07c84ed 100644
--- a/crosstl/src/translator/parser.py
+++ b/crosstl/src/translator/parser.py
@@ -644,6 +644,7 @@ def parse_assignment_or_function_call(self, update_condition=False):
             "ASSIGN_MOD",
             "BITWISE_SHIFT_RIGHT",
             "BITWISE_SHIFT_LEFT",
+            "ASSIGN_SHIFT_RIGHT",
         ]:
             return self.parse_assignment(name)
         elif self.current_token[0] == "INCREMENT":
@@ -704,6 +705,7 @@ def parse_variable_declaration(self, type_name, update_condition=False):
             "ASSIGN_MOD",
             "BITWISE_SHIFT_RIGHT",
             "BITWISE_SHIFT_LEFT",
+            "ASSIGN_SHIFT_RIGHT",
         ]:
             op = self.current_token[1]
             self.eat(self.current_token[0])
@@ -739,6 +741,7 @@ def parse_variable_declaration(self, type_name, update_condition=False):
             "ASSIGN_OR",
             "ASSIGN_XOR",
             "ASSIGN_MOD",
+            "ASSIGN_SHIFT_RIGHT",
         ):
             op = self.current_token[0]
             self.eat(op)
@@ -792,6 +795,7 @@ def parse_assignment(self, name):
             "ASSIGN_MOD",
             "BITWISE_SHIFT_RIGHT",
             "BITWISE_SHIFT_LEFT",
+            "ASSIGN_SHIFT_RIGHT",
         ]:
             op = self.current_token[0]
             op_name = self.current_token[1]
@@ -956,6 +960,7 @@ def parse_expression(self):
             "ASSIGN_MOD",
             "BITWISE_SHIFT_RIGHT",
             "BITWISE_SHIFT_LEFT",
+            "ASSIGN_SHIFT_RIGHT",
         ]:
             op = self.current_token[0]
             self.eat(op)


Test patch:
diff --git a/tests/test_translator/test_parser.py b/tests/test_translator/test_parser.py
index 95c1eaef..29a5d275 100644
--- a/tests/test_translator/test_parser.py
+++ b/tests/test_translator/test_parser.py
@@ -261,6 +261,44 @@ def test_function_call():
         pytest.fail("Struct parsing not implemented.")
 
 
+def test_assign_shift_right():
+    code = """
+    shader PerlinNoise {
+    vertex {
+        input vec3 position;
+        output vec2 vUV;
+
+        void main() {
+            vUV >>= 1;
+            vUV = position.xy * 10.0;
+            gl_Position = vec4(position, 1.0);
+        }
+    }
+
+    // Fragment Shader
+    fragment {
+        input vec2 vUV;
+        output vec4 fragColor;
+
+        void main() {
+            double noise = fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758.5453);
+            double height = noise * 10.0;
+            uint a >>= 1;
+            uint b = 2;
+            vec3 color = vec3(height / 10.0, 1.0 - height / 10.0, 0.0);
+            fragColor = vec4(color, 1.0);
+            }
+        }
+    }
+    """
+
+    try:
+        tokens = tokenize_code(code)
+        print(parse_code(tokens))
+    except SyntaxError as e:
+        pytest.fail(f"Failed to parse ASSIGN_SHIFT_RIGHT token: {e}")
+
+
 def test_logical_operators():
     code = """
         shader LightControl {