vhdlparser.y 92 KB
Newer Older
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14
/******************************************************************************
 *
 * Copyright (C) 1997-2013 by Dimitri van Heesch.
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation under the terms of the GNU General Public License is hereby 
 * granted. No representations are made about the suitability of this software 
 * for any purpose. It is provided "as is" without express or implied warranty.
 * See the GNU General Public License for more details.
 *
 * Documents produced by Doxygen are derivative works derived from the
 * input used in their production; they are not affected by this license.
 *
 */
15

16
/*********************************************************************************************
17 18 19 20 21 22 23 24 25 26 27 28 29 30
 * The original was a VHDL parser description to be used with GMD Compiler
 * Tool Box
 * written from:
 * Jan den Ouden, Jaap Hofstede
 * Department of Computer Science (INF/SPA)
 * University of Twente
 * PB 217, 7500 AE ENSCHEDE, The Netherlands
 * Tel: +31 53 893788
 * Email: hofstede@cs.utwente.nl
 * avail at: ftp.cs.utwente.nl in pub/src/VHDL/Grammar
 *
 * author of YACC transformation:
 * Thomas Dettmer
 * Dortmund University
31
 * Dept. of Computer Scienc, LS1
32 33 34 35 36
 * PB 500 500
 * D-44221 Dortmund (Germany)
 * Phone: +49-231-755-6464
 * e-mail: dettmer@ls1.informatik.uni-dortmund.de
 *****************************************************************
37
 *
38 39 40 41 42 43 44 45
 * This file is intended not to be used for commercial purposes
 * without permission of the University of Twente and permission
 * of the University of Dortmund
 *
 * NOTE THAT THERE IS NO WARRANTY FOR CORRECTNES, COMPLETENESS, SUPPORT
 * OR ANYTHING ELSE.
 *
 *******************************************************/
46
/******************************************************************************
47
 * modified for doxygen by M. Kreis
48
 * extended to VHDL 93/2008
49 50 51 52 53 54 55
 ******************************************************************************/


%{
#include <stdio.h>
#include <qcstring.h>
#include <qstringlist.h>
56
#include "config.h"
57 58 59 60

#ifndef YYSTYPE
typedef int YYSTYPE;
#endif
61

62 63
struct  YYMM
{
64
  int itype;
65
  QCString qstr;
66
};
67

68 69 70
 


71 72 73 74 75 76 77 78 79 80
// define struct instead of union
#define YYSTYPE YYMM

#include "membergroup.h"
#include "vhdldocgen.h"
#include "doxygen.h"
#include "searchindex.h"
#include "vhdlscanner.h"
#include "commentscan.h"
#include "entry.h"
81
#include "arguments.h"
82
#include "memberdef.h"
83
#include "vhdldocgen.h"
84 85

//-----------------------------variables ---------------------------------------------------------------------------
86 87 88 89


    

90

Dimitri van Heesch's avatar
Dimitri van Heesch committed
91
static VhdlContainer s_str;
92

93
static QList<Entry>instFiles;
94 95 96
static QList<Entry>libUse;


97 98 99 100 101 102 103 104 105 106 107 108
static int yyLineNr;
static Entry* lastCompound;
static Entry* currentCompound;
static Entry* lastEntity;
static Entry* current;
static Entry* tempEntry;
static Entry* current_root;
static QCString compSpec;
static QCString currName;
static int levelCounter;
static QCString confName;
static QCString genLabels;
109
static QCString lab;
110
static QCString forL;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
111
static QList<VhdlConfNode> configL;
112

113 114 115

static int currP=0;

116 117 118 119 120 121
enum  { GEN_SEC=0x1, PARAM_SEC,CONTEXT_SEC,PROTECTED_SEC } ;

static int param_sec = 0;
static int parse_sec=0;


122
//---------------------------- functions --------------------------------------------------------------------------------
123

124
int vhdlScanYYlex ();
125 126
void vhdlScanYYerror (char const *);

127
static void addVhdlType(const QCString &name,int startLine,
128
                        int section,uint64 spec,
129 130 131 132 133 134
			const char* args,const char* type,
			Protection prot=Public);
static void addCompInst(char *n, char* instName,char* comp,int line);

static void newEntry();
static void initEntry(Entry *e);
135

136 137 138

static void pushLabel(QCString &,QCString&);
static QCString popLabel(QCString&);
139
static void addConfigureNode(const char* a,const char*b,
140
                         bool isRoot,bool isLeave,bool inlineConf=FALSE);
141
//static bool addLibUseClause(const QCString &type);
142 143 144 145
static bool isFuncProcProced();
static void initEntry(Entry *e);
static void addProto(const char *s1,const char *s2,const char *s3,
                     const char *s4,const char *s5,const char *s6);
146
static void createFunction(const QCString &impure,uint64 spec,
147
                           const QCString &fname);
148

Dimitri van Heesch's avatar
Dimitri van Heesch committed
149
static void createFlow();    
150

151
void newVhdlEntry()
152
{
153
  newEntry();
154 155
}

156
Entry* getCurrentVhdlEntry()
157
{
158
  return current;
159 160 161 162 163 164 165 166 167 168 169
}

void initVhdlParser()
{
  lastCompound=0;
  lastEntity=0;
  currentCompound=0;
  lastEntity=0;
  current_root=s_str.root;
  current=new Entry();
  initEntry(current);
170
  libUse.clear();
171 172 173 174 175 176 177
}

QList<Entry> & getVhdlInstList()
{
  return instFiles;
}

178 179 180 181
QList<Entry> & getLibUse()
{
  return libUse;
}
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275

%}

%token
t_ABSTRLIST
t_CHARLIST
t_DIGIT
t_STRING
t_LETTER
t_ACCESS
t_AFTER
t_ALIAS
t_ALL
t_AND
t_ARCHITECTURE
t_ARRAY
t_ASSERT
t_ATTRIBUTE
t_BEGIN
t_BLOCK
t_BODY
t_BUFFER
t_BUS
t_CASE
t_COMPONENT
t_CONFIGURATION
t_CONSTANT
t_DISCONNECT
t_DOWNTO
t_ELSE
t_ELSIF
t_END
t_ENTITY
t_EXIT
t_FILE
t_FOR
t_FUNCTION
t_GENERATE
t_GENERIC
t_GUARDED
t_IF
t_IN
t_INOUT
t_IS
t_LABEL
t_LIBRARY
t_LINKAGE
t_LOOP
t_MAP
t_NAND
t_NEW
t_NEXT
t_NOR
t_NULL
t_OF
t_ON
t_OPEN
t_OR
t_OTHERS
t_OUT
t_PACKAGE
t_PORT
t_PROCEDURE
t_PROCESS
t_RANGE
t_RECORD
t_REGISTER
t_REPORT
t_RETURN
t_SELECT
t_SEVERITY
t_SIGNAL
t_SUBTYPE
t_THEN
t_TO
t_TRANSPORT
t_TYPE
t_UNITS
t_UNTIL
t_USE
t_VARIABLE
t_WAIT
t_WHEN
t_WHILE
t_WITH
t_XOR

/* new keywords */
t_IMPURE
t_PURE
t_GROUP
t_POSTPONED
t_SHARED
t_XNOR
276 277 278
t_SLL
t_SRA
t_SLA
279
t_SRL
280
t_ROR
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322
t_ROL
t_UNAFFECTED
/*============== VHDL 2008 keywords   ======================= */

t_ASSUME_GUARANTEE
t_ASSUME
t_CONTEXT
t_COVER
t_DEFAULT
t_FAIRNESS
t_FORCE
t_INERTIAL
t_LITERAL
t_PARAMETER
t_PROTECTED
t_PROPERTY
t_REJECT
t_RELEASE
t_RESTRICT
t_RESTRICT_GUARANTEE
t_SEQUENCE
t_STRONG
t_VMODE
t_VPROP
t_VUNIT


/*============== VHDL binary operators 2008   ======================= */

t_SLSL
t_SRSR
t_QQ
t_QGT
t_QLT
t_QG
t_QL
t_QEQU
t_QNEQU

%nonassoc t_EQSym t_NESym t_LTSym t_LESym t_GTSym t_GESym t_QNEQU t_QEQU t_QL t_QG t_QLT  t_QGT
%left t_Plus t_Minus t_Ampersand
%left MED_PRECEDENCE
323 324
%left t_Star t_Slash t_MOD t_REM
%nonassoc t_DoubleStar t_ABS t_NOT MAX_PRECEDENCE
325 326 327 328

/* misc syms */
/*t_Space */

329
%token
330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346
t_Apostrophe
t_LeftParen
t_RightParen
t_Comma
t_VarAsgn
t_Colon
t_Semicolon
t_Arrow
t_Box
t_Bar
t_Dot
t_Q
t_At
t_Neg
t_LEFTBR
t_RIGHTBR
t_ToolDir
347

348
%type<qstr> designator literal enumeration_literal physical_literal physical_literal_no_default physical_literal_1
349 350
%type<qstr> lib_clause use_clause sel_list entity_decl entity_start entity_decl_2 entity_decl_1 arch_body arch_start arch_body_1
%type<qstr> config_decl config_start config_decl_2 config_decl_1 config_decl_3 package_decl package_start package_body pack_body_start package_body_2 package_body_1 common_decltve_item
351
%type<qstr> config_decltve_item subprog_decl subprog_body interf_list interf_element interf_element_4 interf_element_3 interf_element_2 interf_element_1 mode
352 353 354 355 356 357 358
%type<qstr> association_list association_list_1 association_list_2 gen_association_list gen_association_list_1 gen_association_list_2 association_element gen_association_element formal_part actual_part mark expr and_relation relation primary name name2 sel_name suffix ifts_name
%type<qstr> attribute_name aggregate element_association_list2 qualified_expr element_association choices choices_1 choices_2 choice type_decl type_decl_1 type_definition enumeration_type_definition enumeration_type_definition_1 enumeration_type_definition_2 physical_type_definition physical_type_definition_1 physical_type_definition_2 base_unit_decl secondary_unit_decl unconstrained_array_definition unconstrained_array_definition_1 unconstrained_array_definition_2 index_subtype_definition constrained_array_definition record_type_definition record_type_definition_1 record_type_definition_2 element_decl
%type<qstr> access_type_definition file_type_definition subtype_decl subtype_indic subtype_indic_1 subtype_indic1 subtype_indic1_1 range_constraint index_constraint index_constraint_1 index_constraint_2 discrete_range discrete_range1 range_spec direction constant_decl constant_decl_1 signal_decl signal_decl_2 signal_decl_1 variable_decl variable_decl_1 object_class signal_kind alias_decl file_decl file_decl_1 attribute_decl attribute_spec entity_spec entity_name_list entity_name_list_1
%type<qstr> entity_name_list_2 entity_class block_stat
%type<qstr> generate_stat generate_stat_1 procs_stat procs_stat1 procs_stat1_1 sensitivity_list sensitivity_list_1 sensitivity_list_2
%type<qstr> procedure_call_stat comp_decl comp_decl_2 comp_decl_1 block_config block_config_2 block_config_3 block_config_1 block_config_4 block_spec config_item comp_config comp_config_2 comp_config_1 config_spec binding_indic comp_spec
%type<qstr> inst_list entity_aspect idf_list procs_stat1_6
359 360 361
%type<qstr> t_Identifier t_StringLit t_BitStringLit t_AbstractLit t_CharacterLit tbox group_name record_type_simple_name
%type<qstr> entity_class_entry_list entity_class_entry group_constituent_list group_constituent group_declaration group_template_declaration
%type<qstr> procs_stat1_5 comp_1 mark_comp dot_name fi_dec multiplying_operator factor term adding_op
362
%type<qstr> simple_exp alias_spec sigma signature1 mark_stats mark_stats_1 signature
363
%type<qstr> protected_type_body protected_type_declaration alias_name_stat vcomp_stat comp_spec_stat procs_decltve_item
364 365 366
%type<qstr> sig_stat external_name absolute_pathname relative_pathname package_path_name external_pathname pathname_element_list neg_list pathname_element

%type<qstr> func_name return_is param func_prec iproc ifunc interface_subprogram_decl interface_package_decl package_instantiation_decl
367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385
%type<qstr> subprogram_instantiation_decl procs_stat1_4
%type<qstr>  context_ref  libustcont_stats   libustcont_stat  context_decl entity_decltve_item case_stat 
%type<qstr> exit_stat   if_stat loop_stat next_stat null_stat    return_stat  signal_assign_stat 
%type<qstr> variable_assign_stat  wait_stat report_statement assertion_stat_2 assertion_stat_1

%type<qstr> binding_indic_2 binding_indic_1   shift_op block_decltve_item disconnection_spec seq_stats_1 seq_stats_2 seq_stats
%type<qstr> signal_list signal_list_1 signal_list_2 seq_stat assertion_stat choice_stat choice_stat_1
%type<qstr>  case_stat_1 case_stat_2 case_stat_alternative  exit_stat_1 exit_stat_2  if_stat_2 if_stat_3 if_stat_1 loop_stat_2  loop_stat_1 loop_stat_3
%type<qstr>  next_stat_1  next_stat_2 return_stat_1   lable variable_assign_stat_1
%type<qstr>  wait_stat_1 wait_stat_2 wait_stat_3 target delay_mechanism
%type<qstr> if_generation_scheme if_scheme if_scheme_1 if_scheme_2 if_scheme_3  iteration_scheme for_scheme while_scheme concurrent_stats
%type<qstr> concurrent_stats_1 concurrent_stats_2  concurrent_stat  block_stat_5 block_stat_4 block_stat_3 block_stat_2 block_stat_1 block_stat_0
%type<qstr> generate_statement_body generation_scheme concurrent_assertion_stat concurrent_procedure_call concurrent_signal_assign_stat
%type<qstr> block_stat_6  block_stat_7 block_stat_8 condal_signal_assign  sel_signal_assign opts condal_wavefrms wavefrm wavefrm_element
%type<qstr> wavefrm_1 wavefrm_2 wavefrm_element_1 wavefrm_element_2 opts_1 opts_2 sel_wavefrms
%type<qstr>  sel_wavefrms_1 sel_wavefrms_2 gen_stat1 block_declarative_part end_stats inout_stat
%type<qstr> selected_signal_assignment comp_inst_stat                                             
 %type<qstr> conditional_signal_assignment selected_variable_assignment conditional_variable_assignment 
 %type<qstr> subprog_decltve_item subprog_body_3 subprog_body_1 procs_stat1_2
386 387 388 389

%debug

// for debugging set yydebug=1
390
%initial-action { yydebug=0; }
391 392 393 394

%expect 2

// minimum bison version
395 396 397
//%required "2.2"


398 399

%%
400 401
start: design_file 
    
402 403

design_file     : design_unit_list
404 405 406
                    /* parse function/process/procedure for vhdlflow */
                     | procs_stat
                     | subprog_body
407

408
design_unit_list: design_unit
409 410
                | design_unit_list design_unit
                ;
411

412 413 414
designator      : t_Identifier                      { $$=$1; }
                | t_StringLit                       { $$=$1; }
                ;
