/* A lexical scanner generated by flex */

/* scanner skeleton version:
 * $Header: /usr/fsys/odin/a/vern/flex/RCS/flex.skel,v 2.16 90/08/03 14:09:36 vern Exp $
 */

#define FLEX_SCANNER

#include <stdio.h>


/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
#ifdef c_plusplus
#ifndef __cplusplus
#define __cplusplus
#endif
#endif


#ifdef __cplusplus

#include <stdlib.h>
#include <osfcn.h>

/* use prototypes in function declarations */
#define YY_USE_PROTOS

/* the "const" storage-class-modifier is valid */
#define YY_USE_CONST

#else	/* ! __cplusplus */

#ifdef __STDC__

#ifdef __GNUC__
#include <stddef.h>
void *malloc( size_t );
void free( void* );
#else
#include <stdlib.h>
#endif	/* __GNUC__ */

#define YY_USE_PROTOS
#define YY_USE_CONST

#endif	/* __STDC__ */
#endif	/* ! __cplusplus */


#ifdef __TURBOC__
#define YY_USE_CONST
#endif


#ifndef YY_USE_CONST
#define const
#endif


#ifdef YY_USE_PROTOS
#define YY_PROTO(proto) proto
#else
#define YY_PROTO(proto) ()
/* we can't get here if it's an ANSI C compiler, or a C++ compiler,
 * so it's got to be a K&R compiler, and therefore there's no standard
 * place from which to include these definitions
 */
char *malloc();
int free();
int read();
#endif


/* amount of stuff to slurp up with each read */
#ifndef YY_READ_BUF_SIZE
#define YY_READ_BUF_SIZE 8192
#endif

/* returned upon end-of-file */
#define YY_END_TOK 0

/* copy whatever the last rule matched to the standard output */

/* cast to (char *) is because for 8-bit chars, yytext is (unsigned char *) */
/* this used to be an fputs(), but since the string might contain NUL's,
 * we now use fwrite()
 */
#define ECHO (void) fwrite( (char *) yytext, yyleng, 1, yyout )

/* gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
 * is returned in "result".
 */
#define YY_INPUT(buf,result,max_size) \
	if ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \
	    YY_FATAL_ERROR( "read() in flex scanner failed" );
#define YY_NULL 0

/* no semi-colon after return; correct usage is to write "yyterminate();" -
 * we don't want an extra ';' after the "return" because that will cause
 * some compilers to complain about unreachable statements.
 */
#define yyterminate() return ( YY_NULL )

/* report a fatal error */

/* The funky do-while is used to turn this macro definition into
 * a single C statement (which needs a semi-colon terminator).
 * This avoids problems with code like:
 *
 * 	if ( something_happens )
 *		YY_FATAL_ERROR( "oops, the something happened" );
 *	else
 *		everything_okay();
 *
 * Prior to using the do-while the compiler would get upset at the
 * "else" because it interpreted the "if" statement as being all
 * done when it reached the ';' after the YY_FATAL_ERROR() call.
 */

#define YY_FATAL_ERROR(msg) \
	do \
		{ \
		(void) fputs( msg, stderr ); \
		(void) putc( '\n', stderr ); \
		exit( 1 ); \
		} \
	while ( 0 )

/* default yywrap function - always treat EOF as an EOF */
#define yywrap() 1

/* enter a start condition.  This macro really ought to take a parameter,
 * but we do it the disgusting crufty way forced on us by the ()-less
 * definition of BEGIN
 */
#define BEGIN yy_start = 1 + 2 *

/* action number for EOF rule of a given start state */
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)

/* special action meaning "start processing a new file" */
#define YY_NEW_FILE \
	do \
		{ \
		yy_init_buffer( yy_current_buffer, yyin ); \
		yy_load_buffer_state(); \
		} \
	while ( 0 )

/* default declaration of generated scanner - a define so the user can
 * easily add parameters
 */
#define YY_DECL int yylex YY_PROTO(( void )) 

/* code executed at the end of each rule */
#define YY_BREAK break;

#define YY_END_OF_BUFFER_CHAR 0

#ifndef YY_BUF_SIZE
#define YY_BUF_SIZE (YY_READ_BUF_SIZE * 2) /* size of default input buffer */
#endif

typedef struct yy_buffer_state *YY_BUFFER_STATE;

#define YY_CHAR char
# line 1 "lit-deatify.lex"
#define INITIAL 0
# line 2 "lit-deatify.lex"
#define LEX_STK_SIZE 256

int lex_stk[LEX_STK_SIZE];
int lex_stk_top = 0;

#define PUSH(x)            lex_stk[++lex_stk_top] = (x); BEGIN(x)
#define POP                BEGIN(lex_stk[--lex_stk_top])
#define LEX_STK_TOP        lex_stk[lex_stk_top]
#define LEX_NEXT_TO_STK_TOP lex_stk[lex_stk_top - 1]
#define CHG_TOP(x)         lex_stk[lex_stk_top] = (x); BEGIN(x)
#define CHG_NEXT_TO_TOP(x) lex_stk[lex_stk_top - 1] = (x)
/* not a lot in the old stack {over,under}flow dept, what? */

extern char *yytext; /* forward decl */
void print_leading_whitespace();

void
print_lex_stk () /* just for debugging */
{
    int i;
    fprintf(stderr,"lex_stk:");
    for (i = lex_stk_top; i >= 0; i--) {
        fprintf(stderr," %d",lex_stk[i]);
    }
    fprintf(stderr,"::%s\n",yytext);
}
int verbose;       /* set from first argv */
int follow_inputs; /* set from second argv */

#if defined (SYSV) || defined (SYSV)
#include <string.h>
#include <time.h>
#else
#include <strings.h>
#include <sys/time.h>
#endif

#if defined (SYSV)
#define index(string, ch) strchr ((string), (ch))
#endif

#define INPUTFILE_STK_SIZE 20
struct {
    YY_BUFFER_STATE handle; /* flex-supplied magic */
    char*           name;
    int             lineno;
} inputfile_stk[INPUTFILE_STK_SIZE];
int   inputfile_stk_top = 0;
void  push_inputfile();
void  pop_inputfile();
int   i; /* temporary */
char* rbrace;
int deatify_debug       = 0;
int unmatched_lbraces   = 0;
int unmatched_lbrackets = 0;

/* like everything, must track srcfile name and lineno */
char srcfile_name[1024]; /* too lazy to do this right */
int  lineno = 1; /* count \n's as they go by */
int  lineno_fiddled = 0; /* boolean: incr if newlines get trashed */

int  exit_status = 0;
void not_OK ();  /* prints an error msg and bumps exit_status */
void warning (); /* same, but no exit-status fiddling */

int lit2what; /* set from ARGV */

#define IS_LIT2PGM_Q    (lit2what == 1)
#define IS_LIT2PGM      (lit2what == 2)
#define IS_LIT2TEXI     (lit2what == 3)
#define IS_LIT2LATEX    (lit2what == 4)
#define IS_LIT2DEPEND   (lit2what == 5)
#define IS_LIT2CHANGELOG (lit2what== 6)

/* the condition for printing to stdout */
#define SHLD_PRINT      (! IS_LIT2PGM_Q || (LEX_STK_TOP == Code || LEX_STK_TOP == Bird))

void myecho();
#define MYECHO myecho()
void myprintstr();

#define YY_USER_ACTION if (deatify_debug) print_lex_stk(); /* debugging */
#define Norm 1
#define Verb 2
#define Code 3
#define Bird 4
#define Atting 5
#define Math 6
#define Index 7
#define Typing 8
#define Linify_braces 9
#define Linify_brackets 10
# line 89 "lit-deatify.lex"

/* done after the current pattern has been matched and before the
 * corresponding action - sets up yytext
 */
#define YY_DO_BEFORE_ACTION \
	yytext = yy_bp; \
	yyleng = yy_cp - yy_bp; \
	yy_hold_char = *yy_cp; \
	*yy_cp = '\0'; \
	yy_c_buf_p = yy_cp;

#define EOB_ACT_CONTINUE_SCAN 0
#define EOB_ACT_END_OF_FILE 1
#define EOB_ACT_LAST_MATCH 2

/* return all but the first 'n' matched characters back to the input stream */
#define yyless(n) \
	do \
		{ \
		/* undo effects of setting up yytext */ \
		*yy_cp = yy_hold_char; \
		yy_c_buf_p = yy_cp = yy_bp + n; \
		YY_DO_BEFORE_ACTION; /* set up yytext again */ \
		} \
	while ( 0 )

#define unput(c) yyunput( c, yytext )


