├── LICENSE ├── README.md ├── binding.gyp ├── grammar.js ├── index.js ├── package.json ├── queries └── highlights.scm ├── src ├── grammar.json ├── node-types.json ├── parser.c └── tree_sitter │ └── parser.h └── test ├── corpus ├── architecture_body.txt ├── assignments │ ├── conditional_signal_assignment.txt │ ├── selected_signal_assignment.txt │ └── simple_signal_assignment.txt ├── concurrent_statements │ ├── assert.txt │ ├── block.txt │ ├── component_instantiation.txt │ ├── generate.txt │ └── process.txt ├── conflicts │ └── conflict1.txt ├── declarations │ ├── access_type.txt │ ├── alias.txt │ ├── architecture_body.txt │ ├── attribute.txt │ ├── component.txt │ ├── composite_type.txt │ ├── configuration.txt │ ├── configuration_specification.txt │ ├── disconnection.txt │ ├── entity.txt │ ├── file_type.txt │ ├── group.txt │ ├── incomplete_type.txt │ ├── instantiations.txt │ ├── objects.txt │ ├── package.txt │ ├── protected_type.txt │ ├── protected_type_body.txt │ ├── scalar_type.txt │ ├── subprogram.txt │ └── subtype_indication.txt ├── expressions │ ├── allocators.txt │ ├── expressions.txt │ ├── lrm.txt │ ├── precedence.txt │ ├── qualified_expression.txt │ └── string_expression.txt ├── interface_lists │ ├── function_parameters_clause.txt │ ├── generic_clause.txt │ ├── package_interface_declaration.txt │ ├── port_clause.txt │ ├── procedure_parameters_clause.txt │ └── subprogram_interface_declaration.txt ├── lexical_elements │ ├── aggregates.txt │ ├── bit_string_literals.txt │ ├── comments.txt │ ├── null_literal.txt │ ├── numeric_literals.txt │ ├── predefined_enumeration_literals.txt │ └── string_literals.txt ├── names │ ├── ambiguos_name.txt │ ├── attribute_name.txt │ ├── external_name.txt │ ├── function_call.txt │ └── slice_names.txt ├── primary_unit │ └── primary_unit.txt ├── psl │ ├── declaration.txt │ ├── lrm.txt │ ├── property.txt │ ├── sequence.txt │ ├── suffix_implication.txt │ ├── test.txt │ └── vunit.txt └── sequential_statements │ ├── case.txt │ ├── if.txt │ ├── loop.txt │ ├── report.txt │ └── wait.txt └── highlight ├── architecture_body.vhdl ├── architecture_declarative_part.vhdl ├── array_types.vhdl ├── entity_declaration.vhdl ├── entity_declarative_part.vhdl ├── entity_header.vhdl ├── entity_statement_part.vhdl ├── enumeration_types.vhdl ├── function_declaration.vhdl ├── function_instantiation.vhdl ├── function_paramater_clause.vhdl ├── numeric_type_definition.vhdl ├── package_body.vhdl ├── package_body_declarative_part.vhdl ├── package_declaration.vhdl ├── package_declarative_part.vhdl ├── package_header.vhdl ├── package_map_aspect.vhdl ├── physical_types.vhdl ├── predefined_array_types.vhdl ├── procedure_declaration.vhdl ├── procedure_instantiation.vhdl ├── procedure_paramater_clause.vhdl ├── record_types.vhdl ├── subprogram_declarative_part.vhdl ├── subprogram_header.vhdl └── subprogram_map_aspect.vhdl /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Alexandre A. Muller 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # tree-sitter-vhdl 2 | 3 | Tree-sitter-vhdl is a VHDL parser for syntax highlighting. 4 | 5 | ## Missing features 6 | 7 | - [x] VHDL-2008 8 | - [ ] Protected tool directives 9 | - [x] PSL-02 10 | - [ ] LTL PSL Operators (not intended to be supported) 11 | - [ ] OBE PSL Operators (not intended to be supported) 12 | - [ ] VHDL-2019 13 | 14 | Not listed features are implemented already. 15 | 16 | ## Notes 17 | 18 | The parser accepts some illegal constructions to be able to provide precise 19 | error highlight. 20 | 21 | See `./tests/highlight/` and `./queries/highlights.scm` for a list of errors. 22 | 23 | ## References 24 | * IEEE Std 1076-2008 25 | * IEEE Std 1850-2005 26 | * IEEE Std 1076-2019 27 | -------------------------------------------------------------------------------- /binding.gyp: -------------------------------------------------------------------------------- 1 | { 2 | "targets": [ 3 | { 4 | "target_name": "tree_sitter_vhdl_binding", 5 | "include_dirs": [ 6 | " 9 | #include 10 | #include 11 | 12 | #define ts_builtin_sym_error ((TSSymbol)-1) 13 | #define ts_builtin_sym_end 0 14 | #define TREE_SITTER_SERIALIZATION_BUFFER_SIZE 1024 15 | 16 | typedef uint16_t TSStateId; 17 | 18 | #ifndef TREE_SITTER_API_H_ 19 | typedef uint16_t TSSymbol; 20 | typedef uint16_t TSFieldId; 21 | typedef struct TSLanguage TSLanguage; 22 | #endif 23 | 24 | typedef struct { 25 | TSFieldId field_id; 26 | uint8_t child_index; 27 | bool inherited; 28 | } TSFieldMapEntry; 29 | 30 | typedef struct { 31 | uint16_t index; 32 | uint16_t length; 33 | } TSFieldMapSlice; 34 | 35 | typedef struct { 36 | bool visible; 37 | bool named; 38 | bool supertype; 39 | } TSSymbolMetadata; 40 | 41 | typedef struct TSLexer TSLexer; 42 | 43 | struct TSLexer { 44 | int32_t lookahead; 45 | TSSymbol result_symbol; 46 | void (*advance)(TSLexer *, bool); 47 | void (*mark_end)(TSLexer *); 48 | uint32_t (*get_column)(TSLexer *); 49 | bool (*is_at_included_range_start)(const TSLexer *); 50 | bool (*eof)(const TSLexer *); 51 | }; 52 | 53 | typedef enum { 54 | TSParseActionTypeShift, 55 | TSParseActionTypeReduce, 56 | TSParseActionTypeAccept, 57 | TSParseActionTypeRecover, 58 | } TSParseActionType; 59 | 60 | typedef union { 61 | struct { 62 | uint8_t type; 63 | TSStateId state; 64 | bool extra; 65 | bool repetition; 66 | } shift; 67 | struct { 68 | uint8_t type; 69 | uint8_t child_count; 70 | TSSymbol symbol; 71 | int16_t dynamic_precedence; 72 | uint16_t production_id; 73 | } reduce; 74 | uint8_t type; 75 | } TSParseAction; 76 | 77 | typedef struct { 78 | uint16_t lex_state; 79 | uint16_t external_lex_state; 80 | } TSLexMode; 81 | 82 | typedef union { 83 | TSParseAction action; 84 | struct { 85 | uint8_t count; 86 | bool reusable; 87 | } entry; 88 | } TSParseActionEntry; 89 | 90 | struct TSLanguage { 91 | uint32_t version; 92 | uint32_t symbol_count; 93 | uint32_t alias_count; 94 | uint32_t token_count; 95 | uint32_t external_token_count; 96 | uint32_t state_count; 97 | uint32_t large_state_count; 98 | uint32_t production_id_count; 99 | uint32_t field_count; 100 | uint16_t max_alias_sequence_length; 101 | const uint16_t *parse_table; 102 | const uint16_t *small_parse_table; 103 | const uint32_t *small_parse_table_map; 104 | const TSParseActionEntry *parse_actions; 105 | const char * const *symbol_names; 106 | const char * const *field_names; 107 | const TSFieldMapSlice *field_map_slices; 108 | const TSFieldMapEntry *field_map_entries; 109 | const TSSymbolMetadata *symbol_metadata; 110 | const TSSymbol *public_symbol_map; 111 | const uint16_t *alias_map; 112 | const TSSymbol *alias_sequences; 113 | const TSLexMode *lex_modes; 114 | bool (*lex_fn)(TSLexer *, TSStateId); 115 | bool (*keyword_lex_fn)(TSLexer *, TSStateId); 116 | TSSymbol keyword_capture_token; 117 | struct { 118 | const bool *states; 119 | const TSSymbol *symbol_map; 120 | void *(*create)(void); 121 | void (*destroy)(void *); 122 | bool (*scan)(void *, TSLexer *, const bool *symbol_whitelist); 123 | unsigned (*serialize)(void *, char *); 124 | void (*deserialize)(void *, const char *, unsigned); 125 | } external_scanner; 126 | }; 127 | 128 | /* 129 | * Lexer Macros 130 | */ 131 | 132 | #define START_LEXER() \ 133 | bool result = false; \ 134 | bool skip = false; \ 135 | bool eof = false; \ 136 | int32_t lookahead; \ 137 | goto start; \ 138 | next_state: \ 139 | lexer->advance(lexer, skip); \ 140 | start: \ 141 | skip = false; \ 142 | lookahead = lexer->lookahead; 143 | 144 | #define ADVANCE(state_value) \ 145 | { \ 146 | state = state_value; \ 147 | goto next_state; \ 148 | } 149 | 150 | #define SKIP(state_value) \ 151 | { \ 152 | skip = true; \ 153 | state = state_value; \ 154 | goto next_state; \ 155 | } 156 | 157 | #define ACCEPT_TOKEN(symbol_value) \ 158 | result = true; \ 159 | lexer->result_symbol = symbol_value; \ 160 | lexer->mark_end(lexer); 161 | 162 | #define END_STATE() return result; 163 | 164 | /* 165 | * Parse Table Macros 166 | */ 167 | 168 | #define SMALL_STATE(id) id - LARGE_STATE_COUNT 169 | 170 | #define STATE(id) id 171 | 172 | #define ACTIONS(id) id 173 | 174 | #define SHIFT(state_value) \ 175 | {{ \ 176 | .shift = { \ 177 | .type = TSParseActionTypeShift, \ 178 | .state = state_value \ 179 | } \ 180 | }} 181 | 182 | #define SHIFT_REPEAT(state_value) \ 183 | {{ \ 184 | .shift = { \ 185 | .type = TSParseActionTypeShift, \ 186 | .state = state_value, \ 187 | .repetition = true \ 188 | } \ 189 | }} 190 | 191 | #define SHIFT_EXTRA() \ 192 | {{ \ 193 | .shift = { \ 194 | .type = TSParseActionTypeShift, \ 195 | .extra = true \ 196 | } \ 197 | }} 198 | 199 | #define REDUCE(symbol_val, child_count_val, ...) \ 200 | {{ \ 201 | .reduce = { \ 202 | .type = TSParseActionTypeReduce, \ 203 | .symbol = symbol_val, \ 204 | .child_count = child_count_val, \ 205 | __VA_ARGS__ \ 206 | }, \ 207 | }} 208 | 209 | #define RECOVER() \ 210 | {{ \ 211 | .type = TSParseActionTypeRecover \ 212 | }} 213 | 214 | #define ACCEPT_INPUT() \ 215 | {{ \ 216 | .type = TSParseActionTypeAccept \ 217 | }} 218 | 219 | #ifdef __cplusplus 220 | } 221 | #endif 222 | 223 | #endif // TREE_SITTER_PARSER_H_ 224 | -------------------------------------------------------------------------------- /test/corpus/architecture_body.txt: -------------------------------------------------------------------------------- 1 | ============================== 2 | Minimal 3 | ============================== 4 | architecture rtl of ent is 5 | begin 6 | end; 7 | 8 | architecture rtl of ent is 9 | begin 10 | end architecture; 11 | 12 | architecture rtl of ent is 13 | begin 14 | end architecture rtl; 15 | --- 16 | 17 | (design_file 18 | (design_unit 19 | (architecture_body 20 | name: (identifier) 21 | entity: (simple_name))) 22 | (design_unit 23 | (architecture_body 24 | name: (identifier) 25 | entity: (simple_name))) 26 | (design_unit 27 | (architecture_body 28 | name: (identifier) 29 | entity: (simple_name) 30 | at_end: (simple_name)))) 31 | -------------------------------------------------------------------------------- /test/corpus/assignments/simple_signal_assignment.txt: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | Simple waveform assignment - Minimal 3 | ================================================================================ 4 | t <= w; 5 | L: t <= w; 6 | -------------------------------------------------------------------------------- 7 | 8 | (design_file 9 | (simple_concurrent_signal_assignment 10 | target: (simple_name) 11 | (waveforms 12 | (waveform_element 13 | (expression 14 | (simple_name))))) 15 | (simple_concurrent_signal_assignment 16 | (label 17 | (identifier)) 18 | target: (simple_name) 19 | (waveforms 20 | (waveform_element 21 | (expression 22 | (simple_name)))))) 23 | 24 | ================================================================================ 25 | Simple waveform assignment - Delay mechanism 26 | ================================================================================ 27 | t <= transport w; 28 | t <= inertial w; 29 | t <= reject 10 ns inertial w; 30 | -------------------------------------------------------------------------------- 31 | 32 | (design_file 33 | (simple_concurrent_signal_assignment 34 | target: (simple_name) 35 | (delay_mechanism 36 | (transport)) 37 | (waveforms 38 | (waveform_element 39 | (expression 40 | (simple_name))))) 41 | (simple_concurrent_signal_assignment 42 | target: (simple_name) 43 | (delay_mechanism 44 | (inertial)) 45 | (waveforms 46 | (waveform_element 47 | (expression 48 | (simple_name))))) 49 | (simple_concurrent_signal_assignment 50 | target: (simple_name) 51 | (delay_mechanism 52 | (inertial 53 | reject: (time_expression 54 | (physical_literal 55 | (integer_decimal) 56 | unit: (simple_name))))) 57 | (waveforms 58 | (waveform_element 59 | (expression 60 | (simple_name)))))) 61 | 62 | ================================================================================ 63 | Waveform element 64 | ================================================================================ 65 | t <= val; 66 | t <= val after 42 ns; 67 | t <= null after 42 ns; 68 | -------------------------------------------------------------------------------- 69 | 70 | (design_file 71 | (simple_concurrent_signal_assignment 72 | target: (simple_name) 73 | (waveforms 74 | (waveform_element 75 | (expression 76 | (simple_name))))) 77 | (simple_concurrent_signal_assignment 78 | target: (simple_name) 79 | (waveforms 80 | (waveform_element 81 | (expression 82 | (simple_name)) 83 | (time_expression 84 | (physical_literal 85 | (integer_decimal) 86 | unit: (simple_name)))))) 87 | (simple_concurrent_signal_assignment 88 | target: (simple_name) 89 | (waveforms 90 | (waveform_element 91 | (expression 92 | (null)) 93 | (time_expression 94 | (physical_literal 95 | (integer_decimal) 96 | unit: (simple_name))))))) 97 | 98 | ================================================================================ 99 | Waveforms 100 | ================================================================================ 101 | t <= unaffected; 102 | t <= val1 after 10 ns, 103 | val2 after 20 ns, 104 | null; 105 | -------------------------------------------------------------------------------- 106 | 107 | (design_file 108 | (simple_concurrent_signal_assignment 109 | target: (simple_name) 110 | (waveforms 111 | (unaffected))) 112 | (simple_concurrent_signal_assignment 113 | target: (simple_name) 114 | (waveforms 115 | (waveform_element 116 | (expression 117 | (simple_name)) 118 | (time_expression 119 | (physical_literal 120 | (integer_decimal) 121 | unit: (simple_name)))) 122 | (waveform_element 123 | (expression 124 | (simple_name)) 125 | (time_expression 126 | (physical_literal 127 | (integer_decimal) 128 | unit: (simple_name)))) 129 | (waveform_element 130 | (expression 131 | (null)))))) 132 | 133 | ================================================================================ 134 | Simple force assignment 135 | ================================================================================ 136 | t <= force expr; 137 | t <= force in expr; 138 | t <= force out expr; 139 | -------------------------------------------------------------------------------- 140 | 141 | (design_file 142 | (simple_force_assignment 143 | target: (simple_name) 144 | (expression 145 | (simple_name))) 146 | (simple_force_assignment 147 | target: (simple_name) 148 | (force_mode) 149 | (expression 150 | (simple_name))) 151 | (simple_force_assignment 152 | target: (simple_name) 153 | (force_mode) 154 | (expression 155 | (simple_name)))) 156 | 157 | ================================================================================ 158 | Simple release assignment 159 | ================================================================================ 160 | t <= release; 161 | t <= release in; 162 | t <= release out; 163 | -------------------------------------------------------------------------------- 164 | 165 | (design_file 166 | (simple_release_assignment 167 | target: (simple_name)) 168 | (simple_release_assignment 169 | target: (simple_name) 170 | (force_mode)) 171 | (simple_release_assignment 172 | target: (simple_name) 173 | (force_mode))) 174 | 175 | ================================================================================ 176 | Guarded assignment 177 | ================================================================================ 178 | t <= guarded w; 179 | -------------------------------------------------------------------------------- 180 | 181 | (design_file 182 | (simple_concurrent_signal_assignment 183 | target: (simple_name) 184 | (waveforms 185 | (waveform_element 186 | (expression 187 | (simple_name)))))) 188 | -------------------------------------------------------------------------------- /test/corpus/concurrent_statements/assert.txt: -------------------------------------------------------------------------------- 1 | ============================== 2 | Minimal 3 | ============================== 4 | assert a; 5 | A1: assert a; 6 | --- 7 | 8 | (design_file 9 | (assertion_statement 10 | (conditional_expression 11 | (simple_name))) 12 | (assertion_statement 13 | (label 14 | (identifier)) 15 | (conditional_expression 16 | (simple_name)))) 17 | 18 | ============================== 19 | Report 20 | ============================== 21 | assert a report "str"; 22 | --- 23 | 24 | (design_file 25 | (assertion_statement 26 | (conditional_expression 27 | (simple_name)) 28 | (string_expression 29 | (string_literal)))) 30 | 31 | ============================== 32 | Severity 33 | ============================== 34 | assert a severity note; 35 | --- 36 | 37 | (design_file 38 | (assertion_statement 39 | (conditional_expression 40 | (simple_name)) 41 | (severity_expression 42 | (simple_name)))) 43 | 44 | ============================== 45 | Report and severity 46 | ============================== 47 | assert a report K_MSG severity failure; 48 | --- 49 | 50 | (design_file 51 | (assertion_statement 52 | (conditional_expression 53 | (simple_name)) 54 | (string_expression 55 | (simple_name)) 56 | (severity_expression 57 | (simple_name)))) 58 | -------------------------------------------------------------------------------- /test/corpus/concurrent_statements/block.txt: -------------------------------------------------------------------------------- 1 | ============================== 2 | Minimal 3 | ============================== 4 | L1: block 5 | begin 6 | end block; 7 | 8 | B2: block is 9 | begin 10 | end block B2; 11 | ---- 12 | 13 | (design_file 14 | (block_statement 15 | (label (identifier))) 16 | (block_statement 17 | (label (identifier)) 18 | at_end: (simple_name))) 19 | 20 | ============================== 21 | Guard condition 22 | ============================== 23 | L1: block (cond) is 24 | begin 25 | end block; 26 | --- 27 | 28 | (design_file 29 | (block_statement 30 | (label 31 | (identifier)) 32 | guard: (conditional_expression 33 | (simple_name)))) 34 | 35 | ============================== 36 | Block header - Generic clause 37 | ============================== 38 | L1: block is 39 | generic (a:t); 40 | begin 41 | end block; 42 | --- 43 | 44 | (design_file 45 | (block_statement 46 | (label 47 | (identifier)) 48 | (block_header 49 | (generic_clause 50 | (constant_interface_declaration 51 | (identifier_list 52 | (identifier)) 53 | (subtype_indication 54 | (type_mark 55 | (simple_name)))) 56 | (semicolon))))) 57 | 58 | ================================== 59 | Block header - Generic map aspect 60 | ================================== 61 | L1: block is 62 | generic (a:t); 63 | generic map (b); 64 | begin 65 | end block; 66 | --- 67 | 68 | (design_file 69 | (block_statement 70 | (label 71 | (identifier)) 72 | (block_header 73 | (generic_clause 74 | (constant_interface_declaration 75 | (identifier_list 76 | (identifier)) 77 | (subtype_indication 78 | (type_mark 79 | (simple_name)))) 80 | (semicolon)) 81 | (generic_map_aspect 82 | (association_list 83 | (positional_association_element 84 | actual_part: (expression 85 | (simple_name)))) 86 | (semicolon))))) 87 | 88 | ============================== 89 | Block header - Port clause 90 | ============================== 91 | L1: block is 92 | port (a:t); 93 | begin 94 | end block; 95 | --- 96 | 97 | (design_file 98 | (block_statement 99 | (label 100 | (identifier)) 101 | (block_header 102 | (port_clause 103 | (signal_interface_declaration 104 | (identifier_list 105 | (identifier)) 106 | (subtype_indication 107 | (type_mark 108 | (simple_name)))) 109 | (semicolon))))) 110 | 111 | ============================== 112 | Block header - Port map aspect 113 | ============================== 114 | L1: block is 115 | port (a:t); 116 | port map (b); 117 | begin 118 | end block; 119 | --- 120 | 121 | (design_file 122 | (block_statement 123 | (label 124 | (identifier)) 125 | (block_header 126 | (port_clause 127 | (signal_interface_declaration 128 | (identifier_list 129 | (identifier)) 130 | (subtype_indication 131 | (type_mark 132 | (simple_name)))) 133 | (semicolon)) 134 | (port_map_aspect 135 | (association_list 136 | (positional_association_element 137 | actual_part: (expression 138 | (simple_name)))) 139 | (semicolon))))) 140 | 141 | ============================== 142 | Declarative part 143 | ============================== 144 | L1: block is 145 | alias a is s; 146 | begin 147 | end block; 148 | --- 149 | 150 | (design_file 151 | (block_statement 152 | (label 153 | (identifier)) 154 | (declarative_part 155 | (alias_declaration 156 | designator: (identifier) 157 | denotator: (simple_name))))) 158 | 159 | ============================== 160 | Sequential part 161 | ============================== 162 | L1: block is 163 | begin 164 | PL: p; 165 | end block; 166 | --- 167 | 168 | (design_file 169 | (block_statement 170 | (label 171 | (identifier)) 172 | (concurrent_statement_part 173 | (procedure_call_statement 174 | (label 175 | (identifier)) 176 | procedure: (simple_name))))) 177 | -------------------------------------------------------------------------------- /test/corpus/concurrent_statements/process.txt: -------------------------------------------------------------------------------- 1 | ============================= 2 | Minimal 3 | ============================= 4 | process 5 | begin 6 | end process; 7 | 8 | L1: process is 9 | begin 10 | end process L1; 11 | --- 12 | 13 | (design_file 14 | (process_statement) 15 | (process_statement 16 | (label (identifier)) 17 | at_end: (simple_name))) 18 | 19 | ============================= 20 | Sequential statement 21 | ============================= 22 | process 23 | begin 24 | wait on a; 25 | end process; 26 | --- 27 | 28 | (design_file 29 | (process_statement 30 | (sequence_of_statements 31 | (wait_statement 32 | (sensitivity_list 33 | (simple_name)))))) 34 | 35 | ============================= 36 | Sensitivity list - All 37 | ============================= 38 | process (all) 39 | begin 40 | end process; 41 | --- 42 | 43 | (design_file 44 | (process_statement 45 | (sensitivity_list 46 | (all)))) 47 | 48 | ============================= 49 | Sensitivity list - Signals 50 | ============================= 51 | process (a,b) 52 | begin 53 | end process; 54 | --- 55 | 56 | (design_file 57 | (process_statement 58 | (sensitivity_list 59 | (simple_name) 60 | (simple_name)))) 61 | 62 | ============================= 63 | Declarative part 64 | ============================= 65 | process 66 | constant k : t := g; 67 | begin 68 | end process; 69 | --- 70 | 71 | (design_file 72 | (process_statement 73 | (declarative_part 74 | (constant_declaration 75 | (identifier_list (identifier)) 76 | (subtype_indication 77 | (type_mark (simple_name))) 78 | (default_expression 79 | (simple_name)))))) 80 | -------------------------------------------------------------------------------- /test/corpus/conflicts/conflict1.txt: -------------------------------------------------------------------------------- 1 | =================================== 2 | Conflict I - Function call 3 | =================================== 4 | assert (foo (open)); 5 | --- 6 | 7 | (design_file 8 | (assertion_statement 9 | (conditional_expression 10 | (parenthesized_expression 11 | (function_call 12 | function: (simple_name) 13 | (association_list 14 | (positional_association_element 15 | actual_part: (open)))))))) 16 | 17 | =================================== 18 | Conflict I - Subtype indication constraint 19 | =================================== 20 | assert new foobar (foo (open)); 21 | --- 22 | 23 | (design_file 24 | (assertion_statement 25 | (conditional_expression 26 | (allocator 27 | (subtype_indication 28 | (type_mark 29 | (simple_name)) 30 | (record_constraint 31 | (record_element_constraint 32 | element: (simple_name) 33 | (array_constraint 34 | (index_constraint 35 | (open)))))))))) 36 | 37 | =================================== 38 | Conflict II - Slice name 39 | =================================== 40 | assert (foo (h downto l)); 41 | --- 42 | 43 | (design_file 44 | (assertion_statement 45 | (conditional_expression 46 | (parenthesized_expression 47 | (slice_name 48 | prefix: (simple_name) 49 | (descending_range 50 | high: (simple_expression 51 | (simple_name)) 52 | low: (simple_expression 53 | (simple_name)))))))) 54 | 55 | =================================== 56 | Conflict II - Subtype indication constraint 57 | =================================== 58 | assert new foobar (foo (h downto l)); 59 | --- 60 | 61 | (design_file 62 | (assertion_statement 63 | (conditional_expression 64 | (allocator 65 | (subtype_indication 66 | (type_mark 67 | (simple_name)) 68 | (record_constraint 69 | (record_element_constraint 70 | element: (simple_name) 71 | (array_constraint 72 | (index_constraint 73 | (descending_range 74 | high: (simple_expression 75 | (simple_name)) 76 | low: (simple_expression 77 | (simple_name)))))))))))) 78 | -------------------------------------------------------------------------------- /test/corpus/declarations/access_type.txt: -------------------------------------------------------------------------------- 1 | ============== 2 | Minimal 3 | ============== 4 | type foo is access bar; 5 | --- 6 | 7 | (design_file 8 | (full_type_declaration 9 | (identifier) 10 | (access_type_definition 11 | (subtype_indication 12 | (type_mark 13 | (simple_name)))))) 14 | -------------------------------------------------------------------------------- /test/corpus/declarations/alias.txt: -------------------------------------------------------------------------------- 1 | =========================== 2 | Designator - Identifier 3 | =========================== 4 | alias a is b; 5 | --- 6 | 7 | (design_file 8 | (alias_declaration 9 | designator: (identifier) 10 | denotator: (simple_name))) 11 | 12 | ============================== 13 | Designator - Character literal 14 | ============================== 15 | alias '0' is STD.STANDARD.'0' [return STD.STANDARD.BIT]; 16 | --- 17 | 18 | (design_file 19 | (alias_declaration 20 | designator: (character_literal) 21 | denotator: (selected_name 22 | prefix: (selected_name 23 | prefix: (simple_name) 24 | suffix: (simple_name)) 25 | suffix: (character_literal)) 26 | (signature 27 | (return 28 | (type_mark 29 | (selected_name 30 | prefix: (selected_name 31 | prefix: (simple_name) 32 | suffix: (simple_name)) 33 | suffix: (simple_name))))))) 34 | 35 | ============================== 36 | Designator - Operator symbol 37 | ============================== 38 | alias "or" is STD.STANDARD."or" [STD.STANDARD.BIT, 39 | STD.STANDARD.BIT 40 | return STD.STANDARD.BIT]; 41 | --- 42 | 43 | (design_file 44 | (alias_declaration 45 | designator: (operator_symbol) 46 | denotator: (selected_name 47 | prefix: (selected_name 48 | prefix: (simple_name) 49 | suffix: (simple_name)) 50 | suffix: (operator_symbol)) 51 | (signature 52 | (type_mark 53 | (selected_name 54 | prefix: (selected_name 55 | prefix: (simple_name) 56 | suffix: (simple_name)) 57 | suffix: (simple_name))) 58 | (type_mark 59 | (selected_name 60 | prefix: (selected_name 61 | prefix: (simple_name) 62 | suffix: (simple_name)) 63 | suffix: (simple_name))) 64 | (return 65 | (type_mark 66 | (selected_name 67 | prefix: (selected_name 68 | prefix: (simple_name) 69 | suffix: (simple_name)) 70 | suffix: (simple_name))))))) 71 | -------------------------------------------------------------------------------- /test/corpus/declarations/architecture_body.txt: -------------------------------------------------------------------------------- 1 | ============================== 2 | Minimal 3 | ============================== 4 | architecture rtl of ent is 5 | begin 6 | end; 7 | 8 | architecture rtl of ent is 9 | begin 10 | end architecture; 11 | 12 | architecture rtl of ent is 13 | begin 14 | end architecture rtl; 15 | --- 16 | 17 | (design_file 18 | (design_unit 19 | (architecture_body 20 | name: (identifier) 21 | entity: (simple_name))) 22 | (design_unit 23 | (architecture_body 24 | name: (identifier) 25 | entity: (simple_name))) 26 | (design_unit 27 | (architecture_body 28 | name: (identifier) 29 | entity: (simple_name) 30 | at_end: (simple_name)))) 31 | -------------------------------------------------------------------------------- /test/corpus/declarations/attribute.txt: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | Declaration 3 | ================================================================================ 4 | attribute a : t; 5 | -------------------------------------------------------------------------------- 6 | 7 | (design_file 8 | (attribute_declaration 9 | (identifier) 10 | (type_mark 11 | (simple_name)))) 12 | 13 | ================================================================================ 14 | Specification 15 | ================================================================================ 16 | attribute attr of e : entity is expr; 17 | -------------------------------------------------------------------------------- 18 | 19 | (design_file 20 | (attribute_specification 21 | (simple_name) 22 | (entity_specification 23 | (entity_name_list 24 | (entity_designator 25 | (simple_name))) 26 | (entity_class)) 27 | (expression 28 | (simple_name)))) 29 | 30 | ================================================================================ 31 | Specification [LRM] I 32 | ================================================================================ 33 | attribute LOCATION of ADDER1 : label is (10,15); 34 | -------------------------------------------------------------------------------- 35 | 36 | (design_file 37 | (attribute_specification 38 | (simple_name) 39 | (entity_specification 40 | (entity_name_list 41 | (entity_designator 42 | (simple_name))) 43 | (entity_class)) 44 | (expression 45 | (aggregate 46 | (positional_element_association 47 | (expression 48 | (integer_decimal))) 49 | (positional_element_association 50 | (expression 51 | (integer_decimal))))))) 52 | 53 | ================================================================================ 54 | Specification [LRM] II 55 | ================================================================================ 56 | attribute IMPLEMENTATION of G1: group is "74LS152"; 57 | -------------------------------------------------------------------------------- 58 | 59 | (design_file 60 | (attribute_specification 61 | (simple_name) 62 | (entity_specification 63 | (entity_name_list 64 | (entity_designator 65 | (simple_name))) 66 | (entity_class)) 67 | (expression 68 | (string_literal)))) 69 | 70 | ================================================================================ 71 | Specification [LRM] III 72 | ================================================================================ 73 | attribute CAPACITANCE of all: signal is 15 pF; 74 | -------------------------------------------------------------------------------- 75 | 76 | (design_file 77 | (attribute_specification 78 | name: (simple_name) 79 | (entity_specification 80 | (entity_name_list 81 | (all)) 82 | (entity_class)) 83 | (expression 84 | (physical_literal 85 | (integer_decimal) 86 | unit: (simple_name))))) 87 | 88 | ================================================================================ 89 | Xilinx Attribute I 90 | ================================================================================ 91 | attribute ASYNC_REG : string; 92 | attribute ASYNC_REG of sync_regs : signal is "TRUE"; 93 | attribute ASYNC_REG : boolean; 94 | attribute ASYNC_REG of sync_regs : signal is true; 95 | -------------------------------------------------------------------------------- 96 | 97 | (design_file 98 | (attribute_declaration 99 | (identifier) 100 | (type_mark 101 | (simple_name))) 102 | (attribute_specification 103 | (simple_name) 104 | (entity_specification 105 | (entity_name_list 106 | (entity_designator 107 | (simple_name))) 108 | (entity_class)) 109 | (expression 110 | (string_literal))) 111 | (attribute_declaration 112 | (identifier) 113 | (type_mark 114 | (simple_name))) 115 | (attribute_specification 116 | (simple_name) 117 | (entity_specification 118 | (entity_name_list 119 | (entity_designator 120 | (simple_name))) 121 | (entity_class)) 122 | (expression 123 | (simple_name)))) 124 | -------------------------------------------------------------------------------- /test/corpus/declarations/component.txt: -------------------------------------------------------------------------------- 1 | ============================= 2 | Minimal 3 | ============================= 4 | component c 5 | end component; 6 | 7 | component c is 8 | end component; 9 | 10 | component c is 11 | end component c; 12 | --- 13 | 14 | (design_file 15 | (component_declaration 16 | name: (identifier)) 17 | (component_declaration 18 | name: (identifier)) 19 | (component_declaration 20 | name: (identifier) 21 | at_end: (simple_name))) 22 | 23 | ============================= 24 | Header 25 | ============================= 26 | component c 27 | generic (k : t); 28 | port (s : t); 29 | end component; 30 | --- 31 | 32 | (design_file 33 | (component_declaration 34 | name: (identifier) 35 | (component_header 36 | (generic_clause 37 | (constant_interface_declaration 38 | (identifier_list 39 | (identifier)) 40 | (subtype_indication 41 | (type_mark 42 | (simple_name)))) 43 | (semicolon)) 44 | (port_clause 45 | (signal_interface_declaration 46 | (identifier_list 47 | (identifier)) 48 | (subtype_indication 49 | (type_mark 50 | (simple_name)))) 51 | (semicolon))))) 52 | 53 | ============================= 54 | LINT: Missing semicolon 55 | ============================= 56 | component c 57 | generic (k:t) -- here 58 | port (s:t) -- here 59 | end component; 60 | --- 61 | 62 | (design_file 63 | (component_declaration 64 | name: (identifier) 65 | (component_header 66 | (generic_clause 67 | (constant_interface_declaration 68 | (identifier_list 69 | (identifier)) 70 | (subtype_indication 71 | (type_mark 72 | (simple_name))))) 73 | (comment) 74 | (port_clause 75 | (signal_interface_declaration 76 | (identifier_list 77 | (identifier)) 78 | (subtype_indication 79 | (type_mark 80 | (simple_name)))))) 81 | (comment))) 82 | 83 | ============================= 84 | LINT: Illegal headers 85 | ============================= 86 | -- Illegal 87 | component c 88 | generic map (x); 89 | port map (x); 90 | end component; 91 | 92 | -- Duplicated 93 | component c 94 | generic (k:t); 95 | generic (k:t); 96 | end component; 97 | 98 | -- Duplicated 99 | component c 100 | port (s:t); 101 | port (s:t); 102 | end component; 103 | 104 | -- Wrong order 105 | component c 106 | port (s:t); 107 | generic (k:t); 108 | end component; 109 | --- 110 | 111 | (design_file 112 | (comment) 113 | (component_declaration 114 | name: (identifier) 115 | (component_header 116 | (generic_map_aspect 117 | (association_list 118 | (positional_association_element 119 | actual_part: (expression 120 | (simple_name)))) 121 | (semicolon)) 122 | (port_map_aspect 123 | (association_list 124 | (positional_association_element 125 | actual_part: (expression 126 | (simple_name)))) 127 | (semicolon)))) 128 | (comment) 129 | (component_declaration 130 | name: (identifier) 131 | (component_header 132 | (generic_clause 133 | (constant_interface_declaration 134 | (identifier_list 135 | (identifier)) 136 | (subtype_indication 137 | (type_mark 138 | (simple_name)))) 139 | (semicolon)) 140 | (generic_clause 141 | (constant_interface_declaration 142 | (identifier_list 143 | (identifier)) 144 | (subtype_indication 145 | (type_mark 146 | (simple_name)))) 147 | (semicolon)))) 148 | (comment) 149 | (component_declaration 150 | name: (identifier) 151 | (component_header 152 | (port_clause 153 | (signal_interface_declaration 154 | (identifier_list 155 | (identifier)) 156 | (subtype_indication 157 | (type_mark 158 | (simple_name)))) 159 | (semicolon)) 160 | (port_clause 161 | (signal_interface_declaration 162 | (identifier_list 163 | (identifier)) 164 | (subtype_indication 165 | (type_mark 166 | (simple_name)))) 167 | (semicolon)))) 168 | (comment) 169 | (component_declaration 170 | name: (identifier) 171 | (component_header 172 | (port_clause 173 | (signal_interface_declaration 174 | (identifier_list 175 | (identifier)) 176 | (subtype_indication 177 | (type_mark 178 | (simple_name)))) 179 | (semicolon)) 180 | (generic_clause 181 | (constant_interface_declaration 182 | (identifier_list 183 | (identifier)) 184 | (subtype_indication 185 | (type_mark 186 | (simple_name)))) 187 | (semicolon))))) 188 | -------------------------------------------------------------------------------- /test/corpus/declarations/composite_type.txt: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | Unbounded array type I 3 | ================================================================================ 4 | type att_t is array (a range <>) of b; 5 | -------------------------------------------------------------------------------- 6 | 7 | (design_file 8 | (full_type_declaration 9 | name: (identifier) 10 | (unbounded_array_definition 11 | (index_subtype_definition 12 | (type_mark 13 | (simple_name)) 14 | (any)) 15 | element: (subtype_indication 16 | (type_mark 17 | (simple_name)))))) 18 | 19 | ================================================================================ 20 | Unbounded array type II 21 | ================================================================================ 22 | type att_t is array (a range <>, b range <>) of c; 23 | -------------------------------------------------------------------------------- 24 | 25 | (design_file 26 | (full_type_declaration 27 | name: (identifier) 28 | (unbounded_array_definition 29 | (index_subtype_definition 30 | (type_mark 31 | (simple_name)) 32 | (any)) 33 | (index_subtype_definition 34 | (type_mark 35 | (simple_name)) 36 | (any)) 37 | element: (subtype_indication 38 | (type_mark 39 | (simple_name)))))) 40 | 41 | ================================================================================ 42 | Constrained array type - Subtype indication 43 | ================================================================================ 44 | type att_t is array (subtype_t) of foo; 45 | -------------------------------------------------------------------------------- 46 | 47 | (design_file 48 | (full_type_declaration 49 | name: (identifier) 50 | (constrained_array_definition 51 | (index_constraint 52 | (subtype_indication 53 | (type_mark 54 | (simple_name)))) 55 | element: (subtype_indication 56 | (type_mark 57 | (simple_name)))))) 58 | 59 | ================================================================================ 60 | Constrained array type - Range 61 | ================================================================================ 62 | type att_t is array (7 downto 0) of foo; 63 | -------------------------------------------------------------------------------- 64 | 65 | (design_file 66 | (full_type_declaration 67 | name: (identifier) 68 | (constrained_array_definition 69 | (index_constraint 70 | (descending_range 71 | high: (simple_expression 72 | (integer_decimal)) 73 | low: (simple_expression 74 | (integer_decimal)))) 75 | element: (subtype_indication 76 | (type_mark 77 | (simple_name)))))) 78 | 79 | ================================================================================ 80 | Record type I 81 | ================================================================================ 82 | type rec_t is 83 | record 84 | e1 : elemt_t; 85 | end record; 86 | -------------------------------------------------------------------------------- 87 | 88 | (design_file 89 | (full_type_declaration 90 | name: (identifier) 91 | (record_type_definition 92 | (element_declaration 93 | (identifier_list 94 | (identifier)) 95 | (subtype_indication 96 | (type_mark 97 | (simple_name))))))) 98 | 99 | ================================================================================ 100 | Record type II 101 | ================================================================================ 102 | type rec_t is 103 | record 104 | e1 : arr (st); 105 | end record; 106 | -------------------------------------------------------------------------------- 107 | 108 | (design_file 109 | (full_type_declaration 110 | name: (identifier) 111 | (record_type_definition 112 | (element_declaration 113 | (identifier_list 114 | (identifier)) 115 | (subtype_indication 116 | (type_mark 117 | (simple_name)) 118 | (array_constraint 119 | (index_constraint 120 | (subtype_indication 121 | (type_mark 122 | (simple_name)))))))))) 123 | 124 | ================================================================================ 125 | Record type III 126 | ================================================================================ 127 | type rec_t is 128 | record 129 | e1 : elemt_t; 130 | e2, e3 : elemt_t; 131 | end record rec_t; 132 | -------------------------------------------------------------------------------- 133 | 134 | (design_file 135 | (full_type_declaration 136 | name: (identifier) 137 | (record_type_definition 138 | (element_declaration 139 | (identifier_list 140 | (identifier)) 141 | (subtype_indication 142 | (type_mark 143 | (simple_name)))) 144 | (element_declaration 145 | (identifier_list 146 | (identifier) 147 | (identifier)) 148 | (subtype_indication 149 | (type_mark 150 | (simple_name)))) 151 | at_end: (simple_name)))) 152 | -------------------------------------------------------------------------------- /test/corpus/declarations/configuration.txt: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | Minimal 3 | ================================================================================ 4 | configuration cfg of ent is 5 | end; 6 | 7 | configuration cfg of ent is 8 | end configuration; 9 | 10 | configuration cfg of ent is 11 | end configuration cfg; 12 | -------------------------------------------------------------------------------- 13 | 14 | (design_file 15 | (design_unit 16 | (configuration_declaration 17 | name: (identifier) 18 | entity: (simple_name))) 19 | (design_unit 20 | (configuration_declaration 21 | name: (identifier) 22 | entity: (simple_name))) 23 | (design_unit 24 | (configuration_declaration 25 | name: (identifier) 26 | entity: (simple_name) 27 | at_end: (simple_name)))) 28 | 29 | ================================================================================ 30 | Expanded name 31 | ================================================================================ 32 | configuration cfg of lib.ent is 33 | end; 34 | -------------------------------------------------------------------------------- 35 | 36 | (design_file 37 | (design_unit 38 | (configuration_declaration 39 | name: (identifier) 40 | entity: (selected_name 41 | prefix: (simple_name) 42 | suffix: (simple_name))))) 43 | 44 | ================================================================================ 45 | Block configuration - Minimal 46 | ================================================================================ 47 | configuration cfg of ent is 48 | for arch 49 | end for; 50 | end; 51 | 52 | configuration cfg of ent is 53 | for gen(GEN1) 54 | end for; 55 | end; 56 | 57 | configuration cfg of ent is 58 | for gen(0 to 1) 59 | end for; 60 | end; 61 | 62 | configuration cfg of ent is 63 | for gen(1+1) 64 | end for; 65 | end; 66 | -------------------------------------------------------------------------------- 67 | 68 | (design_file 69 | (design_unit 70 | (configuration_declaration 71 | name: (identifier) 72 | entity: (simple_name) 73 | (block_configuration 74 | (block_specification 75 | name_or_label: (simple_name))))) 76 | (design_unit 77 | (configuration_declaration 78 | name: (identifier) 79 | entity: (simple_name) 80 | (block_configuration 81 | (block_specification 82 | (generate_statement_element 83 | label: (simple_name) 84 | specification: (simple_name)))))) 85 | (design_unit 86 | (configuration_declaration 87 | name: (identifier) 88 | entity: (simple_name) 89 | (block_configuration 90 | (block_specification 91 | (generate_statement_element 92 | label: (simple_name) 93 | specification: (ascending_range 94 | low: (simple_expression 95 | (integer_decimal)) 96 | high: (simple_expression 97 | (integer_decimal)))))))) 98 | (design_unit 99 | (configuration_declaration 100 | name: (identifier) 101 | entity: (simple_name) 102 | (block_configuration 103 | (block_specification 104 | (generate_statement_element 105 | label: (simple_name) 106 | specification: (expression 107 | (simple_expression 108 | (integer_decimal) 109 | (integer_decimal))))))))) 110 | 111 | ================================================================================ 112 | LRM 3.4.1 113 | ================================================================================ 114 | library TTL, Work; 115 | configuration V4_27_87 of Processor is 116 | use Work.all; 117 | for Structure_View 118 | for A1: ALU 119 | use configuration TTL.SN74LS181; 120 | end for; 121 | for M1,M2,M3: MUX 122 | use entity Multiplex4 (Behavior); 123 | end for; 124 | for all: Latch 125 | -- use defaults 126 | end for; 127 | end for; 128 | end configuration V4_27_87; 129 | -------------------------------------------------------------------------------- 130 | 131 | (design_file 132 | (design_unit 133 | (context_clause 134 | (library_clause 135 | (logical_name_list 136 | library: (simple_name) 137 | library: (simple_name)))) 138 | (configuration_declaration 139 | name: (identifier) 140 | entity: (simple_name) 141 | (declarative_part 142 | (use_clause 143 | (selected_name 144 | prefix: (simple_name) 145 | suffix: (all)))) 146 | (block_configuration 147 | (block_specification 148 | name_or_label: (simple_name)) 149 | (component_configuration 150 | (instantiation_list 151 | (simple_name)) 152 | component: (simple_name) 153 | (binding_indication 154 | (configuration_instantiation 155 | configuration: (selected_name 156 | prefix: (simple_name) 157 | suffix: (simple_name))))) 158 | (component_configuration 159 | (instantiation_list 160 | (simple_name) 161 | (simple_name) 162 | (simple_name)) 163 | component: (simple_name) 164 | (binding_indication 165 | (entity_instantiation 166 | entity: (simple_name) 167 | architecture: (simple_name)))) 168 | (component_configuration 169 | (instantiation_list 170 | (all)) 171 | component: (simple_name) 172 | (comment))) 173 | at_end: (simple_name)))) 174 | -------------------------------------------------------------------------------- /test/corpus/declarations/configuration_specification.txt: -------------------------------------------------------------------------------- 1 | ============================================= 2 | Simple configuration specification 3 | ============================================= 4 | for l : c 5 | use open; 6 | 7 | for l : c 8 | use open; 9 | end for; 10 | --- 11 | 12 | (design_file 13 | (configuration_specification 14 | (instantiation_list 15 | (simple_name)) 16 | component: (simple_name) 17 | (binding_indication (open))) 18 | (configuration_specification 19 | (instantiation_list 20 | (simple_name)) 21 | component: (simple_name) 22 | (binding_indication (open)))) 23 | 24 | ============================================= 25 | Compound configuration specification 26 | ============================================= 27 | for l : c 28 | use open; 29 | use vunit vu; 30 | end for; 31 | --- 32 | 33 | (design_file 34 | (configuration_specification 35 | (instantiation_list 36 | (simple_name)) 37 | component: (simple_name) 38 | (binding_indication (open)) 39 | (verification_unit_binding_indication 40 | (verification_unit_list 41 | (simple_name))))) 42 | 43 | ============================================= 44 | Instantiation list 45 | ============================================= 46 | for l1, l2 : c 47 | use open; 48 | 49 | for others : c 50 | use open; 51 | 52 | for all : c 53 | use open; 54 | --- 55 | 56 | (design_file 57 | (configuration_specification 58 | (instantiation_list 59 | (simple_name) 60 | (simple_name)) 61 | component: (simple_name) 62 | (binding_indication (open))) 63 | (configuration_specification 64 | (instantiation_list (others)) 65 | component: (simple_name) 66 | (binding_indication (open))) 67 | (configuration_specification 68 | (instantiation_list (all)) 69 | component: (simple_name) 70 | (binding_indication (open)))) 71 | 72 | ============================================= 73 | Binding indication - Entity aspect 74 | ============================================= 75 | for all : c 76 | use entity e; 77 | 78 | for all : c 79 | use entity e(a); 80 | 81 | for all : c 82 | use configuration c; 83 | 84 | for all : c 85 | use open; 86 | --- 87 | 88 | (design_file 89 | (configuration_specification 90 | (instantiation_list (all)) 91 | component: (simple_name) 92 | (binding_indication 93 | (entity_instantiation 94 | entity: (simple_name)))) 95 | (configuration_specification 96 | (instantiation_list (all)) 97 | component: (simple_name) 98 | (binding_indication 99 | (entity_instantiation 100 | entity: (simple_name) 101 | architecture: (simple_name)))) 102 | (configuration_specification 103 | (instantiation_list (all)) 104 | component: (simple_name) 105 | (binding_indication 106 | (configuration_instantiation 107 | configuration: (simple_name)))) 108 | (configuration_specification 109 | (instantiation_list (all)) 110 | component: (simple_name) 111 | (binding_indication (open)))) 112 | 113 | ============================================= 114 | Binding indication - Generic map aspects 115 | ============================================= 116 | for all : c 117 | generic map (a); 118 | --- 119 | 120 | (design_file 121 | (configuration_specification 122 | (instantiation_list 123 | (all)) 124 | component: (simple_name) 125 | (binding_indication 126 | (generic_map_aspect 127 | (association_list 128 | (positional_association_element 129 | actual_part: (expression 130 | (simple_name)))))))) 131 | 132 | ============================================= 133 | Binding indication - Port map aspects 134 | ============================================= 135 | for all : c 136 | port map (a); 137 | --- 138 | 139 | (design_file 140 | (configuration_specification 141 | (instantiation_list 142 | (all)) 143 | component: (simple_name) 144 | (binding_indication 145 | (port_map_aspect 146 | (association_list 147 | (positional_association_element 148 | actual_part: (expression 149 | (simple_name)))))))) 150 | 151 | ============================================= 152 | Binding indication - Both map aspects 153 | ============================================= 154 | for all : c 155 | generic map (a) 156 | port map (a); 157 | --- 158 | 159 | (design_file 160 | (configuration_specification 161 | (instantiation_list 162 | (all)) 163 | component: (simple_name) 164 | (binding_indication 165 | (generic_map_aspect 166 | (association_list 167 | (positional_association_element 168 | actual_part: (expression 169 | (simple_name))))) 170 | (port_map_aspect 171 | (association_list 172 | (positional_association_element 173 | actual_part: (expression 174 | (simple_name)))))))) 175 | 176 | ============================================= 177 | LINT: Binding indication (open) 178 | ============================================= 179 | for all : c 180 | use open 181 | generic map (a) -- illegal 182 | port map (a); -- illegal 183 | --- 184 | 185 | (design_file 186 | (configuration_specification 187 | (instantiation_list 188 | (all)) 189 | component: (simple_name) 190 | (binding_indication 191 | (open) 192 | (generic_map_aspect 193 | (association_list 194 | (positional_association_element 195 | actual_part: (expression 196 | (simple_name))))) 197 | (comment) 198 | (port_map_aspect 199 | (association_list 200 | (positional_association_element 201 | actual_part: (expression 202 | (simple_name))))))) 203 | (comment)) 204 | 205 | ============================================= 206 | LINT: Binding indication - Semicolon 207 | ============================================= 208 | for all : c 209 | generic map (x); -- here 210 | port map (x); 211 | --- 212 | 213 | (design_file 214 | (configuration_specification 215 | (instantiation_list 216 | (all)) 217 | component: (simple_name) 218 | (binding_indication 219 | (generic_map_aspect 220 | (association_list 221 | (positional_association_element 222 | actual_part: (expression 223 | (simple_name)))) 224 | (semicolon)) 225 | (comment) 226 | (port_map_aspect 227 | (association_list 228 | (positional_association_element 229 | actual_part: (expression 230 | (simple_name)))))))) 231 | 232 | ============================================= 233 | LINT: Binding indication - Header 234 | ============================================= 235 | -- Illegal 236 | for all : c 237 | generic (k:t) 238 | port (s:t); 239 | 240 | -- Duplicated 241 | for all : c 242 | generic map (x) 243 | generic map (x); 244 | 245 | -- Duplicated 246 | for all : c 247 | port map (x) 248 | port map (x); 249 | 250 | -- Wrong order 251 | for all : c 252 | port map (x) 253 | generic map (x); 254 | --- 255 | 256 | (design_file 257 | (comment) 258 | (configuration_specification 259 | (instantiation_list 260 | (all)) 261 | component: (simple_name) 262 | (binding_indication 263 | (generic_clause 264 | (constant_interface_declaration 265 | (identifier_list 266 | (identifier)) 267 | (subtype_indication 268 | (type_mark 269 | (simple_name))))) 270 | (port_clause 271 | (signal_interface_declaration 272 | (identifier_list 273 | (identifier)) 274 | (subtype_indication 275 | (type_mark 276 | (simple_name))))))) 277 | (comment) 278 | (configuration_specification 279 | (instantiation_list 280 | (all)) 281 | component: (simple_name) 282 | (binding_indication 283 | (generic_map_aspect 284 | (association_list 285 | (positional_association_element 286 | actual_part: (expression 287 | (simple_name))))) 288 | (generic_map_aspect 289 | (association_list 290 | (positional_association_element 291 | actual_part: (expression 292 | (simple_name))))))) 293 | (comment) 294 | (configuration_specification 295 | (instantiation_list 296 | (all)) 297 | component: (simple_name) 298 | (binding_indication 299 | (port_map_aspect 300 | (association_list 301 | (positional_association_element 302 | actual_part: (expression 303 | (simple_name))))) 304 | (port_map_aspect 305 | (association_list 306 | (positional_association_element 307 | actual_part: (expression 308 | (simple_name))))))) 309 | (comment) 310 | (configuration_specification 311 | (instantiation_list 312 | (all)) 313 | component: (simple_name) 314 | (binding_indication 315 | (port_map_aspect 316 | (association_list 317 | (positional_association_element 318 | actual_part: (expression 319 | (simple_name))))) 320 | (generic_map_aspect 321 | (association_list 322 | (positional_association_element 323 | actual_part: (expression 324 | (simple_name)))))))) 325 | -------------------------------------------------------------------------------- /test/corpus/declarations/disconnection.txt: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | Minimal 3 | ================================================================================ 4 | disconnect s : t after 10 ns; 5 | -------------------------------------------------------------------------------- 6 | 7 | (design_file 8 | (disconnection_specification 9 | (guarded_signal_specification 10 | (signal_list 11 | (simple_name)) 12 | (type_mark 13 | (simple_name))) 14 | (time_expression 15 | (physical_literal 16 | (integer_decimal) 17 | unit: (simple_name))))) 18 | 19 | ================================================================================ 20 | Signal list - Multiple signals 21 | ================================================================================ 22 | disconnect all : t after 10 ns; 23 | disconnect others : t after 10 ns; 24 | disconnect s1, s2 : t after 10 ns; 25 | -------------------------------------------------------------------------------- 26 | 27 | (design_file 28 | (disconnection_specification 29 | (guarded_signal_specification 30 | (signal_list 31 | (all)) 32 | (type_mark 33 | (simple_name))) 34 | (time_expression 35 | (physical_literal 36 | (integer_decimal) 37 | unit: (simple_name)))) 38 | (disconnection_specification 39 | (guarded_signal_specification 40 | (signal_list 41 | (others)) 42 | (type_mark 43 | (simple_name))) 44 | (time_expression 45 | (physical_literal 46 | (integer_decimal) 47 | unit: (simple_name)))) 48 | (disconnection_specification 49 | (guarded_signal_specification 50 | (signal_list 51 | (simple_name) 52 | (simple_name)) 53 | (type_mark 54 | (simple_name))) 55 | (time_expression 56 | (physical_literal 57 | (integer_decimal) 58 | unit: (simple_name))))) 59 | -------------------------------------------------------------------------------- /test/corpus/declarations/entity.txt: -------------------------------------------------------------------------------- 1 | =============================== 2 | Minimal 3 | =============================== 4 | entity e is 5 | end; 6 | 7 | entity e is 8 | end entity; 9 | 10 | entity e is 11 | end e; 12 | 13 | entity e is 14 | end entity e; 15 | --- 16 | 17 | (design_file 18 | (design_unit 19 | (entity_declaration 20 | name: (identifier))) 21 | (design_unit 22 | (entity_declaration 23 | name: (identifier))) 24 | (design_unit 25 | (entity_declaration 26 | name: (identifier) 27 | at_end: (simple_name))) 28 | (design_unit 29 | (entity_declaration 30 | name: (identifier) 31 | at_end: (simple_name)))) 32 | -------------------------------------------------------------------------------- /test/corpus/declarations/file_type.txt: -------------------------------------------------------------------------------- 1 | ==================== 2 | Minimal 3 | ==================== 4 | type FT is file of TM; 5 | --- 6 | 7 | (design_file 8 | (full_type_declaration 9 | (identifier) 10 | (file_type_definition 11 | (type_mark 12 | (simple_name))))) 13 | -------------------------------------------------------------------------------- /test/corpus/declarations/group.txt: -------------------------------------------------------------------------------- 1 | ==================================== 2 | Template - Minimal 3 | ==================================== 4 | group g is (signal); 5 | --- 6 | 7 | (design_file 8 | (group_template_declaration 9 | name: (identifier) 10 | (entity_class_entry_list 11 | (entity_class_entry 12 | (entity_class))))) 13 | 14 | ==================================== 15 | Template - Entry list 16 | ==================================== 17 | group g is (signal, signal); 18 | group g is (group <>); 19 | --- 20 | 21 | (design_file 22 | (group_template_declaration 23 | name: (identifier) 24 | (entity_class_entry_list 25 | (entity_class_entry 26 | (entity_class)) 27 | (entity_class_entry 28 | (entity_class)))) 29 | (group_template_declaration 30 | name: (identifier) 31 | (entity_class_entry_list 32 | (entity_class_entry 33 | (entity_class) 34 | (any))))) 35 | 36 | ==================================== 37 | Group declaration - Minimal 38 | ==================================== 39 | group G1 : E (L2); 40 | --- 41 | 42 | (design_file 43 | (group_declaration 44 | name: (identifier) 45 | template: (simple_name) 46 | (group_constituent_list 47 | (simple_name)))) 48 | 49 | ==================================== 50 | Group declaration - LRM I 51 | ==================================== 52 | group G1: RESOURCE (L1, L2); 53 | group G2: RESOURCE (L3, L4, L5); 54 | --- 55 | 56 | (design_file 57 | (group_declaration 58 | name: (identifier) 59 | template: (simple_name) 60 | (group_constituent_list 61 | (simple_name) 62 | (simple_name))) 63 | (group_declaration 64 | name: (identifier) 65 | template: (simple_name) 66 | (group_constituent_list 67 | (simple_name) 68 | (simple_name) 69 | (simple_name)))) 70 | 71 | ==================================== 72 | Group declaration - LRM II 73 | ==================================== 74 | group C2Q: PIN2PIN (PROJECT.GLOBALS.CK, Q); 75 | --- 76 | 77 | (design_file 78 | (group_declaration 79 | name: (identifier) 80 | template: (simple_name) 81 | (group_constituent_list 82 | (selected_name 83 | prefix: (selected_name 84 | prefix: (simple_name) 85 | suffix: (simple_name)) 86 | suffix: (simple_name)) 87 | (simple_name)))) 88 | 89 | ==================================== 90 | Group declaration - LRM III 91 | ==================================== 92 | group CONSTRAINT1: DIFF_CYCLES (G1, G3); 93 | --- 94 | 95 | (design_file 96 | (group_declaration 97 | name: (identifier) 98 | template: (simple_name) 99 | (group_constituent_list 100 | (simple_name) 101 | (simple_name)))) 102 | 103 | -------------------------------------------------------------------------------- /test/corpus/declarations/incomplete_type.txt: -------------------------------------------------------------------------------- 1 | ==================== 2 | Minimal 3 | ==================== 4 | type t; 5 | --- 6 | 7 | (design_file 8 | (incomplete_type_declaration 9 | (identifier))) 10 | -------------------------------------------------------------------------------- /test/corpus/declarations/instantiations.txt: -------------------------------------------------------------------------------- 1 | ==================================== 2 | Subprogram - Minimal 3 | ==================================== 4 | function f is new u; 5 | procedure p is new u; 6 | --- 7 | 8 | (design_file 9 | (function_instantiation_declaration 10 | designator: (identifier) 11 | uninstantiated: (simple_name)) 12 | (procedure_instantiation_declaration 13 | designator: (identifier) 14 | uninstantiated: (simple_name))) 15 | 16 | ==================================== 17 | Subprogram - Signature 18 | ==================================== 19 | function f is new u [return t]; 20 | procedure p is new u [t]; 21 | --- 22 | 23 | (design_file 24 | (function_instantiation_declaration 25 | designator: (identifier) 26 | uninstantiated: (simple_name) 27 | (signature 28 | (return 29 | (type_mark 30 | (simple_name))))) 31 | (procedure_instantiation_declaration 32 | designator: (identifier) 33 | uninstantiated: (simple_name) 34 | (signature 35 | (type_mark 36 | (simple_name))))) 37 | 38 | ==================================== 39 | Subprogram - Generic map aspect 40 | ==================================== 41 | function f is new u 42 | generic map (a); 43 | 44 | procedure p is new u 45 | generic map (a); 46 | --- 47 | 48 | (design_file 49 | (function_instantiation_declaration 50 | designator: (identifier) 51 | uninstantiated: (simple_name) 52 | (subprogram_map_aspect 53 | (generic_map_aspect 54 | (association_list 55 | (positional_association_element 56 | actual_part: (expression 57 | (simple_name))))))) 58 | (procedure_instantiation_declaration 59 | designator: (identifier) 60 | uninstantiated: (simple_name) 61 | (subprogram_map_aspect 62 | (generic_map_aspect 63 | (association_list 64 | (positional_association_element 65 | actual_part: (expression 66 | (simple_name)))))))) 67 | 68 | ============================================ 69 | Subprogram - Conflict resolution - Procedure 70 | ============================================ 71 | procedure p is new u; 72 | procedure p; 73 | --- 74 | 75 | (design_file 76 | (procedure_instantiation_declaration 77 | designator: (identifier) 78 | uninstantiated: (simple_name)) 79 | (procedure_declaration 80 | designator: (identifier))) 81 | 82 | ============================================ 83 | Subprogram - Conflict resolution - Function 84 | ============================================ 85 | function f is new u; 86 | function f return t; 87 | --- 88 | 89 | (design_file 90 | (function_instantiation_declaration 91 | designator: (identifier) 92 | uninstantiated: (simple_name)) 93 | (function_declaration 94 | designator: (identifier) 95 | (return 96 | (type_mark 97 | (simple_name))))) 98 | 99 | ==================================== 100 | Package - Minimal 101 | ==================================== 102 | package p is new u; 103 | --- 104 | 105 | (design_file 106 | (package_instantiation_declaration 107 | name: (identifier) 108 | uninstantiated: (simple_name))) 109 | 110 | ==================================== 111 | Package - Generic map aspect 112 | ==================================== 113 | package p is new u 114 | generic map (a); 115 | --- 116 | 117 | (design_file 118 | (package_instantiation_declaration 119 | name: (identifier) 120 | uninstantiated: (simple_name) 121 | (package_map_aspect 122 | (generic_map_aspect 123 | (association_list 124 | (positional_association_element 125 | actual_part: (expression 126 | (simple_name)))))))) 127 | -------------------------------------------------------------------------------- /test/corpus/declarations/objects.txt: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | Minimal 3 | ================================================================================ 4 | constant k: t; 5 | signal s : t; 6 | variable v: t; 7 | file f : ft; 8 | -------------------------------------------------------------------------------- 9 | 10 | (design_file 11 | (constant_declaration 12 | (identifier_list 13 | (identifier)) 14 | (subtype_indication 15 | (type_mark 16 | (simple_name)))) 17 | (signal_declaration 18 | (identifier_list 19 | (identifier)) 20 | (subtype_indication 21 | (type_mark 22 | (simple_name)))) 23 | (variable_declaration 24 | (identifier_list 25 | (identifier)) 26 | (subtype_indication 27 | (type_mark 28 | (simple_name)))) 29 | (file_declaration 30 | (identifier_list 31 | (identifier)) 32 | (subtype_indication 33 | (type_mark 34 | (simple_name))))) 35 | 36 | ================================================================================ 37 | Identifier list 38 | ================================================================================ 39 | constant k1, k2 : t; 40 | signal s1, s2, s3 : t; 41 | variable v1, v2, v3, v4 : t; 42 | file f1, f2, f3, f4, f5 : ft; 43 | -------------------------------------------------------------------------------- 44 | 45 | (design_file 46 | (constant_declaration 47 | (identifier_list 48 | (identifier) 49 | (identifier)) 50 | (subtype_indication 51 | (type_mark 52 | (simple_name)))) 53 | (signal_declaration 54 | (identifier_list 55 | (identifier) 56 | (identifier) 57 | (identifier)) 58 | (subtype_indication 59 | (type_mark 60 | (simple_name)))) 61 | (variable_declaration 62 | (identifier_list 63 | (identifier) 64 | (identifier) 65 | (identifier) 66 | (identifier)) 67 | (subtype_indication 68 | (type_mark 69 | (simple_name)))) 70 | (file_declaration 71 | (identifier_list 72 | (identifier) 73 | (identifier) 74 | (identifier) 75 | (identifier) 76 | (identifier)) 77 | (subtype_indication 78 | (type_mark 79 | (simple_name))))) 80 | 81 | ================================================================================ 82 | Default expression 83 | ================================================================================ 84 | constant k : t := expr; 85 | signal s : t := expr; 86 | variable v : t := expr; 87 | -------------------------------------------------------------------------------- 88 | 89 | (design_file 90 | (constant_declaration 91 | (identifier_list 92 | (identifier)) 93 | (subtype_indication 94 | (type_mark 95 | (simple_name))) 96 | (default_expression 97 | (simple_name))) 98 | (signal_declaration 99 | (identifier_list 100 | (identifier)) 101 | (subtype_indication 102 | (type_mark 103 | (simple_name))) 104 | (default_expression 105 | (simple_name))) 106 | (variable_declaration 107 | (identifier_list 108 | (identifier)) 109 | (subtype_indication 110 | (type_mark 111 | (simple_name))) 112 | (default_expression 113 | (simple_name)))) 114 | 115 | ================================================================================ 116 | Shared variable 117 | ================================================================================ 118 | shared variable sv : t; 119 | -------------------------------------------------------------------------------- 120 | 121 | (design_file 122 | (shared_variable_declaration 123 | (identifier_list 124 | (identifier)) 125 | (subtype_indication 126 | (type_mark 127 | (simple_name))))) 128 | 129 | ================================================================================ 130 | Signal kind 131 | ================================================================================ 132 | signal s : t bus; 133 | signal s : t register; 134 | -------------------------------------------------------------------------------- 135 | 136 | (design_file 137 | (signal_declaration 138 | (identifier_list 139 | (identifier)) 140 | (subtype_indication 141 | (type_mark 142 | (simple_name))) 143 | (signal_kind)) 144 | (signal_declaration 145 | (identifier_list 146 | (identifier)) 147 | (subtype_indication 148 | (type_mark 149 | (simple_name))) 150 | (signal_kind))) 151 | 152 | ================================================================================ 153 | File open information 154 | ================================================================================ 155 | file f : ft is "fn.ext"; 156 | file f : ft open write_mode is "fn.ext"; 157 | file f : ft open f(x) is "fn.ext"; 158 | -------------------------------------------------------------------------------- 159 | 160 | (design_file 161 | (file_declaration 162 | (identifier_list 163 | (identifier)) 164 | (subtype_indication 165 | (type_mark 166 | (simple_name))) 167 | (file_open_information 168 | (string_expression 169 | (string_literal)))) 170 | (file_declaration 171 | (identifier_list 172 | (identifier)) 173 | (subtype_indication 174 | (type_mark 175 | (simple_name))) 176 | (file_open_information 177 | (file_open_kind 178 | (simple_name)) 179 | (string_expression 180 | (string_literal)))) 181 | (file_declaration 182 | (identifier_list 183 | (identifier)) 184 | (subtype_indication 185 | (type_mark 186 | (simple_name))) 187 | (file_open_information 188 | (file_open_kind 189 | (ambiguous_name 190 | prefix: (simple_name) 191 | (expression_list 192 | (expression 193 | (simple_name))))) 194 | (string_expression 195 | (string_literal))))) 196 | 197 | ================================================================================ 198 | Type Mark - Selected name [LRM] 199 | ================================================================================ 200 | signal S : STANDARD.BIT_VECTOR (1 to 10); 201 | -------------------------------------------------------------------------------- 202 | 203 | (design_file 204 | (signal_declaration 205 | (identifier_list 206 | (identifier)) 207 | (subtype_indication 208 | (type_mark 209 | (selected_name 210 | prefix: (simple_name) 211 | suffix: (simple_name))) 212 | (array_constraint 213 | (index_constraint 214 | (ascending_range 215 | low: (simple_expression 216 | (integer_decimal)) 217 | high: (simple_expression 218 | (integer_decimal)))))))) 219 | 220 | ================================================================================ 221 | Resolution function [LRM] 222 | ================================================================================ 223 | signal OUTPUT: WIRED_OR MULTI_VALUED_LOGIC; 224 | -------------------------------------------------------------------------------- 225 | 226 | (design_file 227 | (signal_declaration 228 | (identifier_list 229 | (identifier)) 230 | (subtype_indication 231 | (resolution_function 232 | (simple_name)) 233 | (type_mark 234 | (simple_name))))) 235 | -------------------------------------------------------------------------------- /test/corpus/declarations/package.txt: -------------------------------------------------------------------------------- 1 | ==================================== 2 | Package declaration - Minimal 3 | ==================================== 4 | package pkg is 5 | end; 6 | 7 | package pkg is 8 | end package; 9 | 10 | package pkg is 11 | end pkg; 12 | 13 | package pkg is 14 | end package pkg; 15 | --- 16 | 17 | (design_file 18 | (package_declaration 19 | name: (identifier)) 20 | (package_declaration 21 | name: (identifier)) 22 | (package_declaration 23 | name: (identifier) 24 | at_end: (simple_name)) 25 | (package_declaration 26 | name: (identifier) 27 | at_end: (simple_name))) 28 | 29 | ========================== 30 | Package body - Minimal 31 | ========================== 32 | package body pkg is 33 | end; 34 | 35 | package body pkg is 36 | end package body; 37 | 38 | package body pkg is 39 | end package body pkg; 40 | --- 41 | 42 | (design_file 43 | (package_body 44 | package: (simple_name)) 45 | (package_body 46 | package: (simple_name)) 47 | (package_body 48 | package: (simple_name) 49 | at_end: (simple_name))) 50 | -------------------------------------------------------------------------------- /test/corpus/declarations/protected_type.txt: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | Minimal 3 | ================================================================================ 4 | type t is 5 | protected 6 | end protected; 7 | 8 | type t is 9 | protected 10 | end protected t; 11 | -------------------------------------------------------------------------------- 12 | 13 | (design_file 14 | (full_type_declaration 15 | name: (identifier) 16 | (protected_type_declaration)) 17 | (full_type_declaration 18 | name: (identifier) 19 | (protected_type_declaration 20 | at_end: (simple_name)))) 21 | 22 | ================================================================================ 23 | LRM I 24 | ================================================================================ 25 | type SharedCounter is protected 26 | procedure increment (N: Integer := 1); 27 | procedure decrement (N: Integer := 1); 28 | impure function value return Integer; 29 | end protected SharedCounter; 30 | -------------------------------------------------------------------------------- 31 | 32 | (design_file 33 | (full_type_declaration 34 | name: (identifier) 35 | (protected_type_declaration 36 | (declarative_part 37 | (procedure_declaration 38 | designator: (identifier) 39 | (procedure_parameter_clause 40 | (constant_interface_declaration 41 | (identifier_list 42 | (identifier)) 43 | (subtype_indication 44 | (type_mark 45 | (simple_name))) 46 | (default_expression 47 | (integer_decimal))))) 48 | (procedure_declaration 49 | designator: (identifier) 50 | (procedure_parameter_clause 51 | (constant_interface_declaration 52 | (identifier_list 53 | (identifier)) 54 | (subtype_indication 55 | (type_mark 56 | (simple_name))) 57 | (default_expression 58 | (integer_decimal))))) 59 | (function_declaration 60 | designator: (identifier) 61 | (return 62 | (type_mark 63 | (simple_name))))) 64 | at_end: (simple_name)))) 65 | -------------------------------------------------------------------------------- /test/corpus/declarations/protected_type_body.txt: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | Minimal 3 | ================================================================================ 4 | type t is 5 | protected body 6 | end protected body; 7 | 8 | type t is 9 | protected body 10 | end protected body t; 11 | -------------------------------------------------------------------------------- 12 | 13 | (design_file 14 | (full_type_declaration 15 | name: (identifier) 16 | (protected_type_body)) 17 | (full_type_declaration 18 | name: (identifier) 19 | (protected_type_body 20 | at_end: (simple_name)))) 21 | 22 | ================================================================================ 23 | LRM I (Simplified) 24 | ================================================================================ 25 | type SharedCounter is protected body 26 | 27 | variable counter: Integer := 0; 28 | 29 | procedure increment (N: Integer := 1) is 30 | begin 31 | counter := counter + N; 32 | end procedure increment; 33 | 34 | end protected body SharedCounter; 35 | -------------------------------------------------------------------------------- 36 | 37 | (design_file 38 | (full_type_declaration 39 | name: (identifier) 40 | (protected_type_body 41 | (declarative_part 42 | (variable_declaration 43 | (identifier_list 44 | (identifier)) 45 | (subtype_indication 46 | (type_mark 47 | (simple_name))) 48 | (default_expression 49 | (integer_decimal))) 50 | (procedure_body 51 | designator: (identifier) 52 | (procedure_parameter_clause 53 | (constant_interface_declaration 54 | (identifier_list 55 | (identifier)) 56 | (subtype_indication 57 | (type_mark 58 | (simple_name))) 59 | (default_expression 60 | (integer_decimal)))) 61 | (sequence_of_statements 62 | (simple_variable_assignment 63 | target: (simple_name) 64 | (expression 65 | (simple_expression 66 | (simple_name) 67 | (simple_name))))) 68 | at_end: (simple_name))) 69 | at_end: (simple_name)))) 70 | -------------------------------------------------------------------------------- /test/corpus/declarations/scalar_type.txt: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | Enumeration type - Minimal 3 | ================================================================================ 4 | type enum_t is ('a'); 5 | type enum_t is (foo); 6 | -------------------------------------------------------------------------------- 7 | 8 | (design_file 9 | (full_type_declaration 10 | name: (identifier) 11 | (enumeration_type_definition 12 | literal: (character_literal))) 13 | (full_type_declaration 14 | name: (identifier) 15 | (enumeration_type_definition 16 | literal: (identifier)))) 17 | 18 | ================================================================================ 19 | Enumeration type - Character type 20 | ================================================================================ 21 | type enum_t is ('a', foo, bar); 22 | -------------------------------------------------------------------------------- 23 | 24 | (design_file 25 | (full_type_declaration 26 | name: (identifier) 27 | (enumeration_type_definition 28 | literal: (character_literal) 29 | literal: (identifier) 30 | literal: (identifier)))) 31 | 32 | ================================================================================ 33 | Integer type definition 34 | ================================================================================ 35 | type int_t is range 0 to 255; 36 | -------------------------------------------------------------------------------- 37 | 38 | (design_file 39 | (full_type_declaration 40 | name: (identifier) 41 | (numeric_type_definition 42 | (ascending_range 43 | low: (simple_expression 44 | (integer_decimal)) 45 | high: (simple_expression 46 | (integer_decimal)))))) 47 | 48 | ================================================================================ 49 | Floating type definition 50 | ================================================================================ 51 | type float_t is range 2.0 to 8.0; 52 | -------------------------------------------------------------------------------- 53 | 54 | (design_file 55 | (full_type_declaration 56 | name: (identifier) 57 | (numeric_type_definition 58 | (ascending_range 59 | low: (simple_expression 60 | (real_decimal)) 61 | high: (simple_expression 62 | (real_decimal)))))) 63 | 64 | ================================================================================ 65 | Physical type definition - Minimal 66 | ================================================================================ 67 | type phy_t is range l to h 68 | units 69 | p; 70 | end units; 71 | -------------------------------------------------------------------------------- 72 | 73 | (design_file 74 | (full_type_declaration 75 | name: (identifier) 76 | (physical_type_definition 77 | (range_constraint 78 | (ascending_range 79 | low: (simple_expression 80 | (simple_name)) 81 | high: (simple_expression 82 | (simple_name)))) 83 | (primary_unit_declaration 84 | name: (identifier))))) 85 | 86 | ================================================================================ 87 | Physical type definition 88 | ================================================================================ 89 | type phy_t is range l to h 90 | units 91 | p; 92 | a = p; 93 | end units; 94 | -------------------------------------------------------------------------------- 95 | 96 | (design_file 97 | (full_type_declaration 98 | name: (identifier) 99 | (physical_type_definition 100 | (range_constraint 101 | (ascending_range 102 | low: (simple_expression 103 | (simple_name)) 104 | high: (simple_expression 105 | (simple_name)))) 106 | (primary_unit_declaration 107 | name: (identifier)) 108 | (secondary_unit_declaration 109 | name: (identifier) 110 | (physical_literal 111 | unit: (simple_name)))))) 112 | 113 | ================================================================================ 114 | Physical type definition - LRM 115 | ================================================================================ 116 | type byte_t is range 0 to 1E16 117 | units 118 | B; 119 | -- decimal 120 | kB = 1000 B; 121 | MB = 1000 kB; 122 | GB = 1000 MB; 123 | TB = 1000 GB; 124 | -- binary 125 | KiB = 1024 B; 126 | MiB = 1024 KiB; 127 | GiB = 1024 MiB; 128 | end units; 129 | -------------------------------------------------------------------------------- 130 | 131 | (design_file 132 | (full_type_declaration 133 | name: (identifier) 134 | (physical_type_definition 135 | (range_constraint 136 | (ascending_range 137 | low: (simple_expression 138 | (integer_decimal)) 139 | high: (simple_expression 140 | (integer_decimal)))) 141 | (primary_unit_declaration 142 | name: (identifier)) 143 | (comment) 144 | (secondary_unit_declaration 145 | name: (identifier) 146 | (physical_literal 147 | (integer_decimal) 148 | unit: (simple_name))) 149 | (secondary_unit_declaration 150 | name: (identifier) 151 | (physical_literal 152 | (integer_decimal) 153 | unit: (simple_name))) 154 | (secondary_unit_declaration 155 | name: (identifier) 156 | (physical_literal 157 | (integer_decimal) 158 | unit: (simple_name))) 159 | (secondary_unit_declaration 160 | name: (identifier) 161 | (physical_literal 162 | (integer_decimal) 163 | unit: (simple_name))) 164 | (comment) 165 | (secondary_unit_declaration 166 | name: (identifier) 167 | (physical_literal 168 | (integer_decimal) 169 | unit: (simple_name))) 170 | (secondary_unit_declaration 171 | name: (identifier) 172 | (physical_literal 173 | (integer_decimal) 174 | unit: (simple_name))) 175 | (secondary_unit_declaration 176 | name: (identifier) 177 | (physical_literal 178 | (integer_decimal) 179 | unit: (simple_name)))))) 180 | -------------------------------------------------------------------------------- /test/corpus/declarations/subprogram.txt: -------------------------------------------------------------------------------- 1 | ========================== 2 | Procedure - Minimal 3 | ========================== 4 | procedure p is 5 | begin 6 | end; 7 | 8 | procedure p is 9 | begin 10 | end procedure; 11 | 12 | procedure p is 13 | begin 14 | end procedure p; 15 | --- 16 | 17 | (design_file 18 | (procedure_body 19 | designator: (identifier)) 20 | (procedure_body 21 | designator: (identifier)) 22 | (procedure_body 23 | designator: (identifier) 24 | at_end: (simple_name))) 25 | 26 | ========================== 27 | Pure function (implicit) - Minimal 28 | ========================== 29 | function f return t is 30 | begin 31 | end; 32 | 33 | function f return t is 34 | begin 35 | end function; 36 | 37 | function f return t is 38 | begin 39 | end function f; 40 | --- 41 | 42 | (design_file 43 | (function_body 44 | designator: (identifier) 45 | (return 46 | (type_mark 47 | (simple_name)))) 48 | (function_body 49 | designator: (identifier) 50 | (return 51 | (type_mark 52 | (simple_name)))) 53 | (function_body 54 | designator: (identifier) 55 | (return 56 | (type_mark 57 | (simple_name))) 58 | at_end: (simple_name))) 59 | 60 | ========================== 61 | Pure function (explicit) - Minimal 62 | ========================== 63 | pure function f return t is 64 | begin 65 | end; 66 | 67 | pure function f return t is 68 | begin 69 | end function; 70 | 71 | pure function f return t is 72 | begin 73 | end function f; 74 | --- 75 | 76 | (design_file 77 | (function_body 78 | designator: (identifier) 79 | (return 80 | (type_mark 81 | (simple_name)))) 82 | (function_body 83 | designator: (identifier) 84 | (return 85 | (type_mark 86 | (simple_name)))) 87 | (function_body 88 | designator: (identifier) 89 | (return 90 | (type_mark 91 | (simple_name))) 92 | at_end: (simple_name))) 93 | 94 | ========================== 95 | Impure function - Minimal 96 | ========================== 97 | impure function f return t is 98 | begin 99 | end; 100 | 101 | impure function f return t is 102 | begin 103 | end function; 104 | 105 | impure function f return t is 106 | begin 107 | end function f; 108 | --- 109 | 110 | (design_file 111 | (function_body 112 | designator: (identifier) 113 | (return 114 | (type_mark 115 | (simple_name)))) 116 | (function_body 117 | designator: (identifier) 118 | (return 119 | (type_mark 120 | (simple_name)))) 121 | (function_body 122 | designator: (identifier) 123 | (return 124 | (type_mark 125 | (simple_name))) 126 | at_end: (simple_name))) 127 | -------------------------------------------------------------------------------- /test/corpus/expressions/allocators.txt: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | Minimal [LRM] 3 | ================================================================================ 4 | assert new Node; 5 | -------------------------------------------------------------------------------- 6 | 7 | (design_file 8 | (assertion_statement 9 | (conditional_expression 10 | (allocator 11 | (subtype_indication 12 | (type_mark 13 | (simple_name))))))) 14 | 15 | ================================================================================ 16 | Qualified expression I [LRM] 17 | ================================================================================ 18 | assert new Node'(Delay => 5 ns, 19 | \Next\ => Stack); 20 | -------------------------------------------------------------------------------- 21 | 22 | (design_file 23 | (assertion_statement 24 | (conditional_expression 25 | (allocator 26 | (qualified_expression 27 | (type_mark 28 | (simple_name)) 29 | (aggregate 30 | (named_element_association 31 | (choices 32 | (simple_expression 33 | (simple_name))) 34 | (expression 35 | (physical_literal 36 | (integer_decimal) 37 | unit: (simple_name)))) 38 | (named_element_association 39 | (choices 40 | (simple_expression 41 | (extended_simple_name))) 42 | (expression 43 | (simple_name))))))))) 44 | 45 | ================================================================================ 46 | Qualified expression II [LRM] 47 | ================================================================================ 48 | assert new CELL'(0, null, null); 49 | -------------------------------------------------------------------------------- 50 | 51 | (design_file 52 | (assertion_statement 53 | (conditional_expression 54 | (allocator 55 | (qualified_expression 56 | (type_mark 57 | (simple_name)) 58 | (aggregate 59 | (positional_element_association 60 | (expression 61 | (integer_decimal))) 62 | (positional_element_association 63 | (expression 64 | (null))) 65 | (positional_element_association 66 | (expression 67 | (null))))))))) 68 | 69 | ================================================================================ 70 | Subtype indication LRM - I 71 | ================================================================================ 72 | assert new String; 73 | assert new String (1 to 10); 74 | -------------------------------------------------------------------------------- 75 | 76 | (design_file 77 | (assertion_statement 78 | (conditional_expression 79 | (allocator 80 | (subtype_indication 81 | (type_mark 82 | (simple_name)))))) 83 | (assertion_statement 84 | (conditional_expression 85 | (allocator 86 | (subtype_indication 87 | (type_mark 88 | (simple_name)) 89 | (array_constraint 90 | (index_constraint 91 | (ascending_range 92 | low: (simple_expression 93 | (integer_decimal)) 94 | high: (simple_expression 95 | (integer_decimal)))))))))) 96 | 97 | ================================================================================ 98 | Subtype indication - LRM II 99 | ================================================================================ 100 | assert new bit_vector (1 to index); 101 | -------------------------------------------------------------------------------- 102 | 103 | (design_file 104 | (assertion_statement 105 | (conditional_expression 106 | (allocator 107 | (subtype_indication 108 | (type_mark 109 | (simple_name)) 110 | (array_constraint 111 | (index_constraint 112 | (ascending_range 113 | low: (simple_expression 114 | (integer_decimal)) 115 | high: (simple_expression 116 | (simple_name)))))))))) 117 | -------------------------------------------------------------------------------- /test/corpus/expressions/expressions.txt: -------------------------------------------------------------------------------- 1 | =================================== 2 | Factor 3 | =================================== 4 | t <= abs a, 5 | not b; 6 | --- 7 | 8 | (design_file 9 | (simple_concurrent_signal_assignment 10 | target: (simple_name) 11 | (waveforms 12 | (waveform_element 13 | (expression 14 | (factor 15 | (simple_name)))) 16 | (waveform_element 17 | (expression 18 | (factor 19 | (simple_name))))))) 20 | 21 | =================================== 22 | Factor - exponentiation 23 | =================================== 24 | t <= a**b; 25 | --- 26 | 27 | (design_file 28 | (simple_concurrent_signal_assignment 29 | target: (simple_name) 30 | (waveforms 31 | (waveform_element 32 | (expression 33 | (exponentiation 34 | (simple_name) 35 | (simple_name))))))) 36 | 37 | =================================== 38 | Factor - logical reduction operation 39 | =================================== 40 | t <= and a, 41 | or a, 42 | nand a, 43 | nor a, 44 | xor a, 45 | xnor a; 46 | --- 47 | 48 | (design_file 49 | (simple_concurrent_signal_assignment 50 | target: (simple_name) 51 | (waveforms 52 | (waveform_element 53 | (expression 54 | (reduction 55 | (simple_name)))) 56 | (waveform_element 57 | (expression 58 | (reduction 59 | (simple_name)))) 60 | (waveform_element 61 | (expression 62 | (reduction 63 | (simple_name)))) 64 | (waveform_element 65 | (expression 66 | (reduction 67 | (simple_name)))) 68 | (waveform_element 69 | (expression 70 | (reduction 71 | (simple_name)))) 72 | (waveform_element 73 | (expression 74 | (reduction 75 | (simple_name))))))) 76 | 77 | =================================== 78 | Associative logical expression 79 | =================================== 80 | t <= a and b and c; 81 | --- 82 | 83 | (design_file 84 | (simple_concurrent_signal_assignment 85 | target: (simple_name) 86 | (waveforms 87 | (waveform_element 88 | (expression 89 | (logical_expression 90 | (simple_name) 91 | (simple_name) 92 | (simple_name))))))) 93 | 94 | =================================== 95 | Term I 96 | =================================== 97 | t <= a * b, 98 | a / b, 99 | a mod b, 100 | a rem b; 101 | --- 102 | 103 | (design_file 104 | (simple_concurrent_signal_assignment 105 | target: (simple_name) 106 | (waveforms 107 | (waveform_element 108 | (expression 109 | (term 110 | (simple_name) 111 | (simple_name)))) 112 | (waveform_element 113 | (expression 114 | (term 115 | (simple_name) 116 | (simple_name)))) 117 | (waveform_element 118 | (expression 119 | (term 120 | (simple_name) 121 | (simple_name)))) 122 | (waveform_element 123 | (expression 124 | (term 125 | (simple_name) 126 | (simple_name))))))) 127 | 128 | =================================== 129 | Term II 130 | =================================== 131 | t <= a * b / c mod d rem e; 132 | --- 133 | 134 | (design_file 135 | (simple_concurrent_signal_assignment 136 | target: (simple_name) 137 | (waveforms 138 | (waveform_element 139 | (expression 140 | (term 141 | (simple_name) 142 | (simple_name) 143 | (simple_name) 144 | (simple_name) 145 | (simple_name))))))) 146 | 147 | =================================== 148 | Simple expression 149 | =================================== 150 | t <= a + b - c; 151 | --- 152 | 153 | (design_file 154 | (simple_concurrent_signal_assignment 155 | target: (simple_name) 156 | (waveforms 157 | (waveform_element 158 | (expression 159 | (simple_expression 160 | (simple_name) 161 | (simple_name) 162 | (simple_name))))))) 163 | 164 | =================================== 165 | Simple expression - Sign 166 | =================================== 167 | t <= -a, -b; 168 | --- 169 | 170 | (design_file 171 | (simple_concurrent_signal_assignment 172 | target: (simple_name) 173 | (waveforms 174 | (waveform_element 175 | (expression 176 | (sign 177 | (simple_name)))) 178 | (waveform_element 179 | (expression 180 | (sign 181 | (simple_name))))))) 182 | 183 | =================================== 184 | Sign 185 | =================================== 186 | t <= - a * b, 187 | - abs a, 188 | - abs b, 189 | - a ** b; 190 | --- 191 | 192 | (design_file 193 | (simple_concurrent_signal_assignment 194 | target: (simple_name) 195 | (waveforms 196 | (waveform_element 197 | (expression 198 | (sign 199 | (term 200 | (simple_name) 201 | (simple_name))))) 202 | (waveform_element 203 | (expression 204 | (sign 205 | (factor 206 | (simple_name))))) 207 | (waveform_element 208 | (expression 209 | (sign 210 | (factor 211 | (simple_name))))) 212 | (waveform_element 213 | (expression 214 | (sign 215 | (exponentiation 216 | (simple_name) 217 | (simple_name)))))))) 218 | 219 | =================================== 220 | Parenthesized expression I 221 | =================================== 222 | t <= (x); 223 | t <= ((x)); 224 | --- 225 | 226 | (design_file 227 | (simple_concurrent_signal_assignment 228 | target: (simple_name) 229 | (waveforms 230 | (waveform_element 231 | (expression 232 | (parenthesized_expression 233 | (simple_name)))))) 234 | (simple_concurrent_signal_assignment 235 | target: (simple_name) 236 | (waveforms 237 | (waveform_element 238 | (expression 239 | (parenthesized_expression 240 | (parenthesized_expression 241 | (simple_name)))))))) 242 | 243 | =================================== 244 | Parenthesized expression II 245 | =================================== 246 | t <= (x(foo'range)); 247 | t <= ((x(foo'range))); 248 | --- 249 | 250 | (design_file 251 | (simple_concurrent_signal_assignment 252 | target: (simple_name) 253 | (waveforms 254 | (waveform_element 255 | (expression 256 | (parenthesized_expression 257 | (slice_name 258 | prefix: (simple_name) 259 | (attribute_name 260 | prefix: (simple_name) 261 | designator: (predefined_designator)))))))) 262 | (simple_concurrent_signal_assignment 263 | target: (simple_name) 264 | (waveforms 265 | (waveform_element 266 | (expression 267 | (parenthesized_expression 268 | (parenthesized_expression 269 | (slice_name 270 | prefix: (simple_name) 271 | (attribute_name 272 | prefix: (simple_name) 273 | designator: (predefined_designator)))))))))) 274 | -------------------------------------------------------------------------------- /test/corpus/expressions/lrm.txt: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | VHDL LRM 9.1 NOTE 2 3 | ================================================================================ 4 | assert (and A) and B; 5 | assert A and (and B); 6 | assert and (and A); 7 | -------------------------------------------------------------------------------- 8 | 9 | (design_file 10 | (assertion_statement 11 | (conditional_expression 12 | (logical_expression 13 | (parenthesized_expression 14 | (reduction 15 | (simple_name))) 16 | (simple_name)))) 17 | (assertion_statement 18 | (conditional_expression 19 | (logical_expression 20 | (simple_name) 21 | (parenthesized_expression 22 | (reduction 23 | (simple_name)))))) 24 | (assertion_statement 25 | (conditional_expression 26 | (reduction 27 | (parenthesized_expression 28 | (reduction 29 | (simple_name))))))) 30 | 31 | ================================================================================ 32 | VHDL LRM 9.2.7 NOTE 33 | ================================================================================ 34 | assert -5 rem 2 >= 0; 35 | -------------------------------------------------------------------------------- 36 | 37 | (design_file 38 | (assertion_statement 39 | (conditional_expression 40 | (relation 41 | (sign 42 | (term 43 | (integer_decimal) 44 | (integer_decimal))) 45 | (integer_decimal))))) 46 | 47 | ================================================================================ 48 | VHDL LRM 9.2.6 NOTE 49 | ================================================================================ 50 | assert A/(+B) > 0; 51 | assert A**(-B) > 0; 52 | -------------------------------------------------------------------------------- 53 | 54 | (design_file 55 | (assertion_statement 56 | (conditional_expression 57 | (relation 58 | (term 59 | (simple_name) 60 | (parenthesized_expression 61 | (sign 62 | (simple_name)))) 63 | (integer_decimal)))) 64 | (assertion_statement 65 | (conditional_expression 66 | (relation 67 | (exponentiation 68 | (simple_name) 69 | (parenthesized_expression 70 | (sign 71 | (simple_name)))) 72 | (integer_decimal))))) 73 | 74 | ================================================================================ 75 | ADA LRM 4.5.0 76 | ================================================================================ 77 | assert not Sunny or Warm; 78 | -------------------------------------------------------------------------------- 79 | 80 | (design_file 81 | (assertion_statement 82 | (conditional_expression 83 | (logical_expression 84 | (factor 85 | (simple_name)) 86 | (simple_name))))) 87 | -------------------------------------------------------------------------------- /test/corpus/expressions/precedence.txt: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | Factor + Term 3 | ================================================================================ 4 | t <= abs a * not b; 5 | t <= abs a * not b * not c; 6 | -------------------------------------------------------------------------------- 7 | 8 | (design_file 9 | (simple_concurrent_signal_assignment 10 | target: (simple_name) 11 | (waveforms 12 | (waveform_element 13 | (expression 14 | (term 15 | (factor 16 | (simple_name)) 17 | (factor 18 | (simple_name))))))) 19 | (simple_concurrent_signal_assignment 20 | target: (simple_name) 21 | (waveforms 22 | (waveform_element 23 | (expression 24 | (term 25 | (factor 26 | (simple_name)) 27 | (factor 28 | (simple_name)) 29 | (factor 30 | (simple_name)))))))) 31 | 32 | ================================================================================ 33 | Factor + Simple Expression 34 | ================================================================================ 35 | t <= abs a + not b; 36 | t <= abs a + not b + not c; 37 | -------------------------------------------------------------------------------- 38 | 39 | (design_file 40 | (simple_concurrent_signal_assignment 41 | target: (simple_name) 42 | (waveforms 43 | (waveform_element 44 | (expression 45 | (simple_expression 46 | (factor 47 | (simple_name)) 48 | (factor 49 | (simple_name))))))) 50 | (simple_concurrent_signal_assignment 51 | target: (simple_name) 52 | (waveforms 53 | (waveform_element 54 | (expression 55 | (simple_expression 56 | (factor 57 | (simple_name)) 58 | (factor 59 | (simple_name)) 60 | (factor 61 | (simple_name)))))))) 62 | 63 | ================================================================================ 64 | Factor + Shift Expression 65 | ================================================================================ 66 | t <= not a sll abs b; 67 | -------------------------------------------------------------------------------- 68 | 69 | (design_file 70 | (simple_concurrent_signal_assignment 71 | target: (simple_name) 72 | (waveforms 73 | (waveform_element 74 | (expression 75 | (shift_expression 76 | (factor 77 | (simple_name)) 78 | (factor 79 | (simple_name)))))))) 80 | 81 | ================================================================================ 82 | Exponentiation + Term 83 | ================================================================================ 84 | t <= a**1 * b**2; 85 | t <= a**1 * b**2 * c**3; 86 | -------------------------------------------------------------------------------- 87 | 88 | (design_file 89 | (simple_concurrent_signal_assignment 90 | target: (simple_name) 91 | (waveforms 92 | (waveform_element 93 | (expression 94 | (term 95 | (exponentiation 96 | (simple_name) 97 | (integer_decimal)) 98 | (exponentiation 99 | (simple_name) 100 | (integer_decimal))))))) 101 | (simple_concurrent_signal_assignment 102 | target: (simple_name) 103 | (waveforms 104 | (waveform_element 105 | (expression 106 | (term 107 | (exponentiation 108 | (simple_name) 109 | (integer_decimal)) 110 | (exponentiation 111 | (simple_name) 112 | (integer_decimal)) 113 | (exponentiation 114 | (simple_name) 115 | (integer_decimal)))))))) 116 | 117 | ================================================================================ 118 | Exponentiation + Simple Expression 119 | ================================================================================ 120 | t <= a**1 + b**2; 121 | t <= a**1 + b**2 + c**3; 122 | -------------------------------------------------------------------------------- 123 | 124 | (design_file 125 | (simple_concurrent_signal_assignment 126 | target: (simple_name) 127 | (waveforms 128 | (waveform_element 129 | (expression 130 | (simple_expression 131 | (exponentiation 132 | (simple_name) 133 | (integer_decimal)) 134 | (exponentiation 135 | (simple_name) 136 | (integer_decimal))))))) 137 | (simple_concurrent_signal_assignment 138 | target: (simple_name) 139 | (waveforms 140 | (waveform_element 141 | (expression 142 | (simple_expression 143 | (exponentiation 144 | (simple_name) 145 | (integer_decimal)) 146 | (exponentiation 147 | (simple_name) 148 | (integer_decimal)) 149 | (exponentiation 150 | (simple_name) 151 | (integer_decimal)))))))) 152 | 153 | ================================================================================ 154 | Exponentiation + Shift Expression 155 | ================================================================================ 156 | t <= a**1 sll b**2; 157 | -------------------------------------------------------------------------------- 158 | 159 | (design_file 160 | (simple_concurrent_signal_assignment 161 | target: (simple_name) 162 | (waveforms 163 | (waveform_element 164 | (expression 165 | (shift_expression 166 | (exponentiation 167 | (simple_name) 168 | (integer_decimal)) 169 | (exponentiation 170 | (simple_name) 171 | (integer_decimal)))))))) 172 | 173 | ================================================================================ 174 | Exponentiation + Factor + Term 175 | ================================================================================ 176 | t <= abs lhs * a**1; 177 | t <= a**1 * not a; 178 | -------------------------------------------------------------------------------- 179 | 180 | (design_file 181 | (simple_concurrent_signal_assignment 182 | target: (simple_name) 183 | (waveforms 184 | (waveform_element 185 | (expression 186 | (term 187 | (factor 188 | (simple_name)) 189 | (exponentiation 190 | (simple_name) 191 | (integer_decimal))))))) 192 | (simple_concurrent_signal_assignment 193 | target: (simple_name) 194 | (waveforms 195 | (waveform_element 196 | (expression 197 | (term 198 | (exponentiation 199 | (simple_name) 200 | (integer_decimal)) 201 | (factor 202 | (simple_name)))))))) 203 | 204 | ================================================================================ 205 | Exponentiation + Factor + Simple Expression 206 | ================================================================================ 207 | t <= abs lhs + a**1; 208 | t <= a**1 + not a; 209 | -------------------------------------------------------------------------------- 210 | 211 | (design_file 212 | (simple_concurrent_signal_assignment 213 | target: (simple_name) 214 | (waveforms 215 | (waveform_element 216 | (expression 217 | (simple_expression 218 | (factor 219 | (simple_name)) 220 | (exponentiation 221 | (simple_name) 222 | (integer_decimal))))))) 223 | (simple_concurrent_signal_assignment 224 | target: (simple_name) 225 | (waveforms 226 | (waveform_element 227 | (expression 228 | (simple_expression 229 | (exponentiation 230 | (simple_name) 231 | (integer_decimal)) 232 | (factor 233 | (simple_name)))))))) 234 | 235 | ================================================================================ 236 | Exponentiation + Factor + Simple Expression 237 | ================================================================================ 238 | t <= abs lhs sll a**1; 239 | t <= a**1 sll abs a; 240 | -------------------------------------------------------------------------------- 241 | 242 | (design_file 243 | (simple_concurrent_signal_assignment 244 | target: (simple_name) 245 | (waveforms 246 | (waveform_element 247 | (expression 248 | (shift_expression 249 | (factor 250 | (simple_name)) 251 | (exponentiation 252 | (simple_name) 253 | (integer_decimal))))))) 254 | (simple_concurrent_signal_assignment 255 | target: (simple_name) 256 | (waveforms 257 | (waveform_element 258 | (expression 259 | (shift_expression 260 | (exponentiation 261 | (simple_name) 262 | (integer_decimal)) 263 | (factor 264 | (simple_name)))))))) 265 | -------------------------------------------------------------------------------- /test/corpus/expressions/qualified_expression.txt: -------------------------------------------------------------------------------- 1 | ========================================================== 2 | Parenthesized expression 3 | ========================================================== 4 | assert foo'(a); 5 | --- 6 | 7 | (design_file 8 | (assertion_statement 9 | (conditional_expression 10 | (qualified_expression 11 | (type_mark 12 | (simple_name)) 13 | (expression 14 | (simple_name)))))) 15 | 16 | ========================================================== 17 | Aggregate - Positional asssociation 18 | ========================================================== 19 | assert foo'(a,b); 20 | --- 21 | 22 | (design_file 23 | (assertion_statement 24 | (conditional_expression 25 | (qualified_expression 26 | (type_mark 27 | (simple_name)) 28 | (aggregate 29 | (positional_element_association 30 | (expression 31 | (simple_name))) 32 | (positional_element_association 33 | (expression 34 | (simple_name)))))))) 35 | 36 | ========================================================== 37 | Aggregate - Named asssociation 38 | ========================================================== 39 | assert foo'(a=>b); 40 | --- 41 | 42 | (design_file 43 | (assertion_statement 44 | (conditional_expression 45 | (qualified_expression 46 | (type_mark 47 | (simple_name)) 48 | (aggregate 49 | (named_element_association 50 | (choices 51 | (simple_expression 52 | (simple_name))) 53 | (expression 54 | (simple_name)))))))) 55 | -------------------------------------------------------------------------------- /test/corpus/expressions/string_expression.txt: -------------------------------------------------------------------------------- 1 | ========================= 2 | Attribute name 3 | ========================= 4 | report integer'image(a); 5 | --- 6 | 7 | (design_file 8 | (report_statement 9 | (string_expression 10 | (attribute_name 11 | prefix: (simple_name) 12 | designator: (predefined_designator) 13 | (expression 14 | (simple_name)))))) 15 | 16 | ========================= 17 | Function 18 | ========================= 19 | report to_string(a); 20 | --- 21 | 22 | (design_file 23 | (report_statement 24 | (string_expression 25 | (ambiguous_name 26 | prefix: (simple_name) 27 | (expression_list 28 | (expression 29 | (simple_name))))))) 30 | 31 | ========================= 32 | Concatenation 33 | ========================= 34 | report "a" & "b"; 35 | --- 36 | 37 | (design_file 38 | (report_statement 39 | (string_expression 40 | (concatenation 41 | (string_literal) 42 | (string_literal))))) 43 | 44 | ========================= 45 | Concatenation II 46 | ========================= 47 | report "a" & "b" & "c"; 48 | --- 49 | 50 | (design_file 51 | (report_statement 52 | (string_expression 53 | (concatenation 54 | (string_literal) 55 | (string_literal) 56 | (string_literal))))) 57 | 58 | -------------------------------------------------------------------------------- /test/corpus/interface_lists/package_interface_declaration.txt: -------------------------------------------------------------------------------- 1 | ============================================================================ 2 | Package interface generic map aspect 3 | ============================================================================ 4 | entity e is 5 | generic ( 6 | package p1 is new up generic map (default); 7 | package p2 is new up generic map (<>) 8 | ); 9 | end entity e; 10 | --- 11 | 12 | (design_file 13 | (design_unit 14 | (entity_declaration 15 | name: (identifier) 16 | (entity_header 17 | (generic_clause 18 | (package_interface_declaration 19 | name: (identifier) 20 | uninstantiated: (simple_name) 21 | (package_map_aspect 22 | (generic_map_aspect 23 | (default)))) 24 | (package_interface_declaration 25 | name: (identifier) 26 | uninstantiated: (simple_name) 27 | (package_map_aspect 28 | (generic_map_aspect 29 | (any)))) 30 | (semicolon))) 31 | at_end: (simple_name)))) 32 | -------------------------------------------------------------------------------- /test/corpus/interface_lists/subprogram_interface_declaration.txt: -------------------------------------------------------------------------------- 1 | ============================================================================ 2 | Interface subprogram default 3 | ============================================================================ 4 | entity e is 5 | generic (impure function f1 return t is <>; 6 | pure function f2 return t is foo.bar); 7 | end; 8 | --- 9 | 10 | (design_file 11 | (design_unit 12 | (entity_declaration 13 | name: (identifier) 14 | (entity_header 15 | (generic_clause 16 | (function_interface_declaration 17 | designator: (identifier) 18 | (return 19 | (type_mark 20 | (simple_name))) 21 | (interface_subprogram_default 22 | (same))) 23 | (function_interface_declaration 24 | designator: (identifier) 25 | (return 26 | (type_mark 27 | (simple_name))) 28 | (interface_subprogram_default 29 | (selected_name 30 | prefix: (simple_name) 31 | suffix: (simple_name)))) 32 | (semicolon)))))) 33 | 34 | -------------------------------------------------------------------------------- /test/corpus/lexical_elements/aggregates.txt: -------------------------------------------------------------------------------- 1 | ============================================ 2 | Positional association 3 | ============================================ 4 | assert (a,b); 5 | assert (a,b,c); 6 | --- 7 | 8 | (design_file 9 | (assertion_statement 10 | (conditional_expression 11 | (aggregate 12 | (positional_element_association 13 | (expression 14 | (simple_name))) 15 | (positional_element_association 16 | (expression 17 | (simple_name)))))) 18 | (assertion_statement 19 | (conditional_expression 20 | (aggregate 21 | (positional_element_association 22 | (expression 23 | (simple_name))) 24 | (positional_element_association 25 | (expression 26 | (simple_name))) 27 | (positional_element_association 28 | (expression 29 | (simple_name))))))) 30 | 31 | ============================================ 32 | Named association 33 | ============================================ 34 | assert (a=>b,c=>d,e=>f); 35 | --- 36 | 37 | (design_file 38 | (assertion_statement 39 | (conditional_expression 40 | (aggregate 41 | (named_element_association 42 | (choices 43 | (simple_expression 44 | (simple_name))) 45 | (expression 46 | (simple_name))) 47 | (named_element_association 48 | (choices 49 | (simple_expression 50 | (simple_name))) 51 | (expression 52 | (simple_name))) 53 | (named_element_association 54 | (choices 55 | (simple_expression 56 | (simple_name))) 57 | (expression 58 | (simple_name))))))) 59 | 60 | ============================================ 61 | Choices 62 | ============================================ 63 | assert (a|b|c=>d); 64 | --- 65 | 66 | (design_file 67 | (assertion_statement 68 | (conditional_expression 69 | (aggregate 70 | (named_element_association 71 | (choices 72 | (simple_expression 73 | (simple_name)) 74 | (simple_expression 75 | (simple_name)) 76 | (simple_expression 77 | (simple_name))) 78 | (expression 79 | (simple_name))))))) 80 | 81 | ============================================ 82 | Others 83 | ============================================ 84 | assert (others=>a); 85 | assert (a,b=>c,others=>d); 86 | --- 87 | 88 | (design_file 89 | (assertion_statement 90 | (conditional_expression 91 | (aggregate 92 | (named_element_association 93 | (choices 94 | (others)) 95 | (expression 96 | (simple_name)))))) 97 | (assertion_statement 98 | (conditional_expression 99 | (aggregate 100 | (positional_element_association 101 | (expression 102 | (simple_name))) 103 | (named_element_association 104 | (choices 105 | (simple_expression 106 | (simple_name))) 107 | (expression 108 | (simple_name))) 109 | (named_element_association 110 | (choices 111 | (others)) 112 | (expression 113 | (simple_name))))))) 114 | 115 | ============================================ 116 | Mixed element associations 117 | ============================================ 118 | assert (a,b=>c); 119 | assert (a,b,c=>d,e=>f); 120 | assert (a,b,c|d=>e,f|g=>h); 121 | --- 122 | 123 | (design_file 124 | (assertion_statement 125 | (conditional_expression 126 | (aggregate 127 | (positional_element_association 128 | (expression 129 | (simple_name))) 130 | (named_element_association 131 | (choices 132 | (simple_expression 133 | (simple_name))) 134 | (expression 135 | (simple_name)))))) 136 | (assertion_statement 137 | (conditional_expression 138 | (aggregate 139 | (positional_element_association 140 | (expression 141 | (simple_name))) 142 | (positional_element_association 143 | (expression 144 | (simple_name))) 145 | (named_element_association 146 | (choices 147 | (simple_expression 148 | (simple_name))) 149 | (expression 150 | (simple_name))) 151 | (named_element_association 152 | (choices 153 | (simple_expression 154 | (simple_name))) 155 | (expression 156 | (simple_name)))))) 157 | (assertion_statement 158 | (conditional_expression 159 | (aggregate 160 | (positional_element_association 161 | (expression 162 | (simple_name))) 163 | (positional_element_association 164 | (expression 165 | (simple_name))) 166 | (named_element_association 167 | (choices 168 | (simple_expression 169 | (simple_name)) 170 | (simple_expression 171 | (simple_name))) 172 | (expression 173 | (simple_name))) 174 | (named_element_association 175 | (choices 176 | (simple_expression 177 | (simple_name)) 178 | (simple_expression 179 | (simple_name))) 180 | (expression 181 | (simple_name))))))) 182 | 183 | ============================================ 184 | Aggregate name on choice 185 | ============================================ 186 | assert (a'high=>b); 187 | --- 188 | 189 | (design_file 190 | (assertion_statement 191 | (conditional_expression 192 | (aggregate 193 | (named_element_association 194 | (choices 195 | (simple_expression 196 | (attribute_name 197 | prefix: (simple_name) 198 | designator: (predefined_designator)))) 199 | (expression 200 | (simple_name))))))) 201 | 202 | ============================================ 203 | Discrete range I 204 | ============================================ 205 | assert (h downto l=>a); 206 | assert (l to h=>a); 207 | --- 208 | 209 | (design_file 210 | (assertion_statement 211 | (conditional_expression 212 | (aggregate 213 | (named_element_association 214 | (choices 215 | (descending_range 216 | high: (simple_expression 217 | (simple_name)) 218 | low: (simple_expression 219 | (simple_name)))) 220 | (expression 221 | (simple_name)))))) 222 | (assertion_statement 223 | (conditional_expression 224 | (aggregate 225 | (named_element_association 226 | (choices 227 | (ascending_range 228 | low: (simple_expression 229 | (simple_name)) 230 | high: (simple_expression 231 | (simple_name)))) 232 | (expression 233 | (simple_name))))))) 234 | 235 | ============================================ 236 | Discrete range II 237 | ============================================ 238 | assert (t'range=>a); 239 | assert (t'reverse_range=>a); 240 | --- 241 | 242 | (design_file 243 | (assertion_statement 244 | (conditional_expression 245 | (aggregate 246 | (named_element_association 247 | (choices 248 | (attribute_name 249 | prefix: (simple_name) 250 | designator: (predefined_designator))) 251 | (expression 252 | (simple_name)))))) 253 | (assertion_statement 254 | (conditional_expression 255 | (aggregate 256 | (named_element_association 257 | (choices 258 | (attribute_name 259 | prefix: (simple_name) 260 | designator: (predefined_designator))) 261 | (expression 262 | (simple_name))))))) 263 | 264 | ============================================ 265 | Discrete range III 266 | ============================================ 267 | assert (t'range(1)=>a); 268 | assert (t'reverse_range(1)=>a); 269 | --- 270 | 271 | (design_file 272 | (assertion_statement 273 | (conditional_expression 274 | (aggregate 275 | (named_element_association 276 | (choices 277 | (attribute_name 278 | prefix: (simple_name) 279 | designator: (predefined_designator) 280 | (expression 281 | (integer_decimal)))) 282 | (expression 283 | (simple_name)))))) 284 | (assertion_statement 285 | (conditional_expression 286 | (aggregate 287 | (named_element_association 288 | (choices 289 | (attribute_name 290 | prefix: (simple_name) 291 | designator: (predefined_designator) 292 | (expression 293 | (integer_decimal)))) 294 | (expression 295 | (simple_name))))))) 296 | -------------------------------------------------------------------------------- /test/corpus/lexical_elements/bit_string_literals.txt: -------------------------------------------------------------------------------- 1 | ============================================ 2 | Minimal 3 | ============================================ 4 | assert b""; 5 | assert o""; 6 | assert x""; 7 | 8 | assert ub""; 9 | assert uo""; 10 | assert ux""; 11 | 12 | assert sb""; 13 | assert so""; 14 | assert sx""; 15 | --- 16 | 17 | (design_file 18 | (assertion_statement 19 | (conditional_expression 20 | (bit_string_literal))) 21 | (assertion_statement 22 | (conditional_expression 23 | (bit_string_literal))) 24 | (assertion_statement 25 | (conditional_expression 26 | (bit_string_literal))) 27 | (assertion_statement 28 | (conditional_expression 29 | (bit_string_literal))) 30 | (assertion_statement 31 | (conditional_expression 32 | (bit_string_literal))) 33 | (assertion_statement 34 | (conditional_expression 35 | (bit_string_literal))) 36 | (assertion_statement 37 | (conditional_expression 38 | (bit_string_literal))) 39 | (assertion_statement 40 | (conditional_expression 41 | (bit_string_literal))) 42 | (assertion_statement 43 | (conditional_expression 44 | (bit_string_literal)))) 45 | 46 | ============================================ 47 | Length 48 | ============================================ 49 | assert 4b"0"; 50 | assert 8ub"0"; 51 | assert 16sb"0"; 52 | 53 | assert 04o"0"; 54 | assert 08uo"0"; 55 | assert 016so"0"; 56 | 57 | assert 004x"0"; 58 | assert 008ux"0"; 59 | assert 0016sx"0"; 60 | --- 61 | 62 | (design_file 63 | (assertion_statement 64 | (conditional_expression 65 | (bit_string_literal))) 66 | (assertion_statement 67 | (conditional_expression 68 | (bit_string_literal))) 69 | (assertion_statement 70 | (conditional_expression 71 | (bit_string_literal))) 72 | (assertion_statement 73 | (conditional_expression 74 | (bit_string_literal))) 75 | (assertion_statement 76 | (conditional_expression 77 | (bit_string_literal))) 78 | (assertion_statement 79 | (conditional_expression 80 | (bit_string_literal))) 81 | (assertion_statement 82 | (conditional_expression 83 | (bit_string_literal))) 84 | (assertion_statement 85 | (conditional_expression 86 | (bit_string_literal))) 87 | (assertion_statement 88 | (conditional_expression 89 | (bit_string_literal)))) 90 | 91 | ============================================ 92 | Bit value 93 | ============================================ 94 | assert b"01"; 95 | assert ub"01"; 96 | assert sb"01"; 97 | 98 | assert o"0123_4567"; 99 | assert uo"0123_4567"; 100 | assert so"0123_4567"; 101 | 102 | assert x"0123_4567"; 103 | assert ux"0123_4567_89AB_CDEF"; 104 | assert sx"0123_4567_89AB_CDEF"; 105 | --- 106 | 107 | (design_file 108 | (assertion_statement 109 | (conditional_expression 110 | (bit_string_literal))) 111 | (assertion_statement 112 | (conditional_expression 113 | (bit_string_literal))) 114 | (assertion_statement 115 | (conditional_expression 116 | (bit_string_literal))) 117 | (assertion_statement 118 | (conditional_expression 119 | (bit_string_literal))) 120 | (assertion_statement 121 | (conditional_expression 122 | (bit_string_literal))) 123 | (assertion_statement 124 | (conditional_expression 125 | (bit_string_literal))) 126 | (assertion_statement 127 | (conditional_expression 128 | (bit_string_literal))) 129 | (assertion_statement 130 | (conditional_expression 131 | (bit_string_literal))) 132 | (assertion_statement 133 | (conditional_expression 134 | (bit_string_literal)))) 135 | 136 | ============================================ 137 | std_match 138 | ============================================ 139 | assert b"--"; 140 | --- 141 | 142 | (design_file 143 | (assertion_statement 144 | (conditional_expression 145 | (bit_string_literal)))) 146 | -------------------------------------------------------------------------------- /test/corpus/lexical_elements/comments.txt: -------------------------------------------------------------------------------- 1 | =========================== 2 | Minimal 3 | =========================== 4 | -- 5 | --- 6 | 7 | (design_file 8 | (comment)) 9 | 10 | =========================== 11 | Multi line - Minimal 12 | =========================== 13 | /**/ 14 | --- 15 | 16 | (design_file 17 | (comment)) 18 | 19 | =========================== 20 | Multi line - Single line 21 | =========================== 22 | /**/ 23 | /***/ 24 | /****/ 25 | /***/ 26 | /**/ 27 | --- 28 | 29 | (design_file 30 | (comment) 31 | (comment) 32 | (comment) 33 | (comment) 34 | (comment)) 35 | 36 | =========================== 37 | Multi line - Multiple lines 38 | =========================== 39 | /* 40 | 41 | 42 | 43 | 44 | 45 | */ 46 | --- 47 | 48 | (design_file 49 | (comment)) 50 | 51 | =========================== 52 | Multi line - Banner 53 | =========================== 54 | /******************************** 55 | *********************************/ 56 | --- 57 | 58 | (design_file 59 | (comment)) 60 | -------------------------------------------------------------------------------- /test/corpus/lexical_elements/null_literal.txt: -------------------------------------------------------------------------------- 1 | ============================================ 2 | Null literal 3 | ============================================ 4 | assert null; 5 | --- 6 | 7 | (design_file 8 | (assertion_statement 9 | (conditional_expression 10 | (null)))) 11 | -------------------------------------------------------------------------------- /test/corpus/lexical_elements/predefined_enumeration_literals.txt: -------------------------------------------------------------------------------- 1 | ============================================================== 2 | Character literal - White spaces (SPACE and NBSP) 3 | ============================================================== 4 | report ' ' & ' '; 5 | --- 6 | 7 | (design_file 8 | (report_statement 9 | (string_expression 10 | (concatenation 11 | (character_literal) 12 | (character_literal))))) 13 | 14 | ============================================================== 15 | Character literal - Apostrophe 16 | ============================================================== 17 | report ''' & '''; 18 | --- 19 | 20 | (design_file 21 | (report_statement 22 | (string_expression 23 | (concatenation 24 | (character_literal) 25 | (character_literal))))) 26 | 27 | ============================================================== 28 | Character literal - Quotation mark 29 | ============================================================== 30 | report '"' & '"'; 31 | --- 32 | 33 | (design_file 34 | (report_statement 35 | (string_expression 36 | (concatenation 37 | (character_literal) 38 | (character_literal))))) 39 | 40 | ============================================================== 41 | Character literal - Backtick 42 | ============================================================== 43 | report '`'; 44 | --- 45 | 46 | (design_file 47 | (report_statement 48 | (string_expression 49 | (character_literal)))) 50 | 51 | ============================================================== 52 | Character literal - Solidus and backslash 53 | ============================================================== 54 | report '/' & '\'; 55 | --- 56 | 57 | (design_file 58 | (report_statement 59 | (string_expression 60 | (concatenation 61 | (character_literal) 62 | (character_literal))))) 63 | 64 | ============================================================== 65 | Character literal - Number signal 66 | ============================================================== 67 | report '#' & 'e'; 68 | --- 69 | 70 | (design_file 71 | (report_statement 72 | (string_expression 73 | (concatenation 74 | (character_literal) 75 | (character_literal))))) 76 | 77 | ============================================================== 78 | Character literal - STD_LOGIC values (upper case) 79 | ============================================================== 80 | report '1' & '0' & 'U' & 'X' & 'W' & 'L' & 'H' & '-'; 81 | --- 82 | 83 | (design_file 84 | (report_statement 85 | (string_expression 86 | (concatenation 87 | (character_literal) 88 | (character_literal) 89 | (character_literal) 90 | (character_literal) 91 | (character_literal) 92 | (character_literal) 93 | (character_literal) 94 | (character_literal))))) 95 | 96 | 97 | ============================================================== 98 | Character literal - STD_LOGIC values (lower case) 99 | ============================================================== 100 | report '1' & '0' & 'u' & 'x' & 'w' & 'l' & 'h' & '-'; 101 | --- 102 | 103 | (design_file 104 | (report_statement 105 | (string_expression 106 | (concatenation 107 | (character_literal) 108 | (character_literal) 109 | (character_literal) 110 | (character_literal) 111 | (character_literal) 112 | (character_literal) 113 | (character_literal) 114 | (character_literal))))) 115 | 116 | ============================================================== 117 | Special characters 118 | ============================================================== 119 | report '"'; 120 | report '!'; 121 | report '$'; 122 | report '%'; 123 | report '\'; 124 | report '^'; 125 | report '{'; 126 | report '}'; 127 | report '''; 128 | report '~'; 129 | 130 | report '¡'; 131 | report '¢'; 132 | report '£'; 133 | report '¤'; 134 | report '¥'; 135 | report '¦'; 136 | report '§'; 137 | report '¨'; 138 | report '©'; 139 | report 'ª'; 140 | report '«'; 141 | report '¬'; 142 | report '®'; 143 | report '¯'; 144 | report '°'; 145 | report '±'; 146 | report '²'; 147 | report '³'; 148 | report '´'; 149 | report 'µ'; 150 | report '¶'; 151 | report '·'; 152 | report '¸'; 153 | report '¹'; 154 | report 'º'; 155 | report '»'; 156 | report '¼'; 157 | report '½'; 158 | report '¾'; 159 | report '¿'; 160 | report '×'; 161 | report '÷'; 162 | report '-'; 163 | --- 164 | 165 | (design_file 166 | (report_statement 167 | (string_expression 168 | (character_literal))) 169 | (report_statement 170 | (string_expression 171 | (character_literal))) 172 | (report_statement 173 | (string_expression 174 | (character_literal))) 175 | (report_statement 176 | (string_expression 177 | (character_literal))) 178 | (report_statement 179 | (string_expression 180 | (character_literal))) 181 | (report_statement 182 | (string_expression 183 | (character_literal))) 184 | (report_statement 185 | (string_expression 186 | (character_literal))) 187 | (report_statement 188 | (string_expression 189 | (character_literal))) 190 | (report_statement 191 | (string_expression 192 | (character_literal))) 193 | (report_statement 194 | (string_expression 195 | (character_literal))) 196 | (report_statement 197 | (string_expression 198 | (character_literal))) 199 | (report_statement 200 | (string_expression 201 | (character_literal))) 202 | (report_statement 203 | (string_expression 204 | (character_literal))) 205 | (report_statement 206 | (string_expression 207 | (character_literal))) 208 | (report_statement 209 | (string_expression 210 | (character_literal))) 211 | (report_statement 212 | (string_expression 213 | (character_literal))) 214 | (report_statement 215 | (string_expression 216 | (character_literal))) 217 | (report_statement 218 | (string_expression 219 | (character_literal))) 220 | (report_statement 221 | (string_expression 222 | (character_literal))) 223 | (report_statement 224 | (string_expression 225 | (character_literal))) 226 | (report_statement 227 | (string_expression 228 | (character_literal))) 229 | (report_statement 230 | (string_expression 231 | (character_literal))) 232 | (report_statement 233 | (string_expression 234 | (character_literal))) 235 | (report_statement 236 | (string_expression 237 | (character_literal))) 238 | (report_statement 239 | (string_expression 240 | (character_literal))) 241 | (report_statement 242 | (string_expression 243 | (character_literal))) 244 | (report_statement 245 | (string_expression 246 | (character_literal))) 247 | (report_statement 248 | (string_expression 249 | (character_literal))) 250 | (report_statement 251 | (string_expression 252 | (character_literal))) 253 | (report_statement 254 | (string_expression 255 | (character_literal))) 256 | (report_statement 257 | (string_expression 258 | (character_literal))) 259 | (report_statement 260 | (string_expression 261 | (character_literal))) 262 | (report_statement 263 | (string_expression 264 | (character_literal))) 265 | (report_statement 266 | (string_expression 267 | (character_literal))) 268 | (report_statement 269 | (string_expression 270 | (character_literal))) 271 | (report_statement 272 | (string_expression 273 | (character_literal))) 274 | (report_statement 275 | (string_expression 276 | (character_literal))) 277 | (report_statement 278 | (string_expression 279 | (character_literal))) 280 | (report_statement 281 | (string_expression 282 | (character_literal))) 283 | (report_statement 284 | (string_expression 285 | (character_literal))) 286 | (report_statement 287 | (string_expression 288 | (character_literal))) 289 | (report_statement 290 | (string_expression 291 | (character_literal))) 292 | (report_statement 293 | (string_expression 294 | (character_literal)))) 295 | 296 | ============================================================== 297 | Character literal - ASCII mnemonics (simple_names) 298 | ============================================================== 299 | report nul; 300 | report ack & nak; 301 | report ack & nak; 302 | report esc & esc; 303 | report ht & vt & cr & lf & ff; 304 | --- 305 | 306 | (design_file 307 | (report_statement 308 | (string_expression 309 | (simple_name))) 310 | (report_statement 311 | (string_expression 312 | (concatenation 313 | (simple_name) 314 | (simple_name)))) 315 | (report_statement 316 | (string_expression 317 | (concatenation 318 | (simple_name) 319 | (simple_name)))) 320 | (report_statement 321 | (string_expression 322 | (concatenation 323 | (simple_name) 324 | (simple_name)))) 325 | (report_statement 326 | (string_expression 327 | (concatenation 328 | (simple_name) 329 | (simple_name) 330 | (simple_name) 331 | (simple_name) 332 | (simple_name))))) 333 | -------------------------------------------------------------------------------- /test/corpus/lexical_elements/string_literals.txt: -------------------------------------------------------------------------------- 1 | ============================================ 2 | Minimal 3 | ============================================ 4 | report ""; 5 | --- 6 | 7 | (design_file 8 | (report_statement 9 | (string_expression 10 | (string_literal)))) 11 | 12 | ============================================ 13 | White space (SPACE) 14 | ============================================ 15 | report " "; 16 | --- 17 | 18 | (design_file 19 | (report_statement 20 | (string_expression 21 | (string_literal)))) 22 | 23 | ============================================ 24 | White space (NBSP) 25 | ============================================ 26 | report " "; 27 | --- 28 | 29 | (design_file 30 | (report_statement 31 | (string_expression 32 | (string_literal)))) 33 | 34 | ============================================================== 35 | Apostrophe 36 | ============================================================== 37 | report "'"; 38 | --- 39 | 40 | (design_file 41 | (report_statement 42 | (string_expression 43 | (string_literal)))) 44 | 45 | ============================================================== 46 | Quotation mark (escape) 47 | ============================================================== 48 | report """"; 49 | --- 50 | 51 | (design_file 52 | (report_statement 53 | (string_expression 54 | (string_literal)))) 55 | 56 | ============================================================== 57 | Underscore 58 | ============================================================== 59 | report "_"; 60 | --- 61 | 62 | (design_file 63 | (report_statement 64 | (string_expression 65 | (string_literal)))) 66 | 67 | ============================================================== 68 | Backslash 69 | ============================================================== 70 | report "\"; 71 | --- 72 | 73 | (design_file 74 | (report_statement 75 | (string_expression 76 | (string_literal)))) 77 | 78 | ============================================================== 79 | Comment 80 | ============================================================== 81 | report "--"; 82 | --- 83 | 84 | (design_file 85 | (report_statement 86 | (string_expression 87 | (string_literal)))) 88 | 89 | ============================================================== 90 | Multi line comment 91 | ============================================================== 92 | report "/*aa*/"; 93 | --- 94 | 95 | (design_file 96 | (report_statement 97 | (string_expression 98 | (string_literal)))) 99 | 100 | ============================================================== 101 | Zeros and ones 102 | ============================================================== 103 | report "010"; 104 | --- 105 | 106 | (design_file 107 | (report_statement 108 | (string_expression 109 | (string_literal)))) 110 | 111 | ============================================================== 112 | Operators symbols 113 | ============================================================== 114 | report "and"; 115 | report ">="; 116 | report "sll"; 117 | report "+"; 118 | report "abs"; 119 | report "**"; 120 | --- 121 | 122 | (design_file 123 | (report_statement 124 | (string_expression 125 | (string_literal))) 126 | (report_statement 127 | (string_expression 128 | (string_literal))) 129 | (report_statement 130 | (string_expression 131 | (string_literal))) 132 | (report_statement 133 | (string_expression 134 | (string_literal))) 135 | (report_statement 136 | (string_expression 137 | (string_literal))) 138 | (report_statement 139 | (string_expression 140 | (string_literal)))) 141 | 142 | ============================================================== 143 | Regex Tokens 144 | ============================================================== 145 | report "^"; 146 | report "$"; 147 | report "."; 148 | report "|"; 149 | report "\"; 150 | report "*"; 151 | report "?"; 152 | report "+"; 153 | report "["; 154 | report "]"; 155 | report "("; 156 | report ")"; 157 | report "{"; 158 | report "}"; 159 | report "#"; 160 | --- 161 | 162 | (design_file 163 | (report_statement 164 | (string_expression 165 | (string_literal))) 166 | (report_statement 167 | (string_expression 168 | (string_literal))) 169 | (report_statement 170 | (string_expression 171 | (string_literal))) 172 | (report_statement 173 | (string_expression 174 | (string_literal))) 175 | (report_statement 176 | (string_expression 177 | (string_literal))) 178 | (report_statement 179 | (string_expression 180 | (string_literal))) 181 | (report_statement 182 | (string_expression 183 | (string_literal))) 184 | (report_statement 185 | (string_expression 186 | (string_literal))) 187 | (report_statement 188 | (string_expression 189 | (string_literal))) 190 | (report_statement 191 | (string_expression 192 | (string_literal))) 193 | (report_statement 194 | (string_expression 195 | (string_literal))) 196 | (report_statement 197 | (string_expression 198 | (string_literal))) 199 | (report_statement 200 | (string_expression 201 | (string_literal))) 202 | (report_statement 203 | (string_expression 204 | (string_literal))) 205 | (report_statement 206 | (string_expression 207 | (string_literal)))) 208 | -------------------------------------------------------------------------------- /test/corpus/names/ambiguos_name.txt: -------------------------------------------------------------------------------- 1 | ============================================================== 2 | Ambiguity I 3 | ============================================================== 4 | -- possible interpretations: 5 | -- (function_call 6 | -- (function_name "foo") 7 | -- (_name "bar")) 8 | -- 9 | -- (type_conversion 10 | -- (type_name "foo") 11 | -- (_name "bar")) 12 | -- 13 | -- (indexed_name 14 | -- (array_name "foo") 15 | -- (_name "bar")) 16 | -- 17 | -- (slice_name 18 | -- (array_name "foo") 19 | -- (subtype_name "bar")) 20 | 21 | assert foo(bar); 22 | --- 23 | 24 | (design_file 25 | (comment) 26 | (comment) 27 | (comment) 28 | (comment) 29 | (comment) 30 | (comment) 31 | (comment) 32 | (comment) 33 | (comment) 34 | (comment) 35 | (comment) 36 | (comment) 37 | (comment) 38 | (comment) 39 | (comment) 40 | (comment) 41 | (assertion_statement 42 | (conditional_expression 43 | (ambiguous_name 44 | prefix: (simple_name) 45 | (expression_list 46 | (expression 47 | (simple_name))))))) 48 | 49 | ============================================================== 50 | Ambiguity II 51 | ============================================================== 52 | -- Possible interpretations: 53 | -- (function_call 54 | -- (function_name "foo") 55 | -- (_name "bar") 56 | -- (_name "baz")) 57 | -- 58 | -- (indexed_name 59 | -- (array_name "foo") 60 | -- (_name "bar") 61 | -- (_name "baz")) 62 | 63 | assert foo(bar, baz); 64 | --- 65 | 66 | (design_file 67 | (comment) 68 | (comment) 69 | (comment) 70 | (comment) 71 | (comment) 72 | (comment) 73 | (comment) 74 | (comment) 75 | (comment) 76 | (comment) 77 | (assertion_statement 78 | (conditional_expression 79 | (ambiguous_name 80 | prefix: (simple_name) 81 | (expression_list 82 | (expression 83 | (simple_name)) 84 | (expression 85 | (simple_name))))))) 86 | 87 | ============================================================== 88 | Ambiguity III 89 | ============================================================== 90 | -- Possible interpretations: 91 | -- (slice_name 92 | -- (function_call ...) 93 | -- (subtype_name "bar")) 94 | -- 95 | -- (indexed_name 96 | -- (function_call ...) 97 | -- (object_name "bar")) 98 | 99 | assert foobar(foo=>bar)(bar); 100 | --- 101 | 102 | (design_file 103 | (comment) 104 | (comment) 105 | (comment) 106 | (comment) 107 | (comment) 108 | (comment) 109 | (comment) 110 | (comment) 111 | (assertion_statement 112 | (conditional_expression 113 | (ambiguous_name 114 | prefix: (function_call 115 | function: (simple_name) 116 | (association_list 117 | (named_association_element 118 | formal_part: (simple_name) 119 | actual_part: (expression 120 | (simple_name))))) 121 | (expression_list 122 | (expression 123 | (simple_name))))))) 124 | 125 | ============================================================== 126 | Ambiguous name on ambiguous name 127 | ============================================================== 128 | assert foo(bar(x)); 129 | --- 130 | 131 | (design_file 132 | (assertion_statement 133 | (conditional_expression 134 | (ambiguous_name 135 | prefix: (simple_name) 136 | (expression_list 137 | (expression 138 | (ambiguous_name 139 | prefix: (simple_name) 140 | (expression_list 141 | (expression 142 | (simple_name)))))))))) 143 | 144 | ============================================================== 145 | PSL Built-ins functions names (not reserved words) 146 | ============================================================== 147 | t <= prev(x); 148 | --- 149 | 150 | (design_file 151 | (simple_concurrent_signal_assignment 152 | target: (simple_name) 153 | (waveforms 154 | (waveform_element 155 | (expression 156 | (ambiguous_name 157 | prefix: (simple_name) 158 | (expression_list 159 | (expression 160 | (simple_name))))))))) 161 | -------------------------------------------------------------------------------- /test/corpus/names/attribute_name.txt: -------------------------------------------------------------------------------- 1 | ============================= 2 | Attribute of attribute 3 | ============================= 4 | assert t'base'left; 5 | --- 6 | 7 | (design_file 8 | (assertion_statement 9 | (conditional_expression 10 | (attribute_name 11 | prefix: (attribute_name 12 | prefix: (simple_name) 13 | designator: (predefined_designator)) 14 | designator: (predefined_designator))))) 15 | 16 | ============================= 17 | External name 18 | ============================= 19 | assert << constant a : foo >>'subtype; 20 | --- 21 | 22 | (design_file 23 | (assertion_statement 24 | (conditional_expression 25 | (attribute_name 26 | prefix: (external_constant_name 27 | (relative_pathname 28 | object: (simple_name)) 29 | (subtype_indication 30 | (type_mark 31 | (simple_name)))) 32 | designator: (predefined_designator))))) 33 | 34 | ============================= 35 | Function call 36 | ============================= 37 | assert foo(a => b)'high; 38 | --- 39 | 40 | (design_file 41 | (assertion_statement 42 | (conditional_expression 43 | (attribute_name 44 | prefix: (function_call 45 | function: (simple_name) 46 | (association_list 47 | (named_association_element 48 | formal_part: (simple_name) 49 | actual_part: (expression 50 | (simple_name))))) 51 | designator: (predefined_designator))))) 52 | 53 | -------------------------------------------------------------------------------- /test/corpus/names/function_call.txt: -------------------------------------------------------------------------------- 1 | =================================== 2 | Ambiguous name I 3 | =================================== 4 | assert fun (obj); 5 | --- 6 | 7 | (design_file 8 | (assertion_statement 9 | (conditional_expression 10 | (ambiguous_name 11 | prefix: (simple_name) 12 | (expression_list 13 | (expression 14 | (simple_name))))))) 15 | 16 | =================================== 17 | Ambiguous name II 18 | =================================== 19 | assert fun (bar, baz); 20 | --- 21 | 22 | (design_file 23 | (assertion_statement 24 | (conditional_expression 25 | (ambiguous_name 26 | prefix: (simple_name) 27 | (expression_list 28 | (expression 29 | (simple_name)) 30 | (expression 31 | (simple_name))))))) 32 | 33 | =================================== 34 | Predefine enumeration literal on actual I 35 | =================================== 36 | assert fun ('+'); 37 | assert fun ("str"); 38 | --- 39 | 40 | (design_file 41 | (assertion_statement 42 | (conditional_expression 43 | (function_call 44 | function: (simple_name) 45 | (association_list 46 | (positional_association_element 47 | actual_part: (character_literal)))))) 48 | (assertion_statement 49 | (conditional_expression 50 | (function_call 51 | function: (simple_name) 52 | (association_list 53 | (positional_association_element 54 | actual_part: (string_literal))))))) 55 | 56 | =================================== 57 | Predefine enumeration literal on actual II 58 | =================================== 59 | assert fun (amb, '+'); 60 | assert fun (amb, "str"); 61 | --- 62 | 63 | (design_file 64 | (assertion_statement 65 | (conditional_expression 66 | (function_call 67 | function: (simple_name) 68 | (association_list 69 | (positional_association_element 70 | actual_part: (expression 71 | (simple_name))) 72 | (positional_association_element 73 | actual_part: (character_literal)))))) 74 | (assertion_statement 75 | (conditional_expression 76 | (function_call 77 | function: (simple_name) 78 | (association_list 79 | (positional_association_element 80 | actual_part: (expression 81 | (simple_name))) 82 | (positional_association_element 83 | actual_part: (string_literal))))))) 84 | 85 | =================================== 86 | Named association element I 87 | =================================== 88 | assert fun (foo => bar); 89 | --- 90 | 91 | (design_file 92 | (assertion_statement 93 | (conditional_expression 94 | (function_call 95 | function: (simple_name) 96 | (association_list 97 | (named_association_element 98 | formal_part: (simple_name) 99 | actual_part: (expression 100 | (simple_name)))))))) 101 | 102 | =================================== 103 | Named association element II 104 | =================================== 105 | assert fun (foo.bar => baz); 106 | --- 107 | 108 | (design_file 109 | (assertion_statement 110 | (conditional_expression 111 | (function_call 112 | function: (simple_name) 113 | (association_list 114 | (named_association_element 115 | formal_part: (selected_name 116 | prefix: (simple_name) 117 | suffix: (simple_name)) 118 | actual_part: (expression 119 | (simple_name)))))))) 120 | 121 | =================================== 122 | Mixed association list 123 | =================================== 124 | assert fun (a, b => c); 125 | --- 126 | 127 | (design_file 128 | (assertion_statement 129 | (conditional_expression 130 | (function_call 131 | function: (simple_name) 132 | (association_list 133 | (positional_association_element 134 | actual_part: (expression 135 | (simple_name))) 136 | (named_association_element 137 | formal_part: (simple_name) 138 | actual_part: (expression 139 | (simple_name)))))))) 140 | 141 | =================================== 142 | Open I 143 | =================================== 144 | assert fun (open); 145 | --- 146 | 147 | (design_file 148 | (assertion_statement 149 | (conditional_expression 150 | (function_call 151 | function: (simple_name) 152 | (association_list 153 | (positional_association_element 154 | actual_part: (open))))))) 155 | 156 | =================================== 157 | Open II 158 | =================================== 159 | assert fun (bar => open); 160 | --- 161 | 162 | (design_file 163 | (assertion_statement 164 | (conditional_expression 165 | (function_call 166 | function: (simple_name) 167 | (association_list 168 | (named_association_element 169 | formal_part: (simple_name) 170 | actual_part: (open))))))) 171 | 172 | =================================== 173 | Open III 174 | =================================== 175 | assert fun (fun (open)); 176 | --- 177 | 178 | (design_file 179 | (assertion_statement 180 | (conditional_expression 181 | (ambiguous_name 182 | prefix: (simple_name) 183 | (expression_list 184 | (expression 185 | (function_call 186 | function: (simple_name) 187 | (association_list 188 | (positional_association_element 189 | actual_part: (open)))))))))) 190 | 191 | =================================== 192 | Prefix - Operator symbol 193 | =================================== 194 | assert "and" (foo, bar); 195 | --- 196 | 197 | (design_file 198 | (assertion_statement 199 | (conditional_expression 200 | (function_call 201 | function: (operator_symbol) 202 | (association_list 203 | (positional_association_element 204 | actual_part: (expression 205 | (simple_name))) 206 | (positional_association_element 207 | actual_part: (expression 208 | (simple_name)))))))) 209 | 210 | =================================== 211 | Prefix - Attribute name 212 | =================================== 213 | assert foo'bar (baz); 214 | --- 215 | 216 | (design_file 217 | (assertion_statement 218 | (conditional_expression 219 | (function_call 220 | function: (attribute_name 221 | prefix: (simple_name) 222 | designator: (simple_name)) 223 | (association_list 224 | (positional_association_element 225 | actual_part: (expression 226 | (simple_name)))))))) 227 | 228 | =================================== 229 | Actual part I (Type conversion) 230 | =================================== 231 | assert fun (t(param) => obj); 232 | --- 233 | 234 | (design_file 235 | (assertion_statement 236 | (conditional_expression 237 | (function_call 238 | function: (simple_name) 239 | (association_list 240 | (named_association_element 241 | formal_part: (ambiguous_name 242 | prefix: (simple_name) 243 | (expression_list 244 | (expression 245 | (simple_name)))) 246 | actual_part: (expression 247 | (simple_name)))))))) 248 | -------------------------------------------------------------------------------- /test/corpus/names/slice_names.txt: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | Ambiguous name I 3 | ================================================================================ 4 | assert arr (st); 5 | -------------------------------------------------------------------------------- 6 | 7 | (design_file 8 | (assertion_statement 9 | (conditional_expression 10 | (ambiguous_name 11 | prefix: (simple_name) 12 | (expression_list 13 | (expression 14 | (simple_name))))))) 15 | 16 | ================================================================================ 17 | Descending range 18 | ================================================================================ 19 | assert arr (h downto l); 20 | -------------------------------------------------------------------------------- 21 | 22 | (design_file 23 | (assertion_statement 24 | (conditional_expression 25 | (slice_name 26 | prefix: (simple_name) 27 | (descending_range 28 | high: (simple_expression 29 | (simple_name)) 30 | low: (simple_expression 31 | (simple_name))))))) 32 | 33 | ================================================================================ 34 | Ascending range 35 | ================================================================================ 36 | assert arr (h to l); 37 | -------------------------------------------------------------------------------- 38 | 39 | (design_file 40 | (assertion_statement 41 | (conditional_expression 42 | (slice_name 43 | prefix: (simple_name) 44 | (ascending_range 45 | low: (simple_expression 46 | (simple_name)) 47 | high: (simple_expression 48 | (simple_name))))))) 49 | 50 | ================================================================================ 51 | Attribute range 52 | ================================================================================ 53 | assert arr (st'range); 54 | assert arr (st'reverse_range); 55 | -------------------------------------------------------------------------------- 56 | 57 | (design_file 58 | (assertion_statement 59 | (conditional_expression 60 | (slice_name 61 | prefix: (simple_name) 62 | (attribute_name 63 | prefix: (simple_name) 64 | designator: (predefined_designator))))) 65 | (assertion_statement 66 | (conditional_expression 67 | (slice_name 68 | prefix: (simple_name) 69 | (attribute_name 70 | prefix: (simple_name) 71 | designator: (predefined_designator)))))) 72 | 73 | ================================================================================ 74 | Prefix 75 | ================================================================================ 76 | assert amb (amb)(h downto l); 77 | -------------------------------------------------------------------------------- 78 | 79 | (design_file 80 | (assertion_statement 81 | (conditional_expression 82 | (slice_name 83 | prefix: (ambiguous_name 84 | prefix: (simple_name) 85 | (expression_list 86 | (expression 87 | (simple_name)))) 88 | (descending_range 89 | high: (simple_expression 90 | (simple_name)) 91 | low: (simple_expression 92 | (simple_name))))))) 93 | 94 | ================================================================================ 95 | Prefix - Selected name 96 | ================================================================================ 97 | assert MAC_CONFIG(i).TypeSwitch(0 to SWITCH_COUNT - 1); 98 | -------------------------------------------------------------------------------- 99 | 100 | (design_file 101 | (assertion_statement 102 | (conditional_expression 103 | (slice_name 104 | prefix: (selected_name 105 | prefix: (ambiguous_name 106 | prefix: (simple_name) 107 | (expression_list 108 | (expression 109 | (simple_name)))) 110 | suffix: (simple_name)) 111 | (ascending_range 112 | low: (simple_expression 113 | (integer_decimal)) 114 | high: (simple_expression 115 | (simple_expression 116 | (simple_name) 117 | (integer_decimal)))))))) 118 | -------------------------------------------------------------------------------- /test/corpus/primary_unit/primary_unit.txt: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | Minimal 3 | ================================================================================ 4 | library ieee; 5 | 6 | entity e is 7 | end entity; 8 | -------------------------------------------------------------------------------- 9 | 10 | (design_file 11 | (design_unit 12 | (context_clause 13 | (library_clause 14 | (logical_name_list 15 | (simple_name)))) 16 | (entity_declaration 17 | (identifier)))) 18 | 19 | ================================================================================ 20 | Logical name list 21 | ================================================================================ 22 | library work, ieee; 23 | 24 | entity e is 25 | end entity; 26 | -------------------------------------------------------------------------------- 27 | 28 | (design_file 29 | (design_unit 30 | (context_clause 31 | (library_clause 32 | (logical_name_list 33 | (simple_name) 34 | (simple_name)))) 35 | (entity_declaration 36 | (identifier)))) 37 | 38 | ================================================================================ 39 | Context declaration - LRM 40 | ================================================================================ 41 | context project_context is 42 | library project_lib; 43 | use project_lib.project_defs.all; 44 | library IP_lib; 45 | context IP_lib.IP_context; 46 | end context project_context; 47 | -------------------------------------------------------------------------------- 48 | 49 | (design_file 50 | (design_unit 51 | (context_declaration 52 | name: (identifier) 53 | (context_clause 54 | (library_clause 55 | (logical_name_list 56 | library: (simple_name))) 57 | (use_clause 58 | (selected_name 59 | prefix: (selected_name 60 | prefix: (simple_name) 61 | suffix: (simple_name)) 62 | suffix: (all))) 63 | (library_clause 64 | (logical_name_list 65 | library: (simple_name))) 66 | (context_reference 67 | (context_list 68 | (selected_name 69 | prefix: (simple_name) 70 | suffix: (simple_name))))) 71 | at_end: (simple_name)))) 72 | -------------------------------------------------------------------------------- /test/corpus/psl/declaration.txt: -------------------------------------------------------------------------------- 1 | ==================================== 2 | Constant Parameter Specification I 3 | ==================================== 4 | sequence s (const c) is {c}; 5 | --- 6 | 7 | (design_file 8 | (PSL_Sequence_Declaration 9 | (PSL_Identifier) 10 | (PSL_Formal_Parameter_List 11 | (PSL_Formal_Parameter 12 | (PSL_Constant_Parameter_Specification) 13 | (PSL_Identifier))) 14 | (PSL_Braced_SERE 15 | (PSL_Boolean 16 | (simple_name))))) 17 | 18 | ==================================== 19 | Constant Parameter Specification II 20 | ==================================== 21 | sequence s (boolean b) is {b}; 22 | --- 23 | 24 | (design_file 25 | (PSL_Sequence_Declaration 26 | (PSL_Identifier) 27 | (PSL_Formal_Parameter_List 28 | (PSL_Formal_Parameter 29 | (PSL_Constant_Parameter_Specification 30 | (PSL_Type_Class)) 31 | (PSL_Identifier))) 32 | (PSL_Braced_SERE 33 | (PSL_Boolean 34 | (simple_name))))) 35 | 36 | ==================================== 37 | Constant Parameter Specification III 38 | ==================================== 39 | sequence s (const boolean b) is {b}; 40 | --- 41 | 42 | (design_file 43 | (PSL_Sequence_Declaration 44 | (PSL_Identifier) 45 | (PSL_Formal_Parameter_List 46 | (PSL_Formal_Parameter 47 | (PSL_Constant_Parameter_Specification 48 | (PSL_Type_Class)) 49 | (PSL_Identifier))) 50 | (PSL_Braced_SERE 51 | (PSL_Boolean 52 | (simple_name))))) 53 | 54 | ==================================== 55 | Constant Parameter Specification IV 56 | ==================================== 57 | sequence s (hdltype t o) is {o}; 58 | --- 59 | 60 | (design_file 61 | (PSL_Sequence_Declaration 62 | (PSL_Identifier) 63 | (PSL_Formal_Parameter_List 64 | (PSL_Formal_Parameter 65 | (PSL_Constant_Parameter_Specification 66 | (PSL_HDL_Type 67 | (subtype_indication 68 | (type_mark 69 | (simple_name))))) 70 | (PSL_Identifier))) 71 | (PSL_Braced_SERE 72 | (PSL_Boolean 73 | (simple_name))))) 74 | 75 | ==================================== 76 | Constant Parameter Specification V 77 | ==================================== 78 | sequence s (const hdltype t o) is {o}; 79 | --- 80 | 81 | (design_file 82 | (PSL_Sequence_Declaration 83 | (PSL_Identifier) 84 | (PSL_Formal_Parameter_List 85 | (PSL_Formal_Parameter 86 | (PSL_Constant_Parameter_Specification 87 | (PSL_HDL_Type 88 | (subtype_indication 89 | (type_mark 90 | (simple_name))))) 91 | (PSL_Identifier))) 92 | (PSL_Braced_SERE 93 | (PSL_Boolean 94 | (simple_name))))) 95 | 96 | ==================================== 97 | Temporal Parameter Specification I 98 | ==================================== 99 | sequence s1 (sequence s2) is s2; 100 | --- 101 | 102 | (design_file 103 | (PSL_Sequence_Declaration 104 | (PSL_Identifier) 105 | (PSL_Formal_Parameter_List 106 | (PSL_Formal_Parameter 107 | (PSL_Temporal_Parameter_Specification) 108 | (PSL_Identifier))) 109 | (PSL_Sequence_Instance 110 | (PSL_Identifier)))) 111 | 112 | ==================================== 113 | Formal parameter list 114 | ==================================== 115 | property s1 (property p; sequence s; const k) is p(s,k); 116 | --- 117 | 118 | (design_file 119 | (PSL_Property_Declaration 120 | (PSL_Identifier) 121 | (PSL_Formal_Parameter_List 122 | (PSL_Formal_Parameter 123 | (PSL_Temporal_Parameter_Specification) 124 | (PSL_Identifier)) 125 | (PSL_Formal_Parameter 126 | (PSL_Temporal_Parameter_Specification) 127 | (PSL_Identifier)) 128 | (PSL_Formal_Parameter 129 | (PSL_Constant_Parameter_Specification) 130 | (PSL_Identifier))) 131 | (PSL_Property_Instance 132 | (PSL_Identifier) 133 | (PSL_Actual_Parameter_List 134 | (PSL_Actual_Parameter 135 | (PSL_Any_Type 136 | (simple_name))) 137 | (PSL_Actual_Parameter 138 | (PSL_Any_Type 139 | (simple_name))))))) 140 | 141 | -------------------------------------------------------------------------------- /test/corpus/psl/sequence.txt: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | Repeated sequence I 3 | ================================================================================ 4 | restrict {a[*2]}; 5 | -------------------------------------------------------------------------------- 6 | 7 | (design_file 8 | (PSL_Restrict_Directive 9 | (PSL_Braced_SERE 10 | (PSL_Repeated_SERE 11 | (PSL_Boolean 12 | (simple_name)) 13 | (PSL_Count 14 | (PSL_Number 15 | (integer_decimal))))))) 16 | 17 | ================================================================================ 18 | Repeated sequence II 19 | ================================================================================ 20 | restrict {a[+]}; 21 | -------------------------------------------------------------------------------- 22 | 23 | (design_file 24 | (PSL_Restrict_Directive 25 | (PSL_Braced_SERE 26 | (PSL_Repeated_SERE 27 | (PSL_Boolean 28 | (simple_name)) 29 | (PSL_Count))))) 30 | 31 | ================================================================================ 32 | Repeated sequence III 33 | ================================================================================ 34 | restrict {a[*]}; 35 | -------------------------------------------------------------------------------- 36 | 37 | (design_file 38 | (PSL_Restrict_Directive 39 | (PSL_Braced_SERE 40 | (PSL_Repeated_SERE 41 | (PSL_Boolean 42 | (simple_name)) 43 | (PSL_Count))))) 44 | 45 | ================================================================================ 46 | Repeated sequence IV 47 | ================================================================================ 48 | restrict {[*]}; 49 | -------------------------------------------------------------------------------- 50 | 51 | (design_file 52 | (PSL_Restrict_Directive 53 | (PSL_Braced_SERE 54 | (PSL_Repeated_SERE 55 | (PSL_Count))))) 56 | 57 | ================================================================================ 58 | Repeated sequence V 59 | ================================================================================ 60 | restrict {a[=2]}; 61 | -------------------------------------------------------------------------------- 62 | 63 | (design_file 64 | (PSL_Restrict_Directive 65 | (PSL_Braced_SERE 66 | (PSL_Repeated_SERE 67 | (PSL_Boolean 68 | (simple_name)) 69 | (PSL_Count 70 | (PSL_Number 71 | (integer_decimal))))))) 72 | 73 | ================================================================================ 74 | Repeated sequence VI 75 | ================================================================================ 76 | restrict {a[*1 to 3]}; 77 | -------------------------------------------------------------------------------- 78 | 79 | (design_file 80 | (PSL_Restrict_Directive 81 | (PSL_Braced_SERE 82 | (PSL_Repeated_SERE 83 | (PSL_Boolean 84 | (simple_name)) 85 | (PSL_Count 86 | (ascending_range 87 | low: (simple_expression 88 | (integer_decimal)) 89 | high: (simple_expression 90 | (integer_decimal)))))))) 91 | 92 | ================================================================================ 93 | Sequence Instantiation - Minimal 94 | ================================================================================ 95 | restrict s; 96 | -------------------------------------------------------------------------------- 97 | 98 | (design_file 99 | (PSL_Restrict_Directive 100 | (PSL_Sequence_Instance 101 | (PSL_Identifier)))) 102 | 103 | ================================================================================ 104 | Sequence Instantiation - LRM I 105 | ================================================================================ 106 | restrict BusArb(breq, back, 3); 107 | -------------------------------------------------------------------------------- 108 | 109 | (design_file 110 | (PSL_Restrict_Directive 111 | (PSL_Sequence_Instance 112 | (PSL_Identifier) 113 | (PSL_Actual_Parameter_List 114 | (PSL_Actual_Parameter 115 | (PSL_Any_Type 116 | (simple_name))) 117 | (PSL_Actual_Parameter 118 | (PSL_Any_Type 119 | (simple_name))) 120 | (PSL_Actual_Parameter 121 | (PSL_Any_Type 122 | (integer_decimal))))))) 123 | 124 | ================================================================================ 125 | Sequence Instantiation - LRM II 126 | ================================================================================ 127 | restrict ReadCycle(BusArb(breq, back, 5), breq, ardy, drdy); 128 | -------------------------------------------------------------------------------- 129 | 130 | (design_file 131 | (PSL_Restrict_Directive 132 | (PSL_Sequence_Instance 133 | (PSL_Identifier) 134 | (PSL_Actual_Parameter_List 135 | (PSL_Actual_Parameter 136 | (PSL_Any_Type 137 | (ambiguous_name 138 | prefix: (simple_name) 139 | (expression_list 140 | (expression 141 | (simple_name)) 142 | (expression 143 | (simple_name)) 144 | (expression 145 | (integer_decimal)))))) 146 | (PSL_Actual_Parameter 147 | (PSL_Any_Type 148 | (simple_name))) 149 | (PSL_Actual_Parameter 150 | (PSL_Any_Type 151 | (simple_name))) 152 | (PSL_Actual_Parameter 153 | (PSL_Any_Type 154 | (simple_name))))))) 155 | -------------------------------------------------------------------------------- /test/corpus/psl/test.txt: -------------------------------------------------------------------------------- 1 | ================================ 2 | Assertion Statement 3 | ================================ 4 | assert a and b; 5 | assert (a and b); 6 | --- 7 | 8 | (design_file 9 | (assertion_statement 10 | (conditional_expression 11 | (logical_expression 12 | (simple_name) 13 | (simple_name)))) 14 | (assertion_statement 15 | (conditional_expression 16 | (parenthesized_expression 17 | (logical_expression 18 | (simple_name) 19 | (simple_name)))))) 20 | 21 | ================================ 22 | Assert Directive - Implication 23 | ================================ 24 | assert a -> b; 25 | assert (a -> b); 26 | --- 27 | 28 | (design_file 29 | (PSL_Assert_Directive 30 | (PSL_Expression 31 | (PSL_Boolean 32 | (simple_name)) 33 | (PSL_Boolean 34 | (simple_name)))) 35 | (PSL_Assert_Directive 36 | (PSL_Parenthesized_FL_Property 37 | (PSL_Expression 38 | (PSL_Boolean 39 | (simple_name)) 40 | (PSL_Boolean 41 | (simple_name)))))) 42 | 43 | ================================ 44 | Function call - Next 45 | ================================ 46 | assert next(x); 47 | assert foo(x); 48 | 49 | foo <= next(x); 50 | --- 51 | 52 | (design_file 53 | (PSL_Assert_Directive 54 | (PSL_Built_In_Function_Call 55 | (PSL_Any_Type 56 | (simple_name)))) 57 | (assertion_statement 58 | (conditional_expression 59 | (ambiguous_name 60 | prefix: (simple_name) 61 | (expression_list 62 | (expression 63 | (simple_name)))))) 64 | (simple_concurrent_signal_assignment 65 | target: (simple_name) 66 | (waveforms 67 | (waveform_element 68 | (expression 69 | (ambiguous_name 70 | prefix: (simple_name) 71 | (expression_list 72 | (expression 73 | (simple_name))))))))) 74 | 75 | ================================ 76 | Function call - Sequence I 77 | ================================ 78 | assert nondet({x}); 79 | assert nondet({x,y}); 80 | --- 81 | 82 | (design_file 83 | (PSL_Assert_Directive 84 | (PSL_Built_In_Function_Call 85 | (PSL_Value_Set 86 | (PSL_Any_Type 87 | (simple_name))))) 88 | (PSL_Assert_Directive 89 | (PSL_Built_In_Function_Call 90 | (PSL_Value_Set 91 | (PSL_Any_Type 92 | (simple_name)) 93 | (PSL_Any_Type 94 | (simple_name)))))) 95 | 96 | ================================ 97 | Function call - Sequence II 98 | ================================ 99 | assert ended({x}); 100 | --- 101 | 102 | (design_file 103 | (PSL_Assert_Directive 104 | (PSL_Built_In_Function_Call 105 | (PSL_Braced_SERE 106 | (PSL_Boolean 107 | (simple_name)))))) 108 | 109 | ================================ 110 | Next conflict I 111 | ================================ 112 | assert next (a); 113 | assert next (a -> b); 114 | assert next (x) (y); 115 | --- 116 | 117 | (design_file 118 | (PSL_Assert_Directive 119 | (PSL_Built_In_Function_Call 120 | (PSL_Any_Type 121 | (simple_name)))) 122 | (PSL_Assert_Directive 123 | (PSL_Built_In_Function_Call 124 | (PSL_Expression 125 | (PSL_Boolean 126 | (simple_name)) 127 | (PSL_Boolean 128 | (simple_name))))) 129 | (PSL_Assert_Directive 130 | (PSL_Extended_Ocurrence_FL_Property 131 | Boolean: (PSL_Boolean 132 | (simple_name)) 133 | Property: (PSL_Boolean 134 | (simple_name))))) 135 | 136 | ================================ 137 | Next not-conflict 138 | ================================ 139 | assert next! (a); 140 | assert next! (a -> b); 141 | assert next! (x) (y); 142 | --- 143 | 144 | (design_file 145 | (PSL_Assert_Directive 146 | (PSL_Ocurrence_FL_Property 147 | (PSL_Boolean 148 | (parenthesized_expression 149 | (simple_name))))) 150 | (PSL_Assert_Directive 151 | (PSL_Ocurrence_FL_Property 152 | (PSL_Parenthesized_FL_Property 153 | (PSL_Expression 154 | (PSL_Boolean 155 | (simple_name)) 156 | (PSL_Boolean 157 | (simple_name)))))) 158 | (PSL_Assert_Directive 159 | (PSL_Extended_Ocurrence_FL_Property 160 | Boolean: (PSL_Boolean 161 | (simple_name)) 162 | Property: (PSL_Boolean 163 | (simple_name))))) 164 | 165 | ================================ 166 | Next conflict II 167 | ================================ 168 | assert next (a before b); 169 | --- 170 | 171 | (design_file 172 | (PSL_Assert_Directive 173 | (PSL_Ocurrence_FL_Property 174 | (PSL_Parenthesized_FL_Property 175 | (PSL_Bounding_FL_Property 176 | (PSL_Boolean 177 | (simple_name)) 178 | (PSL_Boolean 179 | (simple_name))))))) 180 | 181 | ================================ 182 | PSL Expression 183 | ================================ 184 | assert c -> x; 185 | assert c -> (x); 186 | assert c -> next(x); 187 | --- 188 | 189 | (design_file 190 | (PSL_Assert_Directive 191 | (PSL_Expression 192 | (PSL_Boolean 193 | (simple_name)) 194 | (PSL_Boolean 195 | (simple_name)))) 196 | (PSL_Assert_Directive 197 | (PSL_Expression 198 | (PSL_Boolean 199 | (simple_name)) 200 | (PSL_Boolean 201 | (parenthesized_expression 202 | (simple_name))))) 203 | (PSL_Assert_Directive 204 | (PSL_Expression 205 | (PSL_Boolean 206 | (simple_name)) 207 | (PSL_Built_In_Function_Call 208 | (PSL_Any_Type 209 | (simple_name)))))) 210 | 211 | ================================ 212 | Implication operator 213 | ================================ 214 | assert c -> next x; 215 | assert c -> (next x); 216 | assert c -> (next (x)); 217 | --- 218 | 219 | (design_file 220 | (PSL_Assert_Directive 221 | (PSL_Implication_FL_Property 222 | (PSL_Boolean 223 | (simple_name)) 224 | (PSL_Ocurrence_FL_Property 225 | (PSL_Boolean 226 | (simple_name))))) 227 | (PSL_Assert_Directive 228 | (PSL_Implication_FL_Property 229 | (PSL_Boolean 230 | (simple_name)) 231 | (PSL_Parenthesized_FL_Property 232 | (PSL_Ocurrence_FL_Property 233 | (PSL_Boolean 234 | (simple_name)))))) 235 | (PSL_Assert_Directive 236 | (PSL_Implication_FL_Property 237 | (PSL_Boolean 238 | (simple_name)) 239 | (PSL_Parenthesized_FL_Property 240 | (PSL_Built_In_Function_Call 241 | (PSL_Any_Type 242 | (simple_name))))))) 243 | 244 | ================================ 245 | Test 246 | ================================ 247 | assert always (e -> (f or next (f before e))); 248 | --- 249 | 250 | (design_file 251 | (PSL_Assert_Directive 252 | (PSL_Invariant_FL_Property 253 | (PSL_Parenthesized_FL_Property 254 | (PSL_Implication_FL_Property 255 | (PSL_Boolean 256 | (simple_name)) 257 | (PSL_Parenthesized_FL_Property 258 | (PSL_Logical_FL_Property 259 | (PSL_Boolean 260 | (simple_name)) 261 | (PSL_Ocurrence_FL_Property 262 | (PSL_Parenthesized_FL_Property 263 | (PSL_Bounding_FL_Property 264 | (PSL_Boolean 265 | (simple_name)) 266 | (PSL_Boolean 267 | (simple_name)))))))))))) 268 | -------------------------------------------------------------------------------- /test/corpus/sequential_statements/case.txt: -------------------------------------------------------------------------------- 1 | =========================== 2 | Ordinary case statement 3 | =========================== 4 | case expr is 5 | end case; 6 | 7 | L1: 8 | case expr is 9 | end case; 10 | 11 | L2: 12 | case expr is 13 | end case L2; 14 | --- 15 | 16 | (design_file 17 | (case_statement 18 | (expression 19 | (simple_name))) 20 | (case_statement 21 | (label 22 | (identifier)) 23 | (expression 24 | (simple_name))) 25 | (case_statement 26 | (label 27 | (identifier)) 28 | (expression 29 | (simple_name)) 30 | at_end: (simple_name))) 31 | 32 | =========================== 33 | Matching case statement 34 | =========================== 35 | case? expr is 36 | end case?; 37 | 38 | L1: 39 | case? expr is 40 | end case?; 41 | 42 | L2: 43 | case? expr is 44 | end case? L2; 45 | --- 46 | 47 | (design_file 48 | (case_statement 49 | (expression 50 | (simple_name))) 51 | (case_statement 52 | (label 53 | (identifier)) 54 | (expression 55 | (simple_name))) 56 | (case_statement 57 | (label 58 | (identifier)) 59 | (expression 60 | (simple_name)) 61 | at_end: (simple_name))) 62 | 63 | =================================== 64 | Case statement alternatives 65 | =================================== 66 | case expr is 67 | when a => 68 | when b | c => 69 | when others => 70 | end case; 71 | --- 72 | 73 | (design_file 74 | (case_statement 75 | (expression 76 | (simple_name)) 77 | (case_statement_alternative 78 | (choices 79 | (simple_expression 80 | (simple_name)))) 81 | (case_statement_alternative 82 | (choices 83 | (simple_expression 84 | (simple_name)) 85 | (simple_expression 86 | (simple_name)))) 87 | (case_statement_alternative 88 | (choices 89 | (others))))) 90 | 91 | =================================== 92 | Sequence os statements 93 | =================================== 94 | case expr is 95 | when a => 96 | null; 97 | end case; 98 | --- 99 | 100 | (design_file 101 | (case_statement 102 | (expression 103 | (simple_name)) 104 | (case_statement_alternative 105 | (choices 106 | (simple_expression 107 | (simple_name))) 108 | (sequence_of_statements 109 | (null_statement))))) 110 | -------------------------------------------------------------------------------- /test/corpus/sequential_statements/if.txt: -------------------------------------------------------------------------------- 1 | ================================ 2 | Minimal 3 | ================================ 4 | if true then 5 | end if; 6 | 7 | L2: 8 | if true then 9 | end if; 10 | 11 | L3: 12 | if true then 13 | end if L3; 14 | --- 15 | 16 | (design_file 17 | (if_statement 18 | (if 19 | (conditional_expression 20 | (simple_name)))) 21 | (if_statement 22 | (label 23 | (identifier)) 24 | (if 25 | (conditional_expression 26 | (simple_name)))) 27 | (if_statement 28 | (label 29 | (identifier)) 30 | (if 31 | (conditional_expression 32 | (simple_name))) 33 | at_end: (simple_name))) 34 | 35 | ================================ 36 | Elsif 37 | ================================ 38 | if true then 39 | elsif true then 40 | end if; 41 | --- 42 | 43 | (design_file 44 | (if_statement 45 | (if 46 | (conditional_expression 47 | (simple_name))) 48 | (elsif 49 | (conditional_expression 50 | (simple_name))))) 51 | 52 | ================================ 53 | Else 54 | ================================ 55 | if true then 56 | elsif true then 57 | else 58 | end if; 59 | --- 60 | 61 | (design_file 62 | (if_statement 63 | (if 64 | (conditional_expression 65 | (simple_name))) 66 | (elsif 67 | (conditional_expression 68 | (simple_name))) 69 | (else))) 70 | 71 | ================================ 72 | Sequence os statements 73 | ================================ 74 | if true then 75 | null; 76 | elsif true then 77 | null; 78 | null; 79 | else 80 | null; 81 | null; 82 | null; 83 | end if; 84 | --- 85 | 86 | (design_file 87 | (if_statement 88 | (if 89 | (conditional_expression 90 | (simple_name)) 91 | (sequence_of_statements 92 | (null_statement))) 93 | (elsif 94 | (conditional_expression 95 | (simple_name)) 96 | (sequence_of_statements 97 | (null_statement) 98 | (null_statement))) 99 | (else 100 | (sequence_of_statements 101 | (null_statement) 102 | (null_statement) 103 | (null_statement))))) 104 | -------------------------------------------------------------------------------- /test/corpus/sequential_statements/loop.txt: -------------------------------------------------------------------------------- 1 | =================================== 2 | Minmal 3 | =================================== 4 | loop 5 | end loop; 6 | 7 | L1: 8 | loop 9 | end loop; 10 | 11 | L2: 12 | loop 13 | end loop L2; 14 | --- 15 | 16 | (design_file 17 | (loop_statement) 18 | (loop_statement 19 | (label (identifier))) 20 | (loop_statement 21 | (label (identifier)) 22 | at_end: (simple_name))) 23 | 24 | =================================== 25 | Iteration scheme - While 26 | =================================== 27 | while cond 28 | loop 29 | end loop; 30 | --- 31 | 32 | (design_file 33 | (loop_statement 34 | (while_loop 35 | (conditional_expression 36 | (simple_name))))) 37 | 38 | =================================== 39 | Iteration scheme - For loop 40 | =================================== 41 | for c in st 42 | loop 43 | end loop; 44 | --- 45 | 46 | (design_file 47 | (loop_statement 48 | (for_loop 49 | (parameter_specification 50 | (identifier) 51 | (subtype_indication 52 | (type_mark 53 | (simple_name))))))) 54 | 55 | =================================== 56 | Next I 57 | =================================== 58 | loop 59 | next; 60 | end loop; 61 | --- 62 | 63 | (design_file 64 | (loop_statement 65 | (sequence_of_statements 66 | (next_statement)))) 67 | 68 | =================================== 69 | Next II 70 | =================================== 71 | for c in st 72 | loop 73 | next when cond; 74 | end loop; 75 | --- 76 | 77 | (design_file 78 | (loop_statement 79 | (for_loop 80 | (parameter_specification 81 | (identifier) 82 | (subtype_indication 83 | (type_mark 84 | (simple_name))))) 85 | (sequence_of_statements 86 | (next_statement 87 | (conditional_expression 88 | (simple_name)))))) 89 | 90 | =================================== 91 | Exit I 92 | =================================== 93 | loop 94 | exit; 95 | end loop; 96 | --- 97 | 98 | (design_file 99 | (loop_statement 100 | (sequence_of_statements 101 | (exit_statement)))) 102 | 103 | =================================== 104 | Exit II 105 | =================================== 106 | loop 107 | exit when e; 108 | end loop; 109 | --- 110 | 111 | (design_file 112 | (loop_statement 113 | (sequence_of_statements 114 | (exit_statement 115 | (conditional_expression 116 | (simple_name)))))) 117 | -------------------------------------------------------------------------------- /test/corpus/sequential_statements/report.txt: -------------------------------------------------------------------------------- 1 | ================================ 2 | Report - Minimal 3 | ================================ 4 | report "str"; 5 | L1: report "str"; 6 | --- 7 | 8 | (design_file 9 | (report_statement 10 | (string_expression 11 | (string_literal))) 12 | (report_statement 13 | (label 14 | (identifier)) 15 | (string_expression 16 | (string_literal)))) 17 | 18 | ================================ 19 | Report - Severity 20 | ================================ 21 | report K_MSG severity note; 22 | --- 23 | 24 | (design_file 25 | (report_statement 26 | (string_expression 27 | (simple_name)) 28 | (severity_expression 29 | (simple_name)))) 30 | 31 | -------------------------------------------------------------------------------- /test/corpus/sequential_statements/wait.txt: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | Wait - Minimal 3 | ================================================================================ 4 | wait; 5 | L: wait; 6 | -------------------------------------------------------------------------------- 7 | 8 | (design_file 9 | (wait_statement) 10 | (wait_statement 11 | (label 12 | (identifier)))) 13 | 14 | ================================================================================ 15 | Wait - Sensitivity clause 16 | ================================================================================ 17 | wait on a; 18 | -------------------------------------------------------------------------------- 19 | 20 | (design_file 21 | (wait_statement 22 | (sensitivity_list 23 | (simple_name)))) 24 | 25 | ================================================================================ 26 | Wait - Conditon clause 27 | ================================================================================ 28 | wait until rising_edge(clk); 29 | -------------------------------------------------------------------------------- 30 | 31 | (design_file 32 | (wait_statement 33 | (conditional_expression 34 | (ambiguous_name 35 | prefix: (simple_name) 36 | (expression_list 37 | (expression 38 | (simple_name))))))) 39 | 40 | ================================================================================ 41 | Wait - Timeout clause 42 | ================================================================================ 43 | wait for 10 ns; 44 | -------------------------------------------------------------------------------- 45 | 46 | (design_file 47 | (wait_statement 48 | (time_expression 49 | (physical_literal 50 | (integer_decimal) 51 | unit: (simple_name))))) 52 | 53 | ================================================================================ 54 | Wait - All clauses 55 | ================================================================================ 56 | L1: wait on foo, bar until cond for 1 ms; 57 | -------------------------------------------------------------------------------- 58 | 59 | (design_file 60 | (wait_statement 61 | (label 62 | (identifier)) 63 | (sensitivity_list 64 | (simple_name) 65 | (simple_name)) 66 | (conditional_expression 67 | (simple_name)) 68 | (time_expression 69 | (physical_literal 70 | (integer_decimal) 71 | unit: (simple_name))))) 72 | -------------------------------------------------------------------------------- /test/highlight/architecture_body.vhdl: -------------------------------------------------------------------------------- 1 | architecture a of e is 2 | begin 3 | end architecture b; 4 | -- ^ error.misspeling.name 5 | -------------------------------------------------------------------------------- /test/highlight/architecture_declarative_part.vhdl: -------------------------------------------------------------------------------- 1 | architecture a of e is 2 | 3 | variable s : t; 4 | -- ^ error.illegal.declaration 5 | 6 | procedure p; 7 | 8 | function f return t; 9 | 10 | procedure p is 11 | begin 12 | end procedure; 13 | 14 | function f return t is 15 | begin 16 | end function; 17 | 18 | procedure p2 is new up; 19 | 20 | function f2 is new uf; 21 | 22 | package pkg is 23 | end; 24 | 25 | package body pkg is 26 | end; 27 | 28 | package pkg2 is new upkg; 29 | 30 | type t is range 0 to 7; 31 | 32 | subtype st is t; 33 | 34 | constant k : t; 35 | 36 | signal s : t; 37 | 38 | shared variable s : t; 39 | 40 | file f : t; 41 | 42 | alias a is k; 43 | 44 | component c is 45 | end component; 46 | 47 | attribute a of e : entity is x; 48 | 49 | attribute a : t; 50 | 51 | for l : c 52 | use open; 53 | 54 | disconnect s : t after 10 ns; 55 | 56 | use foo.bar; 57 | 58 | group G1 : E (L2); 59 | 60 | group g is (signal); 61 | 62 | assert c; 63 | 64 | assume c; 65 | 66 | assume_guarantee c; 67 | 68 | restrict c; 69 | 70 | restrict_guarantee c; 71 | 72 | cover c; 73 | 74 | fairness c; 75 | 76 | strong fairness c,c; 77 | 78 | property p is (a -> b); 79 | 80 | sequence s is {c}; 81 | 82 | default clock is rising_edge(clk); 83 | 84 | begin 85 | end; 86 | 87 | -------------------------------------------------------------------------------- /test/highlight/array_types.vhdl: -------------------------------------------------------------------------------- 1 | type foo_t is array (resolve_f foobar_t) of bar_t; 2 | -- ^ error.unexpected.resolution_function 3 | 4 | for k in foo_f bar_t 5 | -- ^ error.unexpected.resolution_function 6 | loop 7 | end loop; 8 | 9 | type foo_t is array (3 downto 0) of foo_t; 10 | -- ^ error.repeated.type 11 | 12 | type foo_t is array (integer range <>) of foo_t; 13 | -- ^ error.repeated.type 14 | 15 | 16 | -------------------------------------------------------------------------------- /test/highlight/entity_declaration.vhdl: -------------------------------------------------------------------------------- 1 | entity ent is 2 | end entity foo; 3 | -- ^ error.misspeling.name 4 | -------------------------------------------------------------------------------- /test/highlight/entity_declarative_part.vhdl: -------------------------------------------------------------------------------- 1 | entity e is 2 | 3 | variable s : t; 4 | -- ^ error.illegal.declaration 5 | 6 | component c is 7 | -- ^ error.illegal.declaration 8 | end component; 9 | 10 | for l : c 11 | -- ^ error.illegal.declaration 12 | use open; 13 | 14 | procedure p; 15 | 16 | function f return t; 17 | 18 | procedure p is 19 | begin 20 | end procedure; 21 | 22 | function f return t is 23 | begin 24 | end function; 25 | 26 | procedure p2 is new up; 27 | 28 | function f2 is new uf; 29 | 30 | package pkg is 31 | end; 32 | 33 | package body pkg is 34 | end; 35 | 36 | package pkg2 is new upkg; 37 | 38 | type t is range 0 to 7; 39 | 40 | subtype st is t; 41 | 42 | constant k : t; 43 | 44 | signal s : t; 45 | 46 | shared variable s : t; 47 | 48 | file f : t; 49 | 50 | alias a is k; 51 | 52 | attribute a of e : entity is x; 53 | 54 | attribute a : t; 55 | 56 | disconnect s : t after 10 ns; 57 | 58 | use foo.bar; 59 | 60 | group G1 : E (L2); 61 | 62 | group g is (signal); 63 | 64 | assert c; 65 | 66 | assume c; 67 | 68 | assume_guarantee c; 69 | 70 | restrict c; 71 | 72 | restrict_guarantee c; 73 | 74 | cover c; 75 | 76 | fairness c; 77 | 78 | strong fairness c,c; 79 | 80 | property p is (a -> b); 81 | 82 | sequence s is {c}; 83 | 84 | default clock is rising_edge(clk); 85 | 86 | end entity; 87 | -------------------------------------------------------------------------------- /test/highlight/entity_header.vhdl: -------------------------------------------------------------------------------- 1 | entity e is 2 | generic (k:t); 3 | generic map (k); 4 | -- ^ error.illegal.map_aspect.generic 5 | port (s:t); 6 | port map (s); 7 | -- ^ error.illegal.map_aspect.port 8 | end entity; 9 | 10 | 11 | entity e is 12 | generic (k:t); 13 | generic (k:t); 14 | -- ^ error.repeated.clause.generic 15 | end entity; 16 | 17 | entity e is 18 | port (s:t); 19 | port (s:t); 20 | -- ^ error.repeated.clause.port 21 | end entity; 22 | 23 | 24 | entity e is 25 | port (s:t); 26 | generic (k:t); 27 | -- ^ error.order.generic_after_port 28 | end entity; 29 | 30 | 31 | entity e is 32 | generic (k:t) 33 | -- ^ error.missing.semicolon.after_clause 34 | port (s:t) 35 | -- ^ error.missing.semicolon.after_clause 36 | end entity; 37 | -------------------------------------------------------------------------------- /test/highlight/entity_statement_part.vhdl: -------------------------------------------------------------------------------- 1 | entity e is 2 | begin 3 | 4 | process 5 | begin 6 | t <= x; 7 | -- ^ error.illegal.assignment.in_passive_process 8 | 9 | t <= force x; 10 | -- ^ error.illegal.assignment.in_passive_process 11 | 12 | t <= release; 13 | -- ^ error.illegal.assignment.in_passive_process 14 | end process; 15 | 16 | end entity; 17 | 18 | entity e is 19 | begin 20 | 21 | L1: block 22 | -- ^ error.illegal.statement 23 | begin 24 | end block; 25 | 26 | L2: component unit; 27 | -- ^ error.illegal.statement 28 | 29 | t <= x; 30 | -- ^ error.illegal.statement 31 | 32 | t <= x when c; 33 | -- ^ error.illegal.statement 34 | 35 | with e select 36 | -- ^ error.illegal.statement 37 | t <= x when x; 38 | 39 | G1: for i in r 40 | -- ^ error.illegal.statement 41 | generate 42 | end generate; 43 | 44 | G1: if c generate 45 | -- ^ error.illegal.statement 46 | end generate; 47 | 48 | G1: case e generate 49 | -- ^ error.illegal.statement 50 | end generate; 51 | 52 | property p is p1; 53 | -- ^ error.illegal.statement 54 | 55 | sequence s is s1; 56 | -- ^ error.illegal.statement 57 | 58 | default clock is x; 59 | -- ^ error.illegal.statement 60 | 61 | p(arg); 62 | 63 | process 64 | begin 65 | end process; 66 | 67 | assert x; 68 | 69 | assume x; 70 | 71 | assume_guarantee x; 72 | 73 | restrict x; 74 | 75 | restrict_guarantee x; 76 | 77 | cover x; 78 | 79 | fairness x; 80 | 81 | strong fairness x,x; 82 | 83 | end entity; 84 | -------------------------------------------------------------------------------- /test/highlight/enumeration_types.vhdl: -------------------------------------------------------------------------------- 1 | type enum_t is (foo, foo); 2 | -- ^ error.repeated.enumerator 3 | 4 | type enum_t is ('0', '0'); 5 | -- ^ error.repeated.enumerator 6 | 7 | type enum_t is (foo, '1', foo); 8 | -- ^ error.repeated.enumerator 9 | 10 | type enum_t is ('0', foo, '0'); 11 | -- ^ error.repeated.enumerator 12 | 13 | -------------------------------------------------------------------------------- /test/highlight/function_declaration.vhdl: -------------------------------------------------------------------------------- 1 | function f; 2 | -- ^ error.missing.return 3 | 4 | function f is 5 | -- ^ error.missing.return 6 | begin 7 | end; 8 | 9 | 10 | function f (k:t); 11 | -- ^ error.missing.return 12 | 13 | function f (k:t) is 14 | -- ^ error.missing.return 15 | begin 16 | end; 17 | 18 | 19 | function "+" (k:t) return t is 20 | begin 21 | end g; 22 | -- ^ error.misspeling.designator 23 | 24 | function f (k:t) return t is 25 | begin 26 | end procedure; 27 | -- ^ error.misspeling.subprogram_kind 28 | 29 | 30 | pure function f (k:t) return t is 31 | begin 32 | end pure function; 33 | -- ^ error.unexpected.purity.at_end 34 | 35 | 36 | function "and" return t; 37 | 38 | function "foo" return t; 39 | -- ^ error.illegal.operator_symbol 40 | 41 | -------------------------------------------------------------------------------- /test/highlight/function_instantiation.vhdl: -------------------------------------------------------------------------------- 1 | function foo is new bar [t]; 2 | -- ^ error.missing.return 3 | 4 | function "+" is new foo."+" [t,t, return t]; 5 | -- ^ error.unexpected.comma 6 | 7 | 8 | -------------------------------------------------------------------------------- /test/highlight/function_paramater_clause.vhdl: -------------------------------------------------------------------------------- 1 | function p 2 | parameter ( 3 | signal s : out t; 4 | -- ^ error.illegal.mode 5 | signal s : inout t; 6 | -- ^ error.illegal.mode 7 | signal s : buffer t; 8 | -- ^ error.illegal.mode 9 | signal s : linkage t 10 | -- ^ error.illegal.mode 11 | ) return t; 12 | 13 | function p 14 | parameter (signal s : t := expr) return t; 15 | -- ^ error.illegal.default_expression 16 | 17 | function p 18 | parameter ( 19 | variable v : t; 20 | -- ^ error.illegal.interface.variable 21 | file f : t; 22 | -- ^ error.illegal.interface.file 23 | type t; 24 | -- ^ error.illegal.interface.type 25 | procedure p; 26 | -- ^ error.illegal.interface.procedure 27 | function f return f; 28 | -- ^ error.illegal.interface.function 29 | package pkg is new l.pkg 30 | -- ^ error.illegal.interface.package 31 | ) return t; 32 | -------------------------------------------------------------------------------- /test/highlight/numeric_type_definition.vhdl: -------------------------------------------------------------------------------- 1 | type int_t is range 0 to 255.0; 2 | -- ^ error.illegal.range 3 | 4 | type int_t is range 255 downto 0.0; 5 | -- ^ error.illegal.range 6 | 7 | type int_t is range 1.0 to 255; 8 | -- ^ error.illegal.range 9 | 10 | type int_t is range 255.0 downto 0; 11 | -- ^ error.illegal.range 12 | 13 | -------------------------------------------------------------------------------- /test/highlight/package_body.vhdl: -------------------------------------------------------------------------------- 1 | package body pkg is 2 | end package body foo; 3 | -- ^ error.misspeling.name 4 | 5 | -------------------------------------------------------------------------------- /test/highlight/package_body_declarative_part.vhdl: -------------------------------------------------------------------------------- 1 | package body pkg is 2 | 3 | signal s : t; 4 | -- ^ error.illegal.declaration 5 | 6 | component c is 7 | -- ^ error.illegal.declaration 8 | end component; 9 | 10 | for l : c 11 | -- ^ error.illegal.declaration 12 | use open; 13 | 14 | disconnect s : t after 10 ns; 15 | -- ^ error.illegal.declaration 16 | 17 | assert c; 18 | -- ^ error.illegal.declaration 19 | 20 | assume c; 21 | -- ^ error.illegal.declaration 22 | 23 | assume_guarantee c; 24 | -- ^ error.illegal.declaration 25 | 26 | restrict c; 27 | -- ^ error.illegal.declaration 28 | 29 | restrict_guarantee c; 30 | -- ^ error.illegal.declaration 31 | 32 | cover c; 33 | -- ^ error.illegal.declaration 34 | 35 | fairness c; 36 | -- ^ error.illegal.declaration 37 | 38 | strong fairness c,c; 39 | -- ^ error.illegal.declaration 40 | 41 | property p is (a -> b); 42 | -- ^ error.illegal.declaration 43 | 44 | sequence s is {c}; 45 | -- ^ error.illegal.declaration 46 | 47 | default clock is rising_edge(clk); 48 | -- ^ error.illegal.declaration 49 | 50 | procedure p; 51 | 52 | procedure p is 53 | begin 54 | end procedure; 55 | 56 | procedure p2 is new up; 57 | 58 | function f return t is 59 | begin 60 | end function; 61 | 62 | function f return t; 63 | 64 | function f2 is new uf; 65 | 66 | package pkg is 67 | end; 68 | 69 | package body pkg is 70 | end; 71 | 72 | package pkg2 is new upkg; 73 | 74 | type t is range 0 to 7; 75 | 76 | subtype st is t; 77 | 78 | constant k : t; 79 | 80 | variable s : t; 81 | 82 | shared variable s : t; 83 | 84 | file f : t; 85 | 86 | alias a is k; 87 | 88 | attribute a of e : entity is x; 89 | 90 | attribute a : t; 91 | 92 | use foo.bar; 93 | 94 | group G1 : E (L2); 95 | 96 | group g is (signal); 97 | 98 | end package body; 99 | 100 | 101 | procedure p is 102 | package body pkg is 103 | shared variable sv : t; 104 | -- ^ error.unexpected.shared 105 | end package body; 106 | begin 107 | end procedure; 108 | 109 | 110 | process 111 | package body pkg is 112 | shared variable sv : t; 113 | -- ^ error.unexpected.shared 114 | end package body; 115 | begin 116 | end process; 117 | 118 | 119 | type t is 120 | protected body 121 | package body pkg is 122 | shared variable sv : t; 123 | -- ^ error.unexpected.shared 124 | end package body; 125 | end protected body; 126 | 127 | 128 | 129 | -------------------------------------------------------------------------------- /test/highlight/package_declaration.vhdl: -------------------------------------------------------------------------------- 1 | package pkg is 2 | end package foo; 3 | -- ^ error.misspeling.name 4 | -------------------------------------------------------------------------------- /test/highlight/package_declarative_part.vhdl: -------------------------------------------------------------------------------- 1 | package pkg is 2 | 3 | procedure p is 4 | -- ^ error.illegal.declaration 5 | begin 6 | end procedure; 7 | 8 | function f return t is 9 | -- ^ error.illegal.declaration 10 | begin 11 | end function; 12 | 13 | for l : c 14 | -- ^ error.illegal.declaration 15 | use open; 16 | 17 | procedure p; 18 | 19 | function f return t; 20 | 21 | procedure p2 is new up; 22 | 23 | function f2 is new uf; 24 | 25 | package pkg is 26 | end; 27 | 28 | package body pkg is 29 | end; 30 | 31 | package pkg2 is new upkg; 32 | 33 | type t is range 0 to 7; 34 | 35 | subtype st is t; 36 | 37 | constant k : t; 38 | 39 | signal s : t; 40 | 41 | variable s : t; 42 | 43 | shared variable s : t; 44 | 45 | file f : t; 46 | 47 | alias a is k; 48 | 49 | component c is 50 | end component; 51 | 52 | attribute a of e : entity is x; 53 | 54 | attribute a : t; 55 | 56 | disconnect s : t after 10 ns; 57 | 58 | use foo.bar; 59 | 60 | group G1 : E (L2); 61 | 62 | group g is (signal); 63 | 64 | assert c; 65 | 66 | assume c; 67 | 68 | assume_guarantee c; 69 | 70 | restrict c; 71 | 72 | restrict_guarantee c; 73 | 74 | cover c; 75 | 76 | fairness c; 77 | 78 | strong fairness c,c; 79 | 80 | property p is (a -> b); 81 | 82 | sequence s is {c}; 83 | 84 | default clock is rising_edge(clk); 85 | 86 | end package; 87 | 88 | package pkg is 89 | 90 | type t is 91 | protected 92 | end protected; 93 | 94 | type t is 95 | protected body 96 | -- ^ error.illegal.declaration 97 | end protected body; 98 | 99 | end package; 100 | 101 | procedure p is 102 | package pkg is 103 | shared variable sv : t; 104 | -- ^ error.unexpected.shared 105 | 106 | signal s : t; 107 | -- ^ error.illegal.declaration 108 | 109 | disconnect s : t after 10 ns; 110 | -- ^ error.illegal.declaration 111 | 112 | property p is (a -> b); 113 | -- ^ error.illegal.declaration 114 | 115 | sequence s is {c}; 116 | -- ^ error.illegal.declaration 117 | 118 | default clock is rising_edge(clk); 119 | -- ^ error.illegal.declaration 120 | end package; 121 | begin 122 | end procedure; 123 | 124 | 125 | process 126 | package pkg is 127 | shared variable sv : t; 128 | -- ^ error.unexpected.shared 129 | 130 | signal s : t; 131 | -- ^ error.illegal.declaration 132 | 133 | disconnect s : t after 10 ns; 134 | -- ^ error.illegal.declaration 135 | 136 | property p is (a -> b); 137 | -- ^ error.illegal.declaration 138 | 139 | sequence s is {c}; 140 | -- ^ error.illegal.declaration 141 | 142 | default clock is rising_edge(clk); 143 | -- ^ error.illegal.declaration 144 | end package; 145 | begin 146 | end process; 147 | 148 | 149 | type t is 150 | protected body 151 | package pkg is 152 | shared variable sv : t; 153 | -- ^ error.unexpected.shared 154 | 155 | signal s : t; 156 | -- ^ error.illegal.declaration 157 | 158 | disconnect s : t after 10 ns; 159 | -- ^ error.illegal.declaration 160 | 161 | property p is (a -> b); 162 | -- ^ error.illegal.declaration 163 | 164 | sequence s is {c}; 165 | -- ^ error.illegal.declaration 166 | 167 | default clock is rising_edge(clk); 168 | -- ^ error.illegal.declaration 169 | end package; 170 | end protected body; 171 | 172 | 173 | 174 | -------------------------------------------------------------------------------- /test/highlight/package_header.vhdl: -------------------------------------------------------------------------------- 1 | package pkg is 2 | generic (k:t); 3 | generic map (k); 4 | port (s:t); 5 | -- ^ error.illegal.clause.port 6 | port map (s); 7 | -- ^ error.illegal.map_aspect.port 8 | end package; 9 | 10 | 11 | package pkg is 12 | generic (k:t); 13 | generic (k:t); 14 | -- ^ error.repeated.clause.generic 15 | end package; 16 | 17 | package pkg is 18 | generic (k:t); 19 | generic map (k); 20 | generic map (k); 21 | -- ^ error.repeated.map_aspect.generic 22 | end package; 23 | 24 | 25 | package pkg is 26 | generic map (k); 27 | -- ^ error.missing.clause.generic 28 | end package; 29 | 30 | 31 | package pkg is 32 | generic map (k); 33 | generic (k:t); 34 | -- ^ error.order.clause_after_map_aspect 35 | end package; 36 | 37 | 38 | package pkg is 39 | generic (k:t) 40 | -- ^ error.missing.semicolon.after_clause 41 | generic map (k) 42 | -- ^ error.missing.semicolon.after_map_aspect 43 | end package; 44 | -------------------------------------------------------------------------------- /test/highlight/package_map_aspect.vhdl: -------------------------------------------------------------------------------- 1 | package p is new u 2 | generic (k:t) 3 | -- ^ error.illegal.clause.generic 4 | generic map (k) 5 | port (s:t) 6 | -- ^ error.illegal.clause.port 7 | port map (s); 8 | -- ^ error.illegal.map_aspect.port 9 | 10 | 11 | package p is new u 12 | generic map (k) 13 | generic map (k); 14 | -- ^ error.repeated.map_aspect.generic 15 | 16 | 17 | package p is new u 18 | generic map (k);; 19 | -- ^ error.unexpected.semicolon.after_map_aspect 20 | -------------------------------------------------------------------------------- /test/highlight/physical_types.vhdl: -------------------------------------------------------------------------------- 1 | type physical_t is range l to h 2 | units 3 | end units foo; 4 | -- ^ error.misspeling.name 5 | 6 | type physical_t is range l to h 7 | units 8 | a; 9 | b = 1.0 a; 10 | -- ^ error.illegal.floating_point 11 | end units; 12 | 13 | 14 | type physical_t is range l to h 15 | units 16 | a; 17 | a = 1 a; 18 | -- ^ error.repeated.unit 19 | end units; 20 | 21 | type physical_t is range l to h 22 | units 23 | a; 24 | b = 1 a; 25 | b = 1 a; 26 | -- ^ error.repeated.unit 27 | end units; 28 | 29 | type physical_t is range l to h 30 | units 31 | a; 32 | b = 1 a; 33 | c = 1 a; 34 | b = 1 a; 35 | -- ^ error.repeated.unit 36 | end units; 37 | -------------------------------------------------------------------------------- /test/highlight/predefined_array_types.vhdl: -------------------------------------------------------------------------------- 1 | subtype f_t is integer range 10 to 0; 2 | 3 | subtype st is string(-1 to 7); 4 | -- ^ error.illegal.index.negative 5 | 6 | subtype st is string(0 to 7, 1 to 7); 7 | -- ^ error.illegal.index.zero 8 | -- ^ error.illegal.discrete_range 9 | 10 | subtype st is boolean_vector(-1 to 7, 0 to 7); 11 | -- ^ error.illegal.index.negative 12 | -- ^ error.illegal.discrete_range 13 | 14 | subtype st is bit_vector(-1 to 7, 0 to 7); 15 | -- ^ error.illegal.index.negative 16 | -- ^ error.illegal.discrete_range 17 | 18 | subtype st is integer_vector(-1 to 7, 0 to 7); 19 | -- ^ error.illegal.index.negative 20 | -- ^ error.illegal.discrete_range 21 | 22 | subtype st is real_vector(-1 to 7, 0 to 7); 23 | -- ^ error.illegal.index.negative 24 | -- ^ error.illegal.discrete_range 25 | 26 | subtype st is time_vector(-1 to 7, 0 to 7); 27 | -- ^ error.illegal.index.negative 28 | -- ^ error.illegal.discrete_range 29 | -------------------------------------------------------------------------------- /test/highlight/procedure_declaration.vhdl: -------------------------------------------------------------------------------- 1 | pure procedure f (k:t); 2 | -- ^ error.unexpected.purity 3 | 4 | pure procedure f (k:t) is 5 | -- ^ error.unexpected.purity 6 | begin 7 | end pure procedure; 8 | -- ^ error.unexpected.purity 9 | 10 | 11 | procedure "+" (k:t); 12 | -- ^ error.illegal.designator.operator_symbol 13 | 14 | procedure "+" (k:t) is 15 | -- ^ error.illegal.designator.operator_symbol 16 | begin 17 | end "+"; 18 | -- ^ error.illegal.designator.operator_symbol 19 | 20 | 21 | procedure f (k:t) return x; 22 | -- ^ error.unexpected.return 23 | 24 | procedure f (k:t) return x is 25 | -- ^ error.unexpected.return 26 | begin 27 | end; 28 | 29 | 30 | procedure f (k:t) is 31 | begin 32 | end g; 33 | -- ^ error.misspeling.designator 34 | 35 | procedure f (k:t) is 36 | begin 37 | end function; 38 | -- ^ error.misspeling.subprogram_kind 39 | -------------------------------------------------------------------------------- /test/highlight/procedure_instantiation.vhdl: -------------------------------------------------------------------------------- 1 | pure procedure foo is new bar; 2 | -- ^ error.unexpected.purity 3 | 4 | impure procedure foo is new bar; 5 | -- ^ error.unexpected.purity 6 | 7 | 8 | procedure "+" is new foo."+"; 9 | -- ^ error.illegal.designator.operator_symbol 10 | 11 | procedure foo is new bar [return t]; 12 | -- ^ error.unexpected.return 13 | -------------------------------------------------------------------------------- /test/highlight/procedure_paramater_clause.vhdl: -------------------------------------------------------------------------------- 1 | procedure p 2 | parameter ( 3 | signal s : buffer t; 4 | -- ^ error.illegal.mode 5 | signal s : linkage t 6 | -- ^ error.illegal.mode 7 | ); 8 | 9 | procedure p 10 | parameter (signal s : t := expr); 11 | -- ^ error.illegal.default_expression 12 | 13 | procedure p 14 | parameter ( 15 | variable v : buffer t; 16 | -- ^ error.illegal.mode 17 | variable v : linkage t 18 | -- ^ error.illegal.mode 19 | ); 20 | 21 | 22 | procedure p 23 | parameter ( 24 | type t; 25 | -- ^ error.illegal.interface.type 26 | procedure p; 27 | -- ^ error.illegal.interface.procedure 28 | function f return f; 29 | -- ^ error.illegal.interface.function 30 | package pkg is new l.pkg 31 | -- ^ error.illegal.interface.package 32 | ); 33 | -------------------------------------------------------------------------------- /test/highlight/record_types.vhdl: -------------------------------------------------------------------------------- 1 | type foo is 2 | record 3 | end record bar; 4 | -- ^ error.misspeling.name 5 | 6 | type foo is 7 | record 8 | e1, e1 : t; 9 | -- ^ error.repeated.identifier 10 | end record; 11 | 12 | type foo is 13 | record 14 | e1 : t; 15 | e1 : t; 16 | -- ^ error.repeated.identifier 17 | end record; 18 | 19 | type foo is 20 | record 21 | e1, e2 : t; 22 | e3, e2 : t; 23 | -- ^ error.repeated.identifier 24 | end record; 25 | -------------------------------------------------------------------------------- /test/highlight/subprogram_declarative_part.vhdl: -------------------------------------------------------------------------------- 1 | procedure foo is 2 | 3 | type it; 4 | -- ^ error.illegal.declaration 5 | 6 | signal s : t; 7 | -- ^ error.illegal.declaration 8 | 9 | shared variable s : t; 10 | -- ^ error.unexpected.shared 11 | 12 | component c is 13 | -- ^ error.illegal.declaration 14 | end component; 15 | 16 | for l : c 17 | -- ^ error.illegal.declaration 18 | use open; 19 | 20 | disconnect s : t after 10 ns; 21 | -- ^ error.illegal.declaration 22 | 23 | assert c; 24 | -- ^ error.illegal.declaration 25 | 26 | assume c; 27 | -- ^ error.illegal.declaration 28 | 29 | assume_guarantee c; 30 | -- ^ error.illegal.declaration 31 | 32 | restrict c; 33 | -- ^ error.illegal.declaration 34 | 35 | restrict_guarantee c; 36 | -- ^ error.illegal.declaration 37 | 38 | cover c; 39 | -- ^ error.illegal.declaration 40 | 41 | fairness c; 42 | -- ^ error.illegal.declaration 43 | 44 | strong fairness c,c; 45 | -- ^ error.illegal.declaration 46 | 47 | property p is (a -> b); 48 | -- ^ error.illegal.declaration 49 | 50 | sequence s is {c}; 51 | -- ^ error.illegal.declaration 52 | 53 | default clock is rising_edge(clk); 54 | -- ^ error.illegal.declaration 55 | 56 | procedure p; 57 | function f return t; 58 | 59 | procedure p is 60 | begin 61 | end procedure; 62 | 63 | function f return t is 64 | begin 65 | end function; 66 | 67 | procedure p2 is new up; 68 | function f2 is new uf; 69 | 70 | package pkg is 71 | end; 72 | 73 | package body pkg is 74 | end; 75 | 76 | package pkg2 is new upkg; 77 | 78 | type t is range 0 to 7; 79 | 80 | subtype st is t; 81 | 82 | constant k : t; 83 | variable s : t; 84 | file f : t; 85 | 86 | alias a is k; 87 | 88 | attribute a of e : entity is x; 89 | attribute a : t; 90 | 91 | use foo.bar; 92 | 93 | group G1 : E (L2); 94 | group g is (signal); 95 | 96 | begin 97 | end; 98 | -------------------------------------------------------------------------------- /test/highlight/subprogram_header.vhdl: -------------------------------------------------------------------------------- 1 | procedure p 2 | generic (k:t) 3 | generic map (k) 4 | port (s:t) 5 | -- ^ error.illegal.clause.port 6 | port map (s); 7 | -- ^ error.illegal.map_aspect.port 8 | 9 | 10 | procedure p 11 | generic (k:t) 12 | generic (k:t); 13 | -- ^ error.repeated.clause.generic 14 | 15 | procedure p 16 | generic (k:t) 17 | generic map (k) 18 | generic map (k); 19 | -- ^ error.repeated.map_aspect.generic 20 | 21 | 22 | procedure p 23 | generic map (k); 24 | -- ^ error.missing.clause.generic 25 | 26 | 27 | procedure p 28 | generic map (k) 29 | generic (k:t); 30 | -- ^ error.order.clause_after_map_aspect 31 | 32 | 33 | architecture a of e is 34 | function p 35 | generic (k:t); 36 | -- ^ error.unexpected.semicolon.after_clause 37 | generic map (k); return t; 38 | -- ^ error.unexpected.semicolon.after_map_aspect 39 | begin 40 | end; 41 | 42 | -------------------------------------------------------------------------------- /test/highlight/subprogram_map_aspect.vhdl: -------------------------------------------------------------------------------- 1 | procedure p is new u 2 | generic (k:t) 3 | -- ^ error.illegal.clause.generic 4 | generic map (k) 5 | port (s:t) 6 | -- ^ error.illegal.clause.port 7 | port map (s); 8 | -- ^ error.illegal.map_aspect.port 9 | 10 | 11 | procedure p is new u 12 | generic map (k) 13 | generic map (k); 14 | -- ^ error.repeated.map_aspect.generic 15 | 16 | procedure p is new u 17 | generic map (k);; 18 | -- ^ error.unexpected.semicolon.after_map_aspect 19 | --------------------------------------------------------------------------------