415

416 417 418 419 420 421
literal         : t_AbstractLit                     { $$=$1; }
                | t_CharacterLit                    { $$=$1; }
                | t_BitStringLit                    { $$=$1; }
                | physical_literal_no_default       { $$=$1; }
                | t_NULL                            { $$="null"; }
                ;
422

423 424
enumeration_literal  : t_CharacterLit               { $$=$1; }
                     | t_Identifier                 { $$=$1; }
425

426
physical_literal     : physical_literal_1 t_Identifier  { $$=$1+" "+$2; }
427

428 429 430 431 432 433
physical_literal_1   : /* empty */        { $$=""; }
                     | t_AbstractLit      { $$=$1; }

physical_literal_no_default : t_AbstractLit t_Identifier   { $$=$1+" "+$2; }

idf_list : t_Identifier { $$=$1; }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
434
         | idf_list t_Comma t_Identifier { $$=$1+","+$3; }
435
         ;
436 437 438 439 440

/*------------------------------------------
--  Desing Unit
--------------------------------------------*/

441
design_unit      : context_list lib_unit
442

443 444 445 446 447 448 449 450
context_list     :  /* empty */
                 | context_list context_item

lib_unit         : entity_decl
                 | config_decl
                 | package_decl
                 | arch_body
                 | package_body
451 452 453 454
                 | context_decl
                 | package_instantiation_decl
                 ;

455 456 457 458 459 460
context_item     : lib_clause
                 | use_clause
                 ;

lib_clause       : t_LIBRARY idf_list t_Semicolon
                 {
461
                   if ( parse_sec==0 && Config_getBool("SHOW_INCLUDE_FILES") )
462
                   {
463
                     addVhdlType($2,getParsedLine(t_LIBRARY),Entry::VARIABLE_SEC,VhdlDocGen::LIBRARY,$2.data(),"_library_");
464 465 466 467 468
                   }
                   $$="library "+$2;
                 }

use_clause : t_USE sel_list t_Semicolon
469
                 {
470 471 472
                   QStringList ql1=QStringList::split(",",$2,FALSE);
                   for (uint j=0;j<ql1.count();j++)
                   {
473 474 475
                     //QStringList ql=QStringList::split(".",ql1[j],FALSE);
                     QCString it=ql1[j].utf8();
                     if ( parse_sec==0 && Config_getBool("SHOW_INCLUDE_FILES") )
476 477 478 479 480
                     {
                       addVhdlType(it,getParsedLine(t_USE),Entry::VARIABLE_SEC,VhdlDocGen::USE,it.data(),"_use_");
                     }
                   }
                   $$="use "+$2;
481 482
                 }

483 484
sel_list    : sel_name { $$=$1; }
            | sel_list t_Comma sel_name { $$=$1+","+$3; }
485 486 487 488 489 490 491 492 493 494 495
            ;
/*------------------------------------------
--  Library Units
--------------------------------------------*/

entity_decl : entity_start error comp_end_dec  t_Semicolon

entity_decl : entity_start entity_decl_1 entity_decl_2
                     entity_decl_3 entity_decl_4   comp_end_dec  t_Semicolon

entity_start: t_ENTITY t_Identifier t_IS
496 497 498 499
              {
                $$=$2;
                lastEntity=current;
                lastCompound=0;
500
                 getParsedLine(t_ENTITY);
501
                addVhdlType($$,getParsedLine(t_ENTITY),Entry::CLASS_SEC,VhdlDocGen::ENTITY,0,0,Public);
502
               }
503
              ;
504 505

entity_decl_5 :   /* empty */
506 507
              |  t_Identifier
              ;
508
entity_decl_4 :  /* empty */
509 510
              | t_BEGIN concurrent_stats
              ;
511
entity_decl_3 :  /* empty */
512 513
              | entity_decl_3 entity_decl_6
              ;
514

515
entity_decl_6 : entity_decltve_item
516

517 518 519 520
entity_decl_2 : /* empty */  { $$=""; }
              | t_PORT { currP=VhdlDocGen::PORT; }  interf_list t_Semicolon  { currP=0; }
              ;
entity_decl_1 :  /* empty */  { $$=""; }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
521
              | t_GENERIC { currP=VhdlDocGen::GENERIC;parse_sec=GEN_SEC; } interf_list t_Semicolon{ currP=0;parse_sec=0; }
522 523
              | t_GENERIC error t_Semicolon{ currP=0; }
              ;
524 525


526 527
arch_body     : arch_start arch_body_1 t_BEGIN concurrent_stats t_END arch_body_2 t_Semicolon {lastCompound=0;}
arch_body     : arch_start error t_END arch_body_2 t_Semicolon {lastCompound=0;}
528 529 530

arch_start    : t_ARCHITECTURE t_Identifier t_OF t_Identifier t_IS
                {
531
                  $$=$4+"::"+$2;
532 533
                  genLabels.resize(0);
                  pushLabel(genLabels,$2);
534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549
                  lastCompound=current;
                  addVhdlType($$,getParsedLine(t_ARCHITECTURE),Entry::CLASS_SEC,VhdlDocGen::ARCHITECTURE,0,0,Private);
                }
arch_body_2   : /* empty */
arch_body_2   : t_Identifier
arch_body_2   : t_ARCHITECTURE  t_Identifier
arch_body_2   : t_ARCHITECTURE

arch_body_1   : /* empty */  { $$=""; }
arch_body_1   : arch_body_1 arch_body_3

arch_body_3   :  block_decltve_item

config_decl   : config_start error  t_END config_decl_2 t_Semicolon { genLabels.resize(0); }
config_decl   : config_start config_decl_1 block_config t_END config_decl_2 t_Semicolon { genLabels.resize(0); }
                {
550 551
                  QCString k=$3;
                  QCString k2=$2;        
552 553 554 555 556 557
                  confName="";
                }


config_start  : t_CONFIGURATION t_Identifier t_OF t_Identifier t_IS
                {
558
                  forL.resize(0);
559 560 561 562 563
                  confName=$2+"::"+$4;
                  addVhdlType($2.data(),getParsedLine(t_CONFIGURATION),Entry::VARIABLE_SEC,VhdlDocGen::CONFIG,"configuration",$4.data());
                }

config_decl_2 : /* empty */     { $$=""; }
564 565 566 567 568
config_decl_2 : t_Identifier    
                { 
                  QCString l=$1;
                  $$=$1; 
                }
569 570 571 572 573 574 575 576 577
config_decl_2 : t_CONFIGURATION { $$="configuration"; }
config_decl_2 : t_CONFIGURATION t_Identifier  { $$=$2; }
config_decl_1 :  /* empty */    { $$=""; }
config_decl_1 : config_decl_1 config_decl_3   { $$=$1+" "+$2; }
config_decl_3 : config_decltve_item           { $$=$1; }

package_decl  : package_start error t_END package_decl_2 t_Semicolon
package_decl  : package_start package_decl_1 t_END package_decl_2 t_Semicolon
package_start : t_PACKAGE t_Identifier t_IS
578 579
                           {
                          lastCompound=current;
580 581 582 583 584 585 586 587 588
                          Entry *clone=new Entry(*current);
                         clone->section=Entry::NAMESPACE_SEC;
                         clone->spec=VhdlDocGen::PACKAGE;
                         clone->name=$2;
                         clone->startLine=s_str.iLine;
                         clone->bodyLine=s_str.iLine;
                         clone->protection=Package;
                         current_root->addSubEntry(clone);
                         addVhdlType($2,s_str.iLine,Entry::CLASS_SEC,VhdlDocGen::PACKAGE,0,0,Package);
589 590
                       }

591 592 593 594 595 596
package_decl_2     :  /* empty */
package_decl_2     : t_Identifier  { lastCompound=0; }
package_decl_2     : t_PACKAGE t_Identifier { lastCompound=0; }
package_decl_2     : t_PACKAGE { lastCompound=0; }

package_decl_1     :  /* empty */
597
package_decl_1    : package_decl_22
598 599
package_decl_1     : package_decl_1 package_decl_3
package_decl_3     : package_decltve_item
600 601 602 603 604 605

package_decl_22: gen_interface_list t_Semicolon
package_decl_22: gen_interface_list
package_decl_22: gen_interface_list gen_assoc_list
package_decl_22: gen_interface_list gen_assoc_list t_Semicolon

606 607
package_body    : pack_body_start error t_END package_body_2 t_Semicolon                   {lastCompound=0;}
package_body    : pack_body_start package_body_1 t_END package_body_2 t_Semicolon {lastCompound=0;}
608
pack_body_start : t_PACKAGE t_BODY t_Identifier t_IS
609 610 611 612 613 614
                      {
                        $$=$3;
                        lastCompound=current;
                        $$.prepend("_");
                        addVhdlType($$,getParsedLine(t_PACKAGE) ,Entry::CLASS_SEC,VhdlDocGen::PACKAGE_BODY,0,0,Protected);
                      }
615 616 617 618
package_body_2  :  /* empty */  { $$="";lastCompound=0; }
package_body_2  : t_Identifier                                            { lastCompound=0; }
package_body_2  : t_PACKAGE t_BODY                         { lastCompound=0; }
package_body_2  : t_PACKAGE t_BODY t_Identifier      { lastCompound=0; }
619

620 621 622
package_body_1  :  /* empty */  { $$=""; }
package_body_1  : package_body_1 package_body_3
package_body_3  : package_body_decltve_item
623 624 625 626 627 628


/*------------------------------------------
--  Declarative Item
--------------------------------------------*/

629
common_decltve_item_1: package_decl 
630 631 632 633 634
common_decltve_item_1: package_instantiation_decl
common_decltve_item_1: package_body
common_decltve_item_1: subprogram_instantiation_decl


Dimitri van Heesch's avatar
Dimitri van Heesch committed
635 636 637 638 639 640 641
common_decltve_item: type_decl{ $$=$1; }
common_decltve_item: subtype_decl{ $$=$1; }
common_decltve_item: constant_decl{  $$=$1; }
common_decltve_item: file_decl{ $$=$1; }
common_decltve_item: alias_decl{ $$=$1; }
common_decltve_item: subprog_decl{ $$=$1; }
common_decltve_item: use_clause { $$=$1; }
642

Dimitri van Heesch's avatar
Dimitri van Heesch committed
643 644 645 646 647 648 649 650 651 652
entity_decltve_item: common_decltve_item  { $$=$1; }
entity_decltve_item: subprog_body { $$=$1; }
entity_decltve_item: attribute_decl { $$=$1; }
entity_decltve_item: attribute_spec { $$=$1; }
entity_decltve_item: disconnection_spec { $$=$1; }
entity_decltve_item: signal_decl { $$=$1; }
entity_decltve_item: variable_decl { $$=$1; }
entity_decltve_item: group_template_declaration { $$=$1; }
entity_decltve_item: group_declaration { $$=$1; }
entity_decltve_item: common_decltve_item_1 { $$=""; }
653 654 655 656 657 658 659 660 661


block_decltve_item: common_decltve_item 
block_decltve_item: subprog_body 
block_decltve_item: comp_decl 
block_decltve_item: attribute_decl 
block_decltve_item: attribute_spec 
block_decltve_item: config_spec 
block_decltve_item: disconnection_spec 
662 663 664 665
block_decltve_item: signal_decl
block_decltve_item: variable_decl
block_decltve_item: group_template_declaration
block_decltve_item: group_declaration
Dimitri van Heesch's avatar
Dimitri van Heesch committed
666 667
block_decltve_item: common_decltve_item_1 { $$=""; }
block_decltve_item: tool_directive { $$=""; }
668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694

block_declarative_part: block_decltve_item
                      | block_declarative_part  block_decltve_item


package_decltve_item: common_decltve_item
package_decltve_item: comp_decl
package_decltve_item: attribute_decl
package_decltve_item: attribute_spec
package_decltve_item: disconnection_spec
package_decltve_item: signal_decl
package_decltve_item: variable_decl
package_decltve_item: group_template_declaration
package_decltve_item: group_declaration
package_decltve_item: package_decl
package_decltve_item: package_instantiation_decl
package_decltve_item: subprogram_instantiation_decl

package_body_decltve_item: common_decltve_item
package_body_decltve_item: subprog_body
package_body_decltve_item: variable_decl
package_body_decltve_item: group_template_declaration
package_body_decltve_item: group_declaration
package_body_decltve_item: attribute_decl
package_body_decltve_item: attribute_spec
package_body_decltve_item: common_decltve_item_1

Dimitri van Heesch's avatar
Dimitri van Heesch committed
695 696 697 698 699
subprog_decltve_item: common_decltve_item { $$=$1; }
subprog_decltve_item: subprog_body  { $$=""; }
subprog_decltve_item: attribute_decl { $$=$1; }
subprog_decltve_item: attribute_spec { $$=$1; }
subprog_decltve_item: variable_decl { $$=$1; }
700
subprog_decltve_item: group_template_declaration
Dimitri van Heesch's avatar
Dimitri van Heesch committed
701 702
subprog_decltve_item: group_declaration { $$=""; }
subprog_decltve_item: common_decltve_item_1 { $$=""; }
703

Dimitri van Heesch's avatar
Dimitri van Heesch committed
704
procs_decltve_item: subprog_decltve_item { $$=$1; }
705 706 707 708 709

config_decltve_item: attribute_spec    { $$=$1; }
config_decltve_item: use_clause        { $$=$1; }
config_decltve_item: group_declaration { $$=$1; }
config_decltve_item: t_USE t_VUNIT idf_list t_Semicolon { $$=$3; }
710 711 712 713

/*------------------------------------------
--  Subprograms
--------------------------------------------*/
714 715 716 717 718 719
func_prec: t_PURE { $$="pure"; }
func_prec: t_IMPURE { $$="impure"; }

subprog_decl: subprog_spec t_Semicolon { currP=0; }

subprog_spec: t_PROCEDURE t_Identifier
720 721 722 723 724
              { 
              currP=VhdlDocGen::PROCEDURE; 
              createFunction($2,currP,0); 
              tempEntry=current;
             }
725 726 727 728 729 730 731
              subprog_spec_1 {  newEntry(); }
subprog_spec: func_prec t_FUNCTION designator
              {
                currP=VhdlDocGen::FUNCTION;
                createFunction($1,currP,$3.data());
              }
              subprog_spec_2 t_RETURN mark
732
                {
733 734 735 736 737 738 739 740 741 742 743 744 745 746 747
                tempEntry=current;
                current->type=$7;
                newEntry();
              }

subprog_spec  :  t_FUNCTION designator
              {
                currP=VhdlDocGen::FUNCTION;
                createFunction(0,currP,$2.data());
              }
              subprog_spec_2 t_RETURN mark
              {
                tempEntry=current;
                current->type=$6;
                newEntry();
748

749
              }
750 751 752 753

subprog_spec_22: gen_interface_list
subprog_spec_22: gen_interface_list gen_assoc_list

754 755 756 757 758 759 760
subprog_spec_33: t_PARAMETER
                 { param_sec=PARAM_SEC; }
                 interf_list
                 { param_sec= 0; }