struct yy_buffer_state
    {
    FILE *yy_input_file;

    YY_CHAR *yy_ch_buf;		/* input buffer */
    YY_CHAR *yy_buf_pos;	/* current position in input buffer */

    /* size of input buffer in bytes, not including room for EOB characters*/
    int yy_buf_size;	

    /* number of characters read into yy_ch_buf, not including EOB characters */
    int yy_n_chars;

    int yy_eof_status;		/* whether we've seen an EOF on this buffer */
#define EOF_NOT_SEEN 0
    /* "pending" happens when the EOF has been seen but there's still
     * some text process
     */
#define EOF_PENDING 1
#define EOF_DONE 2
    };

static YY_BUFFER_STATE yy_current_buffer;

/* we provide macros for accessing buffer states in case in the
 * future we want to put the buffer states in a more general
 * "scanner state"
 */
#define YY_CURRENT_BUFFER yy_current_buffer


/* yy_hold_char holds the character lost when yytext is formed */
static YY_CHAR yy_hold_char;

static int yy_n_chars;		/* number of characters read into yy_ch_buf */



#ifndef YY_USER_ACTION
#define YY_USER_ACTION
#endif

#ifndef YY_USER_INIT
#define YY_USER_INIT
#endif

extern YY_CHAR *yytext;
extern int yyleng;
extern FILE *yyin, *yyout;

YY_CHAR *yytext;
int yyleng;

FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;

#define YY_END_OF_BUFFER 111
typedef int yy_state_type;
static const short int yy_accept[398] =
    {   0,
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
        0,    0,  111,    1,  110,   40,   39,   41,   32,   40,
       30,   40,   40,   40,   39,   47,   48,   47,   47,   47,
       53,   53,   52,   51,   63,   62,   60,   57,   58,   59,
       71,   70,   68,   65,   71,   71,   66,   67,  105,  104,
      103,  102,   89,   93,  100,   74,   78,   83,   86,   74,
       88,  105,   85,   74,   76,   81,   95,   74,   98,   77,
       82,   39,    0,    0,    0,    0,   38,   31,   36,   29,
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,

        0,    0,    0,   34,   35,    0,   12,    0,    0,   39,
        0,   46,    0,    0,    0,   52,    0,    0,   50,   51,
       51,   62,   54,    0,   70,   64,  104,  101,   87,   90,
       84,   73,   84,    0,   92,    0,    0,   75,   79,   80,
       94,   96,   97,    0,    0,    0,   11,    0,    0,    0,
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
        0,    0,    0,    0,    0,    0,    0,    0,   39,    0,
        0,   50,   50,    0,    0,    0,    0,    9,    0,   10,
       37,    0,    0,    0,    0,    0,    0,    0,    0,    0,
        0,    0,    0,   27,    0,    0,    0,    0,    0,   39,

        0,    0,    0,   91,   72,    0,    0,    0,    0,    0,
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
        0,    0,   39,    0,    0,    0,    0,    0,    0,   16,
        0,    0,    0,   28,    0,    0,   21,    0,    0,    0,
        0,    0,    0,   39,    0,    0,    0,    0,    0,    0,
        0,    0,    0,    0,   33,   19,    0,   22,    0,    0,
       26,    0,    0,   39,    0,    0,    0,    0,    0,   13,
        0,    0,   17,    0,    0,    0,    0,    0,    0,    0,
        0,    0,    0,    0,    0,    0,    0,    0,   14,    0,
       18,    0,    0,   24,   23,    0,    0,    0,    0,    0,

        0,    0,    0,    0,    0,    0,   56,    0,    0,    0,
        0,    0,    0,    0,    0,    3,    0,    0,    0,    0,
       45,    0,    0,   20,    0,    0,    0,    0,    0,    0,
        0,    0,    0,   55,   15,    0,    0,    0,    0,    0,
        0,    0,    0,    0,    0,    0,    8,    0,    0,    0,
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
        0,   42,    0,    0,    0,    0,    0,    0,    0,    0,
        0,    0,    0,    0,    0,   44,   25,    0,    0,    0,
        5,    0,    0,    0,    0,    0,    0,    0,    0,    7,
        2,   43,    0,    0,    0,    6,    0

    } ;

static const YY_CHAR yy_ec[128] =
    {   0,
        1,    1,    1,    2,    2,    2,    2,    2,    3,    4,
        2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
        2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
        2,    3,    5,    2,    2,    6,    7,    2,    2,    2,
        2,    2,    2,    2,    2,    2,    2,    8,    8,    8,
        8,    8,    8,    8,    8,    8,    8,    2,    2,    2,
        2,    9,    2,   10,   11,   11,   11,   11,   11,   11,
       11,   11,   11,   11,   11,   11,   11,   11,   11,   11,
       11,   11,   11,   11,   11,   11,   11,   11,   11,   11,
       12,   13,   14,    2,   15,    2,   16,   17,   18,   19,

       20,   21,   22,   23,   24,   11,   11,   25,   26,   27,
       28,   29,   11,   30,   31,   32,   33,   34,   35,   36,
       37,   11,   38,    2,   39,    2,    2
    } ;

static const YY_CHAR yy_meta[40] =
    {   0,
        1,    1,    2,    3,    1,    1,    1,    2,    1,    1,
        2,    1,    1,    1,    1,    2,    2,    2,    2,    2,
        2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
        2,    2,    2,    2,    2,    2,    2,    1,    4
    } ;

static const short int yy_base[425] =
    {   0,
      609,  608,    0,   39,  604,    4,  603,    7,   15,   18,
       78,  117,  156,  195,  234,  273,   18,   19,  308,  343,
      378,    0,  606,  611,  611,  611,    0,   33,  611,  601,
      611,  412,  600,    9,  573,  611,  611,  598,  581,  580,
      611,   31,   52,  595,  611,    0,  611,   37,  611,  611,
      611,    0,  611,  611,  594,   51,  611,  611,  611,    0,
      611,  611,  611,  611,  611,   58,  611,  611,  611,   88,
      611,  593,  611,  446,  611,  558,  611,   48,  557,  611,
      611,    0,   63,  585,  589,  588,   69,  611,  611,  611,
      558,   69,   83,   88,  570,   42,  573,  568,  559,  551,

      560,  108,   51,  611,  611,  580,  611,  116,   78,  565,
      578,  611,  554,  553,   93,  103,  110,  134,  575,  574,
      611,    0,  611,  550,    0,  611,    0,  611,  611,  611,
      611,  611,  611,  572,  131,  533,  453,  611,  611,  611,
      611,  611,  611,  473,  477,  476,  611,  141,  470,  445,
      147,  447,  447,  441,  451,  455,  451,  449,  451,  440,
      447,  438,  426,  445,  446,  429,  438,  123,  437,  438,
      436,  450,  611,  421,  147,  439,  409,  611,  442,  611,
      611,  419,  402,  401,  412,  403,  407,  405,  398,  403,
      388,  400,  395,  611,  382,  386,  387,  387,  377,  385,

      370,  369,  382,  611,  611,  377,  380,  383,  364,  374,
      376,  363,  386,  372,  376,  357,  364,  369,  370,  367,
      359,  348,  354,  125,  360,  350,  346,  347,  344,  611,
      353,  345,  333,  611,  332,  342,  611,  330,  339,  350,
      327,  326,  325,  342,  336,  329,  339,  330,  338,  317,
      327,  327,  313,  323,  611,  611,  312,  611,  316,  317,
      611,  154,    0,  336,  307,  319,  308,  318,  316,  611,
      297,  310,  611,  295,  302,  165,  303,  302,  304,  297,
      307,  287,  310,  293,  290,  305,  300,  283,  611,  290,
      611,  279,  173,  611,  611,  283,  290,  275,  287,  276,

      301,  299,  280,  283,  285,  261,  261,  278,  259,  276,
      275,  263,  260,  275,  287,  611,    0,  256,  261,  252,
      611,  242,  238,  611,  243,  231,  246,  249,  251,  261,
      245,  246,  239,  611,  611,  232,  257,  226,  231,  226,
      169,  227,  228,  229,  227,  249,  611,  232,  233,  226,
      240,  225,  218,  193,  203,  200,  201,  202,  171,  211,
      206,  611,  193,  207,  203,  182,  182,  188,  180,  180,
      201,  195,  210,  177,  182,  611,  611,  166,  154,  187,
      611,  184,  127,  124,  116,  208,   76,   85,  105,  611,
      611,  611,   50,   72,   55,  611,  611,  485,  489,  493,

      497,  501,  505,  509,  513,   28,  517,  521,  525,  529,
       23,   14,    1,  533,  537,  541,  545,  549,  551,  555,
      559,  563,  567,  571
    } ;

