/* A lexical scanner generated by flex */

/* Scanner skeleton version:
 * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.85 95/04/24 10:48:47 vern Exp $
 */

/**************************************************/
/* Indicate the flex optimization template */

//FLEXFLAGS=Cem


/**************************************************/

package JavaAgent.resource.fopl ;

/**************************************************/

import java.util.*;
import java.io.*;
import jbf.*;

/**************************************************/

// PREFIX



/**************************************************/


public
class YYlex {

    // Set up the fake goto mechanism
    protected int Goto;
    protected static final int yynobranch = 0;
    protected static final int yy_find_action = 1;
    protected static final int yy_match = 2;
    protected static final int do_action = 3;

// CONSTANTS

public static final int YY_FLEX_MAJOR_VERSION = 2;
public static final int YY_FLEX_MINOR_VERSION = 5;
public static final int YY_NULL = 0;
public static final int YY_MORE_ADJ = 0;
public static final int YY_END_OF_BUFFER_CHAR = 0;
public static final int YY_BUF_SIZE = 16384;
public static final int YY_READ_BUF_SIZE = 8192;
public static final int EOB_ACT_CONTINUE_SCAN = 0;
public static final int EOB_ACT_END_OF_FILE = 1;
public static final int EOB_ACT_LAST_MATCH = 2;
public static final int YY_START_STACK_INCR = 25;
public static final int YY_BUFFER_NEW = 0;
public static final int YY_BUFFER_NORMAL = 1;
public static final int YY_BUFFER_EOF_PENDING = 2;
public static final int YY_NUM_RULES = 22;
public static final int YY_END_OF_BUFFER = 23;
public static final int YY_SPECIAL = 147;


// STATES

public static final int INITIAL = 0;


// MISC.

    protected static final int EOF = -1;


// Class State

    Int_Stack yy_start_stack;
    java.io.InputStream yyin;
    java.io.PrintStream yyout;
    int yy_start;		/* start state number */
    int yy_last_accepting_state;
    int yy_last_accepting_cpos;
    YYtoken yylval;
    Integer yytokentype;
    protected StringBuffer lexeme;
    YYlexbuffer yytext;
    public int yydebug;

