@@ -257,7 +257,7 @@ const checkedNoun = new CheckedParser(
257257 ) ,
258258 noun ,
259259) ;
260- function simpleDefinitionWith < T > (
260+ function checkedSimpleUnitWith < T > (
261261 tag : Parser < unknown > ,
262262 after : Parser < T > ,
263263) : CheckedParser < readonly [ string , T ] > {
@@ -266,30 +266,33 @@ function simpleDefinitionWith<T>(
266266 closeParenthesis . with ( after ) ,
267267 ) ;
268268}
269- function simpleDefinition ( tag : Parser < unknown > ) : CheckedParser < string > {
270- return simpleDefinitionWith ( tag , nothing ) . map ( ( [ word ] ) => word ) ;
269+ function checkedSimpleUnit ( tag : Parser < unknown > ) : CheckedParser < string > {
270+ return checkedSimpleUnitWith ( tag , nothing ) . map ( ( [ word ] ) => word ) ;
271271}
272- function simpleDefinitionWithTemplate (
272+ function checkedSimpleUnitWithTemplate (
273273 tag : Parser < unknown > ,
274274 templateInside : Parser < unknown > ,
275275) : CheckedParser < string > {
276- return simpleDefinitionWith ( tag , template ( templateInside ) )
276+ return checkedSimpleUnitWith ( tag , template ( templateInside ) )
277277 . map ( ( [ word ] ) => word ) ;
278278}
279- const interjectionDefinition = simpleDefinition ( keyword ( "i" ) )
279+ const interjectionDefinition = checkedSimpleUnit ( keyword ( "i" ) )
280280 . map ( ( interjection ) => ( { type : "interjection" , interjection } ) as const ) ;
281- const particleDefinition = simpleDefinition (
282- sequence ( keyword ( "particle" ) , keyword ( "def" ) ) ,
281+ const particleDefinition = checkedSequence (
282+ word . skip ( openParenthesis ) . skip ( keyword ( "particle" ) ) ,
283+ sequence ( keyword ( "def" ) , closeParenthesis ) ,
283284)
284- . map ( ( definition ) => ( { type : "particle definition" , definition } ) as const ) ;
285- const adverbDefinition = simpleDefinition ( keyword ( "adv" ) )
285+ . map ( ( [ definition ] ) =>
286+ ( { type : "particle definition" , definition } ) as const
287+ ) ;
288+ const adverbDefinition = checkedSimpleUnit ( keyword ( "adv" ) )
286289 . map ( ( adverb ) => ( { type : "adverb" , adverb } ) as const ) ;
287- const prepositionDefinition = simpleDefinitionWithTemplate (
290+ const prepositionDefinition = checkedSimpleUnitWithTemplate (
288291 keyword ( "prep" ) ,
289292 sequence ( keyword ( "indirect" ) , keyword ( "object" ) ) ,
290293)
291294 . map ( ( preposition ) => ( { type : "preposition" , preposition } ) as const ) ;
292- const numeralDefinition = simpleDefinition ( keyword ( "num" ) )
295+ const numeralDefinition = checkedSimpleUnit ( keyword ( "num" ) )
293296 . mapWithPositionedError ( ( num ) => {
294297 const numeral = Number . parseInt ( num ) ;
295298 if ( Number . isNaN ( numeral ) ) {
@@ -394,7 +397,7 @@ const nounDefinition = new CheckedParser(
394397 sequence (
395398 noun ,
396399 optionalWithCheck (
397- simpleDefinitionWithTemplate ( keyword ( "prep" ) , keyword ( "headword" ) ) ,
400+ checkedSimpleUnitWithTemplate ( keyword ( "prep" ) , keyword ( "headword" ) ) ,
398401 ) ,
399402 ) ,
400403)
@@ -430,7 +433,7 @@ const verbDefinition = checkedSequence(
430433 sequence ( closeParenthesis , openBracket , keyword ( "object" ) ) ,
431434 closeBracket
432435 . with ( optionalWithCheck (
433- simpleDefinitionWith ( keyword ( "prep" ) , noun )
436+ checkedSimpleUnitWith ( keyword ( "prep" ) , noun )
434437 . map ( ( [ preposition , object ] ) => ( { preposition, object } ) as const ) ,
435438 ) )
436439 . map ( nullableAsArray ) ,
@@ -474,7 +477,7 @@ const verbDefinition = checkedSequence(
474477 optionalWithCheck ( checkedNoun ) ,
475478 ) ,
476479 optionalWithCheck (
477- simpleDefinitionWith (
480+ checkedSimpleUnitWith (
478481 keyword ( "prep" ) ,
479482 choiceWithCheck < "template" | Noun > (
480483 checkedSequence (
0 commit comments