Subversion Repositories Vertical

Rev

Rev 2 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

%{
/* $Id: orcad_yacc.y,v 1.1.1.1 2003/11/04 23:34:58 mjames Exp $ 
 *
 * $Log: orcad_yacc.y,v $
 * Revision 1.1.1.1  2003/11/04 23:34:58  mjames
 * Imported into local repositrory
 *
 * Revision 1.4  2002/10/02 19:37:28  MJAMES
 * Moved dummy functions to a separate support file.
 *
 * Used correct number of arguments to define_pin
 *
 * Revision 1.3  2002/09/09 10:16:43  mjames
 * Modified expression parser to match CC as previous one was
 * broken
 *
 * Revision 1.2  2001/10/31 22:20:10  mjames
 * Tidying up problematical comments caused by CVS
 * 'intelligent' comment guessing
 *
 * Revision 1.1  2001/10/23 21:11:38  mjames
 * Added in an Orcad reader into Vertical
 *
 *
 *
 *  */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "expression.h"
#include "generic.h"
#include "database.h"


static char IDstr[] = "@(#)$Header: C:/cvsroot/Vert03/orcad_src/orcad_yacc.y,v 1.1.1.1 2003/11/04 23:34:58 mjames Exp $";


static socket_t * current_chip;
static char curr_net_nam[MAXIDLEN];
int inside_block;
%}
%union { char * string; }
%token SPACE  LF CR
%token <string> ASTRING

%%

file : objects;


objects   : objects net
          | net
          ;


net       : net_name pin_lines space_endline
          | net_name space_endline
          | space_endline;

net_name  : ASTRING space_endline { strcpy(curr_net_nam,$1); };


pin_lines : pin_lines pin_line
          | pin_line
          ;

pin_line  : SPACE pinlist space_endline;
          


pinlist   : pinlist SPACE pin
          | pin
          ;

pin  :  ASTRING '.' ASTRING { define_pin(&routed_list,
                              find_socket(Ident,$1,Create,&socket_head),
                              curr_net_nam,BIDIR,0,$3,
                              default_vhdl_datatype,NULL); };

space_endline : opt_space endline;

opt_space : SPACE 
          | /* nothing */
          ;

endline   : CR 
          | CR LF
          | LF
          ;



%%

/* defining lineno here */

int lineno;
extern char * yytext;

int yyerror(char * x)
  {
  int token;
  printf("-- Error --> %s near string (%s) at line %d\n",x,yytext,lineno);
/*  for(token = yylex();token >= 0 && token!=NL;token = yylex()); */
  return 1;
  }

int yywrap(void)
  {
  return 1;
  }