@@ -10,6 +10,7 @@ import {
1010 ExhaustedError ,
1111 FilteredError ,
1212 TranslationTodoError ,
13+ UntranslatableError ,
1314} from "./error.ts" ;
1415import { CONJUNCTION } from "./misc.ts" ;
1516import {
@@ -18,7 +19,7 @@ import {
1819 multipleModifiers ,
1920} from "./modifier.ts" ;
2021import { fromNounForms , PartialNoun } from "./noun.ts" ;
21- import { nounAsPreposition } from "./preposition.ts" ;
22+ import { nounAsPreposition , preposition } from "./preposition.ts" ;
2223import { Place } from "./pronoun.ts" ;
2324import { PartialCompoundVerb , PartialVerb } from "./verb.ts" ;
2425import { wordUnit } from "./word_unit.ts" ;
@@ -205,6 +206,27 @@ function defaultPhrase(
205206 } )
206207 . addErrorWhenNone ( ( ) => new ExhaustedError ( Composer . phrase ( phrase ) ) ) ;
207208}
209+ function prepositionAsVerb ( preposition : English . Preposition ) : PartialVerb {
210+ return {
211+ modal : null ,
212+ adverb : [ ] ,
213+ first : {
214+ presentPlural : "are" ,
215+ presentSingular : "is" ,
216+ past : "were" ,
217+ } ,
218+ reduplicationCount : 1 ,
219+ wordEmphasis : false ,
220+ rest : [ ] ,
221+ subjectComplement : null ,
222+ object : null ,
223+ objectComplement : null ,
224+ preposition : [ preposition ] ,
225+ forObject : false ,
226+ predicateType : null ,
227+ phraseEmphasis : false ,
228+ } ;
229+ }
208230export function phrase (
209231 options : Readonly < {
210232 phrase : TokiPona . Phrase ;
@@ -213,12 +235,24 @@ export function phrase(
213235 includeVerb : boolean ;
214236 } > ,
215237) : ArrayResult < PhraseTranslation > {
216- const { phrase } = options ;
238+ const { phrase, includeVerb } = options ;
217239 switch ( phrase . type ) {
218240 case "default" :
219241 return defaultPhrase ( { ...options , phrase } ) ;
220- case "preverb" :
221242 case "preposition" :
243+ if ( includeVerb ) {
244+ return preposition ( phrase )
245+ . map ( prepositionAsVerb )
246+ . map < PhraseTranslation > ( ( verb ) => ( {
247+ type : "verb" ,
248+ verb : { ...verb , type : "simple" } ,
249+ } ) ) ;
250+ } else {
251+ return new ArrayResult (
252+ new UntranslatableError ( "preposition" , "noun or adjective" ) ,
253+ ) ;
254+ }
255+ case "preverb" :
222256 return new ArrayResult ( new TranslationTodoError ( phrase . type ) ) ;
223257 }
224258}
@@ -346,7 +380,9 @@ export function multiplePhrases(
346380 phrase . type === "adjective" && phrase . inWayPhrase != null
347381 )
348382 ) {
349- throw new FilteredError ( "in [adjective] way phrase within compound" ) ;
383+ throw new FilteredError (
384+ "in [adjective] way phrase within compound" ,
385+ ) ;
350386 }
351387 if ( phrase . every ( ( phrase ) => phrase . type === "noun" ) ) {
352388 return {
0 commit comments