subprog_spec_33: { param_sec=PARAM_SEC; }
                 interf_list
                 { param_sec= 0; }
761

762 763 764 765
subprog_spec_2:  /* empty */
subprog_spec_2: subprog_spec_22 subprog_spec_33
subprog_spec_2: subprog_spec_33
subprog_spec_2: subprog_spec_22
766

767 768
subprog_spec_1: subprog_spec_2

Dimitri van Heesch's avatar
Dimitri van Heesch committed
769
subprog_body: subprog_spec t_IS subprog_body_1 
770
    {
Dimitri van Heesch's avatar
Dimitri van Heesch committed
771 772 773 774 775 776 777 778 779 780 781
      if ($3.data())
      {
        FlowChart::addFlowChart(FlowChart::VARIABLE_NO,$3,0);
      }
      FlowChart::addFlowChart(FlowChart::BEGIN_NO,"BEGIN",0);
    } 
    t_BEGIN seq_stats t_END subprog_body_2 t_Semicolon
    {
      tempEntry->endBodyLine=s_str.yyLineNr;
      createFlow();    
      currP=0;
782 783 784 785 786 787 788 789 790 791 792 793 794
    }
subprog_body: subprog_spec t_IS error  t_END subprog_body_2 t_Semicolon
    {
      currP=0;
    }
subprog_body_2:  /* empty */
subprog_body_2: designator
subprog_body_2: t_FUNCTION
subprog_body_2: t_PROCEDURE
subprog_body_2: t_PROCEDURE t_Identifier
subprog_body_2: t_FUNCTION t_Identifier
subprog_body_2: t_FUNCTION t_STRING

Dimitri van Heesch's avatar
Dimitri van Heesch committed
795
subprog_body_1:  /* empty */ { $$=""; }
796
//subprog_body_1    :  subprogram_instantiation_decl
Dimitri van Heesch's avatar
Dimitri van Heesch committed
797
subprog_body_1: subprog_body_1 subprog_body_3  { $$=$1+$2; }
798

Dimitri van Heesch's avatar
Dimitri van Heesch committed
799
subprog_body_3: subprog_decltve_item  { $$=$1; }
800
                                                              
801 802 803 804
/*--------------------------------------------------
--  Interface Lists and Associaton Lists
----------------------------------------------------*/

805 806 807 808 809 810 811 812 813 814 815
interf_list:   t_LeftParen interf_element interf_list_1 t_RightParen   { $$=""; }
interf_list:   t_LeftParen error t_RightParen   { $$=""; }
interf_list_1:  /* empty */
interf_list_1: interf_list_1 interf_list_2
interf_list_2: t_Semicolon interf_element

interf_element: interface_package_decl
                  {
                    // adding generic :  [ package foo  is new bar]
                    if (parse_sec==GEN_SEC)
                    {
816
                       addVhdlType(current->name.data(),getParsedLine(t_PACKAGE),Entry::VARIABLE_SEC,VhdlDocGen::GENERIC,$1.data(),0);
817 818 819 820 821 822 823 824 825 826 827
                    }
                  }
interf_element: interface_subprogram_decl
                  {
                    if (parse_sec==GEN_SEC)
                    {
                      int a=getParsedLine(t_FUNCTION);
                      int b=getParsedLine(t_PROCEDURE);

                      if (a>b) b=a;

828
                      addVhdlType(current->name.data(),b,Entry::VARIABLE_SEC,VhdlDocGen::GENERIC,$1.data(),0);
829 830 831 832 833 834
                    }
                  }
interf_element: interf_element_1 t_Identifier
                  {
                    if (parse_sec==GEN_SEC)
                    {
835
                        addVhdlType($2,s_str.iLine,Entry::VARIABLE_SEC,currP,$1.data(),0);
836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880
                    }
                  }
interf_element: interf_element_1 idf_list t_Colon interf_element_2 subtype_indic interf_element_3 interf_element_4
                  {
                    $$=$2+":"+$4+$5+$6+$7;
                    if (currP!=VhdlDocGen::COMPONENT)
                    {
                      if (currP==VhdlDocGen::FUNCTION || currP==VhdlDocGen::PROCEDURE)
                      {
                        addProto($1.data(),$2.data(),$4.data(),$5.data(),$6.data(),$7.data());
                      }
                      else
                      {
                        QCString i=$5+$6+$7;
                        if (currP==VhdlDocGen::GENERIC)
                          addVhdlType($2,s_str.iLine,Entry::VARIABLE_SEC,currP,i.data(),$4.data());
                        else if(parse_sec != GEN_SEC)
                          addVhdlType($2,s_str.iLine,Entry::VARIABLE_SEC,currP,i.data(),$4.data());
                      }
                      //   fprintf(stderr,"\n\n <<port  %s  >>\n",$$.data());
                    } // if component
                  }
interf_element_4: /* empty :=*/   { $$=""; }
interf_element_4: t_VarAsgn expr  { $$=":="+$2; }
interf_element_3: /* empty */     { $$=""; }
interf_element_3: t_BUFFER        { $$="buffer"; }
interf_element_3: t_BUS           { $$="bus"; }
interf_element_2: /* empty */     { $$=""; }
interf_element_2: mode            { $$=$1; }
interf_element_1: /* empty */     { $$=""; }
interf_element_1: object_class    { $$=$1; }

mode: t_IN                        { $$="in"; }
mode: t_OUT                       { $$="out"; }
mode: t_INOUT                     { $$="inout"; }
mode: t_BUFFER                    { $$="buffer"; }
mode: t_LINKAGE                   { $$="link"; }

association_list:   t_LeftParen association_element association_list_1 t_RightParen  { $$="("+$2+")"; }
association_list_1:  /* empty */                           { $$=""; }
association_list_1: association_list_1 association_list_2  { $$=$1+" "+$2; }
association_list_2: t_Comma association_element            { $$=", "+$2; }

gen_association_list : t_LeftParen gen_association_element gen_association_list_1 t_RightParen
    {
881
      QCString str="( "+$2+$3;
882 883 884 885 886 887 888
      str.append(" )");
      $$=str;
    }
gen_association_list: t_LeftParen  error t_RightParen { $$=""; }
gen_association_list: t_LeftParen t_OPEN t_RightParen { $$=" ( open ) "; }

gen_association_list_1:  /* empty */  { $$=""; }
889
gen_association_list_1: gen_association_list_1   gen_association_list_2  { $$=$1+" "+$2; }
890 891 892 893 894 895
gen_association_list_2: t_Comma gen_association_element { $$=","+$2; }

association_element: formal_part t_Arrow actual_part { $$=$1+"=>"+$3; }
association_element: actual_part { $$=$1; }
association_element: t_Box       { $$="<>"; }
association_element: t_DEFAULT   { $$="default"; }
896 897

/* changed ;gen_association_element   : association_element  */
898
gen_association_element: expr            { $$=$1; }
899
gen_association_element: choice t_Arrow expr { $$=$1+"=>"+$3; }
900
gen_association_element: discrete_range1 {  $$=$1 ; }
901

902
formal_part: name  { $$=$1; }
903

904 905 906
actual_part: expr      { $$=$1; }
actual_part: t_OPEN    { $$="open"; }
actual_part: t_INERTIAL expr    { $$="inertial"; }
907 908 909 910 911

/*--------------------------------------------------
--  Names and Expressions
----------------------------------------------------*/

912 913
expr: and_relation  { $$=$1; }
expr: relation  { $$=$1; }
914

915 916 917 918 919 920
shift_op: t_SLL { $$="sll"; }
        | t_SRA    { $$="sra"; }
        | t_SLA    { $$="sla"; }
        | t_SRL    { $$="srl"; }
        | t_ROR    { $$="ror"; }
        | t_ROL   { $$="rol"; }
921
        ;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
922 923 924 925 926 927 928 929 930 931 932 933 934
and_relation: relation shift_op relation { $$= $1+$2+$3; }
and_relation: relation t_AND    relation  { $$= $1+" and "+$3; }
and_relation: relation t_XOR    relation  { $$= $1+" xor "+$3; }
and_relation: relation t_OR     relation  { $$= $1+" or "+$3; }
and_relation: relation t_NOR    relation  { $$= $1+" nor "+$3; }
and_relation: relation t_XNOR   relation  { $$= $1+"xnor"+$3; }
and_relation: relation t_NAND   relation { $$= $1+"nand"+$3; }
and_relation: and_relation t_NAND relation { $$= $1+"nand"+$3; }
and_relation: and_relation t_NOR  relation{ $$= $1+"nor"+$3; }
and_relation: and_relation t_XNOR relation  { $$= $1+"nand"+$3; }
and_relation: and_relation t_AND  relation { $$= $1+" and "+$3; }
and_relation: and_relation t_OR   relation  { $$= $1+" or "+$3; }
and_relation: and_relation t_XOR  relation  { $$= $1+" xor "+$3; }
935

936
/* ;relation   : unary_operator primary   */
937

938 939 940 941 942 943 944 945
relation: t_QQ primary                         { $$=" ?? "+$2; }
relation: primary                              { $$=$1; }
relation: t_Plus primary  %prec MED_PRECEDENCE { $$="+"+$2; }
relation: t_Minus primary %prec MED_PRECEDENCE { $$="-"+$2; }
relation: t_ABS primary                        { $$="abs"+$2; }
relation: t_NOT primary                        { $$="not "+$2; }
relation: primary t_DoubleStar primary         { $$=$1+" ** "+$3; }
relation: t_Minus primary t_DoubleStar primary { $$=$2+" ** "+$4; }
946

947
/*   relation : relation binary_operator primary */
948

Dimitri van Heesch's avatar
Dimitri van Heesch committed
949 950 951 952 953 954 955 956 957 958
relation: relation t_MOD   relation       { $$=$1+" mod "+$3; }
relation: relation t_REM   relation       { $$=$1+" rem "+$3; }
relation: relation t_Ampersand relation   { $$=$1+" & "+$3; }
relation: relation t_Star  relation       { $$=$1+" * "+$3; }
relation: relation t_Plus  relation       { $$=$1+" + "+$3; }
relation: relation t_Minus relation       { $$=$1+" - "+$3; }
relation: relation t_LESym relation       { $$=$1+" <= "+$3; }
relation: relation t_GESym relation       { $$=$1+" >= "+$3; }
relation: relation t_LTSym relation       { $$=$1+" < "+$3; }
relation: relation t_GTSym relation       { $$=$1+" > "+$3; }
959
relation: relation t_EQSym relation       { $$=$1+" = "+$3; }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
960 961 962 963 964 965 966 967
relation: relation t_NESym relation       { $$=$1+" != "+$3; }
relation: relation t_Slash relation       { $$=$1+" / "+$3; }
relation: relation t_QNEQU relation       { $$=$1+" ?/= "+$3; }
relation: relation t_QEQU  relation       { $$=$1+" ?= "+$3; }
relation: relation t_QL    relation       { $$=$1+" ?< "+$3; }
relation: relation t_QG    relation       { $$=$1+" ?> "+$3; }
relation: relation t_QLT   relation       { $$=$1+" ?<= "+$3; }
relation: relation t_QGT   relation       { $$=$1+" ?>= "+$3; }
968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044

simple_exp: t_Minus  term  { $$ = "-"+$2; }
          | t_Plus term    { $$ = "+"+$2; }
          | term           { $$ = $1; }
          | simple_exp
            adding_op term { $$ = $1+" "+$2+" "+$3; }

adding_op: t_Ampersand { $$ = "&"; }
         | t_Minus     { $$ = "-"; }
         | t_Plus      { $$ = "+"; }
         ;

term: factor { $$=$1; }
    | factor multiplying_operator factor { $$ = $1+" "+$2+" "+$3; }
    ;

multiplying_operator: t_Star  { $$ = "*";   }
                    | t_REM   { $$ = "rem"; }
                    | t_MOD   { $$ = "mod"; }
                    | t_Slash { $$ = "/";   }

factor: primary                        { $$=$1; }
      | t_ABS  primary                 { $$="abs "+$2; }
      | t_NOT  primary                 { $$="not  "+$2; }
      |  primary t_DoubleStar  primary { $$ = $1+" ** "+$3; }

primary: name                          { $$=$1; }
primary: literal                       { $$=$1; }
primary: aggregate                     { $$=$1; }
primary: qualified_expr                { $$=$1; }
primary: allocator                     { $$=""; }
primary: t_LeftParen expr t_RightParen { $$="("+$2+")"; }

name:  mark           { $$=$1; }
name:  name2          { $$=$1; }
name:  external_name  { $$=$1; }
name2: t_StringLit    { $$=$1; }
name2: attribute_name { $$=$1; }
name2: ifts_name      { $$=$1; }

mark: t_Identifier    { $$=$1; }
mark: sel_name        { $$=$1; }

sel_name: name t_Dot suffix   { $$=$1+"."+$3; }

suffix: designator     { $$=$1; }
suffix: t_CharacterLit { $$=$1; }
suffix: t_ALL          { $$="all"; }

ifts_name: mark  gen_association_list { $$=$1+" "+$2; }
ifts_name: name2 gen_association_list { $$=$1+" "+$2; }

sigma:  t_Apostrophe { $$="'"; }
//sigma :  t_LEFTBR signature1 t_RIGHTBR  t_Apostrophe { $$="("+$2;;$$.append(")");$$.append("'"); }

attribute_name: mark  sigma t_Identifier   { $$=$1+"' "+$3; }
attribute_name: attribute_name t_LeftParen expr t_RightParen
attribute_name: name2 sigma t_Identifier   { $$=$1+" '"+$3; }
attribute_name: mark  sigma t_RANGE        { $$=$1+"' range "; }
attribute_name: name2 sigma t_RANGE        { $$=$1+"' range "; }

aggregate  : element_association_list2 t_RightParen  { $$=$1+" ) "; }
aggregate  : t_LeftParen choices t_Arrow expr t_RightParen  { $$="( "+$2+ "=>"+$4+" ) "; }

element_association_list2 : t_LeftParen element_association t_Comma element_association  { $$=" ( "+$2+","+$4; }
element_association_list2 : element_association_list2 t_Comma element_association   { $$=$1+","+$3; }

qualified_expr : mark t_Apostrophe t_LeftParen expr  t_RightParen { $$=$1+"'("+$4+" ) "; }
qualified_expr : mark t_Apostrophe aggregate  { $$=$1+"'"+$3; }

allocator: t_NEW mark mark allocator_1
allocator: t_NEW mark allocator_2
allocator: t_NEW qualified_expr
allocator_2:  /* empty */
allocator_2: gen_association_list
allocator_1:  /* empty */
allocator_1: gen_association_list
1045 1046 1047 1048 1049 1050


/*--------------------------------------------------
--  Element Association and Choices
----------------------------------------------------*/

1051 1052
element_association: choices t_Arrow expr { $$=$1+"=> "+$3; }
element_association: expr                 { $$=$1; }
1053

