/** A raw object as it appears in the file, before schema interpretation. */ export interface RawObject { /** Type name exactly as written, e.g. `BuildingSurface:Detailed`. */ typeName: string; /** Comma-separated values after the type name, trimmed, comments stripped. */ values: string[]; /** 1-based line where the object starts, for diagnostics. */ line: number; /** 1-based column where the object starts, for diagnostics. */ column?: number; /** * Absolute offset of the object's first character in the source text. * * One number per object, so that a finding about a FIELD can be positioned without the lexer * recording a line for every field of every object. The rescan that uses it runs only when a * finding is being built. */ offset?: number; } export interface LexDiagnostic { message: string; line: number; /** * Machine-readable kind, from the vocabulary both libraries share. * * Derived from Python's exception hierarchy by dropping the `Error` suffix, so neither language * invented it and the mapping stays mechanical. The conformance corpus compares a finding on * `(code, line, typeName)` and never on `message`: wording is a presentation choice each library * should stay free to improve, and pinning it would turn every improvement into a failure. */ code?: ParseDiagnosticCode; /** 1-based column, when the lexer knew one. */ column?: number; /** Path the text came from, when it came from a file rather than a string. */ filepath?: string; /** * Object type the problem occurred in, when known. * * Declared here rather than only on `ParseDiagnostic` because the lexer knows it too: an * unterminated object has read its type name before it runs out of input, and a finding that * drops it says only that something went wrong somewhere. */ typeName?: string; } /** * The shared diagnostic vocabulary. The table lives in * `idfkit-conformance/runners/compare.md`; a code outside it is a difference, not a near match. */ export type ParseDiagnosticCode = 'UnknownObjectType' | 'InvalidField' | 'Range' | 'DuplicateObject' | 'ParseError' | 'VersionMismatch' | 'UnsupportedVersion' | 'SchemaNotFound'; export interface LexOptions { /** Report a problem instead of throwing. */ onDiagnostic?: (diagnostic: LexDiagnostic) => void; } /** * Split IDF text into raw objects. * * The character rules are not here: they live in `scan.ts`, which the syntax layer reads through * as well. Two copies of "step over a comment between a separator and its value" that differ by * one character put a finding on the wrong field, so there is one copy (research R3). * * This function is what remains once those rules are elsewhere: assembling values from the text * runs the scan reports, and turning a statement into a `RawObject` or into a diagnostic. It asks * for no comment and no region, so it pays for neither, and it builds no syntax layer. */ export declare function lex(text: string, options?: LexOptions): RawObject[]; //# sourceMappingURL=lexer.d.ts.map