Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit01f2172

Browse files
committed
Allow "'" symbol in affixes ("'s" affix in english): it was diallowed during
multibyte support work.Add line number to error output during affix file parsing.
1 parent12fca1f commit01f2172

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

‎contrib/tsearch2/ispell/spell.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ NIAddAffix(IspellDict * Conf, int flag, char flagflags, const char *mask, const
306306
#definePAE_INREPL 5
307307

308308
staticbool
309-
parse_affentry(char*str,char*mask,char*find,char*repl ) {
309+
parse_affentry(char*str,char*mask,char*find,char*repl,intline ) {
310310
intstate=PAE_WAIT_MASK;
311311
char*pmask=mask,*pfind=find,*prepl=repl;
312312

@@ -332,12 +332,12 @@ parse_affentry( char *str, char *mask, char *find, char *repl ) {
332332
}elseif (state==PAE_WAIT_FIND ) {
333333
if (t_iseq(str,'-') ) {
334334
state=PAE_INFIND;
335-
}elseif (t_isalpha(str)) {
335+
}elseif (t_isalpha(str)||t_iseq(str,'\'')/* english 's */) {
336336
COPYCHAR(prepl,str);
337337
prepl+=pg_mblen(str);
338338
state=PAE_INREPL;
339339
}elseif (!t_isspace(str))
340-
ts_error(ERROR,"Affix parse error");
340+
ts_error(ERROR,"Affix parse error at %d line",line);
341341
}elseif (state==PAE_INFIND ) {
342342
if (t_iseq(str,',') ) {
343343
*pfind='\0';
@@ -346,7 +346,7 @@ parse_affentry( char *str, char *mask, char *find, char *repl ) {
346346
COPYCHAR(pfind,str);
347347
pfind+=pg_mblen(str);
348348
}elseif (!t_isspace(str))
349-
ts_error(ERROR,"Affix parse error");
349+
ts_error(ERROR,"Affix parse error at %d line",line);
350350
}elseif (state==PAE_WAIT_REPL ) {
351351
if (t_iseq(str,'-') ) {
352352
break;/* void repl */
@@ -355,7 +355,7 @@ parse_affentry( char *str, char *mask, char *find, char *repl ) {
355355
prepl+=pg_mblen(str);
356356
state=PAE_INREPL;
357357
}elseif (!t_isspace(str))
358-
ts_error(ERROR,"Affix parse error");
358+
ts_error(ERROR,"Affix parse error at %d line",line);
359359
}elseif (state==PAE_INREPL ) {
360360
if (t_iseq(str,'#') ) {
361361
*prepl='\0';
@@ -364,7 +364,7 @@ parse_affentry( char *str, char *mask, char *find, char *repl ) {
364364
COPYCHAR(prepl,str);
365365
prepl+=pg_mblen(str);
366366
}elseif (!t_isspace(str))
367-
ts_error(ERROR,"Affix parse error");
367+
ts_error(ERROR,"Affix parse error at %d line",line);
368368
}else
369369
ts_error(ERROR,"Unknown state in parse_affentry: %d",state);
370370

@@ -390,13 +390,15 @@ NIImportAffixes(IspellDict * Conf, const char *filename)
390390
intflag=0;
391391
charflagflags=0;
392392
FILE*affix;
393+
intline=0;
393394

394395
if (!(affix=fopen(filename,"r")))
395396
return (1);
396397
Conf->compoundcontrol='\t';
397398

398399
while (fgets(str,sizeof(str),affix))
399400
{
401+
line++;
400402
pg_verifymbstr(str,strlen(str), false);
401403
memcpy(tmpstr,str,32);/* compoundwords... */
402404
tmpstr[32]='\0';
@@ -463,7 +465,7 @@ NIImportAffixes(IspellDict * Conf, const char *filename)
463465
continue;
464466

465467
lowerstr(str);
466-
if ( !parse_affentry(str,mask,find,repl) )
468+
if ( !parse_affentry(str,mask,find,repl,line) )
467469
continue;
468470

469471
NIAddAffix(Conf,flag,flagflags,mask,find,repl,suffixes ?FF_SUFFIX :FF_PREFIX);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp