@@ -69,6 +69,7 @@ function nounPhrase(
69
69
if ( prepositions . length > 0 && postAdjective != null ) {
70
70
throw new FilteredError ( "named noun with preposition" ) ;
71
71
}
72
+ const { nounPreposition } = modifier ;
72
73
const headNoun = fromNounForms ( noun , quantity )
73
74
. map ( ( { noun : useWord , quantity } ) : English . NounPhrase => ( {
74
75
type : "simple" ,
@@ -85,21 +86,25 @@ function nounPhrase(
85
86
postAdjective,
86
87
prepositions,
87
88
emphasis : emphasis &&
88
- modifier . nounPreposition == null ,
89
+ nounPreposition == null ,
89
90
} ) ) ;
90
- if ( modifier . nounPreposition == null ) {
91
+ if ( nounPreposition == null ) {
91
92
return headNoun ;
92
93
} 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
+ }
103
108
} else {
104
109
// will be filled by ExhaustedError on `defaultPhrase`
105
110
return IterableResult . empty ( ) ;
0 commit comments