Expand description
STEP/IFC Parser using nom
Zero-copy tokenization and fast entity scanning.
Two independent algorithms live here:
- [
tokenizer]: nom-combinator tokenization (Token,parse_entity). - [
scanner]: a byte-level SIMD fast scanner (EntityScanner) that does its own hand-rolled parsing and never touchesTokenor nom.
[lexical] holds one small piece shared by both, and by other crates:
skip_step_comment is the STEP /* ... */ comment-skip rule, in one
place so every scanner that has no reason to answer “what does an
unterminated comment mean” differently gives the same answer (#3303).
[keyword] is the other shared rule: the scanner returns the keyword as
written and STEP keyword case is not significant, so every comparison
against a literal goes through keyword_eq and its siblings.
header reads ISO 10303-21 header records for exporters and source views.
Re-exports§
pub use header::declared_schema_bounded;
Modules§
- header
- Shared, quote-aware ISO 10303-21 header record and schema reading. The export writer and analytic processing use the same lexical rules.
Structs§
- Entity
Scanner - Fast entity scanner over raw IFC bytes without full parsing. O(n) performance for finding entities by type Uses memchr for SIMD-accelerated byte searching
- Step
List Items - The top-level items of one parenthesized STEP list, each trimmed of
trivia (STEP whitespace and
/* ... */comments) at both ends. Nested parentheses and quoted strings are respected, so a,inside('a,b')or(#1,#2)does not separate items, and a comment is trivia wherever ISO 10303-21 allows one: a,,(,)or'inside it is comment text.
Enums§
- Token
- STEP/IFC token.
Functions§
- entity_
count - Count the entities in a STEP/IFC byte buffer in
O(scan)time andO(1)memory — no entity index, no per-type map. - find_
keyword - Byte offset of the first case-folded occurrence of
upperincontent, anywhere (not only at a record’s keyword position): the whole-file “is this entity present at all” prefilter.uppermust be uppercase ASCII and non-empty. - keyword_
ends_ with keyword_eqfor a suffix: true whenrawends withupper, case folded.uppermust be uppercase ASCII.- keyword_
eq - True when the raw keyword
rawspellsupperunder STEP’s case-insensitive keyword rule.uppermust be uppercase ASCII. - keyword_
starts_ with keyword_eqfor a prefix: true whenrawbegins withupper, case folded.uppermust be uppercase ASCII.- nth_
attribute_ is_ present - Whether the top-level attribute at
index(0-based, first attribute after the() of a STEP record holds a value: it exists, it is not$, and it is not an empty slot (,,). Attributes are split byStepListItems, so nesting, strings and comments follow its rule, and whitespace is the STEP set (is_step_space), including the vertical tab and form feed thatu8::is_ascii_whitespaceleaves out. - oversized_
id_ report - The one-line report for
skippedrefused records, orNonewhen the scan refused nothing. - parse_
entity - Parse a complete entity line from raw IFC bytes. Example: #123=IFCWALL(‘guid’,‘owner’,$,$,‘name’,$,$,$);
- report_
malformed_ records - Emit [
MALFORMED_RECORD_MESSAGE] to the installed sink (stderr by default; seesuper::set_report_sink). - report_
oversized_ ids - Emit
oversized_id_reportto the installed sink (stderr by default). - report_
scan_ diagnostics report_oversized_ids+report_malformed_recordsin one call — the two diagnostics every whole-fileEntityScannerwalk in this workspace emits after a scan, so every call site needs only one line, not two.- set_
report_ sink - Route every scan diagnostic in this crate —
report_oversized_idsandsuper::malformed_records::report_malformed_recordsalike — tosinkinstead of stderr. - skip_
step_ comment - If a STEP
/* ... */comment starts atbytes[i], the index just past its closing*/.