跳转到下一个状态

@param currentState 当前状态
@param character    接受字符
@return 跳转结果
4925
private static State getState(State currentState, Character character)
    {
        State newCurrentState = currentState.nextState(character);  // 先按success跳转
        while (newCurrentState == null) // 跳转失败的话，按failure跳转
        {
            currentState = currentState.failure();
            newCurrentState = currentState.nextState(character);
        }
        return newCurrentState;
    }
1359339
private char nextChar() throws IOException {
		if (missedChar != null) {
			// RETURNS THE PREVIOUS PARSED CHAR
			c = missedChar.charValue();
			missedChar = null;

		} else {
			c = (char) in.read();

			if (c == '\\') {
				char c2 = (char) in.read();
				if (c2 == 'u') {
					// DECODE UNICODE CHAR
					final StringBuilder buff = new StringBuilder();
					for (int i = 0; i < 4; ++i)
						buff.append((char) in.read());

					cursor += 6;

					return (char) Integer.parseInt(buff.toString(), 16);
				} else {
					// REMEMBER THE CURRENT CHAR TO RETURN NEXT TIME
					missedChar = c2;
				}
			}
		}

		cursor++;

		if (c == NEW_LINE) {
			++lineNumber;
			columnNumber = 0;
		} else
			++columnNumber;

		return c;
	}

	public char lastChar() {
		return c;
	}

	public String getValue() {
		return value;
	}

	public int getLineNumber() {
		return lineNumber;
	}

	public int getColumnNumber() {
		return columnNumber;
	}

	public boolean hasNext() throws IOException {
		return in.ready();
	}
}
137999
public static boolean isAllAlpha(String str) {

	if (str == null) return false;

	for (int i = str.length() - 1; i >= 0; i--) {

	    if (!Character.isLetter(str.charAt(i))) return false;
	}

	return true;
    }
887045
void characters(CharSequence csq, int start, int end) throws IOException {
        getCurrent().characters(csq, start, end);
    }
1127531
private static int readingState(char[] nchar, DDLStatement retval) {

        if ( ! Character.isUnicodeIdentifierPart(nchar[0])) {
            char prev = prevChar(retval.statement);
            /* Since we only have access to the current character and the characters we have seen so far,
             * we can check for the token only after its completed and then look if it matches the required token. */
            if (checkForNextBegin) {
                if (prev == 'n' || prev == 'N') {
                    if (SQLLexer.matchToken(retval.statement, retval.statement.length() - 5, "begin") ) {
                        inAsBegin = true;
                    }
                }
                checkForNextBegin = false;
            }
            if (prev == 'd' || prev == 'D') {
                if (SQLLexer.matchToken(retval.statement, retval.statement.length() - 3, "end") ) {
                    if (inCaseWhen > 0) {
                        inCaseWhen--;
                    } else {
                        // we can terminate BEGIN ... END for multi stmt proc
                        // after all CASE ... END stmts are completed
                        inAsBegin = false;
                    }
                }
            } else if (prev == 'e' || prev == 'E') {
                if (SQLLexer.matchToken(retval.statement, retval.statement.length() - 4, "case") ) {
                    inCaseWhen++;
                }
            } else if (prev == 's' || prev == 'S') {
                if (SQLLexer.matchToken(retval.statement, retval.statement.length() - 2, "as") ) {
                    checkForNextBegin = true;
                }
            }
        }
        if (nchar[0] == '-') {
            // remember that a possible '--' is being examined
            return kStateReadingCommentDelim;
        }
        else if (nchar[0] == '\n') {
            // normalize newlines to spaces
            retval.endLineNo += 1;
            retval.statement += " ";
        }
        else if (nchar[0] == '\r') {
            // ignore carriage returns
        }
        else if (nchar[0] == ';') {
            // end of the statement
            retval.statement += nchar[0];
            // statement completed only if outside of begin..end
            if(!inAsBegin) {
                return kStateCompleteStatement;
            }
        }
        else if (nchar[0] == '\'') {
            retval.statement += nchar[0];
            return kStateReadingStringLiteral;
        }
        else if (SQLLexer.isBlockDelimiter(nchar[0])) {
            // we may be examining ### code block delimiters
            retval.statement += nchar[0];
            return kStateReadingCodeBlockDelim;
        }
        else {
            // accumulate and continue
            retval.statement += nchar[0];
        }

        return kStateReading;
    }
