fix(parser): update ast gen script

This commit is contained in:
HEL
2026-05-25 12:46:04 +02:00
parent 0e0a1b26f2
commit a735113466
+8 -3
View File
@@ -14,7 +14,8 @@ from abc import ABC, abstractmethod
from dataclasses import dataclass from dataclasses import dataclass
from typing import Any, Generic, Optional, TypeVar from typing import Any, Generic, Optional, TypeVar
from lexer.token import Token from midas.ast.location import Location
from midas.lexer.token import Token
T = TypeVar("T") T = TypeVar("T")
@@ -23,8 +24,10 @@ T = TypeVar("T")
############## ##############
@dataclass(frozen=True) @dataclass(frozen=True, kw_only=True)
class Stmt(ABC): class Stmt(ABC):
location: Optional[Location] = None
@abstractmethod @abstractmethod
def accept(self, visitor: Visitor[T]) -> T: ... def accept(self, visitor: Visitor[T]) -> T: ...
@@ -40,8 +43,10 @@ class Stmt(ABC):
############### ###############
@dataclass(frozen=True) @dataclass(frozen=True, kw_only=True)
class Expr(ABC): class Expr(ABC):
location: Optional[Location] = None
@abstractmethod @abstractmethod
def accept(self, visitor: Visitor[T]) -> T: ... def accept(self, visitor: Visitor[T]) -> T: ...