1054 1055 1056 1057
choices: choice choices_1      { $$=$1+" "+$2; }
choices_1:  /* empty */        { $$="";        }
choices_1: choices_1 choices_2 { $$=$1+" "+$2; }
choices_2: t_Bar choice        { $$=" | "+$2;  }
1058

1059 1060 1061
choice: expr                   { $$=$1; }
choice: discrete_range1        { $$=$1; }
choice: t_OTHERS               { $$="others"; }
1062 1063 1064 1065

/*--------------------------------------------------
--	Type Declarations
----------------------------------------------------*/
1066 1067 1068 1069
type_decl: t_TYPE t_Identifier error t_Semicolon  { $$=""; }
type_decl: t_TYPE t_Identifier type_decl_1 t_Semicolon
           {
             addVhdlType($2,getParsedLine(t_TYPE),Entry::VARIABLE_SEC,VhdlDocGen::TYPE,0,$3.data());
1070 1071
            $$="type ";
            $$+=$2+$3+";";
1072 1073 1074 1075
           }
type_decl: t_TYPE error t_Semicolon { $$=""; }

type_decl_1:  /* empty */           { $$=""; }
1076
type_decl_1: t_IS type_definition   { $$=" is "+$2; }
1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093

type_definition: enumeration_type_definition    { $$=$1; }
type_definition: range_constraint               { $$=$1; }
type_definition: physical_type_definition       { $$=$1; }
type_definition: unconstrained_array_definition { $$=$1; }
type_definition: constrained_array_definition   { $$=$1; }
type_definition: record_type_definition         { $$=$1; }
type_definition: access_type_definition         { $$=$1; }
type_definition: file_type_definition           { $$=$1; }
type_definition: protected_type_declaration     { $$=$1; }
type_definition: protected_type_body            { $$=$1; }


enumeration_type_definition:   t_LeftParen enumeration_literal enumeration_type_definition_1 t_RightParen { $$="( "+$2+" "+$3+" )"; }
enumeration_type_definition_1: { $$=""; }
enumeration_type_definition_1: enumeration_type_definition_1 enumeration_type_definition_2 { $$=$1+" "+$2; }
enumeration_type_definition_2: t_Comma enumeration_literal { $$=","+$2; }
1094 1095

physical_type_definition : range_constraint  t_UNITS base_unit_decl
1096 1097 1098 1099 1100 1101 1102
                           physical_type_definition_1 t_END unit_stat
                           {
                             $$=$1;
                             current->args=$3+"#"+$4;
                             current->args.prepend("units");
                             current->spec=VhdlDocGen::UNITS;
                           }
1103

1104 1105
unit_stat: t_UNITS t_Identifier
unit_stat: t_UNITS
1106

1107 1108 1109
physical_type_definition_1: /* empty */ { $$=""; }
physical_type_definition_1: physical_type_definition_1 physical_type_definition_2 { $$=$1+" "+$2; }
physical_type_definition_2: secondary_unit_decl  { $$=$1+"#"; }
1110

1111
base_unit_decl: t_Identifier t_Semicolon { $$=$1; }
1112

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1113
secondary_unit_decl: t_Identifier t_EQSym physical_literal t_Semicolon { $$=$1+"="+$3; }
1114

1115 1116 1117 1118 1119 1120 1121 1122
unconstrained_array_definition: t_ARRAY t_LeftParen
                                index_subtype_definition unconstrained_array_definition_1 t_RightParen t_OF
                                subtype_indic
    {
      QCString sr1=" array ( "+$3+" "+$4;
      QCString sr2=" ) of "+$7;
      $$=sr1+sr2;
    }
1123

1124
unconstrained_array_definition_1: { $$=""; }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1125 1126
unconstrained_array_definition_1: unconstrained_array_definition_1 unconstrained_array_definition_2 { $$=$1+"  "+$2; }
unconstrained_array_definition_2: t_Comma index_subtype_definition { $$=", "+$2; }
1127

1128
index_subtype_definition: mark t_RANGE t_Box { $$=$1+" range<> "; }
1129

1130
constrained_array_definition: t_ARRAY index_constraint t_OF subtype_indic { $$=" array "+$2+" of "+$4; }
1131

1132 1133
record_type_simple_name:/*empty*/     { $$=""; }
                       | t_Identifier { $$=$1; }
1134

1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145
record_type_definition: t_RECORD element_decl record_type_definition_1 t_END
                        t_RECORD record_type_simple_name
    {
      QRegExp reg("[\\s]");
      QCString oo=$2+" "+$3;
      current->spec=VhdlDocGen::RECORD;
      current->args=oo;
      current->args.replace(reg,"%");
      current->args.prepend("record");
      $$=$2+" "+$3;
    }
1146

1147 1148 1149 1150
record_type_definition_1: /*empty*/ { $$=""; }
record_type_definition_1: record_type_definition_1 record_type_definition_2
    {
      $$=$1+" "+$2;
1151
    }
1152
record_type_definition_2: element_decl { $$=$1; }
1153

1154
element_decl: idf_list t_Colon subtype_indic t_Semicolon { $$=$1+":"+$3+"#"; }
1155

1156
access_type_definition: t_ACCESS subtype_indic { $$="access "+$2; }
1157

1158
file_type_definition: t_FILE t_OF mark  { $$="file of "+$3; }
1159 1160 1161 1162 1163

/*--------------------------------------------------
--  Subtypes and Constraints
----------------------------------------------------*/

1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180
subtype_decl: t_SUBTYPE t_Identifier t_IS subtype_indic t_Semicolon
    {
      addVhdlType($2,getParsedLine(t_SUBTYPE),Entry::VARIABLE_SEC,VhdlDocGen::SUBTYPE,0,$4.data());
    }
subtype_decl:     t_SUBTYPE error  t_Semicolon  { $$=""; }
subtype_indic:    mark subtype_indic_1          { $$=$1+" "+$2; }
subtype_indic:    subtype_indic1                { $$=$1; }
subtype_indic_1:  /* empty */                   { $$=""; }
subtype_indic_1:  gen_association_list          { $$=$1; }

subtype_indic1:   mark mark range_constraint    { $$=$1+" "+$2+" "+$3; }
subtype_indic1:   mark range_constraint         { $$=$1+" "+$2; }
subtype_indic1:   mark mark subtype_indic1_1    { $$=$1+" "+$2+" "+$3; }
subtype_indic1_1:  /* empty */                  { $$=""; }
subtype_indic1_1: gen_association_list          { $$=$1; }

range_constraint: t_RANGE range_spec            { $$="range "+$2; }
1181 1182
//range_constraint        : array_constraint

1183 1184 1185 1186 1187 1188 1189
index_constraint: t_LeftParen discrete_range
                  index_constraint_1
                  t_RightParen                  { $$="("+$2+" "+$3+")"; }
index_constraint_1:  /* empty */                { $$=""; }
index_constraint_1: index_constraint_1
                    index_constraint_2          { $$=$1+" "+$2; }
index_constraint_2: t_Comma discrete_range      { $$=","+$2; }
1190

1191 1192
discrete_range: subtype_indic                   { $$=$1; }
discrete_range: range_spec                      { $$=$1; }
1193

1194 1195
discrete_range1 : subtype_indic1                { $$=$1; }
discrete_range1 : expr direction expr           { $$=$1+"  "+$2+"  "+$3; }
1196

1197 1198
range_spec  : attribute_name                    { $$=$1; }
range_spec  : simple_exp direction simple_exp   { $$=$1+"  "+$2+"  "+$3; }
1199

1200 1201
direction  : t_TO     { $$=" to "; }
direction  : t_DOWNTO { $$=" downto "; }
1202 1203 1204 1205 1206

/*--------------------------------------------------
--  Objects, Aliases, Files, Disconnections
----------------------------------------------------*/

1207 1208 1209 1210 1211
constant_decl: t_CONSTANT idf_list t_Colon subtype_indic constant_decl_1 t_Semicolon
                                  {
                                    QCString it=$4+" "+$5;
                                    //  fprintf(stderr,"\n currP %d \n",currP);
                                    addVhdlType($2,getParsedLine(t_CONSTANT),Entry::VARIABLE_SEC,VhdlDocGen::CONSTANT,0,it.data());
1212 1213 1214
                                    $$="constant "+$2;
                                    $$+=": ";
                                    $$+=it+";";
1215 1216 1217
                                  }
constant_decl_1:  /* empty */     { $$="";      }
constant_decl_1: t_VarAsgn expr   { $$=":="+$2; }
1218

1219 1220 1221 1222 1223 1224 1225 1226 1227
signal_decl: t_SIGNAL idf_list t_Colon subtype_indic signal_decl_1 signal_decl_2 t_Semicolon
                                  {
                                    QCString s=$4+" "+$6;
                                    addVhdlType($2,getParsedLine(t_SIGNAL),Entry::VARIABLE_SEC,VhdlDocGen::SIGNAL,0,s.data());
                                  }
signal_decl_2:  /* empty */       { $$=""; }
signal_decl_2: t_VarAsgn expr     { $$=":="+$2; }
signal_decl_1:  /* empty */       { $$=""; }
signal_decl_1: signal_kind        { $$=$1; }
1228

1229 1230
variable_decl: t_VARIABLE idf_list t_Colon subtype_indic variable_decl_1 t_Semicolon
                                  {
1231 1232
                                    $$=$2+":"+$4+" "+$5+";";
                                    $$.prepend("variable: ");
1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247
                                  }
variable_decl: t_SHARED t_VARIABLE idf_list t_Colon subtype_indic variable_decl_1 t_Semicolon
                                  {
                                    $$=$5+" "+$6;
                                    addVhdlType($3,getParsedLine(t_VARIABLE),Entry::VARIABLE_SEC,VhdlDocGen::SHAREDVARIABLE,0,$$.data());
                                  }
variable_decl_1:  /* empty */     { $$=""; }
variable_decl_1: t_VarAsgn expr   { $$=":="+$2; }

object_class: t_CONSTANT          { $$="constant"; }
object_class: t_SIGNAL            { $$="signal"; }
object_class: t_VARIABLE          { $$="variable"; }
object_class: t_SHARED t_VARIABLE { $$="shared"; }
object_class: t_FILE              { $$="file"; }
object_class: t_TYPE              { $$="type"; }
1248

1249 1250
signal_kind: t_BUS                { $$="bus"; }
signal_kind: t_REGISTER           { $$="register"; }
1251

1252
alias_decl: t_ALIAS alias_name_stat alias_spec t_IS name signature t_Semicolon
1253
                                  {
1254 1255
                                    QCString s=$3+" is "+$5+$6;
                                    addVhdlType($2,getParsedLine(t_ALIAS),Entry::VARIABLE_SEC,VhdlDocGen::ALIAS,0,s.data());
1256 1257 1258
                                   $$="alias "+$2;
                                   $$+=": ";
                                   $$+=s+";";
1259 1260 1261 1262 1263 1264 1265
                                  }
alias_decl: t_ALIAS alias_name_stat alias_spec t_IS error t_Semicolon { $$=""; }

alias_name_stat: t_Identifier     { $$=$1; }
alias_name_stat: t_StringLit      { $$=$1; }

alias_spec :/*empty*/              { $$=""; }
1266
           | t_Colon subtype_indic { $$=$2; }
1267 1268 1269 1270 1271 1272
           ;

file_decl: t_FILE idf_list t_Colon subtype_indic t_IS file_decl_1 expr t_Semicolon
           {
             addVhdlType($2,getParsedLine(t_FILE),Entry::VARIABLE_SEC,VhdlDocGen::VFILE,0,$4.data());
           }
1273

1274 1275 1276 1277 1278
file_decl: t_FILE idf_list t_Colon t_Identifier fi_dec t_Semicolon
           {
             QCString s=$4+" "+$5;
             addVhdlType($2,getParsedLine(t_FILE),Entry::VARIABLE_SEC,VhdlDocGen::VFILE,0,s.data());
           }
1279

1280 1281
fi_dec: /*empty*/              { $$=""; }
      |  t_OPEN expr t_IS expr { $$="open "+$2+" is "+s_str.qstr; }
1282 1283


1284 1285
file_decl_1:  /* empty */   { $$=""; }
file_decl_1: mode           { $$=$1; }
1286

1287
disconnection_spec: t_DISCONNECT signal_list t_Colon mark t_AFTER expr t_Semicolon
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1288
                                      { $$="disconnect "+$2+":"+$4+" after "+$6; }
1289
                                      
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1290 1291 1292 1293 1294 1295
signal_list:   name signal_list_1 { $$=$1+$2; }
signal_list:   t_OTHERS   { $$="others"; }
signal_list:   t_ALL             { $$="all"; }
signal_list_1:  /* empty */  { $$=""; }
signal_list_1: signal_list_1 signal_list_2    { $$=$1+$2; }
signal_list_2: t_Comma name { $$=" , "+$2; }
1296 1297 1298 1299 1300

/*--------------------------------------------------
--  Attribute Declarations and Specifications
----------------------------------------------------*/

1301 1302 1303
attribute_decl: t_ATTRIBUTE t_Identifier t_Colon mark t_Semicolon
                {
                  addVhdlType($2,getParsedLine(t_ATTRIBUTE),Entry::VARIABLE_SEC,VhdlDocGen::ATTRIBUTE,0,$4.data());
1304
                 $$= "attribute "+$2+ " : "+$4;
1305 1306 1307 1308
                }

attribute_spec: t_ATTRIBUTE t_Identifier t_OF entity_spec t_IS expr t_Semicolon
                {
1309 1310 1311
                  QCString att=$4+" is "+$6;
                  addVhdlType($2,getParsedLine(t_ATTRIBUTE),Entry::VARIABLE_SEC,VhdlDocGen::ATTRIBUTE,0,att.data());
                  $$="attribute "+att+";";
1312 1313
                }

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1314
entity_spec : entity_name_list signature  t_Colon entity_class { $$=$1+$2+":"+$4; }	
1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331

entity_name_list:   designator entity_name_list_1         { $$=$1+" "+$2; }
entity_name_list:   t_OTHERS                              { $$="others";  }
entity_name_list:   t_ALL                                 { $$="all";     }
entity_name_list_1: /* empty */                           { $$="";        }
entity_name_list_1: entity_name_list_1 entity_name_list_2 { $$=$1+" "+$2; }
entity_name_list_2: t_Comma designator                    { $$=","+$2;    }

entity_class: t_ENTITY        { $$="entity";        }
entity_class: t_ARCHITECTURE  { $$="architecture";  }
entity_class: t_PACKAGE       { $$="package";       }
entity_class: t_CONFIGURATION { $$="configuration"; }
entity_class: t_COMPONENT     { $$="component";     }
entity_class: t_LABEL         { $$="label";         }
entity_class: t_TYPE          { $$="type";          }
entity_class: t_SUBTYPE       { $$="subtype";       }
entity_class: t_PROCEDURE     { $$="procedure";     }
1332
entity_class: t_FUNCTION      { $$="function";              }
1333 1334 1335 1336 1337 1338 1339 1340 1341
entity_class: t_SIGNAL        { $$="signal";        }
entity_class: t_VARIABLE      { $$="variable";      }
entity_class: t_CONSTANT      { $$="constant";      }
entity_class: t_GROUP         { $$="group";         }
entity_class: t_FILE          { $$="file";          }
entity_class: t_UNITS         { $$="units";         }
entity_class: t_LITERAL       { $$="literal";       }
entity_class: t_SEQUENCE      { $$="sequence";      }
entity_class: t_PROPERTY      { $$="property";      }
1342 1343 1344 1345 1346 1347


