E4GLLexer.java

// $ANTLR 2.7.7 (20060906): "e4gl.g" -> "E4GLLexer.java"$

/*
** Module   : E4GLParser.java
**            E4GLTokenTypes.java
**            E4GLLexer.java
** Abstract : lex and parse E4GL source code (html files)
**
** Copyright (c) 2007-2025, Golden Code Development Corporation.
**
** -#- -I- --Date-- -T- --JPRM-- ----------------Description-----------------
** 001 GES 20070820 NEW   @348xx WARNING, THIS IS A GENERATED FILE!!!
**                               DO NOT EDIT THIS FILE. The original source
**                               file is e4gl.g!
*/

/*
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU Affero General Public License as
** published by the Free Software Foundation, either version 3 of the
** License, or (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU Affero General Public License for more details.
**
** You may find a copy of the GNU Affero GPL version 3 at the following
** location: https://www.gnu.org/licenses/agpl-3.0.en.html
** 
** Additional terms under GNU Affero GPL version 3 section 7:
** 
**   Under Section 7 of the GNU Affero GPL version 3, the following additional
**   terms apply to the works covered under the License.  These additional terms
**   are non-permissive additional terms allowed under Section 7 of the GNU
**   Affero GPL version 3 and may not be removed by you.
** 
**   0. Attribution Requirement.
** 
**     You must preserve all legal notices or author attributions in the covered
**     work or Appropriate Legal Notices displayed by works containing the covered
**     work.  You may not remove from the covered work any author or developer
**     credit already included within the covered work.
** 
**   1. No License To Use Trademarks.
** 
**     This license does not grant any license or rights to use the trademarks
**     Golden Code, FWD, any Golden Code or FWD logo, or any other trademarks
**     of Golden Code Development Corporation. You are not authorized to use the
**     name Golden Code, FWD, or the names of any author or contributor, for
**     publicity purposes without written authorization.
** 
**   2. No Misrepresentation of Affiliation.
** 
**     You may not represent yourself as Golden Code Development Corporation or FWD.
** 
**     You may not represent yourself for publicity purposes as associated with
**     Golden Code Development Corporation, FWD, or any author or contributor to
**     the covered work, without written authorization.
** 
**   3. No Misrepresentation of Source or Origin.
** 
**     You may not represent the covered work as solely your work.  All modified
**     versions of the covered work must be marked in a reasonable way to make it
**     clear that the modified work is not originating from Golden Code Development
**     Corporation or FWD.  All modified versions must contain the notices of
**     attribution required in this license.
*/

package com.goldencode.p2j.e4gl;

import java.io.*;
import java.util.logging.*;
import com.goldencode.ast.*;
import com.goldencode.p2j.convert.*;
import antlr.*;

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;

/**
 * Reads an HTML file and provides a stream of tokens that can be readily
 * parsed. The central design point of this lexer is for all possible input
 * to be matched and passed through on output. For example, all whitespace
 * (with one exception, see below) will be matched and passed through. The
 * minimum number of tokens needed by the parser is generated.
 * <p> 
 * Most HTML constructs are NOT directly matched. Instead, this only
 * matches those constructs needed to unambiguously parse embedded 4GL
 * in an HTML page and translate that input into a valid 4GL program. No
 * 4GL constructs are matched here as the parser is not aware of any 4GL
 * syntax. Since the parser is only a filter (preprocessor), it only needs
 * to match on a small subset of HTML syntax such that it can make its
 * state transitions and so forth. Generally, there is a top-level rule
 * or artificial token type for every critical parser decision. Many of
 * these are single character matches but some more complicated 
 * multi-character constructs are matched as needed. Every possible ASCII
 * and extended ASCII character can be matched by itself. For any character
 * that doea not match a unique top-level rule or artificial token type, the
 * character can be returned as part of {@link #mWS} or {@link #mUNKNOWN}.
 * There are some places in the parser that matches on <code>WS</code> but
 * the content (token text) is not really important. Anything that is matched
 * as <code>UNKNOWN</code> is simply passed through by the parser grammar
 * rules, though on output the parser my do some tranformations as needed
 * to represent 4GL source code (e.g. unsafe character escaping).
 * <p>
 * Whitespace processing takes into account the platform-specific newline
 * string and maintains the newline counter as appropriate. In the case of
 * a platform's newline of "\r\n", the '\r' character immediately preceding
 * a '\n' character will be dropped. This allows the parser to match on a
 * simple '\n' in that case and on output the full platform-specific newline
 * will be inserted as needed. This also allows the '\r' to be dropped from
 * output if run on a system where the newline string is "\n".
 * <p>
 * Symbol processing is very simplistic. It leverages the built-in literals
 * testing (case-insensitively) of ANTLR. The key factor is that any text
 * that must be converted into an artificial token type must first match via
 * some other top-level lexer rule (see {@link #mSYMBOL}). The end of the
 * {@link #nextToken} rule then does a case-insensitive literal text lookup
 * with the list of hard coded string literals that are associated with
 * artificial token types. If a match is found, the token type of the
 * <code>SYMBOL</code> is changed to the corresponding artificial type.
 */