static const short int yy_def[425] =
    {   0,
      398,  398,  399,  399,  400,  401,  400,  401,  402,  402,
      403,  403,  404,  404,  405,  405,   16,   16,   16,   16,
       16,   21,  397,  397,  397,  397,  406,  397,  397,  407,
      397,  397,  408,   32,  406,  397,  397,  409,  397,  397,
      397,  397,  397,  410,  397,  411,  397,  397,  397,  397,
      397,  412,  397,  397,  407,  397,  397,  397,  397,  413,
      397,  397,  397,  397,  397,  397,  397,  397,  397,  397,
      397,  414,  397,  397,  397,  397,  397,   74,  397,  397,
      397,  406,  397,  397,  415,  407,  397,  397,  397,  397,
      397,  397,  397,  397,  397,  397,  397,  397,  397,  397,

      397,  397,  397,  397,  397,  408,  397,  397,  397,  406,
      409,  397,  397,  397,  397,  397,  397,  397,  416,  410,
      397,  411,  397,  397,  412,  397,  413,  397,  397,  397,
      397,  397,  397,  414,  397,  397,  397,  397,  397,  397,
      397,  397,  397,  397,  417,  415,  397,  397,  397,  397,
      397,  397,  397,  397,  397,  397,  397,  397,  397,  397,
      397,  397,  397,  397,  397,  397,  397,  397,  406,  397,
      397,  416,  397,  397,  397,  397,  397,  397,  417,  397,
      397,  397,  397,  397,  397,  397,  397,  397,  397,  397,
      397,  397,  397,  397,  397,  397,  397,  397,  397,  406,

      397,  397,  397,  397,  397,  397,  397,  397,  397,  397,
      397,  397,  397,  397,  397,  397,  397,  397,  397,  397,
      397,  397,  406,  397,  397,  397,  397,  397,  397,  397,
      397,  397,  397,  397,  397,  397,  397,  397,  397,  397,
      397,  397,  397,  406,  397,  397,  397,  397,  397,  397,
      397,  397,  397,  397,  397,  397,  397,  397,  397,  397,
      397,  397,  418,  406,  397,  397,  397,  397,  397,  397,
      397,  397,  397,  397,  397,  397,  397,  397,  397,  397,
      397,  418,  397,  397,  397,  397,  397,  397,  397,  397,
      397,  397,  397,  397,  397,  397,  397,  397,  397,  397,

      419,  397,  397,  397,  397,  397,  397,  397,  397,  397,
      397,  397,  397,  397,  419,  397,  420,  397,  397,  397,
      397,  397,  397,  397,  397,  397,  397,  397,  397,  420,
      397,  397,  397,  397,  397,  397,  421,  397,  397,  397,
      420,  397,  397,  397,  397,  421,  397,  397,  397,  397,
      420,  397,  397,  397,  397,  397,  397,  397,  420,  397,
      397,  397,  397,  397,  397,  397,  420,  397,  397,  397,
      397,  397,  422,  420,  397,  397,  397,  397,  397,  422,
      397,  420,  397,  397,  423,  420,  397,  397,  423,  397,
      397,  397,  397,  424,  424,  397,    0,  397,  397,  397,

      397,  397,  397,  397,  397,  397,  397,  397,  397,  397,
      397,  397,  397,  397,  397,  397,  397,  397,  397,  397,
      397,  397,  397,  397
    } ;

static const short int yy_nxt[651] =
    {   0,
       26,   26,  127,   28,   26,   29,   30,   37,   26,   31,
       37,   26,   32,   26,   26,  125,   39,   42,   43,   40,
       42,   43,   59,   59,  122,  108,   44,   69,   69,   82,
       70,   70,  109,  115,  116,   83,   84,   26,   26,   26,
       26,   85,   28,   26,   29,   30,  123,   33,   31,  124,
       26,   34,   26,   26,  117,  118,  126,   89,  396,  141,
      119,  142,  128,  129,  130,   83,  144,  131,  157,   35,
      132,  148,  149,  158,  166,  396,   26,   26,   45,   45,
      163,   47,   45,   45,   45,   92,   45,   48,  394,   45,
       45,   45,   45,  129,  130,  115,  116,  133,  152,  151,

      132,   92,  153,  154,  168,  117,  118,  155,  390,  158,
      393,  119,  117,  118,  392,   49,   50,   45,   45,  390,
       47,   45,   45,   45,   92,   45,   48,  164,   45,   45,
       45,   45,   92,  175,  176,  167,  117,  118,  151,  165,
       92,  188,  119,  148,  149,  245,  151,  388,   92,  175,
      176,  199,  387,  246,   49,   50,   51,   51,  247,   53,
       51,   54,   55,   92,   51,   51,  164,   51,   56,   51,
       51,  278,  293,  341,  279,  341,  294,  151,  367,   92,
      293,  341,  280,  351,  294,  351,  374,  281,  386,  367,
      381,  382,  385,   57,   58,   51,   51,  384,   53,   51,

       54,   55,  295,   51,   51,  383,   51,   56,   51,   51,
      295,  391,  341,  381,  379,  367,  378,  377,  376,  375,
      373,  372,  351,  371,  370,  369,  368,  366,  365,  364,
      363,  362,   57,   58,   59,   59,  361,   61,   62,   63,
       64,  360,   59,   65,  359,   59,   66,   59,   59,  358,
      357,  356,  347,  355,  354,  353,  352,  350,  349,  348,
      347,  345,  344,  343,  342,  341,  340,  339,  338,  337,
      336,   67,   68,   59,   59,  335,   61,   62,   63,   64,
      334,   59,   65,  333,   59,   66,   59,   59,  332,  331,
      316,  329,  328,  327,  326,  325,  324,  323,  322,  321,

      320,  319,  318,  317,  316,  314,  313,  312,  311,  310,
       67,   68,   59,   71,   72,  309,  308,   73,  307,  306,
       74,  305,  304,  303,  302,  301,  300,  299,  298,  297,
      296,  292,  291,  290,  289,  288,  287,  286,  285,  284,
      283,  277,  276,  275,  274,   75,   76,   59,   71,   72,
      273,  272,   73,  271,  270,   74,  269,  268,  267,  266,
      265,  264,  263,  262,  261,  260,  259,  258,  257,  256,
      255,  254,  253,  252,  251,  250,  249,  248,  244,  243,
       75,   76,   59,   71,   72,  242,  241,   73,  240,   77,
       78,   79,  239,  238,  237,  236,  235,  234,  233,  232,

      231,  230,  229,  228,  227,  226,  225,  224,  223,  222,
      221,  220,  219,  218,  217,   80,   81,   88,   89,  216,
      215,   90,  214,  213,  212,  211,  210,   91,   92,   93,
       94,  209,  208,  207,   95,   96,   97,   98,   99,  100,
      101,  206,  102,  103,   92,  180,  205,  204,  203,  104,
      105,  129,  130,  173,  202,  133,  201,  200,  132,  198,
      197,  196,  195,  194,  193,  192,  191,  190,  189,  188,
      187,  186,  185,  184,  136,  183,  182,  137,  181,  147,
      180,  178,  177,  138,  139,   25,   25,   25,   25,   27,
       27,   27,   27,   36,   36,   36,   36,   38,   38,   38,

       38,   41,   41,   41,   41,   46,   46,   46,   46,   52,
       52,   52,   52,   60,   60,   60,   60,   86,   86,   86,
       86,  106,  106,  106,  106,  111,  111,  111,  111,  120,
      120,  120,  120,  134,  134,  134,  134,  146,  146,  146,
      146,  172,  172,  172,  172,  179,  179,  179,  179,  282,
      282,  315,  315,  315,  315,  330,  330,  177,  330,  346,
      346,  346,  346,  380,  380,  380,  380,  389,  389,  389,
      389,  395,  395,  395,  395,  135,  174,  121,  173,  171,
      170,  112,  169,  107,  163,  162,  161,  160,  159,  156,
      150,   87,  147,  145,  143,  140,  135,   87,  121,  114,

      113,  112,  110,  107,   87,  397,   37,   37,   24,   24,
       23,  397,  397,  397,  397,  397,  397,  397,  397,  397,
      397,  397,  397,  397,  397,  397,  397,  397,  397,  397,
      397,  397,  397,  397,  397,  397,  397,  397,  397,  397,
      397,  397,  397,  397,  397,  397,  397,  397,  397,  397
    } ;

