Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added translator support for Modulus token #136

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crosstl/src/translator/codegen/directx_codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ def map_operator(self, op):
"MINUS": "-",
"MULTIPLY": "*",
"DIVIDE": "/",
"MOD": "%",
"LESS_THAN": "<",
"GREATER_THAN": ">",
"ASSIGN_ADD": "+=",
Expand Down
3 changes: 2 additions & 1 deletion crosstl/src/translator/codegen/metal_codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,11 +414,12 @@ def map_operator(self, op):
"MINUS": "-",
"MULTIPLY": "*",
"DIVIDE": "/",
"LESS_THAN": "<",
"MOD": "%",
"ASSIGN_ADD": "+=",
"ASSIGN_SUB": "-=",
"ASSIGN_MUL": "*=",
"ASSIGN_DIV": "/=",
"LESS_THAN": "<",
"GREATER_THAN": ">",
"LESS_EQUAL": "<=",
"GREATER_EQUAL": ">=",
Expand Down
3 changes: 2 additions & 1 deletion crosstl/src/translator/codegen/opengl_codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,12 @@ def map_operator(self, op):
"MINUS": "-",
"MULTIPLY": "*",
"DIVIDE": "/",
"LESS_THAN": "<",
"MOD": "%",
"ASSIGN_ADD": "+=",
"ASSIGN_SUB": "-=",
"ASSIGN_MUL": "*=",
"ASSIGN_DIV": "/=",
"LESS_THAN": "<",
"GREATER_THAN": ">",
"LESS_EQUAL": "<=",
"GREATER_EQUAL": ">=",
Expand Down
7 changes: 2 additions & 5 deletions crosstl/src/translator/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,14 +634,14 @@ def parse_assignment_or_function_call(self, update_condition=False):
"ASSIGN_SUB",
"ASSIGN_MUL",
"ASSIGN_DIV",
"ASSIGN_MOD",
"LESS_THAN",
"GREATER_THAN",
"LESS_EQUAL",
"GREATER_EQUAL",
"ASSIGN_AND",
"ASSIGN_OR",
"ASSIGN_XOR",
"ASSIGN_MOD",
"BITWISE_SHIFT_RIGHT",
"BITWISE_SHIFT_LEFT",
"ASSIGN_SHIFT_RIGHT",
Expand Down Expand Up @@ -702,7 +702,6 @@ def parse_variable_declaration(self, type_name, update_condition=False):
"ASSIGN_AND",
"ASSIGN_OR",
"ASSIGN_XOR",
"ASSIGN_MOD",
"BITWISE_SHIFT_RIGHT",
"BITWISE_SHIFT_LEFT",
"ASSIGN_SHIFT_RIGHT",
Expand Down Expand Up @@ -740,7 +739,6 @@ def parse_variable_declaration(self, type_name, update_condition=False):
"ASSIGN_AND",
"ASSIGN_OR",
"ASSIGN_XOR",
"ASSIGN_MOD",
"ASSIGN_SHIFT_RIGHT",
):
op = self.current_token[0]
Expand Down Expand Up @@ -792,7 +790,6 @@ def parse_assignment(self, name):
"ASSIGN_AND",
"ASSIGN_OR",
"ASSIGN_XOR",
"ASSIGN_MOD",
"BITWISE_SHIFT_RIGHT",
"BITWISE_SHIFT_LEFT",
"ASSIGN_SHIFT_RIGHT",
Expand Down Expand Up @@ -950,14 +947,14 @@ def parse_expression(self):
"MULTIPLY",
"DIVIDE",
"EQUALS",
"MOD",
"ASSIGN_ADD",
"ASSIGN_SUB",
"ASSIGN_MUL",
"ASSIGN_DIV",
"ASSIGN_AND",
"ASSIGN_OR",
"ASSIGN_XOR",
"ASSIGN_MOD",
"BITWISE_SHIFT_RIGHT",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why you removed the Assign_MOD no need to remove it your task it to just add MOD support at translator frontend.

"BITWISE_SHIFT_LEFT",
"ASSIGN_SHIFT_RIGHT",
Expand Down
Loading