Parser for taking IFC file serialized in step and turning them into a lazily parsed model.

Hierarchy (view full)

Constructors

Properties

Instance: default = ...

An easily accessible and re-usable instance of the parser.

Note the parser itself is free of mutable state in the class, so there's no problems with just using a single one.

Accessors

  • get instance(): StepHeaderParser
  • Get the singleton static instance of this.

    Returns StepHeaderParser

    The singleton instance of this.

Methods

  • Parse arguments from a single line from a step file, indexing it.,

    Parameters

    • input: default

      The input parsing buffer, in the data section.

    • expressID: number

    Returns [any, ParseResult]

    The parsing result, including the arguments array and result enum.

  • This uses a much lighter non correctness verifying parse to extract the locations of the fields for an entry, using the v-table builder to append the top level entries.

    In this case, the cursor should represent the start of the

    Parameters

    • input: Uint8Array<ArrayBufferLike>
    • cursor: number
    • endCursor: number
    • vtableBuilder: default

    Returns undefined | [number, number, number]

    The vtable slice or undefined if it's not defined due to an error.

  • Parse the data block of a step file, indexing it.

    Synchronous driver over parseDataBlockIncremental — see parseDataBlockAsync for the cooperative (repaint-friendly) variant.

    Parameters

    • input: default

      The input parsing buffer, in the data section.

    • OptionalonProgress: ParseProgressCallback

      Optional byte-cursor progress callback, invoked roughly every PARSE_PROGRESS_ELEMENT_MASK + 1 elements.

    Returns BlockParseResult<EntityTypesIfc>

    The parsing result, including the index and result enum.

  • Cooperative variant of parseDataBlock: identical parse (same generator body), but periodically awaits a macrotask so the event loop can run — browsers repaint progress UI, watchdog timers fire, and the tab is not flagged as stalled during a large parse. Issue #301 §2.

    Parameters

    • input: default

      The input parsing buffer, in the data section.

    • OptionalonProgress: ParseProgressCallback

      Optional byte-cursor progress callback.

    • yieldIntervalMs: number = DEFAULT_PARSE_YIELD_INTERVAL_MS

      Minimum ms between event-loop yields.

    Returns Promise<BlockParseResult<EntityTypesIfc>>

    The parsing result, including the index and result enum.

  • Streaming driver over parseDataBlockIncremental: identical parse (same generator body) but invokes onRecordBoundary at every top-level record boundary so a caller feeding the parser from a moving window can slide that window forward while the rewind stack is empty. See streaming_index_builder.ts for the coordinator that owns the window.

    Parameters

    • input: default

      The input parsing buffer, positioned at the data section.

    • onRecordBoundary: ((input: default) => void)

      Called at each top-level record boundary with the buffer; the callback may rebase the buffer's window in place.

        • (input): void
        • Parameters

          Returns void

    • OptionalonRecordIndexed: ((localID: number, expressID: number, typeID: undefined | EntityTypesIfc) => void)

      Called as each top-level record is indexed, with its localID, expressID and typeID (0 for external-mapping records) — the seam for incremental semantic consumers (type index, roots registry, names skeleton). Must be synchronous and cheap; expensive work belongs on a demand queue, not the parse path.

        • (localID, expressID, typeID): void
        • Parameters

          • localID: number
          • expressID: number
          • typeID: undefined | EntityTypesIfc

          Returns void

    • OptionalonProgress: ParseProgressCallback

      Optional byte-cursor progress callback.

    • Optionalsink: StepIndexSink<EntityTypesIfc>

    Returns BlockParseResult<EntityTypesIfc>

    The parsing result, including the index and result enum.

  • Cooperative variant of parseDataBlockStreamed: identical parse and window-slide behaviour (same generator body, same boundary callback), but periodically awaits a macrotask so the event loop can run — browsers repaint progress UI during a large streamed parse instead of flagging the tab as stalled. Issue #301 §2 for the streamed path.

    Parameters

    • input: default

      The input parsing buffer, positioned at the data section.

    • onRecordBoundary: ((input: default) => void)

      Called at each top-level record boundary with the buffer; the callback may rebase the buffer's window in place.

        • (input): void
        • Parameters

          Returns void

    • OptionalonRecordIndexed: ((localID: number, expressID: number, typeID: undefined | EntityTypesIfc) => void)

      Called as each top-level record is indexed — see parseDataBlockStreamed.

        • (localID, expressID, typeID): void
        • Parameters

          • localID: number
          • expressID: number
          • typeID: undefined | EntityTypesIfc

          Returns void

    • OptionalonProgress: ParseProgressCallback

      Optional byte-cursor progress callback.

    • Optionalsink: StepIndexSink<EntityTypesIfc>

      Optional index sink (columnar builds).

    • yieldIntervalMs: number = DEFAULT_PARSE_YIELD_INTERVAL_MS

      Minimum ms between event-loop yields.

    Returns Promise<BlockParseResult<EntityTypesIfc>>

    The parsing result, including the index and result enum.

  • Parse data to the model

    Parameters

    • input: default

      The parsing buffer, set to user data, to read.

    • OptionalonProgress: ParseProgressCallback

      Optional byte-cursor progress callback for the data parse.

    Returns [ParseResult, undefined | default]

    The parse result as well as the model, if it can be extracted.

  • Cooperative variant of parseDataToModel — periodically yields to the event loop mid-parse (see StepParser.parseDataBlockAsync, issue #301 §2).

    Parameters

    • input: default

      The parsing buffer, set to user data, to read.

    • OptionalonProgress: ParseProgressCallback

      Optional byte-cursor progress callback for the data parse.

    Returns Promise<[ParseResult, undefined | default]>

    The parse result as well as the model, if it can be extracted.

  • Will parse the input up to data block (including the DATA token).

    Parameters

    • input: default

      The input buffer to parse the header from.

    Returns HeaderParseResult

    The parse result for the header, plus the header values.

  • Build a model by streaming the source through a bounded moving window (see buildIndexStreaming / M0) rather than parsing one resident buffer, then backing the model with a windowed provider over store — so the source is never held fully resident in the JS heap.

    source serves the parse (synchronous windowed reads — on a worker this is an OPFS sync-access handle; in node/tests a file descriptor or buffer) and store serves the model's post-parse property access (asynchronous windowed reads paged in on demand — OPFS File.slice() in the browser). Both view the same file bytes, so the file-absolute addresses the index records resolve identically through either.

    NOTE (M1 scope): this delivers the bounded-memory parse. Synchronous geometry extraction still needs its record ranges resident — as after spillSourceToExternalStore — so a caller that extracts geometry must ensureResident first (demand-driven geometry is M3). Property / index access works directly via the async surfaces.

    Parameters

    • source: ByteSource

      Synchronous byte source feeding the streaming parse.

    • store: StepExternalByteStore

      Async external store backing the windowed model.

    • Optionalopts: {
          chunkBytes?: number;
          maxResidentChunks?: number;
          pool?: number;
      }

      Optional window sizing: pool (parse window), chunkBytes / maxResidentChunks (model window).

      • OptionalchunkBytes?: number
      • OptionalmaxResidentChunks?: number
      • Optionalpool?: number

    Returns [ParseResult, undefined | default]

    The parse result and the windowed model.