feat: CDX compound index write + {||} parsing + zero known constraints

All 3 remaining known constraints resolved. CLAUDE.md now shows zero.

1. CDX compound index WRITE support (was read-only)

   New file: hbrdd/cdx/build.go (~400 LOC)
   - CreateOrAddTag() builds Harbour-compatible CDX files
   - Bit-packed leaf pages (RecBits/DupBits/TrlBits compression)
   - Interior nodes with big-endian RecNo/ChildPage
   - Compound root directory (structural B-tree of tag names)
   - Append-safe: preserves existing tags when adding new ones
   - Linked leaf pages (LeftPtr/RightPtr for sequential scan)

   Pipeline: INDEX ON expr TAG tagname TO file
   - ast.IndexCmd gains TagName field
   - Parser captures TAG name (was discarded)
   - gengo passes TagName to OrderCreateParams
   - indexer.go routes to cdx.CreateOrAddTag when TAG specified

   Verified: 3 tags (BYNAME/BYCITY/BYAGE), OrdSetFocus by name,
   SEEK, GoTop/GoBottom, close+reopen with SET INDEX TO

2. {||} empty code block parsing in function arguments

   Parser's parseArrayOrBlock() called parseExpr() unconditionally
   after closing |, failing when body was empty ({||}).
   Fix: check for RBRACE after closing | and emit NIL literal body.
   {=>} empty hash already worked.

3. Semicolon IF...ENDIF — already worked (removed from constraints)

Tests:
  go test ./...        14 packages ALL PASS
  FiveSql2             43/43 100%
  compat_harbour       51/51

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-13 22:58:09 +09:00
parent e5d27951fd
commit 4d5621c21a
8 changed files with 590 additions and 22 deletions

View File

@@ -65,16 +65,15 @@ cd ~/tmp && rm -f *.dbf __cte_*.dbf && /tmp/test_sql
## 알려진 제약사항
| 항목 | 상태 | 우회 방법 |
|------|------|----------|
| 세미콜론 IF...ENDIF | Five 파서 미지원 | 여러 줄로 분리 |
| `{||}` / `{=>}` 함수 인자 내 | 파서가 빈 블록/해시를 인자 위치에서 파싱 실패 | 변수에 담아서 전달 |
| CDX compound index 쓰기 | 읽기만 지원, 생성 불가 | NTX 사용 또는 Harbour로 CDX 생성 |
현재 알려진 제약사항 없음. 모든 이전 제약이 해결됨.
### 해결된 제약 (2026-04-11~13)
| 항목 | 커밋 |
|------|------|
| 세미콜론 IF...ENDIF | 이미 동작 확인 (2026-04-13) |
| `{||}` / `{=>}` 함수 인자 파싱 실패 | 빈 블록 body에 NIL 리터럴 emit |
| CDX compound index 쓰기 미지원 | CDX 빌더 구현 (비트팩 리프+compound root) |
| STATIC inside FUNCTION → panic | `5bfdc47` — Go 패키지 변수로 emit |
| FIELD->NAME 빈 값 반환 | `e95afad` — GetAliasField 반환 타입 수정 |
| OrdSetFocus(n) 무동작 | `e95afad` — 숫자→문자열 변환 수정 |