/*--------------------------------------------------
--  Schemes
--------------------------------------------------------------------------*/

1348
if_generation_scheme: if_scheme { $$=$1; }
1349

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1350 1351
if_scheme: t_IF expr t_GENERATE  generate_statement_body  if_scheme_1 if_scheme_2 { $$=""; }
if_scheme: t_IF lable expr t_GENERATE  generate_statement_body  if_scheme_1 if_scheme_2 { $$=""; }
1352

1353 1354 1355 1356 1357 1358 1359
if_scheme_2: /* empty */ { $$=""; }
if_scheme_2: t_ELSE t_GENERATE  generate_statement_body { $$="else generate "+$3; }
if_scheme_2: t_ELSE lable t_GENERATE  generate_statement_body { $$="else "+$2+" generate "+$4; }
if_scheme_1: /* empty */  { $$=""; }
if_scheme_1: if_scheme_1 if_scheme_3  { $$=$1+$2; }
if_scheme_3: t_ELSIF expr t_GENERATE generate_statement_body { $$="elsif "+$2+" generate "+$4; }
if_scheme_3: t_ELSIF lable expr t_GENERATE generate_statement_body  { $$="elsif "+$2+$3+" generate "+$5; }
1360

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1361
generation_scheme: for_scheme { $$=$1; }
1362

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1363 1364
iteration_scheme: for_scheme     { $$=$1; }
iteration_scheme: while_scheme { $$=$1; }
1365

1366 1367
for_scheme: t_FOR t_Identifier t_IN discrete_range 
  {
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1368 1369 1370 1371 1372 1373 1374 1375 1376 1377
    if (!lab.isEmpty())
    {
      $$=lab+" :for "+$2+" in "+$4;
    }
    else
    {
      $$=" for "+$2+" in "+$4;
    }
    FlowChart::addFlowChart(FlowChart::FOR_NO,0,$$,lab.data());
    lab.resize(0);
1378 1379
  }
for_scheme: t_FOR lable t_Identifier t_IN discrete_range 
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1380 1381 1382 1383 1384
  {
    $$=lab+" for "+$2+$3+" in "+$5;
    FlowChart::addFlowChart(FlowChart::FOR_NO,0,$$,lab.data());
    lab="";
  }
1385 1386

while_scheme: t_WHILE expr {
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1387 1388 1389 1390
                             $$=" while "+$2;
                             FlowChart::addFlowChart(FlowChart::WHILE_NO,0,$$,lab.data());
                             lab="";
                           }
1391 1392 1393 1394 1395

/*--------------------------------------------------
--  Concurrent Statements
----------------------------------------------------*/

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409
concurrent_stats:   concurrent_stats_1      { $$=$1; }
concurrent_stats_1: /* empty */             { $$=""; }
concurrent_stats_1: concurrent_stats_1 concurrent_stats_2 { $$=$1+$2; }
concurrent_stats_2: concurrent_stat         { $$=$1; }

concurrent_stat : block_stat                { $$=$1; }
                | concurrent_assertion_stat { $$=$1; }
                | concurrent_procedure_call { $$=$1; }
                | concurrent_signal_assign_stat { $$=$1; }
                | comp_inst_stat            {
                                              QCString li=$1;
                                              $$=$1;
                                            }
                | generate_stat             { $$=$1; }
1410
                | procs_stat                   
1411

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1412
block_stat: t_Identifier t_Colon t_BLOCK { pushLabel(genLabels,$1); } block_stat_0 block_stat_1 block_stat_2
1413
            block_stat_3 block_stat_4 t_BEGIN concurrent_stats t_END t_BLOCK block_stat_5
1414 1415 1416 1417 1418
            t_Semicolon 
            {
              $$=$1+":block"; //+$4+$5+$6+$7+$8+"begin "+$10+" block "+$13;
              genLabels=popLabel(genLabels);
            }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435
block_stat_5: /* empty */  { $$=""; }
block_stat_5: t_Identifier { $$=$1; }
block_stat_4: /* empty */  { $$=""; }
block_stat_4: block_stat_4 block_stat_6 { $$=$1+$2; }
block_stat_6: block_decltve_item { $$=$1; }
block_stat_3: /* empty */  { $$=""; }
block_stat_3: t_PORT interf_list t_Semicolon block_stat_7   { $$="port "+$2+";"+$4; }
//block_sta_7:  /* empty */ { $$=""; }
block_stat_7: t_PORT t_MAP association_list t_Semicolon     { $$="port map "+$3; }
block_stat_2: /* empty */  { $$=""; }
block_stat_2: t_GENERIC interf_list t_Semicolon block_stat_8 { $$="generic "+$2+";"+$4; }
block_stat_8: /* empty */  { $$=""; }
block_stat_8: t_GENERIC t_MAP association_list t_Semicolon  { $$="generic map "+$3; }
block_stat_1: /* empty */  { $$=""; }
block_stat_1: t_LeftParen expr t_RightParen  block_stat_0  { $$="("+$2+")"+$4; }
block_stat_0: /* empty */  { $$=""; }
block_stat_0: t_IS  { $$=" is "; }
1436

1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449
dot_name: t_Identifier                 { $$=$1; }
        | dot_name  t_Dot t_Identifier { $$=$1+"."+$3; }
        ;

mark_comp: dot_name  comp_1      { $$=$1+" "+$2; }
mark_comp: dot_name              { $$=$1; }

comp_1: t_LeftParen t_Identifier  t_RightParen  { $$="("+$2+")"; }

vcomp_stat: t_CONFIGURATION      { $$="configurtion";yyLineNr=s_str.iLine; }
vcomp_stat: t_ENTITY             { $$="entity";yyLineNr=s_str.iLine; }
vcomp_stat: t_COMPONENT          { $$="component";yyLineNr=s_str.iLine; }

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1450 1451 1452 1453 1454 1455 1456
comp_inst_stat: t_Identifier t_Colon name { yyLineNr=s_str.iLine; }     t_GENERIC t_MAP association_list comp_inst_stat_1 t_Semicolon
                               {
                                 addCompInst($1.lower().data(),$3.lower().data(),0,yyLineNr);$$="";
                               }
comp_inst_stat: t_Identifier t_Colon name { yyLineNr=s_str.iLine; }    t_PORT t_MAP association_list t_Semicolon
                               {
                                 addCompInst($1.lower().data(),$3.lower().data(),0,yyLineNr);$$="222";
1457 1458
                               }

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1459 1460 1461 1462 1463 1464 1465 1466 1467 1468
comp_inst_stat: t_Identifier t_Colon vcomp_stat  mark_comp t_PORT t_MAP association_list t_Semicolon
                               {
                                 addCompInst($1.lower().data(),$4.lower().data(),$3.data(),yyLineNr);$$="";
                               }
comp_inst_stat: t_Identifier t_Colon vcomp_stat mark_comp t_GENERIC t_MAP association_list comp_inst_stat_1 t_Semicolon
                               {
                                 addCompInst($1.lower().data(),$4.lower().data(),$3.lower().data(),yyLineNr);$$="";
                               }
comp_inst_stat_1:  /* empty                                       { $$=""; } */  
comp_inst_stat_1: t_PORT t_MAP association_list //    { $$="port map"+$3; }
1469

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1470 1471
concurrent_assertion_stat:  t_Identifier t_Colon  assertion_stat  { $$=$1+":"+$3; }
concurrent_assertion_stat:  assertion_stat              { $$=$1; }
1472

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1473 1474
concurrent_assertion_stat:  t_Identifier t_Colon  t_POSTPONED  assertion_stat { $$=$1+":"+"postponed "+$4; }
concurrent_assertion_stat:   t_POSTPONED assertion_stat { $$="postponed "+$2; }
1475

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1476 1477
concurrent_procedure_call: t_Identifier t_Colon procedure_call_stat { $$=$1+":"+$3; }
concurrent_procedure_call: procedure_call_stat { $$=$1; }
1478

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1479 1480
concurrent_procedure_call: t_Identifier t_Colon t_POSTPONED procedure_call_stat { $$=$1+":"+"postponed "+$4; }
concurrent_procedure_call: t_POSTPONED procedure_call_stat { $$="postponed "+$2; }
1481

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1482 1483
concurrent_signal_assign_stat: t_Identifier t_Colon condal_signal_assign { $$=$1+":"+$3; }
concurrent_signal_assign_stat: condal_signal_assign  { $$=$1; }
1484

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1485 1486
concurrent_signal_assign_stat: t_Identifier t_Colon  t_POSTPONED  condal_signal_assign { $$=$1+":"+"postponed "+$4; }
concurrent_signal_assign_stat: t_POSTPONED  condal_signal_assign { $$="postponed "+$2; }
1487

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1488 1489
concurrent_signal_assign_stat: t_Identifier t_Colon t_POSTPONED sel_signal_assign { $$=$1+":"+"postponed "+$4; }
concurrent_signal_assign_stat: t_POSTPONED sel_signal_assign { $$="postponed "+$2; }
1490

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1491 1492
concurrent_signal_assign_stat: t_Identifier t_Colon sel_signal_assign  { $$=$1+":"+$3; }
concurrent_signal_assign_stat: sel_signal_assign  { $$=$1; }
1493

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1494
condal_signal_assign: target t_LESym opts   condal_wavefrms t_Semicolon { $$=$1+"<="+$3+$4; }
1495

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1496 1497 1498
condal_wavefrms: wavefrm { $$=$1; }
condal_wavefrms: wavefrm t_WHEN expr  { $$=$1+" when "+$3; }
condal_wavefrms: wavefrm t_WHEN expr t_ELSE condal_wavefrms { $$=$1+" when "+$3+"else"+$5; }
1499

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1500 1501 1502 1503 1504
wavefrm:   wavefrm_element wavefrm_1 { $$=$1+$2; }
wavefrm:   t_UNAFFECTED { $$="unaffected"; }
wavefrm_1: /* empty */  { $$=""; }
wavefrm_1: wavefrm_1 wavefrm_2 { $$=$1+$2; }
wavefrm_2: t_Comma wavefrm_element { $$=","+$2; }
1505

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1506 1507 1508 1509 1510 1511
wavefrm_element:   expr wavefrm_element_1 { $$=$1+$2; }
wavefrm_element_1: /* empty */ { $$=""; }
wavefrm_element_1: t_AFTER expr { $$="after "+$2; }
wavefrm_element_1: t_NULL wavefrm_element_2 { $$=" null "+$2; }
wavefrm_element_1: t_NULL { $$=" null "; }
wavefrm_element_2: t_AFTER expr { $$="after "+$2; }
1512

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1513 1514
target: name { $$=$1; }
target: aggregate   { $$=$1; }
1515

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1516
opts: opts_1 opts_2   { $$=$1+$2; }
1517

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1518 1519 1520 1521
opts_2: /* empty */  { $$=""; }
opts_2: t_TRANSPORT  { $$="transport "; }
opts_2: t_REJECT expr t_INERTIAL  { $$="transport"+$2+" intertial "; }
opts_2: t_INERTIAL  { $$=" intertial "; }
1522

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1523 1524
opts_1: /* empty */ { $$=""; }
opts_1: t_GUARDED { $$=" guarded "; }
1525

1526
sel_signal_assign: t_WITH expr t_SELECT target t_LESym opts sel_wavefrms t_Semicolon 
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1527
 { $$="with "+$2+" select "+$4+"<="+$6+$7; }
1528
 
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1529 1530 1531 1532
sel_wavefrms:   sel_wavefrms_1 wavefrm t_WHEN choices  { $$=$1+$2; }
sel_wavefrms_1: /* empty */  { $$=""; }
sel_wavefrms_1: sel_wavefrms_1 sel_wavefrms_2 { $$=$1+$2; }
sel_wavefrms_2: wavefrm t_WHEN choices t_Comma { $$=$1+" when "+$3; }
1533

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1534 1535 1536
gen_stat1: /* empty */  { $$=""; }
        |  block_declarative_part  t_BEGIN { $$=$1+" begin "; }
        | t_BEGIN { $$="begin "; }
1537

1538 1539 1540 1541
 // problem with double end
 // end;
 // end generate;

1542
generate_statement_body:  gen_stat1 concurrent_stats
1543

1544
generate_stat : t_Identifier  t_Colon
1545
                { pushLabel(genLabels,$1); }
1546 1547
                generation_scheme t_GENERATE
                gen_stat1 concurrent_stats  opstat
1548

1549
// stems from VHDL 2008 generate_statement_body
1550 1551
opstat: end_stats t_END generate_stat_1 t_Semicolon { genLabels=popLabel(genLabels); }
opstat: t_END generate_stat_1 t_Semicolon           {genLabels=popLabel(genLabels); }
1552 1553

generate_stat: t_Identifier  t_Colon
1554
               { pushLabel(genLabels,$1); }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1555
               if_generation_scheme opstat //    t_END   generate_stat_1 t_Semicolon { genLabels=popLabel(genLabels); }
1556 1557 1558 1559 1560 1561
generate_stat: t_Identifier  t_Colon case_scheme

generate_stat_1: t_GENERATE              { $$=""; }
generate_stat_1: t_GENERATE t_Identifier { $$=$2; }

//end_stats :
1562 1563
end_stats: t_END t_Semicolon   { $$="end"; }
end_stats: t_END t_Identifier t_Semicolon   { $$="end "+$2; }
1564 1565

procs_stat: t_Identifier t_Colon procs_stat1
1566
         {  
1567
                 current->name=$1;
1568
                 tempEntry=current;
1569 1570
                 current->endBodyLine=s_str.yyLineNr;
                 newEntry();
1571
                 currName=$1;
1572 1573 1574 1575 1576 1577
               }

procs_stat: procs_stat1
               {
                 current->name=VhdlDocGen::getProcessNumber();
                 current->endBodyLine=s_str.yyLineNr;
1578
                 tempEntry=current;
1579 1580 1581 1582
                 newEntry();
               }

procs_stat1: procs_stat1_5
1583 1584 1585 1586 1587
               {  
               currP=VhdlDocGen::PROCESS; 
               current->startLine=s_str.yyLineNr;
               current->bodyLine=s_str.yyLineNr;
               }
1588 1589 1590 1591 1592 1593 1594 1595
               t_PROCESS procs_stat1_1 procs_stat1_2
               {
                 if ($5.data())
                  FlowChart::addFlowChart(FlowChart::VARIABLE_NO,$5.data(),0);
                FlowChart::addFlowChart(FlowChart::BEGIN_NO,"BEGIN",0);
               }
               t_BEGIN seq_stats t_END

1596
               procs_stat1_3 t_Semicolon
