/** * DeukPack AST Builder * Builds Abstract Syntax Tree from tokens */ import { DeukPackAST, DeukPackToken } from '../types/DeukPackTypes'; export interface DeukPackASTBuilderOptions { /** When true, parse .deuk field syntax: id> [Attr]… type name [= default] and single-identifier namespace */ deuk?: boolean; /** When false (default), throw if more than one namespace is defined in a single file. */ allowMultiNamespace?: boolean; } export declare class DeukPackASTBuilder { private tokens; private position; private currentFile; /** Collected doc comments for the next declaration (struct/enum/field etc.) */ private leadingCommentBuffer; private deukMode; /** Lowercase names after `[` that are neutral IDL tags (not C# passthrough). See DEUKPACK_IDL_DECLARATION_ATTRIBUTES_DESIGN.md */ private static readonly NEUTRAL_DEUK_BRACKET_NAMES; /** * 공식 IDL 스펙에 포함하지 않는 `[]` 이름: 토큰만 소비하고 AST(중립 태그·C# 어트리뷰트)에는 넣지 않음. * 레거시/실수 흡수용. 선언 종류(record/entity/message)별 허용 태그 해석은 파서와 별도(코드젠·정책). */ private static readonly NON_OFFICIAL_BRACKET_SKIP_FIRST; /** * Collect consecutive LINE_COMMENT/BLOCK_COMMENT tokens and return combined text (trimmed). Consumes tokens. */ private collectLeadingComments; /** * Split leading comment into docComment and C# attribute lines. * Lines that look like [AttrName] or [AttrName("arg")] are treated as csharpAttributes (DeukPack extension). */ private parseDocCommentAndCSharpAttributes; /** * Parse IDL annotations: ( key = "value", key2 = "value2" ) or ( key ). Consumes tokens. */ private tryParseAnnotations; /** * Build AST from tokens */ build(tokens: DeukPackToken[], fileName: string, options?: DeukPackASTBuilderOptions): DeukPackAST; /** * Parse namespace declaration */ private parseNamespace; /** * Parse struct declaration */ private parseStruct; /** 예약 필드 ID: message<> 자동 주입 msgInfo (IDL에는 적지 않음, 코드젠에서만 사용). DEUKPACK_MESSAGE_INFO_KEYWORD §5. */ private static readonly MSGINFO_FIELD_ID; /** * Parse message name { fields } — 득팩 프로토콜 메시지. * IDL에는 사용자 필드만 적고, 파서가 예약 ID(31000)로 msgInfo 필드를 자동 주입. */ private parseMessage; /** * Thrift→.deuk 마이그레이션 레거시: message name { ... } (괄호 numeric ID 없음). * MsgInfo 기본값·DefaultMessageId는 코드젠이 query_msg_id 등에서 보완하거나 0으로 둔다. */ private parseMessageLegacy; /** * Parse table = { version: "...", key?: "..." } — 득팩 테이블 정의. * Produces a synthetic struct named "table" with header + infos for existing codegen (IDeukMetaContainer). */ private parseTableDefinition; /** * Parse field declaration. Deuk: id> [Attr]… type name [= default]. Legacy .thrift: id: [required|optional] type name [= default] */ private parseField; /** Rebuild source fragment for bracket bodies; string literals need quotes for `[c#: Obsolete("x")]`. */ private deukBracketTokenFragment; /** Collect inner text until `]` at parenthesis depth 0 (bracket body for `[c#: …]` and `:value`). */ private consumeDeukBracketInnerUntilRightBracket; /** First token of `[name…]` — `table` etc. are keywords, not IDENTIFIER. */ private parseDeukBracketFirstName; private neutralDeukBracketBaseName; /** * Parse one `[…]` block in .deuk: `[c#: …]` / `[csharp: …]` → csharp; neutral tags → neutral; else → csharpAttributes shape. */ private parseOneDeukInlineBracketPair; /** * Parse type declaration */ private parseType; /** 레거시 식별자 타입(i32 등) → 득팩 이름 정규화 (Protobuf와 동일하게 AST에는 득팩 타입만 저장) */ private static readonly THRIFT_TYPE_TO_DEUKPACK; /** 득팩 테이블 프리미티브(DEUKPACK_IDL_DESIGN §5.1): name/note는 string 별칭. id/tid는 int64와 동일해 타입 구분 불필요. */ private static readonly META_PRIMITIVES; /** * Parse identifier type (handles namespaced types like mo_define.projectile_type_e) */ private parseIdentifierType; /** * Parse list type */ private parseListType; /** Parse array — 고정 길이; 와이어는 list와 동일. */ private parseArrayType; /** * Parse set type */ private parseSetType; /** * Parse tablelink — 득팩 테이블 행 참조. */ private parseTableLinkType; /** * Parse map type */ private parseMapType; /** * Parse default value */ private parseDefaultValue; /** * Parse identifier default value (handles namespaced values; . or :: in .deuk, stored as . in AST) */ private parseIdentifierDefaultValue; /** * Parse array default value (handles values like [{"weight":30}, {"weight":30}] or []) */ private parseArrayDefaultValue; /** * Parse object default value (handles values like { "version": 20250802 } or {}) */ private parseObjectDefaultValue; /** * Parse enum declaration */ private parseEnum; /** * Parse service declaration */ private parseService; /** * Parse a single service method: returnType methodName( [ params ] ) */ private parseServiceMethod; /** * Parse include statement */ private parseInclude; /** * Parse typedef declaration */ private parseTypedef; /** * Parse const declaration */ private parseConst; /** * Check if current token matches expected type */ private check; /** * Expect token of specific type and advance */ private expect; /** * Advance and return current token */ private advance; /** * Get current token without advancing */ private peek; /** * Get previous token */ private previous; /** * Check if at end of tokens */ private isAtEnd; } //# sourceMappingURL=DeukPackASTBuilder.d.ts.map