started working on string literals

This commit is contained in:
SpookyDervish
2025-10-15 07:48:38 +11:00
parent 39cc0429da
commit 39a5151d97
5 changed files with 45 additions and 4 deletions

14
AST.py
View File

@@ -23,6 +23,7 @@ class NodeType(Enum):
FloatLiteral = "FloatLiteral"
IdentifierLiteral = "IdentifierLiteral"
BooleanLiteral = "BooleanLiteral"
StringLiteral = "StringLiteral"
# Helper
FunctionParameter = "FunctionParameter"
@@ -124,6 +125,19 @@ class BooleanLiteral(Expression):
"type": self.type().value,
"value": self.value
}
class StringLiteral(Expression):
def __init__(self, value: str = None) -> None:
self.value: str = value
def type(self) -> NodeType:
return NodeType.StringLiteral
def json(self) -> dict:
return {
"type": self.type().value,
"value": self.value
}
# endregion
# region Statements