Logo Search packages:      
Sourcecode: tela version File versions

lex.yy.c

#define YY_CHAR char
#line 1 "./../pars/flexskel.cc"
/* 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 $
 */
/* MODIFIED FOR C++ CLASS BY Alain Coetmeur: coetmeur(at)icdc.fr */
/* Note that (at) mean the 'at' symbol that I cannot write */
/* because it is expanded to the class name */
/* made at Informatique-CDC, Research&development department */
/* company from the Caisse Des Depots et Consignations */
/* institutional financial group (say 'Cat Doc Cad') */


/* theses symbols are added before this file */
/* #define YY_CHAR 'unsigned char' if 8bit or 'char' if 7bit */
/* #define FLEX_DEBUG if debug mode */
#define FLEX_SCANNER
/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
#ifdef c_plusplus
#ifndef __cplusplus
#define __cplusplus
#endif
#endif
/* Old MSC, before c7 */
#ifdef MSDOS
#ifndef _MSDOS
#define _MSDOS
#endif
#endif
/* turboc */
#ifdef __MSDOS__
#ifndef _MSDOS
#define _MSDOS
#endif
#endif

#ifdef __cplusplus
#include <stdlib.h>
#define YY_USE_CONST
#define YY_USE_PROTOS
#ifndef _MSDOS
#if HAVE_OSFCN_H
#include <osfcn.h>
#endif
#endif
#else   /* ! __cplusplus */
#ifdef __STDC__
#ifdef __GNUC__
#include <stddef.h>
void *malloc( size_t );
void free( void* );
int read();
#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
#include <stdio.h>


/*********************************************/
/* COMPILER DEPENDENT   MACROS               */
/*********************************************/
/* use prototypes in function declarations */
/* the "const" storage-class-modifier is valid */
#ifndef YY_USE_CONST
#define const
#endif
/* use prototypes in function declarations */
#ifndef YY_PROTO
#ifdef YY_USE_PROTOS
#define YY_PROTO(proto) proto
#else
#define YY_PROTO(proto) ()
#endif
#endif


/*********************/
/* parameters        */

/* amount of stuff to slurp up with each read */
#ifndef YY_READ_BUF_SIZE
#define YY_READ_BUF_SIZE 8192
#endif
/* size of default input buffer */
#ifndef YY_BUF_SIZE
#define YY_BUF_SIZE (YY_READ_BUF_SIZE * 2) 
#endif

/***********************************/
/* to be redefined for application */

/* returned upon end-of-file */
#define YY_END_TOK 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 )

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

/* #define YY_USER_ACTION */
/* #define YY_USER_INIT */


#ifndef YY_USE_CLASS
/* copy whatever the last rule matched to the standard output */
/* cast to (char *) is because for 8-bit chars, yy___text 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 *) yy___text, yy___leng, 1, yy___out )

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

#endif
/* 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


/* default declaration of generated scanner - a define so the user can
 * easily add parameters
 */
#define YY_DECL int yylex YY_PROTO(( void )) 
#else 
/* c++ */
#define ECHO yy___echo()
#define YY_INPUT(buf,result,max_size) \
      if ( yy___input((char *)buf, result,max_size) < 0 ) \
          YY_FATAL_ERROR( "YY_INPUT() in flex scanner failed" );

#define YY_FATAL_ERROR(msg) yy___fatal_error(msg)
#define yywrap() yy___wrap()

#endif
/***********************************/
/* not to be changed */
#define YY_NULL 0
#define YY_END_OF_BUFFER_CHAR 0
/* special action meaning "start processing a new file" */
#define YY_NEW_FILE yy___newfile 
/* 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)



/* % section 1 definitions go here */ 
#line 1 "m2t.l"
#define INITIAL 0
#define YY_Tm2tlex_FLEX_SCANNER
#define YY_Tm2tlex_CHAR char
#line 1 "./../pars/flexskel.h"
/* A lexical scanner header generated by flex */
/* MODIFIED FOR C++ CLASS BY Alain Coetmeur: coetmeur(at)icdc.fr */
/* Note that (at) mean the 'at' symbol that I cannot write */
/* because it is expanded to the class name */
/* made at Informatique-CDC, Research&development department */
/* company from the Caisse Des Depots et Consignations */


/*********************************************/
/* SYSTEM dependent declaration, includes... */
/*********************************************/
/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
#ifdef c_plusplus
#ifndef __cplusplus
#define __cplusplus
#endif
#endif
#ifdef __cplusplus
#ifndef YY_USE_PROTOS
#define YY_USE_PROTOS
#endif
#ifndef YY_USE_CLASS
#define YY_USE_CLASS
#endif
#else /* ! __cplusplus */
#ifdef __STDC__
#ifdef __GNUC__
#else
#endif      /* __GNUC__ */
#ifndef YY_USE_PROTOS
#define YY_USE_PROTOS
#endif
#endif      /* __STDC__ */
#endif      /* ! __cplusplus */
/*********************************************/
/* COMPILER DEPENDENT   MACROS               */
/*********************************************/
/* use prototypes in function declarations */
#ifndef YY_PROTO
#ifdef YY_USE_PROTOS
#define YY_PROTO(proto) proto
#else
#define YY_PROTO(proto) ()
#endif
#endif
#include <stdio.h>




/* % here is the declaration from section1 %header{  */ 
#line 11 "m2t.l"

#define STMT_MAX 8196         /* maximum # of chars in one statement */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

FILE *fp,*infp;

int lineno = 1;
int OpenBraceMode = 0;
int MaxParenIndex = 0;
int ParenIndex = 0;
int InLeftHandSide = 1;
int QuoteMeansChar = 1;
int SymToBeTypifiedMatrix = -1;
int LastWasMatrix = 0;
int IdentifierWasThere = 0;
int LastWasRightBracket = 0;

int IgnoreScripts = 0;
int IgnoreFunctions = 0;
int SilentMode = 0;
int VerboseMode = 0;
int NoDivisionWarnings = 0;
int MultiFileMode = 0;

static void warning(const char *str);
static void warning(const char *str, const char *str1);
static void warning(const char *str, const char *str1, const char *str2);

#undef YY_INPUT
#define YY_INPUT(buf,result,max_size) { \
      int c = fgetc(infp); \
      (result) = feof(infp) ? YY_NULL : (((buf)[0] = c), 1); \
}

#define INIT_QUOTEMEANSCHAR 0

char stmtbuff[STMT_MAX];            /* buffer where statement is accumulated */
int si = 0;                               /* index to stmtbuff */

static void ResetParams() {
      OpenBraceMode = 0;
      ParenIndex = 0;
      MaxParenIndex = 0;
      InLeftHandSide = 1;
      QuoteMeansChar = 1;
      SymToBeTypifiedMatrix = -1;
      LastWasMatrix = 0;
      LastWasRightBracket = 0;
      si = 0;
}

char OldChar = '\0';

static void PutString(const char*S) {
      if (!*S) return;
      int L = strlen(S);
      strcpy(stmtbuff+si,S);
      si+= L;
      OldChar = S[L-1];
      LastWasRightBracket = 0;
}

static void PutChar(char ch) {
      stmtbuff[si++] = ch;
      stmtbuff[si] = '\0';
      OldChar = ch;
      LastWasRightBracket = 0;
}

static int HandleIdentifierSequenceCase(const char*s, FILE *fp) {
      if (!IdentifierWasThere) return 0;
      int i;
      for (i=0; s[i] && s[i]!=';' && s[i]!='\n'; i++)
            if (!(isalnum(s[i]) || isspace(s[i]) || s[i]=='-' || s[i]=='.')) return 0;
      for (i=0; s[i] && s[i]!=';' && s[i]!='\n' && isspace(s[i]); i++) fputc(s[i],fp);
      for (; s[i] && s[i]!=';' && s[i]!='\n' && !isspace(s[i]); i++) fputc(s[i],fp);
      fputc('(',fp);
      for (; s[i] && s[i]!=';' && s[i]!='\n' && isspace(s[i]); i++);
      int FirstTime = 1;
      while (s[i] && s[i]!=';' && s[i]!='\n') {
            if (FirstTime) FirstTime=0; else fputc(',',fp);
            fputc('"',fp);
            for (; s[i] && s[i]!=';' && s[i]!='\n' && !isspace(s[i]); i++) fputc(s[i],fp);
            fputc('"',fp);
            for (; s[i] && s[i]!=';' && s[i]!='\n' && isspace(s[i]); i++);
      }
      fputc(')',fp);
      for (; s[i]; i++) fputc(s[i],fp);
      return 1;
}

static void Flush() {
      if (!HandleIdentifierSequenceCase(stmtbuff,fp))
            fputs(stmtbuff,fp);
      si = 0;
      SymToBeTypifiedMatrix = -1;
      IdentifierWasThere = 0;
}

#define MAXSYM 1000

enum Tkind {SURELY_FUNCTION, PROBABLY_FUNCTION, SURELY_MATRIX, PROBABLY_MATRIX, UNKNOWN};

