"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DeclarationHandler = void 0;
const types_1 = require("../types");
class DeclarationHandler {
    constructor(parser) {
        this.parser = parser;
    }
    parseStatement() {
        if (this.parser.match(types_1.TokenType.ИНТЕРФЕЙС)) {
            return this.parser.interfaceDeclaration();
        }
        if (this.parser.match(types_1.TokenType.НАВЪ)) {
            return this.parser.typeAlias();
        }
        if (this.parser.match(types_1.TokenType.МАВҲУМ)) {
            this.parser.consume(types_1.TokenType.СИНФ, "Expected 'синф' after 'мавҳум'");
            const classDecl = this.parser.classDeclaration();
            classDecl.abstract = true;
            return classDecl;
        }
        if (this.parser.match(types_1.TokenType.СИНФ)) {
            return this.parser.classDeclaration();
        }
        if (this.parser.match(types_1.TokenType.ТАҒЙИРЁБАНДА, types_1.TokenType.СОБИТ)) {
            return this.parser.variableDeclaration();
        }
        if (this.parser.match(types_1.TokenType.ҲАМЗАМОН)) {
            this.parser.consume(types_1.TokenType.ФУНКСИЯ, "Expected 'функсия' after 'ҳамзамон'");
            const func = this.parser.functionDeclaration();
            func.async = true;
            return func;
        }
        if (this.parser.match(types_1.TokenType.ФУНКСИЯ)) {
            return this.parser.functionDeclaration();
        }
        return null;
    }
}
exports.DeclarationHandler = DeclarationHandler;
//# sourceMappingURL=declaration-handler.js.map