Repository: CrossGL/crosstl (python)

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.

Pull request description:
Add parsing support for ASSIGN_SHIFT_RIGHT token (>>= operator)
This PR addresses issue #82 by adding support for parsing the ASSIGN_SHIFT_RIGHT token (>>= operator) in the translator parser. This enhancement ensures that the parser correctly recognizes and processes expressions involving the >>= operator.
Closes #82 

Patch:
diff --git a/crosstl/src/translator/parser.py b/crosstl/src/translator/parser.py
index a46a9d2..d07c84e 100644
--- a/crosstl/src/translator/parser.py
+++ b/crosstl/src/translator/parser.py
@@ -644,6 +644,7 @@ class Parser:
             "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 @@ class Parser:
             "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 @@ class Parser:
             "ASSIGN_OR",
             "ASSIGN_XOR",
             "ASSIGN_MOD",
+            "ASSIGN_SHIFT_RIGHT",
         ):
             op = self.current_token[0]
             self.eat(op)
@@ -792,6 +795,7 @@ class Parser:
             "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 @@ class Parser:
             "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 95c1eae..29a5d27 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 {