Skip to content

Commit bfe380b

Browse files
committed
update fixer
1 parent 8c796f0 commit bfe380b

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/translator/fixer.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,21 @@ function fixVerbPhrase(verb: English.VerbPhrase): English.VerbPhrase {
224224
};
225225
}
226226
}
227+
function nounHasPreposition(noun: English.NounPhrase): boolean {
228+
switch (noun.type) {
229+
case "simple":
230+
return noun.prepositions.length > 0 ||
231+
(noun.postCompound != null && nounHasPreposition(noun.postCompound));
232+
case "compound":
233+
return noun.nouns.some(nounHasPreposition);
234+
}
235+
}
227236
function fixPreposition(
228237
preposition: English.Preposition,
229238
): English.Preposition {
239+
if (nounHasPreposition(preposition.object)) {
240+
throw new FilteredError("nested preposition");
241+
}
230242
return {
231243
...preposition,
232244
adverbs: fixMultipleAdverbs(preposition.adverbs),

src/translator/modifier.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,6 @@ function pi(
153153
includeGerund: true,
154154
includeVerb: false,
155155
})
156-
.filter((modifier) =>
157-
// TODO: do this in `fixer.ts` instead
158-
modifier.type !== "noun" || modifier.noun.type !== "simple" ||
159-
modifier.noun.prepositions.length === 0
160-
)
161156
.filter((modifier) =>
162157
modifier.type !== "adjective" || modifier.inWayPhrase == null
163158
) as IterableResult<

0 commit comments

Comments
 (0)