File tree 2 files changed +12
-5
lines changed
2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -224,9 +224,21 @@ function fixVerbPhrase(verb: English.VerbPhrase): English.VerbPhrase {
224
224
} ;
225
225
}
226
226
}
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
+ }
227
236
function fixPreposition (
228
237
preposition : English . Preposition ,
229
238
) : English . Preposition {
239
+ if ( nounHasPreposition ( preposition . object ) ) {
240
+ throw new FilteredError ( "nested preposition" ) ;
241
+ }
230
242
return {
231
243
...preposition ,
232
244
adverbs : fixMultipleAdverbs ( preposition . adverbs ) ,
Original file line number Diff line number Diff line change @@ -153,11 +153,6 @@ function pi(
153
153
includeGerund : true ,
154
154
includeVerb : false ,
155
155
} )
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
- )
161
156
. filter ( ( modifier ) =>
162
157
modifier . type !== "adjective" || modifier . inWayPhrase == null
163
158
) as IterableResult <
You can’t perform that action at this time.
0 commit comments