Subversion Repositories Vertical

Rev

Details | 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
 
20
#ident "@(#)$Header: C:/cvsroot/Vert03/protel_src/protel_yacc.y,v 1.1.1.1 2003/11/04 23:34:56 mjames Exp $"
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; }
30
%token SPC NL LBRK RBRK LB2 RB2 MINUS ASTERISK
31
%token PROTEL NETLIST VERSION
32
%token <string> ASTRING
33
 
34
%start version
35
%%
36
protelfile : version objects;
37
 
38
version : PROTEL SPC NETLIST  SPC VERSION NL; 
39
 
40
objects   : objects object
41
          | object
42
		  ;
43
 
44
 
45
object    : component_obj
46
          | net_obj
47
		  | /*empty */
48
		  ;
49
 
50
 
51
 
52
component_obj : LBRK ASTRING NL comp_ident NL  ASTRING NL  comp_value  NL ASTRING NL comp_type NL skip_lines ASTERISK NL RBRK NL { free_lex_strings(); };
53
 
54
 
55
comp_ident:  ASTRING {current_chip = find_socket(Ident,$1,Create,&socket_head); };
56
 
57
comp_type :  ASTRING {
58
                set_socket(current_chip,Type,$1) ; /* same type as Ident so can pick up later */ };
59
 
60
comp_value : ASTRING { 
61
                set_socket(current_chip,Value,$1); };
62
 
63
 
64
net_obj   : LB2 NL net_ident NL pin_list RB2 NL;
65
 
66
 
67
pin_list  : pin_list socket_pin 
68
          | socket_pin
69
          | /* Moths */
70
          ;
71
 
72
net_ident : ASTRING { strcpy(curr_net_nam,$1); free_lex_strings(); }
73
          | ASTRING MINUS ASTRING { sprintf(curr_net_nam,"%s-%s",$1,$3); };
74
 
75
 
76
 
77
skip_line : NL
78
          | SPC NL
79
          ;
80
 
81
skip_lines: skip_lines skip_line
82
           | skip_line
83
           | /* Nothing */
84
           ;
85
 
86
 
87
 
88
 
89
socket_pin : socket_ident MINUS ASTRING NL { define_pin(&routed_list,
90
                              current_chip,
91
                              curr_net_nam,BIDIR,0,$3,
92
                              default_vhdl_datatype,NULL); };
93
 
94
 
95
socket_ident:  ASTRING { current_chip = find_socket(Ident,$1,Create,&socket_head);
96
          set_socket(current_chip,Type,$1) ; /* same type as Ident so can pick up later */
97
   };
98
 
99
 
100
%%
101
 
102
/* defining lineno here */
103
 
104
int lineno;
105
extern char * yytext;
106
 
107
int yyerror(char * x)
108
  {
109
  int token;
110
  printf("-- Error --> %s near string (%s) at line %d\n",x,yytext,lineno);
111
/*  for(token = yylex();token >= 0 && token!=NL;token = yylex()); */
112
  return 1;
113
  }
114
 
115
int yywrap(void)
116
  {
117
  return 1;
118
  }
119
 
120
 
121