    boolean yy_at_bol;
    boolean is_interactive;
    int yy_current_state;
    int yy_act;


// PROCS



public YYlex(java.io.InputStream fin) {this(fin,System.out);}
public YYlex() {this(System.in,System.out);}

public
YYlex(java.io.InputStream fin, java.io.PrintStream fout)
{
    yyin = fin;
    yyout = fout;
    yy_start_stack = new Int_Stack();
    yy_start = 1;		/* start state number */
    yy_last_accepting_state = 0;
    yy_last_accepting_cpos = 0;
    yy_current_state = 0;
    yy_act = 0;
    yy_at_bol = true; //pretend
    is_interactive= false;
    yylval = new YYtoken();
    yytokentype = null;
    yydebug = 0;
    yytext = new YYlexbuffer(yyin,yyout);
    lexeme = new StringBuffer();
    
}

public
Integer
yylex() throws LexException, IOException, EmptyStackException
{
	yylval.clear();
	yytext.purge();

scanloop:
    while( true ) {	      /* loops until end-of-file is reached */

	yytext.setmark();

	int thisch = yytext.nextchar();
	if(thisch == EOF) thisch = YY_END_OF_BUFFER_CHAR;

branch: switch (Goto) {
case yynobranch:

	yy_current_state = yy_start;

	yy_current_state += YY_AT_BOL(); //<<
	do {
///**/yyout.println("(1)yy_current_state=" + yy_current_state);
	    int yy_c;
	    // yy_c = yy_ec[YY_SC_TO_UI(thisch)];
	    yy_c = yy_ec[thisch];
///**/yyout.println("(1)yy_c=" + yy_c);
///**/yyout.println("(1)yy_accept[yy_current_state]=" + yy_accept[yy_current_state]);
	    if ( yy_accept[yy_current_state]  != 0) {
		yy_last_accepting_cpos = yytext.currentpos();
		yy_last_accepting_state = yy_current_state;
///**/yyout.println("(1)yy_last_accepting_state=" + yy_last_accepting_state);
///**/yyout.println("(1)yy_last_accepting_cpos=" + yy_last_accepting_cpos);
	    }
	   while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state)
	   {
///**/yyout.println("(2)yy_chk[yy_base[yy_current_state]+yy_c]="+yy_chk[yy_base[yy_current_state] + yy_c]);
		yy_current_state = (int) yy_def[yy_current_state];
///**/yyout.println("(2)yy_current_state=" + yy_current_state);
		if ( yy_current_state >= yy_accept.length ) {
			yy_c = yy_meta[yy_c];
///**/yyout.println("(2)yy_c=" + yy_c);
			}
	   }
	   yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
///**/yyout.println("(3)yy_current_state=" + yy_current_state);
///**/yyout.println("yy_at_bol=" + yy_at_bol);
	   yy_at_bol = (thisch == '\n');
	   thisch = yytext.nextchar();
	   if(thisch == EOF) thisch = YY_END_OF_BUFFER_CHAR;
	} while ( yy_base[yy_current_state] != YY_SPECIAL );

















case yy_find_action:
	yy_act = yy_accept[yy_current_state];
///**/yyout.println("(4)yy_act=" + yy_act);
	if ( yy_act == 0 ) {
	    /* have to back up to last accepting state*/
	    do {
		yytext.backup();
	    } while(yytext.currentpos() >= yy_last_accepting_cpos);
	    thisch = yytext.nextchar();
///**/yyout.print("backup:"+" yyline="+lineno()+" ; yychar="+charno0()+" ; yylinechar="+charno()+" ; yytext=/"+yytext+"/");
	    yy_current_state = yy_last_accepting_state;
	    yy_act = yy_accept[yy_current_state];
///**/yyout.println("(5)yy_current_state=" + yy_current_state);
///**/yyout.println("(5)yy_act=" + yy_act);
	}

	// YY_DO_BEFORE_ACTION;

case do_action:	     /* This label is used only to access EOF actions. */

	yy_at_bol = (yytext.charno0() == 0);
	yytext.backup();
	yytext.getlexeme(yylval.text());	
	yytokentype = null; // => no token returned

///**/yyout.println("(6)yy_act=" + yy_act);
///**/yyout.println("(6)yytext=/"+yytext+ "/");
///**/yyout.println("(6)yy_at_bol=" + yy_at_bol);

///**/yyout.println("yytext.lexeme=/" + yytext + "/");

	switch ( yy_act ) { /* beginning of action switch */
		case 0: /* must back up */
		/* have to back up to last accepting state*/
		do {
		    yytext.backup();
		} while(yytext.currentpos() > yy_last_accepting_cpos);
		thisch = yytext.nextchar();
///**/yyout.print("backup:"+" yyline="+lineno()+" ; yychar="+charno0()+" ; yylinechar="+charno()+" ; yytext=/"+yytext+"/");
		yy_current_state = yy_last_accepting_state;
		{Goto = yy_find_action; break branch;}

// ACTIONS

case 1:
/* no action */
break;
case 2:
{ yyreturn('('); }
break;
case 3:
{ yyreturn(')'); }
break;
case 4:
{ yyreturn('='); }
break;
case 5:
{ yyreturn(TERM); }
break;
case 6:
{ yyreturn(LITERAL); }
break;
case 7:
{ yyreturn(FORMULA); }
break;
case 8:
{ yyreturn(FORMS); }
break;
case 9:
{ yyreturn(CLAUSE); }
break;
case 10:
{ yyreturn(CLAUSESET); }
break;
case 11:
{ yyreturn(LIST); }
break;
case 12:
{ yyreturn(FORALL); }
break;
case 13:
{ yyreturn(EXISTS); }
break;
case 14:
{ yyreturn(OR); }
break;
case 15:
{ yyreturn(AND); }
break;
case 16:
{ yyreturn(IMPLIES); }
break;
case 17:
{ yyreturn(IFF); }
break;
case 18:
{ yyreturn(XOR); }
break;
case 19:
{ yyreturn(NOT); }
break;
case 20:
{ yyreturn(VARIABLE); }
break;
case 21:
{ yyreturn(CONSTANT); }
break;
case 22:
break;
case YY_END_OF_BUFFER + 1 + INITIAL :
yytokentype = YYtokentypes.YYEOF; break;



case YY_END_OF_BUFFER:
///**/yyout.println("case YY_END_OF_BUFFER");
	yy_act = YY_STATE_EOF(YY_START());
	{Goto = do_action; break branch;}

    default:
	yyfatalerror(
		"fatal flex scanner internal error--no action found" );
	break;
} /* end of action switch */
if(yytokentype != null) {
    yylval.settokentype(yytokentype);
    yytext.getlexemelocation(yylval.location());
    if(yydebug >= 1) yyreport(yylval);	  
    return yytokentype;
} else {
    if(yydebug >= 10) yyout.println("yylex: no token produced");
}
} //branch
} /* end of scanning one token */
} /* end of yylex */

