import type { PslDiagnostic } from '@prisma-next/framework-components/psl-ast'; import { notOk, ok, type Result } from '@prisma-next/utils/result'; import { IdentifierAst } from '../../syntax/ast/identifier'; import type { ArgType } from '../types'; import { leafDiagnostic } from './diagnostic'; export function identifier(name: N): ArgType { return { kind: 'identifier', label: name, parse: (arg, ctx): Result => { if (arg instanceof IdentifierAst && arg.name() === name) return ok(name); return notOk([leafDiagnostic(ctx, arg, `Expected ${name}`)]); }, }; }