static const short int yy_chk[651] =
    {   0,
        3,    3,  413,    3,    3,    3,    3,    6,    3,    3,
        8,    3,    3,    3,    3,  412,    6,    9,    9,    8,
       10,   10,   17,   18,  411,   34,   10,   17,   18,  406,
       17,   18,   34,   42,   42,   28,   28,    3,    3,    4,
        4,   28,    4,    4,    4,    4,   48,    4,    4,   48,
        4,    4,    4,    4,   43,   43,   56,   56,  395,   78,
       43,   78,   66,   66,   66,   83,   83,   66,   96,    4,
       66,   87,   87,   96,  103,  394,    4,    4,   11,   11,
      103,   11,   11,   11,   11,   92,   11,   11,  393,   11,
       11,   11,   11,   70,   70,  115,  115,   70,   93,   92,

       70,   92,   93,   94,  109,  116,  116,   94,  389,  109,
      388,  116,  117,  117,  387,   11,   11,   12,   12,  385,
       12,   12,   12,   12,  102,   12,   12,  102,   12,   12,
       12,   12,  108,  135,  135,  108,  118,  118,  102,  102,
      102,  168,  118,  148,  148,  224,  108,  384,  108,  175,
      175,  168,  383,  224,   12,   12,   13,   13,  224,   13,
       13,   13,   13,  151,   13,   13,  151,   13,   13,   13,
       13,  262,  276,  341,  262,  359,  276,  151,  359,  151,
      293,  374,  262,  341,  293,  359,  367,  262,  382,  367,
      380,  374,  379,   13,   13,   14,   14,  378,   14,   14,

       14,   14,  276,   14,   14,  375,   14,   14,   14,   14,
      293,  386,  386,  373,  372,  386,  371,  370,  369,  368,
      366,  365,  386,  364,  363,  361,  360,  358,  357,  356,
      355,  354,   14,   14,   15,   15,  353,   15,   15,   15,
       15,  352,   15,   15,  351,   15,   15,   15,   15,  350,
      349,  348,  346,  345,  344,  343,  342,  340,  339,  338,
      337,  336,  333,  332,  331,  330,  329,  328,  327,  326,
      325,   15,   15,   16,   16,  323,   16,   16,   16,   16,
      322,   16,   16,  320,   16,   16,   16,   16,  319,  318,
      315,  314,  313,  312,  311,  310,  309,  308,  307,  306,

      305,  304,  303,  302,  301,  300,  299,  298,  297,  296,
       16,   16,   19,   19,   19,  292,  290,   19,  288,  287,
       19,  286,  285,  284,  283,  282,  281,  280,  279,  278,
      277,  275,  274,  272,  271,  269,  268,  267,  266,  265,
      264,  260,  259,  257,  254,   19,   19,   20,   20,   20,
      253,  252,   20,  251,  250,   20,  249,  248,  247,  246,
      245,  244,  243,  242,  241,  240,  239,  238,  236,  235,
      233,  232,  231,  229,  228,  227,  226,  225,  223,  222,
       20,   20,   21,   21,   21,  221,  220,   21,  219,   21,
       21,   21,  218,  217,  216,  215,  214,  213,  212,  211,

      210,  209,  208,  207,  206,  203,  202,  201,  200,  199,
      198,  197,  196,  195,  193,   21,   21,   32,   32,  192,
      191,   32,  190,  189,  188,  187,  186,   32,   32,   32,
       32,  185,  184,  183,   32,   32,   32,   32,   32,   32,
       32,  182,   32,   32,   32,  179,  177,  176,  174,   32,
       32,   74,   74,  172,  171,   74,  170,  169,   74,  167,
      166,  165,  164,  163,  162,  161,  160,  159,  158,  157,
      156,  155,  154,  153,   74,  152,  150,   74,  149,  146,
      145,  144,  137,   74,   74,  398,  398,  398,  398,  399,
      399,  399,  399,  400,  400,  400,  400,  401,  401,  401,

      401,  402,  402,  402,  402,  403,  403,  403,  403,  404,
      404,  404,  404,  405,  405,  405,  405,  407,  407,  407,
      407,  408,  408,  408,  408,  409,  409,  409,  409,  410,
      410,  410,  410,  414,  414,  414,  414,  415,  415,  415,
      415,  416,  416,  416,  416,  417,  417,  417,  417,  418,
      418,  419,  419,  419,  419,  420,  420,  136,  420,  421,
      421,  421,  421,  422,  422,  422,  422,  423,  423,  423,
      423,  424,  424,  424,  424,  134,  124,  120,  119,  114,
      113,  111,  110,  106,  101,  100,   99,   98,   97,   95,
       91,   86,   85,   84,   79,   76,   72,   55,   44,   40,

       39,   38,   35,   33,   30,   23,    7,    5,    2,    1,
      397,  397,  397,  397,  397,  397,  397,  397,  397,  397,
      397,  397,  397,  397,  397,  397,  397,  397,  397,  397,
      397,  397,  397,  397,  397,  397,  397,  397,  397,  397,
      397,  397,  397,  397,  397,  397,  397,  397,  397,  397
    } ;

static yy_state_type yy_last_accepting_state;
static YY_CHAR *yy_last_accepting_cpos;

/* the intent behind this definition is that it'll catch
 * any uses of REJECT which flex missed
 */
#define REJECT reject_used_but_not_detected
#define yymore() yymore_used_but_not_detected
#define YY_MORE_ADJ 0

/* these variables are all declared out here so that section 3 code can
 * manipulate them
 */
/* points to current character in buffer */
static YY_CHAR *yy_c_buf_p = (YY_CHAR *) 0;
static int yy_init = 1;		/* whether we need to initialize */
static int yy_start = 0;	/* start state number */

/* flag which is used to allow yywrap()'s to do buffer switches
 * instead of setting up a fresh yyin.  A bit of a hack ...
 */
static int yy_did_buffer_switch_on_eof;

static yy_state_type yy_get_previous_state YY_PROTO(( void ));
static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
static int yy_get_next_buffer YY_PROTO(( void ));
static void yyunput YY_PROTO(( YY_CHAR c, YY_CHAR *buf_ptr ));
void yyrestart YY_PROTO(( FILE *input_file ));
void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
void yy_load_buffer_state YY_PROTO(( void ));
YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));

#define yy_new_buffer yy_create_buffer

#ifdef __cplusplus
static int yyinput YY_PROTO(( void ));
#else
static int input YY_PROTO(( void ));
#endif

