Extend compile_line to include pronunciation data after a space (e.g. multi-word pronunciation replacements).

This commit is contained in:
Reece H. Dunn
2017-05-14 08:39:29 +01:00
parent 48ca2239bb
commit 05cab4f2dc
+9 -3
View File
@@ -369,7 +369,7 @@ typedef enum
LINE_PARSER_MULTIPLE_WORDS = 2,
LINE_PARSER_END_OF_WORDS = 3,
LINE_PARSER_PRONUNCIATION = 4,
LINE_PARSER_END = 5,
LINE_PARSER_END_OF_PRONUNCIATION = 5,
} LINE_PARSER_STATES;
static int compile_line(char *linebuf, char *dict_line, int *hash)
@@ -379,6 +379,7 @@ static int compile_line(char *linebuf, char *dict_line, int *hash)
char *p;
char *word;
char *phonetic;
char *phonetic_end;
unsigned int ix;
LINE_PARSER_STATES step;
unsigned int n_flag_codes = 0;
@@ -519,11 +520,16 @@ static int compile_line(char *linebuf, char *dict_line, int *hash)
break;
case LINE_PARSER_PRONUNCIATION:
if (isspace2(c)) {
phonetic_end = p;
p[0] = 0; // terminate phonetic
step = LINE_PARSER_END;
step = LINE_PARSER_END_OF_PRONUNCIATION;
}
break;
case LINE_PARSER_END:
case LINE_PARSER_END_OF_PRONUNCIATION:
if (!isspace2(c)) {
*phonetic_end = ' ';
step = LINE_PARSER_PRONUNCIATION;
}
break;
}
p++;