|
What this is
Other links
The source code/* The following code was generated by JFlex 1.3.5 on 8/30/02 3:00 PM */
/*
* Sun Public License Notice
*
* The contents of this file are subject to the Sun Public License
* Version 1.0 (the "License"). You may not use this file except in
* compliance with the License. A copy of the License is available at
* http://www.sun.com/
*
* The Original Code is NetBeans. The Initial Developer of the Original
* Code is Sun Microsystems, Inc. Portions Copyright 1997-2002 Sun
* Microsystems, Inc. All Rights Reserved.
*/
package org.netbeans.lib.java.parser;
import java.io.*;
import java.util.ArrayList;
/**
* This class is a scanner generated by
* JFlex 1.3.5
* on 8/30/02 3:00 PM from the specification file
* file:/home/th125165/Projects/Source/netbeans-cvs/nb_all/java_meta_2/libsrc/org/netbeans/lib/java/parser/unicode.l
*/
final class UnicodeEscapes extends FilterReader {
/** This character denotes the end of file */
final public static int YYEOF = -1;
/** initial size of the lookahead buffer */
final private static int YY_BUFFERSIZE = 16384;
/** lexical states */
final public static int DIGITS = 1;
final public static int YYINITIAL = 0;
/**
* Translates characters to character classes
*/
final private static String yycmap_packed =
"\12\0\1\0\45\0\12\1\7\0\6\1\25\0\1\2\4\0\6\1"+
"\16\0\1\3\uff8a\0";
/**
* Translates characters to character classes
*/
final private static char [] yycmap = yy_unpack_cmap(yycmap_packed);
/* error codes */
final private static int YY_UNKNOWN_ERROR = 0;
final private static int YY_ILLEGAL_STATE = 1;
final private static int YY_NO_MATCH = 2;
final private static int YY_PUSHBACK_2BIG = 3;
/* error messages for the codes above */
final private static String YY_ERROR_MSG[] = {
"Unkown internal scanner error",
"Internal error: unknown state",
"Error: could not match input",
"Error: pushback value was too large"
};
/** the input device */
private java.io.Reader yy_reader;
/** the current state of the DFA */
private int yy_state;
/** the current lexical state */
private int yy_lexical_state = YYINITIAL;
/** this buffer contains the current text to be matched and is
the source of the yytext() string */
private char yy_buffer[] = new char[YY_BUFFERSIZE];
/** the textposition at the last accepting state */
private int yy_markedPos;
/** the textposition at the last state to be included in yytext */
private int yy_pushbackPos;
/** the current text position in the buffer */
private int yy_currentPos;
/** startRead marks the beginning of the yytext() string in the buffer */
private int yy_startRead;
/** endRead marks the last character in the buffer, that has been read
from input */
private int yy_endRead;
/** number of newlines encountered up to the start of the matched text */
private int yyline;
/** the number of characters up to the start of the matched text */
private int yychar;
/**
* the number of characters from the last newline up to the start of the
* matched text
*/
private int yycolumn;
/**
* yy_atBOL == true <=> the scanner is currently at the beginning of a line
*/
private boolean yy_atBOL = true;
/** yy_atEOF == true <=> the scanner is at the EOF */
private boolean yy_atEOF;
/* user code: */
private char lastToken[]=null;
private int escapeOffset = 0;
private ArrayList escapes = new ArrayList();
private int escapesIndex = -1;
private int nextEscapePosition = -1;
private int currentEscapeDispl = 0;
private char value() {
char r=0;
String token = yytext();
for (int k = token.length()-4; k < token.length(); k++) {
int c = token.charAt(k);
if (c >= 'a')
c-= 'a'-10;
else if (c >= 'A')
c-= 'A'-10;
else
c-= '0';
r <<= 4;
r += c;
}
return r;
}
int convertPosition(int position) {
if (escapes.isEmpty())
return position;
for (;;) {
if (position <= nextEscapePosition)
return position+currentEscapeDispl;
if (nextEscapePosition != -1)
currentEscapeDispl=((Integer)escapes.get(++escapesIndex)).intValue();
if (escapes.size()<=escapesIndex+1) {
nextEscapePosition = -1;
return position+currentEscapeDispl;
}
nextEscapePosition=((Integer)escapes.get(++escapesIndex)).intValue();
}
}
public int read(char cbuf[], int off, int len) throws IOException {
int tokenLen;
// if ( !ready() ) return -1;
if (lastToken==null) {
lastToken = yylex();
}
tokenLen = lastToken.length;
if (tokenLen==0)
return -1;
if (len>=tokenLen) {
System.arraycopy(lastToken,0,cbuf,off,tokenLen);
lastToken=null;
return tokenLen;
}
char token[]=new char[lastToken.length-len];
System.arraycopy(lastToken,0,cbuf,off,len);
System.arraycopy(lastToken,len,token,0,token.length);
lastToken=token;
return len;
}
public boolean markSupported() {
return false;
}
public boolean ready() throws IOException {
return lastToken!=null || (!yy_atEOF && (yy_currentPos < yy_endRead || yy_reader.ready()));
}
/**
* Creates a new scanner
* There is also a java.io.InputStream version of this constructor.
*
* @param in the java.io.Reader to read input from.
*/
UnicodeEscapes(java.io.Reader in) {
super(in);
this.yy_reader = in;
}
/**
* Creates a new scanner.
* There is also java.io.Reader version of this constructor.
*
* @param in the java.io.Inputstream to read input from.
*/
UnicodeEscapes(java.io.InputStream in) {
this(new java.io.InputStreamReader(in));
}
/**
* Unpacks the compressed character translation table.
*
* @param packed the packed character translation table
* @return the unpacked character translation table
*/
private static char [] yy_unpack_cmap(String packed) {
char [] map = new char[0x10000];
int i = 0; /* index in packed string */
int j = 0; /* index in unpacked array */
while (i < 26) {
int count = packed.charAt(i++);
char value = packed.charAt(i++);
do map[j++] = value; while (--count > 0);
}
return map;
}
/**
* Refills the input buffer.
*
* @return
|
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.