Subversion Repositories Vertical

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

%{
/*
 * $Header: c:\\cygwin\\cvsroot/Vert03/eagle_src/eagle_lex.l,v 1.1.1.1 2003/11/04 23:34:56 mjames Exp $
 *
 * $Log: eagle_lex.l,v $
 * Revision 1.1.1.1  2003/11/04 23:34:56  mjames
 * Imported into local repositrory
 *
 * Revision 1.1  2002/12/04 22:28:28  mjames
 * Initial release Eagle PCB reader
 *
 *
 *  */
#include <stdio.h>
#if defined HAS_TCL
#include "tcl_l.h"
#endif
#include "expression.h"
#include "generic.h"
#include "database.h"

/* see makefile for why */
#include "protel_yacc.h"
#include "lx_support.h"

#define YYLMAX MAXIDLEN

#ident "@(#)$Header: c:\\cygwin\\cvsroot/Vert03/protel_src/protel_lex.l,v 1.1.1.1 2003/11/04 23:34:56 mjames Exp $"

extern  int yyval;

extern int yydebug;


extern int lineno;
%}
%option debug
$option noyywrap 

%s component
%s netlist



L2 [A-Za-z0-9_/\~\*\+\$]
L3 [A-Za-z0-9_/\~\-\*\+\$ \.]*
L4 [A-Za-z0-9_/\~\*\+\$ \.\\\?]*

S [^\"]
Q [\"]

Spc [ \t]+

D [0-9\.]

%% 

{Q}{S}*{Q}        {  yylval.string = make_string(yytext,&lx_first,&lx_last) ; /* do it anyway */
                           if(yydebug) fprintf(stderr,"String (%s)\n",yylval.string);  return(ASTRING); };

<component>{L2}{L3}      { yylval.string = make_string(yytext,&lx_first,&lx_last) ; /* do it anyway */
                           if(yydebug) fprintf(stderr,"String (%s)\n",yylval.string); return(ASTRING); };

<netlist>{L2}{L4}        { yylval.string = make_string(yytext,&lx_first,&lx_last) ; /* do it anyway */
                           if(yydebug) fprintf(stderr,"String (%s)\n",yylval.string); return(ASTRING); };
                                                   
<INITIAL>"PROTEL"                   { fprintf(stderr,"PROTEL seen!!\n"); lineno++; return (PROTEL); };

<INITIAL>"NETLIST"                  { fprintf(stderr,"Netlist seen!!\n");lineno++; return (NETLIST); }; 

<INITIAL>{D}+                         { fprintf (stderr,"VERSION seen!!\n",lineno++;  return (VERSION); }; 
                                                   

{Spc}            { fprintf(stderr,"space\n"); return (SPC); /* white space */ };
"\r" | "\n"              { lineno++; return(NL); };


"\["              { BEGIN(component); return (LBRK); };
"\]"              { return (RBRK); };
"\("              { BEGIN(netlist) ; return (LB2); };
"\)"              { return (RB2); };
"\*"              { return (ASTERISK); }; 
<netlist>"-"      { return(MINUS); };

. {fprintf( stderr, "Unmatched: %d\n", *yytext); break; };

%%