struct Tsymbol {
      char *s;
      Tkind k;
};

Tsymbol symtab[MAXSYM];
int Nsym = 0;

static void SetSymbolKind(int index, Tkind k) {
      if (k==UNKNOWN) k=symtab[index].k;
      switch (symtab[index].k) {
      case UNKNOWN: break;
      case SURELY_FUNCTION:
            if (k!=PROBABLY_FUNCTION && k!=SURELY_FUNCTION)
                  warning("type conflict for symbol '%s', function or matrix?",symtab[index].s);
            break;
      case PROBABLY_FUNCTION:
      case PROBABLY_MATRIX:
            break;
      case SURELY_MATRIX:
            if (k!=PROBABLY_MATRIX && k!=SURELY_MATRIX)
                  warning("type conflict for symbol '%s', function or matrix?",symtab[index].s);
            break;
      }
      symtab[index].k = k;
}

static int PutSymbol(const char *name, Tkind kind=UNKNOWN) {
// Put name in symbol table and return the symbol table index
      // Look for symbol in the set of old symbols
      int found=0, index=0;
      for (int i=0; i<Nsym; i++)
            if (!strcmp(name,symtab[i].s)) {
                  found = 1;
                  index = i;
                  break;
            }
      if (found) {
            SetSymbolKind(index,kind);
            return index;
      }
      if (Nsym+1 > MAXSYM) {
            fprintf(stderr,"*** Symbol table overflow, increase MAXSYM\n");
            exit(1);
      }
      symtab[Nsym].s = strdup(name);
      symtab[Nsym].k = kind;
      Nsym++;
      return Nsym-1;
}

static void ClearSymbolTable() {
      for (int i=0; i<Nsym; i++) free(symtab[i].s);
      Nsym = 0;
      PutSymbol("pi",SURELY_MATRIX);
      PutSymbol("eps",SURELY_MATRIX);
      PutSymbol("i",SURELY_MATRIX);
      PutSymbol("Inf",SURELY_MATRIX);
      ResetParams();
}

static void OutputSymbolTable(FILE *fp, char*filename) {
      fprintf(fp,"SYMBOL TABLE FOR FILE '%s':\n",filename);
      for (int i=0; i<Nsym; i++) {
            fprintf(fp,"%-30s",symtab[i].s);
            switch (symtab[i].k) {
            case SURELY_FUNCTION:   fprintf(fp,"surely function"); break;
            case SURELY_MATRIX:     fprintf(fp,"surely matrix"); break;
            case PROBABLY_FUNCTION: fprintf(fp,"probably function"); break;
            case PROBABLY_MATRIX:   fprintf(fp,"probably matrix"); break;
            case UNKNOWN:           fprintf(fp,"UNKNOWN"); break;
            }
            fprintf(fp,"\n");
      }
}

#define MAXPAREN 1000

char ParenStack[MAXPAREN];

static void PutParen(char paren) {
      if (paren!='(' && paren!='[') {
            fprintf(stderr,"*** Internal error: bad paren\n");
            exit(2);
      }
      ParenStack[ParenIndex++] = paren;
      if (ParenIndex > MaxParenIndex) MaxParenIndex = ParenIndex;
      PutChar(paren);
}

static void CloseParen() {
      char ch = ParenStack[--ParenIndex];
      if (ch == '(')
            PutChar(')');
      else {
            PutChar(']');
            LastWasRightBracket = 1;
      }
}

struct Tstringpair {
      char *str1;
      char *str2;
};

Tstringpair IDtranslations[] = {
      {"real","Re"},
      {"imag","Im"},
      {"finite","isfinite"},
      {"fft","FFT"},
      {"ifft","invFFT"},
      {"svd","SVD"},
      {"lu","LU"},
      {"std","stddev"},
      {0,0}
};

char *FunctionalVariables[] = {
      "cputime",
      "tic",
      "toc",
      0
};

#line 244 "m2t.l"
#line 244 "m2t.l"
#line 541 "m2t.l"
#line 52 "./../pars/flexskel.h"



#ifndef YY_Tm2tlex_TEXT
#define YY_Tm2tlex_TEXT yytext
#endif
#ifndef YY_Tm2tlex_LENG
#define YY_Tm2tlex_LENG yyleng
#endif
#ifndef YY_Tm2tlex_IN
#define YY_Tm2tlex_IN yyin
#endif
#ifndef YY_Tm2tlex_OUT
#define YY_Tm2tlex_OUT yyout
#endif
#ifndef YY_Tm2tlex_LEX_RETURN
#define YY_Tm2tlex_LEX_RETURN int
#else
#ifndef YY_Tm2tlex_LEX_DEFINED
#define YY_Tm2tlex_LEX_DEFINED 
#endif
#endif

#ifndef YY_Tm2tlex_LEX
#define YY_Tm2tlex_LEX yylex
#else
#ifndef YY_Tm2tlex_LEX_DEFINED
#define YY_Tm2tlex_LEX_DEFINED 
#endif
#endif

#ifndef YY_Tm2tlex_LEX_PARAM
#ifndef YY_USE_PROTOS
#define YY_Tm2tlex_LEX_PARAM 
#else
#define YY_Tm2tlex_LEX_PARAM void
#endif
#else
#ifndef YY_Tm2tlex_LEX_DEFINED
#define YY_Tm2tlex_LEX_DEFINED 
#endif
#endif

#ifndef YY_Tm2tlex_LEX_PARAM_DEF
#define YY_Tm2tlex_LEX_PARAM_DEF
#else
#ifndef YY_Tm2tlex_LEX_DEFINED
#define YY_Tm2tlex_LEX_DEFINED 
#endif
#endif

#ifndef YY_Tm2tlex_RESTART
#define YY_Tm2tlex_RESTART yyrestart
#endif
#ifndef YY_Tm2tlex_SWITCH_TO_BUFFER
#define YY_Tm2tlex_SWITCH_TO_BUFFER yy_switch_to_buffer
#endif
#ifndef YY_Tm2tlex_LOAD_BUFFER_STATE
#define YY_Tm2tlex_LOAD_BUFFER_STATE yy_load_buffer_state
#endif

#ifndef YY_Tm2tlex_CREATE_BUFFER
#define YY_Tm2tlex_CREATE_BUFFER yy_create_buffer
#ifndef YY_USE_CLASS
#ifndef yy_new_buffer
#define yy_new_buffer yy_create_buffer
#endif
#endif
#endif
#ifndef YY_Tm2tlex_DELETE_BUFFER
#define YY_Tm2tlex_DELETE_BUFFER yy_delete_buffer
#endif
#ifndef YY_Tm2tlex_INIT_BUFFER
#define YY_Tm2tlex_INIT_BUFFER yy_init_buffer
#endif
#ifdef YY_Tm2tlex_FLEX_DEBUG
#ifndef YY_Tm2tlex_DEBUG
#define YY_Tm2tlex_DEBUG 1
#endif
#else
#ifndef YY_Tm2tlex_DEBUG
#define YY_Tm2tlex_DEBUG 0
#endif
#endif

#if YY_Tm2tlex_DEBUG != 0
#ifndef YY_Tm2tlex_DEBUG_FLAG
#define YY_Tm2tlex_DEBUG_FLAG yy_flex_debug
#endif
#ifndef YY_Tm2tlex_DEBUG_INIT
#define YY_Tm2tlex_DEBUG_INIT 1
#endif
#endif




#ifndef YY_USE_CLASS
typedef struct yy_buffer_state *YY_BUFFER_STATE;

extern void YY_Tm2tlex_RESTART YY_PROTO(( FILE *input_file ));
extern void YY_Tm2tlex_SWITCH_TO_BUFFER YY_PROTO(( YY_BUFFER_STATE new_buffer ));
extern void YY_Tm2tlex_LOAD_BUFFER_STATE YY_PROTO(( void ));
extern YY_BUFFER_STATE YY_Tm2tlex_CREATE_BUFFER YY_PROTO(( FILE *file, int size ));
extern void YY_Tm2tlex_DELETE_BUFFER YY_PROTO(( YY_BUFFER_STATE b ));
extern void YY_Tm2tlex_INIT_BUFFER YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));

#if YY_Tm2tlex_DEBUG != 0
extern int YY_Tm2tlex_DEBUG_FLAG ;
#endif
extern YY_Tm2tlex_CHAR  *YY_Tm2tlex_TEXT;
extern int YY_Tm2tlex_LENG;
extern FILE *YY_Tm2tlex_IN, *YY_Tm2tlex_OUT;
#ifdef YY_Tm2tlex_LEX_DEFINED
extern YY_Tm2tlex_LEX_RETURN YY_Tm2tlex_LEX ( YY_Tm2tlex_LEX_PARAM )
YY_Tm2tlex_LEX_PARAM_DEF
#else
#ifndef YY_DECL
extern YY_Tm2tlex_LEX_RETURN YY_Tm2tlex_LEX ( YY_Tm2tlex_LEX_PARAM )
YY_Tm2tlex_LEX_PARAM_DEF
#else
/* no declaration if oldstyle flex */
#endif
#endif
#else