public
void
yy_push_state( int new_state )
{
    yy_start_stack.push(YY_START());
    BEGIN(new_state);
}

public
void
yy_pop_state()
{
    BEGIN(yy_start_stack.pop());
}

protected 
int
yy_top_state()
{
    return yy_start_stack.top();
}

protected
void
yyfatalerror( String msg) throws LexException
{
    throw new LexException("yylex: fatalerror: " + msg);
}

public
void
yylexerror(String s) throws LexException
{
    yyout.println("yylexerror: "
		    + "char/line+char "
		    + yytext.charno0()
		    + "/"
		    + yytext.lineno()
		    + "+"
		    + yytext.charno0()
		    + " ; "
		    + s);
    throw new LexException(s);
}

public
YYtoken
yyreport(YYtoken yylval)
{
    if(yylval != null) {
	yyout.println("yylex: "
		    + " char/line+char "
		    + yylval.charno0()
		    + "/"
		    + yylval.lineno()
		    + "+"
		    + yylval.charno()
		    + " /"
		    + YYtokentypes.tokenname(yylval.tokentype())
		    + "/(" + yylval.tokentype()
		    + ") ; text=#"
		    + yylval.text
		    + "#");
    } else {
	yyout.println("yylex: "
		    + " char/line+char "
		    + yytext.charno0()
		    + "/"
		    + yytext.lineno()
		    + "+"
		    + yytext.charno0()
		    + " /EOF/");
    }
    return yylval;
}

protected void BEGIN(int n) {yy_start = 1+2*n;}
public void yybegin(int n) {BEGIN(n);}
public int YY_START() {return (yy_start-1)/2;}
protected int YY_AT_BOL() {return (yy_at_bol)?1:0;}
protected int YY_STATE_EOF(int st) {return YY_END_OF_BUFFER + st + 1;}

/* Promotes a possibly negative, possibly signed char to an unsigned
 * integer for use as an array index.  If the signed char is negative,
 * we want to instead treat it as an 8-bit unsigned char, hence the
 * double cast.
 */
protected int YY_SC_TO_UI(char c) {return (int)((short)c);}

public
void
yy_set_interactive(boolean is_interactive)
{
    this.is_interactive= is_interactive;
}

protected
void
yy_set_bol(boolean at_bol)
{
    yy_at_bol = at_bol;
}

// TABLES

