├── test_dir ├── test.test ├── test_instance.edn ├── test_libwork.edn ├── without_info_design.edn └── and_2bits.edn ├── edn_parse ├── README.md ├── .gitattributes ├── edn_main.c ├── node_util.h ├── edn_bison.h ├── type.h ├── edn_flex.l ├── edn_bison.y ├── node_util.c ├── edn_flex.c └── edn_bison.c /test_dir/test.test: -------------------------------------------------------------------------------- 1 | (edif) 2 | -------------------------------------------------------------------------------- /edn_parse: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/litaotju/edif-parser/HEAD/edn_parse -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # What is edif-parser 2 | edif-parser is a ansi c project to build a EDIF(Electronic Design Interchange Format) parser. 3 | 4 | # Technology Used 5 | This parser is build on flex and bison, which are the lexer and parser generator repectively. The bison parser use BNF rules to specify the 6 | grammer. And the token is defined in Flex format. 7 | 8 | # Any one who intreasts this can contact me via: 9 | * Email: litaotju@live.cn 10 | * pull or issues this repo. 11 | 12 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /test_dir/test_instance.edn: -------------------------------------------------------------------------------- 1 | 2 | (instance (rename outZ0Z_0 "out[0]") (viewRef PRIM (cellRef FD (libraryRef UNILIB))) 3 | ) 4 | (instance (rename outZ0Z_1 "out[1]") (viewRef PRIM (cellRef FD (libraryRef UNILIB))) 5 | ) 6 | (instance clk_ibuf (viewRef PRIM (cellRef BUFG (libraryRef VIRTEX))) 7 | ) 8 | (instance clk_ibuf_iso (viewRef PRIM (cellRef IBUFG (libraryRef VIRTEX))) 9 | ) 10 | (instance (rename out_obuf_1 "out_obuf[1]") (viewRef PRIM (cellRef OBUF (libraryRef VIRTEX))) 11 | ) 12 | (instance (rename out_obuf_0 "out_obuf[0]") (viewRef PRIM (cellRef OBUF (libraryRef VIRTEX))) 13 | ) 14 | (instance scan_out_obuf (viewRef PRIM (cellRef OBUF (libraryRef VIRTEX))) 15 | ) 16 | (instance rst_ibuf (viewRef PRIM (cellRef IBUF (libraryRef VIRTEX))) 17 | ) 18 | (instance scan_in_ibuf (viewRef PRIM (cellRef IBUF (libraryRef VIRTEX))) 19 | ) 20 | (instance scan_en_ibuf (viewRef PRIM (cellRef IBUF (libraryRef VIRTEX))) 21 | ) 22 | (instance (rename inb_ibuf_1 "inb_ibuf[1]") (viewRef PRIM (cellRef IBUF (libraryRef VIRTEX))) 23 | ) 24 | (instance (rename inb_ibuf_0 "inb_ibuf[0]") (viewRef PRIM (cellRef IBUF (libraryRef VIRTEX))) 25 | ) 26 | (instance (rename ina_ibuf_1 "ina_ibuf[1]") (viewRef PRIM (cellRef IBUF (libraryRef VIRTEX))) 27 | ) 28 | (instance (rename ina_ibuf_0 "ina_ibuf[0]") (viewRef PRIM (cellRef IBUF (libraryRef VIRTEX))) 29 | ) 30 | -------------------------------------------------------------------------------- /edn_main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "type.h" 4 | #include "edn_bison.h" //the header include yyparse() created by bison 5 | 6 | #define DEBUG_LEX_ALONE 0 7 | //in edn_flex.c 8 | 9 | extern int yylex(); 10 | extern FILE *yyin; 11 | 12 | top_EDIF *p_top_edif; 13 | 14 | #if DEBUG_LEX_ALONE 15 | extern int instance_num; 16 | extern int net_num; 17 | int token_num=0; 18 | #endif 19 | 20 | int main(int argc ,char **argv){ 21 | printf("runing the main func\n"); 22 | 23 | //open files 24 | if(argc >1){ 25 | 26 | if(!(yyin=fopen(argv[1],"r"))){ 27 | printf("opening the file with errors\n"); 28 | perror(argv[1]); 29 | return (1); 30 | } 31 | else printf("opening the file\n"); 32 | } 33 | 34 | //open the default test 35 | else{ 36 | argv[1]="/home/litao/edn_parse/test_dir/and_2bits.edn"; 37 | if(!(yyin=fopen(argv[1],"r"))){ 38 | printf("opening the default file with errors !!\n"); 39 | perror(argv[1]); 40 | return (1); 41 | } 42 | else printf("opening the default file: %s\n",argv[1]); 43 | } 44 | 45 | #if DEBUG_LEX_ALONE 46 | 47 | do{ 48 | token_num++; 49 | } 50 | while(yylex()!=0); 51 | 52 | printf("the instance number is %d\n",instance_num); 53 | printf("the net number is %d\n",net_num); 54 | printf("the token number is %d\n",token_num); 55 | #else 56 | // 本注释以上可以正确运行,也就是说yylex().产生的lexer是可以正常运行的 57 | //bison 产生的parser存在错误.在运行当中报的错误如下: 58 | //error in parsing: syntax error - on line number 1 59 | yyparse(); 60 | printf("yyparse() has been excuted.\n"); 61 | printf("find top edif:%s",p_top_edif->edif_name); 62 | #endif 63 | 64 | return 1; 65 | } 66 | -------------------------------------------------------------------------------- /node_util.h: -------------------------------------------------------------------------------- 1 | #ifndef NODE_UTIL_H 2 | #define NODE_UTIL_H 3 | 4 | #include "type.h" 5 | 6 | //最顶层的EDIF 7 | top_EDIF *createEdif(char *edif_name,REF_LIBRARY *reflib_list,CELL *work_cells,char *design_name); 8 | 9 | //前九个函数已经足够来创建各个参考库,因为每一个参考库中的cell都只含有interface,而没有含有contents和nets 10 | PORT *createPort(int number,char *name,int dir); 11 | PORT *newPort_List( PORT *first_port); 12 | PORT *newPort_List_Entry(PORT *existed_list,PORT *new_entry,int port_number_now); 13 | 14 | PRIM_CELL *createPrim(char *cell,int cell_type,int view,int view_type,PORT *interface); 15 | PRIM_CELL *newPrim_List(PRIM_CELL *first_prim_cell); 16 | PRIM_CELL *newPrim_List_Entry(PRIM_CELL *existed_list,PRIM_CELL *new_entry,int list_cnt); 17 | 18 | REF_LIBRARY *createRef_Lib(char *lib_name,PRIM_CELL *prim_list); 19 | REF_LIBRARY *newRef_Lib_List(REF_LIBRARY *first_ref_lib); 20 | REF_LIBRARY *newRef_Lib_List_Entry(REF_LIBRARY *existed_list,REF_LIBRARY *new_entry,int list_cnt); 21 | 22 | 23 | 24 | //下面的函数开始创建work_library,首先开始创建INSTANCE的列表. 25 | PROPERTY *createProperty(char *property_id,char *property_type, char *property_value); 26 | PROPERTY *createProperty_Integer(char *property_id,char *property_type, int property_value); 27 | PROPERTY *newProperty_List(PROPERTY *first_property); 28 | PROPERTY *newProperty_List_Entry(PROPERTY *existed_list, PROPERTY *new_entry, int list_cnt); 29 | 30 | 31 | VIEW_CELL_LIB_REF *decideInstance_Ref(char *viewref_id,char *cellref_id, char *libref_id); 32 | 33 | INSTANCE *createInstance(char *name, VIEW_CELL_LIB_REF *view_cell_lib_id, PROPERTY * p_instance_property); 34 | INSTANCE *newInstance_List(INSTANCE *first_instance); 35 | INSTANCE *newInstance_List_Entry(INSTANCE *existed_list, INSTANCE *new_entry,int list_cnt); 36 | //开始创建NET列表 37 | 38 | PORTREF *createPortref(int portref_type,char *portref_id,int bit_location,char *instanceref_id); 39 | PORTREF *newPortref_List(PORTREF *first_portref); 40 | PORTREF *newPortref_List_Entry(PORTREF *existed_list,PORTREF *new_entry,int list_cnt); 41 | 42 | NET *findNet(char *net_name,PORTREF *portref_list); 43 | NET *newNet_List(NET *first_net); 44 | NET *newNet_List_Entry(NET *existed_list,NET *new_entry,int list_cnt); 45 | 46 | //开始创建cell列表; 47 | VIEW *createView(char *view ,int viewtype,PORT *interface,INSTANCE *instance_list,NET *net_list ,PROPERTY *property_list); 48 | CELL *createCell(char *cell,int celltype,VIEW *view); 49 | CELL *newCell_List(CELL *first_cell); 50 | CELL *newCell_List_Entry(CELL *existed_list,CELL *new_entry,int list_cnt); 51 | #endif 52 | -------------------------------------------------------------------------------- /edn_bison.h: -------------------------------------------------------------------------------- 1 | /* A Bison parser, made by GNU Bison 3.0.2. */ 2 | 3 | /* Bison interface for Yacc-like parsers in C 4 | 5 | Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. 6 | 7 | This program is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . */ 19 | 20 | /* As a special exception, you may create a larger work that contains 21 | part or all of the Bison parser skeleton and distribute that work 22 | under terms of your choice, so long as that work isn't itself a 23 | parser generator using the skeleton or a modified version thereof 24 | as a parser skeleton. Alternatively, if you modify or redistribute 25 | the parser skeleton itself, you may (at your option) remove this 26 | special exception, which will cause the skeleton and the resulting 27 | Bison output files to be licensed under the GNU General Public 28 | License without this special exception. 29 | 30 | This special exception was added by the Free Software Foundation in 31 | version 2.2 of Bison. */ 32 | 33 | #ifndef YY_YY_EDN_BISON_H_INCLUDED 34 | # define YY_YY_EDN_BISON_H_INCLUDED 35 | /* Debug traces. */ 36 | #ifndef YYDEBUG 37 | # define YYDEBUG 0 38 | #endif 39 | #if YYDEBUG 40 | extern int yydebug; 41 | #endif 42 | 43 | /* Token type. */ 44 | #ifndef YYTOKENTYPE 45 | # define YYTOKENTYPE 46 | enum yytokentype 47 | { 48 | EDIF = 258, 49 | EDIFVERSION = 259, 50 | EDIFLEVEL = 260, 51 | EKEYWORDMAP = 261, 52 | EKEYWORDLEVEL = 262, 53 | ESTATUS = 263, 54 | EWRITTEN = 264, 55 | ETIMESTAMP = 265, 56 | EAUTHOR = 266, 57 | EPROGRAM = 267, 58 | EVERSION = 268, 59 | eLIBRARY = 269, 60 | eTECHNOLOGY = 270, 61 | eLIBRARYREF = 271, 62 | eCELL = 272, 63 | eCELLTYPE = 273, 64 | eCELLREF = 274, 65 | eVIEW = 275, 66 | eVIEWTYPE = 276, 67 | eVIEWREF = 277, 68 | eINTERFACE = 278, 69 | ePORT = 279, 70 | eARRAY = 280, 71 | eDIRECTION = 281, 72 | eINPUT = 282, 73 | eOUTPUT = 283, 74 | eINOUT = 284, 75 | eCONTENTS = 285, 76 | eINSTANCE = 286, 77 | eRENAME = 287, 78 | ePROPERTY = 288, 79 | eSTRING = 289, 80 | eINTEGER = 290, 81 | eNET = 291, 82 | eJOINED = 292, 83 | ePORTREF = 293, 84 | eMEMBER = 294, 85 | eINSTANCEREF = 295, 86 | eDESIGN = 296, 87 | LP = 297, 88 | RP = 298, 89 | MD = 299, 90 | QUOTE = 300, 91 | eWORK = 301, 92 | eGENERIC = 302, 93 | ePRIM = 303, 94 | eNETLIST = 304, 95 | eINITIAL_VALUE = 305, 96 | eIDENTIFIER = 306, 97 | eWORD_QUOTED = 307, 98 | eNUMBER = 308 99 | }; 100 | #endif 101 | 102 | /* Value type. */ 103 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 104 | typedef union YYSTYPE YYSTYPE; 105 | union YYSTYPE 106 | { 107 | #line 51 "edn_bison.y" /* yacc.c:1909 */ 108 | 109 | char *id; 110 | int num_value; 111 | 112 | top_EDIF *top_EDIF_NODE; 113 | //struct just for ref_lib 114 | REF_LIBRARY *ref_library_node; 115 | PRIM_CELL *prim_node; 116 | PORT *port_node; 117 | 118 | CELL *cell_node; 119 | VIEW *view_node; 120 | VIEW_CELL_LIB_REF *view_cell_lib_ref_node; 121 | PROPERTY *property_node; 122 | INSTANCE *instance_node; 123 | 124 | PORTREF *portref_node; 125 | NET *net_node; 126 | 127 | #line 128 "edn_bison.h" /* yacc.c:1909 */ 128 | }; 129 | # define YYSTYPE_IS_TRIVIAL 1 130 | # define YYSTYPE_IS_DECLARED 1 131 | #endif 132 | 133 | 134 | extern YYSTYPE yylval; 135 | 136 | int yyparse (void); 137 | 138 | #endif /* !YY_YY_EDN_BISON_H_INCLUDED */ 139 | -------------------------------------------------------------------------------- /type.h: -------------------------------------------------------------------------------- 1 | #ifndef TYPE_H 2 | #define TYPE_H 3 | 4 | 5 | #define INSTANCE_PORTREF 1 6 | #define TOP_PORTREF 0 7 | 8 | #define MAX_PRIM_ID_LENGTH 20 9 | //lib_name 10 | //cell_id(a cell's name: FDR,LUT4,DSP,user_define_cell's id ....) 11 | //view_id(a view's name :) 12 | //port_id, 13 | 14 | 15 | #define MAX_USER_ID_LENGTH 50 16 | //instance_id,net_id,instanceref_id(每一个instanceref对应着一个instance_id) 17 | typedef struct edif_t top_EDIF; 18 | 19 | typedef struct ref_library_t REF_LIBRARY; 20 | typedef struct prim_cell_t PRIM_CELL; 21 | typedef struct port_t PORT; 22 | 23 | typedef struct cell_t CELL; 24 | typedef struct view_t VIEW; 25 | 26 | typedef struct instance_t INSTANCE; 27 | typedef struct view_cell_lib_ref_t VIEW_CELL_LIB_REF; 28 | 29 | typedef struct net_t NET; 30 | typedef struct portref_t PORTREF; 31 | 32 | typedef struct property_t PROPERTY; 33 | 34 | struct edif_t{ 35 | char edif_name[20]; 36 | int reflib_cnt; 37 | REF_LIBRARY *reflib_list; 38 | int work_cells_cnt; 39 | CELL *work_cells; 40 | char design_name[20]; 41 | }; 42 | //------------------------------------------------------------------------------------------- 43 | // 44 | //------------------------------------------------------------------------------------------- 45 | 46 | struct ref_library_t{ 47 | //需要传递给上一级的信息 48 | int list_cnt; 49 | //当前ref_library的信息 50 | char lib_name[MAX_PRIM_ID_LENGTH]; //ie: UNILIB VIRTEX VIRTEXR... 51 | //从下一级传上来的信息 52 | int cell_count; //这个参考库中包含的CELL的个数,实际上就是PRIM_list的list_cnt 53 | PRIM_CELL *prim_in_lib; 54 | }; 55 | 56 | struct prim_cell_t{ 57 | //需要传递给上一级的信息 58 | int list_cnt; //记录prim_cell这个list的个数,只需要对list中的element1来记就可以了 59 | 60 | //当前prim_cell的信息 61 | char cell[MAX_PRIM_ID_LENGTH]; 62 | int celltype; 63 | int view; 64 | int viewtype; 65 | //从下一级传上来的信息 66 | int port_number; //interface中port的个数,实际上就是port_list的list_cnt 67 | PORT *interface; 68 | }; 69 | 70 | struct port_t{ 71 | //需要传递给上一级的信息 72 | int list_cnt; //记录port_list当中含有的port的个数,只需要对一个list的p1当中赋予正确的值就可以了 73 | 74 | //本port的信息 75 | char port_name[MAX_PRIM_ID_LENGTH]; //every port has a name 76 | int port_member_count;//a array port has more than one member,such as input[3:0] has four member 77 | int d; //direction was a token , and impliey by an int type in default 78 | }; 79 | 80 | 81 | //------------------------------------------------------------------------------------------- 82 | // 83 | //------------------------------------------------------------------------------------------- 84 | 85 | 86 | struct cell_t{ 87 | int list_cnt; 88 | char cell[MAX_PRIM_ID_LENGTH]; 89 | int celltype; 90 | VIEW *view; 91 | }; 92 | struct view_t{ 93 | int view; 94 | int viewtype; 95 | 96 | int port_number; 97 | PORT *interface; 98 | //以下两部分共同组成了contents 99 | int instance_number; 100 | INSTANCE *instance_list; 101 | int net_number; 102 | NET *net_list; 103 | //property 104 | int property_number; 105 | PROPERTY *property_list; 106 | }; 107 | 108 | //------------------------------------------------------------------------------------------ 109 | //instance的数据类型定义 110 | //------------------------------------------------------------------------------------------ 111 | struct instance_t{ 112 | 113 | //需要传递给上一级的数据 114 | int list_cnt; 115 | 116 | //当前本级的信息 117 | int instance_type; //PRIM or just a cell in lib work 118 | char name[MAX_USER_ID_LENGTH]; 119 | //根据前面的语意值来的信息 120 | VIEW_CELL_LIB_REF *view_cell_lib_id; 121 | PROPERTY *p_instance_property; 122 | }; 123 | 124 | struct view_cell_lib_ref_t{ 125 | char viewref_id [MAX_PRIM_ID_LENGTH]; 126 | char cellref_id [MAX_USER_ID_LENGTH]; 127 | char libref_id [MAX_PRIM_ID_LENGTH]; 128 | }; 129 | 130 | 131 | struct property_t{ 132 | int list_cnt; 133 | char property_id [MAX_PRIM_ID_LENGTH]; //INIT or sth....... 134 | char property_type [MAX_PRIM_ID_LENGTH]; //integer or string 135 | union { 136 | char property_string_value [MAX_PRIM_ID_LENGTH]; 137 | int property_num_value; 138 | }property_value; 139 | }; 140 | 141 | //------------------------------------------------------------------------------------------ 142 | //net的数据类型定义 143 | //------------------------------------------------------------------------------------------ 144 | struct net_t{ 145 | 146 | int list_cnt; 147 | char net_name[MAX_USER_ID_LENGTH]; 148 | int portref_number; 149 | PORTREF *portref_list; 150 | }; 151 | struct portref_t{ 152 | 153 | int list_cnt; 154 | int portref_type; //this cell's bus,port OR the instance's port 155 | char portref_id [MAX_PRIM_ID_LENGTH]; //端口的ID 156 | int bit_location; //当一个NET连接到多位PORT的其中一位时,要根据名字寻找端口,但是必须要有记录bit位的信息 157 | char instanceref_id [MAX_USER_ID_LENGTH];//instance的id,如果是当前cell的顶层端口,就没有ID 158 | }; 159 | #endif 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | -------------------------------------------------------------------------------- /edn_flex.l: -------------------------------------------------------------------------------- 1 | %option noyywrap 2 | %option yylineno 3 | %{ 4 | #include 5 | #include 6 | #include 7 | #include "type.h" 8 | #include "edn_bison.h" 9 | 10 | #define to_view_parse 0 11 | #define RECORD 1 12 | /* the define below helps with watching the parser go token by token */ 13 | #define MP {if(to_view_parse) printf("%d %s\n", yylineno, yytext);} 14 | 15 | #if RECORD 16 | int instance_num=0; 17 | int net_num =0; 18 | #define RECORD_INSTANCE_NUM instance_num++ 19 | #define RECORD_NET_NUM net_num++ 20 | #endif 21 | 22 | %} 23 | 24 | %s READING_STRING 25 | 26 | %% 27 | 28 | /* edif information */ 29 | "edif" {MP;return EDIF;} 30 | "edifVersion" {MP;return EDIFVERSION;} 31 | "edifLevel" {MP;return EDIFLEVEL;} 32 | "keywordMap" {MP;return EKEYWORDMAP;} 33 | "keywordLevel" {MP;return EKEYWORDLEVEL;} 34 | "status" {MP;return ESTATUS;} 35 | "written" {MP;return EWRITTEN;} 36 | "timeStamp" {MP;return ETIMESTAMP;} 37 | "author" {MP;return EAUTHOR;} 38 | "program" {MP;return EPROGRAM;} 39 | "version" {MP;return EVERSION;} 40 | 41 | /* library name */ 42 | "library" {MP;return eLIBRARY;} 43 | "technology" {MP;return eTECHNOLOGY;} 44 | 45 | /* 46 | "UNILIB" {MP;return eUNILIB;} 47 | "VIRTEX" {MP;return eVIRTEX;} 48 | "VIRTEXR" {MP;return eVIRTEXR;} 49 | */ 50 | "work" {MP;return eWORK;} 51 | 52 | 53 | /* keywords of all lib */ 54 | 55 | "cell" {MP;return eCELL;} 56 | "cellType" {MP;return eCELLTYPE;} 57 | "GENERIC" {MP;yylval.num_value=1;return eGENERIC;} 58 | 59 | 60 | "view" {MP;return eVIEW;} 61 | "PRIM" {MP;yylval.num_value=1;return ePRIM;} 62 | "viewType" {MP;return eVIEWTYPE;} 63 | "NETLIST" {MP;yylval.num_value=1;return eNETLIST;} 64 | 65 | 66 | 67 | "interface" {MP;return eINTERFACE;} 68 | "port" {MP;return ePORT;} 69 | "array" {MP;return eARRAY;} 70 | "direction" {MP;return eDIRECTION;} 71 | "INPUT" {MP;return eINPUT;} 72 | "OUTPUT" {MP;return eOUTPUT;} 73 | "INOUT" {MP;return eINOUT;} 74 | 75 | /* tokens belong to cells in work */ 76 | "contents" {MP;return eCONTENTS;} 77 | "instance" {MP;RECORD_INSTANCE_NUM;return eINSTANCE;} 78 | "rename" {MP;return eRENAME;} 79 | "viewRef" {MP;return eVIEWREF;} 80 | "cellRef" {MP;return eCELLREF;} 81 | "libraryRef" {MP;return eLIBRARYREF;} 82 | 83 | /*the instance of a LUT has a property */ 84 | "property" {MP;return ePROPERTY;} 85 | /* 86 | "INIT" {MP;return eINIT;} 87 | */ 88 | 89 | "string" {MP;return eSTRING;} 90 | "integer" {MP;return eINTEGER;} 91 | 92 | 93 | "net" {MP;RECORD_NET_NUM;return eNET;}; 94 | "joined" {MP;return eJOINED;} 95 | "portRef" {MP;return ePORTREF;} 96 | "member" {MP;return eMEMBER;} 97 | "instanceRef" {MP;return eINSTANCEREF;} 98 | 99 | 100 | 101 | /*design information */ 102 | "design " {MP;return eDESIGN;} 103 | 104 | 105 | \" {MP;BEGIN READING_STRING;return QUOTE;} 106 | /*back to initial state a " has been detected */ 107 | \" {MP;BEGIN INITIAL;return QUOTE;} 108 | 109 | /*return the text itself if it is '[' ':' ']' when in a " "*/ 110 | \[ {MP;return LP;} 111 | \] {MP;return RP;} 112 | \: {MP;return MD;} 113 | 114 | [0-9]+'[bdho][0-9A-F]+ {yylval.id=strdup(yytext);MP;return eINITIAL_VALUE;} 115 | /*other words just treated as words to inform the commercial infomation and part-infomation */ 116 | [0-9]+ {yylval.num_value=atoi(yytext);MP;return eNUMBER;} 117 | [a-zA-Z0-9_]+[.-]*[a-zA-Z0-9_]* {yylval.id=strdup(yytext);MP;return eWORD_QUOTED;} 118 | /* ignore the ,.- in a pair of quote */ 119 | [,] {MP;continue;} 120 | [\f\r\t\b ]+ {continue;/* ignore spaces*/} 121 | /* others in a pair of quotes should been warned */ 122 | . {printf("User Waring:ignore %s in a parir quote \n",yytext);continue;} 123 | 124 | 125 | 126 | /*the ( and ) leave to yyparse() to handle */ 127 | [()] {MP;return yytext[0];} 128 | 129 | /* identifier */ 130 | [a-zA-Z][a-zA-Z0-9_]* {yylval.id=strdup(yytext);return eIDENTIFIER;} 131 | 132 | /*number */ 133 | [0-9]+ {yylval.num_value=atoi(yytext);MP;return eNUMBER;} 134 | 135 | /*white space and new line */ 136 | [\f\r\t\b ]+ { /* ignore spaces */ continue;} 137 | [\n] { /* ignore new line */ continue;} 138 | . {printf("User Warning:line no:%d text %s unrecogiized in edif source \n",yylineno,yytext);continue;} 139 | 140 | 141 | -------------------------------------------------------------------------------- /test_dir/test_libwork.edn: -------------------------------------------------------------------------------- 1 | (library work 2 | (edifLevel 0) 3 | (technology (numberDefinition )) 4 | (cell and_2bits (cellType GENERIC) 5 | (view verilog (viewType NETLIST) 6 | (interface 7 | (port (array (rename ina "ina[1:0]") 2) (direction INPUT)) 8 | (port (array (rename inb "inb[1:0]") 2) (direction INPUT)) 9 | (port (array (rename out "out[1:0]") 2) (direction OUTPUT)) 10 | (port clk (direction INPUT)) 11 | (port scan_en (direction INPUT)) 12 | (port scan_in (direction INPUT)) 13 | (port scan_out (direction OUTPUT)) 14 | (port rst (direction INPUT)) 15 | ) 16 | (contents 17 | 18 | (instance (rename outZ0Z_0 "out[0]") (viewRef PRIM (cellRef FD (libraryRef UNILIB))) 19 | ) 20 | (instance (rename outZ0Z_1 "out[1]") (viewRef PRIM (cellRef FD (libraryRef UNILIB))) 21 | ) 22 | (instance (rename out_5_e_1 "out_5_e[1]") (viewRef PRIM (cellRef LUT5 (libraryRef VIRTEXR))) 23 | (property INIT (string "32'h0000F808")) 24 | ) 25 | (instance (rename out_5_e_0 "out_5_e[0]") (viewRef PRIM (cellRef LUT5 (libraryRef VIRTEXR))) 26 | (property INIT (string "32'h0000F808")) 27 | ) 28 | (instance clk_ibuf (viewRef PRIM (cellRef BUFG (libraryRef VIRTEX))) 29 | ) 30 | (instance clk_ibuf_iso (viewRef PRIM (cellRef IBUFG (libraryRef VIRTEX))) 31 | ) 32 | (instance (rename out_obuf_1 "out_obuf[1]") (viewRef PRIM (cellRef OBUF (libraryRef VIRTEX))) 33 | ) 34 | (instance (rename out_obuf_0 "out_obuf[0]") (viewRef PRIM (cellRef OBUF (libraryRef VIRTEX))) 35 | ) 36 | (instance scan_out_obuf (viewRef PRIM (cellRef OBUF (libraryRef VIRTEX))) 37 | ) 38 | (instance rst_ibuf (viewRef PRIM (cellRef IBUF (libraryRef VIRTEX))) 39 | ) 40 | (instance scan_in_ibuf (viewRef PRIM (cellRef IBUF (libraryRef VIRTEX))) 41 | ) 42 | (instance scan_en_ibuf (viewRef PRIM (cellRef IBUF (libraryRef VIRTEX))) 43 | ) 44 | (instance (rename inb_ibuf_1 "inb_ibuf[1]") (viewRef PRIM (cellRef IBUF (libraryRef VIRTEX))) 45 | ) 46 | (instance (rename inb_ibuf_0 "inb_ibuf[0]") (viewRef PRIM (cellRef IBUF (libraryRef VIRTEX))) 47 | ) 48 | (instance (rename ina_ibuf_1 "ina_ibuf[1]") (viewRef PRIM (cellRef IBUF (libraryRef VIRTEX))) 49 | ) 50 | (instance (rename ina_ibuf_0 "ina_ibuf[0]") (viewRef PRIM (cellRef IBUF (libraryRef VIRTEX))) 51 | ) 52 | (net clk_c (joined 53 | (portRef O (instanceRef clk_ibuf)) 54 | (portRef C (instanceRef outZ0Z_1)) 55 | (portRef C (instanceRef outZ0Z_0)) 56 | )) 57 | (net clk (joined 58 | (portRef clk) 59 | (portRef I (instanceRef clk_ibuf_iso)) 60 | )) 61 | (net (rename ina_c_0 "ina_c[0]") (joined 62 | (portRef O (instanceRef ina_ibuf_0)) 63 | (portRef I0 (instanceRef out_5_e_0)) 64 | )) 65 | (net (rename ina_0 "ina[0]") (joined 66 | (portRef (member ina 1)) 67 | (portRef I (instanceRef ina_ibuf_0)) 68 | )) 69 | (net (rename ina_c_1 "ina_c[1]") (joined 70 | (portRef O (instanceRef ina_ibuf_1)) 71 | (portRef I0 (instanceRef out_5_e_1)) 72 | )) 73 | (net (rename ina_1 "ina[1]") (joined 74 | (portRef (member ina 0)) 75 | (portRef I (instanceRef ina_ibuf_1)) 76 | )) 77 | (net (rename inb_c_0 "inb_c[0]") (joined 78 | (portRef O (instanceRef inb_ibuf_0)) 79 | (portRef I1 (instanceRef out_5_e_0)) 80 | )) 81 | (net (rename inb_0 "inb[0]") (joined 82 | (portRef (member inb 1)) 83 | (portRef I (instanceRef inb_ibuf_0)) 84 | )) 85 | (net (rename inb_c_1 "inb_c[1]") (joined 86 | (portRef O (instanceRef inb_ibuf_1)) 87 | (portRef I1 (instanceRef out_5_e_1)) 88 | )) 89 | (net (rename inb_1 "inb[1]") (joined 90 | (portRef (member inb 0)) 91 | (portRef I (instanceRef inb_ibuf_1)) 92 | )) 93 | (net scan_en_c (joined 94 | (portRef O (instanceRef scan_en_ibuf)) 95 | (portRef I2 (instanceRef out_5_e_0)) 96 | (portRef I2 (instanceRef out_5_e_1)) 97 | )) 98 | (net scan_en (joined 99 | (portRef scan_en) 100 | (portRef I (instanceRef scan_en_ibuf)) 101 | )) 102 | (net scan_in_c (joined 103 | (portRef O (instanceRef scan_in_ibuf)) 104 | (portRef I3 (instanceRef out_5_e_0)) 105 | )) 106 | (net scan_in (joined 107 | (portRef scan_in) 108 | (portRef I (instanceRef scan_in_ibuf)) 109 | )) 110 | (net rst_c (joined 111 | (portRef O (instanceRef rst_ibuf)) 112 | (portRef I4 (instanceRef out_5_e_0)) 113 | (portRef I4 (instanceRef out_5_e_1)) 114 | )) 115 | (net rst (joined 116 | (portRef rst) 117 | (portRef I (instanceRef rst_ibuf)) 118 | )) 119 | (net scan_out (joined 120 | (portRef O (instanceRef scan_out_obuf)) 121 | (portRef scan_out) 122 | )) 123 | (net (rename out_c_0 "out_c[0]") (joined 124 | (portRef Q (instanceRef outZ0Z_0)) 125 | (portRef I (instanceRef out_obuf_0)) 126 | (portRef I3 (instanceRef out_5_e_1)) 127 | )) 128 | (net (rename out_0 "out[0]") (joined 129 | (portRef O (instanceRef out_obuf_0)) 130 | (portRef (member out 1)) 131 | )) 132 | (net (rename out_c_1 "out_c[1]") (joined 133 | (portRef Q (instanceRef outZ0Z_1)) 134 | (portRef I (instanceRef scan_out_obuf)) 135 | (portRef I (instanceRef out_obuf_1)) 136 | )) 137 | (net (rename out_1 "out[1]") (joined 138 | (portRef O (instanceRef out_obuf_1)) 139 | (portRef (member out 0)) 140 | )) 141 | (net (rename clk_ibuf_isoZ0 "clk_ibuf_iso") (joined 142 | (portRef O (instanceRef clk_ibuf_iso)) 143 | (portRef I (instanceRef clk_ibuf)) 144 | )) 145 | (net (rename out_5_eZ0Z_0 "out_5_e[0]") (joined 146 | (portRef O (instanceRef out_5_e_0)) 147 | (portRef D (instanceRef outZ0Z_0)) 148 | )) 149 | (net (rename out_5_eZ0Z_1 "out_5_e[1]") (joined 150 | (portRef O (instanceRef out_5_e_1)) 151 | (portRef D (instanceRef outZ0Z_1)) 152 | )) 153 | ) 154 | (property mapper_option (string "")) 155 | (property orig_inst_of (string "and_2bits")) 156 | ) 157 | ) 158 | ) 159 | 160 | -------------------------------------------------------------------------------- /test_dir/without_info_design.edn: -------------------------------------------------------------------------------- 1 | (edif and_2bits 2 | (library VIRTEXR 3 | (edifLevel 0) 4 | (technology (numberDefinition )) 5 | (cell LUT5 (cellType GENERIC) 6 | (view PRIM (viewType NETLIST) 7 | (interface 8 | (port I0 (direction INPUT)) 9 | (port I1 (direction INPUT)) 10 | (port I2 (direction INPUT)) 11 | (port I3 (direction INPUT)) 12 | (port I4 (direction INPUT)) 13 | (port O (direction OUTPUT)) 14 | ) 15 | ) 16 | ) 17 | ) 18 | (library UNILIB 19 | (edifLevel 0) 20 | (technology (numberDefinition )) 21 | (cell FD (cellType GENERIC) 22 | (view PRIM (viewType NETLIST) 23 | (interface 24 | (port Q (direction OUTPUT)) 25 | (port D (direction INPUT)) 26 | (port C (direction INPUT)) 27 | ) 28 | ) 29 | ) 30 | ) 31 | (library VIRTEX 32 | (edifLevel 0) 33 | (technology (numberDefinition )) 34 | (cell IBUFG (cellType GENERIC) 35 | (view PRIM (viewType NETLIST) 36 | (interface 37 | (port O (direction OUTPUT)) 38 | (port I (direction INPUT)) 39 | ) 40 | ) 41 | ) 42 | (cell IBUF (cellType GENERIC) 43 | (view PRIM (viewType NETLIST) 44 | (interface 45 | (port O (direction OUTPUT)) 46 | (port I (direction INPUT)) 47 | ) 48 | ) 49 | ) 50 | (cell OBUF (cellType GENERIC) 51 | (view PRIM (viewType NETLIST) 52 | (interface 53 | (port O (direction OUTPUT)) 54 | (port I (direction INPUT)) 55 | ) 56 | ) 57 | ) 58 | (cell BUFG (cellType GENERIC) 59 | (view PRIM (viewType NETLIST) 60 | (interface 61 | (port I (direction INPUT)) 62 | (port O (direction OUTPUT)) 63 | ) 64 | ) 65 | ) 66 | ) 67 | (library work 68 | (edifLevel 0) 69 | (technology (numberDefinition )) 70 | (cell and_2bits (cellType GENERIC) 71 | (view verilog (viewType NETLIST) 72 | (interface 73 | (port (array (rename ina "ina[1:0]") 2) (direction INPUT)) 74 | (port (array (rename inb "inb[1:0]") 2) (direction INPUT)) 75 | (port (array (rename out "out[1:0]") 2) (direction OUTPUT)) 76 | (port clk (direction INPUT)) 77 | (port scan_en (direction INPUT)) 78 | (port scan_in (direction INPUT)) 79 | (port scan_out (direction OUTPUT)) 80 | (port rst (direction INPUT)) 81 | ) 82 | (contents 83 | (instance (rename outZ0Z_0 "out[0]") (viewRef PRIM (cellRef FD (libraryRef UNILIB))) 84 | ) 85 | (instance (rename outZ0Z_1 "out[1]") (viewRef PRIM (cellRef FD (libraryRef UNILIB))) 86 | ) 87 | (instance (rename out_5_e_1 "out_5_e[1]") (viewRef PRIM (cellRef LUT5 (libraryRef VIRTEXR))) 88 | (property INIT (string "32'h0000F808")) 89 | ) 90 | (instance (rename out_5_e_0 "out_5_e[0]") (viewRef PRIM (cellRef LUT5 (libraryRef VIRTEXR))) 91 | (property INIT (string "32'h0000F808")) 92 | ) 93 | (instance clk_ibuf (viewRef PRIM (cellRef BUFG (libraryRef VIRTEX))) 94 | ) 95 | (instance clk_ibuf_iso (viewRef PRIM (cellRef IBUFG (libraryRef VIRTEX))) 96 | ) 97 | (instance (rename out_obuf_1 "out_obuf[1]") (viewRef PRIM (cellRef OBUF (libraryRef VIRTEX))) 98 | ) 99 | (instance (rename out_obuf_0 "out_obuf[0]") (viewRef PRIM (cellRef OBUF (libraryRef VIRTEX))) 100 | ) 101 | (instance scan_out_obuf (viewRef PRIM (cellRef OBUF (libraryRef VIRTEX))) 102 | ) 103 | (instance rst_ibuf (viewRef PRIM (cellRef IBUF (libraryRef VIRTEX))) 104 | ) 105 | (instance scan_in_ibuf (viewRef PRIM (cellRef IBUF (libraryRef VIRTEX))) 106 | ) 107 | (instance scan_en_ibuf (viewRef PRIM (cellRef IBUF (libraryRef VIRTEX))) 108 | ) 109 | (instance (rename inb_ibuf_1 "inb_ibuf[1]") (viewRef PRIM (cellRef IBUF (libraryRef VIRTEX))) 110 | ) 111 | (instance (rename inb_ibuf_0 "inb_ibuf[0]") (viewRef PRIM (cellRef IBUF (libraryRef VIRTEX))) 112 | ) 113 | (instance (rename ina_ibuf_1 "ina_ibuf[1]") (viewRef PRIM (cellRef IBUF (libraryRef VIRTEX))) 114 | ) 115 | (instance (rename ina_ibuf_0 "ina_ibuf[0]") (viewRef PRIM (cellRef IBUF (libraryRef VIRTEX))) 116 | ) 117 | (net clk_c (joined 118 | (portRef O (instanceRef clk_ibuf)) 119 | (portRef C (instanceRef outZ0Z_1)) 120 | (portRef C (instanceRef outZ0Z_0)) 121 | )) 122 | (net clk (joined 123 | (portRef clk) 124 | (portRef I (instanceRef clk_ibuf_iso)) 125 | )) 126 | (net (rename ina_c_0 "ina_c[0]") (joined 127 | (portRef O (instanceRef ina_ibuf_0)) 128 | (portRef I0 (instanceRef out_5_e_0)) 129 | )) 130 | (net (rename ina_0 "ina[0]") (joined 131 | (portRef (member ina 1)) 132 | (portRef I (instanceRef ina_ibuf_0)) 133 | )) 134 | (net (rename ina_c_1 "ina_c[1]") (joined 135 | (portRef O (instanceRef ina_ibuf_1)) 136 | (portRef I0 (instanceRef out_5_e_1)) 137 | )) 138 | (net (rename ina_1 "ina[1]") (joined 139 | (portRef (member ina 0)) 140 | (portRef I (instanceRef ina_ibuf_1)) 141 | )) 142 | (net (rename inb_c_0 "inb_c[0]") (joined 143 | (portRef O (instanceRef inb_ibuf_0)) 144 | (portRef I1 (instanceRef out_5_e_0)) 145 | )) 146 | (net (rename inb_0 "inb[0]") (joined 147 | (portRef (member inb 1)) 148 | (portRef I (instanceRef inb_ibuf_0)) 149 | )) 150 | (net (rename inb_c_1 "inb_c[1]") (joined 151 | (portRef O (instanceRef inb_ibuf_1)) 152 | (portRef I1 (instanceRef out_5_e_1)) 153 | )) 154 | (net (rename inb_1 "inb[1]") (joined 155 | (portRef (member inb 0)) 156 | (portRef I (instanceRef inb_ibuf_1)) 157 | )) 158 | (net scan_en_c (joined 159 | (portRef O (instanceRef scan_en_ibuf)) 160 | (portRef I2 (instanceRef out_5_e_0)) 161 | (portRef I2 (instanceRef out_5_e_1)) 162 | )) 163 | (net scan_en (joined 164 | (portRef scan_en) 165 | (portRef I (instanceRef scan_en_ibuf)) 166 | )) 167 | (net scan_in_c (joined 168 | (portRef O (instanceRef scan_in_ibuf)) 169 | (portRef I3 (instanceRef out_5_e_0)) 170 | )) 171 | (net scan_in (joined 172 | (portRef scan_in) 173 | (portRef I (instanceRef scan_in_ibuf)) 174 | )) 175 | (net rst_c (joined 176 | (portRef O (instanceRef rst_ibuf)) 177 | (portRef I4 (instanceRef out_5_e_0)) 178 | (portRef I4 (instanceRef out_5_e_1)) 179 | )) 180 | (net rst (joined 181 | (portRef rst) 182 | (portRef I (instanceRef rst_ibuf)) 183 | )) 184 | (net scan_out (joined 185 | (portRef O (instanceRef scan_out_obuf)) 186 | (portRef scan_out) 187 | )) 188 | (net (rename out_c_0 "out_c[0]") (joined 189 | (portRef Q (instanceRef outZ0Z_0)) 190 | (portRef I (instanceRef out_obuf_0)) 191 | (portRef I3 (instanceRef out_5_e_1)) 192 | )) 193 | (net (rename out_0 "out[0]") (joined 194 | (portRef O (instanceRef out_obuf_0)) 195 | (portRef (member out 1)) 196 | )) 197 | (net (rename out_c_1 "out_c[1]") (joined 198 | (portRef Q (instanceRef outZ0Z_1)) 199 | (portRef I (instanceRef scan_out_obuf)) 200 | (portRef I (instanceRef out_obuf_1)) 201 | )) 202 | (net (rename out_1 "out[1]") (joined 203 | (portRef O (instanceRef out_obuf_1)) 204 | (portRef (member out 0)) 205 | )) 206 | (net (rename clk_ibuf_isoZ0 "clk_ibuf_iso") (joined 207 | (portRef O (instanceRef clk_ibuf_iso)) 208 | (portRef I (instanceRef clk_ibuf)) 209 | )) 210 | (net (rename out_5_eZ0Z_0 "out_5_e[0]") (joined 211 | (portRef O (instanceRef out_5_e_0)) 212 | (portRef D (instanceRef outZ0Z_0)) 213 | )) 214 | (net (rename out_5_eZ0Z_1 "out_5_e[1]") (joined 215 | (portRef O (instanceRef out_5_e_1)) 216 | (portRef D (instanceRef outZ0Z_1)) 217 | )) 218 | ) 219 | (property mapper_option (string "")) 220 | (property orig_inst_of (string "and_2bits")) 221 | ) 222 | ) 223 | ) 224 | 225 | ) 226 | -------------------------------------------------------------------------------- /test_dir/and_2bits.edn: -------------------------------------------------------------------------------- 1 | (edif and_2bits 2 | (edifVersion 2 0 0) 3 | (edifLevel 0) 4 | (keywordMap (keywordLevel 0)) 5 | (status 6 | (written 7 | (timeStamp 2014 11 17 16 31 54) 8 | (author "Synopsys, Inc. cell ") 9 | (program "Synplify Pro" (version "H2013, mapper maprc, Build1495R")) 10 | ) 11 | ) 12 | (library VIRTEXR 13 | (edifLevel 0) 14 | (technology (numberDefinition )) 15 | (cell LUT5 (cellType GENERIC) 16 | (view PRIM (viewType NETLIST) 17 | (interface 18 | (port I0 (direction INPUT)) 19 | (port I1 (direction INPUT)) 20 | (port I2 (direction INPUT)) 21 | (port I3 (direction INPUT)) 22 | (port I4 (direction INPUT)) 23 | (port O (direction OUTPUT)) 24 | ) 25 | ) 26 | ) 27 | ) 28 | 29 | (library UNILIB 30 | (edifLevel 0) 31 | (technology (numberDefinition )) 32 | (cell FD (cellType GENERIC) 33 | (view PRIM (viewType NETLIST) 34 | (interface 35 | (port Q (direction OUTPUT)) 36 | (port D (direction INPUT)) 37 | (port C (direction INPUT)) 38 | ) 39 | ) 40 | ) 41 | ) 42 | (library VIRTEX 43 | (edifLevel 0) 44 | (technology (numberDefinition )) 45 | (cell IBUFG (cellType GENERIC) 46 | (view PRIM (viewType NETLIST) 47 | (interface 48 | (port O (direction OUTPUT)) 49 | (port I (direction INPUT)) 50 | ) 51 | ) 52 | ) 53 | (cell IBUF (cellType GENERIC) 54 | (view PRIM (viewType NETLIST) 55 | (interface 56 | (port O (direction OUTPUT)) 57 | (port I (direction INPUT)) 58 | ) 59 | ) 60 | ) 61 | (cell OBUF (cellType GENERIC) 62 | (view PRIM (viewType NETLIST) 63 | (interface 64 | (port O (direction OUTPUT)) 65 | (port I (direction INPUT)) 66 | ) 67 | ) 68 | ) 69 | (cell BUFG (cellType GENERIC) 70 | (view PRIM (viewType NETLIST) 71 | (interface 72 | (port I (direction INPUT)) 73 | (port O (direction OUTPUT)) 74 | ) 75 | ) 76 | ) 77 | ) 78 | (library work 79 | (edifLevel 0) 80 | (technology (numberDefinition )) 81 | (cell and_2bits (cellType GENERIC) 82 | (view verilog (viewType NETLIST) 83 | (interface 84 | (port (array (rename ina "ina[1:0]") 2) (direction INPUT)) 85 | (port (array (rename inb "inb[1:0]") 2) (direction INPUT)) 86 | (port (array (rename out "out[1:0]") 2) (direction OUTPUT)) 87 | (port clk (direction INPUT)) 88 | (port scan_en (direction INPUT)) 89 | (port scan_in (direction INPUT)) 90 | (port scan_out (direction OUTPUT)) 91 | (port rst (direction INPUT)) 92 | ) 93 | (contents 94 | (instance (rename outZ0Z_0 "out[0]") (viewRef PRIM (cellRef FD (libraryRef UNILIB))) 95 | ) 96 | (instance (rename outZ0Z_1 "out[1]") (viewRef PRIM (cellRef FD (libraryRef UNILIB))) 97 | ) 98 | (instance (rename out_5_e_1 "out_5_e[1]") (viewRef PRIM (cellRef LUT5 (libraryRef VIRTEXR))) 99 | (property INIT (string "32'h0000F808")) 100 | ) 101 | (instance (rename out_5_e_0 "out_5_e[0]") (viewRef PRIM (cellRef LUT5 (libraryRef VIRTEXR))) 102 | (property INIT (string "32'h0000F808")) 103 | ) 104 | (instance clk_ibuf (viewRef PRIM (cellRef BUFG (libraryRef VIRTEX))) 105 | ) 106 | (instance clk_ibuf_iso (viewRef PRIM (cellRef IBUFG (libraryRef VIRTEX))) 107 | ) 108 | (instance (rename out_obuf_1 "out_obuf[1]") (viewRef PRIM (cellRef OBUF (libraryRef VIRTEX))) 109 | ) 110 | (instance (rename out_obuf_0 "out_obuf[0]") (viewRef PRIM (cellRef OBUF (libraryRef VIRTEX))) 111 | ) 112 | (instance scan_out_obuf (viewRef PRIM (cellRef OBUF (libraryRef VIRTEX))) 113 | ) 114 | (instance rst_ibuf (viewRef PRIM (cellRef IBUF (libraryRef VIRTEX))) 115 | ) 116 | (instance scan_in_ibuf (viewRef PRIM (cellRef IBUF (libraryRef VIRTEX))) 117 | ) 118 | (instance scan_en_ibuf (viewRef PRIM (cellRef IBUF (libraryRef VIRTEX))) 119 | ) 120 | (instance (rename inb_ibuf_1 "inb_ibuf[1]") (viewRef PRIM (cellRef IBUF (libraryRef VIRTEX))) 121 | ) 122 | (instance (rename inb_ibuf_0 "inb_ibuf[0]") (viewRef PRIM (cellRef IBUF (libraryRef VIRTEX))) 123 | ) 124 | (instance (rename ina_ibuf_1 "ina_ibuf[1]") (viewRef PRIM (cellRef IBUF (libraryRef VIRTEX))) 125 | ) 126 | (instance (rename ina_ibuf_0 "ina_ibuf[0]") (viewRef PRIM (cellRef IBUF (libraryRef VIRTEX))) 127 | ) 128 | (net clk_c (joined 129 | (portRef O (instanceRef clk_ibuf)) 130 | (portRef C (instanceRef outZ0Z_1)) 131 | (portRef C (instanceRef outZ0Z_0)) 132 | )) 133 | (net clk (joined 134 | (portRef clk) 135 | (portRef I (instanceRef clk_ibuf_iso)) 136 | )) 137 | (net (rename ina_c_0 "ina_c[0]") (joined 138 | (portRef O (instanceRef ina_ibuf_0)) 139 | (portRef I0 (instanceRef out_5_e_0)) 140 | )) 141 | (net (rename ina_0 "ina[0]") (joined 142 | (portRef (member ina 1)) 143 | (portRef I (instanceRef ina_ibuf_0)) 144 | )) 145 | (net (rename ina_c_1 "ina_c[1]") (joined 146 | (portRef O (instanceRef ina_ibuf_1)) 147 | (portRef I0 (instanceRef out_5_e_1)) 148 | )) 149 | (net (rename ina_1 "ina[1]") (joined 150 | (portRef (member ina 0)) 151 | (portRef I (instanceRef ina_ibuf_1)) 152 | )) 153 | (net (rename inb_c_0 "inb_c[0]") (joined 154 | (portRef O (instanceRef inb_ibuf_0)) 155 | (portRef I1 (instanceRef out_5_e_0)) 156 | )) 157 | (net (rename inb_0 "inb[0]") (joined 158 | (portRef (member inb 1)) 159 | (portRef I (instanceRef inb_ibuf_0)) 160 | )) 161 | (net (rename inb_c_1 "inb_c[1]") (joined 162 | (portRef O (instanceRef inb_ibuf_1)) 163 | (portRef I1 (instanceRef out_5_e_1)) 164 | )) 165 | (net (rename inb_1 "inb[1]") (joined 166 | (portRef (member inb 0)) 167 | (portRef I (instanceRef inb_ibuf_1)) 168 | )) 169 | (net scan_en_c (joined 170 | (portRef O (instanceRef scan_en_ibuf)) 171 | (portRef I2 (instanceRef out_5_e_0)) 172 | (portRef I2 (instanceRef out_5_e_1)) 173 | )) 174 | (net scan_en (joined 175 | (portRef scan_en) 176 | (portRef I (instanceRef scan_en_ibuf)) 177 | )) 178 | (net scan_in_c (joined 179 | (portRef O (instanceRef scan_in_ibuf)) 180 | (portRef I3 (instanceRef out_5_e_0)) 181 | )) 182 | (net scan_in (joined 183 | (portRef scan_in) 184 | (portRef I (instanceRef scan_in_ibuf)) 185 | )) 186 | (net rst_c (joined 187 | (portRef O (instanceRef rst_ibuf)) 188 | (portRef I4 (instanceRef out_5_e_0)) 189 | (portRef I4 (instanceRef out_5_e_1)) 190 | )) 191 | (net rst (joined 192 | (portRef rst) 193 | (portRef I (instanceRef rst_ibuf)) 194 | )) 195 | (net scan_out (joined 196 | (portRef O (instanceRef scan_out_obuf)) 197 | (portRef scan_out) 198 | )) 199 | (net (rename out_c_0 "out_c[0]") (joined 200 | (portRef Q (instanceRef outZ0Z_0)) 201 | (portRef I (instanceRef out_obuf_0)) 202 | (portRef I3 (instanceRef out_5_e_1)) 203 | )) 204 | (net (rename out_0 "out[0]") (joined 205 | (portRef O (instanceRef out_obuf_0)) 206 | (portRef (member out 1)) 207 | )) 208 | (net (rename out_c_1 "out_c[1]") (joined 209 | (portRef Q (instanceRef outZ0Z_1)) 210 | (portRef I (instanceRef scan_out_obuf)) 211 | (portRef I (instanceRef out_obuf_1)) 212 | )) 213 | (net (rename out_1 "out[1]") (joined 214 | (portRef O (instanceRef out_obuf_1)) 215 | (portRef (member out 0)) 216 | )) 217 | (net (rename clk_ibuf_isoZ0 "clk_ibuf_iso") (joined 218 | (portRef O (instanceRef clk_ibuf_iso)) 219 | (portRef I (instanceRef clk_ibuf)) 220 | )) 221 | (net (rename out_5_eZ0Z_0 "out_5_e[0]") (joined 222 | (portRef O (instanceRef out_5_e_0)) 223 | (portRef D (instanceRef outZ0Z_0)) 224 | )) 225 | (net (rename out_5_eZ0Z_1 "out_5_e[1]") (joined 226 | (portRef O (instanceRef out_5_e_1)) 227 | (portRef D (instanceRef outZ0Z_1)) 228 | )) 229 | ) 230 | (property mapper_option (string "")) 231 | (property orig_inst_of (string "and_2bits")) 232 | ) 233 | ) 234 | ) 235 | (design and_2bits (cellRef and_2bits (libraryRef work)) 236 | (property mapper_option (string "")) 237 | (property PART (string "xc5vlx155tff11363") (owner "Xilinx"))) 238 | ) 239 | -------------------------------------------------------------------------------- /edn_bison.y: -------------------------------------------------------------------------------- 1 | %{ 2 | 3 | #include 4 | #include 5 | #include 6 | #include "type.h" 7 | #include "node_util.h" 8 | 9 | #ifndef YYLINENO 10 | int yylineno; 11 | #define YYLINENO yylineno 12 | #else 13 | extern int yylineno; 14 | #endif 15 | 16 | 17 | /*---------------------------------------------------------------------------------*/ 18 | /*宏定义与函数声明*/ 19 | /*---------------------------------------------------------------------------------*/ 20 | //#define TO_VIEW_LIB_REF 21 | 22 | #ifdef TO_VIEW_LIB_REF 23 | #define to_view_lib_ref 1 24 | #else 25 | #define to_view_lib_ref 0 26 | #endif 27 | 28 | extern top_EDIF *p_top_edif; 29 | 30 | 31 | void yyerror(const char *str); 32 | int yywrap(); 33 | extern int yylex(); 34 | 35 | // RESPONCE in an error 36 | void yyerror(const char *str){fprintf(stderr,"error in parsing: %s - on line number %d\n",str, yylineno);} 37 | // point of continued file reading 38 | int yywrap(){printf("come to the end of this file\n");return 1;} 39 | 40 | //virables global 41 | int prim_type_count; 42 | //virables to record some tmp number 43 | int cnt_tmp; //just a variable to use for alloction of mem for a port list 44 | 45 | %} 46 | 47 | 48 | /*---------------------------------------------------------------------------------*/ 49 | /*语意值的数据结构*/ 50 | /*---------------------------------------------------------------------------------*/ 51 | %union{ 52 | char *id; 53 | int num_value; 54 | 55 | top_EDIF *top_EDIF_NODE; 56 | //struct just for ref_lib 57 | REF_LIBRARY *ref_library_node; 58 | PRIM_CELL *prim_node; 59 | PORT *port_node; 60 | 61 | CELL *cell_node; 62 | VIEW *view_node; 63 | VIEW_CELL_LIB_REF *view_cell_lib_ref_node; 64 | PROPERTY *property_node; 65 | INSTANCE *instance_node; 66 | 67 | PORTREF *portref_node; 68 | NET *net_node; 69 | } 70 | 71 | 72 | 73 | /*---------------------------------------------------------------------------------*/ 74 | /*终结符*/ 75 | /*---------------------------------------------------------------------------------*/ 76 | 77 | /*keywords donot need a semantic value, just help to build the structure of a edif */ 78 | /*edif infomation */ 79 | %token EDIF EDIFVERSION EDIFLEVEL EKEYWORDMAP EKEYWORDLEVEL ESTATUS 80 | %token EWRITTEN ETIMESTAMP EAUTHOR EPROGRAM EVERSION 81 | /* keywords of all lib */ 82 | %token eLIBRARY eTECHNOLOGY eLIBRARYREF 83 | %token eCELL eCELLTYPE eCELLREF 84 | %token eVIEW eVIEWTYPE eVIEWREF 85 | %token eINTERFACE ePORT eARRAY eDIRECTION 86 | %token eINPUT eOUTPUT eINOUT 87 | /*tokens belong to cells in work */ 88 | %token eCONTENTS 89 | %token eINSTANCE eRENAME ePROPERTY eSTRING eINTEGER 90 | %token eNET eJOINED ePORTREF eMEMBER eINSTANCEREF 91 | /*design information */ 92 | %token eDESIGN 93 | /*-----------------------------------------------------------------------------------*/ 94 | /*标点符号token ,作为网表中的定界符 95 | /*in before name there are bus and bit by [ : ] */ 96 | %token LP RP MD 97 | /*other words just treated as words to inform the commercial infomation */ 98 | %token QUOTE 99 | %token '(' ')' 100 | 101 | /*------------------------------------------------------------------------------------*/ 102 | /*后续处理中会用到其语义值的token,因此在flex扫描之中,应该赋予其yylval 103 | 104 | /*library name */ 105 | //%token eUNILIB eVIRTEX eVIRTEXR 106 | %token eWORK 107 | /*cell的基本信息*/ 108 | %token eGENERIC ePRIM eNETLIST 109 | /*LUT的初始化值*/ 110 | %token eINITIAL_VALUE 111 | /*其他标识符 identifier */ 112 | %token eIDENTIFIER eWORD_QUOTED 113 | /* 出现在EDN网表中的数字 */ 114 | %token eNUMBER 115 | 116 | 117 | 118 | 119 | 120 | /*---------------------------------------------------------------------------------*/ 121 | /*非终结符*/ 122 | /*----------------------------------------------------------------------------------*/ 123 | %type top_edif 124 | 125 | %type ref_library_list ref_library 126 | %type prim_list prim_cell 127 | %type interface port_list port 128 | 129 | %type library_work cell_list cell 130 | %type view 131 | %type instance_list instance 132 | %type view_cell_lib_ref 133 | %type property_list property 134 | 135 | %type net_list net 136 | %type portref_list portref 137 | %type rename lib_ref design 138 | %error-verbose 139 | %% 140 | 141 | /*---------------------------------------------------------------------------------*/ 142 | /*网表语法描述开始*/ 143 | /*----------------------------------------------------------------------------------*/ 144 | /* 1 top_edif */ 145 | top_edif : '(' EDIF eIDENTIFIER edif_info ref_library_list library_work design ')' 146 | {p_top_edif=createEdif($3,$5,$6,$7);$$=p_top_edif=createEdif($3,$5,$6,$7);} 147 | ; 148 | 149 | /*---------------------------------------------------------------------------------------*/ 150 | /*1.1 edif_info begin */ 151 | /*---------------------------------------------------------------------------------------*/ 152 | edif_info : edif_version edif_level keywordmap edif_status 153 | ; 154 | edif_version: '(' EDIFVERSION eNUMBER eNUMBER eNUMBER ')' 155 | ; 156 | edif_level : '(' EDIFLEVEL eNUMBER ')' 157 | ; 158 | keywordmap : '(' EKEYWORDMAP '(' EKEYWORDLEVEL eNUMBER ')'')' 159 | ; 160 | edif_status : '(' ESTATUS '(' EWRITTEN time_stamp author program ')' ')' 161 | ; 162 | time_stamp : '(' ETIMESTAMP eNUMBER eNUMBER eNUMBER eNUMBER eNUMBER eNUMBER ')' 163 | ; 164 | author : '(' EAUTHOR QUOTE quoted_info_list QUOTE ')' 165 | ; 166 | program : '(' EPROGRAM QUOTE quoted_info_list QUOTE version ')' 167 | ; 168 | version : '(' EVERSION QUOTE quoted_info_list QUOTE ')' 169 | ; 170 | quoted_info_list : eWORD_QUOTED 171 | |quoted_info_list eWORD_QUOTED 172 | |quoted_info_list eNUMBER 173 | |eNUMBER 174 | ; 175 | 176 | 177 | /*---------------------------------------------------------------------------------------*/ 178 | /*1.2 ref_library begin */ 179 | /*---------------------------------------------------------------------------------------*/ 180 | 181 | ref_library_list :ref_library_list ref_library 182 | {cnt_tmp++;$$=newRef_Lib_List_Entry($1,$2,cnt_tmp);} 183 | |ref_library 184 | {cnt_tmp=1;$$=newRef_Lib_List($1);} 185 | ; 186 | 187 | ref_library : '(' eLIBRARY eIDENTIFIER lib_info prim_list ')' 188 | {$$=createRef_Lib($3,$5);} 189 | ; 190 | 191 | prim_list :prim_cell {cnt_tmp=1;$$=newPrim_List($1);} 192 | |prim_list prim_cell {cnt_tmp++;$$=newPrim_List_Entry($1,$2,cnt_tmp);} 193 | ; 194 | 195 | prim_cell :'(' eCELL eIDENTIFIER '(' eCELLTYPE eGENERIC ')' '(' eVIEW ePRIM '('eVIEWTYPE eNETLIST ')'interface')'')' 196 | {$$=createPrim($3,$6,$10,$13,$15);} 197 | ; 198 | 199 | 200 | //all the view have interface ,they are same in lib_work and lib_XILINX 201 | //interface below 202 | interface : '(' eINTERFACE port_list ')' {$$=$3;} 203 | ; 204 | 205 | port_list : port_list port {cnt_tmp++;$$=newPort_List_Entry($1,$2,cnt_tmp);} 206 | | port {cnt_tmp=1;$$=newPort_List($1);} 207 | ; 208 | port : '(' ePORT '(' eARRAY rename eNUMBER ')''(' eDIRECTION eINPUT ')' ')' {$$=createPort($6,$5,1);} 209 | | '(' ePORT '(' eARRAY rename eNUMBER ')''(' eDIRECTION eOUTPUT ')' ')' {$$=createPort($6,$5,2);} 210 | | '(' ePORT '(' eARRAY rename eNUMBER ')''(' eDIRECTION eINOUT ')' ')' {$$=createPort($6,$5,3);} 211 | 212 | | '(' ePORT rename '(' eDIRECTION eINPUT ')' ')' {$$=createPort(1,$3,1);} 213 | | '(' ePORT rename '(' eDIRECTION eOUTPUT ')' ')' {$$=createPort(1,$3,2);} 214 | | '(' ePORT rename '(' eDIRECTION eINOUT ')' ')' {$$=createPort(1,$3,3);} 215 | 216 | | '(' ePORT eIDENTIFIER '(' eDIRECTION eINPUT ')' ')' {$$=createPort(1,$3,1);} 217 | | '(' ePORT eIDENTIFIER '(' eDIRECTION eOUTPUT ')' ')' {$$=createPort(1,$3,2);} 218 | | '(' ePORT eIDENTIFIER '(' eDIRECTION eINOUT ')' ')' {$$=createPort(1,$3,3);} 219 | 220 | ; 221 | //interface above 222 | 223 | 224 | /*---------------------------------------------------------------------------------------*/ 225 | // 1.3 library_work begin 226 | /*---------------------------------------------------------------------------------------*/ 227 | 228 | library_work :'('eLIBRARY eWORK lib_info cell_list ')' 229 | {$$=$5;} 230 | ; 231 | lib_info : '(' EDIFLEVEL eNUMBER ')' '(' eTECHNOLOGY '('eIDENTIFIER ')' ')' 232 | ; 233 | //cell begins 234 | cell_list :cell_list cell {cnt_tmp++;$$=newCell_List_Entry($1,$2,cnt_tmp);} 235 | |cell {cnt_tmp=1;$$=newCell_List($1);} 236 | ; 237 | 238 | cell : '(' eCELL eIDENTIFIER '(' eCELLTYPE eGENERIC ')' view ')' 239 | {$$=createCell($3,$6,$8);} 240 | ; 241 | 242 | view : '(' eVIEW eIDENTIFIER '('eVIEWTYPE eNETLIST ')' interface '(' eCONTENTS instance_list net_list ')' property_list ')' 243 | {$$=createView($3,$6,$8,$11,$12,$14);} 244 | ; 245 | 246 | //instance list below 247 | instance_list: instance_list instance {cnt_tmp++;$$=newInstance_List_Entry($1,$2,cnt_tmp);} 248 | | instance {cnt_tmp=1;$$=newInstance_List($1);} 249 | 250 | ; 251 | instance : '(' eINSTANCE eIDENTIFIER view_cell_lib_ref property_list ')' 252 | { 253 | $$=createInstance($3,$4,$5); 254 | printf("instance : %s find\n",$3); 255 | } 256 | | '(' eINSTANCE rename view_cell_lib_ref property_list ')' 257 | { 258 | $$=createInstance($3,$4,$5); 259 | printf("instance : %s find\n",$3); 260 | } 261 | | '(' eINSTANCE eIDENTIFIER view_cell_lib_ref ')' 262 | { 263 | $$=createInstance($3,$4,NULL); 264 | printf("instance : %s find\n",$3); 265 | } 266 | | '(' eINSTANCE rename view_cell_lib_ref')' 267 | { 268 | $$=createInstance($3,$4,NULL); 269 | printf("instance : %s find\n",$3); 270 | } 271 | 272 | ; 273 | /* 274 | instance_property_list :instance_property_list instance_property 275 | |instance_property 276 | 277 | ; 278 | instance_property : '(' ePROPERTY eINIT '(' eSTRING QUOTE eINITIAL_VALUE QUOTE ')' ')' 279 | //the lut property initiated a value 280 | {$$=createInstance_Property("INIT",$7);printf("a instance initiated by a value: %s find\n",$7);} 281 | |'(' ePROPERTY eIDENTIFIER '(' eSTRING QUOTE eINITIAL_VALUE QUOTE ')' ')' 282 | {$$=createInstance_Property($3,$7);} 283 | |'(' ePROPERTY eIDENTIFIER '(' eSTRING QUOTE eWORD_QUOTED QUOTE ')' ')' 284 | {$$=createInstance_Property($3,$7);} 285 | |'(' ePROPERTY eIDENTIFIER '(' eIDENTIFIER eNUMBER ')' ')' 286 | {$$=createInstance_Property($3,$5);} 287 | ; 288 | */ 289 | rename : '(' eRENAME eIDENTIFIER QUOTE eWORD_QUOTED LP eNUMBER MD eNUMBER RP QUOTE ')' { $$=$3;} 290 | | '(' eRENAME eIDENTIFIER QUOTE eWORD_QUOTED LP eNUMBER RP QUOTE ')' { $$=$3;} 291 | | '(' eRENAME eIDENTIFIER QUOTE eWORD_QUOTED QUOTE ')' { $$=$3;} 292 | 293 | ; 294 | 295 | view_cell_lib_ref: '(' eVIEWREF eIDENTIFIER '(' eCELLREF eIDENTIFIER ')' ')' 296 | {$$=decideInstance_Ref($3,$6,"work");} 297 | | '(' eVIEWREF ePRIM '(' eCELLREF eIDENTIFIER lib_ref ')' ')' 298 | {$$=decideInstance_Ref("PRIM",$6,$7);} 299 | ; 300 | 301 | lib_ref : '(' eLIBRARYREF eIDENTIFIER ')' {$$=$3; if(to_view_lib_ref) printf("%s lib called\n",$3);} 302 | /* | '(' eLIBRARYREF eWORK ')' {$$="work";if(to_view_lib_ref) printf("WORK lib called\n");}*/ 303 | ; 304 | //intance list above 305 | 306 | 307 | //net_list below 308 | 309 | net_list :net_list net {cnt_tmp++;$$=newNet_List_Entry($1,$2,cnt_tmp);} 310 | |net {cnt_tmp=1;$$=newNet_List($1);} 311 | ; 312 | net :'(' eNET eIDENTIFIER '(' eJOINED portref_list ')' property_list')' {$$=findNet($3,$6);printf("net : %s find\n",$3);} 313 | |'(' eNET rename '(' eJOINED portref_list ')' property_list ')' {$$=findNet($3,$6);printf("net : %s find\n",$3);} 314 | |'(' eNET eIDENTIFIER '(' eJOINED portref_list ')' ')' {$$=findNet($3,$6);printf("net : %s find\n",$3);} 315 | |'(' eNET rename '(' eJOINED portref_list ')' ')' {$$=findNet($3,$6);printf("net : %s find\n",$3);} 316 | ; 317 | 318 | portref_list :portref_list portref {cnt_tmp++;$$=newPortref_List_Entry($1,$2,cnt_tmp);} 319 | |portref {cnt_tmp=1;$$=newPortref_List($1);} 320 | ; 321 | 322 | portref :'(' ePORTREF eIDENTIFIER '(' eINSTANCEREF eIDENTIFIER ')' ')' 323 | {$$=createPortref(1,$3,0,$6);/*Joined to INSTANCE'S PORT*/} 324 | |'(' ePORTREF '(' eMEMBER eIDENTIFIER eNUMBER ')' ')' 325 | {$$=createPortref(0,$5,$6,NULL);/*Joined to THIS CELL'S PORT bus*/} 326 | |'(' ePORTREF '(' eMEMBER eIDENTIFIER eNUMBER ')' '(' eINSTANCEREF eIDENTIFIER ')' ')' 327 | {$$=createPortref(0,$5,$6,$10);/*Joined to THIS CELL'S PORT bus*/} 328 | |'(' ePORTREF eIDENTIFIER ')' 329 | {$$=createPortref(0,$3,0,NULL);/*Joined to THIS CELL'S PORT*/} 330 | ; 331 | //net_lsit above 332 | //contents above 333 | 334 | //properties below 335 | property_list :property_list property {cnt_tmp++;$$=newProperty_List_Entry($1,$2,cnt_tmp);} 336 | |property {cnt_tmp=1;$$=newProperty_List($1);} 337 | ; 338 | property :'(' ePROPERTY eIDENTIFIER '(' eINTEGER eNUMBER ')' ')' {$$=createProperty_Integer($3,"integer",$6);} 339 | |'(' ePROPERTY eIDENTIFIER '(' eSTRING QUOTE eINITIAL_VALUE QUOTE ')' ')' {$$=createProperty($3,"string" ,$7);} 340 | |'(' ePROPERTY eIDENTIFIER '(' eSTRING QUOTE eWORD_QUOTED QUOTE ')' ')' {$$=createProperty($3,"string" ,$7);} 341 | |'(' ePROPERTY eIDENTIFIER '(' eSTRING QUOTE QUOTE ')' ')' {$$=createProperty($3,"string" ,NULL);} 342 | 343 | ; 344 | //properties above 345 | /*---------------------------------------------------------------------------------------*/ 346 | 347 | 348 | /*---------------------------------------------------------------------------------------*/ 349 | //1.4 design begins 350 | design: '(' eDESIGN eIDENTIFIER '('eCELLREF eIDENTIFIER '(' eLIBRARYREF eWORK ')'')' design_property')' 351 | {$$=$3;printf("Congtulations !!!!!!find a design in this edn file successfully\n");} 352 | ; 353 | design_property:'(' ePROPERTY eIDENTIFIER '(' eSTRING QUOTE eWORD_QUOTED QUOTE ')' '('eIDENTIFIER QUOTE eWORD_QUOTED QUOTE ')' ')' 354 | {/*这一行的property是为design所设计的,所以暂时在这里没有考虑其语意值*/} 355 | ; 356 | %% 357 | 358 | 359 | -------------------------------------------------------------------------------- /node_util.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include "type.h" 6 | 7 | #define print_node 0 8 | //#define TRACE 9 | 10 | #ifdef TRACE 11 | #define print_node 1 12 | #endif 13 | 14 | 15 | #define NEW_LIST(LIST_TYPE,POINTER); \ 16 | LIST_TYPE *POINTER;\ 17 | POINTER=(LIST_TYPE *)malloc(sizeof(LIST_TYPE));\ 18 | if(POINTER==NULL){\ 19 | printf("error:malloc in newList();\n");\ 20 | exit(1);\ 21 | }\ 22 | 23 | #define NEW_ENTRY(LIST_TYPE,EXISTED,ITEM_AFTER_ADD,POINTER); \ 24 | { \ 25 | POINTER=(LIST_TYPE*)realloc(EXISTED,ITEM_AFTER_ADD*sizeof(LIST_TYPE));\ 26 | if(POINTER==NULL){\ 27 | printf("error: realloc() in newList_Entry();\n");\ 28 | exit(1);\ 29 | }\ 30 | } 31 | 32 | 33 | #define SAFE_STRCPY(DST,SOUR,MAX_DST_LENG); \ 34 | { \ 35 | if(strlen(SOUR)>MAX_DST_LENG) {\ 36 | printf("Error:source str length >MAX_ID_LENGTH");\ 37 | printf("The source string length is %d",strlen(SOUR));\ 38 | exit(1);\ 39 | }\ 40 | else strcpy(DST,SOUR);\ 41 | } 42 | //----------------------------------------------------------------------------------------------------------- 43 | 44 | top_EDIF *createEdif(char *edif_name,REF_LIBRARY *reflib_list,CELL *work_cells,char *design_name){ 45 | top_EDIF *p1; 46 | p1=(top_EDIF *)malloc(sizeof(top_EDIF)); 47 | 48 | SAFE_STRCPY(p1->edif_name,edif_name,20); 49 | p1->reflib_cnt =reflib_list->list_cnt; 50 | p1->reflib_list =reflib_list; 51 | p1->work_cells_cnt =work_cells->list_cnt; 52 | p1->work_cells =work_cells; 53 | SAFE_STRCPY(p1->design_name,design_name,20); 54 | return p1; 55 | } 56 | //----------------------------------------------------------------------------------------------------------- 57 | // 58 | //----------------------------------------------------------------------------------------------------------- 59 | PORT *createPort(int number,char *name,int dir){ 60 | NEW_LIST(PORT,p1); 61 | SAFE_STRCPY(p1->port_name,name,MAX_PRIM_ID_LENGTH); 62 | p1->port_member_count =number; 63 | p1->d =dir; 64 | if(print_node){ 65 | printf("Create port:%s,dir(%d),width(%d)\n",p1->port_name,p1->d,p1->port_member_count); 66 | } 67 | return p1; 68 | } 69 | 70 | PORT *newPort_List(PORT *first_port){ 71 | NEW_LIST(PORT,p1); 72 | p1->list_cnt =1; 73 | /*p1->port_name=(char *)malloc(sizeof(char)*(strlen(first_port->port_name)));//为p1的字符串指针成员赋值之前必须,为之分配内存 74 | if(p1->port_name==NULL) 75 | printf("malloc error for p1->port_name in newList()\n"); 76 | p1->port_name =strcpy(p1->port_name,first_port->port_name); 77 | */ 78 | //将此空间中的第一个元素,填充为first_port的内容; 79 | strcpy(p1->port_name,first_port->port_name); 80 | p1->port_member_count =first_port->port_member_count; 81 | p1->d =first_port->d; 82 | if(print_node){ 83 | printf("New port list;\n"); 84 | } 85 | //free(first_port->port_name); 86 | free(first_port); 87 | return p1; 88 | } 89 | 90 | PORT *newPort_List_Entry(PORT *existed_list,PORT *new_entry,int port_number_now){ 91 | 92 | PORT *p1; 93 | NEW_ENTRY(PORT,existed_list,port_number_now,p1); 94 | /*p1=(PORT *)realloc(existed_list,port_number_now*sizeof(PORT)); 95 | if(p1==NULL) 96 | {printf("error: realloc() in newList_Entry();\n");exit(1);} 97 | */ 98 | p1->list_cnt=port_number_now;//用第一个元素的一个成员来记录这个list所含的元素的个数 99 | PORT *p2; 100 | p2=p1+port_number_now-1; 101 | strcpy(p1->port_name,new_entry->port_name); 102 | //p2->port_name =(char *)malloc(sizeof(char)*strlen((new_entry->port_name))); 103 | //p2->port_name =strcpy(p2->port_name,new_entry->port_name); 104 | p2->port_member_count =new_entry->port_member_count; 105 | p2->d =new_entry->d; 106 | if(print_node){ 107 | printf("Add new entry.list_cnt is :%d\n",port_number_now); 108 | } 109 | //free(new_entry->port_name); 110 | free(new_entry); 111 | return p1; 112 | } 113 | 114 | 115 | //----------------------------------------------------------------------------------------------------------- 116 | // 参考库中的原语识别,构建列表的函数 117 | //----------------------------------------------------------------------------------------------------------- 118 | PRIM_CELL *createPrim(char *cell,int cell_type,int view,int view_type,PORT *interface){ 119 | NEW_LIST(PRIM_CELL,p1); 120 | //p1->ID_MALLOC(cell,cell); 121 | //p1->cell =strcpy(p1->cell,cell); 122 | SAFE_STRCPY(p1->cell,cell,MAX_PRIM_ID_LENGTH); 123 | p1->celltype =cell_type; 124 | p1->view =view; 125 | p1->viewtype =view_type; 126 | p1->port_number=interface->list_cnt; 127 | p1->interface =interface; 128 | return p1; 129 | } 130 | 131 | PRIM_CELL *newPrim_List(PRIM_CELL *first_prim_cell){ 132 | NEW_LIST(PRIM_CELL,p1); 133 | // p1->ID_MALLOC(cell,first_prim_cell->cell); 134 | // p1->cell =strcpy(p1->cell,first_prim_cell->cell); 135 | p1->list_cnt=1; 136 | strcpy(p1->cell,first_prim_cell->cell); 137 | p1->celltype =first_prim_cell->celltype; 138 | p1->view =first_prim_cell->view; 139 | p1->viewtype =first_prim_cell->viewtype; 140 | p1->port_number =first_prim_cell->list_cnt; 141 | p1->interface =first_prim_cell->interface; 142 | //由于在前面创造的interface存放在内存空间中的连续块中,而且没有被释放,所以只需要记住它的起始地址就好了。 143 | //并且这些内存空间是需要后面分析使用的,所以在main()运行期间一直不释放 144 | //free(first_prim_cell->cell); 145 | free(first_prim_cell); 146 | return p1; 147 | } 148 | 149 | PRIM_CELL *newPrim_List_Entry(PRIM_CELL *existed_list,PRIM_CELL *new_entry,int list_cnt){ 150 | 151 | PRIM_CELL *p1; 152 | NEW_ENTRY(PRIM_CELL,existed_list,list_cnt,p1); 153 | 154 | p1->list_cnt=list_cnt; 155 | //对最后一个element赋值 156 | PRIM_CELL *p2; 157 | p2=p1+list_cnt-1; 158 | //p2->ID_MALLOC(cell,new_entry->cell); 159 | //p2->cell =strcpy(p2->cell,new_entry->cell); 160 | strcpy(p1->cell,new_entry->cell); 161 | p2->view =new_entry->view; 162 | p2->viewtype =new_entry->viewtype; 163 | p2->port_number =new_entry->list_cnt; 164 | p2->interface =new_entry->interface; 165 | 166 | //释放无用内存 167 | //free(new_entry->cell); 168 | free(new_entry); 169 | return p1; 170 | } 171 | 172 | 173 | //----------------------------------------------------------------------------------------------------------- 174 | //构建参考库,参考库列表的函数 175 | //----------------------------------------------------------------------------------------------------------- 176 | REF_LIBRARY *createRef_Lib(char *lib_name,PRIM_CELL *prim_list){ 177 | NEW_LIST(REF_LIBRARY,p1); 178 | SAFE_STRCPY(p1->lib_name,lib_name,MAX_PRIM_ID_LENGTH); 179 | p1->cell_count =prim_list->list_cnt; 180 | p1->prim_in_lib =prim_list; 181 | if(print_node) printf("\n\nNOTE:Create ref_lib %s successfully\n\n",p1->lib_name); 182 | return p1; 183 | } 184 | 185 | REF_LIBRARY *newRef_Lib_List(REF_LIBRARY *first_ref_lib){ 186 | NEW_LIST(REF_LIBRARY,p1); 187 | p1->list_cnt =1; 188 | strcpy(p1->lib_name,first_ref_lib->lib_name); 189 | p1->cell_count =first_ref_lib->cell_count; 190 | p1->prim_in_lib =first_ref_lib->prim_in_lib; 191 | free(first_ref_lib); 192 | if(print_node) printf("\n\nNOTE:New ref_lib list successfully\n\n"); 193 | return p1; 194 | } 195 | REF_LIBRARY *newRef_Lib_List_Entry(REF_LIBRARY *existed_list,REF_LIBRARY *new_entry,int list_cnt){ 196 | REF_LIBRARY *p1; 197 | NEW_ENTRY(REF_LIBRARY,existed_list,list_cnt,p1); 198 | p1->list_cnt =list_cnt; 199 | REF_LIBRARY *p2; 200 | p2=p1+list_cnt-1; 201 | strcpy(p2->lib_name,new_entry->lib_name); 202 | p2->cell_count =new_entry->list_cnt; 203 | p2->prim_in_lib =new_entry->prim_in_lib; 204 | if(print_node) printf("\n\nNOTE:Add a ref_lib %s successfully\n\n",p2->lib_name); 205 | free(new_entry); 206 | return p1; 207 | } 208 | 209 | 210 | 211 | //----------------------------------------------------------------------------------------------------------- 212 | //构建一个INSTANCE或者INSTANCE_LIST的函数 213 | //----------------------------------------------------------------------------------------------------------- 214 | PROPERTY *createProperty(char *property_id,char *property_type, char *property_value){ 215 | NEW_LIST(PROPERTY,p1); 216 | SAFE_STRCPY(p1->property_id, property_id, MAX_PRIM_ID_LENGTH); 217 | SAFE_STRCPY(p1->property_type, property_type, MAX_PRIM_ID_LENGTH); 218 | SAFE_STRCPY((p1->property_value).property_string_value, property_value, MAX_PRIM_ID_LENGTH); 219 | return p1; 220 | } 221 | PROPERTY *createProperty_Integer(char *property_id,char *property_type, int property_value){ 222 | NEW_LIST(PROPERTY,p1); 223 | SAFE_STRCPY(p1->property_id, property_id, MAX_PRIM_ID_LENGTH); 224 | SAFE_STRCPY(p1->property_type, property_type, MAX_PRIM_ID_LENGTH); 225 | p1->property_value.property_num_value=property_value; 226 | return p1; 227 | } 228 | 229 | PROPERTY *newProperty_List(PROPERTY *first_property){ 230 | NEW_LIST(PROPERTY,p1); 231 | strcpy(p1->property_id, first_property->property_id); 232 | strcpy(p1->property_type, first_property->property_type); 233 | int tmp; 234 | tmp=(!strcmp(first_property->property_type,"string"))?1:(!strcmp(first_property->property_type,"integer"))?2:3; 235 | switch(tmp) 236 | { 237 | case(1) :{ 238 | strcpy(p1->property_value.property_string_value,first_property->property_value.property_string_value); 239 | break; 240 | } 241 | case(2):{ 242 | p1->property_value.property_num_value=first_property->property_value.property_num_value; 243 | break; 244 | } 245 | default:{printf("Warning:Find a property is neither integer nor string\n");exit(1);} 246 | } 247 | free(first_property); 248 | return p1; 249 | } 250 | 251 | PROPERTY *newProperty_List_Entry(PROPERTY *existed_list, PROPERTY *new_entry, int list_cnt){ 252 | PROPERTY *p1; 253 | NEW_ENTRY(PROPERTY,existed_list,list_cnt,p1); 254 | p1->list_cnt=list_cnt; 255 | PROPERTY *p2; 256 | p2=p1+list_cnt-1; 257 | strcpy(p2->property_id, new_entry->property_id); 258 | strcpy(p2->property_type, new_entry->property_type); 259 | int tmp; 260 | tmp=(!strcmp(new_entry->property_type,"string"))?1:(!strcmp(new_entry->property_type,"integer"))?2:3; 261 | switch(tmp) 262 | { 263 | case(1) :strcpy(p1->property_value.property_string_value,new_entry->property_value.property_string_value);break; 264 | case(2):p1->property_value.property_num_value=new_entry->property_value.property_num_value;break; 265 | default:printf("Warning:Find a property is neither integer nor string\n");exit(1); 266 | } 267 | free(new_entry); 268 | return p1; 269 | } 270 | 271 | VIEW_CELL_LIB_REF *decideInstance_Ref(char *viewref_id,char *cellref_id, char *libref_id){ 272 | NEW_LIST(VIEW_CELL_LIB_REF,p1); 273 | SAFE_STRCPY(p1->viewref_id,viewref_id,MAX_PRIM_ID_LENGTH); 274 | SAFE_STRCPY(p1->cellref_id,cellref_id,MAX_PRIM_ID_LENGTH); 275 | SAFE_STRCPY(p1->libref_id, libref_id,MAX_USER_ID_LENGTH); 276 | return p1; 277 | } 278 | 279 | INSTANCE *createInstance(char *name, VIEW_CELL_LIB_REF *view_cell_lib_id, PROPERTY * p_instance_property){ 280 | NEW_LIST(INSTANCE,p1); 281 | VIEW_CELL_LIB_REF *tmp; 282 | tmp=view_cell_lib_id; 283 | //INSTANCE的类型是有限种的,根据它的view_cell_lib_ref的信息来判断是什么类型. 284 | //类型 用一个整数来表示 285 | if(strcmp(tmp->libref_id,"work")==0) 286 | p1->instance_type=3; 287 | else if(strcmp(tmp->viewref_id,"PRIM")==0) 288 | p1->instance_type=1; 289 | else 290 | p1->instance_type=2; 291 | SAFE_STRCPY(p1->name,name,MAX_USER_ID_LENGTH); 292 | 293 | //INSTANCE内部包含的两个指针型变量 294 | p1->view_cell_lib_id =view_cell_lib_id; 295 | if(p_instance_property!=NULL) 296 | p1->p_instance_property =p_instance_property; 297 | else p1->p_instance_property=NULL; 298 | return p1; 299 | } 300 | 301 | INSTANCE *newInstance_List(INSTANCE *first_instance){ 302 | INSTANCE *p1; 303 | p1=first_instance; 304 | p1->list_cnt=1; 305 | return p1; 306 | } 307 | 308 | INSTANCE *newInstance_List_Entry(INSTANCE *existed_list, INSTANCE *new_entry,int list_cnt){ 309 | INSTANCE *p1; 310 | NEW_ENTRY(INSTANCE,existed_list,list_cnt,p1); 311 | INSTANCE *p2; 312 | 313 | p1->list_cnt=list_cnt; 314 | p2=p1+list_cnt-1; 315 | if(strcmp((new_entry->view_cell_lib_id)->libref_id,"work")==0) 316 | p2->instance_type=3; 317 | else if(strcmp((new_entry->view_cell_lib_id)->viewref_id,"PRIM")==0) 318 | p2->instance_type=1; 319 | else 320 | p2->instance_type=2; 321 | 322 | strcpy(p2->name,new_entry->name); 323 | p2->view_cell_lib_id =new_entry->view_cell_lib_id; 324 | 325 | if((new_entry->p_instance_property)!=NULL) 326 | p2->p_instance_property =new_entry->p_instance_property; 327 | else p2->p_instance_property=NULL; 328 | 329 | free(new_entry); 330 | return p1; 331 | 332 | } 333 | 334 | 335 | //----------------------------------------------------------------------------------------------------------- 336 | //构建NET的函数 337 | //----------------------------------------------------------------------------------------------------------- 338 | 339 | PORTREF *createPortref(int portref_type,char *portref_id,int bit_location,char *instanceref_id){ 340 | NEW_LIST(PORTREF,p1); 341 | //存在bug,因为传进来的instanceref_id可能会是一个NULL指针,所以必须carefully 342 | p1->portref_type =portref_type; 343 | SAFE_STRCPY(p1->portref_id,portref_id,MAX_PRIM_ID_LENGTH); 344 | if (instanceref_id!=NULL){ 345 | SAFE_STRCPY(p1->instanceref_id,instanceref_id,MAX_USER_ID_LENGTH); 346 | } 347 | p1->bit_location=bit_location; 348 | return p1; 349 | } 350 | PORTREF *newPortref_List(PORTREF *first_portref){ 351 | NEW_LIST(PORTREF,p1); 352 | p1->portref_type =first_portref->portref_type; 353 | strcpy(p1->portref_id,first_portref->portref_id); 354 | p1->bit_location =first_portref->bit_location; 355 | strcpy(p1->instanceref_id,first_portref->instanceref_id); 356 | free(first_portref); 357 | return p1; 358 | } 359 | 360 | PORTREF *newPortref_List_Entry(PORTREF *existed_list,PORTREF *new_entry,int list_cnt){ 361 | 362 | PORTREF *p1; 363 | NEW_ENTRY(PORTREF,existed_list,list_cnt,p1); 364 | p1->list_cnt=list_cnt; 365 | PORTREF *p2; 366 | p2=p1+list_cnt-1; 367 | p2->portref_type =new_entry->portref_type; 368 | strcpy(p2->portref_id,new_entry->portref_id); 369 | p2->bit_location =new_entry->bit_location; 370 | strcpy(p2->instanceref_id,new_entry->instanceref_id); 371 | free(new_entry); 372 | return p1; 373 | } 374 | 375 | 376 | NET *findNet(char *net_name,PORTREF *portref_list){ 377 | NEW_LIST(NET,p1); 378 | SAFE_STRCPY(p1->net_name,net_name,MAX_USER_ID_LENGTH); 379 | p1->portref_number=portref_list->list_cnt; 380 | p1->portref_list =portref_list; 381 | return p1; 382 | } 383 | 384 | 385 | 386 | NET *newNet_List(NET *first_net){ 387 | NEW_LIST(NET,p1); 388 | strcpy(p1->net_name,first_net->net_name); 389 | p1->portref_number=first_net->portref_number; 390 | p1->portref_list =first_net->portref_list; 391 | free(first_net); 392 | return p1; 393 | } 394 | 395 | NET *newNet_List_Entry(NET *existed_list,NET *new_entry,int list_cnt){ 396 | NET *p1; 397 | NEW_ENTRY(NET,existed_list,list_cnt,p1); 398 | p1->list_cnt=list_cnt; 399 | NET *p2; 400 | p2=p1+list_cnt-1; 401 | strcpy(p2->net_name,new_entry->net_name); 402 | p2->portref_number=new_entry->portref_number; 403 | p2->portref_list =new_entry->portref_list; 404 | free(new_entry); 405 | return p1; 406 | } 407 | 408 | //----------------------------------------------------------------------------------------------------------- 409 | //构建工作库中的CELL的函数 410 | //----------------------------------------------------------------------------------------------------------- 411 | 412 | VIEW *createView(char *view ,int viewtype,PORT *interface,INSTANCE *instance_list,NET *net_list ,PROPERTY *property_list){ 413 | VIEW *p1; 414 | p1=(VIEW *)malloc(sizeof(VIEW)); 415 | int tmp; 416 | tmp=strcmp(view,"netlist")?1:strcmp(view,"verilog")?2:3; 417 | p1->view=tmp; 418 | p1->viewtype=viewtype; 419 | p1->port_number=interface->list_cnt; 420 | p1->interface=interface; 421 | p1->instance_number=instance_list->list_cnt; 422 | p1->instance_list=instance_list; 423 | p1->net_number=net_list->list_cnt; 424 | p1->net_list=net_list; 425 | p1->property_number=property_list->list_cnt; 426 | p1->property_list=property_list; 427 | return p1; 428 | } 429 | CELL *createCell(char *cell,int celltype,VIEW *view){ 430 | CELL *p1; 431 | p1=(CELL *)malloc(sizeof(CELL)); 432 | SAFE_STRCPY(p1->cell,cell,MAX_PRIM_ID_LENGTH); 433 | p1->celltype=celltype; 434 | p1->view=view; 435 | return p1; 436 | } 437 | CELL *newCell_List(CELL *first_cell){ 438 | CELL *p1; 439 | p1=first_cell; 440 | p1->list_cnt=1; 441 | return p1; 442 | } 443 | CELL *newCell_List_Entry(CELL *existed_list,CELL *new_entry,int list_cnt){ 444 | CELL *p1; 445 | NEW_ENTRY(CELL,existed_list,list_cnt,p1); 446 | p1->list_cnt=list_cnt; 447 | CELL *p2; 448 | p2=p1+list_cnt-1; 449 | strcpy(p2->cell,new_entry->cell); 450 | p2->celltype=new_entry->celltype; 451 | p2->view=new_entry->view; 452 | free(new_entry); 453 | return p1; 454 | } 455 | 456 | 457 | -------------------------------------------------------------------------------- /edn_flex.c: -------------------------------------------------------------------------------- 1 | #line 2 "edn_flex.c" 2 | 3 | #line 4 "edn_flex.c" 4 | 5 | #define YY_INT_ALIGNED short int 6 | 7 | /* A lexical scanner generated by flex */ 8 | 9 | #define FLEX_SCANNER 10 | #define YY_FLEX_MAJOR_VERSION 2 11 | #define YY_FLEX_MINOR_VERSION 5 12 | #define YY_FLEX_SUBMINOR_VERSION 35 13 | #if YY_FLEX_SUBMINOR_VERSION > 0 14 | #define FLEX_BETA 15 | #endif 16 | 17 | /* First, we deal with platform-specific or compiler-specific issues. */ 18 | 19 | /* begin standard C headers. */ 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | /* end standard C headers. */ 26 | 27 | /* flex integer type definitions */ 28 | 29 | #ifndef FLEXINT_H 30 | #define FLEXINT_H 31 | 32 | /* C99 systems have . Non-C99 systems may or may not. */ 33 | 34 | #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 35 | 36 | /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, 37 | * if you want the limit (max/min) macros for int types. 38 | */ 39 | #ifndef __STDC_LIMIT_MACROS 40 | #define __STDC_LIMIT_MACROS 1 41 | #endif 42 | 43 | #include 44 | typedef int8_t flex_int8_t; 45 | typedef uint8_t flex_uint8_t; 46 | typedef int16_t flex_int16_t; 47 | typedef uint16_t flex_uint16_t; 48 | typedef int32_t flex_int32_t; 49 | typedef uint32_t flex_uint32_t; 50 | #else 51 | typedef signed char flex_int8_t; 52 | typedef short int flex_int16_t; 53 | typedef int flex_int32_t; 54 | typedef unsigned char flex_uint8_t; 55 | typedef unsigned short int flex_uint16_t; 56 | typedef unsigned int flex_uint32_t; 57 | 58 | /* Limits of integral types. */ 59 | #ifndef INT8_MIN 60 | #define INT8_MIN (-128) 61 | #endif 62 | #ifndef INT16_MIN 63 | #define INT16_MIN (-32767-1) 64 | #endif 65 | #ifndef INT32_MIN 66 | #define INT32_MIN (-2147483647-1) 67 | #endif 68 | #ifndef INT8_MAX 69 | #define INT8_MAX (127) 70 | #endif 71 | #ifndef INT16_MAX 72 | #define INT16_MAX (32767) 73 | #endif 74 | #ifndef INT32_MAX 75 | #define INT32_MAX (2147483647) 76 | #endif 77 | #ifndef UINT8_MAX 78 | #define UINT8_MAX (255U) 79 | #endif 80 | #ifndef UINT16_MAX 81 | #define UINT16_MAX (65535U) 82 | #endif 83 | #ifndef UINT32_MAX 84 | #define UINT32_MAX (4294967295U) 85 | #endif 86 | 87 | #endif /* ! C99 */ 88 | 89 | #endif /* ! FLEXINT_H */ 90 | 91 | #ifdef __cplusplus 92 | 93 | /* The "const" storage-class-modifier is valid. */ 94 | #define YY_USE_CONST 95 | 96 | #else /* ! __cplusplus */ 97 | 98 | /* C99 requires __STDC__ to be defined as 1. */ 99 | #if defined (__STDC__) 100 | 101 | #define YY_USE_CONST 102 | 103 | #endif /* defined (__STDC__) */ 104 | #endif /* ! __cplusplus */ 105 | 106 | #ifdef YY_USE_CONST 107 | #define yyconst const 108 | #else 109 | #define yyconst 110 | #endif 111 | 112 | /* Returned upon end-of-file. */ 113 | #define YY_NULL 0 114 | 115 | /* Promotes a possibly negative, possibly signed char to an unsigned 116 | * integer for use as an array index. If the signed char is negative, 117 | * we want to instead treat it as an 8-bit unsigned char, hence the 118 | * double cast. 119 | */ 120 | #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) 121 | 122 | /* Enter a start condition. This macro really ought to take a parameter, 123 | * but we do it the disgusting crufty way forced on us by the ()-less 124 | * definition of BEGIN. 125 | */ 126 | #define BEGIN (yy_start) = 1 + 2 * 127 | 128 | /* Translate the current start state into a value that can be later handed 129 | * to BEGIN to return to the state. The YYSTATE alias is for lex 130 | * compatibility. 131 | */ 132 | #define YY_START (((yy_start) - 1) / 2) 133 | #define YYSTATE YY_START 134 | 135 | /* Action number for EOF rule of a given start state. */ 136 | #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) 137 | 138 | /* Special action meaning "start processing a new file". */ 139 | #define YY_NEW_FILE yyrestart(yyin ) 140 | 141 | #define YY_END_OF_BUFFER_CHAR 0 142 | 143 | /* Size of default input buffer. */ 144 | #ifndef YY_BUF_SIZE 145 | #ifdef __ia64__ 146 | /* On IA-64, the buffer size is 16k, not 8k. 147 | * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. 148 | * Ditto for the __ia64__ case accordingly. 149 | */ 150 | #define YY_BUF_SIZE 32768 151 | #else 152 | #define YY_BUF_SIZE 16384 153 | #endif /* __ia64__ */ 154 | #endif 155 | 156 | /* The state buf must be large enough to hold one state per character in the main buffer. 157 | */ 158 | #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) 159 | 160 | #ifndef YY_TYPEDEF_YY_BUFFER_STATE 161 | #define YY_TYPEDEF_YY_BUFFER_STATE 162 | typedef struct yy_buffer_state *YY_BUFFER_STATE; 163 | #endif 164 | 165 | extern int yyleng; 166 | 167 | extern FILE *yyin, *yyout; 168 | 169 | #define EOB_ACT_CONTINUE_SCAN 0 170 | #define EOB_ACT_END_OF_FILE 1 171 | #define EOB_ACT_LAST_MATCH 2 172 | 173 | /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires 174 | * access to the local variable yy_act. Since yyless() is a macro, it would break 175 | * existing scanners that call yyless() from OUTSIDE yylex. 176 | * One obvious solution it to make yy_act a global. I tried that, and saw 177 | * a 5% performance hit in a non-yylineno scanner, because yy_act is 178 | * normally declared as a register variable-- so it is not worth it. 179 | */ 180 | #define YY_LESS_LINENO(n) \ 181 | do { \ 182 | int yyl;\ 183 | for ( yyl = n; yyl < yyleng; ++yyl )\ 184 | if ( yytext[yyl] == '\n' )\ 185 | --yylineno;\ 186 | }while(0) 187 | 188 | /* Return all but the first "n" matched characters back to the input stream. */ 189 | #define yyless(n) \ 190 | do \ 191 | { \ 192 | /* Undo effects of setting up yytext. */ \ 193 | int yyless_macro_arg = (n); \ 194 | YY_LESS_LINENO(yyless_macro_arg);\ 195 | *yy_cp = (yy_hold_char); \ 196 | YY_RESTORE_YY_MORE_OFFSET \ 197 | (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ 198 | YY_DO_BEFORE_ACTION; /* set up yytext again */ \ 199 | } \ 200 | while ( 0 ) 201 | 202 | #define unput(c) yyunput( c, (yytext_ptr) ) 203 | 204 | #ifndef YY_TYPEDEF_YY_SIZE_T 205 | #define YY_TYPEDEF_YY_SIZE_T 206 | typedef size_t yy_size_t; 207 | #endif 208 | 209 | #ifndef YY_STRUCT_YY_BUFFER_STATE 210 | #define YY_STRUCT_YY_BUFFER_STATE 211 | struct yy_buffer_state 212 | { 213 | FILE *yy_input_file; 214 | 215 | char *yy_ch_buf; /* input buffer */ 216 | char *yy_buf_pos; /* current position in input buffer */ 217 | 218 | /* Size of input buffer in bytes, not including room for EOB 219 | * characters. 220 | */ 221 | yy_size_t yy_buf_size; 222 | 223 | /* Number of characters read into yy_ch_buf, not including EOB 224 | * characters. 225 | */ 226 | int yy_n_chars; 227 | 228 | /* Whether we "own" the buffer - i.e., we know we created it, 229 | * and can realloc() it to grow it, and should free() it to 230 | * delete it. 231 | */ 232 | int yy_is_our_buffer; 233 | 234 | /* Whether this is an "interactive" input source; if so, and 235 | * if we're using stdio for input, then we want to use getc() 236 | * instead of fread(), to make sure we stop fetching input after 237 | * each newline. 238 | */ 239 | int yy_is_interactive; 240 | 241 | /* Whether we're considered to be at the beginning of a line. 242 | * If so, '^' rules will be active on the next match, otherwise 243 | * not. 244 | */ 245 | int yy_at_bol; 246 | 247 | int yy_bs_lineno; /**< The line count. */ 248 | int yy_bs_column; /**< The column count. */ 249 | 250 | /* Whether to try to fill the input buffer when we reach the 251 | * end of it. 252 | */ 253 | int yy_fill_buffer; 254 | 255 | int yy_buffer_status; 256 | 257 | #define YY_BUFFER_NEW 0 258 | #define YY_BUFFER_NORMAL 1 259 | /* When an EOF's been seen but there's still some text to process 260 | * then we mark the buffer as YY_EOF_PENDING, to indicate that we 261 | * shouldn't try reading from the input source any more. We might 262 | * still have a bunch of tokens to match, though, because of 263 | * possible backing-up. 264 | * 265 | * When we actually see the EOF, we change the status to "new" 266 | * (via yyrestart()), so that the user can continue scanning by 267 | * just pointing yyin at a new input file. 268 | */ 269 | #define YY_BUFFER_EOF_PENDING 2 270 | 271 | }; 272 | #endif /* !YY_STRUCT_YY_BUFFER_STATE */ 273 | 274 | /* Stack of input buffers. */ 275 | static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ 276 | static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ 277 | static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ 278 | 279 | /* We provide macros for accessing buffer states in case in the 280 | * future we want to put the buffer states in a more general 281 | * "scanner state". 282 | * 283 | * Returns the top of the stack, or NULL. 284 | */ 285 | #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ 286 | ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ 287 | : NULL) 288 | 289 | /* Same as previous macro, but useful when we know that the buffer stack is not 290 | * NULL or when we need an lvalue. For internal use only. 291 | */ 292 | #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] 293 | 294 | /* yy_hold_char holds the character lost when yytext is formed. */ 295 | static char yy_hold_char; 296 | static int yy_n_chars; /* number of characters read into yy_ch_buf */ 297 | int yyleng; 298 | 299 | /* Points to current character in buffer. */ 300 | static char *yy_c_buf_p = (char *) 0; 301 | static int yy_init = 0; /* whether we need to initialize */ 302 | static int yy_start = 0; /* start state number */ 303 | 304 | /* Flag which is used to allow yywrap()'s to do buffer switches 305 | * instead of setting up a fresh yyin. A bit of a hack ... 306 | */ 307 | static int yy_did_buffer_switch_on_eof; 308 | 309 | void yyrestart (FILE *input_file ); 310 | void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); 311 | YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); 312 | void yy_delete_buffer (YY_BUFFER_STATE b ); 313 | void yy_flush_buffer (YY_BUFFER_STATE b ); 314 | void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); 315 | void yypop_buffer_state (void ); 316 | 317 | static void yyensure_buffer_stack (void ); 318 | static void yy_load_buffer_state (void ); 319 | static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); 320 | 321 | #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) 322 | 323 | YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); 324 | YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); 325 | YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); 326 | 327 | void *yyalloc (yy_size_t ); 328 | void *yyrealloc (void *,yy_size_t ); 329 | void yyfree (void * ); 330 | 331 | #define yy_new_buffer yy_create_buffer 332 | 333 | #define yy_set_interactive(is_interactive) \ 334 | { \ 335 | if ( ! YY_CURRENT_BUFFER ){ \ 336 | yyensure_buffer_stack (); \ 337 | YY_CURRENT_BUFFER_LVALUE = \ 338 | yy_create_buffer(yyin,YY_BUF_SIZE ); \ 339 | } \ 340 | YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ 341 | } 342 | 343 | #define yy_set_bol(at_bol) \ 344 | { \ 345 | if ( ! YY_CURRENT_BUFFER ){\ 346 | yyensure_buffer_stack (); \ 347 | YY_CURRENT_BUFFER_LVALUE = \ 348 | yy_create_buffer(yyin,YY_BUF_SIZE ); \ 349 | } \ 350 | YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ 351 | } 352 | 353 | #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) 354 | 355 | #define yywrap(n) 1 356 | #define YY_SKIP_YYWRAP 357 | 358 | typedef unsigned char YY_CHAR; 359 | 360 | FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; 361 | 362 | typedef int yy_state_type; 363 | 364 | extern int yylineno; 365 | 366 | int yylineno = 1; 367 | 368 | extern char *yytext; 369 | #define yytext_ptr yytext 370 | 371 | static yy_state_type yy_get_previous_state (void ); 372 | static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); 373 | static int yy_get_next_buffer (void ); 374 | static void yy_fatal_error (yyconst char msg[] ); 375 | 376 | /* Done after the current pattern has been matched and before the 377 | * corresponding action - sets up yytext. 378 | */ 379 | #define YY_DO_BEFORE_ACTION \ 380 | (yytext_ptr) = yy_bp; \ 381 | yyleng = (size_t) (yy_cp - yy_bp); \ 382 | (yy_hold_char) = *yy_cp; \ 383 | *yy_cp = '\0'; \ 384 | (yy_c_buf_p) = yy_cp; 385 | 386 | #define YY_NUM_RULES 61 387 | #define YY_END_OF_BUFFER 62 388 | /* This struct is not used in this scanner, 389 | but its presence is necessary. */ 390 | struct yy_trans_info 391 | { 392 | flex_int32_t yy_verify; 393 | flex_int32_t yy_nxt; 394 | }; 395 | static yyconst flex_int16_t yy_accept[266] = 396 | { 0, 397 | 0, 0, 0, 0, 62, 60, 58, 59, 44, 55, 398 | 57, 56, 56, 56, 56, 56, 56, 56, 56, 56, 399 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 400 | 56, 56, 56, 54, 53, 61, 45, 52, 50, 48, 401 | 51, 46, 47, 58, 57, 56, 56, 56, 56, 56, 402 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 403 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 404 | 56, 56, 56, 56, 53, 0, 51, 50, 51, 56, 405 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 406 | 56, 56, 56, 56, 56, 56, 56, 56, 38, 56, 407 | 408 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 409 | 0, 51, 56, 56, 56, 56, 56, 19, 56, 56, 410 | 15, 56, 56, 56, 1, 56, 56, 56, 56, 56, 411 | 56, 23, 56, 56, 56, 56, 56, 56, 56, 56, 412 | 18, 14, 56, 49, 56, 28, 26, 56, 56, 24, 413 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 414 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 415 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 27, 416 | 9, 56, 56, 56, 56, 56, 56, 56, 56, 56, 417 | 56, 39, 56, 56, 41, 56, 56, 56, 31, 6, 418 | 419 | 36, 56, 56, 56, 56, 56, 56, 17, 21, 33, 420 | 56, 56, 43, 56, 56, 56, 56, 37, 56, 56, 421 | 12, 40, 10, 56, 56, 56, 11, 32, 56, 7, 422 | 16, 29, 56, 56, 56, 30, 56, 56, 56, 56, 423 | 35, 56, 56, 20, 25, 3, 56, 56, 22, 56, 424 | 56, 56, 56, 8, 56, 56, 56, 4, 34, 13, 425 | 2, 42, 56, 5, 0 426 | } ; 427 | 428 | static yyconst flex_int32_t yy_ec[256] = 429 | { 0, 430 | 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 431 | 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 432 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 433 | 1, 4, 1, 5, 1, 1, 1, 1, 6, 7, 434 | 7, 1, 1, 8, 9, 9, 1, 10, 10, 10, 435 | 10, 10, 10, 10, 10, 10, 10, 11, 1, 1, 436 | 1, 1, 1, 1, 12, 12, 13, 12, 14, 12, 437 | 15, 16, 17, 16, 16, 18, 19, 20, 21, 22, 438 | 16, 23, 24, 25, 26, 27, 16, 16, 16, 16, 439 | 28, 1, 29, 1, 30, 1, 31, 32, 33, 34, 440 | 441 | 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 442 | 45, 46, 16, 47, 48, 49, 50, 51, 52, 16, 443 | 53, 16, 1, 1, 1, 1, 1, 1, 1, 1, 444 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 445 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 446 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 447 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 448 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 449 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 450 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 451 | 452 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 453 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 454 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 455 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 456 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 457 | 1, 1, 1, 1, 1 458 | } ; 459 | 460 | static yyconst flex_int32_t yy_meta[54] = 461 | { 0, 462 | 1, 1, 1, 1, 1, 2, 1, 1, 3, 4, 463 | 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 464 | 4, 4, 4, 4, 4, 4, 4, 1, 1, 4, 465 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 466 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 467 | 4, 4, 4 468 | } ; 469 | 470 | static yyconst flex_int16_t yy_base[270] = 471 | { 0, 472 | 0, 0, 53, 82, 334, 335, 63, 335, 335, 335, 473 | 323, 0, 318, 311, 316, 303, 305, 19, 33, 35, 474 | 293, 282, 280, 289, 284, 287, 286, 26, 285, 270, 475 | 37, 40, 49, 335, 93, 335, 335, 335, 92, 335, 476 | 71, 335, 335, 101, 308, 0, 297, 78, 291, 290, 477 | 297, 266, 263, 269, 266, 261, 261, 268, 58, 267, 478 | 252, 272, 260, 253, 254, 255, 255, 73, 265, 254, 479 | 249, 260, 247, 254, 110, 81, 283, 112, 118, 277, 480 | 264, 263, 270, 265, 267, 254, 246, 241, 233, 242, 481 | 245, 243, 229, 242, 232, 223, 227, 241, 0, 223, 482 | 483 | 71, 240, 221, 230, 230, 232, 218, 213, 223, 214, 484 | 118, 253, 238, 235, 234, 241, 231, 0, 203, 210, 485 | 100, 219, 216, 219, 111, 220, 96, 215, 204, 217, 486 | 212, 223, 198, 209, 200, 192, 197, 196, 215, 199, 487 | 111, 0, 188, 127, 219, 0, 0, 211, 209, 0, 488 | 186, 197, 178, 186, 185, 179, 192, 191, 181, 189, 489 | 187, 188, 174, 173, 172, 183, 186, 169, 180, 166, 490 | 176, 167, 162, 165, 174, 155, 172, 193, 180, 0, 491 | 0, 168, 157, 153, 197, 161, 148, 151, 164, 149, 492 | 164, 0, 160, 140, 0, 156, 148, 141, 0, 0, 493 | 494 | 0, 147, 157, 143, 150, 139, 140, 0, 0, 0, 495 | 148, 134, 335, 136, 145, 131, 143, 0, 144, 126, 496 | 153, 0, 0, 122, 129, 130, 0, 0, 137, 0, 497 | 0, 0, 127, 128, 130, 145, 132, 131, 134, 129, 498 | 0, 126, 116, 0, 0, 0, 116, 125, 0, 108, 499 | 112, 121, 103, 0, 111, 106, 100, 0, 0, 0, 500 | 0, 0, 74, 0, 335, 145, 105, 148, 150 501 | } ; 502 | 503 | static yyconst flex_int16_t yy_def[270] = 504 | { 0, 505 | 265, 1, 266, 266, 265, 265, 265, 265, 265, 265, 506 | 265, 267, 267, 267, 267, 267, 267, 267, 267, 267, 507 | 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 508 | 267, 267, 267, 265, 265, 265, 265, 265, 268, 265, 509 | 268, 265, 265, 265, 265, 267, 267, 267, 267, 267, 510 | 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 511 | 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 512 | 267, 267, 267, 267, 265, 265, 269, 268, 268, 267, 513 | 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 514 | 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 515 | 516 | 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 517 | 265, 269, 267, 267, 267, 267, 267, 267, 267, 267, 518 | 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 519 | 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 520 | 267, 267, 267, 265, 267, 267, 267, 267, 267, 267, 521 | 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 522 | 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 523 | 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 524 | 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 525 | 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 526 | 527 | 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 528 | 267, 267, 265, 267, 267, 267, 267, 267, 267, 267, 529 | 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 530 | 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 531 | 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 532 | 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 533 | 267, 267, 267, 267, 0, 265, 265, 265, 265 534 | } ; 535 | 536 | static yyconst flex_int16_t yy_nxt[389] = 537 | { 0, 538 | 6, 7, 8, 7, 9, 6, 10, 6, 6, 11, 539 | 6, 12, 12, 12, 13, 12, 14, 12, 12, 15, 540 | 16, 17, 12, 12, 12, 12, 12, 6, 6, 6, 541 | 18, 12, 19, 20, 21, 12, 12, 12, 22, 23, 542 | 24, 25, 26, 27, 12, 28, 29, 30, 31, 12, 543 | 32, 33, 12, 34, 35, 36, 35, 37, 34, 34, 544 | 38, 34, 39, 40, 44, 52, 44, 54, 53, 56, 545 | 65, 69, 66, 57, 71, 70, 265, 55, 72, 77, 546 | 42, 43, 34, 35, 36, 35, 37, 34, 34, 38, 547 | 34, 39, 40, 73, 75, 74, 75, 76, 81, 82, 548 | 549 | 77, 78, 44, 103, 44, 93, 94, 133, 46, 42, 550 | 43, 75, 111, 75, 111, 264, 134, 76, 111, 104, 551 | 77, 78, 152, 265, 153, 111, 77, 144, 157, 144, 552 | 144, 144, 160, 175, 263, 176, 144, 158, 144, 144, 553 | 144, 262, 161, 238, 239, 41, 41, 41, 41, 79, 554 | 79, 79, 112, 112, 261, 260, 259, 258, 257, 256, 555 | 255, 254, 253, 252, 251, 250, 249, 248, 247, 246, 556 | 245, 244, 243, 242, 241, 240, 237, 236, 235, 234, 557 | 233, 232, 231, 230, 229, 228, 227, 226, 225, 224, 558 | 223, 222, 221, 220, 219, 218, 217, 216, 215, 214, 559 | 560 | 213, 212, 211, 210, 209, 208, 207, 206, 205, 204, 561 | 203, 202, 201, 200, 199, 198, 197, 196, 195, 194, 562 | 193, 192, 191, 190, 189, 188, 187, 186, 185, 184, 563 | 183, 182, 181, 180, 179, 178, 177, 174, 173, 172, 564 | 171, 170, 169, 168, 167, 166, 165, 164, 163, 162, 565 | 159, 156, 155, 154, 151, 150, 149, 148, 147, 146, 566 | 145, 265, 143, 142, 141, 140, 139, 138, 137, 136, 567 | 135, 132, 131, 130, 129, 128, 127, 126, 125, 124, 568 | 123, 122, 121, 120, 119, 118, 117, 116, 115, 114, 569 | 113, 77, 110, 109, 108, 107, 106, 105, 102, 101, 570 | 571 | 100, 99, 98, 97, 96, 95, 92, 91, 90, 89, 572 | 88, 87, 86, 85, 84, 83, 80, 45, 68, 67, 573 | 64, 63, 62, 61, 60, 59, 58, 51, 50, 49, 574 | 48, 47, 45, 265, 5, 265, 265, 265, 265, 265, 575 | 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 576 | 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 577 | 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 578 | 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 579 | 265, 265, 265, 265, 265, 265, 265, 265 580 | } ; 581 | 582 | static yyconst flex_int16_t yy_chk[389] = 583 | { 0, 584 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 585 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 586 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 587 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 588 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 589 | 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 590 | 3, 3, 3, 3, 7, 18, 7, 19, 18, 20, 591 | 28, 31, 28, 20, 32, 31, 41, 19, 32, 41, 592 | 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 593 | 4, 4, 4, 33, 35, 33, 35, 39, 48, 48, 594 | 595 | 39, 39, 44, 68, 44, 59, 59, 101, 267, 4, 596 | 4, 75, 76, 75, 76, 263, 101, 78, 76, 68, 597 | 78, 78, 121, 79, 121, 76, 79, 111, 125, 111, 598 | 111, 111, 127, 141, 257, 141, 144, 125, 144, 144, 599 | 144, 256, 127, 220, 220, 266, 266, 266, 266, 268, 600 | 268, 268, 269, 269, 255, 253, 252, 251, 250, 248, 601 | 247, 243, 242, 240, 239, 238, 237, 236, 235, 234, 602 | 233, 229, 226, 225, 224, 221, 219, 217, 216, 215, 603 | 214, 212, 211, 207, 206, 205, 204, 203, 202, 198, 604 | 197, 196, 194, 193, 191, 190, 189, 188, 187, 186, 605 | 606 | 185, 184, 183, 182, 179, 178, 177, 176, 175, 174, 607 | 173, 172, 171, 170, 169, 168, 167, 166, 165, 164, 608 | 163, 162, 161, 160, 159, 158, 157, 156, 155, 154, 609 | 153, 152, 151, 149, 148, 145, 143, 140, 139, 138, 610 | 137, 136, 135, 134, 133, 132, 131, 130, 129, 128, 611 | 126, 124, 123, 122, 120, 119, 117, 116, 115, 114, 612 | 113, 112, 110, 109, 108, 107, 106, 105, 104, 103, 613 | 102, 100, 98, 97, 96, 95, 94, 93, 92, 91, 614 | 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 615 | 80, 77, 74, 73, 72, 71, 70, 69, 67, 66, 616 | 617 | 65, 64, 63, 62, 61, 60, 58, 57, 56, 55, 618 | 54, 53, 52, 51, 50, 49, 47, 45, 30, 29, 619 | 27, 26, 25, 24, 23, 22, 21, 17, 16, 15, 620 | 14, 13, 11, 5, 265, 265, 265, 265, 265, 265, 621 | 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 622 | 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 623 | 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 624 | 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 625 | 265, 265, 265, 265, 265, 265, 265, 265 626 | } ; 627 | 628 | /* Table of booleans, true if rule could match eol. */ 629 | static yyconst flex_int32_t yy_rule_can_match_eol[62] = 630 | { 0, 631 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 632 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 633 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 634 | 0, 0, }; 635 | 636 | static yy_state_type yy_last_accepting_state; 637 | static char *yy_last_accepting_cpos; 638 | 639 | extern int yy_flex_debug; 640 | int yy_flex_debug = 0; 641 | 642 | /* The intent behind this definition is that it'll catch 643 | * any uses of REJECT which flex missed. 644 | */ 645 | #define REJECT reject_used_but_not_detected 646 | #define yymore() yymore_used_but_not_detected 647 | #define YY_MORE_ADJ 0 648 | #define YY_RESTORE_YY_MORE_OFFSET 649 | char *yytext; 650 | #line 1 "edn_flex.l" 651 | #line 4 "edn_flex.l" 652 | #include 653 | #include 654 | #include 655 | #include "type.h" 656 | #include "edn_bison.h" 657 | 658 | #define to_view_parse 0 659 | #define RECORD 1 660 | /* the define below helps with watching the parser go token by token */ 661 | #define MP {if(to_view_parse) printf("%d %s\n", yylineno, yytext);} 662 | 663 | #if RECORD 664 | int instance_num=0; 665 | int net_num =0; 666 | #define RECORD_INSTANCE_NUM instance_num++ 667 | #define RECORD_NET_NUM net_num++ 668 | #endif 669 | 670 | 671 | #line 672 "edn_flex.c" 672 | 673 | #define INITIAL 0 674 | #define READING_STRING 1 675 | 676 | #ifndef YY_NO_UNISTD_H 677 | /* Special case for "unistd.h", since it is non-ANSI. We include it way 678 | * down here because we want the user's section 1 to have been scanned first. 679 | * The user has a chance to override it with an option. 680 | */ 681 | #include 682 | #endif 683 | 684 | #ifndef YY_EXTRA_TYPE 685 | #define YY_EXTRA_TYPE void * 686 | #endif 687 | 688 | static int yy_init_globals (void ); 689 | 690 | /* Accessor methods to globals. 691 | These are made visible to non-reentrant scanners for convenience. */ 692 | 693 | int yylex_destroy (void ); 694 | 695 | int yyget_debug (void ); 696 | 697 | void yyset_debug (int debug_flag ); 698 | 699 | YY_EXTRA_TYPE yyget_extra (void ); 700 | 701 | void yyset_extra (YY_EXTRA_TYPE user_defined ); 702 | 703 | FILE *yyget_in (void ); 704 | 705 | void yyset_in (FILE * in_str ); 706 | 707 | FILE *yyget_out (void ); 708 | 709 | void yyset_out (FILE * out_str ); 710 | 711 | int yyget_leng (void ); 712 | 713 | char *yyget_text (void ); 714 | 715 | int yyget_lineno (void ); 716 | 717 | void yyset_lineno (int line_number ); 718 | 719 | /* Macros after this point can all be overridden by user definitions in 720 | * section 1. 721 | */ 722 | 723 | #ifndef YY_SKIP_YYWRAP 724 | #ifdef __cplusplus 725 | extern "C" int yywrap (void ); 726 | #else 727 | extern int yywrap (void ); 728 | #endif 729 | #endif 730 | 731 | static void yyunput (int c,char *buf_ptr ); 732 | 733 | #ifndef yytext_ptr 734 | static void yy_flex_strncpy (char *,yyconst char *,int ); 735 | #endif 736 | 737 | #ifdef YY_NEED_STRLEN 738 | static int yy_flex_strlen (yyconst char * ); 739 | #endif 740 | 741 | #ifndef YY_NO_INPUT 742 | 743 | #ifdef __cplusplus 744 | static int yyinput (void ); 745 | #else 746 | static int input (void ); 747 | #endif 748 | 749 | #endif 750 | 751 | /* Amount of stuff to slurp up with each read. */ 752 | #ifndef YY_READ_BUF_SIZE 753 | #ifdef __ia64__ 754 | /* On IA-64, the buffer size is 16k, not 8k */ 755 | #define YY_READ_BUF_SIZE 16384 756 | #else 757 | #define YY_READ_BUF_SIZE 8192 758 | #endif /* __ia64__ */ 759 | #endif 760 | 761 | /* Copy whatever the last rule matched to the standard output. */ 762 | #ifndef ECHO 763 | /* This used to be an fputs(), but since the string might contain NUL's, 764 | * we now use fwrite(). 765 | */ 766 | #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) 767 | #endif 768 | 769 | /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, 770 | * is returned in "result". 771 | */ 772 | #ifndef YY_INPUT 773 | #define YY_INPUT(buf,result,max_size) \ 774 | if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ 775 | { \ 776 | int c = '*'; \ 777 | size_t n; \ 778 | for ( n = 0; n < max_size && \ 779 | (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ 780 | buf[n] = (char) c; \ 781 | if ( c == '\n' ) \ 782 | buf[n++] = (char) c; \ 783 | if ( c == EOF && ferror( yyin ) ) \ 784 | YY_FATAL_ERROR( "input in flex scanner failed" ); \ 785 | result = n; \ 786 | } \ 787 | else \ 788 | { \ 789 | errno=0; \ 790 | while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ 791 | { \ 792 | if( errno != EINTR) \ 793 | { \ 794 | YY_FATAL_ERROR( "input in flex scanner failed" ); \ 795 | break; \ 796 | } \ 797 | errno=0; \ 798 | clearerr(yyin); \ 799 | } \ 800 | }\ 801 | \ 802 | 803 | #endif 804 | 805 | /* No semi-colon after return; correct usage is to write "yyterminate();" - 806 | * we don't want an extra ';' after the "return" because that will cause 807 | * some compilers to complain about unreachable statements. 808 | */ 809 | #ifndef yyterminate 810 | #define yyterminate() return YY_NULL 811 | #endif 812 | 813 | /* Number of entries by which start-condition stack grows. */ 814 | #ifndef YY_START_STACK_INCR 815 | #define YY_START_STACK_INCR 25 816 | #endif 817 | 818 | /* Report a fatal error. */ 819 | #ifndef YY_FATAL_ERROR 820 | #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) 821 | #endif 822 | 823 | /* end tables serialization structures and prototypes */ 824 | 825 | /* Default declaration of generated scanner - a define so the user can 826 | * easily add parameters. 827 | */ 828 | #ifndef YY_DECL 829 | #define YY_DECL_IS_OURS 1 830 | 831 | extern int yylex (void); 832 | 833 | #define YY_DECL int yylex (void) 834 | #endif /* !YY_DECL */ 835 | 836 | /* Code executed at the beginning of each rule, after yytext and yyleng 837 | * have been set up. 838 | */ 839 | #ifndef YY_USER_ACTION 840 | #define YY_USER_ACTION 841 | #endif 842 | 843 | /* Code executed at the end of each rule. */ 844 | #ifndef YY_BREAK 845 | #define YY_BREAK break; 846 | #endif 847 | 848 | #define YY_RULE_SETUP \ 849 | YY_USER_ACTION 850 | 851 | /** The main scanner function which does all the work. 852 | */ 853 | YY_DECL 854 | { 855 | register yy_state_type yy_current_state; 856 | register char *yy_cp, *yy_bp; 857 | register int yy_act; 858 | 859 | #line 26 "edn_flex.l" 860 | 861 | 862 | /* edif information */ 863 | #line 864 "edn_flex.c" 864 | 865 | if ( !(yy_init) ) 866 | { 867 | (yy_init) = 1; 868 | 869 | #ifdef YY_USER_INIT 870 | YY_USER_INIT; 871 | #endif 872 | 873 | if ( ! (yy_start) ) 874 | (yy_start) = 1; /* first start state */ 875 | 876 | if ( ! yyin ) 877 | yyin = stdin; 878 | 879 | if ( ! yyout ) 880 | yyout = stdout; 881 | 882 | if ( ! YY_CURRENT_BUFFER ) { 883 | yyensure_buffer_stack (); 884 | YY_CURRENT_BUFFER_LVALUE = 885 | yy_create_buffer(yyin,YY_BUF_SIZE ); 886 | } 887 | 888 | yy_load_buffer_state( ); 889 | } 890 | 891 | while ( 1 ) /* loops until end-of-file is reached */ 892 | { 893 | yy_cp = (yy_c_buf_p); 894 | 895 | /* Support of yytext. */ 896 | *yy_cp = (yy_hold_char); 897 | 898 | /* yy_bp points to the position in yy_ch_buf of the start of 899 | * the current run. 900 | */ 901 | yy_bp = yy_cp; 902 | 903 | yy_current_state = (yy_start); 904 | yy_match: 905 | do 906 | { 907 | register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; 908 | if ( yy_accept[yy_current_state] ) 909 | { 910 | (yy_last_accepting_state) = yy_current_state; 911 | (yy_last_accepting_cpos) = yy_cp; 912 | } 913 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 914 | { 915 | yy_current_state = (int) yy_def[yy_current_state]; 916 | if ( yy_current_state >= 266 ) 917 | yy_c = yy_meta[(unsigned int) yy_c]; 918 | } 919 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 920 | ++yy_cp; 921 | } 922 | while ( yy_base[yy_current_state] != 335 ); 923 | 924 | yy_find_action: 925 | yy_act = yy_accept[yy_current_state]; 926 | if ( yy_act == 0 ) 927 | { /* have to back up */ 928 | yy_cp = (yy_last_accepting_cpos); 929 | yy_current_state = (yy_last_accepting_state); 930 | yy_act = yy_accept[yy_current_state]; 931 | } 932 | 933 | YY_DO_BEFORE_ACTION; 934 | 935 | if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) 936 | { 937 | int yyl; 938 | for ( yyl = 0; yyl < yyleng; ++yyl ) 939 | if ( yytext[yyl] == '\n' ) 940 | 941 | yylineno++; 942 | ; 943 | } 944 | 945 | do_action: /* This label is used only to access EOF actions. */ 946 | 947 | switch ( yy_act ) 948 | { /* beginning of action switch */ 949 | case 0: /* must back up */ 950 | /* undo the effects of YY_DO_BEFORE_ACTION */ 951 | *yy_cp = (yy_hold_char); 952 | yy_cp = (yy_last_accepting_cpos); 953 | yy_current_state = (yy_last_accepting_state); 954 | goto yy_find_action; 955 | 956 | case 1: 957 | YY_RULE_SETUP 958 | #line 29 "edn_flex.l" 959 | {MP;return EDIF;} 960 | YY_BREAK 961 | case 2: 962 | YY_RULE_SETUP 963 | #line 30 "edn_flex.l" 964 | {MP;return EDIFVERSION;} 965 | YY_BREAK 966 | case 3: 967 | YY_RULE_SETUP 968 | #line 31 "edn_flex.l" 969 | {MP;return EDIFLEVEL;} 970 | YY_BREAK 971 | case 4: 972 | YY_RULE_SETUP 973 | #line 32 "edn_flex.l" 974 | {MP;return EKEYWORDMAP;} 975 | YY_BREAK 976 | case 5: 977 | YY_RULE_SETUP 978 | #line 33 "edn_flex.l" 979 | {MP;return EKEYWORDLEVEL;} 980 | YY_BREAK 981 | case 6: 982 | YY_RULE_SETUP 983 | #line 34 "edn_flex.l" 984 | {MP;return ESTATUS;} 985 | YY_BREAK 986 | case 7: 987 | YY_RULE_SETUP 988 | #line 35 "edn_flex.l" 989 | {MP;return EWRITTEN;} 990 | YY_BREAK 991 | case 8: 992 | YY_RULE_SETUP 993 | #line 36 "edn_flex.l" 994 | {MP;return ETIMESTAMP;} 995 | YY_BREAK 996 | case 9: 997 | YY_RULE_SETUP 998 | #line 37 "edn_flex.l" 999 | {MP;return EAUTHOR;} 1000 | YY_BREAK 1001 | case 10: 1002 | YY_RULE_SETUP 1003 | #line 38 "edn_flex.l" 1004 | {MP;return EPROGRAM;} 1005 | YY_BREAK 1006 | case 11: 1007 | YY_RULE_SETUP 1008 | #line 39 "edn_flex.l" 1009 | {MP;return EVERSION;} 1010 | YY_BREAK 1011 | /* library name */ 1012 | case 12: 1013 | YY_RULE_SETUP 1014 | #line 42 "edn_flex.l" 1015 | {MP;return eLIBRARY;} 1016 | YY_BREAK 1017 | case 13: 1018 | YY_RULE_SETUP 1019 | #line 43 "edn_flex.l" 1020 | {MP;return eTECHNOLOGY;} 1021 | YY_BREAK 1022 | /* 1023 | "UNILIB" {MP;return eUNILIB;} 1024 | "VIRTEX" {MP;return eVIRTEX;} 1025 | "VIRTEXR" {MP;return eVIRTEXR;} 1026 | */ 1027 | case 14: 1028 | YY_RULE_SETUP 1029 | #line 50 "edn_flex.l" 1030 | {MP;return eWORK;} 1031 | YY_BREAK 1032 | /* keywords of all lib */ 1033 | case 15: 1034 | YY_RULE_SETUP 1035 | #line 55 "edn_flex.l" 1036 | {MP;return eCELL;} 1037 | YY_BREAK 1038 | case 16: 1039 | YY_RULE_SETUP 1040 | #line 56 "edn_flex.l" 1041 | {MP;return eCELLTYPE;} 1042 | YY_BREAK 1043 | case 17: 1044 | YY_RULE_SETUP 1045 | #line 57 "edn_flex.l" 1046 | {MP;yylval.num_value=1;return eGENERIC;} 1047 | YY_BREAK 1048 | case 18: 1049 | YY_RULE_SETUP 1050 | #line 60 "edn_flex.l" 1051 | {MP;return eVIEW;} 1052 | YY_BREAK 1053 | case 19: 1054 | YY_RULE_SETUP 1055 | #line 61 "edn_flex.l" 1056 | {MP;yylval.num_value=1;return ePRIM;} 1057 | YY_BREAK 1058 | case 20: 1059 | YY_RULE_SETUP 1060 | #line 62 "edn_flex.l" 1061 | {MP;return eVIEWTYPE;} 1062 | YY_BREAK 1063 | case 21: 1064 | YY_RULE_SETUP 1065 | #line 63 "edn_flex.l" 1066 | {MP;yylval.num_value=1;return eNETLIST;} 1067 | YY_BREAK 1068 | case 22: 1069 | YY_RULE_SETUP 1070 | #line 67 "edn_flex.l" 1071 | {MP;return eINTERFACE;} 1072 | YY_BREAK 1073 | case 23: 1074 | YY_RULE_SETUP 1075 | #line 68 "edn_flex.l" 1076 | {MP;return ePORT;} 1077 | YY_BREAK 1078 | case 24: 1079 | YY_RULE_SETUP 1080 | #line 69 "edn_flex.l" 1081 | {MP;return eARRAY;} 1082 | YY_BREAK 1083 | case 25: 1084 | YY_RULE_SETUP 1085 | #line 70 "edn_flex.l" 1086 | {MP;return eDIRECTION;} 1087 | YY_BREAK 1088 | case 26: 1089 | YY_RULE_SETUP 1090 | #line 71 "edn_flex.l" 1091 | {MP;return eINPUT;} 1092 | YY_BREAK 1093 | case 27: 1094 | YY_RULE_SETUP 1095 | #line 72 "edn_flex.l" 1096 | {MP;return eOUTPUT;} 1097 | YY_BREAK 1098 | case 28: 1099 | YY_RULE_SETUP 1100 | #line 73 "edn_flex.l" 1101 | {MP;return eINOUT;} 1102 | YY_BREAK 1103 | /* tokens belong to cells in work */ 1104 | case 29: 1105 | YY_RULE_SETUP 1106 | #line 76 "edn_flex.l" 1107 | {MP;return eCONTENTS;} 1108 | YY_BREAK 1109 | case 30: 1110 | YY_RULE_SETUP 1111 | #line 77 "edn_flex.l" 1112 | {MP;RECORD_INSTANCE_NUM;return eINSTANCE;} 1113 | YY_BREAK 1114 | case 31: 1115 | YY_RULE_SETUP 1116 | #line 78 "edn_flex.l" 1117 | {MP;return eRENAME;} 1118 | YY_BREAK 1119 | case 32: 1120 | YY_RULE_SETUP 1121 | #line 79 "edn_flex.l" 1122 | {MP;return eVIEWREF;} 1123 | YY_BREAK 1124 | case 33: 1125 | YY_RULE_SETUP 1126 | #line 80 "edn_flex.l" 1127 | {MP;return eCELLREF;} 1128 | YY_BREAK 1129 | case 34: 1130 | YY_RULE_SETUP 1131 | #line 81 "edn_flex.l" 1132 | {MP;return eLIBRARYREF;} 1133 | YY_BREAK 1134 | /*the instance of a LUT has a property */ 1135 | case 35: 1136 | YY_RULE_SETUP 1137 | #line 84 "edn_flex.l" 1138 | {MP;return ePROPERTY;} 1139 | YY_BREAK 1140 | /* 1141 | "INIT" {MP;return eINIT;} 1142 | */ 1143 | case 36: 1144 | YY_RULE_SETUP 1145 | #line 89 "edn_flex.l" 1146 | {MP;return eSTRING;} 1147 | YY_BREAK 1148 | case 37: 1149 | YY_RULE_SETUP 1150 | #line 90 "edn_flex.l" 1151 | {MP;return eINTEGER;} 1152 | YY_BREAK 1153 | case 38: 1154 | YY_RULE_SETUP 1155 | #line 93 "edn_flex.l" 1156 | {MP;RECORD_NET_NUM;return eNET;}; 1157 | YY_BREAK 1158 | case 39: 1159 | YY_RULE_SETUP 1160 | #line 94 "edn_flex.l" 1161 | {MP;return eJOINED;} 1162 | YY_BREAK 1163 | case 40: 1164 | YY_RULE_SETUP 1165 | #line 95 "edn_flex.l" 1166 | {MP;return ePORTREF;} 1167 | YY_BREAK 1168 | case 41: 1169 | YY_RULE_SETUP 1170 | #line 96 "edn_flex.l" 1171 | {MP;return eMEMBER;} 1172 | YY_BREAK 1173 | case 42: 1174 | YY_RULE_SETUP 1175 | #line 97 "edn_flex.l" 1176 | {MP;return eINSTANCEREF;} 1177 | YY_BREAK 1178 | /*design information */ 1179 | case 43: 1180 | YY_RULE_SETUP 1181 | #line 102 "edn_flex.l" 1182 | {MP;return eDESIGN;} 1183 | YY_BREAK 1184 | case 44: 1185 | YY_RULE_SETUP 1186 | #line 105 "edn_flex.l" 1187 | {MP;BEGIN READING_STRING;return QUOTE;} 1188 | YY_BREAK 1189 | /*back to initial state a " has been detected */ 1190 | case 45: 1191 | YY_RULE_SETUP 1192 | #line 107 "edn_flex.l" 1193 | {MP;BEGIN INITIAL;return QUOTE;} 1194 | YY_BREAK 1195 | /*return the text itself if it is '[' ':' ']' when in a " "*/ 1196 | case 46: 1197 | YY_RULE_SETUP 1198 | #line 110 "edn_flex.l" 1199 | {MP;return LP;} 1200 | YY_BREAK 1201 | case 47: 1202 | YY_RULE_SETUP 1203 | #line 111 "edn_flex.l" 1204 | {MP;return RP;} 1205 | YY_BREAK 1206 | case 48: 1207 | YY_RULE_SETUP 1208 | #line 112 "edn_flex.l" 1209 | {MP;return MD;} 1210 | YY_BREAK 1211 | case 49: 1212 | YY_RULE_SETUP 1213 | #line 114 "edn_flex.l" 1214 | {yylval.id=strdup(yytext);MP;return eINITIAL_VALUE;} 1215 | YY_BREAK 1216 | /*other words just treated as words to inform the commercial infomation and part-infomation */ 1217 | case 50: 1218 | YY_RULE_SETUP 1219 | #line 116 "edn_flex.l" 1220 | {yylval.num_value=atoi(yytext);MP;return eNUMBER;} 1221 | YY_BREAK 1222 | case 51: 1223 | YY_RULE_SETUP 1224 | #line 117 "edn_flex.l" 1225 | {yylval.id=strdup(yytext);MP;return eWORD_QUOTED;} 1226 | YY_BREAK 1227 | /* ignore the ,.- in a pair of quote */ 1228 | case 52: 1229 | YY_RULE_SETUP 1230 | #line 119 "edn_flex.l" 1231 | {MP;continue;} 1232 | YY_BREAK 1233 | case 53: 1234 | YY_RULE_SETUP 1235 | #line 120 "edn_flex.l" 1236 | {continue;/* ignore spaces*/} 1237 | YY_BREAK 1238 | /* others in a pair of quotes should been warned */ 1239 | case 54: 1240 | YY_RULE_SETUP 1241 | #line 122 "edn_flex.l" 1242 | {printf("User Waring:ignore %s in a parir quote \n",yytext);continue;} 1243 | YY_BREAK 1244 | /*the ( and ) leave to yyparse() to handle */ 1245 | case 55: 1246 | YY_RULE_SETUP 1247 | #line 127 "edn_flex.l" 1248 | {MP;return yytext[0];} 1249 | YY_BREAK 1250 | /* identifier */ 1251 | case 56: 1252 | YY_RULE_SETUP 1253 | #line 130 "edn_flex.l" 1254 | {yylval.id=strdup(yytext);return eIDENTIFIER;} 1255 | YY_BREAK 1256 | /*number */ 1257 | case 57: 1258 | YY_RULE_SETUP 1259 | #line 133 "edn_flex.l" 1260 | {yylval.num_value=atoi(yytext);MP;return eNUMBER;} 1261 | YY_BREAK 1262 | /*white space and new line */ 1263 | case 58: 1264 | YY_RULE_SETUP 1265 | #line 136 "edn_flex.l" 1266 | { /* ignore spaces */ continue;} 1267 | YY_BREAK 1268 | case 59: 1269 | /* rule 59 can match eol */ 1270 | YY_RULE_SETUP 1271 | #line 137 "edn_flex.l" 1272 | { /* ignore new line */ continue;} 1273 | YY_BREAK 1274 | case 60: 1275 | YY_RULE_SETUP 1276 | #line 138 "edn_flex.l" 1277 | {printf("User Warning:line no:%d text %s unrecogiized in edif source \n",yylineno,yytext);continue;} 1278 | YY_BREAK 1279 | case 61: 1280 | YY_RULE_SETUP 1281 | #line 141 "edn_flex.l" 1282 | ECHO; 1283 | YY_BREAK 1284 | #line 1285 "edn_flex.c" 1285 | case YY_STATE_EOF(INITIAL): 1286 | case YY_STATE_EOF(READING_STRING): 1287 | yyterminate(); 1288 | 1289 | case YY_END_OF_BUFFER: 1290 | { 1291 | /* Amount of text matched not including the EOB char. */ 1292 | int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; 1293 | 1294 | /* Undo the effects of YY_DO_BEFORE_ACTION. */ 1295 | *yy_cp = (yy_hold_char); 1296 | YY_RESTORE_YY_MORE_OFFSET 1297 | 1298 | if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) 1299 | { 1300 | /* We're scanning a new file or input source. It's 1301 | * possible that this happened because the user 1302 | * just pointed yyin at a new source and called 1303 | * yylex(). If so, then we have to assure 1304 | * consistency between YY_CURRENT_BUFFER and our 1305 | * globals. Here is the right place to do so, because 1306 | * this is the first action (other than possibly a 1307 | * back-up) that will match for the new input source. 1308 | */ 1309 | (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; 1310 | YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; 1311 | YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; 1312 | } 1313 | 1314 | /* Note that here we test for yy_c_buf_p "<=" to the position 1315 | * of the first EOB in the buffer, since yy_c_buf_p will 1316 | * already have been incremented past the NUL character 1317 | * (since all states make transitions on EOB to the 1318 | * end-of-buffer state). Contrast this with the test 1319 | * in input(). 1320 | */ 1321 | if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) 1322 | { /* This was really a NUL. */ 1323 | yy_state_type yy_next_state; 1324 | 1325 | (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; 1326 | 1327 | yy_current_state = yy_get_previous_state( ); 1328 | 1329 | /* Okay, we're now positioned to make the NUL 1330 | * transition. We couldn't have 1331 | * yy_get_previous_state() go ahead and do it 1332 | * for us because it doesn't know how to deal 1333 | * with the possibility of jamming (and we don't 1334 | * want to build jamming into it because then it 1335 | * will run more slowly). 1336 | */ 1337 | 1338 | yy_next_state = yy_try_NUL_trans( yy_current_state ); 1339 | 1340 | yy_bp = (yytext_ptr) + YY_MORE_ADJ; 1341 | 1342 | if ( yy_next_state ) 1343 | { 1344 | /* Consume the NUL. */ 1345 | yy_cp = ++(yy_c_buf_p); 1346 | yy_current_state = yy_next_state; 1347 | goto yy_match; 1348 | } 1349 | 1350 | else 1351 | { 1352 | yy_cp = (yy_c_buf_p); 1353 | goto yy_find_action; 1354 | } 1355 | } 1356 | 1357 | else switch ( yy_get_next_buffer( ) ) 1358 | { 1359 | case EOB_ACT_END_OF_FILE: 1360 | { 1361 | (yy_did_buffer_switch_on_eof) = 0; 1362 | 1363 | if ( yywrap( ) ) 1364 | { 1365 | /* Note: because we've taken care in 1366 | * yy_get_next_buffer() to have set up 1367 | * yytext, we can now set up 1368 | * yy_c_buf_p so that if some total 1369 | * hoser (like flex itself) wants to 1370 | * call the scanner after we return the 1371 | * YY_NULL, it'll still work - another 1372 | * YY_NULL will get returned. 1373 | */ 1374 | (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; 1375 | 1376 | yy_act = YY_STATE_EOF(YY_START); 1377 | goto do_action; 1378 | } 1379 | 1380 | else 1381 | { 1382 | if ( ! (yy_did_buffer_switch_on_eof) ) 1383 | YY_NEW_FILE; 1384 | } 1385 | break; 1386 | } 1387 | 1388 | case EOB_ACT_CONTINUE_SCAN: 1389 | (yy_c_buf_p) = 1390 | (yytext_ptr) + yy_amount_of_matched_text; 1391 | 1392 | yy_current_state = yy_get_previous_state( ); 1393 | 1394 | yy_cp = (yy_c_buf_p); 1395 | yy_bp = (yytext_ptr) + YY_MORE_ADJ; 1396 | goto yy_match; 1397 | 1398 | case EOB_ACT_LAST_MATCH: 1399 | (yy_c_buf_p) = 1400 | &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; 1401 | 1402 | yy_current_state = yy_get_previous_state( ); 1403 | 1404 | yy_cp = (yy_c_buf_p); 1405 | yy_bp = (yytext_ptr) + YY_MORE_ADJ; 1406 | goto yy_find_action; 1407 | } 1408 | break; 1409 | } 1410 | 1411 | default: 1412 | YY_FATAL_ERROR( 1413 | "fatal flex scanner internal error--no action found" ); 1414 | } /* end of action switch */ 1415 | } /* end of scanning one token */ 1416 | } /* end of yylex */ 1417 | 1418 | /* yy_get_next_buffer - try to read in a new buffer 1419 | * 1420 | * Returns a code representing an action: 1421 | * EOB_ACT_LAST_MATCH - 1422 | * EOB_ACT_CONTINUE_SCAN - continue scanning from current position 1423 | * EOB_ACT_END_OF_FILE - end of file 1424 | */ 1425 | static int yy_get_next_buffer (void) 1426 | { 1427 | register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; 1428 | register char *source = (yytext_ptr); 1429 | register int number_to_move, i; 1430 | int ret_val; 1431 | 1432 | if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) 1433 | YY_FATAL_ERROR( 1434 | "fatal flex scanner internal error--end of buffer missed" ); 1435 | 1436 | if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) 1437 | { /* Don't try to fill the buffer, so this is an EOF. */ 1438 | if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) 1439 | { 1440 | /* We matched a single character, the EOB, so 1441 | * treat this as a final EOF. 1442 | */ 1443 | return EOB_ACT_END_OF_FILE; 1444 | } 1445 | 1446 | else 1447 | { 1448 | /* We matched some text prior to the EOB, first 1449 | * process it. 1450 | */ 1451 | return EOB_ACT_LAST_MATCH; 1452 | } 1453 | } 1454 | 1455 | /* Try to read more data. */ 1456 | 1457 | /* First move last chars to start of buffer. */ 1458 | number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; 1459 | 1460 | for ( i = 0; i < number_to_move; ++i ) 1461 | *(dest++) = *(source++); 1462 | 1463 | if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) 1464 | /* don't do the read, it's not guaranteed to return an EOF, 1465 | * just force an EOF 1466 | */ 1467 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; 1468 | 1469 | else 1470 | { 1471 | int num_to_read = 1472 | YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; 1473 | 1474 | while ( num_to_read <= 0 ) 1475 | { /* Not enough room in the buffer - grow it. */ 1476 | 1477 | /* just a shorter name for the current buffer */ 1478 | YY_BUFFER_STATE b = YY_CURRENT_BUFFER; 1479 | 1480 | int yy_c_buf_p_offset = 1481 | (int) ((yy_c_buf_p) - b->yy_ch_buf); 1482 | 1483 | if ( b->yy_is_our_buffer ) 1484 | { 1485 | int new_size = b->yy_buf_size * 2; 1486 | 1487 | if ( new_size <= 0 ) 1488 | b->yy_buf_size += b->yy_buf_size / 8; 1489 | else 1490 | b->yy_buf_size *= 2; 1491 | 1492 | b->yy_ch_buf = (char *) 1493 | /* Include room in for 2 EOB chars. */ 1494 | yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); 1495 | } 1496 | else 1497 | /* Can't grow it, we don't own it. */ 1498 | b->yy_ch_buf = 0; 1499 | 1500 | if ( ! b->yy_ch_buf ) 1501 | YY_FATAL_ERROR( 1502 | "fatal error - scanner input buffer overflow" ); 1503 | 1504 | (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; 1505 | 1506 | num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - 1507 | number_to_move - 1; 1508 | 1509 | } 1510 | 1511 | if ( num_to_read > YY_READ_BUF_SIZE ) 1512 | num_to_read = YY_READ_BUF_SIZE; 1513 | 1514 | /* Read in more data. */ 1515 | YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), 1516 | (yy_n_chars), (size_t) num_to_read ); 1517 | 1518 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); 1519 | } 1520 | 1521 | if ( (yy_n_chars) == 0 ) 1522 | { 1523 | if ( number_to_move == YY_MORE_ADJ ) 1524 | { 1525 | ret_val = EOB_ACT_END_OF_FILE; 1526 | yyrestart(yyin ); 1527 | } 1528 | 1529 | else 1530 | { 1531 | ret_val = EOB_ACT_LAST_MATCH; 1532 | YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = 1533 | YY_BUFFER_EOF_PENDING; 1534 | } 1535 | } 1536 | 1537 | else 1538 | ret_val = EOB_ACT_CONTINUE_SCAN; 1539 | 1540 | if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { 1541 | /* Extend the array by 50%, plus the number we really need. */ 1542 | yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); 1543 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); 1544 | if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) 1545 | YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); 1546 | } 1547 | 1548 | (yy_n_chars) += number_to_move; 1549 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; 1550 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; 1551 | 1552 | (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; 1553 | 1554 | return ret_val; 1555 | } 1556 | 1557 | /* yy_get_previous_state - get the state just before the EOB char was reached */ 1558 | 1559 | static yy_state_type yy_get_previous_state (void) 1560 | { 1561 | register yy_state_type yy_current_state; 1562 | register char *yy_cp; 1563 | 1564 | yy_current_state = (yy_start); 1565 | 1566 | for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) 1567 | { 1568 | register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); 1569 | if ( yy_accept[yy_current_state] ) 1570 | { 1571 | (yy_last_accepting_state) = yy_current_state; 1572 | (yy_last_accepting_cpos) = yy_cp; 1573 | } 1574 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 1575 | { 1576 | yy_current_state = (int) yy_def[yy_current_state]; 1577 | if ( yy_current_state >= 266 ) 1578 | yy_c = yy_meta[(unsigned int) yy_c]; 1579 | } 1580 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 1581 | } 1582 | 1583 | return yy_current_state; 1584 | } 1585 | 1586 | /* yy_try_NUL_trans - try to make a transition on the NUL character 1587 | * 1588 | * synopsis 1589 | * next_state = yy_try_NUL_trans( current_state ); 1590 | */ 1591 | static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) 1592 | { 1593 | register int yy_is_jam; 1594 | register char *yy_cp = (yy_c_buf_p); 1595 | 1596 | register YY_CHAR yy_c = 1; 1597 | if ( yy_accept[yy_current_state] ) 1598 | { 1599 | (yy_last_accepting_state) = yy_current_state; 1600 | (yy_last_accepting_cpos) = yy_cp; 1601 | } 1602 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 1603 | { 1604 | yy_current_state = (int) yy_def[yy_current_state]; 1605 | if ( yy_current_state >= 266 ) 1606 | yy_c = yy_meta[(unsigned int) yy_c]; 1607 | } 1608 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 1609 | yy_is_jam = (yy_current_state == 265); 1610 | 1611 | return yy_is_jam ? 0 : yy_current_state; 1612 | } 1613 | 1614 | static void yyunput (int c, register char * yy_bp ) 1615 | { 1616 | register char *yy_cp; 1617 | 1618 | yy_cp = (yy_c_buf_p); 1619 | 1620 | /* undo effects of setting up yytext */ 1621 | *yy_cp = (yy_hold_char); 1622 | 1623 | if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) 1624 | { /* need to shift things up to make room */ 1625 | /* +2 for EOB chars. */ 1626 | register int number_to_move = (yy_n_chars) + 2; 1627 | register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ 1628 | YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; 1629 | register char *source = 1630 | &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; 1631 | 1632 | while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) 1633 | *--dest = *--source; 1634 | 1635 | yy_cp += (int) (dest - source); 1636 | yy_bp += (int) (dest - source); 1637 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = 1638 | (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; 1639 | 1640 | if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) 1641 | YY_FATAL_ERROR( "flex scanner push-back overflow" ); 1642 | } 1643 | 1644 | *--yy_cp = (char) c; 1645 | 1646 | if ( c == '\n' ){ 1647 | --yylineno; 1648 | } 1649 | 1650 | (yytext_ptr) = yy_bp; 1651 | (yy_hold_char) = *yy_cp; 1652 | (yy_c_buf_p) = yy_cp; 1653 | } 1654 | 1655 | #ifndef YY_NO_INPUT 1656 | #ifdef __cplusplus 1657 | static int yyinput (void) 1658 | #else 1659 | static int input (void) 1660 | #endif 1661 | 1662 | { 1663 | int c; 1664 | 1665 | *(yy_c_buf_p) = (yy_hold_char); 1666 | 1667 | if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) 1668 | { 1669 | /* yy_c_buf_p now points to the character we want to return. 1670 | * If this occurs *before* the EOB characters, then it's a 1671 | * valid NUL; if not, then we've hit the end of the buffer. 1672 | */ 1673 | if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) 1674 | /* This was really a NUL. */ 1675 | *(yy_c_buf_p) = '\0'; 1676 | 1677 | else 1678 | { /* need more input */ 1679 | int offset = (yy_c_buf_p) - (yytext_ptr); 1680 | ++(yy_c_buf_p); 1681 | 1682 | switch ( yy_get_next_buffer( ) ) 1683 | { 1684 | case EOB_ACT_LAST_MATCH: 1685 | /* This happens because yy_g_n_b() 1686 | * sees that we've accumulated a 1687 | * token and flags that we need to 1688 | * try matching the token before 1689 | * proceeding. But for input(), 1690 | * there's no matching to consider. 1691 | * So convert the EOB_ACT_LAST_MATCH 1692 | * to EOB_ACT_END_OF_FILE. 1693 | */ 1694 | 1695 | /* Reset buffer status. */ 1696 | yyrestart(yyin ); 1697 | 1698 | /*FALLTHROUGH*/ 1699 | 1700 | case EOB_ACT_END_OF_FILE: 1701 | { 1702 | if ( yywrap( ) ) 1703 | return EOF; 1704 | 1705 | if ( ! (yy_did_buffer_switch_on_eof) ) 1706 | YY_NEW_FILE; 1707 | #ifdef __cplusplus 1708 | return yyinput(); 1709 | #else 1710 | return input(); 1711 | #endif 1712 | } 1713 | 1714 | case EOB_ACT_CONTINUE_SCAN: 1715 | (yy_c_buf_p) = (yytext_ptr) + offset; 1716 | break; 1717 | } 1718 | } 1719 | } 1720 | 1721 | c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ 1722 | *(yy_c_buf_p) = '\0'; /* preserve yytext */ 1723 | (yy_hold_char) = *++(yy_c_buf_p); 1724 | 1725 | if ( c == '\n' ) 1726 | 1727 | yylineno++; 1728 | ; 1729 | 1730 | return c; 1731 | } 1732 | #endif /* ifndef YY_NO_INPUT */ 1733 | 1734 | /** Immediately switch to a different input stream. 1735 | * @param input_file A readable stream. 1736 | * 1737 | * @note This function does not reset the start condition to @c INITIAL . 1738 | */ 1739 | void yyrestart (FILE * input_file ) 1740 | { 1741 | 1742 | if ( ! YY_CURRENT_BUFFER ){ 1743 | yyensure_buffer_stack (); 1744 | YY_CURRENT_BUFFER_LVALUE = 1745 | yy_create_buffer(yyin,YY_BUF_SIZE ); 1746 | } 1747 | 1748 | yy_init_buffer(YY_CURRENT_BUFFER,input_file ); 1749 | yy_load_buffer_state( ); 1750 | } 1751 | 1752 | /** Switch to a different input buffer. 1753 | * @param new_buffer The new input buffer. 1754 | * 1755 | */ 1756 | void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) 1757 | { 1758 | 1759 | /* TODO. We should be able to replace this entire function body 1760 | * with 1761 | * yypop_buffer_state(); 1762 | * yypush_buffer_state(new_buffer); 1763 | */ 1764 | yyensure_buffer_stack (); 1765 | if ( YY_CURRENT_BUFFER == new_buffer ) 1766 | return; 1767 | 1768 | if ( YY_CURRENT_BUFFER ) 1769 | { 1770 | /* Flush out information for old buffer. */ 1771 | *(yy_c_buf_p) = (yy_hold_char); 1772 | YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); 1773 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); 1774 | } 1775 | 1776 | YY_CURRENT_BUFFER_LVALUE = new_buffer; 1777 | yy_load_buffer_state( ); 1778 | 1779 | /* We don't actually know whether we did this switch during 1780 | * EOF (yywrap()) processing, but the only time this flag 1781 | * is looked at is after yywrap() is called, so it's safe 1782 | * to go ahead and always set it. 1783 | */ 1784 | (yy_did_buffer_switch_on_eof) = 1; 1785 | } 1786 | 1787 | static void yy_load_buffer_state (void) 1788 | { 1789 | (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; 1790 | (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; 1791 | yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; 1792 | (yy_hold_char) = *(yy_c_buf_p); 1793 | } 1794 | 1795 | /** Allocate and initialize an input buffer state. 1796 | * @param file A readable stream. 1797 | * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. 1798 | * 1799 | * @return the allocated buffer state. 1800 | */ 1801 | YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) 1802 | { 1803 | YY_BUFFER_STATE b; 1804 | 1805 | b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); 1806 | if ( ! b ) 1807 | YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); 1808 | 1809 | b->yy_buf_size = size; 1810 | 1811 | /* yy_ch_buf has to be 2 characters longer than the size given because 1812 | * we need to put in 2 end-of-buffer characters. 1813 | */ 1814 | b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); 1815 | if ( ! b->yy_ch_buf ) 1816 | YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); 1817 | 1818 | b->yy_is_our_buffer = 1; 1819 | 1820 | yy_init_buffer(b,file ); 1821 | 1822 | return b; 1823 | } 1824 | 1825 | /** Destroy the buffer. 1826 | * @param b a buffer created with yy_create_buffer() 1827 | * 1828 | */ 1829 | void yy_delete_buffer (YY_BUFFER_STATE b ) 1830 | { 1831 | 1832 | if ( ! b ) 1833 | return; 1834 | 1835 | if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ 1836 | YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; 1837 | 1838 | if ( b->yy_is_our_buffer ) 1839 | yyfree((void *) b->yy_ch_buf ); 1840 | 1841 | yyfree((void *) b ); 1842 | } 1843 | 1844 | #ifndef __cplusplus 1845 | extern int isatty (int ); 1846 | #endif /* __cplusplus */ 1847 | 1848 | /* Initializes or reinitializes a buffer. 1849 | * This function is sometimes called more than once on the same buffer, 1850 | * such as during a yyrestart() or at EOF. 1851 | */ 1852 | static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) 1853 | 1854 | { 1855 | int oerrno = errno; 1856 | 1857 | yy_flush_buffer(b ); 1858 | 1859 | b->yy_input_file = file; 1860 | b->yy_fill_buffer = 1; 1861 | 1862 | /* If b is the current buffer, then yy_init_buffer was _probably_ 1863 | * called from yyrestart() or through yy_get_next_buffer. 1864 | * In that case, we don't want to reset the lineno or column. 1865 | */ 1866 | if (b != YY_CURRENT_BUFFER){ 1867 | b->yy_bs_lineno = 1; 1868 | b->yy_bs_column = 0; 1869 | } 1870 | 1871 | b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; 1872 | 1873 | errno = oerrno; 1874 | } 1875 | 1876 | /** Discard all buffered characters. On the next scan, YY_INPUT will be called. 1877 | * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. 1878 | * 1879 | */ 1880 | void yy_flush_buffer (YY_BUFFER_STATE b ) 1881 | { 1882 | if ( ! b ) 1883 | return; 1884 | 1885 | b->yy_n_chars = 0; 1886 | 1887 | /* We always need two end-of-buffer characters. The first causes 1888 | * a transition to the end-of-buffer state. The second causes 1889 | * a jam in that state. 1890 | */ 1891 | b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; 1892 | b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; 1893 | 1894 | b->yy_buf_pos = &b->yy_ch_buf[0]; 1895 | 1896 | b->yy_at_bol = 1; 1897 | b->yy_buffer_status = YY_BUFFER_NEW; 1898 | 1899 | if ( b == YY_CURRENT_BUFFER ) 1900 | yy_load_buffer_state( ); 1901 | } 1902 | 1903 | /** Pushes the new state onto the stack. The new state becomes 1904 | * the current state. This function will allocate the stack 1905 | * if necessary. 1906 | * @param new_buffer The new state. 1907 | * 1908 | */ 1909 | void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) 1910 | { 1911 | if (new_buffer == NULL) 1912 | return; 1913 | 1914 | yyensure_buffer_stack(); 1915 | 1916 | /* This block is copied from yy_switch_to_buffer. */ 1917 | if ( YY_CURRENT_BUFFER ) 1918 | { 1919 | /* Flush out information for old buffer. */ 1920 | *(yy_c_buf_p) = (yy_hold_char); 1921 | YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); 1922 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); 1923 | } 1924 | 1925 | /* Only push if top exists. Otherwise, replace top. */ 1926 | if (YY_CURRENT_BUFFER) 1927 | (yy_buffer_stack_top)++; 1928 | YY_CURRENT_BUFFER_LVALUE = new_buffer; 1929 | 1930 | /* copied from yy_switch_to_buffer. */ 1931 | yy_load_buffer_state( ); 1932 | (yy_did_buffer_switch_on_eof) = 1; 1933 | } 1934 | 1935 | /** Removes and deletes the top of the stack, if present. 1936 | * The next element becomes the new top. 1937 | * 1938 | */ 1939 | void yypop_buffer_state (void) 1940 | { 1941 | if (!YY_CURRENT_BUFFER) 1942 | return; 1943 | 1944 | yy_delete_buffer(YY_CURRENT_BUFFER ); 1945 | YY_CURRENT_BUFFER_LVALUE = NULL; 1946 | if ((yy_buffer_stack_top) > 0) 1947 | --(yy_buffer_stack_top); 1948 | 1949 | if (YY_CURRENT_BUFFER) { 1950 | yy_load_buffer_state( ); 1951 | (yy_did_buffer_switch_on_eof) = 1; 1952 | } 1953 | } 1954 | 1955 | /* Allocates the stack if it does not exist. 1956 | * Guarantees space for at least one push. 1957 | */ 1958 | static void yyensure_buffer_stack (void) 1959 | { 1960 | int num_to_alloc; 1961 | 1962 | if (!(yy_buffer_stack)) { 1963 | 1964 | /* First allocation is just for 2 elements, since we don't know if this 1965 | * scanner will even need a stack. We use 2 instead of 1 to avoid an 1966 | * immediate realloc on the next call. 1967 | */ 1968 | num_to_alloc = 1; 1969 | (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc 1970 | (num_to_alloc * sizeof(struct yy_buffer_state*) 1971 | ); 1972 | if ( ! (yy_buffer_stack) ) 1973 | YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); 1974 | 1975 | memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); 1976 | 1977 | (yy_buffer_stack_max) = num_to_alloc; 1978 | (yy_buffer_stack_top) = 0; 1979 | return; 1980 | } 1981 | 1982 | if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ 1983 | 1984 | /* Increase the buffer to prepare for a possible push. */ 1985 | int grow_size = 8 /* arbitrary grow size */; 1986 | 1987 | num_to_alloc = (yy_buffer_stack_max) + grow_size; 1988 | (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc 1989 | ((yy_buffer_stack), 1990 | num_to_alloc * sizeof(struct yy_buffer_state*) 1991 | ); 1992 | if ( ! (yy_buffer_stack) ) 1993 | YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); 1994 | 1995 | /* zero only the new slots.*/ 1996 | memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); 1997 | (yy_buffer_stack_max) = num_to_alloc; 1998 | } 1999 | } 2000 | 2001 | /** Setup the input buffer state to scan directly from a user-specified character buffer. 2002 | * @param base the character buffer 2003 | * @param size the size in bytes of the character buffer 2004 | * 2005 | * @return the newly allocated buffer state object. 2006 | */ 2007 | YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) 2008 | { 2009 | YY_BUFFER_STATE b; 2010 | 2011 | if ( size < 2 || 2012 | base[size-2] != YY_END_OF_BUFFER_CHAR || 2013 | base[size-1] != YY_END_OF_BUFFER_CHAR ) 2014 | /* They forgot to leave room for the EOB's. */ 2015 | return 0; 2016 | 2017 | b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); 2018 | if ( ! b ) 2019 | YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); 2020 | 2021 | b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ 2022 | b->yy_buf_pos = b->yy_ch_buf = base; 2023 | b->yy_is_our_buffer = 0; 2024 | b->yy_input_file = 0; 2025 | b->yy_n_chars = b->yy_buf_size; 2026 | b->yy_is_interactive = 0; 2027 | b->yy_at_bol = 1; 2028 | b->yy_fill_buffer = 0; 2029 | b->yy_buffer_status = YY_BUFFER_NEW; 2030 | 2031 | yy_switch_to_buffer(b ); 2032 | 2033 | return b; 2034 | } 2035 | 2036 | /** Setup the input buffer state to scan a string. The next call to yylex() will 2037 | * scan from a @e copy of @a str. 2038 | * @param yystr a NUL-terminated string to scan 2039 | * 2040 | * @return the newly allocated buffer state object. 2041 | * @note If you want to scan bytes that may contain NUL values, then use 2042 | * yy_scan_bytes() instead. 2043 | */ 2044 | YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) 2045 | { 2046 | 2047 | return yy_scan_bytes(yystr,strlen(yystr) ); 2048 | } 2049 | 2050 | /** Setup the input buffer state to scan the given bytes. The next call to yylex() will 2051 | * scan from a @e copy of @a bytes. 2052 | * @param yybytes the byte buffer to scan 2053 | * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. 2054 | * 2055 | * @return the newly allocated buffer state object. 2056 | */ 2057 | YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) 2058 | { 2059 | YY_BUFFER_STATE b; 2060 | char *buf; 2061 | yy_size_t n; 2062 | int i; 2063 | 2064 | /* Get memory for full buffer, including space for trailing EOB's. */ 2065 | n = _yybytes_len + 2; 2066 | buf = (char *) yyalloc(n ); 2067 | if ( ! buf ) 2068 | YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); 2069 | 2070 | for ( i = 0; i < _yybytes_len; ++i ) 2071 | buf[i] = yybytes[i]; 2072 | 2073 | buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; 2074 | 2075 | b = yy_scan_buffer(buf,n ); 2076 | if ( ! b ) 2077 | YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); 2078 | 2079 | /* It's okay to grow etc. this buffer, and we should throw it 2080 | * away when we're done. 2081 | */ 2082 | b->yy_is_our_buffer = 1; 2083 | 2084 | return b; 2085 | } 2086 | 2087 | #ifndef YY_EXIT_FAILURE 2088 | #define YY_EXIT_FAILURE 2 2089 | #endif 2090 | 2091 | static void yy_fatal_error (yyconst char* msg ) 2092 | { 2093 | (void) fprintf( stderr, "%s\n", msg ); 2094 | exit( YY_EXIT_FAILURE ); 2095 | } 2096 | 2097 | /* Redefine yyless() so it works in section 3 code. */ 2098 | 2099 | #undef yyless 2100 | #define yyless(n) \ 2101 | do \ 2102 | { \ 2103 | /* Undo effects of setting up yytext. */ \ 2104 | int yyless_macro_arg = (n); \ 2105 | YY_LESS_LINENO(yyless_macro_arg);\ 2106 | yytext[yyleng] = (yy_hold_char); \ 2107 | (yy_c_buf_p) = yytext + yyless_macro_arg; \ 2108 | (yy_hold_char) = *(yy_c_buf_p); \ 2109 | *(yy_c_buf_p) = '\0'; \ 2110 | yyleng = yyless_macro_arg; \ 2111 | } \ 2112 | while ( 0 ) 2113 | 2114 | /* Accessor methods (get/set functions) to struct members. */ 2115 | 2116 | /** Get the current line number. 2117 | * 2118 | */ 2119 | int yyget_lineno (void) 2120 | { 2121 | 2122 | return yylineno; 2123 | } 2124 | 2125 | /** Get the input stream. 2126 | * 2127 | */ 2128 | FILE *yyget_in (void) 2129 | { 2130 | return yyin; 2131 | } 2132 | 2133 | /** Get the output stream. 2134 | * 2135 | */ 2136 | FILE *yyget_out (void) 2137 | { 2138 | return yyout; 2139 | } 2140 | 2141 | /** Get the length of the current token. 2142 | * 2143 | */ 2144 | int yyget_leng (void) 2145 | { 2146 | return yyleng; 2147 | } 2148 | 2149 | /** Get the current token. 2150 | * 2151 | */ 2152 | 2153 | char *yyget_text (void) 2154 | { 2155 | return yytext; 2156 | } 2157 | 2158 | /** Set the current line number. 2159 | * @param line_number 2160 | * 2161 | */ 2162 | void yyset_lineno (int line_number ) 2163 | { 2164 | 2165 | yylineno = line_number; 2166 | } 2167 | 2168 | /** Set the input stream. This does not discard the current 2169 | * input buffer. 2170 | * @param in_str A readable stream. 2171 | * 2172 | * @see yy_switch_to_buffer 2173 | */ 2174 | void yyset_in (FILE * in_str ) 2175 | { 2176 | yyin = in_str ; 2177 | } 2178 | 2179 | void yyset_out (FILE * out_str ) 2180 | { 2181 | yyout = out_str ; 2182 | } 2183 | 2184 | int yyget_debug (void) 2185 | { 2186 | return yy_flex_debug; 2187 | } 2188 | 2189 | void yyset_debug (int bdebug ) 2190 | { 2191 | yy_flex_debug = bdebug ; 2192 | } 2193 | 2194 | static int yy_init_globals (void) 2195 | { 2196 | /* Initialization is the same as for the non-reentrant scanner. 2197 | * This function is called from yylex_destroy(), so don't allocate here. 2198 | */ 2199 | 2200 | /* We do not touch yylineno unless the option is enabled. */ 2201 | yylineno = 1; 2202 | 2203 | (yy_buffer_stack) = 0; 2204 | (yy_buffer_stack_top) = 0; 2205 | (yy_buffer_stack_max) = 0; 2206 | (yy_c_buf_p) = (char *) 0; 2207 | (yy_init) = 0; 2208 | (yy_start) = 0; 2209 | 2210 | /* Defined in main.c */ 2211 | #ifdef YY_STDINIT 2212 | yyin = stdin; 2213 | yyout = stdout; 2214 | #else 2215 | yyin = (FILE *) 0; 2216 | yyout = (FILE *) 0; 2217 | #endif 2218 | 2219 | /* For future reference: Set errno on error, since we are called by 2220 | * yylex_init() 2221 | */ 2222 | return 0; 2223 | } 2224 | 2225 | /* yylex_destroy is for both reentrant and non-reentrant scanners. */ 2226 | int yylex_destroy (void) 2227 | { 2228 | 2229 | /* Pop the buffer stack, destroying each element. */ 2230 | while(YY_CURRENT_BUFFER){ 2231 | yy_delete_buffer(YY_CURRENT_BUFFER ); 2232 | YY_CURRENT_BUFFER_LVALUE = NULL; 2233 | yypop_buffer_state(); 2234 | } 2235 | 2236 | /* Destroy the stack itself. */ 2237 | yyfree((yy_buffer_stack) ); 2238 | (yy_buffer_stack) = NULL; 2239 | 2240 | /* Reset the globals. This is important in a non-reentrant scanner so the next time 2241 | * yylex() is called, initialization will occur. */ 2242 | yy_init_globals( ); 2243 | 2244 | return 0; 2245 | } 2246 | 2247 | /* 2248 | * Internal utility routines. 2249 | */ 2250 | 2251 | #ifndef yytext_ptr 2252 | static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) 2253 | { 2254 | register int i; 2255 | for ( i = 0; i < n; ++i ) 2256 | s1[i] = s2[i]; 2257 | } 2258 | #endif 2259 | 2260 | #ifdef YY_NEED_STRLEN 2261 | static int yy_flex_strlen (yyconst char * s ) 2262 | { 2263 | register int n; 2264 | for ( n = 0; s[n]; ++n ) 2265 | ; 2266 | 2267 | return n; 2268 | } 2269 | #endif 2270 | 2271 | void *yyalloc (yy_size_t size ) 2272 | { 2273 | return (void *) malloc( size ); 2274 | } 2275 | 2276 | void *yyrealloc (void * ptr, yy_size_t size ) 2277 | { 2278 | /* The cast to (char *) in the following accommodates both 2279 | * implementations that use char* generic pointers, and those 2280 | * that use void* generic pointers. It works with the latter 2281 | * because both ANSI C and C++ allow castless assignment from 2282 | * any pointer type to void*, and deal with argument conversions 2283 | * as though doing an assignment. 2284 | */ 2285 | return (void *) realloc( (char *) ptr, size ); 2286 | } 2287 | 2288 | void yyfree (void * ptr ) 2289 | { 2290 | free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ 2291 | } 2292 | 2293 | #define YYTABLES_NAME "yytables" 2294 | 2295 | #line 141 "edn_flex.l" 2296 | -------------------------------------------------------------------------------- /edn_bison.c: -------------------------------------------------------------------------------- 1 | /* A Bison parser, made by GNU Bison 3.0.2. */ 2 | 3 | /* Bison implementation for Yacc-like parsers in C 4 | 5 | Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. 6 | 7 | This program is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . */ 19 | 20 | /* As a special exception, you may create a larger work that contains 21 | part or all of the Bison parser skeleton and distribute that work 22 | under terms of your choice, so long as that work isn't itself a 23 | parser generator using the skeleton or a modified version thereof 24 | as a parser skeleton. Alternatively, if you modify or redistribute 25 | the parser skeleton itself, you may (at your option) remove this 26 | special exception, which will cause the skeleton and the resulting 27 | Bison output files to be licensed under the GNU General Public 28 | License without this special exception. 29 | 30 | This special exception was added by the Free Software Foundation in 31 | version 2.2 of Bison. */ 32 | 33 | /* C LALR(1) parser skeleton written by Richard Stallman, by 34 | simplifying the original so-called "semantic" parser. */ 35 | 36 | /* All symbols defined below should begin with yy or YY, to avoid 37 | infringing on user name space. This should be done even for local 38 | variables, as they might otherwise be expanded by user macros. 39 | There are some unavoidable exceptions within include files to 40 | define necessary library symbols; they are noted "INFRINGES ON 41 | USER NAME SPACE" below. */ 42 | 43 | /* Identify Bison output. */ 44 | #define YYBISON 1 45 | 46 | /* Bison version. */ 47 | #define YYBISON_VERSION "3.0.2" 48 | 49 | /* Skeleton name. */ 50 | #define YYSKELETON_NAME "yacc.c" 51 | 52 | /* Pure parsers. */ 53 | #define YYPURE 0 54 | 55 | /* Push parsers. */ 56 | #define YYPUSH 0 57 | 58 | /* Pull parsers. */ 59 | #define YYPULL 1 60 | 61 | 62 | 63 | 64 | /* Copy the first part of user declarations. */ 65 | #line 1 "edn_bison.y" /* yacc.c:339 */ 66 | 67 | 68 | #include 69 | #include 70 | #include 71 | #include "type.h" 72 | #include "node_util.h" 73 | 74 | #ifndef YYLINENO 75 | int yylineno; 76 | #define YYLINENO yylineno 77 | #else 78 | extern int yylineno; 79 | #endif 80 | 81 | 82 | /*---------------------------------------------------------------------------------*/ 83 | /*宏定义与函数声明*/ 84 | /*---------------------------------------------------------------------------------*/ 85 | //#define TO_VIEW_LIB_REF 86 | 87 | #ifdef TO_VIEW_LIB_REF 88 | #define to_view_lib_ref 1 89 | #else 90 | #define to_view_lib_ref 0 91 | #endif 92 | 93 | extern top_EDIF *p_top_edif; 94 | 95 | 96 | void yyerror(const char *str); 97 | int yywrap(); 98 | extern int yylex(); 99 | 100 | // RESPONCE in an error 101 | void yyerror(const char *str){fprintf(stderr,"error in parsing: %s - on line number %d\n",str, yylineno);} 102 | // point of continued file reading 103 | int yywrap(){printf("come to the end of this file\n");return 1;} 104 | 105 | //virables global 106 | int prim_type_count; 107 | //virables to record some tmp number 108 | int cnt_tmp; //just a variable to use for alloction of mem for a port list 109 | 110 | 111 | #line 112 "edn_bison.c" /* yacc.c:339 */ 112 | 113 | # ifndef YY_NULLPTR 114 | # if defined __cplusplus && 201103L <= __cplusplus 115 | # define YY_NULLPTR nullptr 116 | # else 117 | # define YY_NULLPTR 0 118 | # endif 119 | # endif 120 | 121 | /* Enabling verbose error messages. */ 122 | #ifdef YYERROR_VERBOSE 123 | # undef YYERROR_VERBOSE 124 | # define YYERROR_VERBOSE 1 125 | #else 126 | # define YYERROR_VERBOSE 1 127 | #endif 128 | 129 | /* In a future release of Bison, this section will be replaced 130 | by #include "edn_bison.h". */ 131 | #ifndef YY_YY_EDN_BISON_H_INCLUDED 132 | # define YY_YY_EDN_BISON_H_INCLUDED 133 | /* Debug traces. */ 134 | #ifndef YYDEBUG 135 | # define YYDEBUG 0 136 | #endif 137 | #if YYDEBUG 138 | extern int yydebug; 139 | #endif 140 | 141 | /* Token type. */ 142 | #ifndef YYTOKENTYPE 143 | # define YYTOKENTYPE 144 | enum yytokentype 145 | { 146 | EDIF = 258, 147 | EDIFVERSION = 259, 148 | EDIFLEVEL = 260, 149 | EKEYWORDMAP = 261, 150 | EKEYWORDLEVEL = 262, 151 | ESTATUS = 263, 152 | EWRITTEN = 264, 153 | ETIMESTAMP = 265, 154 | EAUTHOR = 266, 155 | EPROGRAM = 267, 156 | EVERSION = 268, 157 | eLIBRARY = 269, 158 | eTECHNOLOGY = 270, 159 | eLIBRARYREF = 271, 160 | eCELL = 272, 161 | eCELLTYPE = 273, 162 | eCELLREF = 274, 163 | eVIEW = 275, 164 | eVIEWTYPE = 276, 165 | eVIEWREF = 277, 166 | eINTERFACE = 278, 167 | ePORT = 279, 168 | eARRAY = 280, 169 | eDIRECTION = 281, 170 | eINPUT = 282, 171 | eOUTPUT = 283, 172 | eINOUT = 284, 173 | eCONTENTS = 285, 174 | eINSTANCE = 286, 175 | eRENAME = 287, 176 | ePROPERTY = 288, 177 | eSTRING = 289, 178 | eINTEGER = 290, 179 | eNET = 291, 180 | eJOINED = 292, 181 | ePORTREF = 293, 182 | eMEMBER = 294, 183 | eINSTANCEREF = 295, 184 | eDESIGN = 296, 185 | LP = 297, 186 | RP = 298, 187 | MD = 299, 188 | QUOTE = 300, 189 | eWORK = 301, 190 | eGENERIC = 302, 191 | ePRIM = 303, 192 | eNETLIST = 304, 193 | eINITIAL_VALUE = 305, 194 | eIDENTIFIER = 306, 195 | eWORD_QUOTED = 307, 196 | eNUMBER = 308 197 | }; 198 | #endif 199 | 200 | /* Value type. */ 201 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 202 | typedef union YYSTYPE YYSTYPE; 203 | union YYSTYPE 204 | { 205 | #line 51 "edn_bison.y" /* yacc.c:355 */ 206 | 207 | char *id; 208 | int num_value; 209 | 210 | top_EDIF *top_EDIF_NODE; 211 | //struct just for ref_lib 212 | REF_LIBRARY *ref_library_node; 213 | PRIM_CELL *prim_node; 214 | PORT *port_node; 215 | 216 | CELL *cell_node; 217 | VIEW *view_node; 218 | VIEW_CELL_LIB_REF *view_cell_lib_ref_node; 219 | PROPERTY *property_node; 220 | INSTANCE *instance_node; 221 | 222 | PORTREF *portref_node; 223 | NET *net_node; 224 | 225 | #line 226 "edn_bison.c" /* yacc.c:355 */ 226 | }; 227 | # define YYSTYPE_IS_TRIVIAL 1 228 | # define YYSTYPE_IS_DECLARED 1 229 | #endif 230 | 231 | 232 | extern YYSTYPE yylval; 233 | 234 | int yyparse (void); 235 | 236 | #endif /* !YY_YY_EDN_BISON_H_INCLUDED */ 237 | 238 | /* Copy the second part of user declarations. */ 239 | 240 | #line 241 "edn_bison.c" /* yacc.c:358 */ 241 | 242 | #ifdef short 243 | # undef short 244 | #endif 245 | 246 | #ifdef YYTYPE_UINT8 247 | typedef YYTYPE_UINT8 yytype_uint8; 248 | #else 249 | typedef unsigned char yytype_uint8; 250 | #endif 251 | 252 | #ifdef YYTYPE_INT8 253 | typedef YYTYPE_INT8 yytype_int8; 254 | #else 255 | typedef signed char yytype_int8; 256 | #endif 257 | 258 | #ifdef YYTYPE_UINT16 259 | typedef YYTYPE_UINT16 yytype_uint16; 260 | #else 261 | typedef unsigned short int yytype_uint16; 262 | #endif 263 | 264 | #ifdef YYTYPE_INT16 265 | typedef YYTYPE_INT16 yytype_int16; 266 | #else 267 | typedef short int yytype_int16; 268 | #endif 269 | 270 | #ifndef YYSIZE_T 271 | # ifdef __SIZE_TYPE__ 272 | # define YYSIZE_T __SIZE_TYPE__ 273 | # elif defined size_t 274 | # define YYSIZE_T size_t 275 | # elif ! defined YYSIZE_T 276 | # include /* INFRINGES ON USER NAME SPACE */ 277 | # define YYSIZE_T size_t 278 | # else 279 | # define YYSIZE_T unsigned int 280 | # endif 281 | #endif 282 | 283 | #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) 284 | 285 | #ifndef YY_ 286 | # if defined YYENABLE_NLS && YYENABLE_NLS 287 | # if ENABLE_NLS 288 | # include /* INFRINGES ON USER NAME SPACE */ 289 | # define YY_(Msgid) dgettext ("bison-runtime", Msgid) 290 | # endif 291 | # endif 292 | # ifndef YY_ 293 | # define YY_(Msgid) Msgid 294 | # endif 295 | #endif 296 | 297 | #ifndef YY_ATTRIBUTE 298 | # if (defined __GNUC__ \ 299 | && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ 300 | || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C 301 | # define YY_ATTRIBUTE(Spec) __attribute__(Spec) 302 | # else 303 | # define YY_ATTRIBUTE(Spec) /* empty */ 304 | # endif 305 | #endif 306 | 307 | #ifndef YY_ATTRIBUTE_PURE 308 | # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) 309 | #endif 310 | 311 | #ifndef YY_ATTRIBUTE_UNUSED 312 | # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) 313 | #endif 314 | 315 | #if !defined _Noreturn \ 316 | && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) 317 | # if defined _MSC_VER && 1200 <= _MSC_VER 318 | # define _Noreturn __declspec (noreturn) 319 | # else 320 | # define _Noreturn YY_ATTRIBUTE ((__noreturn__)) 321 | # endif 322 | #endif 323 | 324 | /* Suppress unused-variable warnings by "using" E. */ 325 | #if ! defined lint || defined __GNUC__ 326 | # define YYUSE(E) ((void) (E)) 327 | #else 328 | # define YYUSE(E) /* empty */ 329 | #endif 330 | 331 | #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ 332 | /* Suppress an incorrect diagnostic about yylval being uninitialized. */ 333 | # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ 334 | _Pragma ("GCC diagnostic push") \ 335 | _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ 336 | _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") 337 | # define YY_IGNORE_MAYBE_UNINITIALIZED_END \ 338 | _Pragma ("GCC diagnostic pop") 339 | #else 340 | # define YY_INITIAL_VALUE(Value) Value 341 | #endif 342 | #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 343 | # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 344 | # define YY_IGNORE_MAYBE_UNINITIALIZED_END 345 | #endif 346 | #ifndef YY_INITIAL_VALUE 347 | # define YY_INITIAL_VALUE(Value) /* Nothing. */ 348 | #endif 349 | 350 | 351 | #if ! defined yyoverflow || YYERROR_VERBOSE 352 | 353 | /* The parser invokes alloca or malloc; define the necessary symbols. */ 354 | 355 | # ifdef YYSTACK_USE_ALLOCA 356 | # if YYSTACK_USE_ALLOCA 357 | # ifdef __GNUC__ 358 | # define YYSTACK_ALLOC __builtin_alloca 359 | # elif defined __BUILTIN_VA_ARG_INCR 360 | # include /* INFRINGES ON USER NAME SPACE */ 361 | # elif defined _AIX 362 | # define YYSTACK_ALLOC __alloca 363 | # elif defined _MSC_VER 364 | # include /* INFRINGES ON USER NAME SPACE */ 365 | # define alloca _alloca 366 | # else 367 | # define YYSTACK_ALLOC alloca 368 | # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS 369 | # include /* INFRINGES ON USER NAME SPACE */ 370 | /* Use EXIT_SUCCESS as a witness for stdlib.h. */ 371 | # ifndef EXIT_SUCCESS 372 | # define EXIT_SUCCESS 0 373 | # endif 374 | # endif 375 | # endif 376 | # endif 377 | # endif 378 | 379 | # ifdef YYSTACK_ALLOC 380 | /* Pacify GCC's 'empty if-body' warning. */ 381 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) 382 | # ifndef YYSTACK_ALLOC_MAXIMUM 383 | /* The OS might guarantee only one guard page at the bottom of the stack, 384 | and a page size can be as small as 4096 bytes. So we cannot safely 385 | invoke alloca (N) if N exceeds 4096. Use a slightly smaller number 386 | to allow for a few compiler-allocated temporary stack slots. */ 387 | # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ 388 | # endif 389 | # else 390 | # define YYSTACK_ALLOC YYMALLOC 391 | # define YYSTACK_FREE YYFREE 392 | # ifndef YYSTACK_ALLOC_MAXIMUM 393 | # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM 394 | # endif 395 | # if (defined __cplusplus && ! defined EXIT_SUCCESS \ 396 | && ! ((defined YYMALLOC || defined malloc) \ 397 | && (defined YYFREE || defined free))) 398 | # include /* INFRINGES ON USER NAME SPACE */ 399 | # ifndef EXIT_SUCCESS 400 | # define EXIT_SUCCESS 0 401 | # endif 402 | # endif 403 | # ifndef YYMALLOC 404 | # define YYMALLOC malloc 405 | # if ! defined malloc && ! defined EXIT_SUCCESS 406 | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ 407 | # endif 408 | # endif 409 | # ifndef YYFREE 410 | # define YYFREE free 411 | # if ! defined free && ! defined EXIT_SUCCESS 412 | void free (void *); /* INFRINGES ON USER NAME SPACE */ 413 | # endif 414 | # endif 415 | # endif 416 | #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ 417 | 418 | 419 | #if (! defined yyoverflow \ 420 | && (! defined __cplusplus \ 421 | || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) 422 | 423 | /* A type that is properly aligned for any stack member. */ 424 | union yyalloc 425 | { 426 | yytype_int16 yyss_alloc; 427 | YYSTYPE yyvs_alloc; 428 | }; 429 | 430 | /* The size of the maximum gap between one aligned stack and the next. */ 431 | # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) 432 | 433 | /* The size of an array large to enough to hold all stacks, each with 434 | N elements. */ 435 | # define YYSTACK_BYTES(N) \ 436 | ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ 437 | + YYSTACK_GAP_MAXIMUM) 438 | 439 | # define YYCOPY_NEEDED 1 440 | 441 | /* Relocate STACK from its old location to the new one. The 442 | local variables YYSIZE and YYSTACKSIZE give the old and new number of 443 | elements in the stack, and YYPTR gives the new location of the 444 | stack. Advance YYPTR to a properly aligned location for the next 445 | stack. */ 446 | # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ 447 | do \ 448 | { \ 449 | YYSIZE_T yynewbytes; \ 450 | YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ 451 | Stack = &yyptr->Stack_alloc; \ 452 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ 453 | yyptr += yynewbytes / sizeof (*yyptr); \ 454 | } \ 455 | while (0) 456 | 457 | #endif 458 | 459 | #if defined YYCOPY_NEEDED && YYCOPY_NEEDED 460 | /* Copy COUNT objects from SRC to DST. The source and destination do 461 | not overlap. */ 462 | # ifndef YYCOPY 463 | # if defined __GNUC__ && 1 < __GNUC__ 464 | # define YYCOPY(Dst, Src, Count) \ 465 | __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) 466 | # else 467 | # define YYCOPY(Dst, Src, Count) \ 468 | do \ 469 | { \ 470 | YYSIZE_T yyi; \ 471 | for (yyi = 0; yyi < (Count); yyi++) \ 472 | (Dst)[yyi] = (Src)[yyi]; \ 473 | } \ 474 | while (0) 475 | # endif 476 | # endif 477 | #endif /* !YYCOPY_NEEDED */ 478 | 479 | /* YYFINAL -- State number of the termination state. */ 480 | #define YYFINAL 4 481 | /* YYLAST -- Last index in YYTABLE. */ 482 | #define YYLAST 337 483 | 484 | /* YYNTOKENS -- Number of terminals. */ 485 | #define YYNTOKENS 56 486 | /* YYNNTS -- Number of nonterminals. */ 487 | #define YYNNTS 37 488 | /* YYNRULES -- Number of rules. */ 489 | #define YYNRULES 71 490 | /* YYNSTATES -- Number of states. */ 491 | #define YYNSTATES 335 492 | 493 | /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned 494 | by yylex, with out-of-bounds checking. */ 495 | #define YYUNDEFTOK 2 496 | #define YYMAXUTOK 308 497 | 498 | #define YYTRANSLATE(YYX) \ 499 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 500 | 501 | /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM 502 | as returned by yylex, without out-of-bounds checking. */ 503 | static const yytype_uint8 yytranslate[] = 504 | { 505 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 506 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 507 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 508 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 509 | 46, 47, 2, 2, 2, 2, 2, 2, 2, 2, 510 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 511 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 512 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 513 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 514 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 515 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 516 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 517 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 518 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 519 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 520 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 521 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 522 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 523 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 524 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 525 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 526 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 527 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 528 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 529 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 530 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 531 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 532 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 533 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 534 | 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 535 | 45, 48, 49, 50, 51, 52, 53, 54, 55 536 | }; 537 | 538 | #if YYDEBUG 539 | /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ 540 | static const yytype_uint16 yyrline[] = 541 | { 542 | 0, 145, 145, 152, 154, 156, 158, 160, 162, 164, 543 | 166, 168, 170, 171, 172, 173, 181, 183, 187, 191, 544 | 192, 195, 202, 205, 206, 208, 209, 210, 212, 213, 545 | 214, 216, 217, 218, 228, 231, 234, 235, 238, 242, 546 | 247, 248, 251, 256, 261, 266, 289, 290, 291, 295, 547 | 297, 301, 309, 310, 312, 313, 314, 315, 318, 319, 548 | 322, 324, 326, 328, 335, 336, 338, 339, 340, 341, 549 | 350, 353 550 | }; 551 | #endif 552 | 553 | #if YYDEBUG || YYERROR_VERBOSE || 1 554 | /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. 555 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ 556 | static const char *const yytname[] = 557 | { 558 | "$end", "error", "$undefined", "EDIF", "EDIFVERSION", "EDIFLEVEL", 559 | "EKEYWORDMAP", "EKEYWORDLEVEL", "ESTATUS", "EWRITTEN", "ETIMESTAMP", 560 | "EAUTHOR", "EPROGRAM", "EVERSION", "eLIBRARY", "eTECHNOLOGY", 561 | "eLIBRARYREF", "eCELL", "eCELLTYPE", "eCELLREF", "eVIEW", "eVIEWTYPE", 562 | "eVIEWREF", "eINTERFACE", "ePORT", "eARRAY", "eDIRECTION", "eINPUT", 563 | "eOUTPUT", "eINOUT", "eCONTENTS", "eINSTANCE", "eRENAME", "ePROPERTY", 564 | "eSTRING", "eINTEGER", "eNET", "eJOINED", "ePORTREF", "eMEMBER", 565 | "eINSTANCEREF", "eDESIGN", "LP", "RP", "MD", "QUOTE", "'('", "')'", 566 | "eWORK", "eGENERIC", "ePRIM", "eNETLIST", "eINITIAL_VALUE", 567 | "eIDENTIFIER", "eWORD_QUOTED", "eNUMBER", "$accept", "top_edif", 568 | "edif_info", "edif_version", "edif_level", "keywordmap", "edif_status", 569 | "time_stamp", "author", "program", "version", "quoted_info_list", 570 | "ref_library_list", "ref_library", "prim_list", "prim_cell", "interface", 571 | "port_list", "port", "library_work", "lib_info", "cell_list", "cell", 572 | "view", "instance_list", "instance", "rename", "view_cell_lib_ref", 573 | "lib_ref", "net_list", "net", "portref_list", "portref", "property_list", 574 | "property", "design", "design_property", YY_NULLPTR 575 | }; 576 | #endif 577 | 578 | # ifdef YYPRINT 579 | /* YYTOKNUM[NUM] -- (External) token number corresponding to the 580 | (internal) symbol number NUM (which must be that of a token). */ 581 | static const yytype_uint16 yytoknum[] = 582 | { 583 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 584 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 585 | 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 586 | 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 587 | 295, 296, 297, 298, 299, 300, 40, 41, 301, 302, 588 | 303, 304, 305, 306, 307, 308 589 | }; 590 | # endif 591 | 592 | #define YYPACT_NINF -211 593 | 594 | #define yypact_value_is_default(Yystate) \ 595 | (!!((Yystate) == (-211))) 596 | 597 | #define YYTABLE_NINF -1 598 | 599 | #define yytable_value_is_error(Yytable_value) \ 600 | 0 601 | 602 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 603 | STATE-NUM. */ 604 | static const yytype_int16 yypact[] = 605 | { 606 | -24, 7, 31, -17, -211, 10, 61, 57, 58, 45, 607 | 60, 59, -211, 101, 62, 56, 63, 93, -211, 64, 608 | 65, 103, 66, 67, 68, -42, 72, 70, 71, 69, 609 | 111, -211, 74, 118, 78, 68, 73, -211, -211, 120, 610 | 79, -211, 75, 112, -3, -211, 82, 85, 77, 124, 611 | 87, 83, -211, -211, 121, 12, -211, 116, 90, 94, 612 | 95, 96, 86, -211, -211, 91, 98, 133, 100, 132, 613 | 130, 104, 105, -211, 97, 138, 107, 108, 106, 139, 614 | 140, 109, 113, 147, 114, 110, 115, 117, 119, 122, 615 | 6, 123, 125, 126, 128, 129, 131, 127, -211, -211, 616 | -38, 6, -211, 134, 145, 137, 141, 135, 142, -211, 617 | -211, -36, -211, 136, 149, 144, 146, 143, -211, 148, 618 | 150, 151, -211, 152, 153, 154, 157, 155, 158, 159, 619 | 156, -211, -211, 161, -211, 160, 163, 162, 6, 165, 620 | 164, 169, -31, 167, 170, 171, 172, 174, 173, 167, 621 | 168, -211, 175, 176, 178, 180, 183, 16, -211, -211, 622 | 184, 179, -41, -211, -211, 181, 182, 0, 185, 186, 623 | 187, 188, -211, 177, 189, 190, 203, 207, -20, 3, 624 | -211, 21, -211, 191, 205, 192, 193, 19, 22, 194, 625 | 194, -18, 206, 195, -211, 196, 197, 198, 199, 201, 626 | 202, 204, 208, 209, 217, 23, 30, 211, 212, 166, 627 | 32, -211, 200, 213, -4, 214, 215, 216, 218, 219, 628 | 220, -8, -211, 34, -211, 36, 223, 227, 221, -211, 629 | -211, 222, 228, 224, 225, -211, -211, -211, -211, -211, 630 | -211, 229, 230, -211, -211, 231, 231, 232, 226, 25, 631 | 28, -211, 234, 249, 233, 38, -211, 40, 54, -211, 632 | 235, 236, 237, 240, 238, 239, 241, -16, 44, -211, 633 | 46, 242, 243, 244, 248, 250, 252, 245, 254, 255, 634 | 247, 48, -211, 50, -211, 52, -25, 256, -211, -211, 635 | -211, -211, 251, 264, 257, 258, 253, 261, -211, -211, 636 | -211, 260, 263, 265, 262, 266, 259, 267, -211, 268, 637 | 269, 270, 271, 272, -211, -211, 273, -211, 274, 277, 638 | -211, 278, 279, -211, 55, 280, -211, -211, 275, -211, 639 | -211, 276, 281, 283, -211 640 | }; 641 | 642 | /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. 643 | Performed when YYTABLE does not specify something else to do. Zero 644 | means the default is an error. */ 645 | static const yytype_uint8 yydefact[] = 646 | { 647 | 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 648 | 0, 0, 17, 0, 0, 0, 0, 0, 16, 0, 649 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 650 | 0, 3, 0, 0, 0, 0, 0, 2, 5, 0, 651 | 0, 4, 0, 0, 0, 19, 0, 0, 0, 0, 652 | 0, 0, 18, 20, 0, 0, 37, 0, 0, 0, 653 | 0, 0, 0, 34, 36, 0, 0, 0, 0, 0, 654 | 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 655 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 656 | 0, 0, 0, 0, 0, 0, 0, 0, 12, 15, 657 | 0, 0, 7, 0, 0, 0, 0, 0, 0, 13, 658 | 14, 0, 35, 0, 0, 0, 0, 0, 9, 0, 659 | 0, 0, 38, 0, 0, 0, 0, 0, 0, 0, 660 | 0, 70, 8, 0, 10, 0, 0, 0, 0, 0, 661 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 662 | 0, 11, 0, 0, 0, 0, 0, 0, 24, 21, 663 | 0, 0, 0, 22, 23, 0, 0, 0, 0, 0, 664 | 0, 0, 41, 0, 0, 0, 0, 0, 0, 0, 665 | 40, 0, 53, 0, 0, 0, 0, 0, 0, 0, 666 | 0, 0, 0, 0, 52, 0, 0, 0, 0, 0, 667 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 668 | 0, 65, 0, 0, 0, 0, 0, 0, 0, 0, 669 | 0, 0, 44, 0, 45, 0, 0, 0, 0, 39, 670 | 64, 0, 0, 0, 0, 31, 32, 33, 28, 29, 671 | 30, 0, 0, 42, 43, 0, 0, 0, 0, 0, 672 | 0, 48, 0, 0, 0, 0, 59, 0, 0, 71, 673 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 58, 674 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 675 | 0, 0, 56, 0, 57, 0, 0, 0, 25, 26, 676 | 27, 47, 0, 0, 0, 0, 0, 0, 63, 54, 677 | 55, 0, 0, 0, 0, 0, 0, 0, 49, 0, 678 | 0, 0, 0, 0, 66, 46, 0, 50, 0, 0, 679 | 69, 0, 0, 51, 0, 0, 67, 68, 0, 61, 680 | 60, 0, 0, 0, 62 681 | }; 682 | 683 | /* YYPGOTO[NTERM-NUM]. */ 684 | static const yytype_int16 yypgoto[] = 685 | { 686 | -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, 687 | -211, -98, -211, 300, -211, 246, 11, -211, 14, -211, 688 | 296, -211, 282, -211, -211, 4, -170, -10, -211, -211, 689 | 29, -59, -200, -204, -210, -211, -211 690 | }; 691 | 692 | /* YYDEFGOTO[NTERM-NUM]. */ 693 | static const yytype_int16 yydefgoto[] = 694 | { 695 | -1, 2, 7, 8, 14, 22, 31, 68, 76, 84, 696 | 127, 100, 11, 12, 44, 45, 148, 157, 158, 19, 697 | 34, 55, 56, 115, 171, 172, 169, 205, 294, 181, 698 | 182, 255, 256, 210, 211, 27, 124 699 | }; 700 | 701 | /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If 702 | positive, shift that token. If negative, reduce the rule whose 703 | number is the opposite. If YYTABLE_NINF, syntax error. */ 704 | static const yytype_uint16 yytable[] = 705 | { 706 | 230, 223, 225, 111, 185, 167, 35, 108, 190, 119, 707 | 3, 24, 168, 230, 146, 230, 109, 110, 109, 110, 708 | 301, 208, 1, 109, 110, 174, 184, 302, 184, 303, 709 | 280, 4, 175, 189, 178, 207, 5, 281, 233, 191, 710 | 142, 234, 241, 43, 52, 242, 198, 199, 200, 201, 711 | 202, 203, 260, 261, 262, 269, 6, 269, 54, 63, 712 | 98, 99, 156, 163, 283, 9, 285, 192, 193, 209, 713 | 222, 263, 264, 230, 16, 230, 209, 224, 209, 229, 714 | 209, 243, 209, 244, 254, 268, 254, 270, 271, 272, 715 | 209, 282, 209, 284, 297, 298, 209, 299, 209, 300, 716 | 15, 328, 329, 10, 13, 17, 20, 25, 21, 29, 717 | 26, 23, 30, 36, 33, 39, 24, 37, 38, 40, 718 | 28, 41, 32, 42, 43, 49, 47, 48, 54, 51, 719 | 50, 57, 58, 59, 60, 65, 61, 66, 62, 71, 720 | 67, 69, 70, 74, 72, 73, 75, 77, 78, 82, 721 | 79, 80, 81, 83, 85, 86, 88, 87, 90, 91, 722 | 154, 92, 94, 93, 89, 113, 95, 96, 101, 121, 723 | 133, 164, 102, 103, 104, 180, 105, 97, 106, 135, 724 | 206, 112, 107, 114, 140, 130, 120, 257, 116, 118, 725 | 117, 122, 123, 0, 126, 0, 128, 152, 125, 228, 726 | 131, 132, 134, 145, 129, 136, 138, 162, 141, 137, 727 | 194, 139, 143, 147, 165, 144, 150, 149, 178, 151, 728 | 153, 156, 155, 159, 160, 161, 166, 170, 173, 187, 729 | 183, 176, 177, 188, 179, 184, 195, 175, 197, 221, 730 | 204, 209, 191, 186, 213, 231, 215, 196, 216, 217, 731 | 212, 218, 214, 265, 249, 219, 220, 226, 227, 232, 732 | 245, 235, 236, 237, 246, 238, 239, 240, 266, 248, 733 | 0, 267, 251, 259, 247, 252, 253, 254, 258, 250, 734 | 306, 0, 273, 274, 275, 276, 296, 286, 292, 0, 735 | 53, 288, 278, 277, 279, 289, 305, 290, 287, 291, 736 | 293, 310, 295, 304, 307, 308, 309, 311, 312, 314, 737 | 313, 18, 316, 315, 317, 331, 0, 320, 321, 322, 738 | 323, 324, 319, 318, 325, 326, 327, 330, 333, 332, 739 | 334, 46, 0, 0, 0, 0, 0, 64 740 | }; 741 | 742 | static const yytype_int16 yycheck[] = 743 | { 744 | 210, 205, 206, 101, 174, 46, 48, 45, 178, 45, 745 | 3, 53, 53, 223, 45, 225, 54, 55, 54, 55, 746 | 45, 191, 46, 54, 55, 25, 46, 52, 46, 54, 747 | 46, 0, 32, 53, 31, 53, 53, 53, 42, 36, 748 | 138, 45, 50, 46, 47, 53, 27, 28, 29, 27, 749 | 28, 29, 27, 28, 29, 255, 46, 257, 46, 47, 750 | 54, 55, 46, 47, 268, 4, 270, 46, 47, 46, 751 | 47, 43, 44, 283, 14, 285, 46, 47, 46, 47, 752 | 46, 47, 46, 47, 46, 47, 46, 47, 34, 35, 753 | 46, 47, 46, 47, 46, 47, 46, 47, 46, 47, 754 | 55, 46, 47, 46, 46, 46, 5, 14, 46, 6, 755 | 46, 55, 46, 41, 46, 46, 53, 47, 47, 8, 756 | 55, 47, 55, 5, 46, 46, 53, 7, 46, 17, 757 | 55, 46, 55, 9, 47, 19, 53, 47, 17, 53, 758 | 46, 46, 46, 10, 53, 47, 46, 15, 18, 11, 759 | 46, 46, 55, 46, 46, 49, 16, 18, 45, 12, 760 | 149, 47, 47, 53, 55, 20, 49, 48, 45, 20, 761 | 13, 157, 47, 47, 46, 171, 47, 55, 47, 21, 762 | 190, 47, 55, 46, 21, 33, 50, 246, 47, 47, 763 | 55, 47, 46, -1, 46, -1, 46, 23, 55, 33, 764 | 47, 47, 47, 34, 53, 46, 45, 24, 46, 53, 765 | 181, 51, 47, 46, 30, 51, 45, 47, 31, 47, 766 | 47, 46, 54, 47, 46, 45, 47, 46, 46, 26, 767 | 53, 46, 46, 26, 46, 46, 45, 32, 45, 22, 768 | 46, 46, 36, 53, 47, 45, 47, 55, 47, 47, 769 | 54, 47, 54, 19, 26, 47, 47, 46, 46, 46, 770 | 37, 47, 47, 47, 37, 47, 47, 47, 19, 47, 771 | -1, 38, 47, 47, 53, 46, 46, 46, 46, 55, 772 | 16, -1, 47, 47, 47, 45, 39, 45, 43, -1, 773 | 44, 47, 53, 55, 53, 47, 45, 47, 55, 47, 774 | 46, 40, 47, 47, 47, 47, 53, 47, 45, 47, 775 | 45, 11, 53, 47, 47, 40, -1, 47, 47, 47, 776 | 47, 47, 53, 55, 47, 47, 47, 47, 47, 53, 777 | 47, 35, -1, -1, -1, -1, -1, 55 778 | }; 779 | 780 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing 781 | symbol of state STATE-NUM. */ 782 | static const yytype_uint8 yystos[] = 783 | { 784 | 0, 46, 57, 3, 0, 53, 46, 58, 59, 4, 785 | 46, 68, 69, 46, 60, 55, 14, 46, 69, 75, 786 | 5, 46, 61, 55, 53, 14, 46, 91, 55, 6, 787 | 46, 62, 55, 46, 76, 48, 41, 47, 47, 46, 788 | 8, 47, 5, 46, 70, 71, 76, 53, 7, 46, 789 | 55, 17, 47, 71, 46, 77, 78, 46, 55, 9, 790 | 47, 53, 17, 47, 78, 19, 47, 46, 63, 46, 791 | 46, 53, 53, 47, 10, 46, 64, 15, 18, 46, 792 | 46, 55, 11, 46, 65, 46, 49, 18, 16, 55, 793 | 45, 12, 47, 53, 47, 49, 48, 55, 54, 55, 794 | 67, 45, 47, 47, 46, 47, 47, 55, 45, 54, 795 | 55, 67, 47, 20, 46, 79, 47, 55, 47, 45, 796 | 50, 20, 47, 46, 92, 55, 46, 66, 46, 53, 797 | 33, 47, 47, 13, 47, 21, 46, 53, 45, 51, 798 | 21, 46, 67, 47, 51, 34, 45, 46, 72, 47, 799 | 45, 47, 23, 47, 72, 54, 46, 73, 74, 47, 800 | 46, 45, 24, 47, 74, 30, 47, 46, 53, 82, 801 | 46, 80, 81, 46, 25, 32, 46, 46, 31, 46, 802 | 81, 85, 86, 53, 46, 82, 53, 26, 26, 53, 803 | 82, 36, 46, 47, 86, 45, 55, 45, 27, 28, 804 | 29, 27, 28, 29, 46, 83, 83, 53, 82, 46, 805 | 89, 90, 54, 47, 54, 47, 47, 47, 47, 47, 806 | 47, 22, 47, 89, 47, 89, 46, 46, 33, 47, 807 | 90, 45, 46, 42, 45, 47, 47, 47, 47, 47, 808 | 47, 50, 53, 47, 47, 37, 37, 53, 47, 26, 809 | 55, 47, 46, 46, 46, 87, 88, 87, 46, 47, 810 | 27, 28, 29, 43, 44, 19, 19, 38, 47, 88, 811 | 47, 34, 35, 47, 47, 47, 45, 55, 53, 53, 812 | 46, 53, 47, 89, 47, 89, 45, 55, 47, 47, 813 | 47, 47, 43, 46, 84, 47, 39, 46, 47, 47, 814 | 47, 45, 52, 54, 47, 45, 16, 47, 47, 53, 815 | 40, 47, 45, 45, 47, 47, 53, 47, 55, 53, 816 | 47, 47, 47, 47, 47, 47, 47, 47, 46, 47, 817 | 47, 40, 53, 47, 47 818 | }; 819 | 820 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 821 | static const yytype_uint8 yyr1[] = 822 | { 823 | 0, 56, 57, 58, 59, 60, 61, 62, 63, 64, 824 | 65, 66, 67, 67, 67, 67, 68, 68, 69, 70, 825 | 70, 71, 72, 73, 73, 74, 74, 74, 74, 74, 826 | 74, 74, 74, 74, 75, 76, 77, 77, 78, 79, 827 | 80, 80, 81, 81, 81, 81, 82, 82, 82, 83, 828 | 83, 84, 85, 85, 86, 86, 86, 86, 87, 87, 829 | 88, 88, 88, 88, 89, 89, 90, 90, 90, 90, 830 | 91, 92 831 | }; 832 | 833 | /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ 834 | static const yytype_uint8 yyr2[] = 835 | { 836 | 0, 2, 8, 4, 6, 4, 7, 9, 9, 6, 837 | 7, 6, 1, 2, 2, 1, 2, 1, 6, 1, 838 | 2, 17, 4, 2, 1, 12, 12, 12, 8, 8, 839 | 8, 8, 8, 8, 6, 10, 2, 1, 9, 15, 840 | 2, 1, 6, 6, 5, 5, 12, 10, 7, 8, 841 | 9, 4, 2, 1, 9, 9, 8, 8, 2, 1, 842 | 8, 8, 12, 4, 2, 1, 8, 10, 10, 9, 843 | 13, 16 844 | }; 845 | 846 | 847 | #define yyerrok (yyerrstatus = 0) 848 | #define yyclearin (yychar = YYEMPTY) 849 | #define YYEMPTY (-2) 850 | #define YYEOF 0 851 | 852 | #define YYACCEPT goto yyacceptlab 853 | #define YYABORT goto yyabortlab 854 | #define YYERROR goto yyerrorlab 855 | 856 | 857 | #define YYRECOVERING() (!!yyerrstatus) 858 | 859 | #define YYBACKUP(Token, Value) \ 860 | do \ 861 | if (yychar == YYEMPTY) \ 862 | { \ 863 | yychar = (Token); \ 864 | yylval = (Value); \ 865 | YYPOPSTACK (yylen); \ 866 | yystate = *yyssp; \ 867 | goto yybackup; \ 868 | } \ 869 | else \ 870 | { \ 871 | yyerror (YY_("syntax error: cannot back up")); \ 872 | YYERROR; \ 873 | } \ 874 | while (0) 875 | 876 | /* Error token number */ 877 | #define YYTERROR 1 878 | #define YYERRCODE 256 879 | 880 | 881 | 882 | /* Enable debugging if requested. */ 883 | #if YYDEBUG 884 | 885 | # ifndef YYFPRINTF 886 | # include /* INFRINGES ON USER NAME SPACE */ 887 | # define YYFPRINTF fprintf 888 | # endif 889 | 890 | # define YYDPRINTF(Args) \ 891 | do { \ 892 | if (yydebug) \ 893 | YYFPRINTF Args; \ 894 | } while (0) 895 | 896 | /* This macro is provided for backward compatibility. */ 897 | #ifndef YY_LOCATION_PRINT 898 | # define YY_LOCATION_PRINT(File, Loc) ((void) 0) 899 | #endif 900 | 901 | 902 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ 903 | do { \ 904 | if (yydebug) \ 905 | { \ 906 | YYFPRINTF (stderr, "%s ", Title); \ 907 | yy_symbol_print (stderr, \ 908 | Type, Value); \ 909 | YYFPRINTF (stderr, "\n"); \ 910 | } \ 911 | } while (0) 912 | 913 | 914 | /*----------------------------------------. 915 | | Print this symbol's value on YYOUTPUT. | 916 | `----------------------------------------*/ 917 | 918 | static void 919 | yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 920 | { 921 | FILE *yyo = yyoutput; 922 | YYUSE (yyo); 923 | if (!yyvaluep) 924 | return; 925 | # ifdef YYPRINT 926 | if (yytype < YYNTOKENS) 927 | YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); 928 | # endif 929 | YYUSE (yytype); 930 | } 931 | 932 | 933 | /*--------------------------------. 934 | | Print this symbol on YYOUTPUT. | 935 | `--------------------------------*/ 936 | 937 | static void 938 | yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 939 | { 940 | YYFPRINTF (yyoutput, "%s %s (", 941 | yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); 942 | 943 | yy_symbol_value_print (yyoutput, yytype, yyvaluep); 944 | YYFPRINTF (yyoutput, ")"); 945 | } 946 | 947 | /*------------------------------------------------------------------. 948 | | yy_stack_print -- Print the state stack from its BOTTOM up to its | 949 | | TOP (included). | 950 | `------------------------------------------------------------------*/ 951 | 952 | static void 953 | yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) 954 | { 955 | YYFPRINTF (stderr, "Stack now"); 956 | for (; yybottom <= yytop; yybottom++) 957 | { 958 | int yybot = *yybottom; 959 | YYFPRINTF (stderr, " %d", yybot); 960 | } 961 | YYFPRINTF (stderr, "\n"); 962 | } 963 | 964 | # define YY_STACK_PRINT(Bottom, Top) \ 965 | do { \ 966 | if (yydebug) \ 967 | yy_stack_print ((Bottom), (Top)); \ 968 | } while (0) 969 | 970 | 971 | /*------------------------------------------------. 972 | | Report that the YYRULE is going to be reduced. | 973 | `------------------------------------------------*/ 974 | 975 | static void 976 | yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) 977 | { 978 | unsigned long int yylno = yyrline[yyrule]; 979 | int yynrhs = yyr2[yyrule]; 980 | int yyi; 981 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", 982 | yyrule - 1, yylno); 983 | /* The symbols being reduced. */ 984 | for (yyi = 0; yyi < yynrhs; yyi++) 985 | { 986 | YYFPRINTF (stderr, " $%d = ", yyi + 1); 987 | yy_symbol_print (stderr, 988 | yystos[yyssp[yyi + 1 - yynrhs]], 989 | &(yyvsp[(yyi + 1) - (yynrhs)]) 990 | ); 991 | YYFPRINTF (stderr, "\n"); 992 | } 993 | } 994 | 995 | # define YY_REDUCE_PRINT(Rule) \ 996 | do { \ 997 | if (yydebug) \ 998 | yy_reduce_print (yyssp, yyvsp, Rule); \ 999 | } while (0) 1000 | 1001 | /* Nonzero means print parse trace. It is left uninitialized so that 1002 | multiple parsers can coexist. */ 1003 | int yydebug; 1004 | #else /* !YYDEBUG */ 1005 | # define YYDPRINTF(Args) 1006 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) 1007 | # define YY_STACK_PRINT(Bottom, Top) 1008 | # define YY_REDUCE_PRINT(Rule) 1009 | #endif /* !YYDEBUG */ 1010 | 1011 | 1012 | /* YYINITDEPTH -- initial size of the parser's stacks. */ 1013 | #ifndef YYINITDEPTH 1014 | # define YYINITDEPTH 200 1015 | #endif 1016 | 1017 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only 1018 | if the built-in stack extension method is used). 1019 | 1020 | Do not make this value too large; the results are undefined if 1021 | YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) 1022 | evaluated with infinite-precision integer arithmetic. */ 1023 | 1024 | #ifndef YYMAXDEPTH 1025 | # define YYMAXDEPTH 10000 1026 | #endif 1027 | 1028 | 1029 | #if YYERROR_VERBOSE 1030 | 1031 | # ifndef yystrlen 1032 | # if defined __GLIBC__ && defined _STRING_H 1033 | # define yystrlen strlen 1034 | # else 1035 | /* Return the length of YYSTR. */ 1036 | static YYSIZE_T 1037 | yystrlen (const char *yystr) 1038 | { 1039 | YYSIZE_T yylen; 1040 | for (yylen = 0; yystr[yylen]; yylen++) 1041 | continue; 1042 | return yylen; 1043 | } 1044 | # endif 1045 | # endif 1046 | 1047 | # ifndef yystpcpy 1048 | # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE 1049 | # define yystpcpy stpcpy 1050 | # else 1051 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in 1052 | YYDEST. */ 1053 | static char * 1054 | yystpcpy (char *yydest, const char *yysrc) 1055 | { 1056 | char *yyd = yydest; 1057 | const char *yys = yysrc; 1058 | 1059 | while ((*yyd++ = *yys++) != '\0') 1060 | continue; 1061 | 1062 | return yyd - 1; 1063 | } 1064 | # endif 1065 | # endif 1066 | 1067 | # ifndef yytnamerr 1068 | /* Copy to YYRES the contents of YYSTR after stripping away unnecessary 1069 | quotes and backslashes, so that it's suitable for yyerror. The 1070 | heuristic is that double-quoting is unnecessary unless the string 1071 | contains an apostrophe, a comma, or backslash (other than 1072 | backslash-backslash). YYSTR is taken from yytname. If YYRES is 1073 | null, do not copy; instead, return the length of what the result 1074 | would have been. */ 1075 | static YYSIZE_T 1076 | yytnamerr (char *yyres, const char *yystr) 1077 | { 1078 | if (*yystr == '"') 1079 | { 1080 | YYSIZE_T yyn = 0; 1081 | char const *yyp = yystr; 1082 | 1083 | for (;;) 1084 | switch (*++yyp) 1085 | { 1086 | case '\'': 1087 | case ',': 1088 | goto do_not_strip_quotes; 1089 | 1090 | case '\\': 1091 | if (*++yyp != '\\') 1092 | goto do_not_strip_quotes; 1093 | /* Fall through. */ 1094 | default: 1095 | if (yyres) 1096 | yyres[yyn] = *yyp; 1097 | yyn++; 1098 | break; 1099 | 1100 | case '"': 1101 | if (yyres) 1102 | yyres[yyn] = '\0'; 1103 | return yyn; 1104 | } 1105 | do_not_strip_quotes: ; 1106 | } 1107 | 1108 | if (! yyres) 1109 | return yystrlen (yystr); 1110 | 1111 | return yystpcpy (yyres, yystr) - yyres; 1112 | } 1113 | # endif 1114 | 1115 | /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message 1116 | about the unexpected token YYTOKEN for the state stack whose top is 1117 | YYSSP. 1118 | 1119 | Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is 1120 | not large enough to hold the message. In that case, also set 1121 | *YYMSG_ALLOC to the required number of bytes. Return 2 if the 1122 | required number of bytes is too large to store. */ 1123 | static int 1124 | yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, 1125 | yytype_int16 *yyssp, int yytoken) 1126 | { 1127 | YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); 1128 | YYSIZE_T yysize = yysize0; 1129 | enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; 1130 | /* Internationalized format string. */ 1131 | const char *yyformat = YY_NULLPTR; 1132 | /* Arguments of yyformat. */ 1133 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; 1134 | /* Number of reported tokens (one for the "unexpected", one per 1135 | "expected"). */ 1136 | int yycount = 0; 1137 | 1138 | /* There are many possibilities here to consider: 1139 | - If this state is a consistent state with a default action, then 1140 | the only way this function was invoked is if the default action 1141 | is an error action. In that case, don't check for expected 1142 | tokens because there are none. 1143 | - The only way there can be no lookahead present (in yychar) is if 1144 | this state is a consistent state with a default action. Thus, 1145 | detecting the absence of a lookahead is sufficient to determine 1146 | that there is no unexpected or expected token to report. In that 1147 | case, just report a simple "syntax error". 1148 | - Don't assume there isn't a lookahead just because this state is a 1149 | consistent state with a default action. There might have been a 1150 | previous inconsistent state, consistent state with a non-default 1151 | action, or user semantic action that manipulated yychar. 1152 | - Of course, the expected token list depends on states to have 1153 | correct lookahead information, and it depends on the parser not 1154 | to perform extra reductions after fetching a lookahead from the 1155 | scanner and before detecting a syntax error. Thus, state merging 1156 | (from LALR or IELR) and default reductions corrupt the expected 1157 | token list. However, the list is correct for canonical LR with 1158 | one exception: it will still contain any token that will not be 1159 | accepted due to an error action in a later state. 1160 | */ 1161 | if (yytoken != YYEMPTY) 1162 | { 1163 | int yyn = yypact[*yyssp]; 1164 | yyarg[yycount++] = yytname[yytoken]; 1165 | if (!yypact_value_is_default (yyn)) 1166 | { 1167 | /* Start YYX at -YYN if negative to avoid negative indexes in 1168 | YYCHECK. In other words, skip the first -YYN actions for 1169 | this state because they are default actions. */ 1170 | int yyxbegin = yyn < 0 ? -yyn : 0; 1171 | /* Stay within bounds of both yycheck and yytname. */ 1172 | int yychecklim = YYLAST - yyn + 1; 1173 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; 1174 | int yyx; 1175 | 1176 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) 1177 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR 1178 | && !yytable_value_is_error (yytable[yyx + yyn])) 1179 | { 1180 | if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) 1181 | { 1182 | yycount = 1; 1183 | yysize = yysize0; 1184 | break; 1185 | } 1186 | yyarg[yycount++] = yytname[yyx]; 1187 | { 1188 | YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); 1189 | if (! (yysize <= yysize1 1190 | && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) 1191 | return 2; 1192 | yysize = yysize1; 1193 | } 1194 | } 1195 | } 1196 | } 1197 | 1198 | switch (yycount) 1199 | { 1200 | # define YYCASE_(N, S) \ 1201 | case N: \ 1202 | yyformat = S; \ 1203 | break 1204 | YYCASE_(0, YY_("syntax error")); 1205 | YYCASE_(1, YY_("syntax error, unexpected %s")); 1206 | YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); 1207 | YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); 1208 | YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); 1209 | YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); 1210 | # undef YYCASE_ 1211 | } 1212 | 1213 | { 1214 | YYSIZE_T yysize1 = yysize + yystrlen (yyformat); 1215 | if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) 1216 | return 2; 1217 | yysize = yysize1; 1218 | } 1219 | 1220 | if (*yymsg_alloc < yysize) 1221 | { 1222 | *yymsg_alloc = 2 * yysize; 1223 | if (! (yysize <= *yymsg_alloc 1224 | && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) 1225 | *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; 1226 | return 1; 1227 | } 1228 | 1229 | /* Avoid sprintf, as that infringes on the user's name space. 1230 | Don't have undefined behavior even if the translation 1231 | produced a string with the wrong number of "%s"s. */ 1232 | { 1233 | char *yyp = *yymsg; 1234 | int yyi = 0; 1235 | while ((*yyp = *yyformat) != '\0') 1236 | if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) 1237 | { 1238 | yyp += yytnamerr (yyp, yyarg[yyi++]); 1239 | yyformat += 2; 1240 | } 1241 | else 1242 | { 1243 | yyp++; 1244 | yyformat++; 1245 | } 1246 | } 1247 | return 0; 1248 | } 1249 | #endif /* YYERROR_VERBOSE */ 1250 | 1251 | /*-----------------------------------------------. 1252 | | Release the memory associated to this symbol. | 1253 | `-----------------------------------------------*/ 1254 | 1255 | static void 1256 | yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) 1257 | { 1258 | YYUSE (yyvaluep); 1259 | if (!yymsg) 1260 | yymsg = "Deleting"; 1261 | YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); 1262 | 1263 | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 1264 | YYUSE (yytype); 1265 | YY_IGNORE_MAYBE_UNINITIALIZED_END 1266 | } 1267 | 1268 | 1269 | 1270 | 1271 | /* The lookahead symbol. */ 1272 | int yychar; 1273 | 1274 | /* The semantic value of the lookahead symbol. */ 1275 | YYSTYPE yylval; 1276 | /* Number of syntax errors so far. */ 1277 | int yynerrs; 1278 | 1279 | 1280 | /*----------. 1281 | | yyparse. | 1282 | `----------*/ 1283 | 1284 | int 1285 | yyparse (void) 1286 | { 1287 | int yystate; 1288 | /* Number of tokens to shift before error messages enabled. */ 1289 | int yyerrstatus; 1290 | 1291 | /* The stacks and their tools: 1292 | 'yyss': related to states. 1293 | 'yyvs': related to semantic values. 1294 | 1295 | Refer to the stacks through separate pointers, to allow yyoverflow 1296 | to reallocate them elsewhere. */ 1297 | 1298 | /* The state stack. */ 1299 | yytype_int16 yyssa[YYINITDEPTH]; 1300 | yytype_int16 *yyss; 1301 | yytype_int16 *yyssp; 1302 | 1303 | /* The semantic value stack. */ 1304 | YYSTYPE yyvsa[YYINITDEPTH]; 1305 | YYSTYPE *yyvs; 1306 | YYSTYPE *yyvsp; 1307 | 1308 | YYSIZE_T yystacksize; 1309 | 1310 | int yyn; 1311 | int yyresult; 1312 | /* Lookahead token as an internal (translated) token number. */ 1313 | int yytoken = 0; 1314 | /* The variables used to return semantic value and location from the 1315 | action routines. */ 1316 | YYSTYPE yyval; 1317 | 1318 | #if YYERROR_VERBOSE 1319 | /* Buffer for error messages, and its allocated size. */ 1320 | char yymsgbuf[128]; 1321 | char *yymsg = yymsgbuf; 1322 | YYSIZE_T yymsg_alloc = sizeof yymsgbuf; 1323 | #endif 1324 | 1325 | #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) 1326 | 1327 | /* The number of symbols on the RHS of the reduced rule. 1328 | Keep to zero when no symbol should be popped. */ 1329 | int yylen = 0; 1330 | 1331 | yyssp = yyss = yyssa; 1332 | yyvsp = yyvs = yyvsa; 1333 | yystacksize = YYINITDEPTH; 1334 | 1335 | YYDPRINTF ((stderr, "Starting parse\n")); 1336 | 1337 | yystate = 0; 1338 | yyerrstatus = 0; 1339 | yynerrs = 0; 1340 | yychar = YYEMPTY; /* Cause a token to be read. */ 1341 | goto yysetstate; 1342 | 1343 | /*------------------------------------------------------------. 1344 | | yynewstate -- Push a new state, which is found in yystate. | 1345 | `------------------------------------------------------------*/ 1346 | yynewstate: 1347 | /* In all cases, when you get here, the value and location stacks 1348 | have just been pushed. So pushing a state here evens the stacks. */ 1349 | yyssp++; 1350 | 1351 | yysetstate: 1352 | *yyssp = yystate; 1353 | 1354 | if (yyss + yystacksize - 1 <= yyssp) 1355 | { 1356 | /* Get the current used size of the three stacks, in elements. */ 1357 | YYSIZE_T yysize = yyssp - yyss + 1; 1358 | 1359 | #ifdef yyoverflow 1360 | { 1361 | /* Give user a chance to reallocate the stack. Use copies of 1362 | these so that the &'s don't force the real ones into 1363 | memory. */ 1364 | YYSTYPE *yyvs1 = yyvs; 1365 | yytype_int16 *yyss1 = yyss; 1366 | 1367 | /* Each stack pointer address is followed by the size of the 1368 | data in use in that stack, in bytes. This used to be a 1369 | conditional around just the two extra args, but that might 1370 | be undefined if yyoverflow is a macro. */ 1371 | yyoverflow (YY_("memory exhausted"), 1372 | &yyss1, yysize * sizeof (*yyssp), 1373 | &yyvs1, yysize * sizeof (*yyvsp), 1374 | &yystacksize); 1375 | 1376 | yyss = yyss1; 1377 | yyvs = yyvs1; 1378 | } 1379 | #else /* no yyoverflow */ 1380 | # ifndef YYSTACK_RELOCATE 1381 | goto yyexhaustedlab; 1382 | # else 1383 | /* Extend the stack our own way. */ 1384 | if (YYMAXDEPTH <= yystacksize) 1385 | goto yyexhaustedlab; 1386 | yystacksize *= 2; 1387 | if (YYMAXDEPTH < yystacksize) 1388 | yystacksize = YYMAXDEPTH; 1389 | 1390 | { 1391 | yytype_int16 *yyss1 = yyss; 1392 | union yyalloc *yyptr = 1393 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); 1394 | if (! yyptr) 1395 | goto yyexhaustedlab; 1396 | YYSTACK_RELOCATE (yyss_alloc, yyss); 1397 | YYSTACK_RELOCATE (yyvs_alloc, yyvs); 1398 | # undef YYSTACK_RELOCATE 1399 | if (yyss1 != yyssa) 1400 | YYSTACK_FREE (yyss1); 1401 | } 1402 | # endif 1403 | #endif /* no yyoverflow */ 1404 | 1405 | yyssp = yyss + yysize - 1; 1406 | yyvsp = yyvs + yysize - 1; 1407 | 1408 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", 1409 | (unsigned long int) yystacksize)); 1410 | 1411 | if (yyss + yystacksize - 1 <= yyssp) 1412 | YYABORT; 1413 | } 1414 | 1415 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 1416 | 1417 | if (yystate == YYFINAL) 1418 | YYACCEPT; 1419 | 1420 | goto yybackup; 1421 | 1422 | /*-----------. 1423 | | yybackup. | 1424 | `-----------*/ 1425 | yybackup: 1426 | 1427 | /* Do appropriate processing given the current state. Read a 1428 | lookahead token if we need one and don't already have one. */ 1429 | 1430 | /* First try to decide what to do without reference to lookahead token. */ 1431 | yyn = yypact[yystate]; 1432 | if (yypact_value_is_default (yyn)) 1433 | goto yydefault; 1434 | 1435 | /* Not known => get a lookahead token if don't already have one. */ 1436 | 1437 | /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ 1438 | if (yychar == YYEMPTY) 1439 | { 1440 | YYDPRINTF ((stderr, "Reading a token: ")); 1441 | yychar = yylex (); 1442 | } 1443 | 1444 | if (yychar <= YYEOF) 1445 | { 1446 | yychar = yytoken = YYEOF; 1447 | YYDPRINTF ((stderr, "Now at end of input.\n")); 1448 | } 1449 | else 1450 | { 1451 | yytoken = YYTRANSLATE (yychar); 1452 | YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); 1453 | } 1454 | 1455 | /* If the proper action on seeing token YYTOKEN is to reduce or to 1456 | detect an error, take that action. */ 1457 | yyn += yytoken; 1458 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) 1459 | goto yydefault; 1460 | yyn = yytable[yyn]; 1461 | if (yyn <= 0) 1462 | { 1463 | if (yytable_value_is_error (yyn)) 1464 | goto yyerrlab; 1465 | yyn = -yyn; 1466 | goto yyreduce; 1467 | } 1468 | 1469 | /* Count tokens shifted since error; after three, turn off error 1470 | status. */ 1471 | if (yyerrstatus) 1472 | yyerrstatus--; 1473 | 1474 | /* Shift the lookahead token. */ 1475 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); 1476 | 1477 | /* Discard the shifted token. */ 1478 | yychar = YYEMPTY; 1479 | 1480 | yystate = yyn; 1481 | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 1482 | *++yyvsp = yylval; 1483 | YY_IGNORE_MAYBE_UNINITIALIZED_END 1484 | 1485 | goto yynewstate; 1486 | 1487 | 1488 | /*-----------------------------------------------------------. 1489 | | yydefault -- do the default action for the current state. | 1490 | `-----------------------------------------------------------*/ 1491 | yydefault: 1492 | yyn = yydefact[yystate]; 1493 | if (yyn == 0) 1494 | goto yyerrlab; 1495 | goto yyreduce; 1496 | 1497 | 1498 | /*-----------------------------. 1499 | | yyreduce -- Do a reduction. | 1500 | `-----------------------------*/ 1501 | yyreduce: 1502 | /* yyn is the number of a rule to reduce with. */ 1503 | yylen = yyr2[yyn]; 1504 | 1505 | /* If YYLEN is nonzero, implement the default value of the action: 1506 | '$$ = $1'. 1507 | 1508 | Otherwise, the following line sets YYVAL to garbage. 1509 | This behavior is undocumented and Bison 1510 | users should not rely upon it. Assigning to YYVAL 1511 | unconditionally makes the parser a bit smaller, and it avoids a 1512 | GCC warning that YYVAL may be used uninitialized. */ 1513 | yyval = yyvsp[1-yylen]; 1514 | 1515 | 1516 | YY_REDUCE_PRINT (yyn); 1517 | switch (yyn) 1518 | { 1519 | case 2: 1520 | #line 146 "edn_bison.y" /* yacc.c:1646 */ 1521 | {p_top_edif=createEdif((yyvsp[-5].id),(yyvsp[-3].ref_library_node),(yyvsp[-2].cell_node),(yyvsp[-1].id));(yyval.top_EDIF_NODE)=p_top_edif=createEdif((yyvsp[-5].id),(yyvsp[-3].ref_library_node),(yyvsp[-2].cell_node),(yyvsp[-1].id));} 1522 | #line 1523 "edn_bison.c" /* yacc.c:1646 */ 1523 | break; 1524 | 1525 | case 16: 1526 | #line 182 "edn_bison.y" /* yacc.c:1646 */ 1527 | {cnt_tmp++;(yyval.ref_library_node)=newRef_Lib_List_Entry((yyvsp[-1].ref_library_node),(yyvsp[0].ref_library_node),cnt_tmp);} 1528 | #line 1529 "edn_bison.c" /* yacc.c:1646 */ 1529 | break; 1530 | 1531 | case 17: 1532 | #line 184 "edn_bison.y" /* yacc.c:1646 */ 1533 | {cnt_tmp=1;(yyval.ref_library_node)=newRef_Lib_List((yyvsp[0].ref_library_node));} 1534 | #line 1535 "edn_bison.c" /* yacc.c:1646 */ 1535 | break; 1536 | 1537 | case 18: 1538 | #line 188 "edn_bison.y" /* yacc.c:1646 */ 1539 | {(yyval.ref_library_node)=createRef_Lib((yyvsp[-3].id),(yyvsp[-1].prim_node));} 1540 | #line 1541 "edn_bison.c" /* yacc.c:1646 */ 1541 | break; 1542 | 1543 | case 19: 1544 | #line 191 "edn_bison.y" /* yacc.c:1646 */ 1545 | {cnt_tmp=1;(yyval.prim_node)=newPrim_List((yyvsp[0].prim_node));} 1546 | #line 1547 "edn_bison.c" /* yacc.c:1646 */ 1547 | break; 1548 | 1549 | case 20: 1550 | #line 192 "edn_bison.y" /* yacc.c:1646 */ 1551 | {cnt_tmp++;(yyval.prim_node)=newPrim_List_Entry((yyvsp[-1].prim_node),(yyvsp[0].prim_node),cnt_tmp);} 1552 | #line 1553 "edn_bison.c" /* yacc.c:1646 */ 1553 | break; 1554 | 1555 | case 21: 1556 | #line 196 "edn_bison.y" /* yacc.c:1646 */ 1557 | {(yyval.prim_node)=createPrim((yyvsp[-14].id),(yyvsp[-11].num_value),(yyvsp[-7].num_value),(yyvsp[-4].num_value),(yyvsp[-2].port_node));} 1558 | #line 1559 "edn_bison.c" /* yacc.c:1646 */ 1559 | break; 1560 | 1561 | case 22: 1562 | #line 202 "edn_bison.y" /* yacc.c:1646 */ 1563 | {(yyval.port_node)=(yyvsp[-1].port_node);} 1564 | #line 1565 "edn_bison.c" /* yacc.c:1646 */ 1565 | break; 1566 | 1567 | case 23: 1568 | #line 205 "edn_bison.y" /* yacc.c:1646 */ 1569 | {cnt_tmp++;(yyval.port_node)=newPort_List_Entry((yyvsp[-1].port_node),(yyvsp[0].port_node),cnt_tmp);} 1570 | #line 1571 "edn_bison.c" /* yacc.c:1646 */ 1571 | break; 1572 | 1573 | case 24: 1574 | #line 206 "edn_bison.y" /* yacc.c:1646 */ 1575 | {cnt_tmp=1;(yyval.port_node)=newPort_List((yyvsp[0].port_node));} 1576 | #line 1577 "edn_bison.c" /* yacc.c:1646 */ 1577 | break; 1578 | 1579 | case 25: 1580 | #line 208 "edn_bison.y" /* yacc.c:1646 */ 1581 | {(yyval.port_node)=createPort((yyvsp[-6].num_value),(yyvsp[-7].id),1);} 1582 | #line 1583 "edn_bison.c" /* yacc.c:1646 */ 1583 | break; 1584 | 1585 | case 26: 1586 | #line 209 "edn_bison.y" /* yacc.c:1646 */ 1587 | {(yyval.port_node)=createPort((yyvsp[-6].num_value),(yyvsp[-7].id),2);} 1588 | #line 1589 "edn_bison.c" /* yacc.c:1646 */ 1589 | break; 1590 | 1591 | case 27: 1592 | #line 210 "edn_bison.y" /* yacc.c:1646 */ 1593 | {(yyval.port_node)=createPort((yyvsp[-6].num_value),(yyvsp[-7].id),3);} 1594 | #line 1595 "edn_bison.c" /* yacc.c:1646 */ 1595 | break; 1596 | 1597 | case 28: 1598 | #line 212 "edn_bison.y" /* yacc.c:1646 */ 1599 | {(yyval.port_node)=createPort(1,(yyvsp[-5].id),1);} 1600 | #line 1601 "edn_bison.c" /* yacc.c:1646 */ 1601 | break; 1602 | 1603 | case 29: 1604 | #line 213 "edn_bison.y" /* yacc.c:1646 */ 1605 | {(yyval.port_node)=createPort(1,(yyvsp[-5].id),2);} 1606 | #line 1607 "edn_bison.c" /* yacc.c:1646 */ 1607 | break; 1608 | 1609 | case 30: 1610 | #line 214 "edn_bison.y" /* yacc.c:1646 */ 1611 | {(yyval.port_node)=createPort(1,(yyvsp[-5].id),3);} 1612 | #line 1613 "edn_bison.c" /* yacc.c:1646 */ 1613 | break; 1614 | 1615 | case 31: 1616 | #line 216 "edn_bison.y" /* yacc.c:1646 */ 1617 | {(yyval.port_node)=createPort(1,(yyvsp[-5].id),1);} 1618 | #line 1619 "edn_bison.c" /* yacc.c:1646 */ 1619 | break; 1620 | 1621 | case 32: 1622 | #line 217 "edn_bison.y" /* yacc.c:1646 */ 1623 | {(yyval.port_node)=createPort(1,(yyvsp[-5].id),2);} 1624 | #line 1625 "edn_bison.c" /* yacc.c:1646 */ 1625 | break; 1626 | 1627 | case 33: 1628 | #line 218 "edn_bison.y" /* yacc.c:1646 */ 1629 | {(yyval.port_node)=createPort(1,(yyvsp[-5].id),3);} 1630 | #line 1631 "edn_bison.c" /* yacc.c:1646 */ 1631 | break; 1632 | 1633 | case 34: 1634 | #line 229 "edn_bison.y" /* yacc.c:1646 */ 1635 | {(yyval.cell_node)=(yyvsp[-1].cell_node);} 1636 | #line 1637 "edn_bison.c" /* yacc.c:1646 */ 1637 | break; 1638 | 1639 | case 36: 1640 | #line 234 "edn_bison.y" /* yacc.c:1646 */ 1641 | {cnt_tmp++;(yyval.cell_node)=newCell_List_Entry((yyvsp[-1].cell_node),(yyvsp[0].cell_node),cnt_tmp);} 1642 | #line 1643 "edn_bison.c" /* yacc.c:1646 */ 1643 | break; 1644 | 1645 | case 37: 1646 | #line 235 "edn_bison.y" /* yacc.c:1646 */ 1647 | {cnt_tmp=1;(yyval.cell_node)=newCell_List((yyvsp[0].cell_node));} 1648 | #line 1649 "edn_bison.c" /* yacc.c:1646 */ 1649 | break; 1650 | 1651 | case 38: 1652 | #line 239 "edn_bison.y" /* yacc.c:1646 */ 1653 | {(yyval.cell_node)=createCell((yyvsp[-6].id),(yyvsp[-3].num_value),(yyvsp[-1].view_node));} 1654 | #line 1655 "edn_bison.c" /* yacc.c:1646 */ 1655 | break; 1656 | 1657 | case 39: 1658 | #line 243 "edn_bison.y" /* yacc.c:1646 */ 1659 | {(yyval.view_node)=createView((yyvsp[-12].id),(yyvsp[-9].num_value),(yyvsp[-7].port_node),(yyvsp[-4].instance_node),(yyvsp[-3].net_node),(yyvsp[-1].property_node));} 1660 | #line 1661 "edn_bison.c" /* yacc.c:1646 */ 1661 | break; 1662 | 1663 | case 40: 1664 | #line 247 "edn_bison.y" /* yacc.c:1646 */ 1665 | {cnt_tmp++;(yyval.instance_node)=newInstance_List_Entry((yyvsp[-1].instance_node),(yyvsp[0].instance_node),cnt_tmp);} 1666 | #line 1667 "edn_bison.c" /* yacc.c:1646 */ 1667 | break; 1668 | 1669 | case 41: 1670 | #line 248 "edn_bison.y" /* yacc.c:1646 */ 1671 | {cnt_tmp=1;(yyval.instance_node)=newInstance_List((yyvsp[0].instance_node));} 1672 | #line 1673 "edn_bison.c" /* yacc.c:1646 */ 1673 | break; 1674 | 1675 | case 42: 1676 | #line 252 "edn_bison.y" /* yacc.c:1646 */ 1677 | { 1678 | (yyval.instance_node)=createInstance((yyvsp[-3].id),(yyvsp[-2].view_cell_lib_ref_node),(yyvsp[-1].property_node)); 1679 | printf("instance : %s find\n",(yyvsp[-3].id)); 1680 | } 1681 | #line 1682 "edn_bison.c" /* yacc.c:1646 */ 1682 | break; 1683 | 1684 | case 43: 1685 | #line 257 "edn_bison.y" /* yacc.c:1646 */ 1686 | { 1687 | (yyval.instance_node)=createInstance((yyvsp[-3].id),(yyvsp[-2].view_cell_lib_ref_node),(yyvsp[-1].property_node)); 1688 | printf("instance : %s find\n",(yyvsp[-3].id)); 1689 | } 1690 | #line 1691 "edn_bison.c" /* yacc.c:1646 */ 1691 | break; 1692 | 1693 | case 44: 1694 | #line 262 "edn_bison.y" /* yacc.c:1646 */ 1695 | { 1696 | (yyval.instance_node)=createInstance((yyvsp[-2].id),(yyvsp[-1].view_cell_lib_ref_node),NULL); 1697 | printf("instance : %s find\n",(yyvsp[-2].id)); 1698 | } 1699 | #line 1700 "edn_bison.c" /* yacc.c:1646 */ 1700 | break; 1701 | 1702 | case 45: 1703 | #line 267 "edn_bison.y" /* yacc.c:1646 */ 1704 | { 1705 | (yyval.instance_node)=createInstance((yyvsp[-2].id),(yyvsp[-1].view_cell_lib_ref_node),NULL); 1706 | printf("instance : %s find\n",(yyvsp[-2].id)); 1707 | } 1708 | #line 1709 "edn_bison.c" /* yacc.c:1646 */ 1709 | break; 1710 | 1711 | case 46: 1712 | #line 289 "edn_bison.y" /* yacc.c:1646 */ 1713 | { (yyval.id)=(yyvsp[-9].id);} 1714 | #line 1715 "edn_bison.c" /* yacc.c:1646 */ 1715 | break; 1716 | 1717 | case 47: 1718 | #line 290 "edn_bison.y" /* yacc.c:1646 */ 1719 | { (yyval.id)=(yyvsp[-7].id);} 1720 | #line 1721 "edn_bison.c" /* yacc.c:1646 */ 1721 | break; 1722 | 1723 | case 48: 1724 | #line 291 "edn_bison.y" /* yacc.c:1646 */ 1725 | { (yyval.id)=(yyvsp[-4].id);} 1726 | #line 1727 "edn_bison.c" /* yacc.c:1646 */ 1727 | break; 1728 | 1729 | case 49: 1730 | #line 296 "edn_bison.y" /* yacc.c:1646 */ 1731 | {(yyval.view_cell_lib_ref_node)=decideInstance_Ref((yyvsp[-5].id),(yyvsp[-2].id),"work");} 1732 | #line 1733 "edn_bison.c" /* yacc.c:1646 */ 1733 | break; 1734 | 1735 | case 50: 1736 | #line 298 "edn_bison.y" /* yacc.c:1646 */ 1737 | {(yyval.view_cell_lib_ref_node)=decideInstance_Ref("PRIM",(yyvsp[-3].id),(yyvsp[-2].id));} 1738 | #line 1739 "edn_bison.c" /* yacc.c:1646 */ 1739 | break; 1740 | 1741 | case 51: 1742 | #line 301 "edn_bison.y" /* yacc.c:1646 */ 1743 | {(yyval.id)=(yyvsp[-1].id); if(to_view_lib_ref) printf("%s lib called\n",(yyvsp[-1].id));} 1744 | #line 1745 "edn_bison.c" /* yacc.c:1646 */ 1745 | break; 1746 | 1747 | case 52: 1748 | #line 309 "edn_bison.y" /* yacc.c:1646 */ 1749 | {cnt_tmp++;(yyval.net_node)=newNet_List_Entry((yyvsp[-1].net_node),(yyvsp[0].net_node),cnt_tmp);} 1750 | #line 1751 "edn_bison.c" /* yacc.c:1646 */ 1751 | break; 1752 | 1753 | case 53: 1754 | #line 310 "edn_bison.y" /* yacc.c:1646 */ 1755 | {cnt_tmp=1;(yyval.net_node)=newNet_List((yyvsp[0].net_node));} 1756 | #line 1757 "edn_bison.c" /* yacc.c:1646 */ 1757 | break; 1758 | 1759 | case 54: 1760 | #line 312 "edn_bison.y" /* yacc.c:1646 */ 1761 | {(yyval.net_node)=findNet((yyvsp[-6].id),(yyvsp[-3].portref_node));printf("net : %s find\n",(yyvsp[-6].id));} 1762 | #line 1763 "edn_bison.c" /* yacc.c:1646 */ 1763 | break; 1764 | 1765 | case 55: 1766 | #line 313 "edn_bison.y" /* yacc.c:1646 */ 1767 | {(yyval.net_node)=findNet((yyvsp[-6].id),(yyvsp[-3].portref_node));printf("net : %s find\n",(yyvsp[-6].id));} 1768 | #line 1769 "edn_bison.c" /* yacc.c:1646 */ 1769 | break; 1770 | 1771 | case 56: 1772 | #line 314 "edn_bison.y" /* yacc.c:1646 */ 1773 | {(yyval.net_node)=findNet((yyvsp[-5].id),(yyvsp[-2].portref_node));printf("net : %s find\n",(yyvsp[-5].id));} 1774 | #line 1775 "edn_bison.c" /* yacc.c:1646 */ 1775 | break; 1776 | 1777 | case 57: 1778 | #line 315 "edn_bison.y" /* yacc.c:1646 */ 1779 | {(yyval.net_node)=findNet((yyvsp[-5].id),(yyvsp[-2].portref_node));printf("net : %s find\n",(yyvsp[-5].id));} 1780 | #line 1781 "edn_bison.c" /* yacc.c:1646 */ 1781 | break; 1782 | 1783 | case 58: 1784 | #line 318 "edn_bison.y" /* yacc.c:1646 */ 1785 | {cnt_tmp++;(yyval.portref_node)=newPortref_List_Entry((yyvsp[-1].portref_node),(yyvsp[0].portref_node),cnt_tmp);} 1786 | #line 1787 "edn_bison.c" /* yacc.c:1646 */ 1787 | break; 1788 | 1789 | case 59: 1790 | #line 319 "edn_bison.y" /* yacc.c:1646 */ 1791 | {cnt_tmp=1;(yyval.portref_node)=newPortref_List((yyvsp[0].portref_node));} 1792 | #line 1793 "edn_bison.c" /* yacc.c:1646 */ 1793 | break; 1794 | 1795 | case 60: 1796 | #line 323 "edn_bison.y" /* yacc.c:1646 */ 1797 | {(yyval.portref_node)=createPortref(1,(yyvsp[-5].id),0,(yyvsp[-2].id));/*Joined to INSTANCE'S PORT*/} 1798 | #line 1799 "edn_bison.c" /* yacc.c:1646 */ 1799 | break; 1800 | 1801 | case 61: 1802 | #line 325 "edn_bison.y" /* yacc.c:1646 */ 1803 | {(yyval.portref_node)=createPortref(0,(yyvsp[-3].id),(yyvsp[-2].num_value),NULL);/*Joined to THIS CELL'S PORT bus*/} 1804 | #line 1805 "edn_bison.c" /* yacc.c:1646 */ 1805 | break; 1806 | 1807 | case 62: 1808 | #line 327 "edn_bison.y" /* yacc.c:1646 */ 1809 | {(yyval.portref_node)=createPortref(0,(yyvsp[-7].id),(yyvsp[-6].num_value),(yyvsp[-2].id));/*Joined to THIS CELL'S PORT bus*/} 1810 | #line 1811 "edn_bison.c" /* yacc.c:1646 */ 1811 | break; 1812 | 1813 | case 63: 1814 | #line 329 "edn_bison.y" /* yacc.c:1646 */ 1815 | {(yyval.portref_node)=createPortref(0,(yyvsp[-1].id),0,NULL);/*Joined to THIS CELL'S PORT*/} 1816 | #line 1817 "edn_bison.c" /* yacc.c:1646 */ 1817 | break; 1818 | 1819 | case 64: 1820 | #line 335 "edn_bison.y" /* yacc.c:1646 */ 1821 | {cnt_tmp++;(yyval.property_node)=newProperty_List_Entry((yyvsp[-1].property_node),(yyvsp[0].property_node),cnt_tmp);} 1822 | #line 1823 "edn_bison.c" /* yacc.c:1646 */ 1823 | break; 1824 | 1825 | case 65: 1826 | #line 336 "edn_bison.y" /* yacc.c:1646 */ 1827 | {cnt_tmp=1;(yyval.property_node)=newProperty_List((yyvsp[0].property_node));} 1828 | #line 1829 "edn_bison.c" /* yacc.c:1646 */ 1829 | break; 1830 | 1831 | case 66: 1832 | #line 338 "edn_bison.y" /* yacc.c:1646 */ 1833 | {(yyval.property_node)=createProperty_Integer((yyvsp[-5].id),"integer",(yyvsp[-2].num_value));} 1834 | #line 1835 "edn_bison.c" /* yacc.c:1646 */ 1835 | break; 1836 | 1837 | case 67: 1838 | #line 339 "edn_bison.y" /* yacc.c:1646 */ 1839 | {(yyval.property_node)=createProperty((yyvsp[-7].id),"string" ,(yyvsp[-3].id));} 1840 | #line 1841 "edn_bison.c" /* yacc.c:1646 */ 1841 | break; 1842 | 1843 | case 68: 1844 | #line 340 "edn_bison.y" /* yacc.c:1646 */ 1845 | {(yyval.property_node)=createProperty((yyvsp[-7].id),"string" ,(yyvsp[-3].id));} 1846 | #line 1847 "edn_bison.c" /* yacc.c:1646 */ 1847 | break; 1848 | 1849 | case 69: 1850 | #line 341 "edn_bison.y" /* yacc.c:1646 */ 1851 | {(yyval.property_node)=createProperty((yyvsp[-6].id),"string" ,NULL);} 1852 | #line 1853 "edn_bison.c" /* yacc.c:1646 */ 1853 | break; 1854 | 1855 | case 70: 1856 | #line 351 "edn_bison.y" /* yacc.c:1646 */ 1857 | {(yyval.id)=(yyvsp[-10].id);printf("Congtulations !!!!!!find a design in this edn file successfully\n");} 1858 | #line 1859 "edn_bison.c" /* yacc.c:1646 */ 1859 | break; 1860 | 1861 | case 71: 1862 | #line 354 "edn_bison.y" /* yacc.c:1646 */ 1863 | {/*这一行的property是为design所设计的,所以暂时在这里没有考虑其语意值*/} 1864 | #line 1865 "edn_bison.c" /* yacc.c:1646 */ 1865 | break; 1866 | 1867 | 1868 | #line 1869 "edn_bison.c" /* yacc.c:1646 */ 1869 | default: break; 1870 | } 1871 | /* User semantic actions sometimes alter yychar, and that requires 1872 | that yytoken be updated with the new translation. We take the 1873 | approach of translating immediately before every use of yytoken. 1874 | One alternative is translating here after every semantic action, 1875 | but that translation would be missed if the semantic action invokes 1876 | YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or 1877 | if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an 1878 | incorrect destructor might then be invoked immediately. In the 1879 | case of YYERROR or YYBACKUP, subsequent parser actions might lead 1880 | to an incorrect destructor call or verbose syntax error message 1881 | before the lookahead is translated. */ 1882 | YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); 1883 | 1884 | YYPOPSTACK (yylen); 1885 | yylen = 0; 1886 | YY_STACK_PRINT (yyss, yyssp); 1887 | 1888 | *++yyvsp = yyval; 1889 | 1890 | /* Now 'shift' the result of the reduction. Determine what state 1891 | that goes to, based on the state we popped back to and the rule 1892 | number reduced by. */ 1893 | 1894 | yyn = yyr1[yyn]; 1895 | 1896 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; 1897 | if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) 1898 | yystate = yytable[yystate]; 1899 | else 1900 | yystate = yydefgoto[yyn - YYNTOKENS]; 1901 | 1902 | goto yynewstate; 1903 | 1904 | 1905 | /*--------------------------------------. 1906 | | yyerrlab -- here on detecting error. | 1907 | `--------------------------------------*/ 1908 | yyerrlab: 1909 | /* Make sure we have latest lookahead translation. See comments at 1910 | user semantic actions for why this is necessary. */ 1911 | yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); 1912 | 1913 | /* If not already recovering from an error, report this error. */ 1914 | if (!yyerrstatus) 1915 | { 1916 | ++yynerrs; 1917 | #if ! YYERROR_VERBOSE 1918 | yyerror (YY_("syntax error")); 1919 | #else 1920 | # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ 1921 | yyssp, yytoken) 1922 | { 1923 | char const *yymsgp = YY_("syntax error"); 1924 | int yysyntax_error_status; 1925 | yysyntax_error_status = YYSYNTAX_ERROR; 1926 | if (yysyntax_error_status == 0) 1927 | yymsgp = yymsg; 1928 | else if (yysyntax_error_status == 1) 1929 | { 1930 | if (yymsg != yymsgbuf) 1931 | YYSTACK_FREE (yymsg); 1932 | yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); 1933 | if (!yymsg) 1934 | { 1935 | yymsg = yymsgbuf; 1936 | yymsg_alloc = sizeof yymsgbuf; 1937 | yysyntax_error_status = 2; 1938 | } 1939 | else 1940 | { 1941 | yysyntax_error_status = YYSYNTAX_ERROR; 1942 | yymsgp = yymsg; 1943 | } 1944 | } 1945 | yyerror (yymsgp); 1946 | if (yysyntax_error_status == 2) 1947 | goto yyexhaustedlab; 1948 | } 1949 | # undef YYSYNTAX_ERROR 1950 | #endif 1951 | } 1952 | 1953 | 1954 | 1955 | if (yyerrstatus == 3) 1956 | { 1957 | /* If just tried and failed to reuse lookahead token after an 1958 | error, discard it. */ 1959 | 1960 | if (yychar <= YYEOF) 1961 | { 1962 | /* Return failure if at end of input. */ 1963 | if (yychar == YYEOF) 1964 | YYABORT; 1965 | } 1966 | else 1967 | { 1968 | yydestruct ("Error: discarding", 1969 | yytoken, &yylval); 1970 | yychar = YYEMPTY; 1971 | } 1972 | } 1973 | 1974 | /* Else will try to reuse lookahead token after shifting the error 1975 | token. */ 1976 | goto yyerrlab1; 1977 | 1978 | 1979 | /*---------------------------------------------------. 1980 | | yyerrorlab -- error raised explicitly by YYERROR. | 1981 | `---------------------------------------------------*/ 1982 | yyerrorlab: 1983 | 1984 | /* Pacify compilers like GCC when the user code never invokes 1985 | YYERROR and the label yyerrorlab therefore never appears in user 1986 | code. */ 1987 | if (/*CONSTCOND*/ 0) 1988 | goto yyerrorlab; 1989 | 1990 | /* Do not reclaim the symbols of the rule whose action triggered 1991 | this YYERROR. */ 1992 | YYPOPSTACK (yylen); 1993 | yylen = 0; 1994 | YY_STACK_PRINT (yyss, yyssp); 1995 | yystate = *yyssp; 1996 | goto yyerrlab1; 1997 | 1998 | 1999 | /*-------------------------------------------------------------. 2000 | | yyerrlab1 -- common code for both syntax error and YYERROR. | 2001 | `-------------------------------------------------------------*/ 2002 | yyerrlab1: 2003 | yyerrstatus = 3; /* Each real token shifted decrements this. */ 2004 | 2005 | for (;;) 2006 | { 2007 | yyn = yypact[yystate]; 2008 | if (!yypact_value_is_default (yyn)) 2009 | { 2010 | yyn += YYTERROR; 2011 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) 2012 | { 2013 | yyn = yytable[yyn]; 2014 | if (0 < yyn) 2015 | break; 2016 | } 2017 | } 2018 | 2019 | /* Pop the current state because it cannot handle the error token. */ 2020 | if (yyssp == yyss) 2021 | YYABORT; 2022 | 2023 | 2024 | yydestruct ("Error: popping", 2025 | yystos[yystate], yyvsp); 2026 | YYPOPSTACK (1); 2027 | yystate = *yyssp; 2028 | YY_STACK_PRINT (yyss, yyssp); 2029 | } 2030 | 2031 | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 2032 | *++yyvsp = yylval; 2033 | YY_IGNORE_MAYBE_UNINITIALIZED_END 2034 | 2035 | 2036 | /* Shift the error token. */ 2037 | YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); 2038 | 2039 | yystate = yyn; 2040 | goto yynewstate; 2041 | 2042 | 2043 | /*-------------------------------------. 2044 | | yyacceptlab -- YYACCEPT comes here. | 2045 | `-------------------------------------*/ 2046 | yyacceptlab: 2047 | yyresult = 0; 2048 | goto yyreturn; 2049 | 2050 | /*-----------------------------------. 2051 | | yyabortlab -- YYABORT comes here. | 2052 | `-----------------------------------*/ 2053 | yyabortlab: 2054 | yyresult = 1; 2055 | goto yyreturn; 2056 | 2057 | #if !defined yyoverflow || YYERROR_VERBOSE 2058 | /*-------------------------------------------------. 2059 | | yyexhaustedlab -- memory exhaustion comes here. | 2060 | `-------------------------------------------------*/ 2061 | yyexhaustedlab: 2062 | yyerror (YY_("memory exhausted")); 2063 | yyresult = 2; 2064 | /* Fall through. */ 2065 | #endif 2066 | 2067 | yyreturn: 2068 | if (yychar != YYEMPTY) 2069 | { 2070 | /* Make sure we have latest lookahead translation. See comments at 2071 | user semantic actions for why this is necessary. */ 2072 | yytoken = YYTRANSLATE (yychar); 2073 | yydestruct ("Cleanup: discarding lookahead", 2074 | yytoken, &yylval); 2075 | } 2076 | /* Do not reclaim the symbols of the rule whose action triggered 2077 | this YYABORT or YYACCEPT. */ 2078 | YYPOPSTACK (yylen); 2079 | YY_STACK_PRINT (yyss, yyssp); 2080 | while (yyssp != yyss) 2081 | { 2082 | yydestruct ("Cleanup: popping", 2083 | yystos[*yyssp], yyvsp); 2084 | YYPOPSTACK (1); 2085 | } 2086 | #ifndef yyoverflow 2087 | if (yyss != yyssa) 2088 | YYSTACK_FREE (yyss); 2089 | #endif 2090 | #if YYERROR_VERBOSE 2091 | if (yymsg != yymsgbuf) 2092 | YYSTACK_FREE (yymsg); 2093 | #endif 2094 | return yyresult; 2095 | } 2096 | #line 356 "edn_bison.y" /* yacc.c:1906 */ 2097 | 2098 | 2099 | 2100 | --------------------------------------------------------------------------------