#ifndef YY_Tm2tlex_CLASS
#define YY_Tm2tlex_CLASS Tm2tlex
#endif
#ifndef YY_Tm2tlex_ECHO
#define YY_Tm2tlex_ECHO yy_echo
#endif
#ifdef YY_Tm2tlex_ECHO_PURE
#define YY_Tm2tlex_ECHO_NOCODE
#endif
#ifndef YY_Tm2tlex_ECHO_CODE
#define YY_Tm2tlex_ECHO_CODE fwrite( (char *) YY_Tm2tlex_TEXT, YY_Tm2tlex_LENG, 1, YY_Tm2tlex_OUT );
#endif
#ifndef YY_Tm2tlex_INPUT
#define YY_Tm2tlex_INPUT yy_input
#endif
#ifdef YY_Tm2tlex_INPUT_PURE
#define YY_Tm2tlex_INPUT_NOCODE
#endif
#ifndef YY_Tm2tlex_INPUT_CODE
#define YY_Tm2tlex_INPUT_CODE return result= fread(  buffer, 1,max_size,YY_Tm2tlex_IN );
#endif
#ifdef YY_Tm2tlex_FATAL_ERROR_PURE
#define YY_Tm2tlex_FATAL_ERRO_NOCODE
#endif
#ifndef YY_Tm2tlex_FATAL_ERROR
#define YY_Tm2tlex_FATAL_ERROR yy_fatal_error
#endif
#ifndef YY_Tm2tlex_FATAL_ERROR_CODE
#define YY_Tm2tlex_FATAL_ERROR_CODE fputs( msg, stderr );putc( '\n', stderr );exit( 1 );
#endif
#ifndef YY_Tm2tlex_WRAP
#define YY_Tm2tlex_WRAP yy_wrap
#endif
#ifdef YY_Tm2tlex_WRAP_PURE
#define YY_Tm2tlex_WRAP_NOCODE
#endif
#ifndef YY_Tm2tlex_WRAP_CODE
#define YY_Tm2tlex_WRAP_CODE return 1;
#endif


#ifndef YY_Tm2tlex_INHERIT
#define YY_Tm2tlex_INHERIT
#endif
#ifndef YY_Tm2tlex_MEMBERS
#define YY_Tm2tlex_MEMBERS 
#endif
#ifndef YY_Tm2tlex_CONSTRUCTOR_PARAM
#define YY_Tm2tlex_CONSTRUCTOR_PARAM
#endif
#ifndef YY_Tm2tlex_CONSTRUCTOR_CODE
#define YY_Tm2tlex_CONSTRUCTOR_CODE
#endif
#ifndef YY_Tm2tlex_CONSTRUCTOR_INIT
#define YY_Tm2tlex_CONSTRUCTOR_INIT
#endif
typedef struct yy_buffer_state *YY_BUFFER_STATE;

class YY_Tm2tlex_CLASS YY_Tm2tlex_INHERIT
{
 private:/* data */
 YY_Tm2tlex_CHAR  *yy_c_buf_p;
 YY_Tm2tlex_CHAR  yy_hold_char;
 int yy_n_chars;
 int yy_init;
 int yy_start;
 int yy_did_buffer_switch_on_eof;
 private: /* functions */
 void yy_initialize();
 int input();
 int yyinput() {return input();};
 int yy_get_next_buffer();
 void yyunput( YY_Tm2tlex_CHAR  c, YY_Tm2tlex_CHAR  *buf_ptr );
 /* use long instead of yy_state_type because it is undef */
 long yy_get_previous_state_ ( void );
 long yy_try_NUL_trans_  ( long current_state_ );
 protected:/* non virtual */
 YY_BUFFER_STATE yy_current_buffer;
 void YY_Tm2tlex_RESTART ( FILE *input_file );
 void YY_Tm2tlex_SWITCH_TO_BUFFER( YY_BUFFER_STATE new_buffer );
 void YY_Tm2tlex_LOAD_BUFFER_STATE( void );
 YY_BUFFER_STATE YY_Tm2tlex_CREATE_BUFFER( FILE *file, int size );
 void YY_Tm2tlex_DELETE_BUFFER( YY_BUFFER_STATE b );
 void YY_Tm2tlex_INIT_BUFFER( YY_BUFFER_STATE b, FILE *file );
 protected: /* virtual */
 virtual void YY_Tm2tlex_ECHO()
#ifdef YY_Tm2tlex_ECHO_PURE
  =0
#endif
  ;
 virtual int  YY_Tm2tlex_INPUT(char  *buf,int &result,int max_size)
#ifdef YY_Tm2tlex_INPUT_PURE
  =0
#endif
  ;
 virtual void  YY_Tm2tlex_FATAL_ERROR(char *msg)
#ifdef YY_Tm2tlex_FATAL_ERROR_PURE
  =0
#endif
  ;
 virtual int  YY_Tm2tlex_WRAP()
#ifdef YY_Tm2tlex_WRAP_PURE
  =0
#endif
  ;
 public:
 YY_Tm2tlex_CHAR  *YY_Tm2tlex_TEXT;
 int YY_Tm2tlex_LENG;
 FILE *YY_Tm2tlex_IN, *YY_Tm2tlex_OUT;
 YY_Tm2tlex_LEX_RETURN YY_Tm2tlex_LEX ( YY_Tm2tlex_LEX_PARAM);
 YY_Tm2tlex_CLASS(YY_Tm2tlex_CONSTRUCTOR_PARAM) ;
#if YY_Tm2tlex_DEBUG != 0
 int YY_Tm2tlex_DEBUG_FLAG;
#endif
 public: /* added members */
 YY_Tm2tlex_MEMBERS 
};
#endif



/* declaration of externs for public use of yylex scanner */

/* % here is the declaration from section2 %header{ */ 
#line 195 "./../pars/flexskel.cc"

#define yy___text YY_Tm2tlex_TEXT
#define yy___leng YY_Tm2tlex_LENG
#define yy___in YY_Tm2tlex_IN
#define yy___out YY_Tm2tlex_OUT
#define yy___newfile \
      do \
            { \
            YY_Tm2tlex_INIT_BUFFER( yy_current_buffer, yy___in ); \
            YY_Tm2tlex_LOAD_BUFFER_STATE(); \
            } \
      while ( 0 )
#if YY_Tm2tlex_DEBUG != 0
#define yy___flex_debug YY_Tm2tlex_DEBUG_FLAG
#endif


#ifdef YY_USE_CLASS

#define yy___echo YY_Tm2tlex_ECHO
#define yy___input YY_Tm2tlex_INPUT
#define yy___fatal_error YY_Tm2tlex_FATAL_ERROR
#define yy___wrap YY_Tm2tlex_WRAP

#endif

/* done after the current pattern has been matched and before the
 * corresponding action - sets up yy___text
 */
#define YY_DO_BEFORE_ACTION \
      yy___text = yy_bp; \
/* % code to fiddle yy___text and yy___leng for yymore() goes here */ \
      yy___leng = 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 yy___text */ \
            *yy_cp = yy_hold_char; \
            yy_c_buf_p = yy_cp = yy_bp + n; \
            YY_DO_BEFORE_ACTION; /* set up yy___text again */ \
            } \
      while ( 0 )

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



struct yy_buffer_state
    {
    FILE *yy_input_file;

    YY_Tm2tlex_CHAR *yy_ch_buf;               /* input buffer */
    YY_Tm2tlex_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
    };

/* 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"
 */

#ifndef YY_USE_CLASS

#if YY_Tm2tlex_DEBUG != 0
int YY_Tm2tlex_DEBUG_FLAG=YY_Tm2tlex_DEBUG_INIT;
#endif
#define YY_CURRENT_BUFFER yy_current_buffer
static YY_BUFFER_STATE yy_current_buffer;
/* yy_hold_char holds the character lost when yy___text is formed */
static YY_Tm2tlex_CHAR yy_hold_char;

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

/* GLOBAL */
YY_Tm2tlex_CHAR *yy___text;
int yy___leng;

FILE *yy___in = (FILE *) 0, *yy___out = (FILE *) 0;

#ifdef __cplusplus
static int yyinput YY_PROTO(( void ));
#else
static int input YY_PROTO(( void ));
#endif
/* these variables are all declared out here so that section 3 code can
 * manipulate them
 */