YY_DECL
    {
    register yy_state_type yy_current_state;
    register YY_CHAR *yy_cp, *yy_bp;
    register int yy_act;


        CHG_TOP(Norm); /* that's where we start */

    if ( yy_init )
	{
	YY_USER_INIT;

	if ( ! yy_start )
	    yy_start = 1;	/* first start state */

	if ( ! yyin )
	    yyin = stdin;

	if ( ! yyout )
	    yyout = stdout;

	if ( yy_current_buffer )
	    yy_init_buffer( yy_current_buffer, yyin );
	else
	    yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );

	yy_load_buffer_state();

	yy_init = 0;
	}

    while ( 1 )		/* loops until end-of-file is reached */
	{
	yy_cp = yy_c_buf_p;

	/* support of yytext */
	*yy_cp = yy_hold_char;

	/* yy_bp points to the position in yy_ch_buf of the start of the
	 * current run.
	 */
	yy_bp = yy_cp;

	yy_current_state = yy_start;
	if ( yy_bp[-1] == '\n' )
	    ++yy_current_state;
yy_match:
	do
	    {
	    register YY_CHAR yy_c = yy_ec[*yy_cp];
	    if ( yy_accept[yy_current_state] )
		{
		yy_last_accepting_state = yy_current_state;
		yy_last_accepting_cpos = yy_cp;
		}
	    while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
		{
		yy_current_state = yy_def[yy_current_state];
		if ( yy_current_state >= 398 )
		    yy_c = yy_meta[yy_c];
		}
	    yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
	    ++yy_cp;
	    }
	while ( yy_current_state != 397 );
	yy_cp = yy_last_accepting_cpos;
	yy_current_state = yy_last_accepting_state;

yy_find_action:
	yy_act = yy_accept[yy_current_state];

	YY_DO_BEFORE_ACTION;
	YY_USER_ACTION;

do_action:	/* this label is used only to access EOF actions */


	switch ( yy_act )
	    {
	    case 0: /* must backtrack */
	    /* undo the effects of YY_DO_BEFORE_ACTION */
	    *yy_cp = yy_hold_char;
	    yy_cp = yy_last_accepting_cpos;
	    yy_current_state = yy_last_accepting_state;
	    goto yy_find_action;

case 1:
# line 91 "lit-deatify.lex"
{ not_OK("ASCII chars \001, \002, \003 may not appear in literate files\n");
                          exit(1);
                        }
	YY_BREAK
case 2:
# line 94 "lit-deatify.lex"
{
                  sscanf(yytext+10,"%[^!]!_!%d", srcfile_name, &lineno);
                  if (lineno > 0) {
                     ECHO;
                  }
                }
	YY_BREAK
case 3:
# line 100 "lit-deatify.lex"
{ lineno++;
                                          if (follow_inputs) {
                                              /* nullify first right brace */
                                              rbrace = index(yytext+7,'}');
                                              *rbrace = '\0';
                                              push_inputfile(yytext+7);
                                          } else {
                                              MYECHO;
                                          }
                                        }
	YY_BREAK
case YY_STATE_EOF(Norm):
case YY_STATE_EOF(Bird):
# line 110 "lit-deatify.lex"
{ if ( inputfile_stk_top <= 0 ) {
                             yyterminate();
                          } else {
                             pop_inputfile();
                          }
                          CHG_TOP(Norm); /* revert */
                        }
	YY_BREAK
case 5:
# line 118 "lit-deatify.lex"
case 6:
# line 119 "lit-deatify.lex"
case 7:
# line 119 "lit-deatify.lex"
{ lineno++; MYECHO; PUSH(Verb); /* some may have opt arg */ }
	YY_BREAK
case 8:
# line 120 "lit-deatify.lex"
{ lineno++;
                                  if (IS_LIT2PGM_Q) {
                                      printf("srcfile!_!%s!_!%d!_!\n",srcfile_name,lineno);
                                  }
                                  MYECHO;
                                  PUSH(Code);
                                }
	YY_BREAK
case 9:
# line 127 "lit-deatify.lex"
{ /* convert to something less weird & try again */
                          unput('>'); unput('\n'); unput('\n');
                        }
	YY_BREAK
case 10:
# line 130 "lit-deatify.lex"
{ lineno += 3;
                          /* NB: init > converted to space */
                          if (IS_LIT2PGM_Q) {
                              printf("srcfile!_!%s!_!%d!_!\n",srcfile_name,(lineno-1));
                              printf("%s",yytext+3);
                          } else {
                              ECHO;
                          }
                          PUSH(Bird);
                        }
	YY_BREAK
case 11:
# line 140 "lit-deatify.lex"
{ lineno++; /* so msg will have right line # */
                          if (lineno > 2) /* I feel guilty about this hack */
                              /* to avoid: file is: blank lines, then code */
                              not_OK("Bird-style code not preceded by a blank line\n");
                          lineno++; /* account for other \n */
                          if (IS_LIT2PGM_Q) {
                              printf("srcfile!_!%s!_!%d!_!\n",srcfile_name,(lineno-1));
                              printf("%s",yytext+2);
                          } else {
                              ECHO;
                          }
                          PUSH(Bird);
                        }
	YY_BREAK
case 12:
# line 153 "lit-deatify.lex"
{ lineno++; /* first line of file */
                          if (IS_LIT2PGM_Q) {
                              printf("srcfile!_!%s!_!%d!_!\n",srcfile_name,(lineno-1));
                              printf("%s",yytext+1);
                          } else {
                              ECHO;
                          }
                          PUSH(Bird);
                        }
	YY_BREAK
case 13:
# line 162 "lit-deatify.lex"
{ MYECHO; PUSH(Linify_braces); }
	YY_BREAK
case 14:
# line 163 "lit-deatify.lex"
{ MYECHO; PUSH(Linify_braces); }
	YY_BREAK
case 15:
# line 164 "lit-deatify.lex"
{ MYECHO; PUSH(Linify_braces); }
	YY_BREAK
case 16:
# line 165 "lit-deatify.lex"
{ MYECHO; PUSH(Linify_braces); }
	YY_BREAK
case 17:
# line 166 "lit-deatify.lex"
{ MYECHO; PUSH(Linify_braces); }
	YY_BREAK
case 18:
# line 167 "lit-deatify.lex"
{ MYECHO; PUSH(Linify_braces); }
	YY_BREAK
case 19:
# line 168 "lit-deatify.lex"
{ MYECHO; PUSH(Linify_braces); }
	YY_BREAK
case 20:
# line 169 "lit-deatify.lex"
{ MYECHO; PUSH(Linify_braces); }
	YY_BREAK
case 21:
# line 170 "lit-deatify.lex"
{ MYECHO; PUSH(Linify_braces); }
	YY_BREAK
case 22:
# line 171 "lit-deatify.lex"
{ MYECHO; PUSH(Linify_braces); }
	YY_BREAK
case 23:
# line 172 "lit-deatify.lex"
{ MYECHO; PUSH(Linify_braces); }
	YY_BREAK
case 24:
# line 173 "lit-deatify.lex"
{ MYECHO; PUSH(Linify_brackets); }
	YY_BREAK
case 25:
# line 174 "lit-deatify.lex"
{ MYECHO; PUSH(Linify_braces); }
	YY_BREAK
case 26:
# line 175 "lit-deatify.lex"
{ MYECHO; PUSH(Linify_braces); }
	YY_BREAK
case 27:
# line 176 "lit-deatify.lex"
{ MYECHO; unmatched_lbraces = 1; PUSH(Typing);
                                  /* \tr has braces as literals */
                                }
	YY_BREAK
case 28:
# line 179 "lit-deatify.lex"
{ MYECHO; PUSH(Linify_brackets); }
	YY_BREAK
case 29:
# line 180 "lit-deatify.lex"
{ MYECHO; }
	YY_BREAK
case 30:
# line 181 "lit-deatify.lex"
{ myprintstr("\\codeInText{"); PUSH(Atting); }
	YY_BREAK
case 31:
# line 182 "lit-deatify.lex"
{ MYECHO; }
	YY_BREAK
case 32:
# line 183 "lit-deatify.lex"
{ myprintstr("\\MathMode{"); PUSH(Math); }
	YY_BREAK
case 33:
# line 184 "lit-deatify.lex"
{ MYECHO;
                          unmatched_lbraces = 1;
                          PUSH(Index);
                        }
	YY_BREAK
case 34:
# line 188 "lit-deatify.lex"
{ MYECHO; }
	YY_BREAK
case 35:
# line 189 "lit-deatify.lex"
{ MYECHO; }
	YY_BREAK
case 36:
# line 190 "lit-deatify.lex"
{ MYECHO; }
	YY_BREAK
case 37:
# line 191 "lit-deatify.lex"
{ /* technically this Bird-style code is wrong
                                     (no blank line in front of it, but that's
                                     not intuitively obvious to the casual observer).
                                     Solution? A hack!
                                  */
                                  unput('>'); unput('\n'); unput('\n');
                                }
	YY_BREAK
case 38:
# line 198 "lit-deatify.lex"
{ /* throw away */ lineno++;
                                  if (! IS_LIT2PGM_Q)
                                     printf("\nsrcfile!_!%s!_!%d!_!\n",srcfile_name,lineno);
                                }
	YY_BREAK
case 39:
# line 202 "lit-deatify.lex"
{ MYECHO; /* slight efficiency */ }
	YY_BREAK
case 40:
# line 203 "lit-deatify.lex"
{ MYECHO; }
	YY_BREAK
case 41:
# line 204 "lit-deatify.lex"
{ /* handle line-number fiddling */
                                  MYECHO;
                                  lineno++;
                                  if (lineno_fiddled) {
                                      if (! IS_LIT2PGM_Q)
                                         printf("srcfile!_!%s!_!%d!_!\n",srcfile_name,lineno);
                                      lineno_fiddled = 0;
                                  }
                                }
	YY_BREAK
case 42:
# line 214 "lit-deatify.lex"
case 43:
# line 215 "lit-deatify.lex"
case 44:
# line 215 "lit-deatify.lex"
{ MYECHO; POP; }
	YY_BREAK
case 45:
# line 216 "lit-deatify.lex"
{ if (! IS_LIT2PGM_Q) ECHO; POP; }
	YY_BREAK
case 46:
# line 217 "lit-deatify.lex"
{ lineno++; MYECHO; /* a line not started by \ */}
	YY_BREAK
case 47:
# line 218 "lit-deatify.lex"
{ MYECHO; }
	YY_BREAK
case 48:
# line 219 "lit-deatify.lex"
{ lineno++; MYECHO; }
	YY_BREAK
case YY_STATE_EOF(Verb):
case YY_STATE_EOF(Code):
# line 220 "lit-deatify.lex"
{ not_OK("unexpected end-of-file in verbatim text or (pseudo)code\n");
                                  exit(1);
                                }
	YY_BREAK
case 50:
# line 223 "lit-deatify.lex"
{ /* whitespace/blank-lines do not matter */
                          /* count lines... */
                          for (i = 0; i < strlen(yytext); i++) {
                              if (yytext[i] == '\n')
                                  lineno++;
                          }
                          if (! IS_LIT2PGM_Q) {
                            ECHO;
                          } else { /* don't print leading whitestuff */
                              for (i = 0; i < strlen(yytext) && yytext[i] != '>'; i++)
                                  ; /* no-op */
                              /* report where this got us...*/
                              printf("srcfile!_!%s!_!%d!_!\n",srcfile_name,
                                ((yytext[yyleng-1] == '\n') ? (lineno-1) : lineno));
                              /* putchar(' '); convert leading > to space */
                              for ( i++ ; i < strlen(yytext); i++)
                                  putchar(yytext[i]);
                          }
                        }
	YY_BREAK
case 51:
# line 242 "lit-deatify.lex"
{ if (yytext[yyleng-1] == '\n') { lineno++; }
                          if (IS_LIT2PGM_Q) printf("%s",yytext+1); else ECHO;
                        }
	YY_BREAK
case 52:
# line 245 "lit-deatify.lex"
{ lineno++;
                          if ( ! IS_LIT2PGM_Q) ECHO;
                          POP;
                        }
	YY_BREAK
case 53:
# line 249 "lit-deatify.lex"
{ lineno--; /* to get right # on msg */
                          not_OK("Bird-style code not followed by a blank line\n");
                          lineno++; /* put it back */
                          unput(yytext[0]);
                          POP;
                        }
	YY_BREAK
case 54:
# line 255 "lit-deatify.lex"
{ myprintstr("@"); }
	YY_BREAK
case 55:
# line 257 "lit-deatify.lex"
case 56:
# line 257 "lit-deatify.lex"
{ myprintstr("\001noindex\003}");
                          POP;
                        }
	YY_BREAK
case 57:
# line 260 "lit-deatify.lex"
{ myprintstr("}");
                          POP;
                        }
	YY_BREAK
case 58:
# line 263 "lit-deatify.lex"
{ myprintstr("\001lbrace\003"); }
	YY_BREAK
case 59:
# line 264 "lit-deatify.lex"
{ myprintstr("\001rbrace\003"); }
	YY_BREAK
case 60:
# line 265 "lit-deatify.lex"
{ warning("I'm turning a newline inside a @...@ into a space\n");
                          myprintstr(" ");
                          lineno++;
                        }
	YY_BREAK
case YY_STATE_EOF(Atting):
# line 270 "lit-deatify.lex"
{ not_OK("unexpected end-of-file inside an @ ... @\n");
                          exit(1);
                        }
	YY_BREAK
case 62:
# line 273 "lit-deatify.lex"
{ MYECHO; /* tiny efficiency */ }
	YY_BREAK
case 63:
# line 274 "lit-deatify.lex"
{ MYECHO; }
	YY_BREAK
case 64:
# line 275 "lit-deatify.lex"
{ MYECHO; }
	YY_BREAK
case 65:
# line 276 "lit-deatify.lex"
{ myprintstr("}");
                          POP;
                        }
	YY_BREAK
case 66:
# line 279 "lit-deatify.lex"
{ myprintstr("\001lbrace\003"); }
	YY_BREAK
case 67:
# line 280 "lit-deatify.lex"
{ myprintstr("\001rbrace\003"); }
	YY_BREAK
case 68:
# line 281 "lit-deatify.lex"
{ myprintstr("\001newline\003");
                          lineno++;
                        }
	YY_BREAK
case YY_STATE_EOF(Math):
# line 285 "lit-deatify.lex"
{ not_OK("unexpected end-of-file inside $ ... $ (math mode)\n");
                          exit(1);
                        }
	YY_BREAK
case 70:
# line 288 "lit-deatify.lex"
{ MYECHO; /* tiny efficiency */ }
	YY_BREAK
case 71:
# line 289 "lit-deatify.lex"
{ MYECHO; }
	YY_BREAK
case 72:
# line 290 "lit-deatify.lex"
{
                          MYECHO;
                          unmatched_lbraces = 1;
                          PUSH(Typing);
                        }
	YY_BREAK
case 73:
# line 296 "lit-deatify.lex"
{
                          MYECHO;
                        }
	YY_BREAK
case 74:
# line 299 "lit-deatify.lex"
{
                          MYECHO;
                        }
	YY_BREAK
case 75:
# line 302 "lit-deatify.lex"
{
                          MYECHO;
                        }
	YY_BREAK
case 76:
# line 306 "lit-deatify.lex"
{ MYECHO; PUSH(Linify_braces); }
	YY_BREAK
case 77:
# line 307 "lit-deatify.lex"
{ MYECHO; }
	YY_BREAK
case 78:
# line 309 "lit-deatify.lex"
{ unmatched_lbraces++; myprintstr("\001lbrace\003"); }
	YY_BREAK
case 79:
# line 311 "lit-deatify.lex"
{
                          MYECHO;
                        }
	YY_BREAK
case 80:
# line 314 "lit-deatify.lex"
{ /* next arg */ MYECHO; }
	YY_BREAK
case 81:
# line 316 "lit-deatify.lex"
{ MYECHO; POP; }
	YY_BREAK
case 82:
# line 317 "lit-deatify.lex"
{ MYECHO; }
	YY_BREAK
case 83:
# line 319 "lit-deatify.lex"
{ if (--unmatched_lbraces == 0) {
                              MYECHO;
                              POP;
                          } else {
                              myprintstr("\001rbrace\003");
                          }
                        }
	YY_BREAK
case 84:
# line 327 "lit-deatify.lex"
{
                          MYECHO;
                        }
	YY_BREAK
case 85:
# line 330 "lit-deatify.lex"
{
                          myprintstr("\\codeInText{"); /* no newline */
                          PUSH(Atting); 
                        }
	YY_BREAK
case 86:
# line 334 "lit-deatify.lex"
{ MYECHO; /* NB: magic <Index> chars below */ }
	YY_BREAK
case 87:
# line 336 "lit-deatify.lex"
{
                          MYECHO;
                        }
	YY_BREAK
case 88:
# line 339 "lit-deatify.lex"
{
                          myprintstr("\\MathMode{"); /* no newline */
                          PUSH(Math);
                        }
	YY_BREAK
case 89:
# line 343 "lit-deatify.lex"
{ MYECHO; }
	YY_BREAK
case 90:
# line 345 "lit-deatify.lex"
{
                          MYECHO;
                        }
	YY_BREAK
case 91:
# line 348 "lit-deatify.lex"
{
                          /* see earlier comments about crimes against humanity */
                          unput('>'); unput('\n'); unput('\n');
                        }
	YY_BREAK
case 92:
# line 352 "lit-deatify.lex"
{ /* throw away */
                          lineno++;
                          lineno_fiddled++;
                        }
	YY_BREAK
case 93:
# line 356 "lit-deatify.lex"
{ MYECHO; }
	YY_BREAK
case 94:
# line 358 "lit-deatify.lex"
{ MYECHO; }
	YY_BREAK
case 95:
# line 359 "lit-deatify.lex"
{ MYECHO; PUSH(Linify_brackets); }      
	YY_BREAK
case 96:
# line 361 "lit-deatify.lex"
{ myprintstr("\\\001rbracket\003"); /* cannot have these in the way */ }
	YY_BREAK
case 97:
# line 362 "lit-deatify.lex"
{ if (LEX_NEXT_TO_STK_TOP == Norm) {
                              MYECHO;
                          } else {
                              myprintstr("\001rbracket\003\{");
                              not_OK("WHAT'S GOING ON? ]{\n");
                              print_lex_stk();
                          }
                          CHG_TOP(Linify_braces);
                        }
	YY_BREAK
case 98:
# line 371 "lit-deatify.lex"
{ if (LEX_NEXT_TO_STK_TOP == Norm) {
                              MYECHO;
                          } else {
                              myprintstr("\001rbracket\003");
                          }
                          POP;
                        }
	YY_BREAK
case 99:
# line 379 "lit-deatify.lex"
{ MYECHO; /* my pseudo-makeindex has two magic chars */ }
	YY_BREAK
case 100:
# line 380 "lit-deatify.lex"
{ myprintstr("\001idxsort\003"); }
	YY_BREAK
case 101:
# line 381 "lit-deatify.lex"
{ MYECHO; }
	YY_BREAK
case 102:
# line 382 "lit-deatify.lex"
{ myprintstr("\001idxsubitem\003"); }
	YY_BREAK
case 103:
# line 384 "lit-deatify.lex"
{
                          lineno++;
                          lineno_fiddled++;
                          if (LEX_STK_TOP == Index) {
                             warning("I'm turning a newline inside an \\index{...} into a space\n");
                             myprintstr(" ");
                          } else if (LEX_STK_TOP == Typing) {
                             warning("I'm turning a newline inside a \\tr{...} or \\pl{...} into a space\n");
                             myprintstr(" ");
                          } else {
                             myprintstr("\001newline\003");
                          }
                        }
	YY_BREAK
case 104:
# line 398 "lit-deatify.lex"
{
                          MYECHO; /* tiny efficiency */
                        }
	YY_BREAK
case 105:
# line 402 "lit-deatify.lex"
{ MYECHO; /* catch all */ }
	YY_BREAK
case YY_STATE_EOF(Index):
# line 404 "lit-deatify.lex"
{ not_OK("unexpected end-of-file inside an \\index{...}\n");
                          exit(1);
                        }
	YY_BREAK
case YY_STATE_EOF(Linify_braces):
# line 407 "lit-deatify.lex"
{ not_OK("unexpected end-of-file inside a macro argument\n");
                          exit(1);
                        }
	YY_BREAK
case YY_STATE_EOF(Linify_brackets):
# line 410 "lit-deatify.lex"
{not_OK("unexpected end-of-file inside a macro optional argument\n");
                          exit(1);
                        }
	YY_BREAK
case YY_STATE_EOF(Typing):
# line 413 "lit-deatify.lex"
{ not_OK("unexpected end-of-file inside a \\tr{...}\n");
                          exit(1);
                        }
	YY_BREAK
case 110:
# line 416 "lit-deatify.lex"
ECHO;
	YY_BREAK
case YY_STATE_EOF(INITIAL):
    yyterminate();

	    case YY_END_OF_BUFFER:
		{
		/* amount of text matched not including the EOB char */
		int yy_amount_of_matched_text = yy_cp - yytext - 1;

		/* undo the effects of YY_DO_BEFORE_ACTION */
		*yy_cp = yy_hold_char;

		/* note that here we test for yy_c_buf_p "<=" to the position
		 * of the first EOB in the buffer, since yy_c_buf_p will
		 * already have been incremented past the NUL character
		 * (since all states make transitions on EOB to the end-
		 * of-buffer state).  Contrast this with the test in yyinput().
		 */
		if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
		    /* this was really a NUL */
		    {
		    yy_state_type yy_next_state;

		    yy_c_buf_p = yytext + yy_amount_of_matched_text;

		    yy_current_state = yy_get_previous_state();

		    /* okay, we're now positioned to make the
		     * NUL transition.  We couldn't have
		     * yy_get_previous_state() go ahead and do it
		     * for us because it doesn't know how to deal
		     * with the possibility of jamming (and we
		     * don't want to build jamming into it because
		     * then it will run more slowly)
		     */

		    yy_next_state = yy_try_NUL_trans( yy_current_state );

		    yy_bp = yytext + YY_MORE_ADJ;

		    if ( yy_next_state )
			{
			/* consume the NUL */
			yy_cp = ++yy_c_buf_p;
			yy_current_state = yy_next_state;
			goto yy_match;
			}

		    else
			{
			    yy_cp = yy_last_accepting_cpos;
			    yy_current_state = yy_last_accepting_state;
			goto yy_find_action;
			}
		    }

		else switch ( yy_get_next_buffer() )
		    {
		    case EOB_ACT_END_OF_FILE:
			{
			yy_did_buffer_switch_on_eof = 0;

			if ( yywrap() )
			    {
			    /* note: because we've taken care in
			     * yy_get_next_buffer() to have set up yytext,
			     * we can now set up yy_c_buf_p so that if some
			     * total hoser (like flex itself) wants
			     * to call the scanner after we return the
			     * YY_NULL, it'll still work - another YY_NULL
			     * will get returned.
			     */
			    yy_c_buf_p = yytext + YY_MORE_ADJ;

			    yy_act = YY_STATE_EOF((yy_start - 1) / 2);
			    goto do_action;
			    }

			else
			    {
			    if ( ! yy_did_buffer_switch_on_eof )
				YY_NEW_FILE;
			    }
			}
			break;

		    case EOB_ACT_CONTINUE_SCAN:
			yy_c_buf_p = yytext + yy_amount_of_matched_text;

			yy_current_state = yy_get_previous_state();

			yy_cp = yy_c_buf_p;
			yy_bp = yytext + YY_MORE_ADJ;
			goto yy_match;

		    case EOB_ACT_LAST_MATCH:
			yy_c_buf_p =
			    &yy_current_buffer->yy_ch_buf[yy_n_chars];

			yy_current_state = yy_get_previous_state();

			yy_cp = yy_c_buf_p;
			yy_bp = yytext + YY_MORE_ADJ;
			goto yy_find_action;
		    }
		break;
		}

	    default:
#ifdef FLEX_DEBUG
		printf( "action # %d\n", yy_act );
#endif
		YY_FATAL_ERROR(
			"fatal flex scanner internal error--no action found" );
	    }
	}
    }