1597 1598 1599 1600 1601
               { 
                $5.stripPrefix($4.data());
                tempEntry=current;
                currP=0;
                createFunction(currName,VhdlDocGen::PROCESS,$4.data());
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1602
                createFlow();
1603
                currName="";
1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615
               }
procs_stat1: error t_END procs_stat1_3  t_Semicolon { currP=0; }

procs_stat1_3:  /* empty */
procs_stat1_3: procs_stat1_5  t_PROCESS  procs_stat1_6

procs_stat1_5:  /* empty */ { $$=""; }
procs_stat1_5: t_POSTPONED  { $$="postponed"; }

procs_stat1_6:  /* empty */ { $$=""; }
procs_stat1_6: t_Identifier { $$=$1; }

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1616 1617
procs_stat1_2:  /* empty */  { $$=""; }
procs_stat1_2:  t_IS { $$=""; }   
1618 1619
procs_stat1_2: procs_stat1_2 procs_stat1_4   { $$+=$2; }
procs_stat1_4: procs_decltve_item           { $$=$1; }
1620 1621 1622 1623 1624 1625 1626 1627
procs_stat1_1:  /* empty */                                    { $$=""; }
procs_stat1_1: t_LeftParen t_ALL t_RightParen                  { $$="all"; }
procs_stat1_1: t_LeftParen sensitivity_list t_RightParen       { $$=$2; }

sensitivity_list:   name sensitivity_list_1                    { $$=$1+" "+$2; }
sensitivity_list_1: /* empty */                                { $$=""; }
sensitivity_list_1: sensitivity_list_1 sensitivity_list_2      { $$=$1+" "+$2; }
sensitivity_list_2: t_Comma name                               { $$=","+$2; }
1628 1629 1630 1631 1632

/*--------------------------------------------------
--  Sequential Statements
----------------------------------------------------*/

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667
seq_stats: seq_stats_1               { $$=$1; }
seq_stats_1: /* empty */             { $$=""; }
seq_stats_1: seq_stats_1 seq_stats_2 { $$=$1+$2; }
seq_stats_2: seq_stat                { $$=$1; }
seq_stat: assertion_stat             { $$=$1;    FlowChart::addFlowChart(FlowChart::TEXT_NO,$$.data(),0); }
seq_stat: lable assertion_stat       { $$=$1+$2; FlowChart::addFlowChart(FlowChart::TEXT_NO,$$.data(),0); }
seq_stat: case_stat                  { $$=$1; }
seq_stat: exit_stat                  { $$=$1; }
seq_stat: if_stat                    { $$=""; } 
seq_stat: loop_stat                  { $$=$1; }
seq_stat: next_stat                  { $$=$1; }
seq_stat: null_stat                  { $$=$1; FlowChart::addFlowChart(FlowChart::TEXT_NO,$$.data(),0); }
seq_stat: procedure_call_stat        { $$=$1; FlowChart::addFlowChart(FlowChart::TEXT_NO,$$.data(),0); } 
seq_stat: return_stat                { $$=$1; FlowChart::addFlowChart(FlowChart::RETURN_NO,$$.data(),0); }
seq_stat: lable signal_assign_stat   { $$=$1+$2; }
seq_stat: signal_assign_stat         { $$=$1; FlowChart::addFlowChart(FlowChart::TEXT_NO,$$.data(),0); }
seq_stat: variable_assign_stat       { $$=$1; FlowChart::addFlowChart(FlowChart::TEXT_NO,$$.data(),0); }
seq_stat: wait_stat                  { $$=$1; FlowChart::addFlowChart(FlowChart::TEXT_NO,$$.data(),0); }
seq_stat: lable wait_stat            { $$=$1+$2; FlowChart::addFlowChart(FlowChart::TEXT_NO,$$.data(),0); }
seq_stat: report_statement           { $$=$1; FlowChart::addFlowChart(FlowChart::TEXT_NO,$$.data(),0); }

report_statement: loop_stat_1 t_REPORT expr assertion_stat_2  t_Semicolon { $$=$1+"report "+$3+$4+";";  }

assertion_stat: t_ASSERT expr assertion_stat_1 assertion_stat_2 t_Semicolon  { $$="assert "+$2+$3+$4+";"; }
assertion_stat_2:  /* empty */                    { $$=""; }
assertion_stat_2     : t_SEVERITY expr  { $$=" serverity "+$2; } 
assertion_stat_1     :  /* empty */            { $$=""; }
assertion_stat_1     : t_REPORT expr  { $$=" report "+$2; }

choice_stat :  /* empty */ { $$=""; }
choice_stat :  t_Q            { $$="?"; }

choice_stat_1:  /* empty */   { $$=""; }
choice_stat_1 :                  t_Q     { $$="?"; }
choice_stat_1 : t_Identifier  { $$=$1; }
1668 1669 1670 1671 1672


case_stat  : t_CASE choice_stat expr 
                   {
                     QCString ca="case "+$2+$3;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1673
                     FlowChart::addFlowChart(FlowChart::CASE_NO,0,ca);
1674
                   }                 
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1675 1676 1677 1678 1679
                   t_IS case_stat_alternative case_stat_1 t_END t_CASE choice_stat_1  t_Semicolon
                   { 
                     FlowChart::moveToPrevLevel();
                     FlowChart::addFlowChart(FlowChart::END_CASE,"end case",0);
                   }
1680
          
1681

1682 1683
case_stat  : lable t_CASE choice_stat expr
                   {
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1684 1685
                     QCString ca="case "+$3+$4;
                     FlowChart::addFlowChart(FlowChart::CASE_NO,0,ca);
1686
                   } 
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1687 1688 1689
                   t_IS case_stat_alternative case_stat_1 t_END t_CASE choice_stat_1  t_Semicolon
                   {
                     FlowChart::moveToPrevLevel();
1690 1691
             
                     FlowChart::addFlowChart(FlowChart::END_CASE,0,0);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1692
                   }
1693

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1694 1695 1696 1697
case_stat       : t_CASE error t_END t_CASE choice_stat_1  t_Semicolon  { $$=""; }
case_stat_1     :  /* empty */             { $$=""; }
case_stat_1     : case_stat_1 case_stat_2  { $$=$1+$2; }
case_stat_2     : case_stat_alternative    { $$=$1; }
1698
case_stat_alternative     : t_WHEN choices t_Arrow
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1699 1700 1701
  { 
    QCString t="when ";
    t+=$2+"=> ";
1702
    FlowChart::addFlowChart(FlowChart::WHEN_NO,$2.data(),t);
1703
  }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1704
  seq_stats { $$=""; FlowChart::moveToPrevLevel(); }
1705

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1706
if_stat: t_IF expr t_THEN
1707
  {
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1708 1709
    $2.prepend("if ");
    FlowChart::addFlowChart(FlowChart::IF_NO,0,$2);
1710 1711 1712 1713 1714
  }  
  seq_stats   
 
  if_stat_1 if_stat_2 t_END t_IF t_Semicolon 
  {
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1715 1716
    FlowChart::moveToPrevLevel();
    FlowChart::addFlowChart(FlowChart::ENDIF_NO,0,0);
1717 1718
  } 
     
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1719
if_stat_2  :  /* empty */             { $$=""; }
1720
if_stat_2  : t_ELSE    
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1721 1722 1723
  {
    FlowChart::addFlowChart(FlowChart::ELSE_NO,0,0);
  } 
1724 1725 1726
  seq_stats   { $$=""; }

 
1727 1728
 

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1729 1730
if_stat_1  :  /* empty */             { $$=""; }
if_stat_1  : if_stat_1 if_stat_3      { $$=$1+$2; }
1731 1732
if_stat_3  : t_ELSIF expr t_THEN 
  { 
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1733 1734 1735
    $2.prepend("elsif ");
    FlowChart::addFlowChart(FlowChart::ELSIF_NO,0,$2.data());
  } seq_stats { $$=""; }
1736 1737
  
loop_stat:   loop_stat_1 loop_stat_2 t_LOOP seq_stats t_END t_LOOP loop_stat_3 t_Semicolon
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1738 1739 1740 1741 1742 1743
  {
    $$=$1+$2+" loop "+$4+" end loop" +$7;
    QCString endLoop="end loop" + $7;
    FlowChart::moveToPrevLevel();
    FlowChart::addFlowChart(FlowChart::END_LOOP,endLoop.data(),0);
  }
1744

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1745 1746 1747 1748 1749
loop_stat_3: /* empty */ { $$=""; }
loop_stat_3: t_Identifier { $$=$1; }
loop_stat_2: /* empty */ { $$=""; 
                           FlowChart::addFlowChart(FlowChart::LOOP_NO,0,"infinite loop");
                         }
1750
loop_stat_2: iteration_scheme
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1751 1752
loop_stat_1: /* empty */ { $$=""; }
loop_stat_1: t_Identifier t_Colon { $$=$1+":";lab=$1; }
1753 1754 1755

exit_stat  : loop_stat_1 t_EXIT exit_stat_1 exit_stat_2 t_Semicolon   
                       {
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1756 1757 1758 1759 1760 1761 1762
                         FlowChart::addFlowChart(FlowChart::EXIT_NO,"exit",$4.data(),$3.data()); 
                         lab.resize(0);
                       }
exit_stat_2     :  /* empty */    { $$=""; }
exit_stat_2     : t_WHEN expr     { $$="when "+$2; }
exit_stat_1     :  /* empty */    { $$=""; }
exit_stat_1     : t_Identifier    { $$=$1;lab=$$; }
1763

1764 1765

next_stat: loop_stat_1  t_NEXT next_stat_1 next_stat_2 t_Semicolon
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1766 1767 1768 1769
                       {
                         FlowChart::addFlowChart(FlowChart::NEXT_NO,"next ",$4.data(),$3.data()); 
                         lab.resize(0);
                       }
1770
                    
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1771 1772 1773 1774
next_stat_2:  /* empty */      { $$=""; }
next_stat_2: t_WHEN expr { $$="when "+$2; }
next_stat_1:  /* empty */      { $$=""; }
next_stat_1: t_Identifier      { $$=$1;lab=$$; }
1775

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1776
null_stat: t_NULL t_Semicolon { $$="null"; $$+=";"; }
1777 1778 1779

procedure_call_stat: name t_Semicolon 
 {
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1780
   $$=$1+";"; 
1781 1782
 }

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1783 1784 1785
return_stat:   t_RETURN return_stat_1 t_Semicolon { $$="return "+$2+";"  ; }
return_stat_1: /* empty */  { $$=""; }
return_stat_1:   expr { $$=$1; }
1786

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1787 1788 1789 1790 1791 1792
signal_assign_stat: target t_LESym wavefrm t_Semicolon                   { $$=$1+" <="+$3+";"  ; }
                  | target t_LESym delay_mechanism wavefrm t_Semicolon   { $$=$1+ "<= "+$3+$4 +";"; }
                  | target t_LESym t_FORCE inout_stat  expr t_Semicolon  { $$=$1+ "<= "+ " force  "+$4+";" ; }
                  | target t_LESym t_RELEASE inout_stat t_Semicolon      { $$=$1+ "<= "+" release "+$4 +";"; }
                  | selected_signal_assignment                           { $$=$1; }
                  | conditional_signal_assignment                        { $$=$1; }
1793 1794
                  ;

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1795 1796 1797 1798
variable_assign_stat: variable_assign_stat_1 t_Semicolon                 { $$=$1+";"; }
                    | conditional_variable_assignment                    { $$=$1; }
                    | lable selected_variable_assignment                 { $$=$1; }
                    | selected_variable_assignment                       { $$=$1; }
1799

1800
lable: t_Identifier t_Colon                                              { $$=$1+":"; }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1801 1802
variable_assign_stat_1: target t_VarAsgn expr                            { $$=$1+":="+$3; }
variable_assign_stat_1: lable target t_VarAsgn expr                      { $$=$1+$2+":="+$4; }
1803 1804

wait_stat:   t_WAIT wait_stat_1 wait_stat_2 wait_stat_3 t_Semicolon
1805 1806 1807 1808
                  {
                     $$="wait "+$2+$3+$4+";";
                  }

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1809 1810 1811 1812 1813 1814
wait_stat_3: /* empty */            { $$=""; }
wait_stat_3: t_FOR expr             { $$="for "+$2; } 
wait_stat_2: /* empty */            { $$=""; }
wait_stat_2: t_UNTIL expr           { $$=" until "+$2; }
wait_stat_1: /* empty */            { $$=""; }
wait_stat_1: t_ON sensitivity_list  { $$=" on "+$2; }
1815 1816 1817 1818 1819


/*--------------------------------------------------
--  Components and Configurations
----------------------------------------------------*/
1820 1821 1822
comp_end_dec : t_END                              { lastEntity=0; lastCompound=0; genLabels.resize(0); }
             | t_END t_COMPONENT entity_decl_5
             | t_END t_ARCHITECTURE entity_decl_5 { lastCompound=0; genLabels.resize(0); }
1823
             | t_END t_ENTITY entity_decl_5       { lastEntity=0;lastCompound=0; genLabels.resize(0); }
1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838
             | t_END t_Identifier                 { lastEntity=0; lastCompound=0; genLabels.resize(0); }

iss :/*empty*/ { currP=VhdlDocGen::COMPONENT; }
    |  t_IS    { currP=VhdlDocGen::COMPONENT; }

comp_decl: t_COMPONENT t_Identifier iss comp_decl_1 comp_decl_2 comp_end_dec  t_Semicolon
           {
             addVhdlType($2,getParsedLine(t_COMPONENT),Entry::VARIABLE_SEC,VhdlDocGen::COMPONENT,0,0);
             currP=0;
           }
comp_decl_2:  /* empty */                      { $$=""; }
comp_decl_2: t_PORT interf_list t_Semicolon    { $$=$2; }
comp_decl_1:  /* empty */                      { $$=""; }
comp_decl_1: t_GENERIC interf_list t_Semicolon { $$=$2; }

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1839
block_config: t_FOR block_spec block_config_1 block_config_2 { levelCounter--; }  t_END t_FOR t_Semicolon
1840 1841
          {
          }
1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857

block_config:   t_FOR error t_END t_FOR t_Semicolon { $$=""; }
block_config_2: /* empty */                         { $$=""; }
block_config_2: block_config_2 block_config_3       { $$=$1+"  "; }
block_config_3: config_item                         { $$=$1; }
block_config_1: /* empty */                         { $$=""; }
block_config_1: block_config_1 block_config_4       { $$=$1; }
block_config_4: use_clause                          { $$=$1; }

block_spec: name
    {
      $$=$1;
      if (levelCounter==0)
        addConfigureNode($1.data(),NULL,TRUE,FALSE);
      else
        addConfigureNode($1.data(),NULL,FALSE,FALSE);
1858
        levelCounter++;
1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871
    }

config_item: block_config { $$=$1; }
config_item: comp_config  { $$=$1; }

comp_config: t_FOR comp_spec comp_config_1 comp_config_2 t_END t_FOR t_Semicolon
             {
               $$=$2+" "+$3+" "+$4;
             }
