%{
/* $Id: gisel.l 2.4 1995/07/20 11:24:33 leon Exp leon $
 *
 *      GISEL - G-CODE ISEL CNC driver
 *
 *      Copyright (c) 1994 LECAD
 *      All Rights Reserved.
 *
 */

#undef yywrap


#ifdef __BORLANDC__

#   pragma warn -pro

#   pragma warn -rch

#   pragma warn -ccc

#   include <process.h>

#   include <dos.h>

#   include "parse.h"

#   include "y_tab.h"

#else

#   include <stdlib.h>

#   include "parse.h"

#   include "gisel.tab.h"

#endif

#include <string.h>

#include <stdio.h>



long int lineno = 1;

char linebuf[200];

#undef ECHO

#define ECHO 


%}


comment [#%].*
uint    [0-9]+
fval    -?(([0-9]+)|([0-9]*\.[0-9]+)([eE][-+]?[0-9]+)?)

%%

[\t ,;]+ ; /* ignore whitespace */


\n.*	{ strcpy(linebuf, yytext + 1); 
          lineno++; 
          yyless(1); 
          return NL; 
        }

{comment}               ; /* ignore comments */
\([A-Za-z\t 0-9]*\)     ; /* ignore comments */
\/.*\n                  ; /* ignore line DIN 66 025 1/4.7 */


G{uint}[A-Z]? { return GCODE;  }

M{uint}	      { return MCODE;   }

N{uint}       { return LINENUMBER; }


X{fval} { return X; }
Y{fval} { return Y; }
Z{fval} { return Z; }
U{fval} { return U; }
V{fval} { return V; }
W{fval} { return W; }
P{fval} { return P; }
Q{fval} { return Q; }
R{fval} { return R; }
I{fval} { return I; }
J{fval} { return J; }
K{fval} { return K; }
F{fval} { return F; }
S{fval} { return S; }
T{uint} { return T; }
A{fval} { return A; }
B{fval} { return B; }
C{fval} { return C; }
L{fval} { return L; }

{fval}  { return NUMBER; }
XYZ     { return ORIENTATION;  }
[A-Za-z][0-9A-Za-z]*	{ return NAME; }



%%

int yywrap(void)
{
   return 1;
}



syntax highlighted by Code2HTML, v. 0.9.1