@@ -10,7 +10,7 @@ import {
10
10
import { extractNegativeFromMultipleAdverbs , NOT } from "./adverb.ts" ;
11
11
import * as English from "./ast.ts" ;
12
12
import { getNumber } from "./determiner.ts" ;
13
- import { ExhaustedError , FilteredError , UntranslatableError } from "./error.ts" ;
13
+ import { ExhaustedError , FilteredError } from "./error.ts" ;
14
14
import { CONJUNCTION } from "./misc.ts" ;
15
15
import {
16
16
AdjectivalModifier ,
@@ -196,10 +196,9 @@ function defaultPhrase(
196
196
phrase : TokiPona . Phrase & { type : "simple" } ;
197
197
place : Place ;
198
198
includeGerund : boolean ;
199
- includeVerb : boolean ;
200
199
} > ,
201
200
) {
202
- const { phrase, includeVerb } = options ;
201
+ const { phrase } = options ;
203
202
const emphasis = phrase . emphasis != null ;
204
203
return IterableResult . combine (
205
204
wordUnit ( { ...options , wordUnit : phrase . headWord } ) ,
@@ -221,7 +220,7 @@ function defaultPhrase(
221
220
type : "adjective" ,
222
221
} ) ;
223
222
} else if (
224
- includeVerb && headWord . type === "verb" && modifier . type === "adverbial"
223
+ headWord . type === "verb" && modifier . type === "adverbial"
225
224
) {
226
225
return IterableResult . from ( ( ) =>
227
226
IterableResult . single < PhraseTranslation > ( {
@@ -286,7 +285,6 @@ function preverb(
286
285
phrase : preverb . phrase ,
287
286
place : "object" ,
288
287
includeGerund : false ,
289
- includeVerb : true ,
290
288
} ) ,
291
289
)
292
290
. filterMap ( ( [ verb , predicate ] ) : null | PartialSimpleVerb => {
@@ -345,38 +343,25 @@ export function phrase(
345
343
phrase : TokiPona . Phrase ;
346
344
place : Place ;
347
345
includeGerund : boolean ;
348
- includeVerb : boolean ;
349
346
} > ,
350
347
) : IterableResult < PhraseTranslation > {
351
- const { phrase, includeVerb } = options ;
348
+ const { phrase } = options ;
352
349
switch ( phrase . type ) {
353
350
case "simple" :
354
351
return defaultPhrase ( { ...options , phrase } ) ;
355
352
case "preposition" :
356
- if ( includeVerb ) {
357
- return preposition ( phrase )
358
- . map ( prepositionAsVerb )
359
- . map ( ( verb ) : PhraseTranslation => ( {
360
- type : "verb" ,
361
- verb : { ...verb , type : "simple" } ,
362
- } ) ) ;
363
- } else {
364
- return IterableResult . errors ( [
365
- new UntranslatableError ( "preposition" , "noun or adjective" ) ,
366
- ] ) ;
367
- }
353
+ return preposition ( phrase )
354
+ . map ( prepositionAsVerb )
355
+ . map ( ( verb ) : PhraseTranslation => ( {
356
+ type : "verb" ,
357
+ verb : { ...verb , type : "simple" } ,
358
+ } ) ) ;
368
359
case "preverb" :
369
- if ( includeVerb ) {
370
- return preverb ( phrase )
371
- . map ( ( verb ) : PhraseTranslation => ( {
372
- type : "verb" ,
373
- verb : { ...verb , type : "simple" } ,
374
- } ) ) ;
375
- } else {
376
- return IterableResult . errors ( [
377
- new UntranslatableError ( "preverb" , "noun or adjective" ) ,
378
- ] ) ;
379
- }
360
+ return preverb ( phrase )
361
+ . map ( ( verb ) : PhraseTranslation => ( {
362
+ type : "verb" ,
363
+ verb : { ...verb , type : "simple" } ,
364
+ } ) ) ;
380
365
}
381
366
}
382
367
export function phraseAsVerb (
@@ -443,10 +428,9 @@ export function multiplePhrases(
443
428
place : Place ;
444
429
includeGerund : boolean ;
445
430
andParticle : null | string ;
446
- includeVerb : boolean ;
447
431
} > ,
448
432
) : IterableResult < PhraseTranslation > {
449
- const { phrases, andParticle, includeVerb } = options ;
433
+ const { phrases, andParticle } = options ;
450
434
switch ( phrases . type ) {
451
435
case "simple" :
452
436
return phrase ( { ...options , phrase : phrases . phrase } ) ;
@@ -488,7 +472,7 @@ export function multiplePhrases(
488
472
inWayPhrase : null ,
489
473
} ;
490
474
}
491
- } else if ( includeVerb ) {
475
+ } else {
492
476
return {
493
477
type : "verb" ,
494
478
verb : {
@@ -500,8 +484,6 @@ export function multiplePhrases(
500
484
prepositions : [ ] ,
501
485
} ,
502
486
} ;
503
- } else {
504
- return null ;
505
487
}
506
488
} )
507
489
. addErrorWhenNone ( ( ) =>
0 commit comments