Subversion Repositories Vertical

Rev

Blame | Last modification | View Log | Download | RSS feed

%{
/*
 * $Id: frb_yacc.y,v 1.10 2002/10/02 19:37:29 MJAMES Exp $
 *
 * $Log: frb_yacc.y,v $
 * Revision 1.10  2002/10/02 19:37:29  MJAMES
 * Moved dummy functions to a separate support file.
 *
 * Used correct number of arguments to define_pin
 *
 * Revision 1.9  2002/09/09 10:36:20  mjames
 * Checkpoint checkin
 *
 * Revision 1.8  2002/01/21 09:34:50  mjames
 * FRBread adds the ability to ignore .ATT_PIN construct that appears in
 * a recent FRB file.
 *
 * Revision 1.7  2001/10/31 22:20:06  mjames
 * Tidying up problematical comments caused by CVS
 * 'intelligent' comment guessing
 *
 * Revision 1.6  2001/10/02 20:53:47  mjames
 * Moved documentation about code to main program module.
 *
 * Revision 1.5  2001/08/31 09:36:41  mjames
 * removed DOS line endings
 *
 * Revision 1.4  2001/06/06 12:10:22  mjames
 * Move from HPUX
 *
 * Revision 1.3  2001/03/29 08:27:07  mjames
 * Converted frbread for use with the newer files from the drawing office
 *
 * Revision 1.2  2000/12/04 13:14:02  mjames
 * Imported all of the PCB syntax readers.
 *
 * Converted "a/b" to mean "a" divided by "b" insted of a single string
 * "a/b" in Verilog
 *
 * Revision 1.1.1.1  2000/10/19 21:58:38  mjames
 * Mike put it here
 *  */




#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "expression.h"
#include "generic.h"
#include "database.h"


static char IDstr[] = "@(#)$Header: /cygwin/cvsroot/vertical/frb_yacc.y,v 1.10 2002/10/02 19:37:29 MJAMES Exp $";


static socket_t * current_chip;
static char curr_net_nam[MAXIDLEN];
static int curr_pin_dir;
int inside_block;

%}
%union { char * string; }
%token HEADER TIME JOB TYPE APP ADD_COM ADD_TER TER END UNITS 
%token ATT_COM ATT_TRE ATT_PIN
%token NL  ENDFILE
%token <string> ASTRING

%%

file   : objects;



objects : objects object
        | object
        ;


object  : header_line NL
        | add_comp_line NL
        | add_ter_line NL
        | ter_block NL
        | gap
        | END gap
        ;


header_line :junktag { } junk ; 

junktag : HEADER | TIME | JOB | APP  | TYPE | UNITS | ATT_COM | ATT_TRE  | ATT_PIN ;

add_comp_line : ADD_COM  ASTRING ASTRING ASTRING  {
                 current_chip = find_socket(Ident,$2,Create,&socket_head);
                 set_socket(current_chip,Type,$3) ;
                 set_socket(current_chip,Value,$4) ;
                 };

add_ter_line : ADD_TER ASTRING ASTRING ASTRING {
                   define_pin(&routed_list,
                              find_socket(Ident,$2,Create,&socket_head),
                              $4,BIDIR,0,$3,default_vhdl_datatype,NULL);
                   strcpy(curr_net_nam,$4);
                   };

ter_block   : TER ter_lines NL;

ter_lines   : ter_lines NL ter_line 
            | ter_line 
            ;

ter_line:    ASTRING ASTRING {
             define_pin(&routed_list,
                        find_socket(Ident,$1,Create,&socket_head),
                        curr_net_nam,BIDIR,0,$2,default_vhdl_datatype,NULL);
             }
            ;


junk      : any junk 
          | any
          | /* nothing */
          ;


any : ASTRING {  }
    ;



gap              : NL gap
                 | NL
                 ;



%%

/* 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)
  {
  printf("-- end of file at line %d\n",lineno);
  return 1;
  }