/* yy_get_next_buffer - try to read in a new buffer
 *
 * synopsis
 *     int yy_get_next_buffer();
 *     
 * returns a code representing an action
 *     EOB_ACT_LAST_MATCH - 
 *     EOB_ACT_CONTINUE_SCAN - continue scanning from current position
 *     EOB_ACT_END_OF_FILE - end of file
 */

static int yy_get_next_buffer()

    {
    register YY_CHAR *dest = yy_current_buffer->yy_ch_buf;
    register YY_CHAR *source = yytext - 1; /* copy prev. char, too */
    register int number_to_move, i;
    int ret_val;

    if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
	YY_FATAL_ERROR(
		"fatal flex scanner internal error--end of buffer missed" );

    /* try to read more data */

    /* first move last chars to start of buffer */
    number_to_move = yy_c_buf_p - yytext;

    for ( i = 0; i < number_to_move; ++i )
	*(dest++) = *(source++);

    if ( yy_current_buffer->yy_eof_status != EOF_NOT_SEEN )
	/* don't do the read, it's not guaranteed to return an EOF,
	 * just force an EOF
	 */
	yy_n_chars = 0;

    else
	{
	int num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1;

	if ( num_to_read > YY_READ_BUF_SIZE )
	    num_to_read = YY_READ_BUF_SIZE;

	else if ( num_to_read <= 0 )
	    YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" );

	/* read in more data */
	YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
		  yy_n_chars, num_to_read );
	}

    if ( yy_n_chars == 0 )
	{
	if ( number_to_move == 1 )
	    {
	    ret_val = EOB_ACT_END_OF_FILE;
	    yy_current_buffer->yy_eof_status = EOF_DONE;
	    }

	else
	    {
	    ret_val = EOB_ACT_LAST_MATCH;
	    yy_current_buffer->yy_eof_status = EOF_PENDING;
	    }
	}

    else
	ret_val = EOB_ACT_CONTINUE_SCAN;

    yy_n_chars += number_to_move;
    yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
    yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;

    /* yytext begins at the second character in yy_ch_buf; the first
     * character is the one which preceded it before reading in the latest
     * buffer; it needs to be kept around in case it's a newline, so
     * yy_get_previous_state() will have with '^' rules active
     */

    yytext = &yy_current_buffer->yy_ch_buf[1];

    return ( ret_val );
    }