/* points to current character in buffer */
static YY_Tm2tlex_CHAR *yy_c_buf_p = (YY_Tm2tlex_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 yy___in.  A bit of a hack ...
 */
static int yy_did_buffer_switch_on_eof;

static int yy_get_next_buffer YY_PROTO(( void ));
static void yyunput YY_PROTO(( YY_Tm2tlex_CHAR c, YY_Tm2tlex_CHAR *buf_ptr ));

#else
/* c++ */
#ifndef YY_Tm2tlex_ECHO_NOCODE
void YY_Tm2tlex_CLASS::yy___echo()
{YY_Tm2tlex_ECHO_CODE
}
#endif
#ifndef YY_Tm2tlex_INPUT_NOCODE
int  YY_Tm2tlex_CLASS::yy___input(char * buffer,int &result,int max_size)
{YY_Tm2tlex_INPUT_CODE
}
#endif
#ifndef YY_Tm2tlex_FATAL_ERROR_NOCODE
void YY_Tm2tlex_CLASS::yy___fatal_error(char *msg)
{YY_Tm2tlex_FATAL_ERROR_CODE
}
#endif
#ifndef YY_Tm2tlex_WRAP_NOCODE
int  YY_Tm2tlex_CLASS::yy___wrap()
{YY_Tm2tlex_WRAP_CODE
}
#endif
void YY_Tm2tlex_CLASS::yy_initialize()
{
 yy___in=0;yy___out=0;yy_init = 1;
 yy_start=0;
 yy___text=0;yy___leng=0;
 yy_current_buffer=0;
 yy_did_buffer_switch_on_eof=0;
 yy_c_buf_p=0;yy_hold_char=0;yy_n_chars=0;
#if YY_Tm2tlex_DEBUG != 0
 YY_Tm2tlex_DEBUG_FLAG=YY_Tm2tlex_DEBUG_INIT;
#endif
}

YY_Tm2tlex_CLASS::YY_Tm2tlex_CLASS(YY_Tm2tlex_CONSTRUCTOR_PARAM) YY_Tm2tlex_CONSTRUCTOR_INIT
{yy_initialize();
 YY_Tm2tlex_CONSTRUCTOR_CODE;
}

#endif


#ifndef YY_USER_ACTION
#define YY_USER_ACTION
#endif

#ifndef YY_USER_INIT
#define YY_USER_INIT
#endif

/* % data tables for the DFA go here */ 
#define YY_END_OF_BUFFER 53
typedef int yy_state_type;
static const short int yy_accept[149] =
    {   0,
        0,    0,   53,   51,    2,    9,    3,   33,   50,   21,
       22,   26,   36,    6,   37,   51,   28,   38,    8,   20,
       39,   49,   23,   24,   30,   49,   49,   49,   49,   49,
       49,   49,   49,   49,   34,   35,    2,    5,   31,   25,
        0,   27,   29,    7,   19,   49,    0,    0,   10,   49,
       49,   49,   49,   49,   11,   49,   49,   49,   49,   32,
        0,    1,    1,   49,   49,   18,   15,   49,   49,   49,
       49,   49,   49,    4,   49,   12,   49,   49,    0,    0,
       49,   49,   49,   16,   49,    0,    0,    0,    0,   49,
       14,   49,   13,    0,    0,    0,    0,    0,    0,   17,

        0,    0,    0,   40,    0,    0,    0,   47,    0,    0,
        0,    0,    0,    0,    0,    0,   41,    0,    0,    0,
        0,    0,    0,   42,    0,    0,    0,   48,    0,    0,
        0,    0,   45,   43,    0,   43,    0,    0,    0,    0,
        0,    0,    0,   46,   44,    0,   44,    0
    } ;

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

       29,   30,   22,   31,   32,   22,   33,   34,   35,   36,
       37,   22,   22,   38,   39,   40,   41,   22,   42,   22,
       22,   43,    1,   44,    1,   45,    1
    } ;

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

static const short int yy_base[159] =
    {   0,
        0,    0,  269,  270,   44,  270,  270,  270,  270,  270,
      270,  270,  270,  265,  270,   40,  270,  270,  264,  246,
      270,    0,   45,  270,  270,  227,   17,  227,  226,  232,
      225,  231,  228,  229,  270,  237,   54,  270,  270,  270,
      242,  270,  270,  270,  270,    0,  205,   48,  270,  197,
      186,  196,  183,  183,    0,  184,   22,  180,  171,  270,
      202,  270,  270,  168,  157,    0,    0,  154,  139,   59,
      133,  135,  128,  270,  129,  129,  145,   62,   69,    0,
      107,  112,   93,    0,   99,   91,   72,   77,  113,   84,
        0,   80,    0,   53,   83,   89,   66,   93,    0,    0,

       88,  105,   74,  270,  106,   91,  109,  270,  110,  122,
      113,   90,  131,  134,  107,  135,  270,  138,  150,  151,
      154,   77,  155,  270,  164,   56,  168,  270,  171,  175,
      181,  187,  270,  270,  188,  270,  191,  197,  198,  202,
       51,  206,  214,  270,  270,  218,  270,  270,   55,  226,
      230,  233,  236,  239,  242,  245,  248,  251
    } ;

static const short int yy_def[159] =
    {   0,
      148,    1,  148,  148,  148,  148,  148,  148,  148,  148,
      148,  148,  148,  148,  148,  148,  148,  148,  148,  148,
      148,  149,  150,  148,  148,  149,  149,  149,  149,  149,
      149,  149,  149,  149,  148,  148,  148,  148,  148,  148,
      148,  148,  148,  148,  148,  149,  150,  150,  148,  149,
      149,  149,  149,  149,  149,  149,  149,  149,  149,  148,
      148,  148,  148,  149,  149,  149,  149,  149,  149,  149,
      149,  149,  149,  148,  149,  149,  149,  149,  148,  151,
      149,  149,  149,  149,  149,  148,  148,  152,  151,  149,
      149,  149,  149,  148,  153,  152,  152,  152,  154,  149,

      148,  155,  148,  148,  153,  153,  153,  148,  148,  152,
      156,  154,  157,  155,  155,  155,  148,  153,  148,  148,
      156,  156,  156,  148,  157,  157,  157,  148,  148,  155,
      158,  148,  148,  148,  156,  148,  157,  148,  148,  158,
      158,  158,  148,  148,  148,  158,  148,    0,  148,  148,
      148,  148,  148,  148,  148,  148,  148,  148
    } ;

static const short int yy_nxt[316] =
    {   0,
        4,    5,    6,    5,    7,    8,    9,   10,   11,   12,
       13,   14,   15,   16,   17,    4,    4,   18,   19,   20,
       21,   22,   23,   24,   25,   22,   26,   22,   27,   28,
       29,   30,   22,   22,   22,   22,   31,   32,   22,   22,
       22,   33,   34,   35,   36,   37,   39,   37,   48,   40,
       51,   48,   52,   41,   42,   37,   70,   37,   46,  145,
       79,   71,   79,   87,   43,   87,   80,  129,   49,   88,
       79,   63,   79,   87,  108,   87,   80,  109,   96,   95,
       96,  101,  103,  101,  105,  134,  105,  102,  104,  101,
       96,  101,   96,   98,  110,  113,  110,  108,  124,  107,

      109,  108,  109,  117,  111,   98,  114,  105,  114,  105,
      118,  119,  118,  119,  121,  128,  121,  109,  129,  100,
      111,  116,  107,  110,   99,  110,  120,   94,   93,  123,
      108,   92,  125,  111,  125,  114,  130,  114,  130,  118,
       91,  118,  128,  128,   90,  129,  131,  127,   86,  111,
      116,  119,  132,  119,  132,  121,  135,  121,  135,  133,
       85,   84,  134,  136,   83,  125,  120,  125,   82,  137,
      123,  137,  138,   81,  138,  129,  130,   78,  130,  131,
      127,   77,  140,  128,  140,   76,  131,  139,  132,  135,
      132,  135,  137,   75,  137,  133,  136,  142,  138,  143,

      138,  143,  131,  140,   74,  140,  144,  146,   73,  146,
      145,   72,   69,  139,  147,  143,   68,  143,  142,  146,
       67,  146,  144,   66,   65,   64,  147,   47,   62,   47,
       47,   89,   89,   89,   97,   97,   97,  106,  106,  106,
      112,  112,  112,  115,  115,  115,  122,  122,  122,  126,
      126,  126,  141,  141,  141,   61,   60,   59,   58,   57,
       56,   55,   54,   53,   50,   45,   44,   38,  148,    3,
      148,  148,  148,  148,  148,  148,  148,  148,  148,  148,
      148,  148,  148,  148,  148,  148,  148,  148,  148,  148,
      148,  148,  148,  148,  148,  148,  148,  148,  148,  148,

      148,  148,  148,  148,  148,  148,  148,  148,  148,  148,
      148,  148,  148,  148,  148
    } ;