comp_config_2:  /* empty */   { $$=""; }
comp_config_2: block_config   { $$=$1; }
comp_config_1:  /*empty*/     { $$=""; }

1872 1873 1874 1875
comp_config_1: binding_indic_1  binding_indic_2  t_Semicolon  
{ 
  $$=""; 
}
1876 1877 1878
comp_config_1: t_USE t_VUNIT idf_list  t_Semicolon             { $$=""; }
comp_config_1: t_USE binding_indic t_Semicolon
             {
1879
               addConfigureNode(compSpec.data(),$2.data(),FALSE,TRUE);
1880 1881 1882 1883
             }

config_spec: t_FOR comp_spec comp_spec_stat t_Semicolon                         
             { 
1884
               addConfigureNode($2.data(),$3.data(),TRUE,FALSE,TRUE);
1885 1886 1887
             }
config_spec: t_FOR comp_spec comp_spec_stat t_Semicolon t_END t_FOR t_Semicolon 
             { 
1888 1889
               addConfigureNode($2.data(),$3.data(),TRUE,FALSE,TRUE);
              }
1890

1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901
comp_spec_stat: t_USE  binding_indic               { 
                                                     $$=$2;
                                                   }
comp_spec_stat: t_USE t_VUNIT idf_list t_Semicolon 
{ 
  $$="";
}
comp_spec_stat: binding_indic_1  binding_indic_2   
                          { 
                          $$="";
                           }
1902 1903 1904

comp_spec: inst_list t_Colon expr
             {
1905
               $$=$1+":"+$3;
1906 1907
               compSpec=$$;
             }
1908

1909 1910 1911
inst_list: idf_list  { $$=$1; }
inst_list: t_ALL     { $$="all"; }
inst_list: t_OTHERS  { $$="others"; }
1912

1913
binding_indic   : entity_aspect binding_indic_1 binding_indic_2 { $$=$1; }
1914

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1915 1916
binding_indic_2: { $$=""; }
binding_indic_2: t_PORT t_MAP association_list  { $$="port map "+$3; }
1917

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1918 1919
binding_indic_1: { $$=""; }
binding_indic_1: t_GENERIC t_MAP association_list { $$="generic map "+$3; }
1920 1921


1922 1923 1924 1925
entity_aspect: t_ENTITY name { $$="entity "+$2; }
entity_aspect: t_CONFIGURATION mark { $$="configuration "+ $2; }
entity_aspect: t_OPEN { $$="open "; }
             ;
1926

1927 1928 1929
group_constituent: t_Identifier    { $$=$1; }
                 | t_CharacterLit { $$=$1; }
                 ;
1930

1931 1932 1933
group_constituent_list: group_constituent                                { $$=$1; }
                      | group_constituent_list t_Comma group_constituent { $$=$1+","+$3; }
                      ;
1934

1935 1936 1937 1938 1939 1940
group_declaration : t_GROUP t_Identifier t_Colon group_name   t_LeftParen  group_constituent_list  t_RightParen t_Semicolon
                    {
                      // $$=$2+":"+$4+$6;
                      $$="("+$4+$6+")";
                      addVhdlType($2,getParsedLine(t_GROUP),Entry::VARIABLE_SEC,VhdlDocGen::GROUP,$$.data(),0);
                    }
1941

1942 1943 1944 1945 1946
group_template_declaration :  t_GROUP  t_Identifier t_IS  t_LeftParen  entity_class_entry_list  t_RightParen t_Semicolon
                    {
                      $$=$2+":"+$5;
                      addVhdlType($2,getParsedLine(t_GROUP),Entry::VARIABLE_SEC,VhdlDocGen::GROUP,$5.data(),0);
                    }
1947

1948 1949
group_template_declaration: t_GROUP  t_Identifier t_IS  t_LeftParen error t_Semicolon  t_RightParen{ $$=""; }
 
1950

Dimitri van Heesch's avatar
Dimitri van Heesch committed
1951
entity_class_entry : entity_class tbox { $$=$1+$2; }
1952

1953 1954
tbox :  /* empty */ { $$="";   }
tbox :  t_Box       { $$="<>"; }
1955

1956 1957 1958 1959
entity_class_entry_list: entity_class_entry         { $$=$1; }
                       | entity_class_entry_list
                         t_Comma entity_class_entry { $$=$1+","+$3; }
                       ;
1960

1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987
group_name: t_Identifier { $$=$1; }
group_name: t_StringLit  { $$=$1; }

t_Identifier: t_LETTER
    {
      $$=s_str.qstr;
    }

t_BitStringLit: t_DIGIT
    {
      $$=s_str.qstr;
    }

t_StringLit: t_STRING
    {
      $$=s_str.qstr;
    }

t_AbstractLit: t_ABSTRLIST
    {
      $$=s_str.qstr;
    }

t_CharacterLit: t_CHARLIST
    {
      $$=s_str.qstr;
    }
1988 1989 1990 1991 1992 1993


/*--------------------------------------------------
--  VHDL 2002 extensions
-- to do: must be added
-----------------------------------------------------*/
1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013
protected_type_declaration:t_PROTECTED protected_stats t_END protected_stat_1 { $$=""; }
protected_type_declaration:t_PROTECTED error  t_END protected_stat_1 { $$=""; }

protected_stats:       /* empty */
protected_stats:       protected_stats   protected_stat_decl_1
protected_stat_decl_1: protected_type_declaration_item
protected_stat_1:      t_PROTECTED
protected_stat_1:      t_PROTECTED t_Identifier

protected_type_declaration_item: use_clause
protected_type_declaration_item: attribute_spec
protected_type_declaration_item: subprog_decl
protected_type_declaration_item:  subprogram_instantiation_decl

protected_type_body: t_PROTECTED t_BODY protected_body_stats t_END protected_body_stat_1 { $$=""; }
protected_type_body: t_PROTECTED t_BODY error t_END protected_body_stat_1 { $$=""; }

protected_body_stats: /* empty */
protected_body_stats:  protected_body_stats   protected_body_stat_decl_1
protected_body_stat_decl_1: protected_type_body_declaration_item
2014 2015 2016 2017 2018 2019 2020 2021 2022 2023

protected_body_stat_1: t_PROTECTED t_BODY
protected_body_stat_1: t_PROTECTED t_BODY t_Identifier

protected_type_body_declaration_item: subprog_decltve_item // same as subprog

/*--------------------------------------------------
--  VHDL 2008 extensions
-- to do: must be added
-----------------------------------------------------*/
2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035
context_ref: t_CONTEXT  sel_list t_Semicolon { $$="context "+$2; }

context_decl: t_CONTEXT t_Identifier t_IS { parse_sec=CONTEXT_SEC; }  libustcont_stats t_END context_stat_1 t_Semicolon
                        {
                          parse_sec=0;
                          QCString v=$5;
                          addVhdlType($2,getParsedLine(t_LIBRARY),Entry::VARIABLE_SEC,VhdlDocGen::LIBRARY,"context",$5.data());
                        }
context_decl: t_CONTEXT t_Identifier t_IS  t_END context_stat_1 t_Semicolon
                        {
                          addVhdlType($2,getParsedLine(t_LIBRARY),Entry::VARIABLE_SEC,VhdlDocGen::LIBRARY,"context",0);
                        }
2036 2037 2038 2039

context_stat_1: t_CONTEXT
context_stat_1: t_CONTEXT t_Identifier

2040 2041
libustcont_stats: libustcont_stat                     { $$ = $1; }
libustcont_stats: libustcont_stats  libustcont_stat   { $$ = $1+"#"+$2; }
2042

2043 2044 2045
libustcont_stat: use_clause  { $$ = $1; }
libustcont_stat: lib_clause  { $$ = $1; }
libustcont_stat: context_ref { $$ = $1; }
2046

2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060
package_instantiation_decl: t_PACKAGE t_Identifier t_IS t_NEW dot_name signature t_Semicolon
    {
      $$=" is new "+$5+$6;
      //Entry * pp=lastCompound;
      //Entry * pps=lastEntity  ;
      //assert(false);
      addVhdlType($2,getParsedLine(t_PACKAGE),Entry::VARIABLE_SEC,VhdlDocGen::INSTANTIATION,"package",$$.data());
    }
package_instantiation_decl: t_PACKAGE t_Identifier t_IS t_NEW dot_name signature  gen_assoc_list t_Semicolon
    {
      $$=" is new "+$5+$6;
      addVhdlType($2,getParsedLine(t_PACKAGE),Entry::VARIABLE_SEC,VhdlDocGen::INSTANTIATION,"package",$$.data());
    }
package_instantiation_decl: t_PACKAGE error  t_Identifier t_IS t_NEW t_Semicolon  { $$=""; }
2061

2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072
subprogram_instantiation_decl: t_FUNCTION  t_Identifier t_IS   t_NEW dot_name  signature  t_Semicolon
    {
      $$= " is new "+$5+$6;
      addVhdlType($2,getParsedLine(t_FUNCTION),Entry::VARIABLE_SEC,VhdlDocGen::INSTANTIATION,"function ",$$.data());
    }
subprogram_instantiation_decl: t_FUNCTION  t_Identifier t_IS t_NEW dot_name  signature gen_assoc_list t_Semicolon
    {
      $$=" is new "+$5+$6;
      addVhdlType($2,getParsedLine(t_FUNCTION),Entry::VARIABLE_SEC,VhdlDocGen::INSTANTIATION,"function ",$$.data());
    }
subprogram_instantiation_decl: t_FUNCTION   t_Identifier t_IS   t_NEW error t_Semicolon { $$=""; }
2073

2074 2075 2076 2077
signature:/*empty*/                  { $$=""; }
signature: t_LEFTBR signature1 
           t_RIGHTBR                 { $$="["+$2+" ]"; }
signature: t_LEFTBR t_RIGHTBR        { $$="[ ]"; }
2078

2079 2080 2081
signature1: t_RETURN mark            { $$="return "+$2; }
signature1: mark_stats               { $$=$1; }
signature1: mark_stats t_RETURN mark { $$=$1+" return "+$3; }
2082

2083 2084 2085
mark_stats: mark                     { $$=$1; }
mark_stats: mark_stats mark_stats_1  { $$=$1+" "+$2; }
mark_stats_1: t_Comma mark           { $$=" , "+$2; }
2086

2087 2088 2089
case_scheme:  t_CASE expr   t_GENERATE when_stats ttend  t_END t_GENERATE generate_stat_1  t_Semicolon
case_scheme:  t_CASE expr   t_GENERATE when_stats        t_END t_GENERATE generate_stat_1  t_Semicolon
case_scheme:  t_CASE error  t_GENERATE error             t_END t_GENERATE generate_stat_1  t_Semicolon
2090

2091 2092 2093 2094
when_stats_1: t_WHEN lable choices t_Arrow generate_statement_body
when_stats_1: t_WHEN choices t_Arrow generate_statement_body
when_stats:   when_stats  when_stats_1
when_stats:   when_stats_1
2095

2096 2097
ttend: t_END t_Semicolon
ttend: t_END t_Identifier t_Semicolon
2098

Dimitri van Heesch's avatar
Dimitri van Heesch committed
2099 2100
conditional_signal_assignment: conditional_waveform_assignment { $$=""; }
conditional_signal_assignment: conditional_force_assignment { $$=""; }
2101 2102 2103 2104 2105 2106

conditional_waveform_assignment: target t_LESym wavefrm_element t_WHEN expr else_wave_list t_Semicolon
conditional_waveform_assignment: target t_LESym delay_mechanism wavefrm_element t_WHEN expr else_wave_list t_Semicolon
conditional_waveform_assignment: target t_LESym wavefrm_element t_WHEN expr t_Semicolon
conditional_waveform_assignment: target t_LESym delay_mechanism wavefrm_element t_WHEN expr t_Semicolon
conditional_waveform_assignment: target t_LESym error t_Semicolon
2107 2108 2109 2110

else_wave_list: t_ELSE expr t_WHEN expr
else_wave_list: t_ELSE expr

2111 2112
conditional_force_assignment:  target t_LESym t_FORCE  inout_stat expr t_WHEN expr else_stat t_Semicolon
conditional_force_assignment:  target t_LESym t_FORCE  inout_stat expr t_WHEN expr t_Semicolon
2113

Dimitri van Heesch's avatar
Dimitri van Heesch committed
2114 2115
selected_signal_assignment : selected_waveform_assignment { $$=""; }
selected_signal_assignment : selected_force_assignment { $$=""; }
2116

2117 2118 2119 2120 2121
selected_waveform_assignment: t_WITH expr t_SELECT choice_stat
                              target t_LESym delay_stat sel_wave_list

delay_stat:
delay_stat: delay_mechanism
2122

2123 2124
sel_wave_list: wavefrm_element t_WHEN choices t_Comma  sel_wave_list
sel_wave_list: sel_wave_list_1
2125

2126
sel_wave_list_1: wavefrm_element  t_WHEN choices t_Semicolon
2127

2128 2129
selected_force_assignment: t_WITH expr t_SELECT choice_stat target t_LESym t_FORCE
                                                  inout_stat sel_var_list
2130

Dimitri van Heesch's avatar
Dimitri van Heesch committed
2131 2132 2133
inout_stat: /* empty */ { $$=""; }
inout_stat: t_IN   { $$=" in "; }
inout_stat: t_OUT { $$="out"; }
2134

Dimitri van Heesch's avatar
Dimitri van Heesch committed
2135 2136 2137
delay_mechanism : t_TRANSPORT { $$=" transport "; }
                | t_REJECT expr t_INERTIAL { $$=" reject "+$2+"inertial "; }
                |  t_INERTIAL { $$=" inertial "; }
2138 2139 2140 2141 2142 2143 2144 2145

conditional_variable_assignment : variable_assign_stat_1 t_WHEN expr else_stat t_Semicolon
conditional_variable_assignment : variable_assign_stat_1 t_WHEN expr t_Semicolon

else_stat: t_ELSE expr t_WHEN expr
else_stat: else_stat t_ELSE expr t_WHEN expr
else_stat: t_ELSE expr

Dimitri van Heesch's avatar
Dimitri van Heesch committed
2146
selected_variable_assignment: t_WITH expr t_SELECT choice_stat select_name t_VarAsgn sel_var_list { $$=""; }
2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221

sel_var_list: expr t_WHEN choices t_Comma  sel_var_list
sel_var_list: sel_var_list_1

sel_var_list_1: expr t_WHEN choices t_Semicolon

select_name: name
           | aggregate

interface_subprogram_decl: iproc { $$ = $1; }
                         | ifunc { $$=$1; }
                         ;
iproc: t_PROCEDURE t_Identifier param { $$ = "procedure "+$2+$3; current->name=$2; }

ifunc: t_FUNCTION   func_name param   t_RETURN mark return_is
    {
      QCString s=$6;
      if (!s.isEmpty())
      {
        s.prepend(" is ");
      }
      $$=" function "+$2+$3+$5+s;
      current->name=$2;
    }