/* yy_get_previous_state - get the state just before the EOB char was reached
 *
 * synopsis
 *     yy_state_type yy_get_previous_state();
 */

static yy_state_type yy_get_previous_state()

    {
    register yy_state_type yy_current_state;
    register YY_CHAR *yy_cp;

    register YY_CHAR *yy_bp = yytext;

    yy_current_state = yy_start;
    if ( yy_bp[-1] == '\n' )
	++yy_current_state;

    for ( yy_cp = yytext + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
	{
	register YY_CHAR yy_c = (*yy_cp ? yy_ec[*yy_cp] : 2);
	if ( yy_accept[yy_current_state] )
	    {
	    yy_last_accepting_state = yy_current_state;
	    yy_last_accepting_cpos = yy_cp;
	    }
	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
	    {
	    yy_current_state = yy_def[yy_current_state];
	    if ( yy_current_state >= 398 )
		yy_c = yy_meta[yy_c];
	    }
	yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
	}

    return ( yy_current_state );
    }


/* yy_try_NUL_trans - try to make a transition on the NUL character
 *
 * synopsis
 *     next_state = yy_try_NUL_trans( current_state );
 */

#ifdef YY_USE_PROTOS
static yy_state_type yy_try_NUL_trans( register yy_state_type yy_current_state )
#else
static yy_state_type yy_try_NUL_trans( yy_current_state )
register yy_state_type yy_current_state;
#endif

    {
    register int yy_is_jam;
    register YY_CHAR *yy_cp = yy_c_buf_p;

    register YY_CHAR yy_c = 2;
    if ( yy_accept[yy_current_state] )
	{
	yy_last_accepting_state = yy_current_state;
	yy_last_accepting_cpos = yy_cp;
	}
    while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
	{
	yy_current_state = yy_def[yy_current_state];
	if ( yy_current_state >= 398 )
	    yy_c = yy_meta[yy_c];
	}
    yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
    yy_is_jam = (yy_current_state == 397);

    return ( yy_is_jam ? 0 : yy_current_state );
    }


#ifdef YY_USE_PROTOS
static void yyunput( YY_CHAR c, register YY_CHAR *yy_bp )
#else
static void yyunput( c, yy_bp )
YY_CHAR c;
register YY_CHAR *yy_bp;
#endif

    {
    register YY_CHAR *yy_cp = yy_c_buf_p;

    /* undo effects of setting up yytext */
    *yy_cp = yy_hold_char;

    if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
	{ /* need to shift things up to make room */
	register int number_to_move = yy_n_chars + 2; /* +2 for EOB chars */
	register YY_CHAR *dest =
	    &yy_current_buffer->yy_ch_buf[yy_current_buffer->yy_buf_size + 2];
	register YY_CHAR *source =
	    &yy_current_buffer->yy_ch_buf[number_to_move];

	while ( source > yy_current_buffer->yy_ch_buf )
	    *--dest = *--source;

	yy_cp += dest - source;
	yy_bp += dest - source;
	yy_n_chars = yy_current_buffer->yy_buf_size;

	if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
	    YY_FATAL_ERROR( "flex scanner push-back overflow" );
	}

    if ( yy_cp > yy_bp && yy_cp[-1] == '\n' )
	yy_cp[-2] = '\n';

    *--yy_cp = c;

    /* note: the formal parameter *must* be called "yy_bp" for this
     *       macro to now work correctly
     */
    YY_DO_BEFORE_ACTION; /* set up yytext again */
    }


#ifdef __cplusplus
static int yyinput()
#else
static int input()
#endif

    {
    int c;
    YY_CHAR *yy_cp = yy_c_buf_p;

    *yy_cp = yy_hold_char;

    if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
	{
	/* yy_c_buf_p now points to the character we want to return.
	 * If this occurs *before* the EOB characters, then it's a
	 * valid NUL; if not, then we've hit the end of the buffer.
	 */
	if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
	    /* this was really a NUL */
	    *yy_c_buf_p = '\0';

	else
	    { /* need more input */
	    yytext = yy_c_buf_p;
	    ++yy_c_buf_p;

	    switch ( yy_get_next_buffer() )
		{
		case EOB_ACT_END_OF_FILE:
		    {
		    if ( yywrap() )
			{
			yy_c_buf_p = yytext + YY_MORE_ADJ;
			return ( EOF );
			}

		    YY_NEW_FILE;

#ifdef __cplusplus
		    return ( yyinput() );
#else
		    return ( input() );
#endif
		    }
		    break;

		case EOB_ACT_CONTINUE_SCAN:
		    yy_c_buf_p = yytext + YY_MORE_ADJ;
		    break;

		case EOB_ACT_LAST_MATCH:
#ifdef __cplusplus
		    YY_FATAL_ERROR( "unexpected last match in yyinput()" );
#else
		    YY_FATAL_ERROR( "unexpected last match in input()" );
#endif
		}
	    }
	}

    c = *yy_c_buf_p;
    yy_hold_char = *++yy_c_buf_p;

    return ( c );
    }


#ifdef YY_USE_PROTOS
void yyrestart( FILE *input_file )
#else
void yyrestart( input_file )
FILE *input_file;
#endif

    {
    yy_init_buffer( yy_current_buffer, input_file );
    yy_load_buffer_state();
    }


#ifdef YY_USE_PROTOS
void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
#else
void yy_switch_to_buffer( new_buffer )
YY_BUFFER_STATE new_buffer;
#endif

    {
    if ( yy_current_buffer == new_buffer )
	return;

    if ( yy_current_buffer )
	{
	/* flush out information for old buffer */
	*yy_c_buf_p = yy_hold_char;
	yy_current_buffer->yy_buf_pos = yy_c_buf_p;
	yy_current_buffer->yy_n_chars = yy_n_chars;
	}

    yy_current_buffer = new_buffer;
    yy_load_buffer_state();

    /* we don't actually know whether we did this switch during
     * EOF (yywrap()) processing, but the only time this flag
     * is looked at is after yywrap() is called, so it's safe
     * to go ahead and always set it.
     */
    yy_did_buffer_switch_on_eof = 1;
    }


#ifdef YY_USE_PROTOS
void yy_load_buffer_state( void )
#else
void yy_load_buffer_state()
#endif

    {
    yy_n_chars = yy_current_buffer->yy_n_chars;
    yytext = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
    yyin = yy_current_buffer->yy_input_file;
    yy_hold_char = *yy_c_buf_p;
    }


#ifdef YY_USE_PROTOS
YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
#else
YY_BUFFER_STATE yy_create_buffer( file, size )
FILE *file;
int size;
#endif

    {
    YY_BUFFER_STATE b;

    b = (YY_BUFFER_STATE) malloc( sizeof( struct yy_buffer_state ) );

    if ( ! b )
	YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );

    b->yy_buf_size = size;

    /* yy_ch_buf has to be 2 characters longer than the size given because
     * we need to put in 2 end-of-buffer characters.
     */
    b->yy_ch_buf = (YY_CHAR *) malloc( (unsigned) (b->yy_buf_size + 2) );

    if ( ! b->yy_ch_buf )
	YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );

    yy_init_buffer( b, file );

    return ( b );
    }


