@@ -306,7 +306,7 @@ NIAddAffix(IspellDict * Conf, int flag, char flagflags, const char *mask, const
306
306
#define PAE_INREPL 5
307
307
308
308
static bool
309
- parse_affentry ( char * str , char * mask , char * find , char * repl ) {
309
+ parse_affentry ( char * str , char * mask , char * find , char * repl , int line ) {
310
310
int state = PAE_WAIT_MASK ;
311
311
char * pmask = mask , * pfind = find , * prepl = repl ;
312
312
@@ -332,12 +332,12 @@ parse_affentry( char *str, char *mask, char *find, char *repl ) {
332
332
} else if ( state == PAE_WAIT_FIND ) {
333
333
if ( t_iseq (str ,'-' ) ) {
334
334
state = PAE_INFIND ;
335
- } else if (t_isalpha (str )) {
335
+ } else if (t_isalpha (str ) || t_iseq ( str , '\'' ) /* english 's */ ) {
336
336
COPYCHAR (prepl ,str );
337
337
prepl += pg_mblen (str );
338
338
state = PAE_INREPL ;
339
339
} else if (!t_isspace (str ))
340
- ts_error (ERROR , "Affix parse error" );
340
+ ts_error (ERROR , "Affix parse error at %d line" , line );
341
341
} else if ( state == PAE_INFIND ) {
342
342
if ( t_iseq (str ,',' ) ) {
343
343
* pfind = '\0' ;
@@ -346,7 +346,7 @@ parse_affentry( char *str, char *mask, char *find, char *repl ) {
346
346
COPYCHAR (pfind ,str );
347
347
pfind += pg_mblen (str );
348
348
} else if (!t_isspace (str ))
349
- ts_error (ERROR , "Affix parse error" );
349
+ ts_error (ERROR , "Affix parse error at %d line" , line );
350
350
} else if ( state == PAE_WAIT_REPL ) {
351
351
if ( t_iseq (str ,'-' ) ) {
352
352
break ; /* void repl */
@@ -355,7 +355,7 @@ parse_affentry( char *str, char *mask, char *find, char *repl ) {
355
355
prepl += pg_mblen (str );
356
356
state = PAE_INREPL ;
357
357
} else if (!t_isspace (str ))
358
- ts_error (ERROR , "Affix parse error" );
358
+ ts_error (ERROR , "Affix parse error at %d line" , line );
359
359
} else if ( state == PAE_INREPL ) {
360
360
if ( t_iseq (str ,'#' ) ) {
361
361
* prepl = '\0' ;
@@ -364,7 +364,7 @@ parse_affentry( char *str, char *mask, char *find, char *repl ) {
364
364
COPYCHAR (prepl ,str );
365
365
prepl += pg_mblen (str );
366
366
} else if (!t_isspace (str ))
367
- ts_error (ERROR , "Affix parse error" );
367
+ ts_error (ERROR , "Affix parse error at %d line" , line );
368
368
} else
369
369
ts_error (ERROR , "Unknown state in parse_affentry: %d" , state );
370
370
@@ -390,13 +390,15 @@ NIImportAffixes(IspellDict * Conf, const char *filename)
390
390
int flag = 0 ;
391
391
char flagflags = 0 ;
392
392
FILE * affix ;
393
+ int line = 0 ;
393
394
394
395
if (!(affix = fopen (filename , "r" )))
395
396
return (1 );
396
397
Conf -> compoundcontrol = '\t' ;
397
398
398
399
while (fgets (str , sizeof (str ), affix ))
399
400
{
401
+ line ++ ;
400
402
pg_verifymbstr ( str , strlen (str ), false);
401
403
memcpy (tmpstr , str , 32 ); /* compoundwords... */
402
404
tmpstr [32 ]= '\0' ;
@@ -463,7 +465,7 @@ NIImportAffixes(IspellDict * Conf, const char *filename)
463
465
continue ;
464
466
465
467
lowerstr (str );
466
- if ( !parse_affentry (str , mask , find , repl ) )
468
+ if ( !parse_affentry (str , mask , find , repl , line ) )
467
469
continue ;
468
470
469
471
NIAddAffix (Conf , flag , flagflags , mask , find , repl , suffixes ? FF_SUFFIX : FF_PREFIX );
0 commit comments