Add specific Literal classes

They are needed for the further development convenience.
Yury Kurlykov 2020-04-30 00:55:25 +10:00
parent c504830928
commit 2708b1e61f
Signed by: t1meshift
GPG Key ID: B133F3167ABF94D8
1 changed files with 29 additions and 0 deletions

View File

@ -1059,6 +1059,35 @@ class BigIntLiteral(Literal):
self._fields.update({"bigint": self.bigint})
class NullLiteral(Literal):
def __init__(self, loc: Optional[SourceLocation]):
super().__init__(loc, None)
def __str__(self):
return "null"
class BooleanLiteral(Literal):
def __init__(self, loc: Optional[SourceLocation], value: bool):
super().__init__(loc, value)
def __str__(self):
return str(self.value).lower()
class StringLiteral(Literal):
def __init__(self, loc: Optional[SourceLocation], value: str):
super().__init__(loc, value)
def __str__(self):
return f'"{self.value}"'
class NumericLiteral(Literal):
def __init__(self, loc: Optional[SourceLocation], value: number):
super().__init__(loc, value)
# "Property" block