static const short int yy_chk[316] =
    {   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,
        1,    1,    1,    1,    1,    5,   16,    5,   23,   16,
       27,   48,   27,   16,   16,   37,   57,   37,  149,  141,
       70,   57,   70,   78,   16,   78,   70,  126,   23,   78,
       79,   48,   79,   87,   97,   87,   79,   97,   88,   87,
       88,   92,   94,   92,   95,  122,   95,   92,   94,  101,
       96,  101,   96,   88,   98,  101,   98,   96,  112,   95,

       96,   98,  106,  103,   98,   96,  102,  105,  102,  105,
      107,  109,  107,  109,  111,  115,  111,  105,  115,   90,
      107,  102,  105,  110,   89,  110,  109,   86,   85,  111,
      110,   83,  113,  110,  113,  114,  116,  114,  116,  118,
       82,  118,  114,  116,   81,  114,  116,  113,   77,  118,
      114,  119,  120,  119,  120,  121,  123,  121,  123,  120,
       76,   75,  121,  123,   73,  125,  119,  125,   72,  127,
      121,  127,  129,   71,  129,  125,  130,   69,  130,  127,
      125,   68,  131,  130,  131,   65,  130,  129,  132,  135,
      132,  135,  137,   64,  137,  132,  135,  131,  138,  139,

      138,  139,  137,  140,   61,  140,  139,  142,   59,  142,
      140,   58,   56,  138,  142,  143,   54,  143,  140,  146,
       53,  146,  143,   52,   51,   50,  146,  150,   47,  150,
      150,  151,  151,  151,  152,  152,  152,  153,  153,  153,
      154,  154,  154,  155,  155,  155,  156,  156,  156,  157,
      157,  157,  158,  158,  158,   41,   36,   34,   33,   32,
       31,   30,   29,   28,   26,   20,   19,   14,    3,  148,
      148,  148,  148,  148,  148,  148,  148,  148,  148,  148,
      148,  148,  148,  148,  148,  148,  148,  148,  148,  148,
      148,  148,  148,  148,  148,  148,  148,  148,  148,  148,

      148,  148,  148,  148,  148,  148,  148,  148,  148,  148,
      148,  148,  148,  148,  148
    } ;

static yy_state_type yy_last_accepting_state;
static YY_CHAR *yy_last_accepting_cpos;

#if YY_Tm2tlex_DEBUG != 0
static const short int yy_rule_linenum[52] =
    {   0,
      247,  267,  270,  280,  283,  297,  310,  326,  341,  357,
      360,  361,  362,  363,  364,  365,  366,  367,  372,  373,
      389,  390,  391,  397,  403,  404,  405,  406,  407,  408,
      409,  410,  411,  412,  413,  414,  415,  416,  417,  420,
      421,  423,  437,  444,  451,  459,  467,  477,  490,  516,
      539
    } ;

#endif
/* 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
#line 368 "./../pars/flexskel.cc"
#ifndef YY_USE_CLASS
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 ));
#else
#define yy_get_previous_state() ((yy_state_type)(yy_get_previous_state_()))
#define yy_try_NUL_trans(c) ((yy_state_type)(yy_try_NUL_trans_(c)))
#endif

#ifndef YY_USE_CLASS
#ifdef YY_Tm2tlex_LEX_DEFINED
YY_Tm2tlex_LEX_RETURN YY_Tm2tlex_LEX ( YY_Tm2tlex_LEX_PARAM )
YY_Tm2tlex_LEX_PARAM_DEF
#else
YY_DECL
#endif
#else
YY_Tm2tlex_LEX_RETURN YY_Tm2tlex_CLASS::YY_Tm2tlex_LEX ( YY_Tm2tlex_LEX_PARAM)

#endif
    {
    register yy_state_type yy_current_state;
    register YY_Tm2tlex_CHAR *yy_cp, *yy_bp;
    register int yy_act;

/* % user's declarations go here */ 


 /* recognize forms [x y z ...] where x,y,z.. contain only literal numbers or identifiers */
/* % end of prolog */ 
#line 393 "./../pars/flexskel.cc"

    if ( yy_init )
      {
       
       {
       YY_USER_INIT;
       }
      if ( ! yy_start )
          yy_start = 1;       /* first start state */

      if ( ! yy___in )
          yy___in = stdin;

      if ( ! yy___out )
          yy___out = stdout;

      if ( yy_current_buffer )
          YY_Tm2tlex_INIT_BUFFER( yy_current_buffer, yy___in );
      else
          yy_current_buffer = YY_Tm2tlex_CREATE_BUFFER( yy___in, YY_BUF_SIZE );

      YY_Tm2tlex_LOAD_BUFFER_STATE();
      yy_init=0;
      }

    while ( 1 )         /* loops until end-of-file is reached */
      {
/* % yymore()-related code goes here */ 
#line 421 "./../pars/flexskel.cc"
      yy_cp = yy_c_buf_p;

      /* support of yy___text */
      *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;

/* % code to set up and find next match goes here */ 
      yy_current_state = yy_start;
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 >= 149 )
                yy_c = yy_meta[yy_c];
            }
          yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
          ++yy_cp;
          }
      while ( yy_current_state != 148 );
      yy_cp = yy_last_accepting_cpos;
      yy_current_state = yy_last_accepting_state;
#line 432 "./../pars/flexskel.cc"

yy_find_action:
/* % code to find the action number goes here */ 
      yy_act = yy_accept[yy_current_state];
#line 435 "./../pars/flexskel.cc"

      YY_DO_BEFORE_ACTION;
      YY_USER_ACTION;

do_action:      /* this label is used only to access EOF actions */
#if YY_Tm2tlex_DEBUG != 0
      if ( yy___flex_debug )
            {
            if ( yy_act == 0 )
                  fprintf( stderr, "--scanner backtracking\n" );
            else if ( yy_act < YY_END_OF_BUFFER -1 )
                  fprintf( stderr, 
                   "--accepting rule at line %d (\"%s\")\n",
                   yy_rule_linenum[yy_act], yy___text );
            else if ( yy_act == YY_END_OF_BUFFER -1 )
                  fprintf( stderr, 
                   "--accepting default rule (\"%s\")\n",
                   yy___text );
            else if ( yy_act == YY_END_OF_BUFFER )
                  fprintf( stderr, "--(end of buffer or a NUL)\n" );
            else
                  fprintf( stderr, "--EOF\n" );
            }
