Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 2 | mjames | 1 | %{ |
| 2 | /* |
||
| 3 | * $Id: eagle_yacc.y,v 1.1.1.1 2003/11/04 23:34:56 mjames Exp $ |
||
| 4 | * |
||
| 5 | * $Log: eagle_yacc.y,v $ |
||
| 6 | * |
||
| 7 | * */ |
||
| 8 | |||
| 9 | |||
| 10 | |||
| 11 | |||
| 12 | #include <stdio.h> |
||
| 13 | #include <stdlib.h> |
||
| 14 | #include <string.h> |
||
| 15 | #include "expression.h" |
||
| 16 | #include "generic.h" |
||
| 17 | #include "database.h" |
||
| 18 | |||
| 19 | |||
| 11 | mjames | 20 | #ident "@(#)$Header: C:/cvsroot/Vert03/eagle_src/eagle_yacc.y,v 1.1.1.1 2003/11/04 23:34:56 mjames Exp $" |
| 2 | mjames | 21 | |
| 22 | |||
| 23 | static char text_buff[1024]; |
||
| 24 | |||
| 25 | static socket_t * current_chip; |
||
| 26 | static char curr_net_nam[MAXIDLEN]; |
||
| 27 | |||
| 28 | %} |
||
| 29 | %union { char * string; } |
||
| 11 | mjames | 30 | %token SPC NL LBRK RBRK LB2 RB2 MINUS |
| 2 | mjames | 31 | %token <string> ASTRING |
| 32 | |||
| 33 | %% |
||
| 11 | mjames | 34 | protelfile : objects; |
| 2 | mjames | 35 | |
| 36 | |||
| 37 | objects : objects object |
||
| 38 | | object |
||
| 11 | mjames | 39 | ; |
| 2 | mjames | 40 | |
| 41 | |||
| 42 | object : component_obj |
||
| 43 | | net_obj |
||
| 44 | |||
| 45 | |||
| 46 | |||
| 11 | mjames | 47 | component_obj : LBRK NL comp_ident NL comp_value NL comp_type NL skip_line skip_line skip_line RBRK NL { free_lex_strings(); }; |
| 2 | mjames | 48 | |
| 49 | |||
| 50 | comp_ident: ASTRING {current_chip = find_socket(Ident,$1,Create,&socket_head); }; |
||
| 51 | |||
| 52 | comp_type : ASTRING { |
||
| 53 | set_socket(current_chip,Type,$1) ; /* same type as Ident so can pick up later */ }; |
||
| 54 | |||
| 55 | comp_value : ASTRING { |
||
| 56 | set_socket(current_chip,Value,$1); }; |
||
| 57 | |||
| 58 | |||
| 59 | net_obj : LB2 NL net_ident NL pin_list RB2 NL; |
||
| 60 | |||
| 61 | |||
| 62 | pin_list : pin_list socket_pin |
||
| 63 | | socket_pin |
||
| 64 | | /* Moths */ |
||
| 65 | ; |
||
| 66 | |||
| 67 | net_ident : ASTRING { strcpy(curr_net_nam,$1); free_lex_strings(); } |
||
| 68 | | ASTRING MINUS ASTRING { sprintf(curr_net_nam,"%s-%s",$1,$3); }; |
||
| 69 | |||
| 70 | |||
| 71 | |||
| 72 | skip_line : NL |
||
| 73 | | SPC NL |
||
| 74 | ; |
||
| 75 | |||
| 76 | |||
| 77 | socket_pin : socket_ident MINUS ASTRING NL { define_pin(&routed_list, |
||
| 78 | current_chip, |
||
| 79 | curr_net_nam,BIDIR,0,$3, |
||
| 80 | default_vhdl_datatype,NULL); }; |
||
| 81 | |||
| 82 | |||
| 83 | socket_ident: ASTRING { current_chip = find_socket(Ident,$1,Create,&socket_head); |
||
| 84 | set_socket(current_chip,Type,$1) ; /* same type as Ident so can pick up later */ |
||
| 85 | }; |
||
| 86 | |||
| 87 | |||
| 88 | %% |
||
| 89 | |||
| 90 | /* defining lineno here */ |
||
| 91 | |||
| 92 | int lineno; |
||
| 93 | extern char * yytext; |
||
| 94 | |||
| 95 | int yyerror(char * x) |
||
| 96 | { |
||
| 97 | int token; |
||
| 98 | printf("-- Error --> %s near string (%s) at line %d\n",x,yytext,lineno); |
||
| 99 | /* for(token = yylex();token >= 0 && token!=NL;token = yylex()); */ |
||
| 100 | return 1; |
||
| 101 | } |
||
| 102 | |||
| 103 | int yywrap(void) |
||
| 104 | { |
||
| 105 | return 1; |
||
| 106 | } |
||
| 107 | |||
| 108 | |||
| 109 |