public class E4GLLexer extends antlr.CharScanner implements E4GLParserTokenTypes, TokenStream
 {

   /** Logger. */
   private static final ConversionStatus LOG = ConversionStatus.get(E4GLLexer.class);
   
   /** Flag to force dropping CR characters from newlines. */
   private boolean dropCR = false;
   
   /** Flag to force maintaining newline based solely on CR characters. */
   private boolean newlineCR = false;
   
   // initializer
   {
      String nl = System.getProperty("line.separator");
      
      // newline of "\n" or "\r\n" will process as "\n", only a newline that
      // is a lone "\r" will trigger newline processing on the CR character
      if ("\r".equals(nl))
      {
         newlineCR = true;
      }
      
      // newline of "\n" will drop CR characters immediately preceding the
      // "\n", but in all other cases these "\r" will be left behind
      if ("\n".equals(nl))
      {
         dropCR = true;
      }
   }
   
   /**
    * Command line driver to allow lexer testing. The only argument should
    * be the source filename that should be lexed.
    *
    * @param    args                                           
    *           List of command line arguments.
    */
   public static void main(String[] args)
   {
      if (args.length != 1)
      {
         LOG.log(Level.SEVERE, "Syntax: java E4GLLexer <source_filename>");
         System.exit(-1);
      }
         
      try
      {
         // setup
         FileInputStream file   = new FileInputStream(args[0]);
         DataInputStream data   = new DataInputStream(file);
         E4GLLexer       lexer  = new E4GLLexer(data);
         LexerDumpHelper test   = new LexerDumpHelper(lexer,
                                                      E4GLParser._tokenNames,
                                                      System.out);
         
         // start the lexing and print a record for each token                  
         test.dump();
      }
       
      catch(Exception excpt)
      {
         LOG.log(Level.SEVERE, "", excpt);
      }
   }
public E4GLLexer(InputStream in) {
	this(new ByteBuffer(in));
}
public E4GLLexer(Reader in) {
	this(new CharBuffer(in));
}
public E4GLLexer(InputBuffer ib) {
	this(new LexerSharedInputState(ib));
}
public E4GLLexer(LexerSharedInputState state) {
	super(state);
	caseSensitiveLiterals = false;
	setCaseSensitive(false);
	literals = new Hashtable();
	literals.put(new ANTLRHashString("server", this), Integer.valueOf(14));
	literals.put(new ANTLRHashString("content", this), Integer.valueOf(29));
	literals.put(new ANTLRHashString("ws", this), Integer.valueOf(10));
	literals.put(new ANTLRHashString("name", this), Integer.valueOf(27));
	literals.put(new ANTLRHashString("http-equiv", this), Integer.valueOf(28));
	literals.put(new ANTLRHashString("wss", this), Integer.valueOf(16));
	literals.put(new ANTLRHashString("wsmeta", this), Integer.valueOf(25));
	literals.put(new ANTLRHashString("language", this), Integer.valueOf(8));
	literals.put(new ANTLRHashString("meta", this), Integer.valueOf(24));
	literals.put(new ANTLRHashString("script", this), Integer.valueOf(5));
	literals.put(new ANTLRHashString("ws4gl", this), Integer.valueOf(17));
	literals.put(new ANTLRHashString("wse", this), Integer.valueOf(23));
}

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 '\u0000':  case '\u0001':  case '\u0002':  case '\u0003':
				case '\u0004':  case '\u0005':  case '\u0006':  case '\u0007':
				case '\u0008':  case '\t':  case '\n':  case '\u000b':
				case '\u000c':  case '\r':  case '\u000e':  case '\u000f':
				case '\u0010':  case '\u0011':  case '\u0012':  case '\u0013':
				case '\u0014':  case '\u0015':  case '\u0016':  case '\u0017':
				case '\u0018':  case '\u0019':  case '\u001a':  case '\u001b':
				case '\u001c':  case '\u001d':  case '\u001e':  case '\u001f':
				case ' ':  case '\u007f':
				{
					mWS(true);
					theRetToken=_returnToken;
					break;
				}
				case '"':
				{
					mDQUOTE(true);
					theRetToken=_returnToken;
					break;
				}
				case '\'':
				{
					mSQUOTE(true);
					theRetToken=_returnToken;
					break;
				}
				case '0':  case '1':  case '2':  case '3':
				case '4':  case '5':  case '6':  case '7':
				case '8':  case '9':  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':
				{
					mSYMBOL(true);
					theRetToken=_returnToken;
					break;
				}
				case '`':
				{
					mBACK_TICK(true);
					theRetToken=_returnToken;
					break;
				}
				case '>':
				{
					mCLOSE_TAG(true);
					theRetToken=_returnToken;
					break;
				}
				default:
					if ((LA(1)=='<') && (LA(2)=='%') && (LA(3)=='=')) {
						mOPEN_PCT_EQ(true);
						theRetToken=_returnToken;
					}
					else if ((LA(1)=='<') && (LA(2)=='/') && (LA(3)=='?')) {
						mCLOSE_QUESTION(true);
						theRetToken=_returnToken;
					}
					else if ((LA(1)=='%') && (_tokenSet_0.member(LA(2)))) {
						mENCODED_CHAR(true);
						theRetToken=_returnToken;
					}
					else if ((LA(1)=='<') && (LA(2)=='%') && (true)) {
						mOPEN_PCT(true);
						theRetToken=_returnToken;
					}
					else if ((LA(1)=='%') && (LA(2)=='>')) {
						mCLOSE_PCT(true);
						theRetToken=_returnToken;
					}
					else if ((LA(1)=='<') && (LA(2)=='?')) {
						mOPEN_QUESTION(true);
						theRetToken=_returnToken;
					}
					else if ((LA(1)=='<') && (LA(2)=='/') && (true)) {
						mOPEN_END_TAG(true);
						theRetToken=_returnToken;
					}
					else if ((LA(1)=='{') && (LA(2)=='=')) {
						mOPEN_CURLY_EQ(true);
						theRetToken=_returnToken;
					}
					else if ((LA(1)=='=') && (LA(2)=='}')) {
						mCLOSE_CURLY_EQ(true);
						theRetToken=_returnToken;
					}
					else if ((LA(1)=='<') && (LA(2)=='!')) {
						mOPEN_COMMENT(true);
						theRetToken=_returnToken;
					}
					else if ((LA(1)=='-') && (LA(2)=='-')) {
						mCLOSE_COMMENT(true);
						theRetToken=_returnToken;
					}
					else if ((LA(1)=='/') && (LA(2)=='>')) {
						mCLOSE_TAG_NO_CONTENT(true);
						theRetToken=_returnToken;
					}
					else if ((LA(1)=='=') && (true)) {
						mEQUALS(true);
						theRetToken=_returnToken;
					}
					else if ((_tokenSet_1.member(LA(1))) && (true)) {
						mUNKNOWN(true);
						theRetToken=_returnToken;
					}
					else if ((LA(1)=='<') && (true)) {
						mOPEN_START_TAG(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());
			}
		}
	}
}

