Skip to content

Commit

Permalink
Implement tokens for unsigned int and double data types (CrossGL#68)
Browse files Browse the repository at this point in the history
* feat: Implement tokens for unsigned int and double data types.

* chore: Add test for data type tokenization

* feat: Refactor unsigned int to uint after review and edit tests for same
  • Loading branch information
rigved-desai authored and AxelB1011 committed Aug 22, 2024
1 parent 94f773f commit c272a8d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions crosstl/src/translator/lexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
("FLOAT_NUMBER", r"\d*\.\d+|\d+\.\d*"),
("FLOAT", r"\bfloat\b"),
("INT", r"\bint\b"),
("UINT", r"\buint\b"),
("DOUBLE", r"\bdouble\b"),
("SAMPLER2D", r"\bsampler2D\b"),
("IDENTIFIER", r"[a-zA-Z_][a-zA-Z_0-9]*"),
("NUMBER", r"\d+(\.\d+)?"),
Expand Down
14 changes: 14 additions & 0 deletions tests/test_translator/test_lexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,17 @@ def test_function_call_tokenization():
tokenize_code(code)
except SyntaxError:
pytest.fail("Function call tokenization not implemented.")


def test_data_types_tokenization():
code = """
int a;
uint b;
float c;
double d;
bool e;
"""
try:
tokenize_code(code)
except SyntaxError:
pytest.fail("Data types tokenization not implemented.")

0 comments on commit c272a8d

Please sign in to comment.