public static final short yy_accept[] = 
    {   0,
        0,    0,   23,   21,    1,    2,    3,   21,    4,   21,
       21,   21,   21,   21,   21,   21,   21,   21,   21,   21,
       21,   21,   21,   21,   21,   21,   21,   21,   21,   21,
       21,    1,   21,   16,   20,   21,   21,   21,   21,   21,
       21,   21,   21,   14,   21,   21,   21,   21,   21,   21,
       21,   21,   21,   21,   21,   21,   17,   15,   21,   21,
       21,   21,   21,   21,   19,   21,   18,   21,   21,   21,
       21,   21,   21,   21,   21,   21,   21,   21,   21,   11,
       21,    5,   21,   21,   21,   21,   21,   21,   21,   21,
       21,    8,   21,   21,   21,   21,   21,   21,   21,   21,

       21,    9,   13,   12,   21,   21,   21,    9,   21,   21,
       21,   21,    7,    6,   21,   21,   21,   10,    0
};

public static final int yy_ec[] = 
    {   0,
        1,    1,    1,    1,    1,    1,    1,    1,    2,    2,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    2,    1,    1,    1,    1,    1,    1,    1,    3,
        4,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    5,
        6,    7,    8,    1,    9,    1,   10,   11,   12,   13,
        1,    1,   14,    1,    1,   15,   16,   17,   18,   19,
        1,   20,   21,   22,   23,    1,    1,   24,    1,    1,
        1,    1,    1,    1,    1,    1,   25,    1,   26,   27,

       28,   29,    1,    1,   30,    1,    1,   31,   32,   33,
       34,   35,    1,   36,   37,   38,   39,    1,    1,   40,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,

        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1
};

public static final short yy_nxt[] = 
    {   0,
        4,    5,    6,    7,    8,    9,    4,   10,   11,   12,
        4,   13,   14,   15,   16,    4,   17,   18,    4,    4,
        4,   19,    4,   20,   21,   22,    4,   23,   24,   25,
       26,    4,   27,   28,    4,    4,    4,   29,    4,   30,
       40,   51,   77,   41,   52,   63,   64,   72,   73,   78,
       85,   92,   92,   93,   99,   35,   31,   86,  118,  118,
      117,  116,  114,   34,  113,  115,  114,   34,  113,  112,
      111,  110,  109,  104,  103,  108,  107,  106,  105,  104,
      103,  102,  101,  100,   98,   97,   96,   95,   94,   91,
       90,   89,   82,   88,   80,   87,   84,   83,   82,   81,

       80,   79,   76,   75,   67,   74,   65,   71,   57,   70,
       69,   68,   58,   67,   66,   65,   62,   57,   61,   60,
       59,   58,   57,   32,   56,   55,   44,   54,   53,   50,
       49,   48,   47,   46,   45,   44,   43,   42,   39,   38,
       37,   36,   34,   33,   32,  119,    3,  119,  119,  119,
      119,  119,  119,  119,  119,  119,  119,  119,  119,  119,
      119,  119,  119,  119,  119,  119,  119,  119,  119,  119,
      119,  119,  119,  119,  119,  119,  119,  119,  119,  119,
      119,  119,  119,  119,  119,  119,  119
};

public static final int yy_meta[] = 
    {   0,
        1,    2,    2,    2,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1
};

public static final short yy_base[] = 
    {   0,
        0,    0,  146,    0,  143,  147,  147,  138,  136,    0,
      125,  126,  116,  121,   28,  124,  119,  116,  123,  116,
      100,  101,   91,   96,   13,   99,   94,   91,   98,   91,
        0,  122,  116,    0,    0,  111,  112,  106,   99,  105,
       98,   25,   94,    0,   95,   94,   86,   87,   81,   74,
       80,   73,   11,   69,   70,   69,    0,    0,   81,   82,
       34,   87,   79,   88,    0,   83,    0,   59,   60,   26,
       65,   57,   66,   61,   71,   69,   75,   31,   75,    0,
       68,    0,   50,   48,   54,   16,   54,   47,   70,   60,
       65,    0,   64,   66,   68,   48,   38,   43,   42,   44,

       46,   49,    0,    0,   60,   47,   52,   29,   40,   27,
       32,   50,    0,    0,   33,   38,   21,    0,  147,   56,
       55
};

