This commit is contained in:
Reece Dunn
2011-12-17 08:13:34 +00:00
parent 5cd9f9217e
commit 5c06650486
101 changed files with 1049 additions and 541 deletions
+35 -1
View File
@@ -879,6 +879,18 @@ static int group3_ix;
int isHexDigit(int c)
{
if((c >= '0') && (c <= '9'))
return(c - '0');
if((c >= 'a') && (c <= 'f'))
return(c - 'a' + 10);
if((c >= 'A') && (c <= 'F'))
return(c - 'A' + 10);
return(-1);
}
static void copy_rule_string(char *string, int &state)
{//===================================================
// state 0: conditional, 1=pre, 2=match, 3=post, 4=phonemes
@@ -889,9 +901,11 @@ static void copy_rule_string(char *string, int &state)
int ix;
int len;
char c;
int c2, c3;
int sxflags;
int value;
int literal;
int hexdigit_input = 0;
MNEM_TAB *mr;
if(string[0] == 0) return;
@@ -911,18 +925,38 @@ static void copy_rule_string(char *string, int &state)
{
literal = 0;
c = *p++;
if((c == '0') && (p[0] == 'x') && (isHexDigit(p[1]) >= 0) && (isHexDigit(p[2]) >= 0))
{
hexdigit_input = 1;
c = p[1];
p+= 2;
}
if(c == '\\')
{
c = *p++; // treat next character literally
//#ifdef deleted
if((c >= '0') && (c <= '3') && (p[0] >= '0') && (p[0] <= '7') && (p[1] >= '0') && (p[1] <= '7'))
{
// character code given by 3 digit octal value;
c = (c-'0')*64 + (p[0]-'0')*8 + (p[1]-'0');
p += 2;
}
//endif
literal = 1;
}
if(hexdigit_input)
{
if(((c2 = isHexDigit(c)) >= 0) && ((c3 = isHexDigit(p[0])) >= 0))
{
c = c2 * 16 + c3;
literal = 1;
p++;
}
else
{
hexdigit_input = 0;
}
}
if((state==1) || (state==3))
{
// replace special characters (note: 'E' is reserved for a replaced silent 'e')