blob: 954b8b41cb1e4816bd47dde8e189e92ed64d956e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
from errors import Error
from astree.unit import Unit
from parse.base import BaseParser
from parse.decl import ParseDecl
class ParseUnit:
def __init__(self, parser: BaseParser):
self.parser: BaseParser = parser
def unit(self) -> (Unit | Error):
decls = ParseDecl(self.parser).decls()
if type(decls) is Error:
return decls
return Unit(decls = decls)
|