diff --git a/packages/imhotep-dsl/src/compiler.ts b/packages/imhotep-dsl/src/compiler.ts index 04b741e..bd13669 100644 --- a/packages/imhotep-dsl/src/compiler.ts +++ b/packages/imhotep-dsl/src/compiler.ts @@ -73,7 +73,11 @@ function defaultNextId(prefix: string): string { function normalizeOptionValue(raw: unknown): number | string | undefined { if (raw === undefined || raw === null) return undefined - if (typeof raw === 'number' || typeof raw === 'string') return raw + if (typeof raw === 'number') return Number.isNaN(raw) ? undefined : raw + if (typeof raw === 'string') { + const trimmed = raw.trim() + return trimmed.length > 0 ? trimmed : undefined + } // String-parser/fluent path: LiteralNode or ToleranceLiteralNode if (typeof raw === 'object') { diff --git a/packages/imhotep-dsl/src/grammar.ts b/packages/imhotep-dsl/src/grammar.ts index 23bd810..25e8afe 100644 --- a/packages/imhotep-dsl/src/grammar.ts +++ b/packages/imhotep-dsl/src/grammar.ts @@ -952,6 +952,7 @@ export class GrammarParser { if (negated) { throw this.error(`Expected assertion after 'not'`) } + console.warn(`[imhotep-dsl] parseAssertion: unexpected token "${this.currentToken().value}" at line ${this.currentToken().start?.line}, skipping`) this.advance() return null } @@ -968,6 +969,7 @@ export class GrammarParser { if (quantifier) { throw this.error(`Expected assertion after quantifier '${quantifier.kind}'`) } + console.warn(`[imhotep-dsl] parseAssertion: could not parse clause for subject "${subject.value}" at line ${start?.line}, skipping`) return null }