/**                 
 * Matches any amount of whitespace in a program. Each newline character
 * causes the lexer's line counter to be incremented in order to properly 
 * maintain each token's line information.
 * <p>
 * Spaces, tabs and carriage returns and line feeds (newlines) are all
 * matched.
 * <p>
 * Non-visible ASCII codes decimal 127 and below are matched here as well. 
 * <p>
 * This is a top level lexer rule which means that there is an associated
 * <code>WS</code> token.
 */
	public final void mWS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
		int _ttype; Token _token=null; int _begin=text.length();
		_ttype = WS;
		int _saveIndex;
		
		{
		int _cnt57=0;
		_loop57:
		do {
			switch ( LA(1)) {
			case ' ':
			{
				match(' ');
				break;
			}
			case '\t':
			{
				match('\t');
				break;
			}
			case '\n':
			{
				match('\n');
				if (!newlineCR) newline();
				break;
			}
			case '\u0000':  case '\u0001':  case '\u0002':  case '\u0003':
			case '\u0004':  case '\u0005':  case '\u0006':  case '\u0007':
			case '\u0008':  case '\u000b':  case '\u000c':  case '\u000e':
			case '\u000f':  case '\u0010':  case '\u0011':  case '\u0012':
			case '\u0013':  case '\u0014':  case '\u0015':  case '\u0016':
			case '\u0017':  case '\u0018':  case '\u0019':  case '\u001a':
			case '\u001b':  case '\u001c':  case '\u001d':  case '\u001e':
			case '\u001f':  case '\u007f':
			{
				mJUNK(false);
				break;
			}
			default:
				if (((LA(1)=='\r') && (true) && (true) && (true))&&( dropCR && LA(2) == '\n' )) {
					_saveIndex=text.length();
					match('\r');
					text.setLength(_saveIndex);
				}
				else if ((LA(1)=='\r') && (true) && (true) && (true)) {
					match('\r');
					if (newlineCR)  newline();
				}
			else {
				if ( _cnt57>=1 ) { break _loop57; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
			}
			}
			_cnt57++;
		} while (true);
		}
		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
			_token = makeToken(_ttype);
			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
		}
		_returnToken = _token;
	}
	
