FileDocCategorySizeDatePackage
Yylex.javaAPI DocAzureus 3.0.3.411203Mon Jun 04 17:43:56 BST 2007org.json.simple.parser

Yylex

public class Yylex extends Object

Fields Summary
private final int
YY_BUFFER_SIZE
private final int
YY_F
private final int
YY_NO_STATE
private final int
YY_NOT_ACCEPT
private final int
YY_START
private final int
YY_END
private final int
YY_NO_ANCHOR
private final int
YY_BOL
private final int
YY_EOF
private StringBuffer
sb
private BufferedReader
yy_reader
private int
yy_buffer_index
private int
yy_buffer_read
private int
yy_buffer_start
private int
yy_buffer_end
private char[]
yy_buffer
private boolean
yy_at_bol
private int
yy_lexical_state
private boolean
yy_eof_done
private final int
YYINITIAL
private final int
STRING_BEGIN
private final int[]
yy_state_dtrans
private boolean
yy_last_was_cr
private final int
YY_E_INTERNAL
private final int
YY_E_MATCH
private String[]
yy_error_string
private int[]
yy_acpt
private int[]
yy_cmap
private int[]
yy_rmap
private int[]
yy_nxt
Constructors Summary
Yylex(Reader reader)


	   
		this ();
		if (null == reader) {
			throw (new Error("Error: Bad input stream initializer."));
		}
		yy_reader = new java.io.BufferedReader(reader);
	
Yylex(InputStream instream)

		this ();
		if (null == instream) {
			throw (new Error("Error: Bad input stream initializer."));
		}
		yy_reader = new java.io.BufferedReader(new java.io.InputStreamReader(instream));
	
private Yylex()

		yy_buffer = new char[YY_BUFFER_SIZE];
		yy_buffer_read = 0;
		yy_buffer_index = 0;
		yy_buffer_start = 0;
		yy_buffer_end = 0;
		yy_at_bol = true;
		yy_lexical_state = YYINITIAL;
	