47341
public static Characters of(String chars) {
        return StringUtils.isEmpty(chars) ? Characters.NONE : new Characters(false, chars.toCharArray());
    }
143160
public static Character getCharacter(char pValue) {
        if (pValue >= CHARACTER_LOWER_BOUND &&
                pValue <= CHARACTER_UPPER_BOUND) {
            return mCharacters[((int) pValue) - CHARACTER_LOWER_BOUND];
        } else {
            return new Character(pValue);
        }
    }
774832
@Override
    public void characters(char[] ch, int start, int length) throws SAXException {
        String text = new String(ch, start, length);
        if (this.isName) {
            this.name = text;
            this.isName = false;
        } else if (this.isState) {
            this.state = text;
            this.isState = false;
        } else if (this.isNp) {
            this.np = Integer.parseInt(text);
            this.isNp = false;
        } else if (this.isProperties) {
            this.properties = text;
            this.isProperties = false;
        } else if (this.isNtype) {
            this.ntype = text;
            this.isNtype = false;
        } else if (this.isStatus) {
            this.status = text;
            this.isStatus = false;
        } else if (this.isJobs) {
            jobs = text;
            this.isJobs = false;
        }
    }
533019
public static List<String> seg(String text, boolean withPunctuation, char... reserve){
        List<String> list = new ArrayList<>();
        int start = 0;
        char[] array = text.toCharArray();
        int len = array.length;
        outer:for(int i=0; i<len; i++){
            char c = array[i];
            for(char t : reserve){
                if(c == t){
                    //保留的标点符号
                    continue outer;
                }
            }
            if(Punctuation.is(c)){
                if(i > start){
                    list.add(text.substring(start, i));
                    //下一句开始索引
                    start = i+1;
                }else{
                    //跳过标点符号
                    start++;
                }
                if(withPunctuation){
                    list.add(Character.toString(c));
                }
            }
        }
        if(len - start > 0){
            list.add(text.substring(start, len));
        }
        return list;
    }
1076942
public char getChar(String key) {
        String s = getString(key);
        if (s == null || s.trim().length() == 0) {
            return (char) 0;
        } else {
            return s.charAt(0);
        }
    }
156256
public void characters(char ch[], int start, int length)
    {
        if (m_CurrentString == null)
            m_CurrentString = new String(ch, start, length);
        else
            m_CurrentString += new String(ch, start, length);
    }
191052
function (state, char) {
                gpf.interfaces.ignoreParameter(state);
                gpf.interfaces.ignoreParameter(char);
                gpf.Error.abstract();
                // return -1;
            }
279872
function (char) {
                var
                    parsedItem = this._lastItem();
                if ("*" === char) {
                    parsedItem._min = 0;
                    parsedItem._max = 0;
                } else if ("+" === char) {
                    parsedItem._max = 0;
                } else if ("?" === char) {
                    parsedItem._min = 0;
                }
                return PatternItem.PARSE_PROCESSED;
            }
326195
public boolean isCurrentState(String s) {
        if (currentState == null) {
            return false;
        }
        return currentState.name.equals(s);
    }
217073
public static int getKeyCode(final char character)
		throws IllegalAccessException, NoSuchFieldException
	{
		final String c = String.valueOf(character).toUpperCase();
		final String variableName = "VK_" + c;
		final Class<KeyEvent> clazz = KeyEvent.class;
		final Field field = clazz.getField(variableName);
		final int keyCode = field.getInt(null);
		return keyCode;
	}
716188
public static Character parserCharacter(JsonPullParser parser) throws IOException,
			JsonFormatException {

		State eventType = parser.getEventType();
		if (eventType == State.VALUE_NULL) {
			return null;
		} else if (eventType == State.VALUE_STRING) {
			String str = parser.getValueString();
			if (str.length() != 1) {
				throw new IllegalStateException(
						"unexpected value. expecte string size is 1. but get=" + str);
			}
			return str.charAt(0);
		} else {
			throw new IllegalStateException("unexpected state. expected=VALUE_STRING, but get="
					+ eventType.toString());
		}
	}
69885
char read() {
        try {
            if( cachePos < cache.length() ) {
                return incLineColumn( cache.charAt( cachePos++ ) );
            }
            int ch = readCharBlockMarker();
            if( ch == -1 ) {
                throw createException( "Unexpected end of Less data" );
            }
            return incLineColumn( ch );
        } catch( IOException ex ) {
            throw new LessException( ex );
        }
    }