/**
 * Matches non-visible ASCII codes that should be silently ignored.
 */
	protected final void mJUNK(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
		int _ttype; Token _token=null; int _begin=text.length();
		_ttype = JUNK;
		int _saveIndex;
		
		switch ( LA(1)) {
		case '\u0000':  case '\u0001':  case '\u0002':  case '\u0003':
		case '\u0004':  case '\u0005':  case '\u0006':  case '\u0007':
		case '\u0008':
		{
			matchRange('\000','\010');
			break;
		}
		case '\u000b':  case '\u000c':
		{
			matchRange('\013','\014');
			break;
		}
		case '\u000e':  case '\u000f':  case '\u0010':  case '\u0011':
		case '\u0012':  case '\u0013':  case '\u0014':  case '\u0015':
		case '\u0016':  case '\u0017':  case '\u0018':  case '\u0019':
		case '\u001a':  case '\u001b':  case '\u001c':  case '\u001d':
		case '\u001e':  case '\u001f':
		{
			matchRange('\016','\037');
			break;
		}
		case '\u007f':
		{
			match('\177');
			break;
		}
		default:
		{
			throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
		}
		}
		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
			_token = makeToken(_ttype);
			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
		}
		_returnToken = _token;
	}
	
/**
 * Matches the double quote character.
 */
	public final void mDQUOTE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
		int _ttype; Token _token=null; int _begin=text.length();
		_ttype = DQUOTE;
		int _saveIndex;
		
		match('\"');
		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
			_token = makeToken(_ttype);
			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
		}
		_returnToken = _token;
	}
	
/**
 * Matches a single quote character.
 */
	public final void mSQUOTE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
		int _ttype; Token _token=null; int _begin=text.length();
		_ttype = SQUOTE;
		int _saveIndex;
		
		match('\'');
		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
			_token = makeToken(_ttype);
			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
		}
		_returnToken = _token;
	}
	
