Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 2 | mjames | 1 | %{ |
| 2 | /* |
||
| 3 | * $Header: c:\\cygwin\\cvsroot/Vert03/eagle_src/eagle_lex.l,v 1.1.1.1 2003/11/04 23:34:56 mjames Exp $ |
||
| 4 | * |
||
| 5 | * $Log: eagle_lex.l,v $ |
||
| 6 | * Revision 1.1.1.1 2003/11/04 23:34:56 mjames |
||
| 7 | * Imported into local repositrory |
||
| 8 | * |
||
| 9 | * Revision 1.1 2002/12/04 22:28:28 mjames |
||
| 10 | * Initial release Eagle PCB reader |
||
| 11 | * |
||
| 12 | * |
||
| 13 | * */ |
||
| 14 | #include <stdio.h> |
||
| 15 | #if defined HAS_TCL |
||
| 16 | #include "tcl_l.h" |
||
| 17 | #endif |
||
| 18 | #include "expression.h" |
||
| 19 | #include "generic.h" |
||
| 20 | #include "database.h" |
||
| 21 | |||
| 22 | /* see makefile for why */ |
||
| 23 | #include "protel_yacc.h" |
||
| 24 | #include "lx_support.h" |
||
| 25 | |||
| 26 | #define YYLMAX MAXIDLEN |
||
| 27 | |||
| 28 | #ident "@(#)$Header: c:\\cygwin\\cvsroot/Vert03/protel_src/protel_lex.l,v 1.1.1.1 2003/11/04 23:34:56 mjames Exp $" |
||
| 29 | |||
| 30 | extern int yyval; |
||
| 31 | |||
| 32 | extern int yydebug; |
||
| 33 | |||
| 34 | |||
| 35 | extern int lineno; |
||
| 36 | %} |
||
| 37 | %option debug |
||
| 7 | mjames | 38 | %option noyywrap |
| 2 | mjames | 39 | |
| 40 | %s component |
||
| 41 | %s netlist |
||
| 42 | |||
| 43 | |||
| 44 | |||
| 45 | L2 [A-Za-z0-9_/\~\*\+\$] |
||
| 46 | L3 [A-Za-z0-9_/\~\-\*\+\$ \.]* |
||
| 47 | L4 [A-Za-z0-9_/\~\*\+\$ \.\\\?]* |
||
| 48 | |||
| 49 | S [^\"] |
||
| 50 | Q [\"] |
||
| 51 | |||
| 52 | Spc [ \t]+ |
||
| 53 | |||
| 54 | D [0-9\.] |
||
| 55 | |||
| 56 | %% |
||
| 57 | |||
| 58 | {Q}{S}*{Q} { yylval.string = make_string(yytext,&lx_first,&lx_last) ; /* do it anyway */ |
||
| 59 | if(yydebug) fprintf(stderr,"String (%s)\n",yylval.string); return(ASTRING); }; |
||
| 60 | |||
| 61 | <component>{L2}{L3} { yylval.string = make_string(yytext,&lx_first,&lx_last) ; /* do it anyway */ |
||
| 62 | if(yydebug) fprintf(stderr,"String (%s)\n",yylval.string); return(ASTRING); }; |
||
| 63 | |||
| 64 | <netlist>{L2}{L4} { yylval.string = make_string(yytext,&lx_first,&lx_last) ; /* do it anyway */ |
||
| 65 | if(yydebug) fprintf(stderr,"String (%s)\n",yylval.string); return(ASTRING); }; |
||
| 66 | |||
| 67 | <INITIAL>"PROTEL" { fprintf(stderr,"PROTEL seen!!\n"); lineno++; return (PROTEL); }; |
||
| 68 | |||
| 69 | <INITIAL>"NETLIST" { fprintf(stderr,"Netlist seen!!\n");lineno++; return (NETLIST); }; |
||
| 70 | |||
| 71 | <INITIAL>{D}+ { fprintf (stderr,"VERSION seen!!\n",lineno++; return (VERSION); }; |
||
| 72 | |||
| 73 | |||
| 74 | {Spc} { fprintf(stderr,"space\n"); return (SPC); /* white space */ }; |
||
| 75 | "\r" | "\n" { lineno++; return(NL); }; |
||
| 76 | |||
| 77 | |||
| 78 | "\[" { BEGIN(component); return (LBRK); }; |
||
| 79 | "\]" { return (RBRK); }; |
||
| 80 | "\(" { BEGIN(netlist) ; return (LB2); }; |
||
| 81 | "\)" { return (RB2); }; |
||
| 82 | "\*" { return (ASTERISK); }; |
||
| 83 | <netlist>"-" { return(MINUS); }; |
||
| 84 | |||
| 85 | . {fprintf( stderr, "Unmatched: %d\n", *yytext); break; }; |
||
| 86 | |||
| 87 | %% |