#endif
      switch ( yy_act )
          {
/* % actions go here */ 
          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 247 "m2t.l"
{
      ParenStack[ParenIndex] = '[';
      PutString((InLeftHandSide&&ParenIndex==0)?"[":"#(");
      LastWasMatrix = 0;
      int LastWasSpace=0;
      for (int i=1; i<yyleng-1; i++)
            if (yytext[i] == ' ') {
                  if (!LastWasSpace) PutChar(',');
                  LastWasSpace=1;
            } else {
                  PutChar(yytext[i]);
                  LastWasSpace=0;
            }
      QuoteMeansChar = INIT_QUOTEMEANSCHAR;
      PutChar((InLeftHandSide&&ParenIndex==0)?']':')');
      LastWasMatrix = 0;
      Flush();
}
      YY_BREAK
 /* echo spaces and tabs */
case 2:
#line 267 "m2t.l"
{ PutString(yytext); QuoteMeansChar++; }
      YY_BREAK
 /* recognize comments */
case 3:
#line 270 "m2t.l"
{
      int c;
      /* eat up the comment, until a newline. Echo comment preceded by '//' to fp */
      PutString("//"); Flush();
      while ( ((c=input()) != '\n') && (c != EOF)) fputc(c,fp);
      lineno++;
      PutChar('\n'); Flush();
}
      YY_BREAK
 /* continuation lines */
case 4:
#line 280 "m2t.l"
{ PutChar('\n'); lineno++; }
      YY_BREAK
 /* statement separators */
case 5:
#line 283 "m2t.l"
{ lineno++;
                    if (ParenIndex==0) {
                        PutString(OpenBraceMode ? ") {\n" : ";\n");
                        OpenBraceMode=0;
                        InLeftHandSide=1;
                        MaxParenIndex=0;
                        Flush();
                    } else {
                        PutString(",\n");
                        QuoteMeansChar++;
                    }
                    LastWasMatrix = 0;
                  }
      YY_BREAK
case 6:
#line 297 "m2t.l"
{ if (ParenIndex==0) {
                        PutString(OpenBraceMode ? ") {" : ";");
                        OpenBraceMode=0;
                        InLeftHandSide=1;
                        MaxParenIndex=0;
                        Flush();
                    } else {
                        PutChar(',');
                        QuoteMeansChar++;
                    }
                    LastWasMatrix = 0;
                  }
      YY_BREAK
case 7:
#line 310 "m2t.l"
{ lineno++;
                    if (ParenIndex==0) {
                        if (OldChar!='\n')
                              PutString(OpenBraceMode ? ") {\n" : ";\n");
                        else
                              PutString(OpenBraceMode ? ") {\n" : "");
                        OpenBraceMode=0;
                        InLeftHandSide=1;
                        MaxParenIndex=0;
                        Flush();
                    } else {
                        PutString(";\n");
                    }
                    LastWasMatrix = 0;
                  }
      YY_BREAK
case 8:
#line 326 "m2t.l"
{ if (ParenIndex==0) {
                        if (OldChar!='\n')
                              PutString(OpenBraceMode ? ") {" : ";");
                        else
                              PutString(OpenBraceMode ? ") {" : "");
                        OpenBraceMode=0;
                        InLeftHandSide=1;
                        MaxParenIndex=0;
                        Flush();
                    } else {
                        PutChar(';');
                    }
                    LastWasMatrix = 0;
                  }
      YY_BREAK
case 9:
#line 341 "m2t.l"
{ lineno++;
                    if (ParenIndex==0) {
                        if (OldChar!='\n')
                              PutString(OpenBraceMode ? ") {\n" : ";\n");
                        else
                              PutString(OpenBraceMode ? ") {\n" : "\n");
                        OpenBraceMode=0;
                        InLeftHandSide=1;
                        MaxParenIndex=0;
                        Flush();
                    } else
                        PutChar('\n');
                    LastWasMatrix = 0;
                  }
      YY_BREAK
 /* empty array constructor */
case 10:
#line 357 "m2t.l"
{ PutString("zeros(0)"); QuoteMeansChar=INIT_QUOTEMEANSCHAR; }
      YY_BREAK
  /* recognize keywords */
case 11:
#line 360 "m2t.l"
{ PutString("if ("); OpenBraceMode=1; InLeftHandSide=0; MaxParenIndex=0; QuoteMeansChar++; Flush(); }
      YY_BREAK
case 12:
#line 361 "m2t.l"
{ PutString("} else {"); QuoteMeansChar++; Flush(); }
      YY_BREAK
case 13:
#line 362 "m2t.l"
{ PutString("} else if ("); OpenBraceMode=1; InLeftHandSide=MaxParenIndex=0; QuoteMeansChar++; Flush(); }
      YY_BREAK
case 14:
#line 363 "m2t.l"
{ PutString("while ("); OpenBraceMode=1; InLeftHandSide=MaxParenIndex=0; QuoteMeansChar++; Flush(); }
      YY_BREAK
case 15:
#line 364 "m2t.l"
{ PutString("foreach ("); OpenBraceMode=1; InLeftHandSide=MaxParenIndex=0; QuoteMeansChar++; Flush(); }
      YY_BREAK
case 16:
#line 365 "m2t.l"
{ PutString("break"); QuoteMeansChar++; Flush();}
      YY_BREAK
case 17:
#line 366 "m2t.l"
{ PutString("return"); QuoteMeansChar++; Flush(); }
      YY_BREAK
case 18:
#line 367 "m2t.l"
{ PutChar('}'); QuoteMeansChar++; Flush(); }
      YY_BREAK
 /*"function"           return FUNCTION;*/
 /* some operators */
case 19:
#line 372 "m2t.l"
{ PutString("=="); QuoteMeansChar++; LastWasMatrix=0; }
      YY_BREAK
case 20:
#line 373 "m2t.l"
{
                        PutChar('=');
                        QuoteMeansChar++;
                        if (ParenIndex==0) {
                              InLeftHandSide=0;
                              if (SymToBeTypifiedMatrix>=0) {
                                    SetSymbolKind(SymToBeTypifiedMatrix,SURELY_MATRIX);
                                    if (MaxParenIndex > 0)
                                          warning("Edit %s(...) = ...; to %s[...] = ...; in output. Sorry.",
                                                      symtab[SymToBeTypifiedMatrix].s, symtab[SymToBeTypifiedMatrix].s);
                              }
                              MaxParenIndex = 0;
                        }
                        LastWasMatrix = 0;
                   }
      YY_BREAK
case 21:
#line 389 "m2t.l"
{ PutParen(LastWasMatrix ? '[' : '('); QuoteMeansChar++; LastWasMatrix=0; }
      YY_BREAK
case 22:
#line 390 "m2t.l"
{ CloseParen(); QuoteMeansChar=INIT_QUOTEMEANSCHAR; LastWasMatrix=0; }
      YY_BREAK
case 23:
#line 391 "m2t.l"
{ ParenIndex++;
                    ParenStack[ParenIndex-1] = '[';
                    PutString((InLeftHandSide&&ParenIndex==1)?"[":"#(");
                    QuoteMeansChar++;
                    LastWasMatrix = 0;
                  }
      YY_BREAK
case 24:
#line 397 "m2t.l"
{ ParenIndex--;
                    QuoteMeansChar = INIT_QUOTEMEANSCHAR;
                    PutChar((InLeftHandSide&&ParenIndex==0)?']':')');
                    LastWasMatrix = 0;
                  }
      YY_BREAK
case 25:
#line 403 "m2t.l"
{ PutChar('*'); QuoteMeansChar++; LastWasMatrix=0; }
      YY_BREAK
case 26:
#line 404 "m2t.l"
{ PutString("**"); QuoteMeansChar++; LastWasMatrix=0; }
      YY_BREAK
case 27:
#line 405 "m2t.l"
{ PutChar('/'); QuoteMeansChar++; LastWasMatrix=0; }
      YY_BREAK
case 28:
#line 406 "m2t.l"
{ PutChar('/'); if (!NoDivisionWarnings) warning("Matrix division seen"); QuoteMeansChar++; LastWasMatrix=0; }
      YY_BREAK
case 29:
#line 407 "m2t.l"
{ PutChar('^'); QuoteMeansChar++; LastWasMatrix=0; }
      YY_BREAK
case 30:
#line 408 "m2t.l"
{ PutChar('^'); warning("Matrix power seen"); QuoteMeansChar++; LastWasMatrix=0; }
      YY_BREAK
case 31:
#line 409 "m2t.l"
{ PutString(".'"); QuoteMeansChar++; LastWasMatrix=0; }
      YY_BREAK
case 32:
#line 410 "m2t.l"
{ PutString("!="); QuoteMeansChar++; LastWasMatrix=0;}
      YY_BREAK
case 33:
#line 411 "m2t.l"
{ PutString("&&"); QuoteMeansChar++; LastWasMatrix=0;}
      YY_BREAK
case 34:
#line 412 "m2t.l"
{ PutString("||"); QuoteMeansChar++; LastWasMatrix=0;}
      YY_BREAK
case 35:
#line 413 "m2t.l"
{ PutChar('!'); QuoteMeansChar++; LastWasMatrix=0;}
      YY_BREAK
case 36:
#line 414 "m2t.l"
{ PutChar('+'); QuoteMeansChar++; LastWasMatrix=0;}
      YY_BREAK
case 37:
#line 415 "m2t.l"
{ PutChar('-'); QuoteMeansChar++; LastWasMatrix=0;}
      YY_BREAK
case 38:
#line 416 "m2t.l"
{ PutChar(':'); QuoteMeansChar++; LastWasMatrix=0;}
      YY_BREAK
case 39:
#line 417 "m2t.l"
{ if (LastWasRightBracket) PutChar(' '); PutChar('>'); QuoteMeansChar++; LastWasMatrix=0; }
      YY_BREAK
 /* some miscellaneous translations */
case 40:
#line 420 "m2t.l"
{ PutString("hold(on)"); QuoteMeansChar++; LastWasMatrix=0; }
      YY_BREAK
case 41:
#line 421 "m2t.l"
{ PutString("hold(off)"); QuoteMeansChar++; LastWasMatrix=0; }
      YY_BREAK
case 42:
#line 423 "m2t.l"
{
      char *arg1 = strchr(yytext,'(') + 1;
      char *arg2 = strchr(yytext,',') + 1;
      *(arg2-1) = '\0';             /* set null to ',' */
      yytext[yyleng-1] = '\0';      /* set null to ')' */
      PutString("((");
      PutString(arg1);
      PutString(") mod (");
      PutString(arg2);
      PutString("))");
      QuoteMeansChar++;
      LastWasMatrix=0;
}
      YY_BREAK
case 43:
#line 437 "m2t.l"
{
      PutString("ones(");
      PutString(strchr(yytext,',')+1);
      QuoteMeansChar++;
      LastWasMatrix=0;
}
      YY_BREAK
case 44:
#line 444 "m2t.l"
{
      PutString("zeros(");
      PutString(strchr(yytext,',')+1);
      QuoteMeansChar++;
      LastWasMatrix=0;
}
      YY_BREAK
case 45:
#line 451 "m2t.l"
{
      *strrchr(yytext,',') = '\0';  /* set null at the ',' */
      PutString(yytext);
      PutChar(')');
      QuoteMeansChar++;
      LastWasMatrix=0;
}
      YY_BREAK
case 46:
#line 459 "m2t.l"
{
      *strrchr(yytext,',') = '\0';  /* set null at the ',' */
      PutString(yytext);
      PutChar(')');
      QuoteMeansChar++;
      LastWasMatrix=0;
}
      YY_BREAK
case 47:
#line 467 "m2t.l"
{
      yytext[yyleng-1] = '\0';      /* set null at the ')' */
      PutString(yytext);
      PutChar(',');
      PutString(yytext+5);
      PutChar(')');
      QuoteMeansChar++;
      LastWasMatrix=0;
}
      YY_BREAK
case 48:
#line 477 "m2t.l"
{
      yytext[yyleng-1] = '\0';      /* set null at the ')' */
      PutString(yytext);
      PutChar(',');
      PutString(yytext+6);
      PutChar(')');
      QuoteMeansChar++;
      LastWasMatrix=0;
}
      YY_BREAK
 /* Identifiers */
 /* an identifier begins with a letter, the rest can be */
 /* also underscores and digits */
case 49:
#line 490 "m2t.l"
{
      QuoteMeansChar = INIT_QUOTEMEANSCHAR;
      /*fprintf(stderr,"IDENTIFIER %s\n",yytext);*/
      char *s = yytext;
      int i;
      for (i=0; IDtranslations[i].str1; i++)
            if (!strcmp(IDtranslations[i].str1,yytext)) {
                  s = IDtranslations[i].str2;
                  break;
            }
      int IsFunctional = 0;
      for (i=0; FunctionalVariables[i]; i++) {
            if (!strcmp(yytext,FunctionalVariables[i])) {
                  IsFunctional = 1;
                  break;
            }
      }
      PutString(s);
      int symindex=PutSymbol(s);
      if (InLeftHandSide && ParenIndex==0)
            SymToBeTypifiedMatrix = symindex;
      if (symtab[symindex].k == SURELY_MATRIX) LastWasMatrix=1;
      if (IsFunctional) PutString("()");
      IdentifierWasThere = 1;
}
      YY_BREAK
case 50:
#line 516 "m2t.l"
{ if (QuoteMeansChar) {
                  int ch;
                  PutChar('"');
                  for(;;) {
                        ch = input();
                        if (feof(infp)) break;
                        if (ch=='\'') {
                              int ch2 = input();
                              if (ch2=='\'') {
                                    PutString("\\\"");
                                    continue;
                              } else {
                                    unput(ch2);
                                    break;
                              }
                        }
                        if (ch == '"') PutChar('\\');
                        PutChar(ch);
                  }
                  PutChar('"');
              } else PutChar('\'');
            }
      YY_BREAK
case 51:
#line 539 "m2t.l"
PutChar(*yytext);
      YY_BREAK
case 52:
#line 541 "m2t.l"
ECHO;
      YY_BREAK
case YY_STATE_EOF(INITIAL):
    yyterminate();
#line 462 "./../pars/flexskel.cc"

          case YY_END_OF_BUFFER:
            {
            /* amount of text matched not including the EOB char */
            int yy_amount_of_matched_text = yy_cp - yy___text - 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 = yy___text + 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 = yy___text + 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
                  {
/* % code to do backtracking for compressed tables and set up yy_cp goes here */ 
                      yy_cp = yy_last_accepting_cpos;
                      yy_current_state = yy_last_accepting_state;
#line 510 "./../pars/flexskel.cc"
                  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 yy___text,
                       * 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 = yy___text + 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 = yy___text + yy_amount_of_matched_text;

                  yy_current_state = yy_get_previous_state();

                  yy_cp = yy_c_buf_p;
                  yy_bp = yy___text + 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 = yy___text + YY_MORE_ADJ;
                  goto yy_find_action;
                }
            break;
            }

          default:
#if YY_Tm2tlex_DEBUG != 0
            fprintf(stderr, "action # %d\n", yy_act );
#endif
            YY_FATAL_ERROR(
                  "fatal flex scanner internal error--no action found" );
          }
      }
      yyterminate();/* avoid the no return value error message on MS-C7/dos */
    }