/**
 * Match any valid HTML name or id. This includes all alphanumeric characters
 * hyphen, underscore, colon and period. Once this matches, the resulting
 * text will be compared to the list of hard-coded literals on a 
 * case-insensitive basis. The token type will be converted to that of the
 * matching literal if a match is found via this literal testing.
 */
	public final void mSYMBOL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
		int _ttype; Token _token=null; int _begin=text.length();
		_ttype = SYMBOL;
		int _saveIndex;
		
		{
		switch ( LA(1)) {
		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':
		{
			mLETTER(false);
			break;
		}
		case '0':  case '1':  case '2':  case '3':
		case '4':  case '5':  case '6':  case '7':
		case '8':  case '9':
		{
			mDIGIT(false);
			break;
		}
		default:
		{
			throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
		}
		}
		}
		{
		_loop63:
		do {
			switch ( LA(1)) {
			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':
			{
				mLETTER(false);
				break;
			}
			case '0':  case '1':  case '2':  case '3':
			case '4':  case '5':  case '6':  case '7':
			case '8':  case '9':
			{
				mDIGIT(false);
				break;
			}
			case '-':
			{
				mHYPHEN(false);
				break;
			}
			case '_':
			{
				mUNDERSCORE(false);
				break;
			}
			case ':':
			{
				mCOLON(false);
				break;
			}
			case '.':
			{
				mDOT(false);
				break;
			}
			default:
			{
				break _loop63;
			}
			}
		} while (true);
		}
		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
			_token = makeToken(_ttype);
			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
		}
		_returnToken = _token;
	}
	
/**
 * Matches any alphabetic character: <code>a - z</code>.
 */
	protected final void mLETTER(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
		int _ttype; Token _token=null; int _begin=text.length();
		_ttype = LETTER;
		int _saveIndex;
		
		matchRange('a','z');
		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
			_token = makeToken(_ttype);
			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
		}
		_returnToken = _token;
	}
	
/**
 * Matches any numeric digit: <code>0 - 9</code>.
 */
	protected final void mDIGIT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
		int _ttype; Token _token=null; int _begin=text.length();
		_ttype = DIGIT;
		int _saveIndex;
		
		matchRange('0','9');
		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
			_token = makeToken(_ttype);
			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
		}
		_returnToken = _token;
	}
	
/**
 * Matches a single '-' character.
 */
	protected final void mHYPHEN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
		int _ttype; Token _token=null; int _begin=text.length();
		_ttype = HYPHEN;
		int _saveIndex;
		
		match('-');
		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
			_token = makeToken(_ttype);
			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
		}
		_returnToken = _token;
	}
	
/**
 * Matches a single '_' character.
 */
	protected final void mUNDERSCORE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
		int _ttype; Token _token=null; int _begin=text.length();
		_ttype = UNDERSCORE;
		int _saveIndex;
		
		match('_');
		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
			_token = makeToken(_ttype);
			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
		}
		_returnToken = _token;
	}
	
/**
 * Matches a single ':' character.
 */
	protected final void mCOLON(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
		int _ttype; Token _token=null; int _begin=text.length();
		_ttype = COLON;
		int _saveIndex;
		
		match(':');
		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
			_token = makeToken(_ttype);
			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
		}
		_returnToken = _token;
	}
	
/**
 * Matches a single '.' character.
 */
	protected final void mDOT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
		int _ttype; Token _token=null; int _begin=text.length();
		_ttype = DOT;
		int _saveIndex;
		
		match('.');
		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
			_token = makeToken(_ttype);
			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
		}
		_returnToken = _token;
	}
	
/**
 * Match '%' followed by 2 hexidecimal digits.
 */
	public final void mENCODED_CHAR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
		int _ttype; Token _token=null; int _begin=text.length();
		_ttype = ENCODED_CHAR;
		int _saveIndex;
		
		_ttype = UNKNOWN;
		
		
		mPERCENT(false);
		mHEX_DIGIT(false);
		{
		if ((_tokenSet_0.member(LA(1)))) {
			mHEX_DIGIT(false);
			_ttype = ENCODED_CHAR;
		}
		else {
		}
		
		}
		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
			_token = makeToken(_ttype);
			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
		}
		_returnToken = _token;
	}
	
/**
 * Matches a single '%' character.
 */
	protected final void mPERCENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
		int _ttype; Token _token=null; int _begin=text.length();
		_ttype = PERCENT;
		int _saveIndex;
		
		match('%');
		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
			_token = makeToken(_ttype);
			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
		}
		_returnToken = _token;
	}
	
