⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 validwhenlexer.java.svn-base

📁 MVC开源框架
💻 SVN-BASE
📖 第 1 页 / 共 2 页
字号:
// $ANTLR 2.7.2: "ValidWhenParser.g" -> "ValidWhenLexer.java"$/* * $Id$ * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements.  See the NOTICE file * distributed with this work for additional information * regarding copyright ownership.  The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License.  You may obtain a copy of the License at * *  http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied.  See the License for the * specific language governing permissions and limitations * under the License. */package org.apache.struts.validator.validwhen;import java.util.Stack;import org.apache.commons.validator.util.ValidatorUtils;import java.io.InputStream;import antlr.TokenStreamException;import antlr.TokenStreamIOException;import antlr.TokenStreamRecognitionException;import antlr.CharStreamException;import antlr.CharStreamIOException;import antlr.ANTLRException;import java.io.Reader;import java.util.Hashtable;import antlr.CharScanner;import antlr.InputBuffer;import antlr.ByteBuffer;import antlr.CharBuffer;import antlr.Token;import antlr.CommonToken;import antlr.RecognitionException;import antlr.NoViableAltForCharException;import antlr.MismatchedCharException;import antlr.TokenStream;import antlr.ANTLRHashString;import antlr.LexerSharedInputState;import antlr.collections.impl.BitSet;import antlr.SemanticException;public class ValidWhenLexer extends antlr.CharScanner implements ValidWhenParserTokenTypes, TokenStream {public ValidWhenLexer(InputStream in) {	this(new ByteBuffer(in));}public ValidWhenLexer(Reader in) {	this(new CharBuffer(in));}public ValidWhenLexer(InputBuffer ib) {	this(new LexerSharedInputState(ib));}public ValidWhenLexer(LexerSharedInputState state) {	super(state);	caseSensitiveLiterals = true;	setCaseSensitive(false);	literals = new Hashtable();	literals.put(new ANTLRHashString("null", this), new Integer(11));	literals.put(new ANTLRHashString("or", this), new Integer(16));	literals.put(new ANTLRHashString("and", this), new Integer(15));}public Token nextToken() throws TokenStreamException {	Token theRetToken=null;tryAgain:	for (;;) {		Token _token = null;		int _ttype = Token.INVALID_TYPE;		resetText();		try {   // for char stream error handling			try {   // for lexical error handling				switch ( LA(1)) {				case '\t':  case '\n':  case '\r':  case ' ':				{					mWS(true);					theRetToken=_returnToken;					break;				}				case '-':  case '1':  case '2':  case '3':				case '4':  case '5':  case '6':  case '7':				case '8':  case '9':				{					mDECIMAL_LITERAL(true);					theRetToken=_returnToken;					break;				}				case '"':  case '\'':				{					mSTRING_LITERAL(true);					theRetToken=_returnToken;					break;				}				case '[':				{					mLBRACKET(true);					theRetToken=_returnToken;					break;				}				case ']':				{					mRBRACKET(true);					theRetToken=_returnToken;					break;				}				case '(':				{					mLPAREN(true);					theRetToken=_returnToken;					break;				}				case ')':				{					mRPAREN(true);					theRetToken=_returnToken;					break;				}				case '*':				{					mTHIS(true);					theRetToken=_returnToken;					break;				}				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':				{					mIDENTIFIER(true);					theRetToken=_returnToken;					break;				}				case '=':				{					mEQUALSIGN(true);					theRetToken=_returnToken;					break;				}				case '!':				{					mNOTEQUALSIGN(true);					theRetToken=_returnToken;					break;				}				default:					if ((LA(1)=='0') && (LA(2)=='x')) {						mHEX_LITERAL(true);						theRetToken=_returnToken;					}					else if ((LA(1)=='<') && (LA(2)=='=')) {						mLESSEQUALSIGN(true);						theRetToken=_returnToken;					}					else if ((LA(1)=='>') && (LA(2)=='=')) {						mGREATEREQUALSIGN(true);						theRetToken=_returnToken;					}					else if ((LA(1)=='0') && (true)) {						mOCTAL_LITERAL(true);						theRetToken=_returnToken;					}					else if ((LA(1)=='<') && (true)) {						mLESSTHANSIGN(true);						theRetToken=_returnToken;					}					else if ((LA(1)=='>') && (true)) {						mGREATERTHANSIGN(true);						theRetToken=_returnToken;					}				else {					if (LA(1)==EOF_CHAR) {uponEOF(); _returnToken = makeToken(Token.EOF_TYPE);}				else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}				}				}				if ( _returnToken==null ) continue tryAgain; // found SKIP token				_ttype = _returnToken.getType();				_ttype = testLiteralsTable(_ttype);				_returnToken.setType(_ttype);				return _returnToken;			}			catch (RecognitionException e) {				throw new TokenStreamRecognitionException(e);			}		}		catch (CharStreamException cse) {			if ( cse instanceof CharStreamIOException ) {				throw new TokenStreamIOException(((CharStreamIOException)cse).io);			}			else {				throw new TokenStreamException(cse.getMessage());			}		}	}}	public final void mWS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {		int _ttype; Token _token=null; int _begin=text.length();		_ttype = WS;		int _saveIndex;				{		int _cnt15=0;		_loop15:		do {			switch ( LA(1)) {			case ' ':			{				match(' ');				break;			}			case '\t':			{				match('\t');				break;			}			case '\n':			{				match('\n');				break;			}			case '\r':			{				match('\r');				break;			}			default:			{				if ( _cnt15>=1 ) { break _loop15; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}			}			}			_cnt15++;		} while (true);		}		_ttype = Token.SKIP;		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {			_token = makeToken(_ttype);			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));		}		_returnToken = _token;	}		public final void mDECIMAL_LITERAL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {		int _ttype; Token _token=null; int _begin=text.length();		_ttype = DECIMAL_LITERAL;		int _saveIndex;				{		switch ( LA(1)) {		case '-':		{			match('-');			break;		}		case '1':  case '2':  case '3':  case '4':		case '5':  case '6':  case '7':  case '8':		case '9':		{			break;		}		default:		{			throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());		}		}		}		{		matchRange('1','9');		}		{		_loop20:		do {			if (((LA(1) >= '0' && LA(1) <= '9'))) {				matchRange('0','9');			}			else {				break _loop20;			}					} while (true);		}		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {			_token = makeToken(_ttype);			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));		}		_returnToken = _token;	}		public final void mHEX_LITERAL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {		int _ttype; Token _token=null; int _begin=text.length();		_ttype = HEX_LITERAL;		int _saveIndex;				match('0');		match('x');		{		int _cnt23=0;		_loop23:		do {			switch ( LA(1)) {			case '0':  case '1':  case '2':  case '3':			case '4':  case '5':  case '6':  case '7':			case '8':  case '9':			{				matchRange('0','9');				break;			}			case 'a':  case 'b':  case 'c':  case 'd':			case 'e':  case 'f':			{				matchRange('a','f');				break;			}			default:			{				if ( _cnt23>=1 ) { break _loop23; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}			}			}			_cnt23++;		} while (true);		}		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {			_token = makeToken(_ttype);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -