private IToken MatchUnicode()
{
Consume();
char[] chars = new char[4];
if (!IsUnicodeLetter(c))
{
NoViableAltException e = new NoViableAltException(string.Empty, 0, 0, input);
errMgr.LexerError(input.SourceName,string.Format( "invalid unicode char: '{0}'", GetCharString(c)), templateToken, e);
}
chars[0] = c;
Consume();
if (!IsUnicodeLetter(c))
{
NoViableAltException e = new NoViableAltException(string.Empty, 0, 0, input);
errMgr.LexerError(input.SourceName, string.Format("invalid unicode char: '{0}'", GetCharString(c)), templateToken, e);
}
chars[1] = c;
Consume();
if (!IsUnicodeLetter(c))
{
NoViableAltException e = new NoViableAltException(string.Empty, 0, 0, input);
errMgr.LexerError(input.SourceName, string.Format("invalid unicode char: '{0}'", GetCharString(c)), templateToken, e);
}
chars[2] = c;
Consume();
if (!IsUnicodeLetter(c))
{
NoViableAltException e = new NoViableAltException(string.Empty, 0, 0, input);
errMgr.LexerError(input.SourceName, string.Format("invalid unicode char: '{0}'", GetCharString(c)), templateToken, e);
}
chars[3] = c;
// ESCAPE kills >
char uc = (char)int.Parse(new string(chars), NumberStyles.HexNumber);
IToken t = NewToken(TEXT, uc.ToString(), input.CharPositionInLine - 6);
Consume();
Match(delimiterStopChar);
return t;
}