/**
 * Matches any hexidecimal digit: <code>0 - 9</code> and <code>a - f</code>.
 */
	protected final void mHEX_DIGIT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
		int _ttype; Token _token=null; int _begin=text.length();
		_ttype = HEX_DIGIT;
		int _saveIndex;
		
		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:
		{
			throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
		}
		}
		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
			_token = makeToken(_ttype);
			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
		}
		_returnToken = _token;
	}
	
/**
 * Match '&lt;!--WSE' used to open one form of expression escape.
 */
	public final void mOPEN_PCT_EQ(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
		int _ttype; Token _token=null; int _begin=text.length();
		_ttype = OPEN_PCT_EQ;
		int _saveIndex;
		
		mLT(false);
		mPERCENT(false);
		mEQUALS(false);
		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
			_token = makeToken(_ttype);
			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
		}
		_returnToken = _token;
	}
	
/**
 * Matches a single '&lt;' character.
 */
	protected final void mLT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
		int _ttype; Token _token=null; int _begin=text.length();
		_ttype = LT;
		int _saveIndex;
		
		match('<');
		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
			_token = makeToken(_ttype);
			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
		}
		_returnToken = _token;
	}
	
/**
 * Matches a single '=' character.
 */
	public final void mEQUALS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
		int _ttype; Token _token=null; int _begin=text.length();
		_ttype = EQUALS;
		int _saveIndex;
		
		match('=');
		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
			_token = makeToken(_ttype);
			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
		}
		_returnToken = _token;
	}
	
/**
 * Match '&lt;!--WSE' used to open one form of expression escape.
 */
	public final void mOPEN_PCT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
		int _ttype; Token _token=null; int _begin=text.length();
		_ttype = OPEN_PCT;
		int _saveIndex;
		
		mLT(false);
		mPERCENT(false);
		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
			_token = makeToken(_ttype);
			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
		}
		_returnToken = _token;
	}
	
/**
 * Match '&lt;!--WSE' used to open one form of expression escape.
 */
	public final void mCLOSE_PCT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
		int _ttype; Token _token=null; int _begin=text.length();
		_ttype = CLOSE_PCT;
		int _saveIndex;
		
		mPERCENT(false);
		mGT(false);
		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
			_token = makeToken(_ttype);
			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
		}
		_returnToken = _token;
	}
	
/**
 * Matches a single '&gt;' character.
 */
	protected final void mGT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
		int _ttype; Token _token=null; int _begin=text.length();
		_ttype = GT;
		int _saveIndex;
		
		match('>');
		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
			_token = makeToken(_ttype);
			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
		}
		_returnToken = _token;
	}
	
/**
 * Match '&lt;?' used to open one form of statement escape.
 */
	public final void mOPEN_QUESTION(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
		int _ttype; Token _token=null; int _begin=text.length();
		_ttype = OPEN_QUESTION;
		int _saveIndex;
		
		mLT(false);
		mQUESTION(false);
		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
			_token = makeToken(_ttype);
			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
		}
		_returnToken = _token;
	}
	
/**
 * Matches a single '?' character.
 */
	protected final void mQUESTION(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
		int _ttype; Token _token=null; int _begin=text.length();
		_ttype = QUESTION;
		int _saveIndex;
		
		match('?');
		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
			_token = makeToken(_ttype);
			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
		}
		_returnToken = _token;
	}
	
/**
 * Match '&lt;?' used to open one form of statement escape.
 */
	public final void mCLOSE_QUESTION(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
		int _ttype; Token _token=null; int _begin=text.length();
		_ttype = CLOSE_QUESTION;
		int _saveIndex;
		
		mOPEN_END_TAG(false);
		mQUESTION(false);
		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
			_token = makeToken(_ttype);
			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
		}
		_returnToken = _token;
	}
	
/**
 * Matches a single '&lt;' character followed by a '/', normally
 * used to start a closing HTML element.
 */
	public final void mOPEN_END_TAG(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
		int _ttype; Token _token=null; int _begin=text.length();
		_ttype = OPEN_END_TAG;
		int _saveIndex;
		
		mLT(false);
		mSLASH(false);
		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
			_token = makeToken(_ttype);
			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
		}
		_returnToken = _token;
	}
	
