📄 csharptokenmaker.java
字号:
/**
* Creates a new scanner.
* There is also java.io.Reader version of this constructor.
*
* @param in the java.io.Inputstream to read input from.
*/
public CSharpTokenMaker(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 [] zzUnpackCMap(String packed) {
char [] map = new char[0x10000];
int i = 0; /* index in packed string */
int j = 0; /* index in unpacked array */
while (i < 158) {
int count = packed.charAt(i++);
char value = packed.charAt(i++);
do map[j++] = value; while (--count > 0);
}
return map;
}
/**
* Closes the input stream.
*/
public final void yyclose() throws java.io.IOException {
zzAtEOF = true; /* indicate end of file */
zzEndRead = zzStartRead; /* invalidate buffer */
if (zzReader != null)
zzReader.close();
}
/**
* Returns the current lexical state.
*/
public final int yystate() {
return zzLexicalState;
}
/**
* Enters a new lexical state
*
* @param newState the new lexical state
*/
public final void yybegin(int newState) {
zzLexicalState = newState;
}
/**
* Returns the text matched by the current regular expression.
*/
public final String yytext() {
return new String( zzBuffer, zzStartRead, zzMarkedPos-zzStartRead );
}
/**
* Returns the character at position <tt>pos</tt> from the
* matched text.
*
* It is equivalent to yytext().charAt(pos), but faster
*
* @param pos the position of the character to fetch.
* A value from 0 to yylength()-1.
*
* @return the character at position pos
*/
public final char yycharat(int pos) {
return zzBuffer[zzStartRead+pos];
}
/**
* Returns the length of the matched text region.
*/
public final int yylength() {
return zzMarkedPos-zzStartRead;
}
/**
* Reports an error that occured while scanning.
*
* In a wellformed scanner (no or only correct usage of
* yypushback(int) and a match-all fallback rule) this method
* will only be called with things that "Can't Possibly Happen".
* If this method is called, something is seriously wrong
* (e.g. a JFlex bug producing a faulty scanner etc.).
*
* Usual syntax/scanner level error handling should be done
* in error fallback rules.
*
* @param errorCode the code of the errormessage to display
*/
private void zzScanError(int errorCode) {
String message;
try {
message = ZZ_ERROR_MSG[errorCode];
}
catch (ArrayIndexOutOfBoundsException e) {
message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
}
throw new Error(message);
}
/**
* Pushes the specified amount of characters back into the input stream.
*
* They will be read again by then next call of the scanning method
*
* @param number the number of characters to be read again.
* This number must not be greater than yylength()!
*/
public void yypushback(int number) {
if ( number > yylength() )
zzScanError(ZZ_PUSHBACK_2BIG);
zzMarkedPos -= number;
}
/**
* Resumes scanning until the next regular expression is matched,
* the end of input is encountered or an I/O-Error occurs.
*
* @return the next token
* @exception java.io.IOException if any I/O-Error occurs
*/
public org.fife.ui.rsyntaxtextarea.Token yylex() throws java.io.IOException {
int zzInput;
int zzAction;
// cached fields:
int zzCurrentPosL;
int zzMarkedPosL;
int zzEndReadL = zzEndRead;
char [] zzBufferL = zzBuffer;
char [] zzCMapL = ZZ_CMAP;
int [] zzTransL = ZZ_TRANS;
int [] zzRowMapL = ZZ_ROWMAP;
int [] zzAttrL = ZZ_ATTRIBUTE;
while (true) {
zzMarkedPosL = zzMarkedPos;
zzAction = -1;
zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
zzState = zzLexicalState;
zzForAction: {
while (true) {
if (zzCurrentPosL < zzEndReadL)
zzInput = zzBufferL[zzCurrentPosL++];
else if (zzAtEOF) {
zzInput = YYEOF;
break zzForAction;
}
else {
// store back cached positions
zzCurrentPos = zzCurrentPosL;
zzMarkedPos = zzMarkedPosL;
boolean eof = zzRefill();
// get translated positions and possibly new buffer
zzCurrentPosL = zzCurrentPos;
zzMarkedPosL = zzMarkedPos;
zzBufferL = zzBuffer;
zzEndReadL = zzEndRead;
if (eof) {
zzInput = YYEOF;
break zzForAction;
}
else {
zzInput = zzBufferL[zzCurrentPosL++];
}
}
int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ];
if (zzNext == -1) break zzForAction;
zzState = zzNext;
int zzAttributes = zzAttrL[zzState];
if ( (zzAttributes & 1) == 1 ) {
zzAction = zzState;
zzMarkedPosL = zzCurrentPosL;
if ( (zzAttributes & 8) == 8 ) break zzForAction;
}
}
}
// store back cached position
zzMarkedPos = zzMarkedPosL;
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
case 28:
{ addToken(Token.PREPROCESSOR);
}
case 34: break;
case 3:
{ addNullToken(); return firstToken;
}
case 35: break;
case 30:
{ addToken(Token.LITERAL_CHAR);
}
case 36: break;
case 25:
{ yybegin(YYINITIAL); addToken(start,zzStartRead+1, Token.COMMENT_MULTILINE);
}
case 37: break;
case 4:
{ addToken(Token.WHITESPACE);
}
case 38: break;
case 29:
{ addToken(Token.LITERAL_NUMBER_HEXADECIMAL);
}
case 39: break;
case 22:
{ addToken(Token.ERROR_CHAR); /*addNullToken(); return firstToken;*/
}
case 40: break;
case 33:
{ addToken(Token.ERROR_STRING_DOUBLE);
}
case 41: break;
case 19:
{ addToken(Token.LITERAL_NUMBER_FLOAT);
}
case 42: break;
case 21:
{ addToken(Token.RESERVED_WORD);
}
case 43: break;
case 10:
{ addToken(Token.SEPARATOR);
}
case 44: break;
case 12:
{ addToken(start,zzStartRead-1, Token.COMMENT_DOCUMENTATION); addNullToken(); return firstToken;
}
case 45: break;
case 6:
{ addToken(Token.IDENTIFIER);
}
case 46: break;
case 8:
{ addToken(Token.ERROR_CHAR); addNullToken(); return firstToken;
}
case 47: break;
case 9:
{ addToken(Token.ERROR_STRING_DOUBLE); addNullToken(); return firstToken;
}
case 48: break;
case 31:
{ addToken(Token.DATA_TYPE);
}
case 49: break;
case 2:
{ addToken(Token.ERROR_IDENTIFIER);
}
case 50: break;
case 23:
{ addToken(Token.ERROR_CHAR);
}
case 51: break;
case 32:
{ addToken(Token.LITERAL_BOOLEAN);
}
case 52: break;
case 13:
{ int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_DOCUMENTATION); addToken(temp,zzEndRead, Token.PREPROCESSOR); addNullToken(); return firstToken;
}
case 53: break;
case 20:
{ start = zzMarkedPos-2; yybegin(VERBATIMSTRING);
}
case 54: break;
case 24:
{ addToken(Token.LITERAL_STRING_DOUBLE_QUOTE);
}
case 55: break;
case 14:
{ addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); return firstToken;
}
case 56: break;
case 16:
{ addToken(Token.COMMENT_EOL); addNullToken(); return firstToken;
}
case 57: break;
case 18:
{ addToken(Token.ERROR_NUMBER_FORMAT);
}
case 58: break;
case 27:
{ start = zzMarkedPos-3; yybegin(DOCUMENTCOMMENT);
}
case 59: break;
case 17:
{ start = zzMarkedPos-2; yybegin(DELIMITEDCOMMENT);
}
case 60: break;
case 7:
{ addToken(Token.LITERAL_NUMBER_DECIMAL_INT);
}
case 61: break;
case 5:
{ addToken(Token.OPERATOR);
}
case 62: break;
case 26:
{ int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_DOCUMENTATION); addToken(temp,zzMarkedPos-1, Token.PREPROCESSOR); start = zzMarkedPos;
}
case 63: break;
case 15:
{ yybegin(YYINITIAL); addToken(start,zzStartRead, Token.LITERAL_STRING_DOUBLE_QUOTE);
}
case 64: break;
case 1:
{
}
case 65: break;
case 11:
{ addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); return firstToken;
}
case 66: break;
default:
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
zzAtEOF = true;
switch (zzLexicalState) {
case VERBATIMSTRING: {
addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); return firstToken;
}
case 335: break;
case DOCUMENTCOMMENT: {
addToken(start,zzStartRead-1, Token.COMMENT_DOCUMENTATION); addNullToken(); return firstToken;
}
case 336: break;
case YYINITIAL: {
addNullToken(); return firstToken;
}
case 337: break;
case DELIMITEDCOMMENT: {
addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); return firstToken;
}
case 338: break;
default:
return null;
}
}
else {
zzScanError(ZZ_NO_MATCH);
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -