Allow Trailing Semicolons and Commas In Lists

That trailing commas and semicolons aren't allowed in lists such as port lists, port maps, and aggregates is a frequent source of irritating compile erorrs. They never take long to fix, but they're irritating and could be easily dealt with by the tools.

I propose that we allow them, i.e. that we allow the following:

entity dealywhopper is
  port(
    d   : in  std_logic;
    q   : out std_logic;
    clk : in  std_logic; 
    rst : in  std_logic;
  );
end entity dealywhopper;

REAL_DEAL: entity work.dealywhopper
  port map (
    d => d,
    q => q,
    clk => clk,
    rst => rst,
  );

The trailing semis and commas would be treated as semantically null; they're wasted characters that are simply deemed to be inoffensive by the compiler. This would apply any time a comma or semicolon delimited list appears inside of parens.

Places This Structure Appears

Syntactic Element LRM (2008) Section Relevant?
aggregate ::=
( element_association { , element_association } )
[§ 9.3.3.1] Yes, this is aggregates
association_list ::=
association_element { , association_element }
[§ 6.5.7.1] Yes, this is port, generic, and subprogram parameter maps
context_reference ::=
context selected_name { , selected_name } ;
[§ 13.4] No, this is for contexts and has no parens.
entity_class_entry_list ::=
entity_class_entry { , entity_class_entry }
[§ 6.9] Sure (though who uses groups)
entity_name_list ::=
entity_designator { , entity_designator }
[§ 7.2] No, this is the entity specifier for attributes and has no parens.
enumeration_type_definition ::=
( enumeration_literal { , enumeration_literal } )
[§ 5.2.2.1] Yes, this is enumerations.
identifier_list ::= identifier { , identifier } [§ 5.3.3] No, this is things like a, b : std_logic in a record.
index_constraint ::= ( discrete_range { , discrete_range } ) [§ 5.3.2.1] Yes, this is defining array ranges.
indexed_name ::= prefix ( expression { , expression } ) [§ 8.4] Yes, this is indexing an array.
instantiation_list ::=
instantiation_label { , instantiation_label }
[§ 7.3.1] No, this is calling out instances in a configuration specification.
interface_list ::=
interface_element { ; interface_element }
[§ 6.5.6.1] Yes, this is port/generic specifications.
logical_name_list ::= logical_name { , logical_name } [§ 13.2] No, this is listing multiple libraries on a line and has no parens.
record_constraint ::=
( record_element_constraint { , record_element_constraint } )
[§ 5.3.3] Yes, this is for creating constrained subtypes of records.
sensitivity_list ::= signal_name { , signal_name } [§ 10.2] Not when used in a wait statement, but explicitly allowed in §11.3 process sensitivity lists.
signal_list ::=
signal_name { , signal_name }
[§ 7.4] No, this is a disconnect list.
signature ::= [ [ type_mark { , type_mark } ] [ return type_mark ] ] [§ 4.5.3] No, these are type marks in function signatures and have no parens.
-- Rob Gaddi - 2016-04-06

Comments


Topic revision: r2 - 2016-04-06 - 21:58:19 - RobGaddi
 
Copyright © 2008-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback