started working on string literals
This commit is contained in:
14
AST.py
14
AST.py
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user