// $ANTLR 2.7.4: "directive.g" -> "DirectiveAntlrLexer.java"$
package org.jostraca.directive;
import java.util.Vector;
import java.util.Hashtable;
import java.io.InputStream;
import org.jostraca.comp.antlr.TokenStreamException;
import org.jostraca.comp.antlr.TokenStreamIOException;
import org.jostraca.comp.antlr.TokenStreamRecognitionException;
import org.jostraca.comp.antlr.CharStreamException;
import org.jostraca.comp.antlr.CharStreamIOException;
import org.jostraca.comp.antlr.ANTLRException;
import java.io.Reader;
import java.util.Hashtable;
import org.jostraca.comp.antlr.CharScanner;
import org.jostraca.comp.antlr.InputBuffer;
import org.jostraca.comp.antlr.ByteBuffer;
import org.jostraca.comp.antlr.CharBuffer;
import org.jostraca.comp.antlr.Token;
import org.jostraca.comp.antlr.CommonToken;
import org.jostraca.comp.antlr.RecognitionException;
import org.jostraca.comp.antlr.NoViableAltForCharException;
import org.jostraca.comp.antlr.MismatchedCharException;
import org.jostraca.comp.antlr.TokenStream;
import org.jostraca.comp.antlr.ANTLRHashString;
import org.jostraca.comp.antlr.LexerSharedInputState;
import org.jostraca.comp.antlr.collections.impl.BitSet;
import org.jostraca.comp.antlr.SemanticException;
public class DirectiveAntlrLexer extends org.jostraca.comp.antlr.CharScanner implements DirectiveAntlrLexerTokenTypes, TokenStream
{
private boolean iDirectiveNameSeen = false;
public DirectiveAntlrLexer(InputStream in) {
this(new ByteBuffer(in));
}
public DirectiveAntlrLexer(Reader in) {
this(new CharBuffer(in));
}
public DirectiveAntlrLexer(InputBuffer ib) {
this(new LexerSharedInputState(ib));
}
public DirectiveAntlrLexer(LexerSharedInputState state) {
super(state);
caseSensitiveLiterals = true;
setCaseSensitive(true);
literals = new Hashtable();
}
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 '"':
{
mDQSTRING(true);
theRetToken=_returnToken;
break;
}
case '\'':
{
mSQSTRING(true);
theRetToken=_returnToken;
break;
}
case '\t': case '\n': case '\r': case ' ':
{
mWS(true);
theRetToken=_returnToken;
break;
}
default:
if ((_tokenSet_0.member(LA(1))) && (true)) {
mDIRECTIVENAME(true);
theRetToken=_returnToken;
}
else if ((_tokenSet_0.member(LA(1))) && (true)) {
mNONSPACE(true);
theRetToken=_returnToken;
}
else if ((_tokenSet_0.member(LA(1))) && (true)) {
mARGNAME(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 mDQSTRING(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
int _ttype; Token _token=null; int _begin=text.length();
_ttype = DQSTRING;
int _saveIndex;
_saveIndex=text.length();
match('"');
text.setLength(_saveIndex);
{
_loop3:
do {
if ((LA(1)=='\\')) {
mESCDQ(false);
}
else if ((_tokenSet_1.member(LA(1)))) {
matchNot('"');
}
else {
break _loop3;
}
} while (true);
}
_saveIndex=text.length();
match('"');
text.setLength(_saveIndex);
if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
_token = makeToken(_ttype);
_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
}
_returnToken = _token;
}
protected final void mESCDQ(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
int _ttype; Token _token=null; int _begin=text.length();
_ttype = ESCDQ;
int _saveIndex;
_saveIndex=text.length();
match('\\');
text.setLength(_saveIndex);
{
switch ( LA(1)) {
case '"':
{
match('"');
break;
}
case '\\':
{
match('\\');
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;
}
public final void mSQSTRING(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
int _ttype; Token _token=null; int _begin=text.length();
_ttype = SQSTRING;
int _saveIndex;
_saveIndex=text.length();
match('\'');
text.setLength(_saveIndex);
{
_loop8:
do {
if ((LA(1)=='\\')) {
mESCSQ(false);
}
else if ((_tokenSet_2.member(LA(1)))) {
matchNot('\'');
}
else {
break _loop8;
}
} while (true);
}
_saveIndex=text.length();
match('\'');
text.setLength(_saveIndex);
if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
_token = makeToken(_ttype);
_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
}
_returnToken = _token;
}
protected final void mESCSQ(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
int _ttype; Token _token=null; int _begin=text.length();
_ttype = ESCSQ;
int _saveIndex;
_saveIndex=text.length();
match('\\');
text.setLength(_saveIndex);
{
switch ( LA(1)) {
case '\'':
{
match('\'');
break;
}
case '\\':
{
match('\\');
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;
}
public final void mDIRECTIVENAME(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
int _ttype; Token _token=null; int _begin=text.length();
_ttype = DIRECTIVENAME;
int _saveIndex;
boolean synPredMatched14 = false;
if (((LA(1)=='@') && (_tokenSet_3.member(LA(2))))) {
int _m14 = mark();
synPredMatched14 = true;
inputState.guessing++;
try {
{
match('@');
{
switch ( LA(1)) {
case '\t': case '\n': case '\r': case ' ':
{
mWS(false);
break;
}
case '-': 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': 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':
{
break;
}
default:
{
throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
}
}
}
mREFINEDID(false);
mWS(false);
}
}
catch (RecognitionException pe) {
synPredMatched14 = false;
}
rewind(_m14);
inputState.guessing--;
}
if ( synPredMatched14 ) {
_saveIndex=text.length();
match('@');
text.setLength(_saveIndex);
{
switch ( LA(1)) {
case '\t': case '\n': case '\r': case ' ':
{
_saveIndex=text.length();
mWS(false);
text.setLength(_saveIndex);
break;
}
case '-': 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': 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':
{
break;
}
default:
{
throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
}
}
}
mREFINEDID(false);
_saveIndex=text.length();
mWS(false);
text.setLength(_saveIndex);
if ( inputState.guessing==0 ) {
if( iDirectiveNameSeen ) {
String t = new String(text.getBuffer(),_begin,text.length()-_begin);
setText( "@"+t );
/* System.out.println( "dns t:"+iDirectiveNameSeen+": "+$getText ); */
_ttype = DirectiveAntlrLexerTokenTypes.NONSPACE;
}
else {
/* System.out.println( "dns f:"+iDirectiveNameSeen+": "+$getText ); */
iDirectiveNameSeen = true;
}
}
}
else {
boolean synPredMatched17 = false;
if (((_tokenSet_4.member(LA(1))) && (_tokenSet_5.member(LA(2))))) {
int _m17 = mark();
synPredMatched17 = true;
inputState.guessing++;
try {
{
mID(false);
match('=');
}
}
catch (RecognitionException pe) {
synPredMatched17 = false;
}
rewind(_m17);
inputState.guessing--;
}
if ( synPredMatched17 ) {
mID(false);
_saveIndex=text.length();
match('=');
text.setLength(_saveIndex);
if ( inputState.guessing==0 ) {
_ttype = DirectiveAntlrLexerTokenTypes.ARGNAME; /* System.out.println( "dnan: "+$getText ); */
}
}
else if ((_tokenSet_0.member(LA(1))) && (true)) {
mNONSPACE(false);
if ( inputState.guessing==0 ) {
_ttype = DirectiveAntlrLexerTokenTypes.NONSPACE; /* System.out.println( "dnns: "+$getText ); */
}
}
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;
}
public final void mWS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
int _ttype; Token _token=null; int _begin=text.length();
_ttype = WS;
int _saveIndex;
{
switch ( LA(1)) {
case ' ':
{
match(' ');
break;
}
case '\t':
{
match('\t');
break;
}
case '\n':
{
match('\n');
if ( inputState.guessing==0 ) {
newline();
}
break;
}
case '\r':
{
match('\r');
break;
}
default:
{
throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
}
}
}
if ( inputState.guessing==0 ) {
_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;
}
protected final void mREFINEDID(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
int _ttype; Token _token=null; int _begin=text.length();
_ttype = REFINEDID;
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':
{
matchRange('a','z');
break;
}
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':
{
matchRange('A','Z');
break;
}
case '_':
{
match('_');
break;
}
case '-':
{
match('-');
break;
}
case '0': case '1': case '2': case '3':
case '4': case '5': case '6': case '7':
case '8': case '9':
{
matchRange('0','9');
break;
}
default:
{
throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
}
}
}
{
_loop32:
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':
{
matchRange('a','z');
break;
}
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':
{
matchRange('A','Z');
break;
}
case '_':
{
match('_');
break;
}
case '-':
{
match('-');
break;
}
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 '/':
{
match('/');
break;
}
default:
{
break _loop32;
}
}
} while (true);
}
if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
_token = makeToken(_ttype);
_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
}
_returnToken = _token;
}
protected final void mID(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
int _ttype; Token _token=null; int _begin=text.length();
_ttype = ID;
int _saveIndex;
{
int _cnt28=0;
_loop28:
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':
{
matchRange('a','z');
break;
}
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':
{
matchRange('A','Z');
break;
}
case '_':
{
match('_');
break;
}
case '-':
{
match('-');
break;
}
case '0': case '1': case '2': case '3':
case '4': case '5': case '6': case '7':
case '8': case '9':
{
matchRange('0','9');
break;
}
default:
{
if ( _cnt28>=1 ) { break _loop28; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
}
}
_cnt28++;
} 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 mNONSPACE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
int _ttype; Token _token=null; int _begin=text.length();
_ttype = NONSPACE;
int _saveIndex;
{
match(_tokenSet_0);
}
{
_loop25:
do {
if ((_tokenSet_6.member(LA(1)))) {
{
match(_tokenSet_6);
}
}
else {
break _loop25;
}
} while (true);
}
if ( inputState.guessing==0 ) {
_ttype = DirectiveAntlrLexerTokenTypes.NONSPACE; /* System.out.println( "ns: "+$getText ); */
}
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 mARGNAME(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
int _ttype; Token _token=null; int _begin=text.length();
_ttype = ARGNAME;
int _saveIndex;
boolean synPredMatched20 = false;
if (((_tokenSet_4.member(LA(1))) && (_tokenSet_5.member(LA(2))))) {
int _m20 = mark();
synPredMatched20 = true;
inputState.guessing++;
try {
{
mID(false);
match('=');
}
}
catch (RecognitionException pe) {
synPredMatched20 = false;
}
rewind(_m20);
inputState.guessing--;
}
if ( synPredMatched20 ) {
mID(false);
_saveIndex=text.length();
match('=');
text.setLength(_saveIndex);
if ( inputState.guessing==0 ) {
/* System.out.println( "anan: "+$getText ); */
}
}
else if ((_tokenSet_0.member(LA(1))) && (true)) {
mNONSPACE(false);
if ( inputState.guessing==0 ) {
_ttype = DirectiveAntlrLexerTokenTypes.NONSPACE; /* System.out.println( "anns: "+$getText ); */
}
}
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;
}
private static final long[] mk_tokenSet_0() {
long[] data = new long[8];
data[0]=-571230660104L;
for (int i = 1; i<=3; i++) { data[i]=-1L; }
return data;
}
public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0());
private static final long[] mk_tokenSet_1() {
long[] data = new long[8];
data[0]=-17179869192L;
data[1]=-268435457L;
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[8];
data[0]=-549755813896L;
data[1]=-268435457L;
for (int i = 2; i<=3; i++) { data[i]=-1L; }
return data;
}
public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2());
private static final long[] mk_tokenSet_3() {
long[] data = { 287984089842066944L, 576460745995190270L, 0L, 0L, 0L};
return data;
}
public static final BitSet _tokenSet_3 = new BitSet(mk_tokenSet_3());
private static final long[] mk_tokenSet_4() {
long[] data = { 287984085547089920L, 576460745995190270L, 0L, 0L, 0L};
return data;
}
public static final BitSet _tokenSet_4 = new BitSet(mk_tokenSet_4());
private static final long[] mk_tokenSet_5() {
long[] data = { 2593827094760783872L, 576460745995190270L, 0L, 0L, 0L};
return data;
}
public static final BitSet _tokenSet_5 = new BitSet(mk_tokenSet_5());
private static final long[] mk_tokenSet_6() {
long[] data = new long[8];
data[0]=-4294977032L;
for (int i = 1; i<=3; i++) { data[i]=-1L; }
return data;
}
public static final BitSet _tokenSet_6 = new BitSet(mk_tokenSet_6());
}