in vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/lang/reflect/parser/SignatureLexer2.java [66:435]
public Token nextToken() throws TokenStreamException {
if (ind >= sgntr.length()) {
return new MToken(MToken.EOF_TYPE, "the end");
}
if (DEBUGGING) {
//System.out.println("nextToken1:"+sgntr);
//System.out.println("nextToken1:"+sgntr.charAt(ind));
}
MToken theRetToken=null;
try {
switch ( sgntr.charAt(ind) ) {
case '*':
{
if (DEBUGGING) {
System.out.println(".............lex:STAR_SIGN:\""+String.valueOf(sgntr.charAt(ind))+"\"");
}
prevLexeme = STAR_SIGN;
theRetToken=new MToken(STAR_SIGN, "*");
ind++;
break;
}
case '+':
{
if (DEBUGGING) {
System.out.println(".............lex:PLUS_SIGN:\""+String.valueOf(sgntr.charAt(ind))+"\"");
}
prevLexeme = PLUS_SIGN;
theRetToken=new MToken(PLUS_SIGN, "+");
ind++;
break;
}
case '-':
{
if (DEBUGGING) {
System.out.println(".............lex:MINUS_SIGN:\""+String.valueOf(sgntr.charAt(ind))+"\"");
}
prevLexeme = MINUS_SIGN;
theRetToken=new MToken(MINUS_SIGN, "-");
ind++;
break;
}
case '[':
{
if (DEBUGGING) {
System.out.println(".............lex:SQUAREOPEN_SIGN:\""+String.valueOf(sgntr.charAt(ind))+"\"");
}
prevLexeme = SQUAREOPEN_SIGN;
theRetToken=new MToken(SQUAREOPEN_SIGN, "[");
ind++;
break;
}
case ':':
{
if (DEBUGGING) {
System.out.println(".............lex:COLON_SIGN:\""+String.valueOf(sgntr.charAt(ind))+"\"");
}
prevLexeme = COLON_SIGN;
theRetToken=new MToken(COLON_SIGN, ":");
ind++;
break;
}
case '.':
{
if (DEBUGGING) {
System.out.println(".............lex:DOT_OR_DOLLAR_SIGN:\""+String.valueOf(sgntr.charAt(ind))+"\"");
}
prevLexeme = DOT_OR_DOLLAR_SIGN;
theRetToken=new MToken(DOT_OR_DOLLAR_SIGN, ".");
ind++;
break;
}
case '<':
{
if (DEBUGGING) {
System.out.println(".............lex:TRIANGLEOPEN_SIGN:\""+String.valueOf(sgntr.charAt(ind))+"\"");
}
if (Lflag2 == 1) trnglsCount++;
prevLexeme = TRIANGLEOPEN_SIGN;
theRetToken=new MToken(TRIANGLEOPEN_SIGN, "<");
ind++;
break;
}
case '>':
{
if (DEBUGGING) {
System.out.println(".............lex:TRIANGLECLOSE_SIGN:\""+String.valueOf(sgntr.charAt(ind))+"\"");
}
if (Lflag2 == 1) trnglsCount--;
prevLexeme = TRIANGLECLOSE_SIGN;
theRetToken=new MToken(TRIANGLECLOSE_SIGN, ">");
ind++;
break;
}
case '^':
{
if (DEBUGGING) {
System.out.println(".............lex:CNTRL_SIGN:\""+String.valueOf(sgntr.charAt(ind))+"\"");
}
Lflag2 = 0;
prevLexeme = CNTRL_SIGN;
theRetToken=new MToken(CNTRL_SIGN, "^");
ind++;
break;
}
case ';':
{
if (DEBUGGING) {
System.out.println(".............lex:SEMICOLON_SIGN:\""+String.valueOf(sgntr.charAt(ind))+"\"");
}
if (Lflag2 == 1 && trnglsCount == 0) {
Lflag3 = 0;
}
prevLexeme = SEMICOLON_SIGN;
theRetToken=new MToken(SEMICOLON_SIGN, ";");
ind++;
break;
}
case '(':
{
if (DEBUGGING) {
System.out.println(".............lex:RINGOPEN_SIGN:\""+String.valueOf(sgntr.charAt(ind))+"\"");
}
Lflag2 = 1;
prevLexeme = RINGOPEN_SIGN;
theRetToken=new MToken(RINGOPEN_SIGN, "(");
ind++;
break;
}
case ')':
{
if (DEBUGGING) {
System.out.println(".............lex:RINGCLOSE_SIGN:\""+String.valueOf(sgntr.charAt(ind))+"\"");
}
prevLexeme = RINGCLOSE_SIGN;
theRetToken=new MToken(RINGCLOSE_SIGN, ")");
ind++;
break;
}
case 'V':
{
if (Lflag2 == 1 && trnglsCount == 0 && prevLexeme != PACKAGE_SPECIFIER && prevLexeme != DOT_OR_DOLLAR_SIGN) {
if (DEBUGGING) {
System.out.println(".............lex:VOIDTYPE" );
}
prevLexeme = VOIDTYPE;
theRetToken=new MToken(VOIDTYPE, "V");
ind++;
} else if (isID_COLON()){
ident = sgntr.substring(ind, ind+lexlen-1); // last ":" should be recovered in stream
if (DEBUGGING) {
System.out.println(".............lex:ID_COLON:\""+ident+"\"");
}
prevLexeme = ID_COLON;
ind += lexlen - 1;
theRetToken=new MToken(ID_COLON, ident);
} else if (isIDwoL()){
ident = sgntr.substring(ind, ind+lexlen);
if (DEBUGGING) {
System.out.println(".............lex:ID:\""+ident+"\"");
}
prevLexeme = ID;
ind += lexlen;
theRetToken=new MToken(ID, ident);
} else {
theRetToken=new MToken(MToken.INVALID_TYPE, "figvam");
throw new Exception();
}
break;
}
case 'B': case 'C':
case 'D': case 'F':
case 'I': case 'J':
case 'S': case 'Z':
{
if (Lflag2 == 1 && Lflag3 != 1 || prevLexeme == SQUAREOPEN_SIGN) {
if (DEBUGGING) {
System.out.println(".............lex:TBASE: \""+ String.valueOf(sgntr.charAt(ind))+"\"");
}
if (ind == sgntr.length()-1 || sgntr.charAt(ind+1) == '^'){
prevLexeme = RETURN_BASE_TYPE ;
theRetToken=new MToken(RETURN_BASE_TYPE , String.valueOf(sgntr.charAt(ind)));
} else {
prevLexeme = TBASE ;
theRetToken=new MToken(TBASE , String.valueOf(sgntr.charAt(ind)));
}
ind++;
} else if (isID_COLON()){
ident = sgntr.substring(ind, ind+lexlen-1); // last ":" should be recovered in stream
if (DEBUGGING) {
System.out.println(".............lex:ID_COLON:\""+ident+"\"");
}
prevLexeme = ID_COLON;
theRetToken=new MToken(ID_COLON, ident);
ind += lexlen - 1;
} else if (isIDwoL()){
ident = sgntr.substring(ind, ind+lexlen);
if (DEBUGGING) {
System.out.println(".............lex:ID:\""+ident+"\"");
}
prevLexeme = ID;
theRetToken=new MToken(ID, ident);
ind += lexlen;
} else {
theRetToken=new MToken(MToken.INVALID_TYPE, "figvam");
throw new Exception();
}
break;
}
case 'T':
{
if (isTV()) {
if (prevLexeme == PACKAGE_SPECIFIER || prevLexeme == DOT_OR_DOLLAR_SIGN) {
ident = sgntr.substring(ind, ind+lexlen-1);// - ";"
if (DEBUGGING) {
System.out.println(".............lex:ID:\""+ident+"\"");
}
prevLexeme = ID ;
theRetToken=new MToken(ID , ident);
ind += lexlen - 1;
} else {
ident = sgntr.substring(ind, ind+lexlen);
if (DEBUGGING) {
System.out.println(".............lex:TVAR:\""+ident+"\"");
}
prevLexeme = TVAR;
theRetToken=new MToken(TVAR, ident);
ind += lexlen;
}
} else if (isID_COLON()){
ident = sgntr.substring(ind, ind+lexlen-1); // last ":" should be recovered in stream
if (DEBUGGING) {
System.out.println(".............lex:ID_COLON:\""+ident+"\"");
}
prevLexeme = ID_COLON;
theRetToken=new MToken(ID_COLON, ident);
ind += lexlen - 1;
} else if (isIDwoL()){
ident = sgntr.substring(ind, ind+lexlen);
if (DEBUGGING) {
System.out.println(".............lex:ID:\""+ident+"\"");
}
prevLexeme = ID;
theRetToken=new MToken(ID, ident);
ind += lexlen;
} else {
theRetToken=new MToken(MToken.INVALID_TYPE, "figvam");
throw new Exception();
}
break;
}
case 'L':
{
if (isPACKAGE_SPECIFIER()) {
ident = sgntr.substring(ind, ind+lexlen);
if (DEBUGGING) {
System.out.println(".............lex:PACKAGE_SPECIFIER:\""+ident+"\"");
}
if (Lflag2 == 1) {
Lflag3 = 1;
}
prevLexeme = PACKAGE_SPECIFIER ;
theRetToken=new MToken(PACKAGE_SPECIFIER , ident);
ind += lexlen;
} else if (isID_COLON()){
ident = sgntr.substring(ind, ind+lexlen-1); // last ":" should be recovered in stream
if (DEBUGGING) {
System.out.println(".............lex:ID_COLON:\""+ident+"\"");
}
prevLexeme = ID_COLON;
theRetToken=new MToken(ID_COLON, ident);
ind += lexlen - 1;
} else if (isIDwL()){
ident = sgntr.substring(ind, ind+lexlen);
if (DEBUGGING) {
System.out.println(".............lex:ID:\""+ident+"\"");
}
prevLexeme = ID;
theRetToken=new MToken(ID, ident);
ind += lexlen;
} else {
theRetToken=new MToken(MToken.INVALID_TYPE, "figvam");
throw new Exception();
}
break;
}
case '$':
{
if (prevLexeme == TRIANGLECLOSE_SIGN) {
if (DEBUGGING) {
System.out.println(".............lex:DOT_OR_DOLLAR_SIGN:\""+String.valueOf(sgntr.charAt(ind))+"\"");
}
prevLexeme = DOT_OR_DOLLAR_SIGN;
theRetToken=new MToken(DOT_OR_DOLLAR_SIGN, "$");
ind++;
} else if (isID_COLON()){
ident = sgntr.substring(ind, ind+lexlen-1); // last ":" should be recovered in stream
if (DEBUGGING) {
System.out.println(".............lex:ID_COLON:\""+ident+"\"");
}
prevLexeme = ID_COLON;
theRetToken=new MToken(ID_COLON, ident);
ind += lexlen - 1;
} else if (isIDwoL()){
ident = sgntr.substring(ind, ind+lexlen);
if (DEBUGGING) {
System.out.println(".............lex:ID:\""+ident+"\"");
}
prevLexeme = ID;
theRetToken=new MToken(ID, ident);
ind += lexlen;
} else {
theRetToken=new MToken(MToken.INVALID_TYPE, "figvam");
throw new Exception();
}
break;
}
case 'A': case 'E': case 'G': case 'H':
case 'K': case 'M': case 'N': case 'O':
case 'P': case 'Q': case 'R': case 'U':
case 'W': case 'X': case 'Y': case '\\':
case '_': case 'a': case 'b': case 'c':
case 'd': case 'e': case 'f': case 'g':
case 'h': case 'i': case 'j': case 'k':
case 'l': case 'm': case 'n': case 'o':
case 'p': case 'q': case 'r': case 's':
case 't': case 'u': case 'v': case 'w':
case 'x': case 'y': case 'z':
{
if (isID_COLON()){
ident = sgntr.substring(ind, ind+lexlen-1); // last ":" should be recovered in stream
if (DEBUGGING) {
System.out.println(".............lex:ID_COLON:\""+ident+"\"");
}
prevLexeme = ID_COLON;
theRetToken=new MToken(ID_COLON, ident);
ind += lexlen - 1;
} else if (isIDwoL()){
ident = sgntr.substring(ind, ind+lexlen);
if (DEBUGGING) {
System.out.println(".............lex:ID:\""+ident+"\"");
}
prevLexeme = ID;
theRetToken=new MToken(ID, ident);
ind += lexlen;
} else {
theRetToken=new MToken(MToken.INVALID_TYPE, "figvam");
throw new Exception();
}
break;
}
default:
{
theRetToken=new MToken(MToken.INVALID_TYPE, "figvam");
throw new Exception();
}
}
if (DEBUGGING) {
//new Throwable().printStackTrace();
System.out.println("------------nextToken2:\""+theRetToken.getText()+"\"");
//System.out.println("nextToken2:"+theRetToken.getType());
//System.out.println("nextToken2:"+ind);
}
return theRetToken;
}
catch (Exception e) {
/**/e.printStackTrace();
/**/System.err.println("===nextToken===: "+e.toString());
throw new TokenStreamException(e.getMessage());
}
}