ifunc: func_prec t_FUNCTION  func_name param t_RETURN mark return_is
    {
      QCString s=$7;
      if (!s.isEmpty())
      {
        s.prepend(" is ");
      }
      $$=$1+" function "+$3+$4+" return "+$6+s;
      current->name=$3;
    }

func_name: t_Identifier   { $$=$1; }
         | t_StringLit    { $$=$1; }  // "?<"
         ;

return_is:  /* empty */       { $$="";   }
         | t_IS  t_Identifier { $$=$2;   }
         | t_IS t_Box         { $$="<>"; }

param: /* empty */ { $$=""; }
param: t_PARAMETER { $$="parameter "; }
param: t_PARAMETER { parse_sec=PARAM_SEC; }
                   t_LeftParen interf_element interf_list_1 t_RightParen
                   { parse_sec=0; }

param: t_LeftParen  interf_element interf_list_1 t_RightParen { $$="("+$2+")"; }

interface_package_decl: t_PACKAGE t_Identifier t_IS t_NEW dot_name
                        {
                          $$="package "+$2+" is new "+$5;
                          current->name=$2;
                        }
interface_package_decl: t_PACKAGE t_Identifier t_IS t_NEW dot_name gen_assoc_list 
                        { 
                          $$="package "+$2+" is new "+$5+"( ... )" ; 
                          current->name=$2; 
                        }

gen_assoc_list:         t_GENERIC t_MAP   association_list

gen_interface_list :    t_GENERIC
                        {
                          //int u=s_str.iLine;
                          parse_sec=GEN_SEC;
                        }
                        interf_list
                        {
                          QCString vo=$3;
                          parse_sec=0;
                        }

2222
external_name: t_SLSL sig_stat external_pathname t_Colon  subtype_indic  t_SRSR
2223 2224 2225 2226 2227 2228 2229 2230 2231
                        {
                          QCString s="<<"+$2;
                          QCString s1=$3+":"+$5+">>";
                          $$=s+s1;
                        }

sig_stat:  t_CONSTANT   { $$="constant "; }
sig_stat:  t_SIGNAL     { $$="signal ";   }
sig_stat:  t_VARIABLE   { $$="variable "; }
2232

2233 2234 2235 2236
external_pathname: absolute_pathname  { $$=$1; }
                 | relative_pathname  { $$=$1; }
                 | package_path_name  { $$=$1; }
                 ;
2237

2238 2239
absolute_pathname:  t_Dot  pathname_element_list t_Identifier  { $$="."+$2+$3; }
absolute_pathname:  t_Dot  t_Identifier  { $$="."+$2; }
2240

2241 2242
relative_pathname: neg_list pathname_element_list t_Identifier { $$=$1+$2+$3; }
relative_pathname: neg_list t_Identifier { $$=$1+$2; }
2243

2244 2245
neg_list:  t_Neg t_Dot          { $$="^."; }
neg_list: neg_list  t_Neg t_Dot { $$=$1+"^."; }
2246

2247 2248 2249
pathname_element: t_Identifier  { $$=$1; }
                | t_Identifier t_LeftParen expr  t_RightParen  { $$=$1+"("+$3+")"; }
                ;
2250

2251 2252 2253 2254 2255 2256
pathname_element_list: pathname_element t_Dot     { $$=$1+"."; }
                     | pathname_element_list pathname_element t_Dot   { $$=$1+$2+"."; }

package_path_name: t_At dot_name { $$="@"+$2; }

tool_directive: t_ToolDir
2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267
{
// fprintf(stderr,"\n  tooldir %s",s_str.qstr.data() );
}


%%
extern FILE* yyout;
extern YYSTYPE vhdlScanYYlval;

void vhdlScanYYerror(const char* /*str*/)
{
2268 2269
  // fprintf(stderr,"\n<---error at line %d  : [ %s]   in file : %s ---->",s_str.yyLineNr,s_str.qstr.data(),s_str.fileName);
  //  exit(0);
2270 2271
}

Dimitri van Heesch's avatar
Dimitri van Heesch committed
2272
void vhdlParse()
2273
{
2274
  vhdlScanYYparse();
2275
}
2276

2277
struct VhdlContainer*  getVhdlCont()
2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288
{
  return &s_str;
}

Entry* getVhdlCompound()
{
  if (lastEntity) return lastEntity;
  if (lastCompound) return lastCompound;
  return NULL;
}

Dimitri van Heesch's avatar
Dimitri van Heesch committed
2289
QList<VhdlConfNode>& getVhdlConfiguration() { return  configL; }
2290

2291 2292 2293
static void addCompInst(char *n, char* instName, char* comp,int iLine)
{

2294
  current->spec=VhdlDocGen::INSTANTIATION;
2295 2296 2297
  current->section=Entry::VARIABLE_SEC;
  current->startLine=iLine;
  current->bodyLine=iLine;
2298
  current->type=instName;                       // foo:instname e.g proto or work. proto(ttt)
2299
  current->exception=genLabels.lower();         // |arch|label1:label2...
2300
  current->name=n;                              // foo
2301
  current->args=lastCompound->name;             // architecture name
2302
  current->includeName=comp;                    // component/enity/configuration
2303 2304 2305 2306 2307 2308 2309
  int u=genLabels.find("|",1);
  if (u>0)
  {
    current->write=genLabels.right(genLabels.length()-u);
    current->read=genLabels.left(u);
  }
  //printf  (" \n genlable: [%s]  inst: [%s]  name: [%s] %d\n",n,instName,comp,iLine);
2310 2311 2312 2313

  if (lastCompound)
  {
    current->args=lastCompound->name;
2314
    if (true) // !findInstant(current->type))
2315
    {
2316 2317 2318
      initEntry(current);
      instFiles.append(new Entry(*current));
    }
2319

Dimitri van Heesch's avatar
Dimitri van Heesch committed
2320 2321 2322
    Entry *temp=current;  // hold  current pointer  (temp=oldEntry)
    current=new Entry;     // (oldEntry != current)
    delete  temp;
2323 2324 2325 2326 2327 2328
  }
  else
  {
    newEntry();
  }
}
2329

2330
static void pushLabel( QCString &label,QCString & val)
2331
{
2332 2333
  label+="|";
  label+=val;
2334 2335
}

2336
static QCString  popLabel(QCString & q)
2337
{
2338 2339 2340 2341 2342
  QCString u=q;
  int i=q.findRev("|");
  if (i<0) return "";
  q = q.left(i);
  return q;
2343 2344
}

2345
static void addConfigureNode(const char* a,const char*b, bool,bool isLeaf,bool inlineConf)
2346
{
2347
  VhdlConfNode* co=0;
2348
  QCString ent,arch,lab;
2349
  QCString l=genLabels;
2350 2351 2352 2353 2354 2355 2356 2357
  ent=a;
  lab =  VhdlDocGen::parseForConfig(ent,arch);

  if (b)
  {
    ent=b;
    lab=VhdlDocGen::parseForBinding(ent,arch);
  }
2358
  int level=0;
2359

2360
  if(!configL.isEmpty())
2361
  {
2362 2363
    VhdlConfNode* vc=configL.last();
    level=vc->level;
2364 2365 2366
    if (levelCounter==0)
      pushLabel(forL,ent);
    else if (level<levelCounter)
2367 2368 2369 2370 2371 2372 2373 2374 2375 2376
    {
      if (!isLeaf)
      {
        pushLabel(forL,ent);
      }
    }
    else if (level>levelCounter)
    {
      forL=popLabel(forL); 
    }
2377
  }
2378
  else
2379
  {
2380
    pushLabel(forL,ent);
2381
  }
2382 2383 2384


  if (inlineConf)
2385
  {
2386
    confName=lastCompound->name;
2387
  }
2388 2389 2390 2391 2392

  //fprintf(stderr,"\n[%s %d %d]\n",forL.data(),levelCounter,level);
  co=new VhdlConfNode(a,b,confName.lower().data(),forL.lower().data(),isLeaf);

  if (inlineConf)
2393
  {
2394
    co->isInlineConf=TRUE;
2395
  }
2396 2397 2398

  configL.append(co);

2399 2400
}// addConfigure

2401
//  ------------------------------------------------------------------------------------------------------------
2402 2403 2404

static bool isFuncProcProced()
{
2405 2406
  if (currP==VhdlDocGen::FUNCTION ||
      currP==VhdlDocGen::PROCEDURE ||
2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418
      currP==VhdlDocGen::PROCESS
     )
  {
    return TRUE;
  }
  return FALSE;
}

static void initEntry(Entry *e)
{
  e->fileName = s_str.fileName;
  e->lang=SrcLangExt_VHDL;
2419
  isVhdlDocPending();
2420 2421 2422 2423
  initGroupInfo(e);
}

static void addProto(const char *s1,const char *s2,const char *s3,
2424
    const char *s4,const char *s5,const char *s6)
2425 2426 2427 2428 2429 2430 2431 2432 2433
{
  (void)s5; // avoid unused warning
  static QRegExp reg("[\\s]");
  QCString name=s2;
  QStringList ql=QStringList::split(",",name,FALSE);

  for (uint u=0;u<ql.count();u++)
  {
    Argument *arg=new Argument;
2434
    arg->name=ql[u].utf8();
2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457
    if (s3)
    {
      arg->type=s3;
    }
    arg->type+=" ";
    arg->type+=s4;
    if (s6)
    {
      arg->type+=s6;
    }
    if (parse_sec==GEN_SEC && param_sec==0)
    {
      arg->defval="gen!";
    }

    if (parse_sec==PARAM_SEC)
    {
      assert(false);
    }

    arg->defval+=s1;
    arg->attrib="";//s6;

2458 2459 2460 2461 2462 2463
    current->argList->append(arg);
    current->args+=s2;
    current->args+=",";
  }
}

2464
static void createFunction(const QCString &impure,uint64 spec,
2465
    const QCString &fname)
2466
{
2467

2468
  current->spec=spec;
2469
  current->section=Entry::FUNCTION_SEC;
2470

2471 2472 2473 2474
  if (impure=="impure" || impure=="pure")  
  {
    current->exception=impure;
  }
2475 2476 2477 2478 2479 2480 2481

  if (parse_sec==GEN_SEC)
  {
    current->spec= VhdlDocGen::GENERIC;
    current->section=Entry::FUNCTION_SEC;
  }

2482 2483 2484
  if (currP==VhdlDocGen::PROCEDURE)
  {
    current->name=impure;
2485
    current->exception="";
2486 2487 2488 2489 2490 2491 2492 2493
  }
  else
  {
    current->name=fname;
  }

  if (spec==VhdlDocGen::PROCESS)
  {
2494

2495 2496
    current->args=fname;
    current->name=impure;
2497
    VhdlDocGen::deleteAllChars(current->args,' ');
2498
    if (!fname.isEmpty())
2499
    {
2500
      QStringList q1=QStringList::split(",",fname);
2501 2502
      for (uint ii=0;ii<q1.count();ii++)
      {
2503
        Argument *arg=new Argument;
2504
        arg->name=q1[ii].utf8();
2505
        current->argList->append(arg);
2506 2507
      }
    }
2508
    return;
2509
  }
2510

2511 2512 2513
  current->startLine=s_str.iLine;
  current->bodyLine=s_str.iLine;

2514 2515
}

2516 2517
static void addVhdlType(const QCString &name,int startLine,int section,
    uint64 spec,const char* args,const char* type,Protection prot)
2518 2519
{
  static QRegExp reg("[\\s]");
2520

2521 2522
  if (isFuncProcProced() || VhdlDocGen::getFlowMember())   return;
    
2523 2524 2525 2526 2527
  if (parse_sec==GEN_SEC)
  {
    spec= VhdlDocGen::GENERIC;
  }

2528 2529 2530 2531 2532
  // more than one name   ?
  QStringList ql=QStringList::split(",",name,FALSE);

  for (uint u=0;u<ql.count();u++)
  {
2533
    current->name=ql[u].utf8();
2534
  
2535

2536 2537
    current->startLine=startLine;
    current->bodyLine=startLine;
2538
    current->section=section;
2539 2540 2541 2542 2543 2544 2545 2546 2547 2548
    current->spec=spec;
    current->fileName=s_str.fileName;
    if (current->args.isEmpty())
    {
      current->args=args;
      current->args.replace(reg,"%"); // insert dummy chars because wihte spaces are removed
    }
    current->type=type;
    current->type.replace(reg,"%"); // insert dummy chars because white spaces are removed
    current->protection=prot;
2549 2550 2551 2552 2553 2554
 
       if (!lastCompound && (section==Entry::VARIABLE_SEC) &&  (spec == VhdlDocGen::USE || spec == VhdlDocGen::LIBRARY) )
       {
         libUse.append(new Entry(*current));
         current->reset();
       }
2555 2556 2557 2558 2559 2560
    newEntry();
  }
}

static void newEntry()
{
2561 2562

  if (VhdlDocGen::isVhdlClass(current))
2563 2564 2565 2566 2567
  {
    current_root->addSubEntry(current);
  }
  else
  {
2568
    if (lastCompound)
2569 2570 2571 2572 2573 2574 2575
    {
      lastCompound->addSubEntry(current);
    }
    else
    {
      if (lastEntity)
      {
2576
        lastEntity->addSubEntry(current);
2577
      }
2578
      else
2579
      {
2580
        current_root->addSubEntry(current);
2581 2582 2583 2584 2585 2586 2587
      }
    }
  }
  current = new Entry ;
  initEntry(current);
}

Dimitri van Heesch's avatar
Dimitri van Heesch committed
2588
void createFlow()
2589
{
2590 2591 2592 2593 2594 2595 2596 2597 2598
  if (!VhdlDocGen::getFlowMember()) 
  {
    return;
  }
  QCString q,ret;

  if (currP==VhdlDocGen::FUNCTION)
  {
    q=":function( ";
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2599
    FlowChart::alignFuncProc(q,tempEntry->argList,true);
2600 2601 2602 2603 2604
    q+=")";
  }
  else if (currP==VhdlDocGen::PROCEDURE)
  {
    q=":procedure (";    
Dimitri van Heesch's avatar
Dimitri van Heesch committed
2605
    FlowChart::alignFuncProc(q,tempEntry->argList,false);
2606 2607 2608 2609 2610 2611 2612 2613 2614 2615
    q+=")";
  }
  else  
  {  
    q=":process( "+tempEntry->args;
    q+=")";
  }

  q.prepend(VhdlDocGen::getFlowMember()->name().data());

Dimitri van Heesch's avatar
Dimitri van Heesch committed
2616
  FlowChart::addFlowChart(FlowChart::START_NO,q,0);
2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630

  if (currP==VhdlDocGen::FUNCTION)
  {
    ret="end function ";  
  }
  else if (currP==VhdlDocGen::PROCEDURE)
  {
    ret="end procedure";
  }
  else 
  {
    ret="end process ";
  }

Dimitri van Heesch's avatar
Dimitri van Heesch committed
2631 2632 2633
  FlowChart::addFlowChart(FlowChart::END_NO,ret,0);
  //  FlowChart::printFlowList();
  FlowChart::writeFlowChart();  
2634 2635
  currP=0;
}
2636