/* 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
 */
#ifndef YY_USE_CLASS
static int yy_get_next_buffer()
#else
int YY_Tm2tlex_CLASS::yy_get_next_buffer()
#endif
    {
    register YY_Tm2tlex_CHAR *dest = yy_current_buffer->yy_ch_buf;
    register YY_Tm2tlex_CHAR *source = yy___text - 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 - yy___text;

    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 - YY_MORE_ADJ == 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;

    /* yy___text 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
     */

    yy___text = &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();
 */

#ifndef YY_USE_CLASS
static yy_state_type yy_get_previous_state()
#else
long YY_Tm2tlex_CLASS::yy_get_previous_state_()
#endif
    {
    register yy_state_type yy_current_state;
    register YY_Tm2tlex_CHAR *yy_cp;

/* % code to get the start state into yy_current_state goes here */ 
    yy_current_state = yy_start;
#line 682 "./../pars/flexskel.cc"

    for ( yy_cp = yy___text + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
      {
/* % code to find the next state goes here */ 
      register YY_CHAR yy_c = (*yy_cp ? yy_ec[*yy_cp] : 1);
      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 >= 149 )
            yy_c = yy_meta[yy_c];
          }
      yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
#line 686 "./../pars/flexskel.cc"
      }

#ifndef YY_USE_CLASS
    return ( yy_current_state );
#else
    return (long)( yy_current_state );
#endif
    }


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

#ifndef YY_USE_CLASS
#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
#else
long YY_Tm2tlex_CLASS::yy_try_NUL_trans_(long yy_current_state_)
#endif

    {
#ifndef YY_USE_CLASS
#else
    yy_state_type yy_current_state=(yy_state_type)yy_current_state_;
#endif
    register int yy_is_jam;
/* % code to find the next state, and perhaps do backtracking, goes here */ 
    register YY_CHAR *yy_cp = yy_c_buf_p;

    register YY_CHAR yy_c = 1;
    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 >= 149 )
          yy_c = yy_meta[yy_c];
      }
    yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
    yy_is_jam = (yy_current_state == 148);
#line 720 "./../pars/flexskel.cc"

#ifndef YY_USE_CLASS
    return ( yy_is_jam ? 0 : yy_current_state );
#else
    return (long)( yy_is_jam ? 0 : yy_current_state );
#endif
    }

#ifndef YY_USE_CLASS
#ifdef YY_USE_PROTOS
static void yyunput( YY_Tm2tlex_CHAR c, register YY_Tm2tlex_CHAR *yy_bp )
#else
static void yyunput( c, yy_bp )
YY_Tm2tlex_CHAR c;
register YY_Tm2tlex_CHAR *yy_bp;
#endif
#else
void YY_Tm2tlex_CLASS::yyunput( YY_Tm2tlex_CHAR c, YY_Tm2tlex_CHAR *yy_bp )
#endif

    {
    register YY_Tm2tlex_CHAR *yy_cp = yy_c_buf_p;

    /* undo effects of setting up yy___text */
    *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_Tm2tlex_CHAR *dest =
          &yy_current_buffer->yy_ch_buf[yy_current_buffer->yy_buf_size + 2];
      register YY_Tm2tlex_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 yy___text again */
    }

#ifndef YY_USE_CLASS
#ifdef __cplusplus
static int yyinput()
#else
static int input()
#endif
#else
int YY_Tm2tlex_CLASS::input()
#endif
    {
    int c;
    YY_Tm2tlex_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 */
          yy___text = 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 = yy___text + YY_MORE_ADJ;
                  return ( EOF );
                  }

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

            case EOB_ACT_CONTINUE_SCAN:
                yy_c_buf_p = yy___text + YY_MORE_ADJ;
                break;

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

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

    return ( c );
    }


#ifndef YY_USE_CLASS
#ifdef YY_USE_PROTOS
void YY_Tm2tlex_RESTART( FILE *input_file )
#else
void YY_Tm2tlex_RESTART( input_file )
FILE *input_file;
#endif
#else
void YY_Tm2tlex_CLASS::YY_Tm2tlex_RESTART ( FILE *input_file )
#endif

    {
    YY_Tm2tlex_INIT_BUFFER( yy_current_buffer, input_file );
    YY_Tm2tlex_LOAD_BUFFER_STATE();
    }


#ifndef YY_USE_CLASS
#ifdef YY_USE_PROTOS
void YY_Tm2tlex_SWITCH_TO_BUFFER( YY_BUFFER_STATE new_buffer )
#else
void YY_Tm2tlex_SWITCH_TO_BUFFER( new_buffer )
YY_BUFFER_STATE new_buffer;
#endif
#else
void YY_Tm2tlex_CLASS::YY_Tm2tlex_SWITCH_TO_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_Tm2tlex_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;
    }


#ifndef YY_USE_CLASS
#ifdef YY_USE_PROTOS
void YY_Tm2tlex_LOAD_BUFFER_STATE( void )
#else
void YY_Tm2tlex_LOAD_BUFFER_STATE()
#endif
#else
void YY_Tm2tlex_CLASS::YY_Tm2tlex_LOAD_BUFFER_STATE(  )
#endif

    {
    yy_n_chars = yy_current_buffer->yy_n_chars;
    yy___text = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
    yy___in = yy_current_buffer->yy_input_file;
    yy_hold_char = *yy_c_buf_p;
    }


#ifndef YY_USE_CLASS
#ifdef YY_USE_PROTOS
YY_BUFFER_STATE YY_Tm2tlex_CREATE_BUFFER( FILE *file, int size )
#else
YY_BUFFER_STATE YY_Tm2tlex_CREATE_BUFFER( file, size )
FILE *file;
int size;
#endif
#else
YY_BUFFER_STATE YY_Tm2tlex_CLASS::YY_Tm2tlex_CREATE_BUFFER( 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_Tm2tlex_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_Tm2tlex_CHAR *) malloc( (unsigned) (b->yy_buf_size + 2) );

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

    YY_Tm2tlex_INIT_BUFFER( b, file );

    return ( b );
    }