public static final short yy_def[] = 
    {   0,
      119,    1,  119,  120,  119,  119,  119,  120,  120,  121,
      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,
      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,
      120,  119,  120,  120,  121,  120,  120,  120,  120,  120,
      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,
      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,
      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,
      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,
      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,
      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,

      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,
      120,  120,  120,  120,  120,  120,  120,  120,    0,  119,
      119
};

public static final short yy_chk[] = 
    {   0,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
       15,   25,   61,   15,   25,   42,   42,   53,   53,   61,
       70,   78,   86,   78,   86,  121,  120,   70,  117,  116,
      115,  112,  111,  110,  109,  108,  107,  106,  105,  102,
      101,  100,   99,   98,   97,   96,   95,   94,   93,   91,
       90,   89,   88,   87,   85,   84,   83,   81,   79,   77,
       76,   75,   74,   73,   72,   71,   69,   68,   66,   64,

       63,   62,   60,   59,   56,   55,   54,   52,   51,   50,
       49,   48,   47,   46,   45,   43,   41,   40,   39,   38,
       37,   36,   33,   32,   30,   29,   28,   27,   26,   24,
       23,   22,   21,   20,   19,   18,   17,   16,   14,   13,
       12,   11,    9,    8,    5,    3,  119,  119,  119,  119,
      119,  119,  119,  119,  119,  119,  119,  119,  119,  119,
      119,  119,  119,  119,  119,  119,  119,  119,  119,  119,
      119,  119,  119,  119,  119,  119,  119,  119,  119,  119,
      119,  119,  119,  119,  119,  119,  119
};



// SUFFIX



public static final Integer CONSTANT = YYtokentypes.Tokentype[258];
public static final Integer VARIABLE = YYtokentypes.Tokentype[259];
public static final Integer NOT = YYtokentypes.Tokentype[260];
public static final Integer IMPLIES = YYtokentypes.Tokentype[261];
public static final Integer IFF = YYtokentypes.Tokentype[262];
public static final Integer XOR = YYtokentypes.Tokentype[263];
public static final Integer AND = YYtokentypes.Tokentype[264];
public static final Integer OR = YYtokentypes.Tokentype[265];
public static final Integer FORALL = YYtokentypes.Tokentype[266];
public static final Integer EXISTS = YYtokentypes.Tokentype[267];
public static final Integer LIST = YYtokentypes.Tokentype[268];
public static final Integer TERM = YYtokentypes.Tokentype[269];
public static final Integer LITERAL = YYtokentypes.Tokentype[270];
public static final Integer FORMULA = YYtokentypes.Tokentype[271];
public static final Integer CLAUSE = YYtokentypes.Tokentype[272];
public static final Integer CLAUSESET = YYtokentypes.Tokentype[273];
public static final Integer FORMS = YYtokentypes.Tokentype[274];


public void setdebug(boolean d) {yydebug = d?1:0; yytext.setdebug(d);}
public void setdebug(int i) {yydebug = i>0?i:0; yytext.setdebug(i);}

public void yyreturn(Integer ttype) {yytokentype = ttype;}
public void yyreturn(int ttype) {
    if(ttype >= 0 && ttype < YYtokentypes.tokenmax) {
	yytokentype = YYtokentypes.Tokentype[ttype];
    } else {
	yytokentype = new Integer(ttype);
    }
}
public StringBuffer yytext() {return yylval.text();}

// return 0 based line number
public int lineno() {return yytext.lineno();}

// return 0 based absolute char number
public int charno0() {return yytext.charno0();}

// return 0 based char number within line
public int charno() {return yytext.charno();}

} // class YYlex
