#define PAE_INREPL 5
static bool
-parse_affentry( char *str, char *mask, char *find, char *repl ) {
+parse_affentry( char *str, char *mask, char *find, char *repl, int line ) {
int state = PAE_WAIT_MASK;
char *pmask=mask, *pfind=find, *prepl=repl;
} else if ( state == PAE_WAIT_FIND ) {
if ( t_iseq(str,'-') ) {
state = PAE_INFIND;
- } else if (t_isalpha(str)) {
+ } else if (t_isalpha(str) || t_iseq(str,'\'') /* english 's */) {
COPYCHAR(prepl,str);
prepl += pg_mblen(str);
state = PAE_INREPL;
} else if (!t_isspace(str))
- ts_error(ERROR, "Affix parse error");
+ ts_error(ERROR, "Affix parse error at %d line", line);
} else if ( state == PAE_INFIND ) {
if ( t_iseq(str,',') ) {
*pfind='\0';
COPYCHAR(pfind,str);
pfind += pg_mblen(str);
} else if (!t_isspace(str))
- ts_error(ERROR, "Affix parse error");
+ ts_error(ERROR, "Affix parse error at %d line", line);
} else if ( state == PAE_WAIT_REPL ) {
if ( t_iseq(str,'-') ) {
break; /* void repl */
prepl += pg_mblen(str);
state = PAE_INREPL;
} else if (!t_isspace(str))
- ts_error(ERROR, "Affix parse error");
+ ts_error(ERROR, "Affix parse error at %d line", line);
} else if ( state == PAE_INREPL ) {
if ( t_iseq(str,'#') ) {
*prepl = '\0';
COPYCHAR(prepl,str);
prepl += pg_mblen(str);
} else if (!t_isspace(str))
- ts_error(ERROR, "Affix parse error");
+ ts_error(ERROR, "Affix parse error at %d line", line);
} else
ts_error(ERROR, "Unknown state in parse_affentry: %d", state);
int flag = 0;
char flagflags = 0;
FILE *affix;
+ int line=0;
if (!(affix = fopen(filename, "r")))
return (1);
while (fgets(str, sizeof(str), affix))
{
+ line++;
pg_verifymbstr( str, strlen(str), false);
memcpy(tmpstr, str, 32); /* compoundwords... */
tmpstr[32]='\0';
continue;
lowerstr(str);
- if ( !parse_affentry(str, mask, find, repl) )
+ if ( !parse_affentry(str, mask, find, repl, line) )
continue;
NIAddAffix(Conf, flag, flagflags, mask, find, repl, suffixes ? FF_SUFFIX : FF_PREFIX);