/**
 * Match '{=' used to open one form of expression escape.
 */
	public final void mOPEN_CURLY_EQ(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
		int _ttype; Token _token=null; int _begin=text.length();
		_ttype = OPEN_CURLY_EQ;
		int _saveIndex;
		
		mLEFT_CURLY(false);
		mEQUALS(false);
		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
			_token = makeToken(_ttype);
			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
		}
		_returnToken = _token;
	}
	
/**
 * Matches a single '{' character.
 */
	protected final void mLEFT_CURLY(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
		int _ttype; Token _token=null; int _begin=text.length();
		_ttype = LEFT_CURLY;
		int _saveIndex;
		
		match('{');
		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
			_token = makeToken(_ttype);
			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
		}
		_returnToken = _token;
	}
	
/**
 * Match '=}' used to close one form of expression escape.
 */
	public final void mCLOSE_CURLY_EQ(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
		int _ttype; Token _token=null; int _begin=text.length();
		_ttype = CLOSE_CURLY_EQ;
		int _saveIndex;
		
		mEQUALS(false);
		mRIGHT_CURLY(false);
		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
			_token = makeToken(_ttype);
			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
		}
		_returnToken = _token;
	}
	
/**
 * Matches a single '}' character.
 */
	protected final void mRIGHT_CURLY(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
		int _ttype; Token _token=null; int _begin=text.length();
		_ttype = RIGHT_CURLY;
		int _saveIndex;
		
		match('}');
		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
			_token = makeToken(_ttype);
			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
		}
		_returnToken = _token;
	}
	
/**
 * Match everything else (this is the inverse of all other top-level lexer
 * rules) as unknown text.
 */
	public final void mUNKNOWN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
		int _ttype; Token _token=null; int _begin=text.length();
		_ttype = UNKNOWN;
		int _saveIndex;
		
		{
		switch ( LA(1)) {
		case '%':
		{
			mPERCENT(false);
			break;
		}
		case '/':
		{
			mSLASH(false);
			break;
		}
		case '!':
		{
			mEXCLAIM(false);
			break;
		}
		case '-':
		{
			mHYPHEN(false);
			break;
		}
		case '_':
		{
			mUNDERSCORE(false);
			break;
		}
		case ':':
		{
			mCOLON(false);
			break;
		}
		case '?':
		{
			mQUESTION(false);
			break;
		}
		case '{':
		{
			mLEFT_CURLY(false);
			break;
		}
		case '}':
		{
			mRIGHT_CURLY(false);
			break;
		}
		case '.':
		{
			mDOT(false);
			break;
		}
		default:
			if ((_tokenSet_2.member(LA(1)))) {
				mOTHER(false);
			}
		else {
			throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
		}
		}
		}
		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
			_token = makeToken(_ttype);
			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
		}
		_returnToken = _token;
	}
	
/**
 * Matches a single '/' character.
 */
	protected final void mSLASH(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
		int _ttype; Token _token=null; int _begin=text.length();
		_ttype = SLASH;
		int _saveIndex;
		
		match('/');
		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
			_token = makeToken(_ttype);
			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
		}
		_returnToken = _token;
	}
	
/**
 * Matches a single '!' character.
 */
	protected final void mEXCLAIM(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
		int _ttype; Token _token=null; int _begin=text.length();
		_ttype = EXCLAIM;
		int _saveIndex;
		
		match('!');
		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
			_token = makeToken(_ttype);
			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
		}
		_returnToken = _token;
	}
	
/**
 * Matches all other unknown, non-whitespace characters, including the
 * extended ASCII range.
 */
	protected final void mOTHER(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
		int _ttype; Token _token=null; int _begin=text.length();
		_ttype = OTHER;
		int _saveIndex;
		
		switch ( LA(1)) {
		case '#':
		{
			match('#');
			break;
		}
		case '$':
		{
			match('$');
			break;
		}
		case '&':
		{
			match('&');
			break;
		}
		case '(':
		{
			match('(');
			break;
		}
		case ')':
		{
			match(')');
			break;
		}
		case '*':
		{
			match('*');
			break;
		}
		case '+':
		{
			match('+');
			break;
		}
		case ',':
		{
			match(',');
			break;
		}
		case ';':
		{
			match(';');
			break;
		}
		case '@':
		{
			match('@');
			break;
		}
		case '[':
		{
			match('[');
			break;
		}
		case '\\':
		{
			match('\\');
			break;
		}
		case ']':
		{
			match(']');
			break;
		}
		case '^':
		{
			match('^');
			break;
		}
		case '|':
		{
			match('|');
			break;
		}
		case '~':
		{
			match('~');
			break;
		}
		default:
			if (((LA(1) >= '\u0080' && LA(1) <= '\u00ff'))) {
				matchRange('\200','\377');
			}
		else {
			throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
		}
		}
		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
			_token = makeToken(_ttype);
			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
		}
		_returnToken = _token;
	}
	
