Rev 7 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 7 | Rev 11 | ||
|---|---|---|---|
| Line 23... | Line 23... | ||
| 23 | #include "protel_yacc.h" |
23 | #include "protel_yacc.h" |
| 24 | #include "lx_support.h" |
24 | #include "lx_support.h" |
| 25 | 25 | ||
| 26 | #define YYLMAX MAXIDLEN |
26 | #define YYLMAX MAXIDLEN |
| 27 | 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 $" |
28 | #ident "@(#)$Header: c:\\cygwin\\cvsroot/Vert03/eagle_src/eagle_lex.l,v 1.1.1.1 2003/11/04 23:34:56 mjames Exp $" |
| 29 | 29 | ||
| 30 | extern int yyval; |
30 | extern int yyval; |
| 31 | 31 | ||
| 32 | extern int yydebug; |
32 | extern int yydebug; |
| 33 | 33 | ||
| 34 | 34 | ||
| 35 | extern int lineno; |
35 | extern int lineno; |
| 36 | %} |
36 | %} |
| 37 | %option debug |
- | |
| 38 | %option noyywrap |
- | |
| 39 | - | ||
| 40 | %s component |
37 | %s component |
| 41 | %s netlist |
38 | %s netlist |
| 42 | 39 | ||
| 43 | 40 | ||
| 44 | - | ||
| 45 | L2 [A-Za-z0-9_/\~\*\+\$] |
41 | L2 [A-Za-z0-9_/\~\*\+\$] |
| 46 | L3 [A-Za-z0-9_/\~\-\*\+\$ \.]* |
42 | L3 [A-Za-z0-9_/\~\-\*\+\$ \.] |
| 47 | L4 [A-Za-z0-9_/\~\*\+\$ \.\\\?]* |
43 | L4 [A-Za-z0-9_/\~\*\+\$ \.\\\?] |
| 48 | 44 | ||
| 49 | S [^\"] |
45 | S [^\"] |
| 50 | Q [\"] |
46 | Q [\"] |
| 51 | 47 | ||
| 52 | Spc [ \t]+ |
48 | Spc [ \t] |
| 53 | - | ||
| 54 | D [0-9\.] |
- | |
| 55 | 49 | ||
| 56 | %% |
50 | %% |
| 57 | 51 | ||
| 58 | {Q}{S}*{Q} { yylval.string = make_string(yytext,&lx_first,&lx_last) ; /* do it anyway */ |
52 | {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); }; |
53 | if(yydebug) fprintf(stderr,"String (%s)\n",yylval.string); return(ASTRING); }; |
| 60 | 54 | ||
| 61 | <component>{L2}{L3} { yylval.string = make_string(yytext,&lx_first,&lx_last) ; /* do it anyway */ |
55 | <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); }; |
56 | if(yydebug) fprintf(stderr,"String (%s)\n",yylval.string); return(ASTRING); }; |
| 63 | 57 | ||
| 64 | <netlist>{L2}{L4} { yylval.string = make_string(yytext,&lx_first,&lx_last) ; /* do it anyway */ |
58 | <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); }; |
59 | 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 | 60 | ||
| - | 61 | {Spc}+ { return (SPC); /* white space */ }; |
|
| - | 62 | "\n" { lineno++; return(NL); }; |
|
| 78 | "\[" { BEGIN(component); return (LBRK); }; |
63 | "\[" { BEGIN(component); return (LBRK); }; |
| 79 | "\]" { return (RBRK); }; |
64 | "\]" { return (RBRK); }; |
| 80 | "\(" { BEGIN(netlist) ; return (LB2); }; |
65 | "\(" { BEGIN(netlist) ; return (LB2); }; |
| 81 | "\)" { return (RB2); }; |
66 | "\)" { return (RB2); }; |
| 82 | "\*" { return (ASTERISK); }; |
- | |
| 83 | <netlist>"-" { return(MINUS); }; |
67 | <netlist>"-" { return(MINUS); }; |
| 84 | 68 | ||
| 85 | . {fprintf( stderr, "Unmatched: %d\n", *yytext); break; }; |
- | |
| 86 | - | ||
| 87 | %% |
69 | %% |