Methods Summary
private int[][]unpackFromString(int size1, int size2, java.lang.String st)

		int colonIndex = -1;
		String lengthString;
		int sequenceLength = 0;
		int sequenceInteger = 0;

		int commaIndex;
		String workString;

		int res[][] = new int[size1][size2];
		for (int i= 0; i < size1; i++) {
			for (int j= 0; j < size2; j++) {
				if (sequenceLength != 0) {
					res[i][j] = sequenceInteger;
					sequenceLength--;
					continue;
				}
				commaIndex = st.indexOf(',");
				workString = (commaIndex==-1) ? st :
					st.substring(0, commaIndex);
				st = st.substring(commaIndex+1);
				colonIndex = workString.indexOf(':");
				if (colonIndex == -1) {
					res[i][j]=Integer.parseInt(workString);
					continue;
				}
				lengthString =
					workString.substring(colonIndex+1);
				sequenceLength=Integer.parseInt(lengthString);
				workString=workString.substring(0,colonIndex);
				sequenceInteger=Integer.parseInt(workString);
				res[i][j] = sequenceInteger;
				sequenceLength--;
			}
		}
		return res;
	
private intyy_advance()

		int next_read;
		int i;
		int j;

		if (yy_buffer_index < yy_buffer_read) {
			return yy_buffer[yy_buffer_index++];
		}

		if (0 != yy_buffer_start) {
			i = yy_buffer_start;
			j = 0;
			while (i < yy_buffer_read) {
				yy_buffer[j] = yy_buffer[i];
				++i;
				++j;
			}
			yy_buffer_end = yy_buffer_end - yy_buffer_start;
			yy_buffer_start = 0;
			yy_buffer_read = j;
			yy_buffer_index = j;
			next_read = yy_reader.read(yy_buffer,
					yy_buffer_read,
					yy_buffer.length - yy_buffer_read);
			if (-1 == next_read) {
				return YY_EOF;
			}
			yy_buffer_read = yy_buffer_read + next_read;
		}

		while (yy_buffer_index >= yy_buffer_read) {
			if (yy_buffer_index >= yy_buffer.length) {
				yy_buffer = yy_double(yy_buffer);
			}
			next_read = yy_reader.read(yy_buffer,
					yy_buffer_read,
					yy_buffer.length - yy_buffer_read);
			if (-1 == next_read) {
				return YY_EOF;
			}
			yy_buffer_read = yy_buffer_read + next_read;
		}
		return yy_buffer[yy_buffer_index++];
	
private char[]yy_double(char[] buf)

		int i;
		char newbuf[];
		newbuf = new char[2*buf.length];
		for (i = 0; i < buf.length; ++i) {
			newbuf[i] = buf[i];
		}
		return newbuf;
	
private voidyy_error(int code, boolean fatal)

	      
		java.lang.System.out.print(yy_error_string[code]);
		java.lang.System.out.flush();
		if (fatal) {
			throw new Error("Fatal Error.\n");
		}
	
private voidyy_mark_end()

		yy_buffer_end = yy_buffer_index;
	
private voidyy_mark_start()

	    
		yy_buffer_start = yy_buffer_index;
	
private voidyy_move_end()

		if (yy_buffer_end > yy_buffer_start &&
		    '\n" == yy_buffer[yy_buffer_end-1])
			yy_buffer_end--;
		if (yy_buffer_end > yy_buffer_start &&
		    '\r" == yy_buffer[yy_buffer_end-1])
			yy_buffer_end--;
	
private voidyy_to_mark()

		yy_buffer_index = yy_buffer_end;
		yy_at_bol = (yy_buffer_end > yy_buffer_start) &&
		            ('\r" == yy_buffer[yy_buffer_end-1] ||
		             '\n" == yy_buffer[yy_buffer_end-1] ||
		             2028/*LS*/ == yy_buffer[yy_buffer_end-1] ||
		             2029/*PS*/ == yy_buffer[yy_buffer_end-1]);
	
private voidyybegin(int state)

	     
		yy_lexical_state = state;
	
private intyylength()

		return yy_buffer_end - yy_buffer_start;
	
public org.json.simple.parser.Yytokenyylex()


	   
		  
		int yy_lookahead;
		int yy_anchor = YY_NO_ANCHOR;
		int yy_state = yy_state_dtrans[yy_lexical_state];
		int yy_next_state = YY_NO_STATE;
		int yy_last_accept_state = YY_NO_STATE;
		boolean yy_initial = true;
		int yy_this_accept;

		yy_mark_start();
		yy_this_accept = yy_acpt[yy_state];
		if (YY_NOT_ACCEPT != yy_this_accept) {
			yy_last_accept_state = yy_state;
			yy_mark_end();
		}
		while (true) {
			if (yy_initial && yy_at_bol) yy_lookahead = YY_BOL;
			else yy_lookahead = yy_advance();
			yy_next_state = YY_F;
			yy_next_state = yy_nxt[yy_rmap[yy_state]][yy_cmap[yy_lookahead]];
			if (YY_EOF == yy_lookahead && true == yy_initial) {
				return null;
			}
			if (YY_F != yy_next_state) {
				yy_state = yy_next_state;
				yy_initial = false;
				yy_this_accept = yy_acpt[yy_state];
				if (YY_NOT_ACCEPT != yy_this_accept) {
					yy_last_accept_state = yy_state;
					yy_mark_end();
				}
			}
			else {
				if (YY_NO_STATE == yy_last_accept_state) {
					throw (new Error("Lexical Error: Unmatched Input."));
				}
				else {
					yy_anchor = yy_acpt[yy_last_accept_state];
					if (0 != (YY_END & yy_anchor)) {
						yy_move_end();
					}
					yy_to_mark();
					switch (yy_last_accept_state) {
					case 1:
						
					case -2:
						break;
					case 2:
						{ sb.delete(0,sb.length());yybegin(STRING_BEGIN);}
					case -3:
						break;
					case 3:
						{ Long val=Long.valueOf(yytext()); return new Yytoken(Yytoken.TYPE_VALUE,val);}
					case -4:
						break;
					case 4:
						{ return new Yytoken(Yytoken.TYPE_LEFT_BRACE,null);}
					case -5:
						break;
					case 5:
						{ return new Yytoken(Yytoken.TYPE_RIGHT_BRACE,null);}
					case -6:
						break;
					case 6:
						{ return new Yytoken(Yytoken.TYPE_LEFT_SQUARE,null);}
					case -7:
						break;
					case 7:
						{ return new Yytoken(Yytoken.TYPE_RIGHT_SQUARE,null);}
					case -8:
						break;
					case 8:
						{ return new Yytoken(Yytoken.TYPE_COMMA,null);}
					case -9:
						break;
					case 9:
						{ return new Yytoken(Yytoken.TYPE_COLON,null);}
					case -10:
						break;
					case 10:
						{}
					case -11:
						break;
					case 11:
						{ Double val=Double.valueOf(yytext()); return new Yytoken(Yytoken.TYPE_VALUE,val);}
					case -12:
						break;
					case 12:
						{ return new Yytoken(Yytoken.TYPE_VALUE,null);}
					case -13:
						break;
					case 13:
						{ Boolean val=Boolean.valueOf(yytext()); return new Yytoken(Yytoken.TYPE_VALUE,val);}
					case -14:
						break;
					case 14:
						{ sb.append(yytext());}
					case -15:
						break;
					case 15:
						{ yybegin(YYINITIAL);return new Yytoken(Yytoken.TYPE_VALUE,sb.toString());}
					case -16:
						break;
					case 16:
						{sb.append('\\");}
					case -17:
						break;
					case 17:
						{sb.append('"");}
					case -18:
						break;
					case 18:
						{sb.append('/");}
					case -19:
						break;
					case 19:
						{sb.append('\b");}
					case -20:
						break;
					case 20:
						{sb.append('\f");}
					case -21:
						break;
					case 21:
						{sb.append('\n");}
					case -22:
						break;
					case 22:
						{sb.append('\r");}
					case -23:
						break;
					case 23:
						{sb.append('\t");}
					case -24:
						break;
					case 24:
						{	int ch=Integer.parseInt(yytext().substring(2),16);
													sb.append((char)ch);
												}
					case -25:
						break;
					case 26:
						{ Double val=Double.valueOf(yytext()); return new Yytoken(Yytoken.TYPE_VALUE,val);}
					case -26:
						break;
					case 27:
						{ sb.append(yytext());}
					case -27:
						break;
					default:
						yy_error(YY_E_INTERNAL,false);
					case -1:
					}
					yy_initial = true;
					yy_state = yy_state_dtrans[yy_lexical_state];
					yy_next_state = YY_NO_STATE;
					yy_last_accept_state = YY_NO_STATE;
					yy_mark_start();
					yy_this_accept = yy_acpt[yy_state];
					if (YY_NOT_ACCEPT != yy_this_accept) {
						yy_last_accept_state = yy_state;
						yy_mark_end();
					}
				}
			}
		}
	
private java.lang.Stringyytext()

		return (new java.lang.String(yy_buffer,
			yy_buffer_start,
			yy_buffer_end - yy_buffer_start));