UNPKG

@atomic-ehr/fhirpath

Version:

A TypeScript implementation of FHIRPath

38 lines (36 loc) 1.38 kB
import type { OperatorDefinition } from '../types'; import { Errors } from '../errors'; import { PRECEDENCE } from '../types'; import type { OperationEvaluator } from '../types'; import { box, unbox } from '../boxing'; // Note: The dot operator is special and is typically handled directly in the interpreter // because it needs to evaluate its operands in sequence, not in parallel export const evaluate: OperationEvaluator = async (input, context, left, right) => { // This should not be called directly - dot operator needs special handling // in the interpreter to properly sequence evaluation throw Errors.invalidOperation('Dot operator requires special handling in the interpreter'); }; export const dotOperator: OperatorDefinition & { evaluate: OperationEvaluator } = { symbol: '.', name: 'dot', category: ['navigation'], precedence: PRECEDENCE.DOT, associativity: 'left', description: 'Navigation operator', examples: ['Patient.name.given'], signatures: [ { name: 'navigation', left: { type: 'Any', singleton: false }, right: { type: 'Any', singleton: false }, result: { type: 'Any', singleton: false } }, { name: 'navigation-singleton', left: { type: 'Any', singleton: true }, right: { type: 'Any', singleton: false }, result: { type: 'Any', singleton: false } } ], evaluate };