From 8769d4436770f5ca83db51a04b47732fc08ed76a Mon Sep 17 00:00:00 2001 From: Lynn Date: Tue, 5 Sep 2023 22:16:44 +0200 Subject: [PATCH] Split denoteLittleV --- src/semantics/denote.ts | 19 ++++++++++++------- src/tree.ts | 2 +- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/semantics/denote.ts b/src/semantics/denote.ts index 76fea1e..3c7278a 100644 --- a/src/semantics/denote.ts +++ b/src/semantics/denote.ts @@ -1,5 +1,5 @@ import { VerbEntry } from '../dictionary'; -import { Branch, Leaf, StrictTree, Word } from '../tree'; +import { Branch, CovertValue, Leaf, StrictTree, Word } from '../tree'; import { after, afterNear, @@ -351,12 +351,19 @@ const littleVAgent = ฮป('e', ['s'], c => // ฮป๐˜—. ๐˜— const na = ฮป(['e', 't'], [], c => v(0, c)); -function denoteLittleV(toaq: string | null): Expr | null { - switch (toaq) { +function denoteCovertLittleV(value: CovertValue): Expr | null { + switch (value) { case 'CAUSE': return littleVAgent; case 'BE': return null; + default: + throw new Error(`Unrecognized ๐˜ท: ${value}`); + } +} + +function denoteOvertLittleV(toaq: string | null): Expr | null { + switch (toaq) { case 'nรค': return na; default: @@ -517,15 +524,13 @@ function denoteLeaf(leaf: Leaf, cCommand: StrictTree | null): DTree { covertResumptive: binding, }; } else if (leaf.label === '๐˜ท') { - let toaq: string | null; if (leaf.word.covert) { - toaq = leaf.word.value; + denotation = denoteCovertLittleV(leaf.word.value); } else if (leaf.word.entry === undefined) { throw new Error(`Unrecognized ๐˜ท: ${leaf.word.text}`); } else { - toaq = leaf.word.entry.toaq; + denotation = denoteOvertLittleV(leaf.word.entry.toaq); } - denotation = denoteLittleV(toaq); } else if (leaf.label === 'Asp') { let toaq: string; if (leaf.word.covert) { diff --git a/src/tree.ts b/src/tree.ts index de8885c..5e532cd 100644 --- a/src/tree.ts +++ b/src/tree.ts @@ -12,7 +12,7 @@ export interface Word { entry: Entry | undefined; } -type CovertValue = 'โˆ…' | 'BE' | 'CAUSE' | 'PRO'; +export type CovertValue = 'โˆ…' | 'BE' | 'CAUSE' | 'PRO'; export interface CovertWord { covert: true;