octal2 = octal3;
octal3 = (char)next_char;
}
}
t = new char_token
(
sym.CH,
(char)Integer.parseInt
( new String
( new char[]{octal1, octal2, octal3} ),
8
)
);
}
else if( (char)next_char == 'x' )
{
// Hexadecimal character
advance();
char hex1 = '0';
char hex2 = (char)next_char;
if( isHexLetterOrDigit( (char)next_char2 ) )
{
advance();
hex1 = hex2;
hex2 = (char)next_char;
}
else if( (char)next_char2 != '\'' )
{
emit_error( "Illegal hex character" );
return null;
}
t = new char_token
(
sym.CH,
(char)Integer.parseInt
( new String
( new char[]{hex1, hex2} ),
16
)
);
}
else if( (char)next_char == 'u' )
{
if( wide == false )
{
emit_error( "Unicode characters are only legal with wide character" );
return null;
}
else
{
// Hexadecimal character
advance();
char uni1 = '0';
char uni2 = '0';
char uni3 = '0';
char uni4 = (char)next_char;
if( isHexLetterOrDigit( (char)next_char2 ) )
{
advance();
uni3 = uni4;
uni4 = (char)next_char;
if( isHexLetterOrDigit( (char)next_char2 ) )
{
advance();
uni2 = uni3;
uni3 = uni4;
uni4 = (char)next_char;
if( isHexLetterOrDigit( (char)next_char2 ) )
{
advance();
uni1 = uni2;
uni2 = uni3;
uni3 = uni4;
uni4 = (char)next_char;
}
else if( (char)next_char2 != '\'' )
{
emit_error( "Illegal unicode character" );
return null;
}
}
else if( (char)next_char2 != '\'' )
{
emit_error( "Illegal unicode character" );
return null;
}
}
else if( (char)next_char2 != '\'' )
{
emit_error( "Illegal unicode character" );
return null;
}
t = new char_token
(
sym.CH,
(char)Integer.parseInt
( new String
( new char[]{uni1, uni2, uni3, uni4} ),
16
)
);
}
}
else
{
switch( next_char )
{
case 'n':
{
t = new char_token( sym.CH, '\n' );
break;
}
case 't':
{
t = new char_token( sym.CH, '\t' );
break;
}
case 'v':
{
t = new char_token( sym.CH, '\013' );
break;
}
case 'b':
{
t = new char_token( sym.CH, '\b' );
break;
}
case 'r':
{
t = new char_token( sym.CH, '\r' );
break;
}
case 'f':
{
t = new char_token( sym.CH, '\f' );
break;
}
case 'a':
{
t = new char_token( sym.CH, '\007' );
break;
}
case '\\':
{
t = new char_token( sym.CH, '\\' );
break;
}
case '?':
{
t = new char_token( sym.CH, '?' );
break;
}
case '0':
{
t = new char_token( sym.CH, '\0' );
break;
}
case '\'':
{
t = new char_token( sym.CH, '\'' );
break;
}
case '\"':
{
t = new char_token( sym.CH, '\"' );
break;
}
default:
{
emit_error( "Invalid escape symbol \'" );
return null;
}
}
}
}
else
{
t = new char_token( sym.CH, (char)next_char );
}
advance();
if( (char)next_char == '\'' )
{