@@ -69,6 +69,7 @@ function nounPhrase(
6969 if ( prepositions . length > 0 && postAdjective != null ) {
7070 throw new FilteredError ( "named noun with preposition" ) ;
7171 }
72+ const { nounPreposition } = modifier ;
7273 const headNoun = fromNounForms ( noun , quantity )
7374 . map ( ( { noun : useWord , quantity } ) : English . NounPhrase => ( {
7475 type : "simple" ,
@@ -85,21 +86,25 @@ function nounPhrase(
8586 postAdjective,
8687 prepositions,
8788 emphasis : emphasis &&
88- modifier . nounPreposition == null ,
89+ nounPreposition == null ,
8990 } ) ) ;
90- if ( modifier . nounPreposition == null ) {
91+ if ( nounPreposition == null ) {
9192 return headNoun ;
9293 } else if ( modifier . ofPhrase == null ) {
93- return headNoun . map ( ( noun ) : English . NounPhrase => ( {
94- ...modifier . nounPreposition ! . noun as English . NounPhrase & {
95- type : "simple" ;
96- } ,
97- prepositions : [ nounAsPreposition (
98- noun ,
99- modifier . nounPreposition ! . preposition ,
100- ) ] ,
101- emphasis,
102- } ) ) ;
94+ const { noun : nounOf } = nounPreposition ;
95+ switch ( nounOf . type ) {
96+ case "simple" :
97+ return headNoun . map ( ( noun ) : English . NounPhrase => ( {
98+ ...nounOf ,
99+ prepositions : [ nounAsPreposition (
100+ noun ,
101+ nounPreposition . preposition ,
102+ ) ] ,
103+ emphasis,
104+ } ) ) ;
105+ case "compound" :
106+ throw new FilteredError ( "compound nouns followed by preposition" ) ;
107+ }
103108 } else {
104109 // will be filled by ExhaustedError on `defaultPhrase`
105110 return IterableResult . empty ( ) ;
0 commit comments