#ifndef YY_USE_CLASS
#ifdef YY_USE_PROTOS
void YY_Tm2tlex_DELETE_BUFFER( YY_BUFFER_STATE b )
#else
void YY_Tm2tlex_DELETE_BUFFER( b )
YY_BUFFER_STATE b;
#endif
#else
void YY_Tm2tlex_CLASS::YY_Tm2tlex_DELETE_BUFFER( 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 );
    }


#ifndef YY_USE_CLASS
#ifdef YY_USE_PROTOS
void YY_Tm2tlex_INIT_BUFFER( YY_BUFFER_STATE b, FILE *file )
#else
void YY_Tm2tlex_INIT_BUFFER( b, file )
YY_BUFFER_STATE b;
FILE *file;
#endif
#else
void YY_Tm2tlex_CLASS::YY_Tm2tlex_INIT_BUFFER( 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 541 "m2t.l"


static void warning(const char *str) {
      if (SilentMode) return;
      fprintf(stderr,"line %d warning: %s\n",lineno,str);
}

static void warning(const char *str, const char *str1) {
      if (SilentMode) return;
      fprintf(stderr,"line %d warning: ",lineno);
      fprintf(stderr,str,str1);
      fprintf(stderr,"\n");
}

static void warning(const char *str, const char *str1, const char *str2) {
      if (SilentMode) return;
      fprintf(stderr,"line %d warning: ",lineno);
      fprintf(stderr,str,str1,str2);
      fprintf(stderr,"\n");
}

static void Basename(char *s) {
      char *SlashPos = strrchr(s,'/');
      if (SlashPos) {
            int L = strlen(SlashPos);
            memmove(s,SlashPos+1,L+1);
      }
      char *DotPos = strrchr(s,'.');
      if (DotPos) *DotPos = '\0';
}

static void PutArgumentSymbolsToSymbolTable(const char *s, const char *fname) {
      char token[256];
      int t=0;
      for (int i=0; s[i]; i++) {
            if (isalnum(s[i]))
                  token[t++] = s[i];
            else if (t>0) {
                  token[t] = '\0';
                  if (strcmp(token,"function")!=0) {
                        PutSymbol(token,strcmp(fname,token) ? SURELY_MATRIX : SURELY_FUNCTION);
                  }
                  t = 0;
            }
      }
}

static void GiveHelp() {
      printf("m2t - Matlab to Tela translator.\n");
      printf(" -> Warnings: Use at your own risk. You must almost always do some hand\n");
      printf("    editing afterwards. This program is provided to make transition to\n");
      printf("    Tela easier, not to 'emulate' Matlab.\n");
    printf(" -> It may be possible to violate the law by translating copyrighted Matlab\n");
      printf("    code to Tela. The author of this program does not take any responsibility\n");
      printf("    for that kind of problems, and you as a user must find out under what\n");
      printf("    conditions you can use this program.\n");
      printf("Usage: m2t [-h?]                        (give help)\n");
      printf("   or: m2t [-sdv] <file.m >file.t       (basic usage)\n");
      printf("   or: m2t [-FSmsvd] [files.m] >file.t  (many files at once)\n");
      printf("Options:\n");
      printf("    -F        Ignore script files (Functions only)\n");
      printf("    -S        Ignore function files (Scripts only)\n");
      printf("    -m        Multi-file mode: generate .t files using .m file basenames\n");
      printf("    -s        Silent mode, suppress all warnings\n");
      printf("    -v        Verbose mode\n");
      printf("    -d        Suppress matrix division warnings\n");
      printf("    -h, -?    Produce this message\n");
      printf("Examples:\n");
      printf("    m2t -F *.m >funcs.t    Compile all function files into \"funcs.t\"\n");
      printf("    m2t -Sm *.m            Compile all scripts in separate t-files\n");
      exit(0);
}

static void ParseArgs(int argc, char *argv[], int& arg)
// Recognizes options -F -S -m -s -v -d -h -?
{
      for (; arg<argc && argv[arg][0]=='-'; arg++) {
            for (int i=1; argv[arg][i]; i++) {
                  int ch = argv[arg][i];
                  if (ch == 'F') {
                        IgnoreScripts = 1; IgnoreFunctions = 0;
                  } else if (ch == 'S') {
                        IgnoreFunctions = 1; IgnoreScripts = 0;
                  } else if (ch == 'm') {
                        MultiFileMode = 1;
                  } else if (ch == 's') {
                        SilentMode = 1;
                        VerboseMode = 0;
                  } else if (ch == 'v') {
                        VerboseMode = 1;
                        SilentMode = 0;
                  } else if (ch == 'd')
                        NoDivisionWarnings = 1;
                  else if (ch == 'h' || ch == '?')
                        GiveHelp();
            }
      }
}

static int IsCommentLine(const char *s) {
      for (int i=0; s[i]; i++) {
            if (s[i] == '%') return 1;
            if (!isspace(s[i])) return 0;
      }
      return 1;
}

static int FirstIsFunction(char *s) {
      static const char Function[] = "function";
      const int L0 = strlen(Function);
      int i;
      for (i=0; s[i] && isspace(s[i]); i++);
      int ch = s[i+L0];
      if (!isspace(ch)) return 0;
      s[i+L0] = '\0';
      int result = !strcmp(s+i,Function);
      s[i+L0] = ch;
      return result;
}

static void GenerateTFileName(char tfile[FILENAME_MAX], const char fn[]) {
      int L = strlen(fn);
      strcpy(tfile,fn);
      if (fn[L-1] == 'm' && fn[L-2] == '.') {
            tfile[L-1] = 't';
      } else
            strcat(tfile,".t");
}

int main(int argc, char *argv[])
{
#     define maxlinebuff 512
      fp = stdout;
      infp = stdin;
      int Arg = 1;
      ParseArgs(argc,argv,Arg);
      if (argc <= Arg) {
            Tm2tlex a;
            ClearSymbolTable();
            a.yylex();
            if (VerboseMode) OutputSymbolTable(stderr,"standard input");
      } else {
            int arg;
            for (arg=Arg; arg<argc; arg++) {
                  lineno = 1;
                  char tfile[FILENAME_MAX];
                  if (MultiFileMode) {
                        GenerateTFileName(tfile,argv[arg]);
                        fp = fopen(tfile,"w");
                        if (!fp) {
                              fprintf(stderr,"*** Could not open '%s', using stdout\n",tfile);
                              fp = stdout;
                        }
                  }
                  Tm2tlex a;
                  YY_BUFFER_STATE bufstate;
                  int L;
                  char linebuff[maxlinebuff+1];
                  infp = fopen(argv[arg],"r");
                  if (!infp) {fprintf(stderr,"warning: could not open '%s'\n",argv[arg]); continue;}
                  for (;;) {
                        fgets(linebuff,maxlinebuff,infp);
                        lineno++;
                        if (!IsCommentLine(linebuff)) break;
                        for (int i=0; linebuff[i]; i++)
                              if (linebuff[i] == '%')
                                    fputs("//",fp);
                              else
                                    fputc(linebuff[i],fp);
                  }
                  L = strlen(linebuff);
                  if (linebuff[L-1]=='\n') linebuff[--L]='\0';
                  if (linebuff[L-1]==';') linebuff[--L]='\0';
                  a.yyin = infp;
                  if (FirstIsFunction(linebuff)) {
                        if (IgnoreFunctions) {
                              fprintf(stderr,"Ignoring FUNCTION file '%s' (-S option)\n",argv[arg]);
                        } else {
                              fprintf(stderr,"Processing FUNCTION file '%s' ...\n",argv[arg]);
                              ClearSymbolTable();
                              char *fname = strdup(argv[arg]);
                              Basename(fname);
                              PutArgumentSymbolsToSymbolTable(linebuff,fname);
                              free(fname);
                              fprintf(fp,"\n\n");
                              fputs(linebuff,fp);
                              fprintf(fp," {\n");
                              a.yylex();
                              fprintf(fp,"\n};\n");
                              if (VerboseMode) OutputSymbolTable(stderr,argv[arg]);
                        }
                  } else {
                        if (IgnoreScripts) {
                              fprintf(stderr,"Ignoring SCRIPT file '%s' (-F option)\n",argv[arg]);
                        } else {
                              rewind(infp);
                              fprintf(stderr,"Processing SCRIPT file '%s' ...\n",argv[arg]);
                              ClearSymbolTable();
                              a.yylex();
                              if (VerboseMode) OutputSymbolTable(stderr,argv[arg]);
                        }
                  }
                  fclose(infp);
                  if (MultiFileMode && fp!=stdout) {
                        if (ftell(fp)==0) {
                              fclose(fp);
                              remove(tfile);
                        } else
                              fclose(fp);
                  }
            }
      }
      return 0;
}

Generated by  Doxygen 1.6.0   Back to index