@@ -2,7 +2,11 @@ import { mapNullable, nullableAsArray } from "../../misc/misc.ts";
22import { IterableResult } from "../compound.ts" ;
33import * as TokiPona from "../parser/ast.ts" ;
44import * as Composer from "../parser/composer.ts" ;
5- import { AdjectiveWithInWay , fixAdjective } from "./adjective.ts" ;
5+ import {
6+ AdjectiveWithInWay ,
7+ extractNegativeFromAdjective ,
8+ fixAdjective ,
9+ } from "./adjective.ts" ;
610import { fixAdverb } from "./adverb.ts" ;
711import * as English from "./ast.ts" ;
812import { fixDeterminer , getNumber } from "./determiner.ts" ;
@@ -18,8 +22,12 @@ import {
1822 AdverbialModifier ,
1923 multipleModifiers ,
2024} from "./modifier.ts" ;
21- import { fromNounForms , PartialNoun } from "./noun.ts" ;
22- import { nounAsPreposition , preposition } from "./preposition.ts" ;
25+ import { extractNegativeFromNoun , fromNounForms , PartialNoun } from "./noun.ts" ;
26+ import {
27+ extractNegativeFromPreposition ,
28+ nounAsPreposition ,
29+ preposition ,
30+ } from "./preposition.ts" ;
2331import { Place } from "./pronoun.ts" ;
2432import { PartialCompoundVerb , PartialVerb } from "./verb.ts" ;
2533import { word } from "./word.ts" ;
@@ -138,6 +146,7 @@ function adjectivePhrase(
138146 }
139147 }
140148}
149+ // TODO: extract "not"
141150function verbPhrase (
142151 options : Readonly < {
143152 emphasis : boolean ;
@@ -165,11 +174,11 @@ function verbPhrase(
165174 return {
166175 ...verb ,
167176 modal : {
168- adverb : fixAdverb ( [
177+ ...verb . modal ,
178+ preAdverb : fixAdverb ( [
169179 ...[ ...modifier . adverb ] . reverse ( ) ,
170- ...verb . modal . adverb ,
180+ ...verb . modal . preAdverb ,
171181 ] ) ,
172- verb : verb . modal . verb ,
173182 } ,
174183 phraseEmphasis : emphasis ,
175184 preposition,
@@ -229,21 +238,23 @@ function defaultPhrase(
229238 . addErrorWhenNone ( ( ) => new ExhaustedError ( Composer . phrase ( phrase ) ) ) ;
230239}
231240function prepositionAsVerb ( preposition : English . Preposition ) {
241+ const extracted = extractNegativeFromPreposition ( preposition ) ;
232242 return {
233243 modal : null ,
234244 adverb : [ ] ,
235245 first : {
236246 presentPlural : "are" ,
237247 presentSingular : "is" ,
238248 past : "were" ,
249+ negated : extracted != null ,
239250 } ,
240251 reduplicationCount : 1 ,
241252 wordEmphasis : false ,
242253 rest : [ ] ,
243254 subjectComplement : null ,
244255 object : null ,
245256 objectComplement : null ,
246- preposition : [ preposition ] ,
257+ preposition : [ extracted ?? preposition ] ,
247258 forObject : false ,
248259 predicateType : null ,
249260 phraseEmphasis : false ,
@@ -336,20 +347,27 @@ export function phraseAsVerb(
336347 switch ( phrase . type ) {
337348 case "noun" :
338349 case "adjective" : {
350+ let negated : boolean ;
339351 let subjectComplement : English . Complement ;
340352 switch ( phrase . type ) {
341- case "noun" :
353+ case "noun" : {
354+ const extract = extractNegativeFromNoun ( phrase . noun ) ;
355+ negated = extract != null ;
342356 subjectComplement = {
343357 type : "noun" ,
344- noun : phrase . noun ,
358+ noun : extract ?? phrase . noun ,
345359 } ;
346360 break ;
347- case "adjective" :
361+ }
362+ case "adjective" : {
363+ const extract = extractNegativeFromAdjective ( phrase . adjective ) ;
364+ negated = extract != null ;
348365 subjectComplement = {
349366 type : "adjective" ,
350- adjective : phrase . adjective ,
367+ adjective : extract ?? phrase . adjective ,
351368 } ;
352369 break ;
370+ }
353371 }
354372 return {
355373 type : "simple" ,
@@ -359,6 +377,7 @@ export function phraseAsVerb(
359377 presentPlural : "are" ,
360378 presentSingular : "is" ,
361379 past : "were" ,
380+ negated,
362381 } ,
363382 wordEmphasis : false ,
364383 reduplicationCount : 1 ,
0 commit comments