cyrilic attributes
This commit is contained in:
+55
-16
@@ -37,7 +37,10 @@ namespace /* internal */
|
|||||||
|
|
||||||
enum TokenType
|
enum TokenType
|
||||||
{
|
{
|
||||||
ATTRIBUTE,
|
ATR_BIRTH,
|
||||||
|
ATR_DEATH,
|
||||||
|
ATR_PARENTS,
|
||||||
|
ATR_SPOUSES,
|
||||||
STRING,
|
STRING,
|
||||||
/* DATE, */
|
/* DATE, */
|
||||||
NUMBER,
|
NUMBER,
|
||||||
@@ -212,10 +215,43 @@ namespace /* internal */
|
|||||||
type = NEW_LINE;
|
type = NEW_LINE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(t.size() == 2)
|
else if(t.end[-1] == ':')
|
||||||
{
|
{
|
||||||
if(t.begin[1] == ':')
|
switch(t.begin[0])
|
||||||
type = ATTRIBUTE;
|
{
|
||||||
|
case 'b':
|
||||||
|
type = ATR_BIRTH;
|
||||||
|
break;
|
||||||
|
case 'd':
|
||||||
|
type = ATR_DEATH;
|
||||||
|
break;
|
||||||
|
case 'p':
|
||||||
|
type = ATR_PARENTS;
|
||||||
|
break;
|
||||||
|
case 's':
|
||||||
|
type = ATR_SPOUSES;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
U16 cyr = ((U8)t.begin[0] << 8) | (U8)t.begin[1]; /* assuming char signed? */
|
||||||
|
switch(cyr) /* check for cyrilic attribure */
|
||||||
|
{
|
||||||
|
case 'д':
|
||||||
|
type = ATR_BIRTH;
|
||||||
|
break;
|
||||||
|
case 'п':
|
||||||
|
type = ATR_DEATH;
|
||||||
|
break;
|
||||||
|
case 'р':
|
||||||
|
type = ATR_PARENTS;
|
||||||
|
break;
|
||||||
|
case 'с':
|
||||||
|
type = ATR_SPOUSES;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
err_illegal_attribute(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return type;
|
return type;
|
||||||
@@ -309,9 +345,19 @@ namespace /* internal */
|
|||||||
err_expected("sex", *it);
|
err_expected("sex", *it);
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
|
else if(it->size() == 2)
|
||||||
|
{
|
||||||
|
U16 cyr = ((U8)it->begin[0] << 8) | (U8)it->begin[1]; /* assuming char signed? */
|
||||||
|
if(cyr == 'М')
|
||||||
|
res = M;
|
||||||
|
else if(cyr == 'Ж')
|
||||||
|
res = F;
|
||||||
|
else
|
||||||
|
err_expected("sex", *it);
|
||||||
|
++it;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
err_expected("sex", *it);
|
err_expected("sex", *it);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
err_unexpected_token(*it);
|
err_unexpected_token(*it);
|
||||||
@@ -494,25 +540,18 @@ namespace /* internal */
|
|||||||
{
|
{
|
||||||
switch(it->type)
|
switch(it->type)
|
||||||
{
|
{
|
||||||
case ATTRIBUTE:
|
case ATR_BIRTH:
|
||||||
switch(it->begin[0])
|
|
||||||
{
|
|
||||||
case 'b':
|
|
||||||
birth = state_date(it); /* todo check for redefinition */
|
birth = state_date(it); /* todo check for redefinition */
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case ATR_DEATH:
|
||||||
death = state_date(it);
|
death = state_date(it);
|
||||||
break;
|
break;
|
||||||
case 'p':
|
case ATR_PARENTS:
|
||||||
parents = processParents(it, end);
|
parents = processParents(it, end);
|
||||||
break;
|
break;
|
||||||
case 's':
|
case ATR_SPOUSES:
|
||||||
spouses = parseSpouses(it, end);
|
spouses = parseSpouses(it, end);
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
err_illegal_attribute(*it);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case NEW_LINE:
|
case NEW_LINE:
|
||||||
++line;
|
++line;
|
||||||
++it;
|
++it;
|
||||||
|
|||||||
Reference in New Issue
Block a user