@@ -66,7 +66,7 @@ const properWords = allAtLeastOnce(
66
66
match ( / [ A - Z ] [ a - z A - Z ] * / , "proper word" ) . skip ( spaces ) ,
67
67
)
68
68
. map ( ( array ) => array . join ( " " ) )
69
- . map ( ( words ) => ( { type : "proper word" , words, kind : "latin" } ) ) ;
69
+ . map ( ( words ) => ( { type : "proper word" , words, kind : "latin" } ) ) ;
70
70
71
71
const specificWord = memoize ( ( thatWord : string ) =>
72
72
word . filter ( ( thisWord ) =>
@@ -76,7 +76,7 @@ const specificWord = memoize((thatWord: string) =>
76
76
) ;
77
77
const multipleA = specificWord ( "a" )
78
78
. with ( count ( allAtLeastOnce ( specificWord ( "a" ) ) ) )
79
- . map ( ( count ) => ( { type : "multiple a" , count : count + 1 } ) ) ;
79
+ . map ( ( count ) => ( { type : "multiple a" , count : count + 1 } ) ) ;
80
80
const repeatingLetter = match ( / [ a - z A - Z ] / , "latin letter" )
81
81
. then ( memoize ( ( letter ) =>
82
82
count ( all ( matchString ( letter ) ) )
@@ -87,15 +87,15 @@ const longWord = allAtLeastOnce(repeatingLetter)
87
87
. map ( ( letters ) => {
88
88
const word = letters . map ( ( [ letter ] ) => letter ) . join ( "" ) ;
89
89
const length = sumOf ( letters , ( [ _ , count ] ) => count ) - word . length + 1 ;
90
- return { type : "long word" , word, length } ;
90
+ return { type : "long word" , word, length } ;
91
91
} )
92
92
. filter ( ( { word, length } ) => / ^ [ a - z ] / . test ( word ) && length > 1 ) ;
93
93
94
94
const alaX = memoize ( ( word : string ) =>
95
95
sequence ( specificWord ( "ala" ) , specificWord ( word ) ) . map ( ( ) => word )
96
96
) ;
97
97
const xAlaX = lazy ( ( ) => settings . xAlaXPartialParsing ? empty : word . then ( alaX ) )
98
- . map ( ( word ) => ( { type : "x ala x" , word } ) ) ;
98
+ . map ( ( word ) => ( { type : "x ala x" , word } ) ) ;
99
99
const punctuation = choiceOnlyOne (
100
100
allAtLeastOnce (
101
101
match ( SENTENCE_TERMINATOR , "punctuation" )
@@ -105,7 +105,7 @@ const punctuation = choiceOnlyOne(
105
105
. map ( ( punctuation ) => punctuation . join ( "" ) . replaceAll ( "..." , ELLIPSIS ) ) ,
106
106
newline . map ( ( ) => "." ) ,
107
107
)
108
- . map ( ( punctuation ) => ( { type : "punctuation" , punctuation } ) ) ;
108
+ . map ( ( punctuation ) => ( { type : "punctuation" , punctuation } ) ) ;
109
109
const cartoucheElement = choiceOnlyOne (
110
110
singleUcsurWord
111
111
. skip ( match ( NSK_COLON , "full width colon" ) . skip ( spaces ) ) ,
@@ -141,13 +141,11 @@ const cartouche = specificSpecialUcsur(START_OF_CARTOUCHE)
141
141
) ;
142
142
const cartouches = allAtLeastOnce ( cartouche )
143
143
. map ( ( words ) => words . join ( " " ) )
144
- . map ( ( words ) =>
145
- ( {
146
- type : "proper word" ,
147
- words,
148
- kind : "cartouche" ,
149
- } )
150
- ) ;
144
+ . map ( ( words ) => ( {
145
+ type : "proper word" ,
146
+ words,
147
+ kind : "cartouche" ,
148
+ } ) ) ;
151
149
const longSpaceContainer = specificSpecialUcsur ( START_OF_LONG_GLYPH )
152
150
. with ( count ( spacesWithoutNewline ) . filter ( ( length ) => length > 0 ) )
153
151
. skip ( specificSpecialUcsur ( END_OF_LONG_GLYPH ) )
@@ -160,36 +158,34 @@ const spaceLongGlyph = sequence(
160
158
longGlyphHead ,
161
159
longSpaceContainer ,
162
160
)
163
- . map ( ( [ words , spaceLength ] ) =>
164
- ( {
165
- type : "space long glyph" ,
166
- words,
167
- spaceLength,
168
- } )
169
- ) ;
161
+ . map ( ( [ words , spaceLength ] ) => ( {
162
+ type : "space long glyph" ,
163
+ words,
164
+ spaceLength,
165
+ } ) ) ;
170
166
const headedLongGlyphStart = longGlyphHead
171
167
. skip ( specificSpecialUcsur ( START_OF_LONG_GLYPH ) )
172
168
. skip ( spaces )
173
- . map ( ( words ) => ( { type : "headed long glyph start" , words } ) ) ;
169
+ . map ( ( words ) => ( { type : "headed long glyph start" , words } ) ) ;
174
170
const headlessLongGlyphEnd = specificSpecialUcsur ( END_OF_LONG_GLYPH )
175
171
. skip ( spaces )
176
- . map ( ( ) => ( { type : "headless long glyph end" } ) ) ;
172
+ . map ( ( ) => ( { type : "headless long glyph end" } ) ) ;
177
173
const headlessLongGlyphStart = specificSpecialUcsur ( START_OF_REVERSE_LONG_GLYPH )
178
174
. skip ( spaces )
179
- . map ( ( ) => ( { type : "headless long glyph end" } ) ) ;
175
+ . map ( ( ) => ( { type : "headless long glyph end" } ) ) ;
180
176
const headedLongGlyphEnd = specificSpecialUcsur ( END_OF_REVERSE_LONG_GLYPH )
181
177
. with ( longGlyphHead )
182
178
. skip ( spaces )
183
- . map ( ( words ) => ( { type : "headed long glyph start" , words } ) ) ;
179
+ . map ( ( words ) => ( { type : "headed long glyph start" , words } ) ) ;
184
180
const insideLongGlyph = specificSpecialUcsur ( END_OF_REVERSE_LONG_GLYPH )
185
181
. with ( longGlyphHead )
186
182
. skip ( specificSpecialUcsur ( START_OF_LONG_GLYPH ) )
187
183
. skip ( spaces )
188
- . map ( ( words ) => ( { type : "inside long glyph" , words } ) ) ;
184
+ . map ( ( words ) => ( { type : "inside long glyph" , words } ) ) ;
189
185
const combinedGlyphsToken = combinedGlyphs
190
186
. skip ( spaces )
191
- . map ( ( words ) => ( { type : "combined glyphs" , words } ) ) ;
192
- const wordToken = word . map ( ( word ) => ( { type : "word" , word } ) ) ;
187
+ . map ( ( words ) => ( { type : "combined glyphs" , words } ) ) ;
188
+ const wordToken = word . map ( ( word ) => ( { type : "word" , word } ) ) ;
193
189
194
190
export const token : Parser < Token > = choiceOnlyOne < Token > (
195
191
xAlaX ,
0 commit comments