diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-05-24 18:19:43 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-05-24 18:19:43 +0200 |
commit | 88869adb76f9cc57dc8446935d41fa11497be227 (patch) | |
tree | fbb0d77b27f47b74fde1c96bb21a3d23bce1367a /src/vhdl | |
parent | 5c5987d671ed390b0965c95f5744d86356a02ddf (diff) | |
download | ghdl-88869adb76f9cc57dc8446935d41fa11497be227.tar.gz ghdl-88869adb76f9cc57dc8446935d41fa11497be227.tar.bz2 ghdl-88869adb76f9cc57dc8446935d41fa11497be227.zip |
vhdl: update AMS parsing.
Diffstat (limited to 'src/vhdl')
-rw-r--r-- | src/vhdl/vhdl-nodes.ads | 4 | ||||
-rw-r--r-- | src/vhdl/vhdl-nodes_meta.adb | 348 | ||||
-rw-r--r-- | src/vhdl/vhdl-parse.adb | 16 |
3 files changed, 195 insertions, 173 deletions
diff --git a/src/vhdl/vhdl-nodes.ads b/src/vhdl/vhdl-nodes.ads index 2365a7543..57e9e3fdc 100644 --- a/src/vhdl/vhdl-nodes.ads +++ b/src/vhdl/vhdl-nodes.ads @@ -1943,6 +1943,8 @@ package Vhdl.Nodes is -- -- Get/Set_Chain (Field2) -- + -- Get/Set_Subtype_Indication (Field5) + -- -- Get/Set_Default_Value (Field4) -- -- Get/Set_Identifier (Field3) @@ -1954,6 +1956,8 @@ package Vhdl.Nodes is -- Get/Set_Expr_Staticness (State1) -- -- Get/Set_Name_Staticness (State2) + -- + -- Get/Set_Is_Ref (Flag12) -- Iir_Kind_Across_Quantity_Declaration (Medium) -- Iir_Kind_Through_Quantity_Declaration (Medium) diff --git a/src/vhdl/vhdl-nodes_meta.adb b/src/vhdl/vhdl-nodes_meta.adb index eb4792ecd..5b8375ddc 100644 --- a/src/vhdl/vhdl-nodes_meta.adb +++ b/src/vhdl/vhdl-nodes_meta.adb @@ -2990,6 +2990,7 @@ package body Vhdl.Nodes_Meta is Field_Chain, -- Iir_Kind_Free_Quantity_Declaration Field_Identifier, + Field_Is_Ref, Field_Visible_Flag, Field_Use_Flag, Field_Expr_Staticness, @@ -2997,6 +2998,7 @@ package body Vhdl.Nodes_Meta is Field_Parent, Field_Type, Field_Chain, + Field_Subtype_Indication, Field_Default_Value, -- Iir_Kind_Across_Quantity_Declaration Field_Identifier, @@ -4520,178 +4522,178 @@ package body Vhdl.Nodes_Meta is Iir_Kind_Psl_Declaration => 650, Iir_Kind_Psl_Endpoint_Declaration => 664, Iir_Kind_Terminal_Declaration => 671, - Iir_Kind_Free_Quantity_Declaration => 680, - Iir_Kind_Across_Quantity_Declaration => 692, - Iir_Kind_Through_Quantity_Declaration => 704, - Iir_Kind_Enumeration_Literal => 715, - Iir_Kind_Function_Declaration => 740, - Iir_Kind_Procedure_Declaration => 764, - Iir_Kind_Function_Body => 774, - Iir_Kind_Procedure_Body => 785, - Iir_Kind_Object_Alias_Declaration => 796, - Iir_Kind_File_Declaration => 810, - Iir_Kind_Guard_Signal_Declaration => 823, - Iir_Kind_Signal_Declaration => 840, - Iir_Kind_Variable_Declaration => 853, - Iir_Kind_Constant_Declaration => 867, - Iir_Kind_Iterator_Declaration => 878, - Iir_Kind_Interface_Constant_Declaration => 894, - Iir_Kind_Interface_Variable_Declaration => 910, - Iir_Kind_Interface_Signal_Declaration => 931, - Iir_Kind_Interface_File_Declaration => 947, - Iir_Kind_Interface_Type_Declaration => 957, - Iir_Kind_Interface_Package_Declaration => 969, - Iir_Kind_Interface_Function_Declaration => 986, - Iir_Kind_Interface_Procedure_Declaration => 999, - Iir_Kind_Signal_Attribute_Declaration => 1002, - Iir_Kind_Identity_Operator => 1006, - Iir_Kind_Negation_Operator => 1010, - Iir_Kind_Absolute_Operator => 1014, - Iir_Kind_Not_Operator => 1018, - Iir_Kind_Implicit_Condition_Operator => 1022, - Iir_Kind_Condition_Operator => 1026, - Iir_Kind_Reduction_And_Operator => 1030, - Iir_Kind_Reduction_Or_Operator => 1034, - Iir_Kind_Reduction_Nand_Operator => 1038, - Iir_Kind_Reduction_Nor_Operator => 1042, - Iir_Kind_Reduction_Xor_Operator => 1046, - Iir_Kind_Reduction_Xnor_Operator => 1050, - Iir_Kind_And_Operator => 1055, - Iir_Kind_Or_Operator => 1060, - Iir_Kind_Nand_Operator => 1065, - Iir_Kind_Nor_Operator => 1070, - Iir_Kind_Xor_Operator => 1075, - Iir_Kind_Xnor_Operator => 1080, - Iir_Kind_Equality_Operator => 1085, - Iir_Kind_Inequality_Operator => 1090, - Iir_Kind_Less_Than_Operator => 1095, - Iir_Kind_Less_Than_Or_Equal_Operator => 1100, - Iir_Kind_Greater_Than_Operator => 1105, - Iir_Kind_Greater_Than_Or_Equal_Operator => 1110, - Iir_Kind_Match_Equality_Operator => 1115, - Iir_Kind_Match_Inequality_Operator => 1120, - Iir_Kind_Match_Less_Than_Operator => 1125, - Iir_Kind_Match_Less_Than_Or_Equal_Operator => 1130, - Iir_Kind_Match_Greater_Than_Operator => 1135, - Iir_Kind_Match_Greater_Than_Or_Equal_Operator => 1140, - Iir_Kind_Sll_Operator => 1145, - Iir_Kind_Sla_Operator => 1150, - Iir_Kind_Srl_Operator => 1155, - Iir_Kind_Sra_Operator => 1160, - Iir_Kind_Rol_Operator => 1165, - Iir_Kind_Ror_Operator => 1170, - Iir_Kind_Addition_Operator => 1175, - Iir_Kind_Substraction_Operator => 1180, - Iir_Kind_Concatenation_Operator => 1185, - Iir_Kind_Multiplication_Operator => 1190, - Iir_Kind_Division_Operator => 1195, - Iir_Kind_Modulus_Operator => 1200, - Iir_Kind_Remainder_Operator => 1205, - Iir_Kind_Exponentiation_Operator => 1210, - Iir_Kind_Function_Call => 1218, - Iir_Kind_Aggregate => 1225, - Iir_Kind_Parenthesis_Expression => 1228, - Iir_Kind_Qualified_Expression => 1232, - Iir_Kind_Type_Conversion => 1237, - Iir_Kind_Allocator_By_Expression => 1241, - Iir_Kind_Allocator_By_Subtype => 1246, - Iir_Kind_Selected_Element => 1254, - Iir_Kind_Dereference => 1259, - Iir_Kind_Implicit_Dereference => 1264, - Iir_Kind_Slice_Name => 1271, - Iir_Kind_Indexed_Name => 1277, - Iir_Kind_Psl_Expression => 1279, - Iir_Kind_Sensitized_Process_Statement => 1300, - Iir_Kind_Process_Statement => 1320, - Iir_Kind_Concurrent_Simple_Signal_Assignment => 1332, - Iir_Kind_Concurrent_Conditional_Signal_Assignment => 1344, - Iir_Kind_Concurrent_Selected_Signal_Assignment => 1357, - Iir_Kind_Concurrent_Assertion_Statement => 1365, - Iir_Kind_Concurrent_Procedure_Call_Statement => 1372, - Iir_Kind_Psl_Assert_Statement => 1385, - Iir_Kind_Psl_Cover_Statement => 1398, - Iir_Kind_Block_Statement => 1411, - Iir_Kind_If_Generate_Statement => 1422, - Iir_Kind_Case_Generate_Statement => 1431, - Iir_Kind_For_Generate_Statement => 1440, - Iir_Kind_Component_Instantiation_Statement => 1451, - Iir_Kind_Psl_Default_Clock => 1455, - Iir_Kind_Simple_Simultaneous_Statement => 1462, - Iir_Kind_Generate_Statement_Body => 1473, - Iir_Kind_If_Generate_Else_Clause => 1479, - Iir_Kind_Simple_Signal_Assignment_Statement => 1489, - Iir_Kind_Conditional_Signal_Assignment_Statement => 1499, - Iir_Kind_Selected_Waveform_Assignment_Statement => 1510, - Iir_Kind_Null_Statement => 1514, - Iir_Kind_Assertion_Statement => 1521, - Iir_Kind_Report_Statement => 1527, - Iir_Kind_Wait_Statement => 1535, - Iir_Kind_Variable_Assignment_Statement => 1542, - Iir_Kind_Conditional_Variable_Assignment_Statement => 1549, - Iir_Kind_Return_Statement => 1555, - Iir_Kind_For_Loop_Statement => 1564, - Iir_Kind_While_Loop_Statement => 1573, - Iir_Kind_Next_Statement => 1580, - Iir_Kind_Exit_Statement => 1587, - Iir_Kind_Case_Statement => 1595, - Iir_Kind_Procedure_Call_Statement => 1601, - Iir_Kind_If_Statement => 1611, - Iir_Kind_Elsif => 1617, - Iir_Kind_Character_Literal => 1625, - Iir_Kind_Simple_Name => 1633, - Iir_Kind_Selected_Name => 1642, - Iir_Kind_Operator_Symbol => 1648, - Iir_Kind_Reference_Name => 1651, - Iir_Kind_External_Constant_Name => 1659, - Iir_Kind_External_Signal_Name => 1667, - Iir_Kind_External_Variable_Name => 1676, - Iir_Kind_Selected_By_All_Name => 1682, - Iir_Kind_Parenthesis_Name => 1687, - Iir_Kind_Package_Pathname => 1691, - Iir_Kind_Absolute_Pathname => 1692, - Iir_Kind_Relative_Pathname => 1693, - Iir_Kind_Pathname_Element => 1698, - Iir_Kind_Base_Attribute => 1700, - Iir_Kind_Subtype_Attribute => 1705, - Iir_Kind_Element_Attribute => 1710, - Iir_Kind_Left_Type_Attribute => 1715, - Iir_Kind_Right_Type_Attribute => 1720, - Iir_Kind_High_Type_Attribute => 1725, - Iir_Kind_Low_Type_Attribute => 1730, - Iir_Kind_Ascending_Type_Attribute => 1735, - Iir_Kind_Image_Attribute => 1741, - Iir_Kind_Value_Attribute => 1747, - Iir_Kind_Pos_Attribute => 1753, - Iir_Kind_Val_Attribute => 1759, - Iir_Kind_Succ_Attribute => 1765, - Iir_Kind_Pred_Attribute => 1771, - Iir_Kind_Leftof_Attribute => 1777, - Iir_Kind_Rightof_Attribute => 1783, - Iir_Kind_Delayed_Attribute => 1792, - Iir_Kind_Stable_Attribute => 1801, - Iir_Kind_Quiet_Attribute => 1810, - Iir_Kind_Transaction_Attribute => 1819, - Iir_Kind_Event_Attribute => 1823, - Iir_Kind_Active_Attribute => 1827, - Iir_Kind_Last_Event_Attribute => 1831, - Iir_Kind_Last_Active_Attribute => 1835, - Iir_Kind_Last_Value_Attribute => 1839, - Iir_Kind_Driving_Attribute => 1843, - Iir_Kind_Driving_Value_Attribute => 1847, - Iir_Kind_Behavior_Attribute => 1847, - Iir_Kind_Structure_Attribute => 1847, - Iir_Kind_Simple_Name_Attribute => 1854, - Iir_Kind_Instance_Name_Attribute => 1859, - Iir_Kind_Path_Name_Attribute => 1864, - Iir_Kind_Left_Array_Attribute => 1871, - Iir_Kind_Right_Array_Attribute => 1878, - Iir_Kind_High_Array_Attribute => 1885, - Iir_Kind_Low_Array_Attribute => 1892, - Iir_Kind_Length_Array_Attribute => 1899, - Iir_Kind_Ascending_Array_Attribute => 1906, - Iir_Kind_Range_Array_Attribute => 1913, - Iir_Kind_Reverse_Range_Array_Attribute => 1920, - Iir_Kind_Attribute_Name => 1929 + Iir_Kind_Free_Quantity_Declaration => 682, + Iir_Kind_Across_Quantity_Declaration => 694, + Iir_Kind_Through_Quantity_Declaration => 706, + Iir_Kind_Enumeration_Literal => 717, + Iir_Kind_Function_Declaration => 742, + Iir_Kind_Procedure_Declaration => 766, + Iir_Kind_Function_Body => 776, + Iir_Kind_Procedure_Body => 787, + Iir_Kind_Object_Alias_Declaration => 798, + Iir_Kind_File_Declaration => 812, + Iir_Kind_Guard_Signal_Declaration => 825, + Iir_Kind_Signal_Declaration => 842, + Iir_Kind_Variable_Declaration => 855, + Iir_Kind_Constant_Declaration => 869, + Iir_Kind_Iterator_Declaration => 880, + Iir_Kind_Interface_Constant_Declaration => 896, + Iir_Kind_Interface_Variable_Declaration => 912, + Iir_Kind_Interface_Signal_Declaration => 933, + Iir_Kind_Interface_File_Declaration => 949, + Iir_Kind_Interface_Type_Declaration => 959, + Iir_Kind_Interface_Package_Declaration => 971, + Iir_Kind_Interface_Function_Declaration => 988, + Iir_Kind_Interface_Procedure_Declaration => 1001, + Iir_Kind_Signal_Attribute_Declaration => 1004, + Iir_Kind_Identity_Operator => 1008, + Iir_Kind_Negation_Operator => 1012, + Iir_Kind_Absolute_Operator => 1016, + Iir_Kind_Not_Operator => 1020, + Iir_Kind_Implicit_Condition_Operator => 1024, + Iir_Kind_Condition_Operator => 1028, + Iir_Kind_Reduction_And_Operator => 1032, + Iir_Kind_Reduction_Or_Operator => 1036, + Iir_Kind_Reduction_Nand_Operator => 1040, + Iir_Kind_Reduction_Nor_Operator => 1044, + Iir_Kind_Reduction_Xor_Operator => 1048, + Iir_Kind_Reduction_Xnor_Operator => 1052, + Iir_Kind_And_Operator => 1057, + Iir_Kind_Or_Operator => 1062, + Iir_Kind_Nand_Operator => 1067, + Iir_Kind_Nor_Operator => 1072, + Iir_Kind_Xor_Operator => 1077, + Iir_Kind_Xnor_Operator => 1082, + Iir_Kind_Equality_Operator => 1087, + Iir_Kind_Inequality_Operator => 1092, + Iir_Kind_Less_Than_Operator => 1097, + Iir_Kind_Less_Than_Or_Equal_Operator => 1102, + Iir_Kind_Greater_Than_Operator => 1107, + Iir_Kind_Greater_Than_Or_Equal_Operator => 1112, + Iir_Kind_Match_Equality_Operator => 1117, + Iir_Kind_Match_Inequality_Operator => 1122, + Iir_Kind_Match_Less_Than_Operator => 1127, + Iir_Kind_Match_Less_Than_Or_Equal_Operator => 1132, + Iir_Kind_Match_Greater_Than_Operator => 1137, + Iir_Kind_Match_Greater_Than_Or_Equal_Operator => 1142, + Iir_Kind_Sll_Operator => 1147, + Iir_Kind_Sla_Operator => 1152, + Iir_Kind_Srl_Operator => 1157, + Iir_Kind_Sra_Operator => 1162, + Iir_Kind_Rol_Operator => 1167, + Iir_Kind_Ror_Operator => 1172, + Iir_Kind_Addition_Operator => 1177, + Iir_Kind_Substraction_Operator => 1182, + Iir_Kind_Concatenation_Operator => 1187, + Iir_Kind_Multiplication_Operator => 1192, + Iir_Kind_Division_Operator => 1197, + Iir_Kind_Modulus_Operator => 1202, + Iir_Kind_Remainder_Operator => 1207, + Iir_Kind_Exponentiation_Operator => 1212, + Iir_Kind_Function_Call => 1220, + Iir_Kind_Aggregate => 1227, + Iir_Kind_Parenthesis_Expression => 1230, + Iir_Kind_Qualified_Expression => 1234, + Iir_Kind_Type_Conversion => 1239, + Iir_Kind_Allocator_By_Expression => 1243, + Iir_Kind_Allocator_By_Subtype => 1248, + Iir_Kind_Selected_Element => 1256, + Iir_Kind_Dereference => 1261, + Iir_Kind_Implicit_Dereference => 1266, + Iir_Kind_Slice_Name => 1273, + Iir_Kind_Indexed_Name => 1279, + Iir_Kind_Psl_Expression => 1281, + Iir_Kind_Sensitized_Process_Statement => 1302, + Iir_Kind_Process_Statement => 1322, + Iir_Kind_Concurrent_Simple_Signal_Assignment => 1334, + Iir_Kind_Concurrent_Conditional_Signal_Assignment => 1346, + Iir_Kind_Concurrent_Selected_Signal_Assignment => 1359, + Iir_Kind_Concurrent_Assertion_Statement => 1367, + Iir_Kind_Concurrent_Procedure_Call_Statement => 1374, + Iir_Kind_Psl_Assert_Statement => 1387, + Iir_Kind_Psl_Cover_Statement => 1400, + Iir_Kind_Block_Statement => 1414, + Iir_Kind_If_Generate_Statement => 1425, + Iir_Kind_Case_Generate_Statement => 1434, + Iir_Kind_For_Generate_Statement => 1443, + Iir_Kind_Component_Instantiation_Statement => 1454, + Iir_Kind_Psl_Default_Clock => 1458, + Iir_Kind_Simple_Simultaneous_Statement => 1465, + Iir_Kind_Generate_Statement_Body => 1476, + Iir_Kind_If_Generate_Else_Clause => 1482, + Iir_Kind_Simple_Signal_Assignment_Statement => 1492, + Iir_Kind_Conditional_Signal_Assignment_Statement => 1502, + Iir_Kind_Selected_Waveform_Assignment_Statement => 1513, + Iir_Kind_Null_Statement => 1517, + Iir_Kind_Assertion_Statement => 1524, + Iir_Kind_Report_Statement => 1530, + Iir_Kind_Wait_Statement => 1538, + Iir_Kind_Variable_Assignment_Statement => 1545, + Iir_Kind_Conditional_Variable_Assignment_Statement => 1552, + Iir_Kind_Return_Statement => 1558, + Iir_Kind_For_Loop_Statement => 1567, + Iir_Kind_While_Loop_Statement => 1576, + Iir_Kind_Next_Statement => 1583, + Iir_Kind_Exit_Statement => 1590, + Iir_Kind_Case_Statement => 1598, + Iir_Kind_Procedure_Call_Statement => 1604, + Iir_Kind_If_Statement => 1614, + Iir_Kind_Elsif => 1620, + Iir_Kind_Character_Literal => 1628, + Iir_Kind_Simple_Name => 1636, + Iir_Kind_Selected_Name => 1645, + Iir_Kind_Operator_Symbol => 1651, + Iir_Kind_Reference_Name => 1654, + Iir_Kind_External_Constant_Name => 1662, + Iir_Kind_External_Signal_Name => 1670, + Iir_Kind_External_Variable_Name => 1679, + Iir_Kind_Selected_By_All_Name => 1685, + Iir_Kind_Parenthesis_Name => 1690, + Iir_Kind_Package_Pathname => 1694, + Iir_Kind_Absolute_Pathname => 1695, + Iir_Kind_Relative_Pathname => 1696, + Iir_Kind_Pathname_Element => 1701, + Iir_Kind_Base_Attribute => 1703, + Iir_Kind_Subtype_Attribute => 1708, + Iir_Kind_Element_Attribute => 1713, + Iir_Kind_Left_Type_Attribute => 1718, + Iir_Kind_Right_Type_Attribute => 1723, + Iir_Kind_High_Type_Attribute => 1728, + Iir_Kind_Low_Type_Attribute => 1733, + Iir_Kind_Ascending_Type_Attribute => 1738, + Iir_Kind_Image_Attribute => 1744, + Iir_Kind_Value_Attribute => 1750, + Iir_Kind_Pos_Attribute => 1756, + Iir_Kind_Val_Attribute => 1762, + Iir_Kind_Succ_Attribute => 1768, + Iir_Kind_Pred_Attribute => 1774, + Iir_Kind_Leftof_Attribute => 1780, + Iir_Kind_Rightof_Attribute => 1786, + Iir_Kind_Delayed_Attribute => 1795, + Iir_Kind_Stable_Attribute => 1804, + Iir_Kind_Quiet_Attribute => 1813, + Iir_Kind_Transaction_Attribute => 1822, + Iir_Kind_Event_Attribute => 1826, + Iir_Kind_Active_Attribute => 1830, + Iir_Kind_Last_Event_Attribute => 1834, + Iir_Kind_Last_Active_Attribute => 1838, + Iir_Kind_Last_Value_Attribute => 1842, + Iir_Kind_Driving_Attribute => 1846, + Iir_Kind_Driving_Value_Attribute => 1850, + Iir_Kind_Behavior_Attribute => 1850, + Iir_Kind_Structure_Attribute => 1850, + Iir_Kind_Simple_Name_Attribute => 1857, + Iir_Kind_Instance_Name_Attribute => 1862, + Iir_Kind_Path_Name_Attribute => 1867, + Iir_Kind_Left_Array_Attribute => 1874, + Iir_Kind_Right_Array_Attribute => 1881, + Iir_Kind_High_Array_Attribute => 1888, + Iir_Kind_Low_Array_Attribute => 1895, + Iir_Kind_Length_Array_Attribute => 1902, + Iir_Kind_Ascending_Array_Attribute => 1909, + Iir_Kind_Range_Array_Attribute => 1916, + Iir_Kind_Reverse_Range_Array_Attribute => 1923, + Iir_Kind_Attribute_Name => 1932 ); function Get_Fields_First (K : Iir_Kind) return Fields_Index is @@ -7564,6 +7566,7 @@ package body Vhdl.Nodes_Meta is case K is when Iir_Kind_Subtype_Declaration | Iir_Kind_Element_Declaration + | Iir_Kind_Free_Quantity_Declaration | Iir_Kind_Object_Alias_Declaration | Iir_Kind_File_Declaration | Iir_Kind_Signal_Declaration @@ -10641,6 +10644,7 @@ package body Vhdl.Nodes_Meta is | Iir_Kind_Floating_Type_Definition | Iir_Kind_Physical_Type_Definition | Iir_Kind_Subtype_Definition + | Iir_Kind_Free_Quantity_Declaration | Iir_Kind_Signal_Declaration | Iir_Kind_Variable_Declaration | Iir_Kind_Constant_Declaration diff --git a/src/vhdl/vhdl-parse.adb b/src/vhdl/vhdl-parse.adb index 33a54a0ef..140317d3f 100644 --- a/src/vhdl/vhdl-parse.adb +++ b/src/vhdl/vhdl-parse.adb @@ -3317,6 +3317,9 @@ package body Vhdl.Parse is Chain_Append (First, Last, Terminal); exit when Current_Token /= Tok_Comma; + + Set_Has_Identifier_List (Terminal, True); + -- Skip ','. Scan; end loop; @@ -3408,7 +3411,18 @@ package body Vhdl.Parse is when Tok_Colon => -- Either a free quantity (or a source quantity) -- TODO - raise Program_Error; + + -- Skip ':'. + Scan; + + Set_Subtype_Indication (First, Parse_Subtype_Indication); + + if Current_Token = Tok_Assign then + -- Skip ':='. + Scan; + + Set_Default_Value (First, Parse_Expression); + end if; when Tok_Tolerance | Tok_Assign | Tok_Across |