1- import { nullableAsArray , repeatWithSpace } from "../../misc/misc.ts" ;
1+ import { nullableAsArray } from "../../misc/misc.ts" ;
22import { ArrayResult } from "../array_result.ts" ;
33import { dictionary } from "../dictionary.ts" ;
44import * as TokiPona from "../parser/ast.ts" ;
55import { definitionAsPlainString } from "./as_string.ts" ;
66import * as English from "./ast.ts" ;
77import { clause , contextClause , unwrapSingleWord } from "./clause.ts" ;
8- import { FilteredError , TranslationTodoError } from "./error.ts" ;
9- import { noEmphasis } from "./word.ts" ;
10- import { fromSimpleDefinition } from "./word_unit.ts" ;
8+ import { TranslationTodoError } from "./error.ts" ;
9+ import { noEmphasis , word } from "./word.ts" ;
10+ import { fromSimpleDefinition , getReduplicationCount } from "./word_unit.ts" ;
1111
1212function filler ( filler : TokiPona . Filler ) : ArrayResult < string > {
1313 switch ( filler . type ) {
@@ -64,26 +64,6 @@ function emphasisAsPunctuation(
6464 return `${ questionMark } ${ exclamationMark } ` ;
6565 }
6666}
67- function anuSeme ( seme : TokiPona . HeadedWordUnit ) : English . Clause {
68- let interjection : string ;
69- switch ( seme . type ) {
70- case "default" :
71- interjection = "right" ;
72- break ;
73- case "reduplication" :
74- interjection = repeatWithSpace ( "right" , seme . count ) ;
75- break ;
76- case "x ala x" :
77- throw new FilteredError ( '"seme ala seme"' ) ;
78- }
79- return {
80- type : "interjection" ,
81- interjection : {
82- word : interjection ,
83- emphasis : seme . emphasis != null ,
84- } ,
85- } ;
86- }
8767function sentence (
8868 sentence : TokiPona . Sentence ,
8969 isFinal : boolean ,
@@ -103,7 +83,17 @@ function sentence(
10383 ) ,
10484 ) ;
10585 }
106- const useAnuSeme = nullableAsArray ( sentence . anuSeme ) . map ( anuSeme ) ;
86+ const useAnuSeme = nullableAsArray ( sentence . anuSeme )
87+ . map ( ( seme ) =>
88+ ( {
89+ type : "interjection" ,
90+ interjection : word ( {
91+ word : "right" ,
92+ reduplicationCount : getReduplicationCount ( seme ) ,
93+ emphasis : seme . emphasis != null ,
94+ } ) ,
95+ } ) as const
96+ ) ;
10797 const interjectionClause : ArrayResult < English . Clause > =
10898 sentence . contextClauses . length === 0 &&
10999 sentence . startingParticle == null
0 commit comments