File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Expand file tree Collapse file tree 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 {
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+ }
227236function 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 ) ,
Original file line number Diff line number Diff 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 <
You can’t perform that action at this time.
0 commit comments