/**
 * Matches a single '`' (back-tick) character.
 */
	public final void mBACK_TICK(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
		int _ttype; Token _token=null; int _begin=text.length();
		_ttype = BACK_TICK;
		int _saveIndex;
		
		match('`');
		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
			_token = makeToken(_ttype);
			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
		}
		_returnToken = _token;
	}
	
/**
 * Matches the HTML open comment "&lt;!--".
 */
	public final void mOPEN_COMMENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
		int _ttype; Token _token=null; int _begin=text.length();
		_ttype = OPEN_COMMENT;
		int _saveIndex;
		
		_ttype = UNKNOWN;
		
		
		mLT(false);
		mEXCLAIM(false);
		{
		if ((LA(1)=='-')) {
			mHYPHEN(false);
			{
			if ((LA(1)=='-')) {
				mHYPHEN(false);
				_ttype = OPEN_COMMENT;
			}
			else {
			}
			
			}
		}
		else {
		}
		
		}
		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
			_token = makeToken(_ttype);
			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
		}
		_returnToken = _token;
	}
	
/**
 * Matches a single '&lt;' character, normally used to start an opening HTML
 * element.
 */
	public final void mOPEN_START_TAG(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
		int _ttype; Token _token=null; int _begin=text.length();
		_ttype = OPEN_START_TAG;
		int _saveIndex;
		
		mLT(false);
		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
			_token = makeToken(_ttype);
			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
		}
		_returnToken = _token;
	}
	
/**
 * Matches the HTML close comment "--&gt;".
 */
	public final void mCLOSE_COMMENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
		int _ttype; Token _token=null; int _begin=text.length();
		_ttype = CLOSE_COMMENT;
		int _saveIndex;
		
		_ttype = UNKNOWN;
		
		
		mHYPHEN(false);
		mHYPHEN(false);
		{
		if ((LA(1)=='>')) {
			mGT(false);
			_ttype = CLOSE_COMMENT;
		}
		else {
		}
		
		}
		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
			_token = makeToken(_ttype);
			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
		}
		_returnToken = _token;
	}
	
/**
 * Matches a '/' followed by a '&gt;' normally used to close an HTML element
 * that has no content.
 */
	public final void mCLOSE_TAG_NO_CONTENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
		int _ttype; Token _token=null; int _begin=text.length();
		_ttype = CLOSE_TAG_NO_CONTENT;
		int _saveIndex;
		
		mSLASH(false);
		mGT(false);
		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
			_token = makeToken(_ttype);
			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
		}
		_returnToken = _token;
	}
	
/**
 * Matches a single '&gt;' character normally used to close an HTML element.
 */
	public final void mCLOSE_TAG(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
		int _ttype; Token _token=null; int _begin=text.length();
		_ttype = CLOSE_TAG;
		int _saveIndex;
		
		mGT(false);
		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
			_token = makeToken(_ttype);
			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
		}
		_returnToken = _token;
	}
	
	
	private static final long[] mk_tokenSet_0() {
		long[] data = { 287948901175001088L, 541165879296L, 0L, 0L, 0L};
		return data;
	}
	public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0());
	private static final long[] mk_tokenSet_1() {
		long[] data = new long[12];
		data[0]=-8358400008948547584L;
		data[1]=8646911288712101889L;
		for (int i = 2; i<=3; i++) { data[i]=-1L; }
		return data;
	}
	public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1());
	private static final long[] mk_tokenSet_2() {
		long[] data = new long[12];
		data[0]=576495215121006592L;
		data[1]=5764607525047500801L;
		for (int i = 2; i<=3; i++) { data[i]=-1L; }
		return data;
	}
	public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2());
	
	}