#ifdef YY_USE_PROTOS
void yy_delete_buffer( YY_BUFFER_STATE b )
#else
void yy_delete_buffer( b )
YY_BUFFER_STATE b;
#endif

    {
    if ( b == yy_current_buffer )
	yy_current_buffer = (YY_BUFFER_STATE) 0;

    free( (char *) b->yy_ch_buf );
    free( (char *) b );
    }


#ifdef YY_USE_PROTOS
void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
#else
void yy_init_buffer( b, file )
YY_BUFFER_STATE b;
FILE *file;
#endif

    {
    b->yy_input_file = file;

    /* we put in the '\n' and start reading from [1] so that an
     * initial match-at-newline will be true.
     */

    b->yy_ch_buf[0] = '\n';
    b->yy_n_chars = 1;

    /* we always need two end-of-buffer characters.  The first causes
     * a transition to the end-of-buffer state.  The second causes
     * a jam in that state.
     */
    b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
    b->yy_ch_buf[2] = YY_END_OF_BUFFER_CHAR;

    b->yy_buf_pos = &b->yy_ch_buf[1];

    b->yy_eof_status = EOF_NOT_SEEN;
    }
# line 416 "lit-deatify.lex"


main(argc, argv)
int  argc;
char **argv;
{
    if (argc != 5) {
        fprintf(stderr,"Sorry, %s must have exactly 4 arguments\n", argv[0]);
        exit(1);
    }
    verbose       = argv[1][0] - '0'; /* hacks */
    follow_inputs = argv[2][0] - '0';
    lit2what      = argv[3][0] - '0'; /* used in IS_LIT2xxx tests */
    if (strcmp(argv[4], "-") == 0) {
        yyin = stdin;
    } else if ((yyin = fopen(argv[4], "r")) == NULL) {
        fprintf(stderr,"%s: can't open file %s\n", argv[0], argv[4]);
        exit(1);
    }
    strcpy(srcfile_name, argv[4]);
    inputfile_stk[ inputfile_stk_top /* 0 */ ].name = argv[4];
    if ( ! IS_LIT2PGM_Q ) printf("srcfile!_!%s!_!1!_!\n",argv[4]);
    yylex();
    exit(exit_status);
}

void
push_inputfile (fname)
char* fname;
{
    if ( inputfile_stk_top >= INPUTFILE_STK_SIZE ) {
        fprintf(stderr,"\\input's too deeply nested\n");
        exit(1);
    }

    /* record where we are in current file */
    inputfile_stk[ inputfile_stk_top ].lineno   = lineno;
    inputfile_stk[ inputfile_stk_top ].handle = YY_CURRENT_BUFFER;
    /* actual push */
    inputfile_stk_top++;

    /* open new file fname */
    if ((yyin = fopen(fname, "r")) == NULL) {
        fprintf(stderr,"%s:%d: can't open \\input file %s\n", srcfile_name, lineno, fname);
        exit(1);
    }
    yy_switch_to_buffer( yy_create_buffer( yyin, YY_BUF_SIZE ) );

    /* report that's where we are */
    if (! IS_LIT2PGM_Q) printf("srcfile!_!%s!_!1!_!\n",fname);
    /* set srcfile_name and lineno for new file */

    strcpy(srcfile_name, fname); /* for my own tracking */
    lineno = 1;

    /* push/record everything for new file */
    inputfile_stk[ inputfile_stk_top ].name     = srcfile_name;
    inputfile_stk[ inputfile_stk_top ].lineno   = lineno;
}

void
pop_inputfile ()
{
    inputfile_stk_top--; /* actual pop */

    /* remind where we were */
    strcpy(srcfile_name, inputfile_stk[inputfile_stk_top].name);
    lineno       = inputfile_stk[inputfile_stk_top].lineno;
    /* put in an extra newline or two before the next file;
       otherwise, the cat'ting of files gives things like:

       > last line of code
       \section{Next section}

       which happens to be very bad for lit2stuff.
    */
    if (! IS_LIT2PGM_Q) printf("\n\nsrcfile!_!%s!_!%d!_!\n",srcfile_name,lineno);

    /* return to prev inputfile */
    yy_switch_to_buffer( inputfile_stk[inputfile_stk_top].handle );
}

void
myecho ()
{
    myprintstr(yytext);
}

void
myprintstr (str)
char *str;
{
    if (SHLD_PRINT) {
        printf("%s",str);
    }
}

void
print_leading_whitespace ()
{
    int i;
    
    for (i = 0; yytext[i] == ' ' || yytext[i] == '\t'; i++) {
        putchar(yytext[i]);
    }
}

void
not_OK(msg)
char *msg;
{
    /* a good old emacsable error msg */
    fprintf(stderr,"%s:%d: %s", srcfile_name, lineno, msg);
    exit_status++;
}

void
warning(msg) /* exit_status not fiddled */
char *msg;
{
    /* a good old emacsable warning msg */
    fprintf(stderr,"%s:%d: [warning] %s", srcfile_name, lineno, msg);
}
