├── .gitignore ├── Cargo.toml ├── LICENSE ├── Makefile ├── README.md ├── analyser_json_tests ├── const_decl_1.json ├── const_decl_1.vhd ├── entity_dup.json ├── entity_dup.vhd ├── entity_empty.json ├── entity_empty.vhd ├── entity_empty2.json ├── entity_empty2.vhd ├── selected_name_1.json ├── selected_name_1.vhd ├── selected_name_2.json ├── selected_name_2.vhd ├── simple_name_1.json ├── simple_name_1.vhd ├── simple_name_2.json ├── simple_name_2.vhd ├── type_enum1.json ├── type_enum1.vhd ├── type_enum2_dup.json ├── type_enum2_dup.vhd ├── type_enum3_dup.json ├── type_enum3_dup.vhd ├── type_enum4_overload.json └── type_enum4_overload.vhd ├── build-release.sh ├── build.rs ├── build.sh ├── grammar_helper.py ├── known deviations.txt ├── parser_tests ├── architecture1.json ├── architecture1.vhd ├── architecture2.json ├── architecture2.vhd ├── assoc_list1.json ├── assoc_list1.vhd ├── assoc_list2.json ├── assoc_list2.vhd ├── assoc_list3.json ├── assoc_list3.vhd ├── assoc_list4.json ├── assoc_list4.vhd ├── assoc_list5.json ├── assoc_list5.vhd ├── basic_id1.fail ├── basic_id1.vhd ├── basic_id2.fail ├── basic_id2.vhd ├── basic_id3.fail ├── basic_id3.vhd ├── basic_id4.json ├── basic_id4.vhd ├── basic_id5.fail ├── basic_id5.vhd ├── basic_id6.fail ├── basic_id6.vhd ├── bit_string_lit1.json ├── bit_string_lit1.vhd ├── bit_string_lit2.json ├── bit_string_lit2.vhd ├── bit_string_lit3.json ├── bit_string_lit3.vhd ├── bit_string_lit4.json ├── bit_string_lit4.vhd ├── bit_string_lit5.json ├── bit_string_lit5.vhd ├── bit_string_lit6.json ├── bit_string_lit6.vhd ├── comment1.json ├── comment1.vhd ├── comment2.json ├── comment2.vhd ├── comment3.json ├── comment3.vhd ├── comment4.json ├── comment4.vhd ├── const_decl1.json ├── const_decl1.vhd ├── const_decl2.json ├── const_decl2.vhd ├── const_decl3.json ├── const_decl3.vhd ├── context_decl1.json ├── context_decl1.vhd ├── context_item1.json ├── context_item1.vhd ├── context_item2.json ├── context_item2.vhd ├── context_item3.fail ├── context_item3.vhd ├── context_item4.json ├── context_item4.vhd ├── context_item5.fail ├── context_item5.vhd ├── entity1.json ├── entity1.vhd ├── entity2.json ├── entity2.vhd ├── entity3.json ├── entity3.vhd ├── entity4.fail ├── entity4.vhd ├── expr1.json ├── expr1.vhd ├── expr10.json ├── expr10.vhd ├── expr2.json ├── expr2.vhd ├── expr3.json ├── expr3.vhd ├── expr4.fail ├── expr4.vhd ├── expr5.json ├── expr5.vhd ├── expr6.json ├── expr6.vhd ├── expr7.fail ├── expr7.vhd ├── expr8.json ├── expr8.vhd ├── expr9.json ├── expr9.vhd ├── expr_primary1.json ├── expr_primary1.vhd ├── expr_primary2.json ├── expr_primary2.vhd ├── expr_primary3.json ├── expr_primary3.vhd ├── expr_primary4.json ├── expr_primary4.vhd ├── expr_primary5.json ├── expr_primary5.vhd ├── expr_primary6.json ├── expr_primary6.vhd ├── expr_primary7.json ├── expr_primary7.vhd ├── expr_primary8.json ├── expr_primary8.vhd ├── ext_id1.json ├── ext_id1.vhd ├── ext_id2.json ├── ext_id2.vhd ├── ext_id3.fail ├── ext_id3.vhd ├── ext_id4.json ├── ext_id4.vhd ├── ext_id5.fail ├── ext_id5.vhd ├── file_decl1.json ├── file_decl1.vhd ├── file_decl2.json ├── file_decl2.vhd ├── file_decl3.json ├── file_decl3.vhd ├── file_decl4.fail ├── file_decl4.vhd ├── lit_based1.json ├── lit_based1.vhd ├── lit_based2.json ├── lit_based2.vhd ├── lit_based3.json ├── lit_based3.vhd ├── lit_based4.json ├── lit_based4.vhd ├── lit_based5.json ├── lit_based5.vhd ├── lit_based6.fail ├── lit_based6.vhd ├── lit_based7.fail ├── lit_based7.vhd ├── lit_based8.fail ├── lit_based8.vhd ├── lit_based9.fail ├── lit_based9.vhd ├── lit_dec1.json ├── lit_dec1.vhd ├── lit_dec2.json ├── lit_dec2.vhd ├── lit_dec3.json ├── lit_dec3.vhd ├── lit_dec4.json ├── lit_dec4.vhd ├── lit_dec5.fail ├── lit_dec5.vhd ├── lit_dec6.fail ├── lit_dec6.vhd ├── lit_dec7.fail ├── lit_dec7.vhd ├── name1.json ├── name1.vhd ├── name2.json ├── name2.vhd ├── name3.json ├── name3.vhd ├── name4.json ├── name4.vhd ├── name5.json ├── name5.vhd ├── name6.json ├── name6.vhd ├── name7.json ├── name7.vhd ├── name_ext1.json ├── name_ext1.vhd ├── name_ext2.fail ├── name_ext2.vhd ├── name_ext3.json ├── name_ext3.vhd ├── name_ext4.json ├── name_ext4.vhd ├── name_ext5.json ├── name_ext5.vhd ├── name_ext6.json ├── name_ext6.vhd ├── name_ext7.fail ├── name_ext7.vhd ├── name_ext8.json ├── name_ext8.vhd ├── package1.json ├── package1.vhd ├── package_body1.json ├── package_body1.vhd ├── package_inst1.json ├── package_inst1.vhd ├── sig_decl1.json ├── sig_decl1.vhd ├── sig_decl2.json ├── sig_decl2.vhd ├── sig_decl3.json ├── sig_decl3.vhd ├── sig_decl4.json ├── sig_decl4.vhd ├── string_lit1.json ├── string_lit1.vhd ├── string_lit2.json ├── string_lit2.vhd ├── string_lit3.fail ├── string_lit3.vhd ├── string_lit4.fail ├── string_lit4.vhd ├── string_lit5.fail ├── string_lit5.vhd ├── subtype_indication1.json ├── subtype_indication1.vhd ├── subtype_indication10.json ├── subtype_indication10.vhd ├── subtype_indication11.json ├── subtype_indication11.vhd ├── subtype_indication12.json ├── subtype_indication12.vhd ├── subtype_indication13.json ├── subtype_indication13.vhd ├── subtype_indication14.json ├── subtype_indication14.vhd ├── subtype_indication15.fail ├── subtype_indication15.vhd ├── subtype_indication16.json ├── subtype_indication16.vhd ├── subtype_indication17.json ├── subtype_indication17.vhd ├── subtype_indication18.json ├── subtype_indication18.vhd ├── subtype_indication19.json ├── subtype_indication19.vhd ├── subtype_indication2.json ├── subtype_indication2.vhd ├── subtype_indication20.json ├── subtype_indication20.vhd ├── subtype_indication21.json ├── subtype_indication21.vhd ├── subtype_indication22.json ├── subtype_indication22.vhd ├── subtype_indication23.json ├── subtype_indication23.vhd ├── subtype_indication24.json ├── subtype_indication24.vhd ├── subtype_indication25.json ├── subtype_indication25.vhd ├── subtype_indication26.json ├── subtype_indication26.vhd ├── subtype_indication27.json ├── subtype_indication27.vhd ├── subtype_indication28.json ├── subtype_indication28.vhd ├── subtype_indication3.json ├── subtype_indication3.vhd ├── subtype_indication4.json ├── subtype_indication4.vhd ├── subtype_indication5.json ├── subtype_indication5.vhd ├── subtype_indication6.json ├── subtype_indication6.vhd ├── subtype_indication7.json ├── subtype_indication7.vhd ├── subtype_indication8.json ├── subtype_indication8.vhd ├── subtype_indication9.json ├── subtype_indication9.vhd ├── subtype_indication_generic_map_arrow1.json ├── subtype_indication_generic_map_arrow1.vhd ├── subtype_indication_generic_map_arrow10.json ├── subtype_indication_generic_map_arrow10.vhd ├── subtype_indication_generic_map_arrow11.json ├── subtype_indication_generic_map_arrow11.vhd ├── subtype_indication_generic_map_arrow12.json ├── subtype_indication_generic_map_arrow12.vhd ├── subtype_indication_generic_map_arrow13.json ├── subtype_indication_generic_map_arrow13.vhd ├── subtype_indication_generic_map_arrow14.json ├── subtype_indication_generic_map_arrow14.vhd ├── subtype_indication_generic_map_arrow15.json ├── subtype_indication_generic_map_arrow15.vhd ├── subtype_indication_generic_map_arrow16.json ├── subtype_indication_generic_map_arrow16.vhd ├── subtype_indication_generic_map_arrow17.json ├── subtype_indication_generic_map_arrow17.vhd ├── subtype_indication_generic_map_arrow18.json ├── subtype_indication_generic_map_arrow18.vhd ├── subtype_indication_generic_map_arrow19.json ├── subtype_indication_generic_map_arrow19.vhd ├── subtype_indication_generic_map_arrow2.json ├── subtype_indication_generic_map_arrow2.vhd ├── subtype_indication_generic_map_arrow20.json ├── subtype_indication_generic_map_arrow20.vhd ├── subtype_indication_generic_map_arrow21.json ├── subtype_indication_generic_map_arrow21.vhd ├── subtype_indication_generic_map_arrow22.json ├── subtype_indication_generic_map_arrow22.vhd ├── subtype_indication_generic_map_arrow23.json ├── subtype_indication_generic_map_arrow23.vhd ├── subtype_indication_generic_map_arrow24.json ├── subtype_indication_generic_map_arrow24.vhd ├── subtype_indication_generic_map_arrow25.json ├── subtype_indication_generic_map_arrow25.vhd ├── subtype_indication_generic_map_arrow26.json ├── subtype_indication_generic_map_arrow26.vhd ├── subtype_indication_generic_map_arrow27.json ├── subtype_indication_generic_map_arrow27.vhd ├── subtype_indication_generic_map_arrow28.json ├── subtype_indication_generic_map_arrow28.vhd ├── subtype_indication_generic_map_arrow3.json ├── subtype_indication_generic_map_arrow3.vhd ├── subtype_indication_generic_map_arrow4.json ├── subtype_indication_generic_map_arrow4.vhd ├── subtype_indication_generic_map_arrow5.json ├── subtype_indication_generic_map_arrow5.vhd ├── subtype_indication_generic_map_arrow6.json ├── subtype_indication_generic_map_arrow6.vhd ├── subtype_indication_generic_map_arrow7.json ├── subtype_indication_generic_map_arrow7.vhd ├── subtype_indication_generic_map_arrow8.json ├── subtype_indication_generic_map_arrow8.vhd ├── subtype_indication_generic_map_arrow9.json ├── subtype_indication_generic_map_arrow9.vhd ├── type_decl1.json ├── type_decl1.vhd ├── type_decl2.json ├── type_decl2.vhd ├── type_decl3.json ├── type_decl3.vhd ├── type_decl4.json ├── type_decl4.vhd ├── type_decl5.json ├── type_decl5.vhd ├── type_decl6.json ├── type_decl6.vhd ├── type_decl7.json ├── type_decl7.vhd ├── type_decl8.json ├── type_decl8.vhd ├── type_decl9.fail ├── type_decl9.vhd ├── type_decl_array1.json ├── type_decl_array1.vhd ├── type_decl_array2.json ├── type_decl_array2.vhd ├── type_decl_array3.json ├── type_decl_array3.vhd ├── type_decl_array4.fail ├── type_decl_array4.vhd ├── type_decl_protected1.json ├── type_decl_protected1.vhd ├── type_decl_protected_body1.json ├── type_decl_protected_body1.vhd ├── type_decl_protected_body2.fail ├── type_decl_protected_body2.vhd ├── type_decl_record1.fail ├── type_decl_record1.vhd ├── type_decl_record2.json ├── type_decl_record2.vhd ├── var_decl1.json ├── var_decl1.vhd ├── var_decl2.json ├── var_decl2.vhd ├── var_decl3.json ├── var_decl3.vhd ├── var_decl4.json └── var_decl4.vhd ├── passes.txt ├── src ├── analyzer │ ├── ast.rs │ ├── core.rs │ ├── design.rs │ ├── identifier.rs │ ├── mod.rs │ ├── objpools.rs │ └── util.rs ├── bin │ ├── vhdl_analyzer.rs │ └── vhdl_parser.rs ├── lib.rs └── parser │ ├── bison │ ├── bindgen.hpp │ ├── util.cpp │ ├── util.h │ ├── vhdl_lexer.l │ ├── vhdl_parse_tree.cpp │ ├── vhdl_parse_tree.h │ ├── vhdl_parser.y │ ├── vhdl_parser_glue.cpp │ └── vhdl_parser_glue.h │ └── mod.rs ├── test.py └── test.vhd /.gitignore: -------------------------------------------------------------------------------- 1 | *_ll.* 2 | *_yy.* 3 | vhdl_parser 4 | vhdl_analyser 5 | *.o 6 | *.a 7 | analyser_native_tests/*.cpp.bin 8 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "yavhdl" 3 | version = "0.0.1" 4 | authors = ["Robert Ou "] 5 | build = "build.rs" 6 | 7 | [profile.release] 8 | lto = true 9 | 10 | [lib] 11 | name = "yavhdl" 12 | crate-type = ["rlib", "staticlib"] 13 | 14 | [build-dependencies] 15 | bindgen = "0.23" 16 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016-2017, Robert Ou 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 14 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 17 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 19 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 20 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 21 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | CXX ?= g++ 2 | CXXFLAGS += -std=c++11 -Wall -ggdb3 3 | 4 | TARGETS = vhdl_analyser vhdl_parser 5 | 6 | FLEXFILES = $(wildcard *.l) 7 | BISONFILES = $(wildcard *.y) 8 | CXXFLEX = $(patsubst %.l, %_ll.cpp, $(FLEXFILES)) 9 | CXXBISON = $(patsubst %.y, %_yy.cpp, $(BISONFILES)) 10 | SOURCES = $(CXXFLEX) $(CXXBISON) $(filter-out $(patsubst %, %.cpp, $(TARGETS)),$(wildcard *.cpp)) 11 | OBJECTS = $(patsubst %.cpp, %.o, $(SOURCES)) 12 | 13 | .PHONY: all clean test 14 | 15 | all: $(TARGETS) 16 | 17 | %: %.cpp $(OBJECTS) 18 | $(CXX) $(CXXFLAGS) -o $@ $^ 19 | 20 | vhdl_analyser_bits.a: $(OBJECTS) 21 | ar ruv $@ $^ 22 | 23 | $(CXXFLEX): $(CXXBISON) 24 | 25 | %_ll.cpp: %.l 26 | flex -o $@ $< 27 | 28 | %_yy.cpp: %.y 29 | bison -v -d -o $@ $< 30 | 31 | clean: 32 | rm -f $(TARGETS) *_ll.* *_yy.* *.o *.a 33 | 34 | test: $(TARGETS) vhdl_analyser_bits.a 35 | ./test.py 36 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Yet Another VHDL tool 2 | 3 | This is yet another attempt to build an open-source VHDL (IEEE 1076-2008) tool 4 | that performs parsing, semantic analysis, and elaboration. The goal is to at 5 | some point in the future integrate this with the 6 | [yosys](https://github.com/cliffordwolf/yosys) HDL synthesis tool. 7 | 8 | ## Current status 9 | The initial parser is complete. Semantic analysis is being brainstormed. 10 | 11 | ## License 12 | ```text 13 | Copyright (c) 2016-2017, Robert Ou 14 | All rights reserved. 15 | 16 | Redistribution and use in source and binary forms, with or without 17 | modification, are permitted provided that the following conditions are met: 18 | 19 | 1. Redistributions of source code must retain the above copyright notice, 20 | this list of conditions and the following disclaimer. 21 | 2. Redistributions in binary form must reproduce the above copyright notice, 22 | this list of conditions and the following disclaimer in the documentation 23 | and/or other materials provided with the distribution. 24 | 25 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 26 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 27 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 28 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 29 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 30 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 31 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 32 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 33 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 34 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | ``` 36 | -------------------------------------------------------------------------------- /analyser_json_tests/const_decl_1.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | type test1 is (foo); 3 | constant test2, test3 : test1; 4 | begin end; 5 | -------------------------------------------------------------------------------- /analyser_json_tests/entity_dup.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "DesignDatabase", 3 | "libraries": [{ 4 | "type": "Library", 5 | "id": "worklib", 6 | "units": [ 7 | { 8 | "decls": ["__is_a_set"], 9 | "type": "Entity", 10 | "id": "test", 11 | "first_line": 1, "first_column": 1, 12 | "last_line": 1, "last_column": 25, 13 | "file_name": "analyser_json_tests/entity_dup.vhd" 14 | } 15 | ] 16 | }] 17 | } 18 | -------------------------------------------------------------------------------- /analyser_json_tests/entity_dup.vhd: -------------------------------------------------------------------------------- 1 | entity test is begin end; 2 | entity test is begin end; 3 | -------------------------------------------------------------------------------- /analyser_json_tests/entity_empty.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "DesignDatabase", 3 | "libraries": [{ 4 | "type": "Library", 5 | "id": "worklib", 6 | "units": [ 7 | { 8 | "decls": ["__is_a_set"], 9 | "type": "Entity", 10 | "id": "test", 11 | "first_line": 1, "first_column": 1, 12 | "last_line": 1, "last_column": 25, 13 | "file_name": "analyser_json_tests/entity_empty.vhd" 14 | } 15 | ] 16 | }] 17 | } 18 | -------------------------------------------------------------------------------- /analyser_json_tests/entity_empty.vhd: -------------------------------------------------------------------------------- 1 | entity test is begin end; 2 | -------------------------------------------------------------------------------- /analyser_json_tests/entity_empty2.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "DesignDatabase", 3 | "libraries": [{ 4 | "type": "Library", 5 | "id": "worklib", 6 | "units": [ 7 | { 8 | "decls": ["__is_a_set"], 9 | "type": "Entity", 10 | "id": "test", 11 | "first_line": 1, "first_column": 1, 12 | "last_line": 1, "last_column": 25, 13 | "file_name": "analyser_json_tests/entity_empty2.vhd" 14 | }, 15 | { 16 | "decls": ["__is_a_set"], 17 | "type": "Entity", 18 | "id": "test2", 19 | "first_line": 2, "first_column": 1, 20 | "last_line": 2, "last_column": 26, 21 | "file_name": "analyser_json_tests/entity_empty2.vhd" 22 | } 23 | ] 24 | }] 25 | } 26 | -------------------------------------------------------------------------------- /analyser_json_tests/entity_empty2.vhd: -------------------------------------------------------------------------------- 1 | entity test is begin end; 2 | entity test2 is begin end; 3 | -------------------------------------------------------------------------------- /analyser_json_tests/selected_name_1.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "DesignDatabase", 3 | "libraries": [{ 4 | "type": "Library", 5 | "id": "worklib", 6 | "units": [ 7 | { 8 | "type": "Entity", 9 | "id": "test", 10 | "first_line": 1, "first_column": 1, 11 | "last_line": 4, "last_column": 10, 12 | "file_name": "analyser_json_tests/selected_name_1.vhd", 13 | "decls": [ 14 | "__is_a_set", 15 | { 16 | "type": "EnumerationTypeDecl", 17 | "id": "test1", 18 | "first_line": 2, "first_column": 5, 19 | "last_line": 2, "last_column": 24, 20 | "file_name": "analyser_json_tests/selected_name_1.vhd" 21 | },{ 22 | "type": "SubtypeDecl", 23 | "id": "test2", 24 | "first_line": 3, "first_column": 5, 25 | "last_line": 3, "last_column": 32, 26 | "file_name": "analyser_json_tests/selected_name_1.vhd", 27 | "subtype_indication": { 28 | "type": "SubtypeIndication", 29 | "type_mark": "test1"} 30 | },{ 31 | "type": "EnumerationLitDecl", 32 | "id": "foo", 33 | "idx": 0, 34 | "enum_name": "test1" 35 | } 36 | ] 37 | } 38 | ] 39 | }] 40 | } 41 | -------------------------------------------------------------------------------- /analyser_json_tests/selected_name_1.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | type test1 is (foo); 3 | subtype test2 is test.test1; 4 | begin end; 5 | -------------------------------------------------------------------------------- /analyser_json_tests/selected_name_2.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "DesignDatabase", 3 | "libraries": [{ 4 | "type": "Library", 5 | "id": "worklib", 6 | "units": [] 7 | }] 8 | } 9 | -------------------------------------------------------------------------------- /analyser_json_tests/selected_name_2.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | type test1 is (foo); 3 | subtype test2 is test1.test1; 4 | begin end; 5 | -------------------------------------------------------------------------------- /analyser_json_tests/simple_name_1.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "DesignDatabase", 3 | "libraries": [{ 4 | "type": "Library", 5 | "id": "worklib", 6 | "units": [ 7 | { 8 | "type": "Entity", 9 | "id": "test", 10 | "first_line": 1, "first_column": 1, 11 | "last_line": 4, "last_column": 10, 12 | "file_name": "analyser_json_tests/simple_name_1.vhd", 13 | "decls": [ 14 | "__is_a_set", 15 | { 16 | "type": "EnumerationTypeDecl", 17 | "id": "test1", 18 | "first_line": 2, "first_column": 5, 19 | "last_line": 2, "last_column": 24, 20 | "file_name": "analyser_json_tests/simple_name_1.vhd" 21 | },{ 22 | "type": "SubtypeDecl", 23 | "id": "test2", 24 | "first_line": 3, "first_column": 5, 25 | "last_line": 3, "last_column": 27, 26 | "file_name": "analyser_json_tests/simple_name_1.vhd", 27 | "subtype_indication": { 28 | "type": "SubtypeIndication", 29 | "type_mark": "test1"} 30 | },{ 31 | "type": "EnumerationLitDecl", 32 | "id": "foo", 33 | "idx": 0, 34 | "enum_name": "test1" 35 | } 36 | ] 37 | } 38 | ] 39 | }] 40 | } 41 | -------------------------------------------------------------------------------- /analyser_json_tests/simple_name_1.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | type test1 is (foo); 3 | subtype test2 is test1; 4 | begin end; 5 | -------------------------------------------------------------------------------- /analyser_json_tests/simple_name_2.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "DesignDatabase", 3 | "libraries": [{ 4 | "type": "Library", 5 | "id": "worklib", 6 | "units": [] 7 | }] 8 | } 9 | -------------------------------------------------------------------------------- /analyser_json_tests/simple_name_2.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | type test1 is (foo); 3 | subtype test2 is test; -- Wrong kind 4 | begin end; 5 | -------------------------------------------------------------------------------- /analyser_json_tests/type_enum1.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "DesignDatabase", 3 | "libraries": [{ 4 | "type": "Library", 5 | "id": "worklib", 6 | "units": [ 7 | { 8 | "type": "Entity", 9 | "id": "test", 10 | "first_line": 1, "first_column": 1, 11 | "last_line": 3, "last_column": 10, 12 | "file_name": "analyser_json_tests/type_enum1.vhd", 13 | "decls": [ 14 | "__is_a_set", 15 | { 16 | "type": "EnumerationTypeDecl", 17 | "id": "test", 18 | "first_line": 2, "first_column": 5, 19 | "last_line": 2, "last_column": 23, 20 | "file_name": "analyser_json_tests/type_enum1.vhd" 21 | },{ 22 | "type": "EnumerationLitDecl", 23 | "id": "foo", 24 | "idx": 0, 25 | "enum_name": "test" 26 | } 27 | ] 28 | } 29 | ] 30 | }] 31 | } 32 | -------------------------------------------------------------------------------- /analyser_json_tests/type_enum1.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | type test is (foo); 3 | begin end; 4 | -------------------------------------------------------------------------------- /analyser_json_tests/type_enum2_dup.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "DesignDatabase", 3 | "libraries": [{ 4 | "type": "Library", 5 | "id": "worklib", 6 | "units": [] 7 | }] 8 | } 9 | -------------------------------------------------------------------------------- /analyser_json_tests/type_enum2_dup.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | type test is (foo); 3 | type test is (bar); 4 | begin end; 5 | -------------------------------------------------------------------------------- /analyser_json_tests/type_enum3_dup.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "DesignDatabase", 3 | "libraries": [{ 4 | "type": "Library", 5 | "id": "worklib", 6 | "units": [] 7 | }] 8 | } 9 | -------------------------------------------------------------------------------- /analyser_json_tests/type_enum3_dup.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | type test is (foo, foo); 3 | begin end; 4 | -------------------------------------------------------------------------------- /analyser_json_tests/type_enum4_overload.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | type test1 is (foo, bar); 3 | type test2 is (foo, baz); 4 | begin end; 5 | -------------------------------------------------------------------------------- /build-release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -xeuo pipefail 4 | 5 | # Bison part (including glue) 6 | mkdir -p build 7 | cd build 8 | bison -v -d -o vhdl_parser_yy.cpp ../src/parser/bison/vhdl_parser.y 9 | flex -o vhdl_lexer_ll.cpp ../src/parser/bison/vhdl_lexer.l 10 | g++ -std=c++11 -Wall -ggdb3 -O2 -c -I ../src/parser/bison -I . vhdl_parser_yy.cpp 11 | g++ -std=c++11 -Wall -ggdb3 -O2 -c -I ../src/parser/bison -I . vhdl_lexer_ll.cpp 12 | 13 | g++ -std=c++11 -Wall -ggdb3 -O2 -c -I ../src/parser/bison -I . ../src/parser/bison/vhdl_parse_tree.cpp 14 | g++ -std=c++11 -Wall -ggdb3 -O2 -c -I ../src/parser/bison -I . ../src/parser/bison/vhdl_parser_glue.cpp 15 | g++ -std=c++11 -Wall -ggdb3 -O2 -c -I ../src/parser/bison -I . ../src/parser/bison/util.cpp 16 | 17 | ar rcs libyavhdl_bison.a *.o 18 | cd .. 19 | 20 | # Rust part 21 | cargo build --release 22 | 23 | # Demo parts 24 | ln -sf target/release/vhdl_parser 25 | ln -sf target/release/vhdl_analyzer 26 | 27 | strip -s -o vhdl_parser_stripped vhdl_parser 28 | strip -s -o vhdl_analyzer_stripped vhdl_analyzer 29 | -------------------------------------------------------------------------------- /build.rs: -------------------------------------------------------------------------------- 1 | extern crate bindgen; 2 | 3 | use std::env; 4 | use std::path::PathBuf; 5 | 6 | fn main() { 7 | let bindings = bindgen::Builder::default() 8 | .no_unstable_rust() 9 | .header("src/parser/bison/bindgen.hpp") 10 | .generate() 11 | .expect("Unable to generate bindings"); 12 | 13 | let out_path = PathBuf::from(env::var("OUT_DIR").unwrap()); 14 | bindings 15 | .write_to_file(out_path.join("bindings.rs")) 16 | .expect("Couldn't write bindings!"); 17 | 18 | 19 | println!("cargo:rustc-flags=-L build -l yavhdl_bison -l stdc++") 20 | } 21 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -xeuo pipefail 4 | 5 | # Bison part (including glue) 6 | mkdir -p build 7 | cd build 8 | bison -v -d -o vhdl_parser_yy.cpp ../src/parser/bison/vhdl_parser.y 9 | flex -o vhdl_lexer_ll.cpp ../src/parser/bison/vhdl_lexer.l 10 | g++ -std=c++11 -Wall -ggdb3 -c -I ../src/parser/bison -I . vhdl_parser_yy.cpp 11 | g++ -std=c++11 -Wall -ggdb3 -c -I ../src/parser/bison -I . vhdl_lexer_ll.cpp 12 | 13 | g++ -std=c++11 -Wall -ggdb3 -c -I ../src/parser/bison -I . ../src/parser/bison/vhdl_parse_tree.cpp 14 | g++ -std=c++11 -Wall -ggdb3 -c -I ../src/parser/bison -I . ../src/parser/bison/vhdl_parser_glue.cpp 15 | g++ -std=c++11 -Wall -ggdb3 -c -I ../src/parser/bison -I . ../src/parser/bison/util.cpp 16 | 17 | ar rcs libyavhdl_bison.a *.o 18 | cd .. 19 | 20 | # Rust part 21 | cargo build 22 | 23 | # Demo parts 24 | ln -sf target/debug/vhdl_parser 25 | ln -sf target/debug/vhdl_analyzer 26 | -------------------------------------------------------------------------------- /grammar_helper.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 -i 2 | 3 | # Load stuff 4 | forward_graph = {} 5 | reverse_graph = {} 6 | inf = open("vhdl_grammar.dot", 'r') 7 | for l in inf.readlines(): 8 | if "->" in l: 9 | l = l.strip() 10 | head, tail = l.split("->") 11 | head = head.strip() 12 | tail = tail.strip() 13 | if tail[-1] == ";": 14 | tail = tail[:-1] 15 | 16 | if head not in forward_graph: 17 | forward_graph[head] = set() 18 | if tail not in reverse_graph: 19 | reverse_graph[tail] = set() 20 | 21 | forward_graph[head].add(tail) 22 | reverse_graph[tail].add(head) 23 | 24 | def bfs(graph, start, limit): 25 | visited = set() 26 | todo = set() 27 | 28 | todo.add((start, 0)) 29 | 30 | while todo: 31 | node, depth = todo.pop() 32 | if limit != -1 and depth == limit: 33 | continue 34 | 35 | indent = depth 36 | if node in visited: 37 | continue 38 | 39 | if node not in graph: 40 | continue 41 | 42 | print("\n" + " " * indent + node + " ->") 43 | visited.add(node) 44 | 45 | next_nodes = graph[node] 46 | for next_node in next_nodes: 47 | print(" " * (indent + 1) + next_node) 48 | todo.add((next_node, indent + 1)) 49 | 50 | indent += 1 51 | 52 | def fwd(start, limit=-1): 53 | bfs(forward_graph, start, limit) 54 | 55 | def back(start, limit=-1): 56 | bfs(reverse_graph, start, limit) 57 | -------------------------------------------------------------------------------- /known deviations.txt: -------------------------------------------------------------------------------- 1 | known deviations: 2 | 3 | tool directives 4 | -------------------------------------------------------------------------------- /parser_tests/architecture1.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ARCHITECTURE", 5 | "first_line": 1, 6 | "first_column": 1, 7 | "last_line": 1, 8 | "last_column": 40, 9 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 10 | "name": {"type": "PT_BASIC_ID", "str": "test2"} 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /parser_tests/architecture1.vhd: -------------------------------------------------------------------------------- 1 | architecture test of test2 is begin end; -------------------------------------------------------------------------------- /parser_tests/architecture2.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ARCHITECTURE", 5 | "first_line": 1, 6 | "first_column": 1, 7 | "last_line": 1, 8 | "last_column": 50, 9 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 10 | 11 | "name": { 12 | "type": "PT_NAME_SELECTED", 13 | "name": { 14 | "type": "PT_NAME_SELECTED", 15 | "name": { 16 | "type": "PT_NAME_SELECTED", 17 | "name": { 18 | "type": "PT_BASIC_ID", 19 | "str": "foo" 20 | }, 21 | "suffix": {"type": "PT_BASIC_ID", "str": "bar"} 22 | }, 23 | "suffix": {"type": "PT_BASIC_ID", "str": "baz"} 24 | }, 25 | "suffix": {"type": "PT_BASIC_ID", "str": "qux"} 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /parser_tests/architecture2.vhd: -------------------------------------------------------------------------------- 1 | architecture test of foo.bar.baz.qux is begin end; -------------------------------------------------------------------------------- /parser_tests/assoc_list1.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "first_column": 5, 5 | "first_line": 2, 6 | "generic_map": { 7 | "association_list": { 8 | "actual_part": { 9 | "str": "foo", 10 | "type": "PT_BASIC_ID" 11 | }, 12 | "type": "PT_ASSOCIATION_ELEMENT" 13 | }, 14 | "type": "PT_GENERIC_MAP_ASPECT" 15 | }, 16 | "identifier": { 17 | "str": "a", 18 | "type": "PT_BASIC_ID" 19 | }, 20 | "last_column": 40, 21 | "last_line": 2, 22 | "type": "PT_PACKAGE_INSTANTIATION_DECLARATION", 23 | "uninstantiated_name": { 24 | "str": "b", 25 | "type": "PT_BASIC_ID" 26 | } 27 | }, 28 | "first_column": 1, 29 | "first_line": 1, 30 | "header": { 31 | "type": "PT_ENTITY_HEADER" 32 | }, 33 | "identifier": { 34 | "str": "test", 35 | "type": "PT_BASIC_ID" 36 | }, 37 | "last_column": 4, 38 | "last_line": 3, 39 | "type": "PT_ENTITY" 40 | }, 41 | "type": "PT_DESIGN_UNIT" 42 | } -------------------------------------------------------------------------------- /parser_tests/assoc_list1.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | package a is new b generic map(foo); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/assoc_list2.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "first_column": 5, 5 | "first_line": 2, 6 | "generic_map": { 7 | "association_list": { 8 | "rest": { 9 | "actual_part": { 10 | "str": "foo", 11 | "type": "PT_BASIC_ID" 12 | }, 13 | "type": "PT_ASSOCIATION_ELEMENT" 14 | }, 15 | "this_piece": { 16 | "actual_part": { 17 | "type": "PT_TOK_OPEN" 18 | }, 19 | "type": "PT_ASSOCIATION_ELEMENT" 20 | }, 21 | "type": "PT_ASSOCIATION_LIST" 22 | }, 23 | "type": "PT_GENERIC_MAP_ASPECT" 24 | }, 25 | "identifier": { 26 | "str": "a", 27 | "type": "PT_BASIC_ID" 28 | }, 29 | "last_column": 46, 30 | "last_line": 2, 31 | "type": "PT_PACKAGE_INSTANTIATION_DECLARATION", 32 | "uninstantiated_name": { 33 | "str": "b", 34 | "type": "PT_BASIC_ID" 35 | } 36 | }, 37 | "first_column": 1, 38 | "first_line": 1, 39 | "header": { 40 | "type": "PT_ENTITY_HEADER" 41 | }, 42 | "identifier": { 43 | "str": "test", 44 | "type": "PT_BASIC_ID" 45 | }, 46 | "last_column": 4, 47 | "last_line": 3, 48 | "type": "PT_ENTITY" 49 | }, 50 | "type": "PT_DESIGN_UNIT" 51 | } -------------------------------------------------------------------------------- /parser_tests/assoc_list2.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | package a is new b generic map(foo, open); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/assoc_list3.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | package a is new b generic map(foo, open, bar); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/assoc_list4.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "first_column": 5, 5 | "first_line": 2, 6 | "generic_map": { 7 | "association_list": { 8 | "actual_part": { 9 | "expression": { 10 | "str": "foo", 11 | "type": "PT_BASIC_ID" 12 | }, 13 | "type": "PT_INERTIAL_EXPRESSION" 14 | }, 15 | "type": "PT_ASSOCIATION_ELEMENT" 16 | }, 17 | "type": "PT_GENERIC_MAP_ASPECT" 18 | }, 19 | "identifier": { 20 | "str": "a", 21 | "type": "PT_BASIC_ID" 22 | }, 23 | "last_column": 49, 24 | "last_line": 2, 25 | "type": "PT_PACKAGE_INSTANTIATION_DECLARATION", 26 | "uninstantiated_name": { 27 | "str": "b", 28 | "type": "PT_BASIC_ID" 29 | } 30 | }, 31 | "first_column": 1, 32 | "first_line": 1, 33 | "header": { 34 | "type": "PT_ENTITY_HEADER" 35 | }, 36 | "identifier": { 37 | "str": "test", 38 | "type": "PT_BASIC_ID" 39 | }, 40 | "last_column": 4, 41 | "last_line": 3, 42 | "type": "PT_ENTITY" 43 | }, 44 | "type": "PT_DESIGN_UNIT" 45 | } -------------------------------------------------------------------------------- /parser_tests/assoc_list4.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | package a is new b generic map(inertial foo); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/assoc_list5.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "first_column": 5, 5 | "first_line": 2, 6 | "generic_map": { 7 | "association_list": { 8 | "actual_part": { 9 | "expression": { 10 | "str": "foo", 11 | "type": "PT_BASIC_ID" 12 | }, 13 | "type": "PT_INERTIAL_EXPRESSION" 14 | }, 15 | "formal_part": { 16 | "name": { 17 | "str": "bar", 18 | "type": "PT_BASIC_ID" 19 | }, 20 | "parens": { 21 | "str": "baz", 22 | "type": "PT_BASIC_ID" 23 | }, 24 | "type": "PT_NAME_AMBIG_PARENS" 25 | }, 26 | "type": "PT_ASSOCIATION_ELEMENT" 27 | }, 28 | "type": "PT_GENERIC_MAP_ASPECT" 29 | }, 30 | "identifier": { 31 | "str": "a", 32 | "type": "PT_BASIC_ID" 33 | }, 34 | "last_column": 61, 35 | "last_line": 2, 36 | "type": "PT_PACKAGE_INSTANTIATION_DECLARATION", 37 | "uninstantiated_name": { 38 | "str": "b", 39 | "type": "PT_BASIC_ID" 40 | } 41 | }, 42 | "first_column": 1, 43 | "first_line": 1, 44 | "header": { 45 | "type": "PT_ENTITY_HEADER" 46 | }, 47 | "identifier": { 48 | "str": "test", 49 | "type": "PT_BASIC_ID" 50 | }, 51 | "last_column": 4, 52 | "last_line": 3, 53 | "type": "PT_ENTITY" 54 | }, 55 | "type": "PT_DESIGN_UNIT" 56 | } -------------------------------------------------------------------------------- /parser_tests/assoc_list5.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | package a is new b generic map(bar(baz) => inertial foo); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/basic_id1.fail: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArcaneNibble/yavhdl/0dae62b5ff56a48f54da24188ea4d30c64a93d4e/parser_tests/basic_id1.fail -------------------------------------------------------------------------------- /parser_tests/basic_id1.vhd: -------------------------------------------------------------------------------- 1 | entity 0test is end; 2 | -------------------------------------------------------------------------------- /parser_tests/basic_id2.fail: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArcaneNibble/yavhdl/0dae62b5ff56a48f54da24188ea4d30c64a93d4e/parser_tests/basic_id2.fail -------------------------------------------------------------------------------- /parser_tests/basic_id2.vhd: -------------------------------------------------------------------------------- 1 | entity _test is end; 2 | -------------------------------------------------------------------------------- /parser_tests/basic_id3.fail: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArcaneNibble/yavhdl/0dae62b5ff56a48f54da24188ea4d30c64a93d4e/parser_tests/basic_id3.fail -------------------------------------------------------------------------------- /parser_tests/basic_id3.vhd: -------------------------------------------------------------------------------- 1 | entity t__est is end; 2 | -------------------------------------------------------------------------------- /parser_tests/basic_id4.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ENTITY", 5 | "first_line": 1, 6 | "first_column": 1, 7 | "last_line": 1, 8 | "last_column": 20, 9 | "identifier": {"type": "PT_BASIC_ID", "str": "test\u00fe"}, 10 | "header": {"type": "PT_ENTITY_HEADER"} 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /parser_tests/basic_id4.vhd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArcaneNibble/yavhdl/0dae62b5ff56a48f54da24188ea4d30c64a93d4e/parser_tests/basic_id4.vhd -------------------------------------------------------------------------------- /parser_tests/basic_id5.fail: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArcaneNibble/yavhdl/0dae62b5ff56a48f54da24188ea4d30c64a93d4e/parser_tests/basic_id5.fail -------------------------------------------------------------------------------- /parser_tests/basic_id5.vhd: -------------------------------------------------------------------------------- 1 | entity test_ is end; 2 | -------------------------------------------------------------------------------- /parser_tests/basic_id6.fail: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArcaneNibble/yavhdl/0dae62b5ff56a48f54da24188ea4d30c64a93d4e/parser_tests/basic_id6.fail -------------------------------------------------------------------------------- /parser_tests/basic_id6.vhd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArcaneNibble/yavhdl/0dae62b5ff56a48f54da24188ea4d30c64a93d4e/parser_tests/basic_id6.vhd -------------------------------------------------------------------------------- /parser_tests/bit_string_lit1.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ARCHITECTURE", 5 | "first_line": 1, "first_column": 1, "last_line": 3, "last_column": 10, 6 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 7 | "name": {"type": "PT_BASIC_ID", "str": "test2"}, 8 | "declarations": { 9 | "type": "PT_CONSTANT_DECLARATION", 10 | "first_line": 2, "first_column": 5, 11 | "last_line": 2, "last_column": 37, 12 | "identifiers": {"type": "PT_BASIC_ID", "str": "foo"}, 13 | "subtype": { 14 | "type": "PT_SUBTYPE_INDICATION", 15 | "type_mark": {"type": "PT_BASIC_ID", "str": "bar"} 16 | }, 17 | "expression": { 18 | "type": "PT_LIT_BITSTRING", 19 | "base_str": "32b", 20 | "str": "12345" 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /parser_tests/bit_string_lit1.vhd: -------------------------------------------------------------------------------- 1 | architecture test of test2 is 2 | constant foo : bar := 32b"12345"; 3 | begin end; 4 | -------------------------------------------------------------------------------- /parser_tests/bit_string_lit2.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ARCHITECTURE", 5 | "first_line": 1, "first_column": 1, "last_line": 3, "last_column": 10, 6 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 7 | "name": {"type": "PT_BASIC_ID", "str": "test2"}, 8 | "declarations": { 9 | "type": "PT_CONSTANT_DECLARATION", 10 | "first_line": 2, "first_column": 5, 11 | "last_line": 2, "last_column": 37, 12 | "identifiers": {"type": "PT_BASIC_ID", "str": "foo"}, 13 | "subtype": { 14 | "type": "PT_SUBTYPE_INDICATION", 15 | "type_mark": {"type": "PT_BASIC_ID", "str": "bar"} 16 | }, 17 | "expression": { 18 | "type": "PT_LIT_BITSTRING", 19 | "base_str": "32o", 20 | "str": "12345" 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /parser_tests/bit_string_lit2.vhd: -------------------------------------------------------------------------------- 1 | architecture test of test2 is 2 | constant foo : bar := 32o"12345"; 3 | begin end; 4 | -------------------------------------------------------------------------------- /parser_tests/bit_string_lit3.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ARCHITECTURE", 5 | "first_line": 1, "first_column": 1, "last_line": 3, "last_column": 10, 6 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 7 | "name": {"type": "PT_BASIC_ID", "str": "test2"}, 8 | "declarations": { 9 | "type": "PT_CONSTANT_DECLARATION", 10 | "first_line": 2, "first_column": 5, 11 | "last_line": 2, "last_column": 37, 12 | "identifiers": {"type": "PT_BASIC_ID", "str": "foo"}, 13 | "subtype": { 14 | "type": "PT_SUBTYPE_INDICATION", 15 | "type_mark": {"type": "PT_BASIC_ID", "str": "bar"} 16 | }, 17 | "expression": { 18 | "type": "PT_LIT_BITSTRING", 19 | "base_str": "32X", 20 | "str": "12345" 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /parser_tests/bit_string_lit3.vhd: -------------------------------------------------------------------------------- 1 | architecture test of test2 is 2 | constant foo : bar := 32X"12345"; 3 | begin end; 4 | -------------------------------------------------------------------------------- /parser_tests/bit_string_lit4.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ARCHITECTURE", 5 | "first_line": 1, "first_column": 1, "last_line": 3, "last_column": 10, 6 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 7 | "name": {"type": "PT_BASIC_ID", "str": "test2"}, 8 | "declarations": { 9 | "type": "PT_CONSTANT_DECLARATION", 10 | "first_line": 2, "first_column": 5, 11 | "last_line": 2, "last_column": 37, 12 | "identifiers": {"type": "PT_BASIC_ID", "str": "foo"}, 13 | "subtype": { 14 | "type": "PT_SUBTYPE_INDICATION", 15 | "type_mark": {"type": "PT_BASIC_ID", "str": "bar"} 16 | }, 17 | "expression": { 18 | "type": "PT_LIT_BITSTRING", 19 | "base_str": "32d", 20 | "str": "12345" 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /parser_tests/bit_string_lit4.vhd: -------------------------------------------------------------------------------- 1 | architecture test of test2 is 2 | constant foo : bar := 32d"12345"; 3 | begin end; 4 | -------------------------------------------------------------------------------- /parser_tests/bit_string_lit5.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ARCHITECTURE", 5 | "first_line": 1, "first_column": 1, "last_line": 3, "last_column": 10, 6 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 7 | "name": {"type": "PT_BASIC_ID", "str": "test2"}, 8 | "declarations": { 9 | "type": "PT_CONSTANT_DECLARATION", 10 | "first_line": 2, "first_column": 5, 11 | "last_line": 2, "last_column": 38, 12 | "identifiers": {"type": "PT_BASIC_ID", "str": "foo"}, 13 | "subtype": { 14 | "type": "PT_SUBTYPE_INDICATION", 15 | "type_mark": {"type": "PT_BASIC_ID", "str": "bar"} 16 | }, 17 | "expression": { 18 | "type": "PT_LIT_BITSTRING", 19 | "base_str": "32Ub", 20 | "str": "12345" 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /parser_tests/bit_string_lit5.vhd: -------------------------------------------------------------------------------- 1 | architecture test of test2 is 2 | constant foo : bar := 32Ub"12345"; 3 | begin end; 4 | -------------------------------------------------------------------------------- /parser_tests/bit_string_lit6.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ARCHITECTURE", 5 | "first_line": 1, "first_column": 1, "last_line": 3, "last_column": 10, 6 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 7 | "name": {"type": "PT_BASIC_ID", "str": "test2"}, 8 | "declarations": { 9 | "type": "PT_CONSTANT_DECLARATION", 10 | "first_line": 2, "first_column": 5, 11 | "last_line": 2, "last_column": 38, 12 | "identifiers": {"type": "PT_BASIC_ID", "str": "foo"}, 13 | "subtype": { 14 | "type": "PT_SUBTYPE_INDICATION", 15 | "type_mark": {"type": "PT_BASIC_ID", "str": "bar"} 16 | }, 17 | "expression": { 18 | "type": "PT_LIT_BITSTRING", 19 | "base_str": "32sO", 20 | "str": "12345" 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /parser_tests/bit_string_lit6.vhd: -------------------------------------------------------------------------------- 1 | architecture test of test2 is 2 | constant foo : bar := 32sO"12345"; 3 | begin end; 4 | -------------------------------------------------------------------------------- /parser_tests/comment1.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ENTITY", 5 | "first_line": 1, 6 | "first_column": 1, 7 | "last_line": 2, 8 | "last_column": 4, 9 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 10 | "header": {"type": "PT_ENTITY_HEADER"} 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /parser_tests/comment1.vhd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArcaneNibble/yavhdl/0dae62b5ff56a48f54da24188ea4d30c64a93d4e/parser_tests/comment1.vhd -------------------------------------------------------------------------------- /parser_tests/comment2.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ENTITY", 5 | "first_line": 1, 6 | "first_column": 1, 7 | "last_line": 1, 8 | "last_column": 41, 9 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 10 | "header": {"type": "PT_ENTITY_HEADER"} 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /parser_tests/comment2.vhd: -------------------------------------------------------------------------------- 1 | entity test is/*This is a /*comment*/end; 2 | -------------------------------------------------------------------------------- /parser_tests/comment3.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ENTITY", 5 | "first_line": 1, 6 | "first_column": 1, 7 | "last_line": 1, 8 | "last_column": 39, 9 | "identifier": {"type": "PT_EXT_ID", "str": "--this isn't a comment"}, 10 | "header": {"type": "PT_ENTITY_HEADER"} 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /parser_tests/comment3.vhd: -------------------------------------------------------------------------------- 1 | entity \--this isn't a comment\ is end; 2 | -------------------------------------------------------------------------------- /parser_tests/comment4.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ENTITY", 5 | "first_line": 1, 6 | "first_column": 1, 7 | "last_line": 1, 8 | "last_column": 41, 9 | "identifier": {"type": "PT_EXT_ID", "str": "/*this isn't a comment*/"}, 10 | "header": {"type": "PT_ENTITY_HEADER"} 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /parser_tests/comment4.vhd: -------------------------------------------------------------------------------- 1 | entity \/*this isn't a comment*/\ is end; 2 | -------------------------------------------------------------------------------- /parser_tests/const_decl1.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ARCHITECTURE", 5 | "first_line": 1, "first_column": 1, "last_line": 3, "last_column": 10, 6 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 7 | "name": {"type": "PT_BASIC_ID", "str": "test2"}, 8 | "declarations": { 9 | "type": "PT_CONSTANT_DECLARATION", 10 | "first_line": 2, "first_column": 5, 11 | "last_line": 2, "last_column": 23, 12 | "identifiers": {"type": "PT_BASIC_ID", "str": "foo"}, 13 | "subtype": { 14 | "type": "PT_SUBTYPE_INDICATION", 15 | "type_mark": {"type": "PT_BASIC_ID", "str": "bar"} 16 | } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /parser_tests/const_decl1.vhd: -------------------------------------------------------------------------------- 1 | architecture test of test2 is 2 | constant foo : bar; 3 | begin end; 4 | -------------------------------------------------------------------------------- /parser_tests/const_decl2.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ARCHITECTURE", 5 | "first_line": 1, "first_column": 1, "last_line": 3, "last_column": 10, 6 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 7 | "name": {"type": "PT_BASIC_ID", "str": "test2"}, 8 | "declarations": { 9 | "type": "PT_CONSTANT_DECLARATION", 10 | "first_line": 2, "first_column": 5, 11 | "last_line": 2, "last_column": 30, 12 | "identifiers": {"type": "PT_BASIC_ID", "str": "foo"}, 13 | "subtype": { 14 | "type": "PT_SUBTYPE_INDICATION", 15 | "type_mark": {"type": "PT_BASIC_ID", "str": "bar"} 16 | }, 17 | "expression": {"type": "PT_BASIC_ID", "str": "baz"} 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /parser_tests/const_decl2.vhd: -------------------------------------------------------------------------------- 1 | architecture test of test2 is 2 | constant foo : bar := baz; 3 | begin end; 4 | -------------------------------------------------------------------------------- /parser_tests/const_decl3.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ARCHITECTURE", 5 | "first_line": 1, "first_column": 1, "last_line": 3, "last_column": 10, 6 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 7 | "name": {"type": "PT_BASIC_ID", "str": "test2"}, 8 | "declarations": { 9 | "type": "PT_CONSTANT_DECLARATION", 10 | "first_line": 2, "first_column": 5, 11 | "last_line": 2, "last_column": 36, 12 | "identifiers": { 13 | "type": "PT_ID_LIST_REAL", 14 | "rest": {"type": "PT_BASIC_ID", "str": "foo"}, 15 | "this_piece": {"type": "PT_BASIC_ID", "str": "foo2"} 16 | }, 17 | "subtype": { 18 | "type": "PT_SUBTYPE_INDICATION", 19 | "type_mark": {"type": "PT_BASIC_ID", "str": "bar"} 20 | }, 21 | "expression": {"type": "PT_BASIC_ID", "str": "baz"} 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /parser_tests/const_decl3.vhd: -------------------------------------------------------------------------------- 1 | architecture test of test2 is 2 | constant foo, foo2 : bar := baz; 3 | begin end; 4 | -------------------------------------------------------------------------------- /parser_tests/context_decl1.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_CONTEXT_DECLARATION", 5 | "first_line": 1, 6 | "first_column": 1, 7 | "last_line": 1, 8 | "last_column": 20, 9 | "identifier": {"type": "PT_BASIC_ID", "str": "test"} 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /parser_tests/context_decl1.vhd: -------------------------------------------------------------------------------- 1 | context test is end; 2 | -------------------------------------------------------------------------------- /parser_tests/context_item1.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ENTITY", 5 | "first_line": 2, 6 | "first_column": 1, 7 | "last_line": 2, 8 | "last_column": 19, 9 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 10 | "header": {"type": "PT_ENTITY_HEADER"} 11 | }, 12 | "context_clause": { 13 | "type": "PT_LIBRARY_CLAUSE", 14 | "names": {"type": "PT_BASIC_ID", "str": "foo"} 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /parser_tests/context_item1.vhd: -------------------------------------------------------------------------------- 1 | library foo; 2 | entity test is end; 3 | -------------------------------------------------------------------------------- /parser_tests/context_item2.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ENTITY", 5 | "first_line": 2, 6 | "first_column": 1, 7 | "last_line": 2, 8 | "last_column": 19, 9 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 10 | "header": {"type": "PT_ENTITY_HEADER"} 11 | }, 12 | "context_clause": { 13 | "type": "PT_USE_CLAUSE", 14 | "used_names": { 15 | "type": "PT_NAME_SELECTED", 16 | "name": {"type": "PT_BASIC_ID", "str": "foo"}, 17 | "suffix": {"type": "PT_BASIC_ID", "str": "bar"} 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /parser_tests/context_item2.vhd: -------------------------------------------------------------------------------- 1 | use foo.bar; 2 | entity test is end; 3 | -------------------------------------------------------------------------------- /parser_tests/context_item3.fail: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArcaneNibble/yavhdl/0dae62b5ff56a48f54da24188ea4d30c64a93d4e/parser_tests/context_item3.fail -------------------------------------------------------------------------------- /parser_tests/context_item3.vhd: -------------------------------------------------------------------------------- 1 | use foo; 2 | entity test is end; 3 | -------------------------------------------------------------------------------- /parser_tests/context_item4.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ENTITY", 5 | "first_line": 2, 6 | "first_column": 1, 7 | "last_line": 2, 8 | "last_column": 19, 9 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 10 | "header": {"type": "PT_ENTITY_HEADER"} 11 | }, 12 | "context_clause": { 13 | "type": "PT_CONTEXT_REFERENCE", 14 | "names": { 15 | "type": "PT_NAME_SELECTED", 16 | "name": {"type": "PT_BASIC_ID", "str": "foo"}, 17 | "suffix": {"type": "PT_BASIC_ID", "str": "bar"} 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /parser_tests/context_item4.vhd: -------------------------------------------------------------------------------- 1 | context foo.bar; 2 | entity test is end; 3 | -------------------------------------------------------------------------------- /parser_tests/context_item5.fail: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArcaneNibble/yavhdl/0dae62b5ff56a48f54da24188ea4d30c64a93d4e/parser_tests/context_item5.fail -------------------------------------------------------------------------------- /parser_tests/context_item5.vhd: -------------------------------------------------------------------------------- 1 | context foo; 2 | entity test is end; 3 | -------------------------------------------------------------------------------- /parser_tests/entity1.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ENTITY", 5 | "first_line": 1, 6 | "first_column": 1, 7 | "last_line": 1, 8 | "last_column": 19, 9 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 10 | "header": {"type": "PT_ENTITY_HEADER"} 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /parser_tests/entity1.vhd: -------------------------------------------------------------------------------- 1 | entity test is end; 2 | -------------------------------------------------------------------------------- /parser_tests/entity2.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ENTITY", 5 | "first_line": 1, 6 | "first_column": 1, 7 | "last_line": 1, 8 | "last_column": 26, 9 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 10 | "header": {"type": "PT_ENTITY_HEADER"} 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /parser_tests/entity2.vhd: -------------------------------------------------------------------------------- 1 | entity test is end entity; 2 | -------------------------------------------------------------------------------- /parser_tests/entity3.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ENTITY", 5 | "first_line": 1, 6 | "first_column": 1, 7 | "last_line": 1, 8 | "last_column": 25, 9 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 10 | "header": {"type": "PT_ENTITY_HEADER"} 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /parser_tests/entity3.vhd: -------------------------------------------------------------------------------- 1 | entity test is begin end; 2 | -------------------------------------------------------------------------------- /parser_tests/entity4.fail: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArcaneNibble/yavhdl/0dae62b5ff56a48f54da24188ea4d30c64a93d4e/parser_tests/entity4.fail -------------------------------------------------------------------------------- /parser_tests/entity4.vhd: -------------------------------------------------------------------------------- 1 | entity test begin end; 2 | -------------------------------------------------------------------------------- /parser_tests/expr1.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "expression": { 5 | "op": "+", 6 | "type": "PT_BINARY_OPERATOR", 7 | "x": { 8 | "str": "foo", 9 | "type": "PT_BASIC_ID" 10 | }, 11 | "y": { 12 | "str": "bar", 13 | "type": "PT_BASIC_ID" 14 | } 15 | }, 16 | "first_column": 5, 17 | "first_line": 2, 18 | "identifiers": { 19 | "str": "a", 20 | "type": "PT_BASIC_ID" 21 | }, 22 | "last_column": 14, 23 | "last_line": 3, 24 | "subtype": { 25 | "type": "PT_SUBTYPE_INDICATION", 26 | "type_mark": { 27 | "str": "b", 28 | "type": "PT_BASIC_ID" 29 | } 30 | }, 31 | "type": "PT_CONSTANT_DECLARATION" 32 | }, 33 | "first_column": 1, 34 | "first_line": 1, 35 | "header": { 36 | "type": "PT_ENTITY_HEADER" 37 | }, 38 | "identifier": { 39 | "str": "test", 40 | "type": "PT_BASIC_ID" 41 | }, 42 | "last_column": 4, 43 | "last_line": 4, 44 | "type": "PT_ENTITY" 45 | }, 46 | "type": "PT_DESIGN_UNIT" 47 | } -------------------------------------------------------------------------------- /parser_tests/expr1.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | constant a : b := 3 | foo + bar; 4 | end; 5 | -------------------------------------------------------------------------------- /parser_tests/expr10.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "expression": { 5 | "op": "*", 6 | "type": "PT_BINARY_OPERATOR", 7 | "x": { 8 | "op": "+", 9 | "type": "PT_BINARY_OPERATOR", 10 | "x": { 11 | "str": "a", 12 | "type": "PT_BASIC_ID" 13 | }, 14 | "y": { 15 | "str": "b", 16 | "type": "PT_BASIC_ID" 17 | } 18 | }, 19 | "y": { 20 | "str": "c", 21 | "type": "PT_BASIC_ID" 22 | } 23 | }, 24 | "first_column": 5, 25 | "first_line": 2, 26 | "identifiers": { 27 | "str": "a", 28 | "type": "PT_BASIC_ID" 29 | }, 30 | "last_column": 16, 31 | "last_line": 3, 32 | "subtype": { 33 | "type": "PT_SUBTYPE_INDICATION", 34 | "type_mark": { 35 | "str": "b", 36 | "type": "PT_BASIC_ID" 37 | } 38 | }, 39 | "type": "PT_CONSTANT_DECLARATION" 40 | }, 41 | "first_column": 1, 42 | "first_line": 1, 43 | "header": { 44 | "type": "PT_ENTITY_HEADER" 45 | }, 46 | "identifier": { 47 | "str": "test", 48 | "type": "PT_BASIC_ID" 49 | }, 50 | "last_column": 4, 51 | "last_line": 4, 52 | "type": "PT_ENTITY" 53 | }, 54 | "type": "PT_DESIGN_UNIT" 55 | } -------------------------------------------------------------------------------- /parser_tests/expr10.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | constant a : b := 3 | (a + b) * c; 4 | end; 5 | -------------------------------------------------------------------------------- /parser_tests/expr2.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "expression": { 5 | "op": "+", 6 | "type": "PT_BINARY_OPERATOR", 7 | "x": { 8 | "str": "foo", 9 | "type": "PT_BASIC_ID" 10 | }, 11 | "y": { 12 | "op": "*", 13 | "type": "PT_BINARY_OPERATOR", 14 | "x": { 15 | "str": "bar", 16 | "type": "PT_BASIC_ID" 17 | }, 18 | "y": { 19 | "str": "baz", 20 | "type": "PT_BASIC_ID" 21 | } 22 | } 23 | }, 24 | "first_column": 5, 25 | "first_line": 2, 26 | "identifiers": { 27 | "str": "a", 28 | "type": "PT_BASIC_ID" 29 | }, 30 | "last_column": 20, 31 | "last_line": 3, 32 | "subtype": { 33 | "type": "PT_SUBTYPE_INDICATION", 34 | "type_mark": { 35 | "str": "b", 36 | "type": "PT_BASIC_ID" 37 | } 38 | }, 39 | "type": "PT_CONSTANT_DECLARATION" 40 | }, 41 | "first_column": 1, 42 | "first_line": 1, 43 | "header": { 44 | "type": "PT_ENTITY_HEADER" 45 | }, 46 | "identifier": { 47 | "str": "test", 48 | "type": "PT_BASIC_ID" 49 | }, 50 | "last_column": 4, 51 | "last_line": 4, 52 | "type": "PT_ENTITY" 53 | }, 54 | "type": "PT_DESIGN_UNIT" 55 | } -------------------------------------------------------------------------------- /parser_tests/expr2.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | constant a : b := 3 | foo + bar * baz; 4 | end; 5 | -------------------------------------------------------------------------------- /parser_tests/expr3.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "expression": { 5 | "op": "??", 6 | "type": "PT_UNARY_OPERATOR", 7 | "x": { 8 | "str": "foo", 9 | "type": "PT_BASIC_ID" 10 | } 11 | }, 12 | "first_column": 5, 13 | "first_line": 2, 14 | "identifiers": { 15 | "str": "a", 16 | "type": "PT_BASIC_ID" 17 | }, 18 | "last_column": 10, 19 | "last_line": 3, 20 | "subtype": { 21 | "type": "PT_SUBTYPE_INDICATION", 22 | "type_mark": { 23 | "str": "b", 24 | "type": "PT_BASIC_ID" 25 | } 26 | }, 27 | "type": "PT_CONSTANT_DECLARATION" 28 | }, 29 | "first_column": 1, 30 | "first_line": 1, 31 | "header": { 32 | "type": "PT_ENTITY_HEADER" 33 | }, 34 | "identifier": { 35 | "str": "test", 36 | "type": "PT_BASIC_ID" 37 | }, 38 | "last_column": 4, 39 | "last_line": 4, 40 | "type": "PT_ENTITY" 41 | }, 42 | "type": "PT_DESIGN_UNIT" 43 | } -------------------------------------------------------------------------------- /parser_tests/expr3.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | constant a : b := 3 | ??foo; 4 | end; 5 | -------------------------------------------------------------------------------- /parser_tests/expr4.fail: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArcaneNibble/yavhdl/0dae62b5ff56a48f54da24188ea4d30c64a93d4e/parser_tests/expr4.fail -------------------------------------------------------------------------------- /parser_tests/expr4.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | constant a : b := 3 | ??foo + bar; 4 | end; 5 | -------------------------------------------------------------------------------- /parser_tests/expr5.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "expression": { 5 | "op": "??", 6 | "type": "PT_UNARY_OPERATOR", 7 | "x": { 8 | "op": "+", 9 | "type": "PT_BINARY_OPERATOR", 10 | "x": { 11 | "str": "foo", 12 | "type": "PT_BASIC_ID" 13 | }, 14 | "y": { 15 | "str": "bar", 16 | "type": "PT_BASIC_ID" 17 | } 18 | } 19 | }, 20 | "first_column": 5, 21 | "first_line": 2, 22 | "identifiers": { 23 | "str": "a", 24 | "type": "PT_BASIC_ID" 25 | }, 26 | "last_column": 18, 27 | "last_line": 3, 28 | "subtype": { 29 | "type": "PT_SUBTYPE_INDICATION", 30 | "type_mark": { 31 | "str": "b", 32 | "type": "PT_BASIC_ID" 33 | } 34 | }, 35 | "type": "PT_CONSTANT_DECLARATION" 36 | }, 37 | "first_column": 1, 38 | "first_line": 1, 39 | "header": { 40 | "type": "PT_ENTITY_HEADER" 41 | }, 42 | "identifier": { 43 | "str": "test", 44 | "type": "PT_BASIC_ID" 45 | }, 46 | "last_column": 4, 47 | "last_line": 4, 48 | "type": "PT_ENTITY" 49 | }, 50 | "type": "PT_DESIGN_UNIT" 51 | } -------------------------------------------------------------------------------- /parser_tests/expr5.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | constant a : b := 3 | ??(foo + bar); 4 | end; 5 | -------------------------------------------------------------------------------- /parser_tests/expr6.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "expression": { 5 | "op": "nand", 6 | "type": "PT_BINARY_OPERATOR", 7 | "x": { 8 | "op": "/=", 9 | "type": "PT_BINARY_OPERATOR", 10 | "x": { 11 | "str": "foo", 12 | "type": "PT_BASIC_ID" 13 | }, 14 | "y": { 15 | "str": "bar", 16 | "type": "PT_BASIC_ID" 17 | } 18 | }, 19 | "y": { 20 | "str": "baz", 21 | "type": "PT_BASIC_ID" 22 | } 23 | }, 24 | "first_column": 5, 25 | "first_line": 2, 26 | "identifiers": { 27 | "str": "a", 28 | "type": "PT_BASIC_ID" 29 | }, 30 | "last_column": 24, 31 | "last_line": 3, 32 | "subtype": { 33 | "type": "PT_SUBTYPE_INDICATION", 34 | "type_mark": { 35 | "str": "b", 36 | "type": "PT_BASIC_ID" 37 | } 38 | }, 39 | "type": "PT_CONSTANT_DECLARATION" 40 | }, 41 | "first_column": 1, 42 | "first_line": 1, 43 | "header": { 44 | "type": "PT_ENTITY_HEADER" 45 | }, 46 | "identifier": { 47 | "str": "test", 48 | "type": "PT_BASIC_ID" 49 | }, 50 | "last_column": 4, 51 | "last_line": 4, 52 | "type": "PT_ENTITY" 53 | }, 54 | "type": "PT_DESIGN_UNIT" 55 | } -------------------------------------------------------------------------------- /parser_tests/expr6.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | constant a : b := 3 | foo /= bar nand baz; 4 | end; 5 | -------------------------------------------------------------------------------- /parser_tests/expr7.fail: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArcaneNibble/yavhdl/0dae62b5ff56a48f54da24188ea4d30c64a93d4e/parser_tests/expr7.fail -------------------------------------------------------------------------------- /parser_tests/expr7.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | constant a : b := 3 | foo /= bar nand baz nor qux; 4 | end; 5 | -------------------------------------------------------------------------------- /parser_tests/expr8.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "expression": { 5 | "op": "nand", 6 | "type": "PT_BINARY_OPERATOR", 7 | "x": { 8 | "op": "/=", 9 | "type": "PT_BINARY_OPERATOR", 10 | "x": { 11 | "str": "foo", 12 | "type": "PT_BASIC_ID" 13 | }, 14 | "y": { 15 | "str": "bar", 16 | "type": "PT_BASIC_ID" 17 | } 18 | }, 19 | "y": { 20 | "op": "nand", 21 | "type": "PT_UNARY_OPERATOR", 22 | "x": { 23 | "str": "baz", 24 | "type": "PT_BASIC_ID" 25 | } 26 | } 27 | }, 28 | "first_column": 5, 29 | "first_line": 2, 30 | "identifiers": { 31 | "str": "a", 32 | "type": "PT_BASIC_ID" 33 | }, 34 | "last_column": 29, 35 | "last_line": 3, 36 | "subtype": { 37 | "type": "PT_SUBTYPE_INDICATION", 38 | "type_mark": { 39 | "str": "b", 40 | "type": "PT_BASIC_ID" 41 | } 42 | }, 43 | "type": "PT_CONSTANT_DECLARATION" 44 | }, 45 | "first_column": 1, 46 | "first_line": 1, 47 | "header": { 48 | "type": "PT_ENTITY_HEADER" 49 | }, 50 | "identifier": { 51 | "str": "test", 52 | "type": "PT_BASIC_ID" 53 | }, 54 | "last_column": 4, 55 | "last_line": 4, 56 | "type": "PT_ENTITY" 57 | }, 58 | "type": "PT_DESIGN_UNIT" 59 | } -------------------------------------------------------------------------------- /parser_tests/expr8.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | constant a : b := 3 | foo /= bar nand nand baz; 4 | end; 5 | -------------------------------------------------------------------------------- /parser_tests/expr9.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "expression": { 5 | "type": "PT_LIT_NULL" 6 | }, 7 | "first_column": 5, 8 | "first_line": 2, 9 | "identifiers": { 10 | "str": "a", 11 | "type": "PT_BASIC_ID" 12 | }, 13 | "last_column": 9, 14 | "last_line": 3, 15 | "subtype": { 16 | "type": "PT_SUBTYPE_INDICATION", 17 | "type_mark": { 18 | "str": "b", 19 | "type": "PT_BASIC_ID" 20 | } 21 | }, 22 | "type": "PT_CONSTANT_DECLARATION" 23 | }, 24 | "first_column": 1, 25 | "first_line": 1, 26 | "header": { 27 | "type": "PT_ENTITY_HEADER" 28 | }, 29 | "identifier": { 30 | "str": "test", 31 | "type": "PT_BASIC_ID" 32 | }, 33 | "last_column": 4, 34 | "last_line": 4, 35 | "type": "PT_ENTITY" 36 | }, 37 | "type": "PT_DESIGN_UNIT" 38 | } -------------------------------------------------------------------------------- /parser_tests/expr9.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | constant a : b := 3 | null; 4 | end; 5 | -------------------------------------------------------------------------------- /parser_tests/expr_primary1.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "expression": { 5 | "alloc": { 6 | "type": "PT_SUBTYPE_INDICATION", 7 | "type_mark": { 8 | "str": "foo", 9 | "type": "PT_BASIC_ID" 10 | } 11 | }, 12 | "type": "PT_ALLOCATOR" 13 | }, 14 | "first_column": 5, 15 | "first_line": 2, 16 | "identifiers": { 17 | "str": "a", 18 | "type": "PT_BASIC_ID" 19 | }, 20 | "last_column": 12, 21 | "last_line": 3, 22 | "subtype": { 23 | "type": "PT_SUBTYPE_INDICATION", 24 | "type_mark": { 25 | "str": "b", 26 | "type": "PT_BASIC_ID" 27 | } 28 | }, 29 | "type": "PT_CONSTANT_DECLARATION" 30 | }, 31 | "first_column": 1, 32 | "first_line": 1, 33 | "header": { 34 | "type": "PT_ENTITY_HEADER" 35 | }, 36 | "identifier": { 37 | "str": "test", 38 | "type": "PT_BASIC_ID" 39 | }, 40 | "last_column": 4, 41 | "last_line": 4, 42 | "type": "PT_ENTITY" 43 | }, 44 | "type": "PT_DESIGN_UNIT" 45 | } -------------------------------------------------------------------------------- /parser_tests/expr_primary1.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | constant a : b := 3 | new foo; 4 | end; 5 | -------------------------------------------------------------------------------- /parser_tests/expr_primary2.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "expression": { 5 | "alloc": { 6 | "constraint": { 7 | "index_constraint": { 8 | "str": "bar", 9 | "type": "PT_BASIC_ID" 10 | }, 11 | "type": "PT_ARRAY_CONSTRAINT" 12 | }, 13 | "type": "PT_SUBTYPE_INDICATION", 14 | "type_mark": { 15 | "str": "foo", 16 | "type": "PT_BASIC_ID" 17 | } 18 | }, 19 | "type": "PT_ALLOCATOR" 20 | }, 21 | "first_column": 5, 22 | "first_line": 2, 23 | "identifiers": { 24 | "str": "a", 25 | "type": "PT_BASIC_ID" 26 | }, 27 | "last_column": 17, 28 | "last_line": 3, 29 | "subtype": { 30 | "type": "PT_SUBTYPE_INDICATION", 31 | "type_mark": { 32 | "str": "b", 33 | "type": "PT_BASIC_ID" 34 | } 35 | }, 36 | "type": "PT_CONSTANT_DECLARATION" 37 | }, 38 | "first_column": 1, 39 | "first_line": 1, 40 | "header": { 41 | "type": "PT_ENTITY_HEADER" 42 | }, 43 | "identifier": { 44 | "str": "test", 45 | "type": "PT_BASIC_ID" 46 | }, 47 | "last_column": 4, 48 | "last_line": 4, 49 | "type": "PT_ENTITY" 50 | }, 51 | "type": "PT_DESIGN_UNIT" 52 | } -------------------------------------------------------------------------------- /parser_tests/expr_primary2.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | constant a : b := 3 | new foo(bar); 4 | end; 5 | -------------------------------------------------------------------------------- /parser_tests/expr_primary3.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "expression": { 5 | "alloc": { 6 | "expression": { 7 | "str": "bar", 8 | "type": "PT_BASIC_ID" 9 | }, 10 | "qualify_type": { 11 | "str": "foo", 12 | "type": "PT_BASIC_ID" 13 | }, 14 | "type": "PT_QUALIFIED_EXPRESSION" 15 | }, 16 | "type": "PT_ALLOCATOR" 17 | }, 18 | "first_column": 5, 19 | "first_line": 2, 20 | "identifiers": { 21 | "str": "a", 22 | "type": "PT_BASIC_ID" 23 | }, 24 | "last_column": 18, 25 | "last_line": 3, 26 | "subtype": { 27 | "type": "PT_SUBTYPE_INDICATION", 28 | "type_mark": { 29 | "str": "b", 30 | "type": "PT_BASIC_ID" 31 | } 32 | }, 33 | "type": "PT_CONSTANT_DECLARATION" 34 | }, 35 | "first_column": 1, 36 | "first_line": 1, 37 | "header": { 38 | "type": "PT_ENTITY_HEADER" 39 | }, 40 | "identifier": { 41 | "str": "test", 42 | "type": "PT_BASIC_ID" 43 | }, 44 | "last_column": 4, 45 | "last_line": 4, 46 | "type": "PT_ENTITY" 47 | }, 48 | "type": "PT_DESIGN_UNIT" 49 | } -------------------------------------------------------------------------------- /parser_tests/expr_primary3.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | constant a : b := 3 | new foo'(bar); 4 | end; 5 | -------------------------------------------------------------------------------- /parser_tests/expr_primary4.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "expression": { 5 | "expression": { 6 | "str": "bar", 7 | "type": "PT_BASIC_ID" 8 | }, 9 | "qualify_type": { 10 | "str": "foo", 11 | "type": "PT_BASIC_ID" 12 | }, 13 | "type": "PT_QUALIFIED_EXPRESSION" 14 | }, 15 | "first_column": 5, 16 | "first_line": 2, 17 | "identifiers": { 18 | "str": "a", 19 | "type": "PT_BASIC_ID" 20 | }, 21 | "last_column": 14, 22 | "last_line": 3, 23 | "subtype": { 24 | "type": "PT_SUBTYPE_INDICATION", 25 | "type_mark": { 26 | "str": "b", 27 | "type": "PT_BASIC_ID" 28 | } 29 | }, 30 | "type": "PT_CONSTANT_DECLARATION" 31 | }, 32 | "first_column": 1, 33 | "first_line": 1, 34 | "header": { 35 | "type": "PT_ENTITY_HEADER" 36 | }, 37 | "identifier": { 38 | "str": "test", 39 | "type": "PT_BASIC_ID" 40 | }, 41 | "last_column": 4, 42 | "last_line": 4, 43 | "type": "PT_ENTITY" 44 | }, 45 | "type": "PT_DESIGN_UNIT" 46 | } -------------------------------------------------------------------------------- /parser_tests/expr_primary4.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | constant a : b := 3 | foo'(bar); 4 | end; 5 | -------------------------------------------------------------------------------- /parser_tests/expr_primary5.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "expression": { 5 | "expression": { 6 | "rest": { 7 | "expression": { 8 | "str": "bar", 9 | "type": "PT_BASIC_ID" 10 | }, 11 | "type": "PT_ELEMENT_ASSOCIATION" 12 | }, 13 | "this_piece": { 14 | "expression": { 15 | "str": "baz", 16 | "type": "PT_BASIC_ID" 17 | }, 18 | "type": "PT_ELEMENT_ASSOCIATION" 19 | }, 20 | "type": "PT_AGGREGATE" 21 | }, 22 | "qualify_type": { 23 | "str": "foo", 24 | "type": "PT_BASIC_ID" 25 | }, 26 | "type": "PT_QUALIFIED_EXPRESSION" 27 | }, 28 | "first_column": 5, 29 | "first_line": 2, 30 | "identifiers": { 31 | "str": "a", 32 | "type": "PT_BASIC_ID" 33 | }, 34 | "last_column": 19, 35 | "last_line": 3, 36 | "subtype": { 37 | "type": "PT_SUBTYPE_INDICATION", 38 | "type_mark": { 39 | "str": "b", 40 | "type": "PT_BASIC_ID" 41 | } 42 | }, 43 | "type": "PT_CONSTANT_DECLARATION" 44 | }, 45 | "first_column": 1, 46 | "first_line": 1, 47 | "header": { 48 | "type": "PT_ENTITY_HEADER" 49 | }, 50 | "identifier": { 51 | "str": "test", 52 | "type": "PT_BASIC_ID" 53 | }, 54 | "last_column": 4, 55 | "last_line": 4, 56 | "type": "PT_ENTITY" 57 | }, 58 | "type": "PT_DESIGN_UNIT" 59 | } -------------------------------------------------------------------------------- /parser_tests/expr_primary5.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | constant a : b := 3 | foo'(bar, baz); 4 | end; 5 | -------------------------------------------------------------------------------- /parser_tests/expr_primary6.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | constant a : b := 3 | foo'(bar, baz => qux); 4 | end; 5 | -------------------------------------------------------------------------------- /parser_tests/expr_primary7.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | constant a : b := 3 | foo'(bar, baz|others => qux); 4 | end; 5 | -------------------------------------------------------------------------------- /parser_tests/expr_primary8.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | constant a : b := 3 | foo'(bar, aa+bb|cc'dd => qux); 4 | end; 5 | -------------------------------------------------------------------------------- /parser_tests/ext_id1.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ENTITY", 5 | "first_line": 1, 6 | "first_column": 1, 7 | "last_line": 1, 8 | "last_column": 21, 9 | "identifier": {"type": "PT_EXT_ID", "str": "test"}, 10 | "header": {"type": "PT_ENTITY_HEADER"} 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /parser_tests/ext_id1.vhd: -------------------------------------------------------------------------------- 1 | entity \test\ is end; 2 | -------------------------------------------------------------------------------- /parser_tests/ext_id2.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ENTITY", 5 | "first_line": 1, 6 | "first_column": 1, 7 | "last_line": 1, 8 | "last_column": 23, 9 | "identifier": {"type": "PT_EXT_ID", "str": "t\\est"}, 10 | "header": {"type": "PT_ENTITY_HEADER"} 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /parser_tests/ext_id2.vhd: -------------------------------------------------------------------------------- 1 | entity \t\\est\ is end; 2 | -------------------------------------------------------------------------------- /parser_tests/ext_id3.fail: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArcaneNibble/yavhdl/0dae62b5ff56a48f54da24188ea4d30c64a93d4e/parser_tests/ext_id3.fail -------------------------------------------------------------------------------- /parser_tests/ext_id3.vhd: -------------------------------------------------------------------------------- 1 | entity \t\\\est\ is end; 2 | -------------------------------------------------------------------------------- /parser_tests/ext_id4.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ENTITY", 5 | "first_line": 1, 6 | "first_column": 1, 7 | "last_line": 1, 8 | "last_column": 22, 9 | "identifier": {"type": "PT_EXT_ID", "str": "test×"}, 10 | "header": {"type": "PT_ENTITY_HEADER"} 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /parser_tests/ext_id4.vhd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArcaneNibble/yavhdl/0dae62b5ff56a48f54da24188ea4d30c64a93d4e/parser_tests/ext_id4.vhd -------------------------------------------------------------------------------- /parser_tests/ext_id5.fail: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArcaneNibble/yavhdl/0dae62b5ff56a48f54da24188ea4d30c64a93d4e/parser_tests/ext_id5.fail -------------------------------------------------------------------------------- /parser_tests/ext_id5.vhd: -------------------------------------------------------------------------------- 1 | entity \test 2 | \ is end; 3 | -------------------------------------------------------------------------------- /parser_tests/file_decl1.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ENTITY", 5 | "first_line": 1, "first_column": 1, "last_line": 3, "last_column": 4, 6 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 7 | "header": {"type": "PT_ENTITY_HEADER"}, 8 | "declarations": { 9 | "type": "PT_FILE_DECLARATION", 10 | "first_line": 2, "first_column": 5, 11 | "last_line": 2, "last_column": 19, 12 | "identifiers": {"type": "PT_BASIC_ID", "str": "foo"}, 13 | "subtype": { 14 | "type": "PT_SUBTYPE_INDICATION", 15 | "type_mark": {"type": "PT_BASIC_ID", "str": "bar"} 16 | } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /parser_tests/file_decl1.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | file foo : bar; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/file_decl2.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ENTITY", 5 | "first_line": 1, "first_column": 1, "last_line": 3, "last_column": 4, 6 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 7 | "header": {"type": "PT_ENTITY_HEADER"}, 8 | "declarations": { 9 | "type": "PT_FILE_DECLARATION", 10 | "first_line": 2, "first_column": 5, 11 | "last_line": 2, "last_column": 28, 12 | "identifiers": {"type": "PT_BASIC_ID", "str": "foo"}, 13 | "subtype": { 14 | "type": "PT_SUBTYPE_INDICATION", 15 | "type_mark": {"type": "PT_BASIC_ID", "str": "bar"} 16 | }, 17 | "open_information": { 18 | "type": "PT_FILE_OPEN_INFORMATION", 19 | "logical_name": {"type": "PT_LIT_STRING", "str": "baz"} 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /parser_tests/file_decl2.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | file foo : bar is "baz"; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/file_decl3.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ENTITY", 5 | "first_line": 1, "first_column": 1, "last_line": 3, "last_column": 4, 6 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 7 | "header": {"type": "PT_ENTITY_HEADER"}, 8 | "declarations": { 9 | "type": "PT_FILE_DECLARATION", 10 | "first_line": 2, "first_column": 5, 11 | "last_line": 2, "last_column": 37, 12 | "identifiers": {"type": "PT_BASIC_ID", "str": "foo"}, 13 | "subtype": { 14 | "type": "PT_SUBTYPE_INDICATION", 15 | "type_mark": {"type": "PT_BASIC_ID", "str": "bar"} 16 | }, 17 | "open_information": { 18 | "type": "PT_FILE_OPEN_INFORMATION", 19 | "logical_name": {"type": "PT_LIT_STRING", "str": "baz"}, 20 | "open_kind": {"type": "PT_BASIC_ID", "str": "qux"} 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /parser_tests/file_decl3.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | file foo : bar open qux is "baz"; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/file_decl4.fail: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArcaneNibble/yavhdl/0dae62b5ff56a48f54da24188ea4d30c64a93d4e/parser_tests/file_decl4.fail -------------------------------------------------------------------------------- /parser_tests/file_decl4.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | file foo : bar open qux; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/lit_based1.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ENTITY", 5 | "first_line": 1, "first_column": 1, "last_line": 3, "last_column": 4, 6 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 7 | "header": {"type": "PT_ENTITY_HEADER"}, 8 | "declarations": { 9 | "type": "PT_FULL_TYPE_DECLARATION", 10 | "first_line": 2, "first_column": 5, 11 | "last_line": 2, "last_column": 30, 12 | "identifier": {"type": "PT_BASIC_ID", "str": "t"}, 13 | "definition": { 14 | "type": "PT_INTEGER_FLOAT_TYPE_DEFINITION", 15 | "range": { 16 | "type": "PT_RANGE", 17 | "dir": "to", 18 | "x": {"type": "PT_LIT_DECIMAL", "str": "0"}, 19 | "y": {"type": "PT_LIT_BASED", "str": "2#1#"} 20 | } 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /parser_tests/lit_based1.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | type t is range 0 to 2#1#; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/lit_based2.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ENTITY", 5 | "first_line": 1, "first_column": 1, "last_line": 3, "last_column": 4, 6 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 7 | "header": {"type": "PT_ENTITY_HEADER"}, 8 | "declarations": { 9 | "type": "PT_FULL_TYPE_DECLARATION", 10 | "first_line": 2, "first_column": 5, 11 | "last_line": 2, "last_column": 32, 12 | "identifier": {"type": "PT_BASIC_ID", "str": "t"}, 13 | "definition": { 14 | "type": "PT_INTEGER_FLOAT_TYPE_DEFINITION", 15 | "range": { 16 | "type": "PT_RANGE", 17 | "dir": "to", 18 | "x": {"type": "PT_LIT_DECIMAL", "str": "0"}, 19 | "y": {"type": "PT_LIT_BASED", "str": "2#1.1#"} 20 | } 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /parser_tests/lit_based2.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | type t is range 0 to 2#1.1#; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/lit_based3.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ENTITY", 5 | "first_line": 1, "first_column": 1, "last_line": 3, "last_column": 4, 6 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 7 | "header": {"type": "PT_ENTITY_HEADER"}, 8 | "declarations": { 9 | "type": "PT_FULL_TYPE_DECLARATION", 10 | "first_line": 2, "first_column": 5, 11 | "last_line": 2, "last_column": 34, 12 | "identifier": {"type": "PT_BASIC_ID", "str": "t"}, 13 | "definition": { 14 | "type": "PT_INTEGER_FLOAT_TYPE_DEFINITION", 15 | "range": { 16 | "type": "PT_RANGE", 17 | "dir": "to", 18 | "x": {"type": "PT_LIT_DECIMAL", "str": "0"}, 19 | "y": {"type": "PT_LIT_BASED", "str": "2#1.1#e2"} 20 | } 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /parser_tests/lit_based3.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | type t is range 0 to 2#1.1#e2; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/lit_based4.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ENTITY", 5 | "first_line": 1, "first_column": 1, "last_line": 3, "last_column": 4, 6 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 7 | "header": {"type": "PT_ENTITY_HEADER"}, 8 | "declarations": { 9 | "type": "PT_FULL_TYPE_DECLARATION", 10 | "first_line": 2, "first_column": 5, 11 | "last_line": 2, "last_column": 35, 12 | "identifier": {"type": "PT_BASIC_ID", "str": "t"}, 13 | "definition": { 14 | "type": "PT_INTEGER_FLOAT_TYPE_DEFINITION", 15 | "range": { 16 | "type": "PT_RANGE", 17 | "dir": "to", 18 | "x": {"type": "PT_LIT_DECIMAL", "str": "0"}, 19 | "y": {"type": "PT_LIT_BASED", "str": "16#f.f#e2"} 20 | } 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /parser_tests/lit_based4.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | type t is range 0 to 16#f.f#e2; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/lit_based5.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ENTITY", 5 | "first_line": 1, "first_column": 1, "last_line": 3, "last_column": 4, 6 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 7 | "header": {"type": "PT_ENTITY_HEADER"}, 8 | "declarations": { 9 | "type": "PT_FULL_TYPE_DECLARATION", 10 | "first_line": 2, "first_column": 5, 11 | "last_line": 2, "last_column": 36, 12 | "identifier": {"type": "PT_BASIC_ID", "str": "t"}, 13 | "definition": { 14 | "type": "PT_INTEGER_FLOAT_TYPE_DEFINITION", 15 | "range": { 16 | "type": "PT_RANGE", 17 | "dir": "to", 18 | "x": {"type": "PT_LIT_DECIMAL", "str": "0"}, 19 | "y": {"type": "PT_LIT_BASED", "str": "16#f.f#e+2"} 20 | } 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /parser_tests/lit_based5.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | type t is range 0 to 16#f.f#e+2; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/lit_based6.fail: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArcaneNibble/yavhdl/0dae62b5ff56a48f54da24188ea4d30c64a93d4e/parser_tests/lit_based6.fail -------------------------------------------------------------------------------- /parser_tests/lit_based6.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | type t is range 0 to 16#g.f#2; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/lit_based7.fail: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArcaneNibble/yavhdl/0dae62b5ff56a48f54da24188ea4d30c64a93d4e/parser_tests/lit_based7.fail -------------------------------------------------------------------------------- /parser_tests/lit_based7.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | type t is range 0 to 16#f.f2; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/lit_based8.fail: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArcaneNibble/yavhdl/0dae62b5ff56a48f54da24188ea4d30c64a93d4e/parser_tests/lit_based8.fail -------------------------------------------------------------------------------- /parser_tests/lit_based8.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | type t is range 0 to 16#f.f#2.; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/lit_based9.fail: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArcaneNibble/yavhdl/0dae62b5ff56a48f54da24188ea4d30c64a93d4e/parser_tests/lit_based9.fail -------------------------------------------------------------------------------- /parser_tests/lit_based9.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | type t is range 0 to 2#1.1#2; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/lit_dec1.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ENTITY", 5 | "first_line": 1, "first_column": 1, "last_line": 3, "last_column": 4, 6 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 7 | "header": {"type": "PT_ENTITY_HEADER"}, 8 | "declarations": { 9 | "type": "PT_FULL_TYPE_DECLARATION", 10 | "first_line": 2, "first_column": 5, 11 | "last_line": 2, "last_column": 29, 12 | "identifier": {"type": "PT_BASIC_ID", "str": "t"}, 13 | "definition": { 14 | "type": "PT_INTEGER_FLOAT_TYPE_DEFINITION", 15 | "range": { 16 | "type": "PT_RANGE", 17 | "dir": "to", 18 | "x": {"type": "PT_LIT_DECIMAL", "str": "0"}, 19 | "y": {"type": "PT_LIT_DECIMAL", "str": "1.0"} 20 | } 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /parser_tests/lit_dec1.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | type t is range 0 to 1.0; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/lit_dec2.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ENTITY", 5 | "first_line": 1, "first_column": 1, "last_line": 3, "last_column": 4, 6 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 7 | "header": {"type": "PT_ENTITY_HEADER"}, 8 | "declarations": { 9 | "type": "PT_FULL_TYPE_DECLARATION", 10 | "first_line": 2, "first_column": 5, 11 | "last_line": 2, "last_column": 29, 12 | "identifier": {"type": "PT_BASIC_ID", "str": "t"}, 13 | "definition": { 14 | "type": "PT_INTEGER_FLOAT_TYPE_DEFINITION", 15 | "range": { 16 | "type": "PT_RANGE", 17 | "dir": "to", 18 | "x": {"type": "PT_LIT_DECIMAL", "str": "0"}, 19 | "y": {"type": "PT_LIT_DECIMAL", "str": "1e2"} 20 | } 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /parser_tests/lit_dec2.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | type t is range 0 to 1e2; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/lit_dec3.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ENTITY", 5 | "first_line": 1, "first_column": 1, "last_line": 3, "last_column": 4, 6 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 7 | "header": {"type": "PT_ENTITY_HEADER"}, 8 | "declarations": { 9 | "type": "PT_FULL_TYPE_DECLARATION", 10 | "first_line": 2, "first_column": 5, 11 | "last_line": 2, "last_column": 30, 12 | "identifier": {"type": "PT_BASIC_ID", "str": "t"}, 13 | "definition": { 14 | "type": "PT_INTEGER_FLOAT_TYPE_DEFINITION", 15 | "range": { 16 | "type": "PT_RANGE", 17 | "dir": "to", 18 | "x": {"type": "PT_LIT_DECIMAL", "str": "0"}, 19 | "y": {"type": "PT_LIT_DECIMAL", "str": "1E-2"} 20 | } 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /parser_tests/lit_dec3.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | type t is range 0 to 1E-2; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/lit_dec4.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ENTITY", 5 | "first_line": 1, "first_column": 1, "last_line": 3, "last_column": 4, 6 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 7 | "header": {"type": "PT_ENTITY_HEADER"}, 8 | "declarations": { 9 | "type": "PT_FULL_TYPE_DECLARATION", 10 | "first_line": 2, "first_column": 5, 11 | "last_line": 2, "last_column": 32, 12 | "identifier": {"type": "PT_BASIC_ID", "str": "t"}, 13 | "definition": { 14 | "type": "PT_INTEGER_FLOAT_TYPE_DEFINITION", 15 | "range": { 16 | "type": "PT_RANGE", 17 | "dir": "to", 18 | "x": {"type": "PT_LIT_DECIMAL", "str": "0"}, 19 | "y": {"type": "PT_LIT_DECIMAL", "str": "1.0E+2"} 20 | } 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /parser_tests/lit_dec4.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | type t is range 0 to 1.0E+2; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/lit_dec5.fail: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArcaneNibble/yavhdl/0dae62b5ff56a48f54da24188ea4d30c64a93d4e/parser_tests/lit_dec5.fail -------------------------------------------------------------------------------- /parser_tests/lit_dec5.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | type t is range 0 to 1.e2; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/lit_dec6.fail: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArcaneNibble/yavhdl/0dae62b5ff56a48f54da24188ea4d30c64a93d4e/parser_tests/lit_dec6.fail -------------------------------------------------------------------------------- /parser_tests/lit_dec6.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | type t is range 0 to 1.0.E+2; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/lit_dec7.fail: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArcaneNibble/yavhdl/0dae62b5ff56a48f54da24188ea4d30c64a93d4e/parser_tests/lit_dec7.fail -------------------------------------------------------------------------------- /parser_tests/lit_dec7.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | type t is range 0 to 1.0.E+2e3; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/name1.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "expression": { 5 | "name": { 6 | "str": "foo", 7 | "type": "PT_BASIC_ID" 8 | }, 9 | "suffix": { 10 | "str": "bar", 11 | "type": "PT_BASIC_ID" 12 | }, 13 | "type": "PT_NAME_SELECTED" 14 | }, 15 | "first_column": 5, 16 | "first_line": 2, 17 | "identifiers": { 18 | "str": "a", 19 | "type": "PT_BASIC_ID" 20 | }, 21 | "last_column": 12, 22 | "last_line": 3, 23 | "subtype": { 24 | "type": "PT_SUBTYPE_INDICATION", 25 | "type_mark": { 26 | "str": "b", 27 | "type": "PT_BASIC_ID" 28 | } 29 | }, 30 | "type": "PT_CONSTANT_DECLARATION" 31 | }, 32 | "first_column": 1, 33 | "first_line": 1, 34 | "header": { 35 | "type": "PT_ENTITY_HEADER" 36 | }, 37 | "identifier": { 38 | "str": "test", 39 | "type": "PT_BASIC_ID" 40 | }, 41 | "last_column": 4, 42 | "last_line": 4, 43 | "type": "PT_ENTITY" 44 | }, 45 | "type": "PT_DESIGN_UNIT" 46 | } -------------------------------------------------------------------------------- /parser_tests/name1.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | constant a : b := 3 | foo.bar; 4 | end; 5 | -------------------------------------------------------------------------------- /parser_tests/name2.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "expression": { 5 | "name": { 6 | "name": { 7 | "name": { 8 | "str": "foo", 9 | "type": "PT_BASIC_ID" 10 | }, 11 | "suffix": { 12 | "str": "bar", 13 | "type": "PT_BASIC_ID" 14 | }, 15 | "type": "PT_NAME_SELECTED" 16 | }, 17 | "parens": { 18 | "str": "baz", 19 | "type": "PT_BASIC_ID" 20 | }, 21 | "type": "PT_NAME_AMBIG_PARENS" 22 | }, 23 | "suffix": { 24 | "str": "qux", 25 | "type": "PT_BASIC_ID" 26 | }, 27 | "type": "PT_NAME_SELECTED" 28 | }, 29 | "first_column": 5, 30 | "first_line": 2, 31 | "identifiers": { 32 | "str": "a", 33 | "type": "PT_BASIC_ID" 34 | }, 35 | "last_column": 21, 36 | "last_line": 3, 37 | "subtype": { 38 | "type": "PT_SUBTYPE_INDICATION", 39 | "type_mark": { 40 | "str": "b", 41 | "type": "PT_BASIC_ID" 42 | } 43 | }, 44 | "type": "PT_CONSTANT_DECLARATION" 45 | }, 46 | "first_column": 1, 47 | "first_line": 1, 48 | "header": { 49 | "type": "PT_ENTITY_HEADER" 50 | }, 51 | "identifier": { 52 | "str": "test", 53 | "type": "PT_BASIC_ID" 54 | }, 55 | "last_column": 4, 56 | "last_line": 4, 57 | "type": "PT_ENTITY" 58 | }, 59 | "type": "PT_DESIGN_UNIT" 60 | } -------------------------------------------------------------------------------- /parser_tests/name2.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | constant a : b := 3 | foo.bar(baz).qux; 4 | end; 5 | -------------------------------------------------------------------------------- /parser_tests/name3.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "expression": { 5 | "name": { 6 | "name": { 7 | "str": "foo", 8 | "type": "PT_BASIC_ID" 9 | }, 10 | "parens": { 11 | "str": "5", 12 | "type": "PT_LIT_DECIMAL" 13 | }, 14 | "type": "PT_NAME_AMBIG_PARENS" 15 | }, 16 | "parens": { 17 | "dir": "to", 18 | "type": "PT_RANGE", 19 | "x": { 20 | "str": "0", 21 | "type": "PT_LIT_DECIMAL" 22 | }, 23 | "y": { 24 | "str": "2", 25 | "type": "PT_LIT_DECIMAL" 26 | } 27 | }, 28 | "type": "PT_NAME_SLICE" 29 | }, 30 | "first_column": 5, 31 | "first_line": 2, 32 | "identifiers": { 33 | "str": "a", 34 | "type": "PT_BASIC_ID" 35 | }, 36 | "last_column": 19, 37 | "last_line": 3, 38 | "subtype": { 39 | "type": "PT_SUBTYPE_INDICATION", 40 | "type_mark": { 41 | "str": "b", 42 | "type": "PT_BASIC_ID" 43 | } 44 | }, 45 | "type": "PT_CONSTANT_DECLARATION" 46 | }, 47 | "first_column": 1, 48 | "first_line": 1, 49 | "header": { 50 | "type": "PT_ENTITY_HEADER" 51 | }, 52 | "identifier": { 53 | "str": "test", 54 | "type": "PT_BASIC_ID" 55 | }, 56 | "last_column": 4, 57 | "last_line": 4, 58 | "type": "PT_ENTITY" 59 | }, 60 | "type": "PT_DESIGN_UNIT" 61 | } -------------------------------------------------------------------------------- /parser_tests/name3.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | constant a : b := 3 | foo(5)(0 to 2); 4 | end; 5 | -------------------------------------------------------------------------------- /parser_tests/name4.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "expression": { 5 | "name": { 6 | "name": { 7 | "str": "foo", 8 | "type": "PT_BASIC_ID" 9 | }, 10 | "parens": { 11 | "str": "5", 12 | "type": "PT_LIT_DECIMAL" 13 | }, 14 | "type": "PT_NAME_AMBIG_PARENS" 15 | }, 16 | "suffix": { 17 | "str": "bar", 18 | "type": "PT_BASIC_ID" 19 | }, 20 | "type": "PT_NAME_SELECTED" 21 | }, 22 | "first_column": 5, 23 | "first_line": 2, 24 | "identifiers": { 25 | "str": "a", 26 | "type": "PT_BASIC_ID" 27 | }, 28 | "last_column": 15, 29 | "last_line": 3, 30 | "subtype": { 31 | "type": "PT_SUBTYPE_INDICATION", 32 | "type_mark": { 33 | "str": "b", 34 | "type": "PT_BASIC_ID" 35 | } 36 | }, 37 | "type": "PT_CONSTANT_DECLARATION" 38 | }, 39 | "first_column": 1, 40 | "first_line": 1, 41 | "header": { 42 | "type": "PT_ENTITY_HEADER" 43 | }, 44 | "identifier": { 45 | "str": "test", 46 | "type": "PT_BASIC_ID" 47 | }, 48 | "last_column": 4, 49 | "last_line": 4, 50 | "type": "PT_ENTITY" 51 | }, 52 | "type": "PT_DESIGN_UNIT" 53 | } -------------------------------------------------------------------------------- /parser_tests/name4.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | constant a : b := 3 | foo(5).bar; 4 | end; 5 | -------------------------------------------------------------------------------- /parser_tests/name5.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "expression": { 5 | "name": { 6 | "str": "foo", 7 | "type": "PT_BASIC_ID" 8 | }, 9 | "parens": { 10 | "dir": "to", 11 | "type": "PT_RANGE", 12 | "x": { 13 | "str": "0", 14 | "type": "PT_LIT_DECIMAL" 15 | }, 16 | "y": { 17 | "str": "2", 18 | "type": "PT_LIT_DECIMAL" 19 | } 20 | }, 21 | "type": "PT_NAME_SLICE" 22 | }, 23 | "first_column": 5, 24 | "first_line": 2, 25 | "identifiers": { 26 | "str": "a", 27 | "type": "PT_BASIC_ID" 28 | }, 29 | "last_column": 16, 30 | "last_line": 3, 31 | "subtype": { 32 | "type": "PT_SUBTYPE_INDICATION", 33 | "type_mark": { 34 | "str": "b", 35 | "type": "PT_BASIC_ID" 36 | } 37 | }, 38 | "type": "PT_CONSTANT_DECLARATION" 39 | }, 40 | "first_column": 1, 41 | "first_line": 1, 42 | "header": { 43 | "type": "PT_ENTITY_HEADER" 44 | }, 45 | "identifier": { 46 | "str": "test", 47 | "type": "PT_BASIC_ID" 48 | }, 49 | "last_column": 4, 50 | "last_line": 4, 51 | "type": "PT_ENTITY" 52 | }, 53 | "type": "PT_DESIGN_UNIT" 54 | } -------------------------------------------------------------------------------- /parser_tests/name5.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | constant a : b := 3 | foo(0 to 2); 4 | end; 5 | -------------------------------------------------------------------------------- /parser_tests/name6.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | constant a : b := 3 | foo(0 to 2)'bar; 4 | end; 5 | -------------------------------------------------------------------------------- /parser_tests/name7.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | constant a : b := 3 | foo(0 to 2)'bar(bax); 4 | end; 5 | -------------------------------------------------------------------------------- /parser_tests/name_ext1.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | constant a : b := 3 | <>; 4 | end; 5 | -------------------------------------------------------------------------------- /parser_tests/name_ext2.fail: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArcaneNibble/yavhdl/0dae62b5ff56a48f54da24188ea4d30c64a93d4e/parser_tests/name_ext2.fail -------------------------------------------------------------------------------- /parser_tests/name_ext2.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | constant a : b := 3 | <>; 4 | end; 5 | -------------------------------------------------------------------------------- /parser_tests/name_ext3.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "expression": { 5 | "pathname": { 6 | "pathname": { 7 | "object": { 8 | "str": "foo", 9 | "type": "PT_BASIC_ID" 10 | }, 11 | "type": "PT_PARTIAL_PATHNAME" 12 | }, 13 | "type": "PT_ABSOLUTE_PATHNAME" 14 | }, 15 | "subtype_indication": { 16 | "type": "PT_SUBTYPE_INDICATION", 17 | "type_mark": { 18 | "str": "t", 19 | "type": "PT_BASIC_ID" 20 | } 21 | }, 22 | "type": "PT_NAME_EXT_CONST" 23 | }, 24 | "first_column": 5, 25 | "first_line": 2, 26 | "identifiers": { 27 | "str": "a", 28 | "type": "PT_BASIC_ID" 29 | }, 30 | "last_column": 26, 31 | "last_line": 3, 32 | "subtype": { 33 | "type": "PT_SUBTYPE_INDICATION", 34 | "type_mark": { 35 | "str": "b", 36 | "type": "PT_BASIC_ID" 37 | } 38 | }, 39 | "type": "PT_CONSTANT_DECLARATION" 40 | }, 41 | "first_column": 1, 42 | "first_line": 1, 43 | "header": { 44 | "type": "PT_ENTITY_HEADER" 45 | }, 46 | "identifier": { 47 | "str": "test", 48 | "type": "PT_BASIC_ID" 49 | }, 50 | "last_column": 4, 51 | "last_line": 4, 52 | "type": "PT_ENTITY" 53 | }, 54 | "type": "PT_DESIGN_UNIT" 55 | } -------------------------------------------------------------------------------- /parser_tests/name_ext3.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | constant a : b := 3 | <>; 4 | end; 5 | -------------------------------------------------------------------------------- /parser_tests/name_ext4.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | constant a : b := 3 | <>; 4 | end; 5 | -------------------------------------------------------------------------------- /parser_tests/name_ext5.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "expression": { 5 | "pathname": { 6 | "pathname": { 7 | "object": { 8 | "str": "foo", 9 | "type": "PT_BASIC_ID" 10 | }, 11 | "type": "PT_PARTIAL_PATHNAME" 12 | }, 13 | "type": "PT_RELATIVE_PATHNAME", 14 | "up_count": 0 15 | }, 16 | "subtype_indication": { 17 | "type": "PT_SUBTYPE_INDICATION", 18 | "type_mark": { 19 | "str": "t", 20 | "type": "PT_BASIC_ID" 21 | } 22 | }, 23 | "type": "PT_NAME_EXT_CONST" 24 | }, 25 | "first_column": 5, 26 | "first_line": 2, 27 | "identifiers": { 28 | "str": "a", 29 | "type": "PT_BASIC_ID" 30 | }, 31 | "last_column": 25, 32 | "last_line": 3, 33 | "subtype": { 34 | "type": "PT_SUBTYPE_INDICATION", 35 | "type_mark": { 36 | "str": "b", 37 | "type": "PT_BASIC_ID" 38 | } 39 | }, 40 | "type": "PT_CONSTANT_DECLARATION" 41 | }, 42 | "first_column": 1, 43 | "first_line": 1, 44 | "header": { 45 | "type": "PT_ENTITY_HEADER" 46 | }, 47 | "identifier": { 48 | "str": "test", 49 | "type": "PT_BASIC_ID" 50 | }, 51 | "last_column": 4, 52 | "last_line": 4, 53 | "type": "PT_ENTITY" 54 | }, 55 | "type": "PT_DESIGN_UNIT" 56 | } -------------------------------------------------------------------------------- /parser_tests/name_ext5.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | constant a : b := 3 | <>; 4 | end; 5 | -------------------------------------------------------------------------------- /parser_tests/name_ext6.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "expression": { 5 | "pathname": { 6 | "pathname": { 7 | "object": { 8 | "str": "foo", 9 | "type": "PT_BASIC_ID" 10 | }, 11 | "type": "PT_PARTIAL_PATHNAME" 12 | }, 13 | "type": "PT_RELATIVE_PATHNAME", 14 | "up_count": 1 15 | }, 16 | "subtype_indication": { 17 | "type": "PT_SUBTYPE_INDICATION", 18 | "type_mark": { 19 | "str": "t", 20 | "type": "PT_BASIC_ID" 21 | } 22 | }, 23 | "type": "PT_NAME_EXT_CONST" 24 | }, 25 | "first_column": 5, 26 | "first_line": 2, 27 | "identifiers": { 28 | "str": "a", 29 | "type": "PT_BASIC_ID" 30 | }, 31 | "last_column": 27, 32 | "last_line": 3, 33 | "subtype": { 34 | "type": "PT_SUBTYPE_INDICATION", 35 | "type_mark": { 36 | "str": "b", 37 | "type": "PT_BASIC_ID" 38 | } 39 | }, 40 | "type": "PT_CONSTANT_DECLARATION" 41 | }, 42 | "first_column": 1, 43 | "first_line": 1, 44 | "header": { 45 | "type": "PT_ENTITY_HEADER" 46 | }, 47 | "identifier": { 48 | "str": "test", 49 | "type": "PT_BASIC_ID" 50 | }, 51 | "last_column": 4, 52 | "last_line": 4, 53 | "type": "PT_ENTITY" 54 | }, 55 | "type": "PT_DESIGN_UNIT" 56 | } -------------------------------------------------------------------------------- /parser_tests/name_ext6.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | constant a : b := 3 | <>; 4 | end; 5 | -------------------------------------------------------------------------------- /parser_tests/name_ext7.fail: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArcaneNibble/yavhdl/0dae62b5ff56a48f54da24188ea4d30c64a93d4e/parser_tests/name_ext7.fail -------------------------------------------------------------------------------- /parser_tests/name_ext7.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | constant a : b := 3 | <>; 4 | end; 5 | -------------------------------------------------------------------------------- /parser_tests/name_ext8.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | constant a : b := 3 | <>; 4 | end; 5 | -------------------------------------------------------------------------------- /parser_tests/package1.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_PACKAGE_DECLARATION", 5 | "first_line": 1, 6 | "first_column": 1, 7 | "last_line": 1, 8 | "last_column": 20, 9 | "identifier": {"type": "PT_BASIC_ID", "str": "test"} 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /parser_tests/package1.vhd: -------------------------------------------------------------------------------- 1 | package test is end; 2 | -------------------------------------------------------------------------------- /parser_tests/package_body1.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_PACKAGE_BODY", 5 | "first_line": 1, 6 | "first_column": 1, 7 | "last_line": 1, 8 | "last_column": 25, 9 | "identifier": {"type": "PT_BASIC_ID", "str": "test"} 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /parser_tests/package_body1.vhd: -------------------------------------------------------------------------------- 1 | package body test is end; 2 | -------------------------------------------------------------------------------- /parser_tests/package_inst1.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_PACKAGE_INSTANTIATION_DECLARATION", 5 | "first_line": 1, 6 | "first_column": 1, 7 | "last_line": 1, 8 | "last_column": 23, 9 | "identifier": {"type": "PT_BASIC_ID", "str": "foo"}, 10 | "uninstantiated_name": {"type": "PT_BASIC_ID", "str": "bar"} 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /parser_tests/package_inst1.vhd: -------------------------------------------------------------------------------- 1 | package foo is new bar; 2 | -------------------------------------------------------------------------------- /parser_tests/sig_decl1.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ARCHITECTURE", 5 | "first_line": 1, "first_column": 1, "last_line": 3, "last_column": 10, 6 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 7 | "name": {"type": "PT_BASIC_ID", "str": "test2"}, 8 | "declarations": { 9 | "type": "PT_SIGNAL_DECLARATION", 10 | "first_line": 2, "first_column": 5, 11 | "last_line": 2, "last_column": 21, 12 | "identifiers": {"type": "PT_BASIC_ID", "str": "foo"}, 13 | "subtype": { 14 | "type": "PT_SUBTYPE_INDICATION", 15 | "type_mark": {"type": "PT_BASIC_ID", "str": "bar"} 16 | } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /parser_tests/sig_decl1.vhd: -------------------------------------------------------------------------------- 1 | architecture test of test2 is 2 | signal foo : bar; 3 | begin end; 4 | -------------------------------------------------------------------------------- /parser_tests/sig_decl2.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ARCHITECTURE", 5 | "first_line": 1, "first_column": 1, "last_line": 3, "last_column": 10, 6 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 7 | "name": {"type": "PT_BASIC_ID", "str": "test2"}, 8 | "declarations": { 9 | "type": "PT_SIGNAL_DECLARATION", 10 | "first_line": 2, "first_column": 5, 11 | "last_line": 2, "last_column": 28, 12 | "identifiers": {"type": "PT_BASIC_ID", "str": "foo"}, 13 | "subtype": { 14 | "type": "PT_SUBTYPE_INDICATION", 15 | "type_mark": {"type": "PT_BASIC_ID", "str": "bar"} 16 | }, 17 | "expression": {"type": "PT_BASIC_ID", "str": "baz"} 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /parser_tests/sig_decl2.vhd: -------------------------------------------------------------------------------- 1 | architecture test of test2 is 2 | signal foo : bar := baz; 3 | begin end; 4 | -------------------------------------------------------------------------------- /parser_tests/sig_decl3.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ARCHITECTURE", 5 | "first_line": 1, "first_column": 1, "last_line": 3, "last_column": 10, 6 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 7 | "name": {"type": "PT_BASIC_ID", "str": "test2"}, 8 | "declarations": { 9 | "type": "PT_SIGNAL_DECLARATION", 10 | "first_line": 2, "first_column": 5, 11 | "last_line": 2, "last_column": 34, 12 | "identifiers": { 13 | "type": "PT_ID_LIST_REAL", 14 | "rest": {"type": "PT_BASIC_ID", "str": "foo"}, 15 | "this_piece": {"type": "PT_BASIC_ID", "str": "foo2"} 16 | }, 17 | "subtype": { 18 | "type": "PT_SUBTYPE_INDICATION", 19 | "type_mark": {"type": "PT_BASIC_ID", "str": "bar"} 20 | }, 21 | "expression": {"type": "PT_BASIC_ID", "str": "baz"} 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /parser_tests/sig_decl3.vhd: -------------------------------------------------------------------------------- 1 | architecture test of test2 is 2 | signal foo, foo2 : bar := baz; 3 | begin end; 4 | -------------------------------------------------------------------------------- /parser_tests/sig_decl4.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ARCHITECTURE", 5 | "first_line": 1, "first_column": 1, "last_line": 3, "last_column": 10, 6 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 7 | "name": {"type": "PT_BASIC_ID", "str": "test2"}, 8 | "declarations": { 9 | "type": "PT_SIGNAL_DECLARATION", 10 | "first_line": 2, "first_column": 5, 11 | "last_line": 2, "last_column": 38, 12 | "identifiers": { 13 | "type": "PT_ID_LIST_REAL", 14 | "rest": {"type": "PT_BASIC_ID", "str": "foo"}, 15 | "this_piece": {"type": "PT_BASIC_ID", "str": "foo2"} 16 | }, 17 | "subtype": { 18 | "type": "PT_SUBTYPE_INDICATION", 19 | "type_mark": {"type": "PT_BASIC_ID", "str": "bar"} 20 | }, 21 | "expression": {"type": "PT_BASIC_ID", "str": "baz"}, 22 | "kind": {"type": "PT_SIGNAL_KIND", "kind": "bus"} 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /parser_tests/sig_decl4.vhd: -------------------------------------------------------------------------------- 1 | architecture test of test2 is 2 | signal foo, foo2 : bar bus := baz; 3 | begin end; 4 | -------------------------------------------------------------------------------- /parser_tests/string_lit1.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ARCHITECTURE", 5 | "first_line": 1, "first_column": 1, "last_line": 3, "last_column": 10, 6 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 7 | "name": {"type": "PT_BASIC_ID", "str": "test2"}, 8 | "declarations": { 9 | "type": "PT_CONSTANT_DECLARATION", 10 | "first_line": 2, "first_column": 5, 11 | "last_line": 2, "last_column": 34, 12 | "identifiers": {"type": "PT_BASIC_ID", "str": "foo"}, 13 | "subtype": { 14 | "type": "PT_SUBTYPE_INDICATION", 15 | "type_mark": {"type": "PT_BASIC_ID", "str": "bar"} 16 | }, 17 | "expression": {"type": "PT_LIT_STRING", "str": "hello"} 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /parser_tests/string_lit1.vhd: -------------------------------------------------------------------------------- 1 | architecture test of test2 is 2 | constant foo : bar := "hello"; 3 | begin end; 4 | -------------------------------------------------------------------------------- /parser_tests/string_lit2.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ARCHITECTURE", 5 | "first_line": 1, "first_column": 1, "last_line": 3, "last_column": 10, 6 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 7 | "name": {"type": "PT_BASIC_ID", "str": "test2"}, 8 | "declarations": { 9 | "type": "PT_CONSTANT_DECLARATION", 10 | "first_line": 2, "first_column": 5, 11 | "last_line": 2, "last_column": 36, 12 | "identifiers": {"type": "PT_BASIC_ID", "str": "foo"}, 13 | "subtype": { 14 | "type": "PT_SUBTYPE_INDICATION", 15 | "type_mark": {"type": "PT_BASIC_ID", "str": "bar"} 16 | }, 17 | "expression": {"type": "PT_LIT_STRING", "str": "hel\"lo"} 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /parser_tests/string_lit2.vhd: -------------------------------------------------------------------------------- 1 | architecture test of test2 is 2 | constant foo : bar := "hel""lo"; 3 | begin end; 4 | -------------------------------------------------------------------------------- /parser_tests/string_lit3.fail: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArcaneNibble/yavhdl/0dae62b5ff56a48f54da24188ea4d30c64a93d4e/parser_tests/string_lit3.fail -------------------------------------------------------------------------------- /parser_tests/string_lit3.vhd: -------------------------------------------------------------------------------- 1 | architecture test of test2 is 2 | constant foo : bar := "hel" "lo"; 3 | begin end; 4 | -------------------------------------------------------------------------------- /parser_tests/string_lit4.fail: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArcaneNibble/yavhdl/0dae62b5ff56a48f54da24188ea4d30c64a93d4e/parser_tests/string_lit4.fail -------------------------------------------------------------------------------- /parser_tests/string_lit4.vhd: -------------------------------------------------------------------------------- 1 | architecture test of test2 is 2 | constant foo : bar := "hel"lo"; 3 | begin end; 4 | -------------------------------------------------------------------------------- /parser_tests/string_lit5.fail: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArcaneNibble/yavhdl/0dae62b5ff56a48f54da24188ea4d30c64a93d4e/parser_tests/string_lit5.fail -------------------------------------------------------------------------------- /parser_tests/string_lit5.vhd: -------------------------------------------------------------------------------- 1 | architecture test of test2 is 2 | constant foo : bar := "hel 3 | lo"; 4 | begin end; 5 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication1.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "first_column": 5, 5 | "first_line": 2, 6 | "identifier": { 7 | "str": "t", 8 | "type": "PT_BASIC_ID" 9 | }, 10 | "last_column": 21, 11 | "last_line": 2, 12 | "subtype": { 13 | "type": "PT_SUBTYPE_INDICATION", 14 | "type_mark": { 15 | "str": "foo", 16 | "type": "PT_BASIC_ID" 17 | } 18 | }, 19 | "type": "PT_SUBTYPE_DECLARATION" 20 | }, 21 | "first_column": 1, 22 | "first_line": 1, 23 | "header": { 24 | "type": "PT_ENTITY_HEADER" 25 | }, 26 | "identifier": { 27 | "str": "test", 28 | "type": "PT_BASIC_ID" 29 | }, 30 | "last_column": 4, 31 | "last_line": 3, 32 | "type": "PT_ENTITY" 33 | }, 34 | "type": "PT_DESIGN_UNIT" 35 | } -------------------------------------------------------------------------------- /parser_tests/subtype_indication1.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | subtype t is foo; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication10.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "first_column": 5, 5 | "first_line": 2, 6 | "identifier": { 7 | "str": "t", 8 | "type": "PT_BASIC_ID" 9 | }, 10 | "last_column": 29, 11 | "last_line": 2, 12 | "subtype": { 13 | "resolution_indication": { 14 | "inner": { 15 | "inner": { 16 | "str": "bar", 17 | "type": "PT_BASIC_ID" 18 | }, 19 | "type": "PT_ELEMENT_RESOLUTION_NEST" 20 | }, 21 | "type": "PT_ELEMENT_RESOLUTION_NEST" 22 | }, 23 | "type": "PT_SUBTYPE_INDICATION", 24 | "type_mark": { 25 | "str": "foo", 26 | "type": "PT_BASIC_ID" 27 | } 28 | }, 29 | "type": "PT_SUBTYPE_DECLARATION" 30 | }, 31 | "first_column": 1, 32 | "first_line": 1, 33 | "header": { 34 | "type": "PT_ENTITY_HEADER" 35 | }, 36 | "identifier": { 37 | "str": "test", 38 | "type": "PT_BASIC_ID" 39 | }, 40 | "last_column": 4, 41 | "last_line": 3, 42 | "type": "PT_ENTITY" 43 | }, 44 | "type": "PT_DESIGN_UNIT" 45 | } -------------------------------------------------------------------------------- /parser_tests/subtype_indication10.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | subtype t is ((bar)) foo; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication11.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "first_column": 5, 5 | "first_line": 2, 6 | "identifier": { 7 | "str": "t", 8 | "type": "PT_BASIC_ID" 9 | }, 10 | "last_column": 33, 11 | "last_line": 2, 12 | "subtype": { 13 | "resolution_indication": { 14 | "inner": { 15 | "inner": { 16 | "element_name": { 17 | "str": "bar", 18 | "type": "PT_BASIC_ID" 19 | }, 20 | "resolution_indication": { 21 | "str": "baz", 22 | "type": "PT_BASIC_ID" 23 | }, 24 | "type": "PT_RECORD_ELEMENT_RESOLUTION" 25 | }, 26 | "type": "PT_ELEMENT_RESOLUTION_NEST" 27 | }, 28 | "type": "PT_ELEMENT_RESOLUTION_NEST" 29 | }, 30 | "type": "PT_SUBTYPE_INDICATION", 31 | "type_mark": { 32 | "str": "foo", 33 | "type": "PT_BASIC_ID" 34 | } 35 | }, 36 | "type": "PT_SUBTYPE_DECLARATION" 37 | }, 38 | "first_column": 1, 39 | "first_line": 1, 40 | "header": { 41 | "type": "PT_ENTITY_HEADER" 42 | }, 43 | "identifier": { 44 | "str": "test", 45 | "type": "PT_BASIC_ID" 46 | }, 47 | "last_column": 4, 48 | "last_line": 3, 49 | "type": "PT_ENTITY" 50 | }, 51 | "type": "PT_DESIGN_UNIT" 52 | } -------------------------------------------------------------------------------- /parser_tests/subtype_indication11.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | subtype t is ((bar baz)) foo; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication12.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | subtype t is ((bar baz, qux zzz)) foo; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication13.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "first_column": 5, 5 | "first_line": 2, 6 | "identifier": { 7 | "str": "t", 8 | "type": "PT_BASIC_ID" 9 | }, 10 | "last_column": 27, 11 | "last_line": 2, 12 | "subtype": { 13 | "constraint": { 14 | "index_constraint": "open", 15 | "type": "PT_ARRAY_CONSTRAINT" 16 | }, 17 | "type": "PT_SUBTYPE_INDICATION", 18 | "type_mark": { 19 | "str": "foo", 20 | "type": "PT_BASIC_ID" 21 | } 22 | }, 23 | "type": "PT_SUBTYPE_DECLARATION" 24 | }, 25 | "first_column": 1, 26 | "first_line": 1, 27 | "header": { 28 | "type": "PT_ENTITY_HEADER" 29 | }, 30 | "identifier": { 31 | "str": "test", 32 | "type": "PT_BASIC_ID" 33 | }, 34 | "last_column": 4, 35 | "last_line": 3, 36 | "type": "PT_ENTITY" 37 | }, 38 | "type": "PT_DESIGN_UNIT" 39 | } -------------------------------------------------------------------------------- /parser_tests/subtype_indication13.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | subtype t is foo(open); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication14.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "first_column": 5, 5 | "first_line": 2, 6 | "identifier": { 7 | "str": "t", 8 | "type": "PT_BASIC_ID" 9 | }, 10 | "last_column": 33, 11 | "last_line": 2, 12 | "subtype": { 13 | "constraint": { 14 | "element_constraint": { 15 | "index_constraint": "open", 16 | "type": "PT_ARRAY_CONSTRAINT" 17 | }, 18 | "index_constraint": "open", 19 | "type": "PT_ARRAY_CONSTRAINT" 20 | }, 21 | "type": "PT_SUBTYPE_INDICATION", 22 | "type_mark": { 23 | "str": "foo", 24 | "type": "PT_BASIC_ID" 25 | } 26 | }, 27 | "type": "PT_SUBTYPE_DECLARATION" 28 | }, 29 | "first_column": 1, 30 | "first_line": 1, 31 | "header": { 32 | "type": "PT_ENTITY_HEADER" 33 | }, 34 | "identifier": { 35 | "str": "test", 36 | "type": "PT_BASIC_ID" 37 | }, 38 | "last_column": 4, 39 | "last_line": 3, 40 | "type": "PT_ENTITY" 41 | }, 42 | "type": "PT_DESIGN_UNIT" 43 | } -------------------------------------------------------------------------------- /parser_tests/subtype_indication14.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | subtype t is foo(open)(open); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication15.fail: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArcaneNibble/yavhdl/0dae62b5ff56a48f54da24188ea4d30c64a93d4e/parser_tests/subtype_indication15.fail -------------------------------------------------------------------------------- /parser_tests/subtype_indication15.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | subtype t is foo(open, open); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication16.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "first_column": 5, 5 | "first_line": 2, 6 | "identifier": { 7 | "str": "t", 8 | "type": "PT_BASIC_ID" 9 | }, 10 | "last_column": 29, 11 | "last_line": 2, 12 | "subtype": { 13 | "constraint": { 14 | "index_constraint": { 15 | "dir": "to", 16 | "type": "PT_RANGE", 17 | "x": { 18 | "str": "0", 19 | "type": "PT_LIT_DECIMAL" 20 | }, 21 | "y": { 22 | "str": "2", 23 | "type": "PT_LIT_DECIMAL" 24 | } 25 | }, 26 | "type": "PT_ARRAY_CONSTRAINT" 27 | }, 28 | "type": "PT_SUBTYPE_INDICATION", 29 | "type_mark": { 30 | "str": "foo", 31 | "type": "PT_BASIC_ID" 32 | } 33 | }, 34 | "type": "PT_SUBTYPE_DECLARATION" 35 | }, 36 | "first_column": 1, 37 | "first_line": 1, 38 | "header": { 39 | "type": "PT_ENTITY_HEADER" 40 | }, 41 | "identifier": { 42 | "str": "test", 43 | "type": "PT_BASIC_ID" 44 | }, 45 | "last_column": 4, 46 | "last_line": 3, 47 | "type": "PT_ENTITY" 48 | }, 49 | "type": "PT_DESIGN_UNIT" 50 | } -------------------------------------------------------------------------------- /parser_tests/subtype_indication16.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | subtype t is foo(0 to 2); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication17.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | subtype t is foo(0 to 2, 1 to 3); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication18.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "first_column": 5, 5 | "first_line": 2, 6 | "identifier": { 7 | "str": "t", 8 | "type": "PT_BASIC_ID" 9 | }, 10 | "last_column": 33, 11 | "last_line": 2, 12 | "subtype": { 13 | "constraint": { 14 | "element_constraint": { 15 | "index_constraint": "open", 16 | "type": "PT_ARRAY_CONSTRAINT" 17 | }, 18 | "element_name": { 19 | "str": "bar", 20 | "type": "PT_BASIC_ID" 21 | }, 22 | "type": "PT_RECORD_ELEMENT_CONSTRAINT" 23 | }, 24 | "type": "PT_SUBTYPE_INDICATION", 25 | "type_mark": { 26 | "str": "foo", 27 | "type": "PT_BASIC_ID" 28 | } 29 | }, 30 | "type": "PT_SUBTYPE_DECLARATION" 31 | }, 32 | "first_column": 1, 33 | "first_line": 1, 34 | "header": { 35 | "type": "PT_ENTITY_HEADER" 36 | }, 37 | "identifier": { 38 | "str": "test", 39 | "type": "PT_BASIC_ID" 40 | }, 41 | "last_column": 4, 42 | "last_line": 3, 43 | "type": "PT_ENTITY" 44 | }, 45 | "type": "PT_DESIGN_UNIT" 46 | } -------------------------------------------------------------------------------- /parser_tests/subtype_indication18.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | subtype t is foo(bar (open)); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication19.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "first_column": 5, 5 | "first_line": 2, 6 | "identifier": { 7 | "str": "t", 8 | "type": "PT_BASIC_ID" 9 | }, 10 | "last_column": 39, 11 | "last_line": 2, 12 | "subtype": { 13 | "constraint": { 14 | "element_constraint": { 15 | "element_constraint": { 16 | "index_constraint": "open", 17 | "type": "PT_ARRAY_CONSTRAINT" 18 | }, 19 | "index_constraint": "open", 20 | "type": "PT_ARRAY_CONSTRAINT" 21 | }, 22 | "element_name": { 23 | "str": "bar", 24 | "type": "PT_BASIC_ID" 25 | }, 26 | "type": "PT_RECORD_ELEMENT_CONSTRAINT" 27 | }, 28 | "type": "PT_SUBTYPE_INDICATION", 29 | "type_mark": { 30 | "str": "foo", 31 | "type": "PT_BASIC_ID" 32 | } 33 | }, 34 | "type": "PT_SUBTYPE_DECLARATION" 35 | }, 36 | "first_column": 1, 37 | "first_line": 1, 38 | "header": { 39 | "type": "PT_ENTITY_HEADER" 40 | }, 41 | "identifier": { 42 | "str": "test", 43 | "type": "PT_BASIC_ID" 44 | }, 45 | "last_column": 4, 46 | "last_line": 3, 47 | "type": "PT_ENTITY" 48 | }, 49 | "type": "PT_DESIGN_UNIT" 50 | } -------------------------------------------------------------------------------- /parser_tests/subtype_indication19.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | subtype t is foo(bar (open)(open)); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication2.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "first_column": 5, 5 | "first_line": 2, 6 | "identifier": { 7 | "str": "t", 8 | "type": "PT_BASIC_ID" 9 | }, 10 | "last_column": 25, 11 | "last_line": 2, 12 | "subtype": { 13 | "type": "PT_SUBTYPE_INDICATION", 14 | "type_mark": { 15 | "attribute": { 16 | "str": "bar", 17 | "type": "PT_BASIC_ID" 18 | }, 19 | "name": { 20 | "str": "foo", 21 | "type": "PT_BASIC_ID" 22 | }, 23 | "type": "PT_NAME_ATTRIBUTE" 24 | } 25 | }, 26 | "type": "PT_SUBTYPE_DECLARATION" 27 | }, 28 | "first_column": 1, 29 | "first_line": 1, 30 | "header": { 31 | "type": "PT_ENTITY_HEADER" 32 | }, 33 | "identifier": { 34 | "str": "test", 35 | "type": "PT_BASIC_ID" 36 | }, 37 | "last_column": 4, 38 | "last_line": 3, 39 | "type": "PT_ENTITY" 40 | }, 41 | "type": "PT_DESIGN_UNIT" 42 | } -------------------------------------------------------------------------------- /parser_tests/subtype_indication2.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | subtype t is foo'bar; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication20.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | subtype t is foo(bar (open)(baz (quz'xxx))); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication21.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | subtype t is foo(bar (open)(open)(baz (quz'xxx))); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication22.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | subtype t is foo (0 to 2)(open)(bar'baz); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication23.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "first_column": 5, 5 | "first_line": 2, 6 | "identifier": { 7 | "str": "t", 8 | "type": "PT_BASIC_ID" 9 | }, 10 | "last_column": 26, 11 | "last_line": 2, 12 | "subtype": { 13 | "constraint": { 14 | "index_constraint": { 15 | "str": "bar", 16 | "type": "PT_BASIC_ID" 17 | }, 18 | "type": "PT_ARRAY_CONSTRAINT" 19 | }, 20 | "type": "PT_SUBTYPE_INDICATION", 21 | "type_mark": { 22 | "str": "foo", 23 | "type": "PT_BASIC_ID" 24 | } 25 | }, 26 | "type": "PT_SUBTYPE_DECLARATION" 27 | }, 28 | "first_column": 1, 29 | "first_line": 1, 30 | "header": { 31 | "type": "PT_ENTITY_HEADER" 32 | }, 33 | "identifier": { 34 | "str": "test", 35 | "type": "PT_BASIC_ID" 36 | }, 37 | "last_column": 4, 38 | "last_line": 3, 39 | "type": "PT_ENTITY" 40 | }, 41 | "type": "PT_DESIGN_UNIT" 42 | } -------------------------------------------------------------------------------- /parser_tests/subtype_indication23.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | subtype t is foo(bar); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication24.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "first_column": 5, 5 | "first_line": 2, 6 | "identifier": { 7 | "str": "t", 8 | "type": "PT_BASIC_ID" 9 | }, 10 | "last_column": 32, 11 | "last_line": 2, 12 | "subtype": { 13 | "constraint": { 14 | "element_constraint": { 15 | "index_constraint": "open", 16 | "type": "PT_ARRAY_CONSTRAINT" 17 | }, 18 | "index_constraint": { 19 | "str": "bar", 20 | "type": "PT_BASIC_ID" 21 | }, 22 | "type": "PT_ARRAY_CONSTRAINT" 23 | }, 24 | "type": "PT_SUBTYPE_INDICATION", 25 | "type_mark": { 26 | "str": "foo", 27 | "type": "PT_BASIC_ID" 28 | } 29 | }, 30 | "type": "PT_SUBTYPE_DECLARATION" 31 | }, 32 | "first_column": 1, 33 | "first_line": 1, 34 | "header": { 35 | "type": "PT_ENTITY_HEADER" 36 | }, 37 | "identifier": { 38 | "str": "test", 39 | "type": "PT_BASIC_ID" 40 | }, 41 | "last_column": 4, 42 | "last_line": 3, 43 | "type": "PT_ENTITY" 44 | }, 45 | "type": "PT_DESIGN_UNIT" 46 | } -------------------------------------------------------------------------------- /parser_tests/subtype_indication24.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | subtype t is foo(bar)(open); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication25.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "first_column": 5, 5 | "first_line": 2, 6 | "identifier": { 7 | "str": "t", 8 | "type": "PT_BASIC_ID" 9 | }, 10 | "last_column": 32, 11 | "last_line": 2, 12 | "subtype": { 13 | "constraint": { 14 | "element_constraint": { 15 | "index_constraint": { 16 | "str": "bar", 17 | "type": "PT_BASIC_ID" 18 | }, 19 | "type": "PT_ARRAY_CONSTRAINT" 20 | }, 21 | "index_constraint": "open", 22 | "type": "PT_ARRAY_CONSTRAINT" 23 | }, 24 | "type": "PT_SUBTYPE_INDICATION", 25 | "type_mark": { 26 | "str": "foo", 27 | "type": "PT_BASIC_ID" 28 | } 29 | }, 30 | "type": "PT_SUBTYPE_DECLARATION" 31 | }, 32 | "first_column": 1, 33 | "first_line": 1, 34 | "header": { 35 | "type": "PT_ENTITY_HEADER" 36 | }, 37 | "identifier": { 38 | "str": "test", 39 | "type": "PT_BASIC_ID" 40 | }, 41 | "last_column": 4, 42 | "last_line": 3, 43 | "type": "PT_ENTITY" 44 | }, 45 | "type": "PT_DESIGN_UNIT" 46 | } -------------------------------------------------------------------------------- /parser_tests/subtype_indication25.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | subtype t is foo(open)(bar); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication26.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "first_column": 5, 5 | "first_line": 2, 6 | "identifier": { 7 | "str": "t", 8 | "type": "PT_BASIC_ID" 9 | }, 10 | "last_column": 34, 11 | "last_line": 2, 12 | "subtype": { 13 | "constraint": { 14 | "element_constraint": { 15 | "index_constraint": { 16 | "str": "bar", 17 | "type": "PT_BASIC_ID" 18 | }, 19 | "type": "PT_ARRAY_CONSTRAINT" 20 | }, 21 | "index_constraint": { 22 | "dir": "to", 23 | "type": "PT_RANGE", 24 | "x": { 25 | "str": "0", 26 | "type": "PT_LIT_DECIMAL" 27 | }, 28 | "y": { 29 | "str": "2", 30 | "type": "PT_LIT_DECIMAL" 31 | } 32 | }, 33 | "type": "PT_ARRAY_CONSTRAINT" 34 | }, 35 | "type": "PT_SUBTYPE_INDICATION", 36 | "type_mark": { 37 | "str": "foo", 38 | "type": "PT_BASIC_ID" 39 | } 40 | }, 41 | "type": "PT_SUBTYPE_DECLARATION" 42 | }, 43 | "first_column": 1, 44 | "first_line": 1, 45 | "header": { 46 | "type": "PT_ENTITY_HEADER" 47 | }, 48 | "identifier": { 49 | "str": "test", 50 | "type": "PT_BASIC_ID" 51 | }, 52 | "last_column": 4, 53 | "last_line": 3, 54 | "type": "PT_ENTITY" 55 | }, 56 | "type": "PT_DESIGN_UNIT" 57 | } -------------------------------------------------------------------------------- /parser_tests/subtype_indication26.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | subtype t is foo(0 to 2)(bar); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication27.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | subtype t is foo(bar)(0 to 2); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication28.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | subtype t is foo(bar)(0 to 2)(open); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication3.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "first_column": 5, 5 | "first_line": 2, 6 | "identifier": { 7 | "str": "t", 8 | "type": "PT_BASIC_ID" 9 | }, 10 | "last_column": 29, 11 | "last_line": 2, 12 | "subtype": { 13 | "resolution_indication": { 14 | "str": "baz", 15 | "type": "PT_BASIC_ID" 16 | }, 17 | "type": "PT_SUBTYPE_INDICATION", 18 | "type_mark": { 19 | "attribute": { 20 | "str": "bar", 21 | "type": "PT_BASIC_ID" 22 | }, 23 | "name": { 24 | "str": "foo", 25 | "type": "PT_BASIC_ID" 26 | }, 27 | "type": "PT_NAME_ATTRIBUTE" 28 | } 29 | }, 30 | "type": "PT_SUBTYPE_DECLARATION" 31 | }, 32 | "first_column": 1, 33 | "first_line": 1, 34 | "header": { 35 | "type": "PT_ENTITY_HEADER" 36 | }, 37 | "identifier": { 38 | "str": "test", 39 | "type": "PT_BASIC_ID" 40 | }, 41 | "last_column": 4, 42 | "last_line": 3, 43 | "type": "PT_ENTITY" 44 | }, 45 | "type": "PT_DESIGN_UNIT" 46 | } -------------------------------------------------------------------------------- /parser_tests/subtype_indication3.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | subtype t is baz foo'bar; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication4.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "first_column": 5, 5 | "first_line": 2, 6 | "identifier": { 7 | "str": "t", 8 | "type": "PT_BASIC_ID" 9 | }, 10 | "last_column": 33, 11 | "last_line": 2, 12 | "subtype": { 13 | "resolution_indication": { 14 | "name": { 15 | "str": "baz", 16 | "type": "PT_BASIC_ID" 17 | }, 18 | "suffix": { 19 | "str": "=", 20 | "type": "PT_LIT_STRING" 21 | }, 22 | "type": "PT_NAME_SELECTED" 23 | }, 24 | "type": "PT_SUBTYPE_INDICATION", 25 | "type_mark": { 26 | "attribute": { 27 | "str": "bar", 28 | "type": "PT_BASIC_ID" 29 | }, 30 | "name": { 31 | "str": "foo", 32 | "type": "PT_BASIC_ID" 33 | }, 34 | "type": "PT_NAME_ATTRIBUTE" 35 | } 36 | }, 37 | "type": "PT_SUBTYPE_DECLARATION" 38 | }, 39 | "first_column": 1, 40 | "first_line": 1, 41 | "header": { 42 | "type": "PT_ENTITY_HEADER" 43 | }, 44 | "identifier": { 45 | "str": "test", 46 | "type": "PT_BASIC_ID" 47 | }, 48 | "last_column": 4, 49 | "last_line": 3, 50 | "type": "PT_ENTITY" 51 | }, 52 | "type": "PT_DESIGN_UNIT" 53 | } -------------------------------------------------------------------------------- /parser_tests/subtype_indication4.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | subtype t is baz."=" foo'bar; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication5.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "first_column": 5, 5 | "first_line": 2, 6 | "identifier": { 7 | "str": "t", 8 | "type": "PT_BASIC_ID" 9 | }, 10 | "last_column": 35, 11 | "last_line": 2, 12 | "subtype": { 13 | "constraint": { 14 | "attribute": { 15 | "str": "baz", 16 | "type": "PT_BASIC_ID" 17 | }, 18 | "name": { 19 | "str": "bar", 20 | "type": "PT_BASIC_ID" 21 | }, 22 | "type": "PT_NAME_ATTRIBUTE" 23 | }, 24 | "type": "PT_SUBTYPE_INDICATION", 25 | "type_mark": { 26 | "str": "foo", 27 | "type": "PT_BASIC_ID" 28 | } 29 | }, 30 | "type": "PT_SUBTYPE_DECLARATION" 31 | }, 32 | "first_column": 1, 33 | "first_line": 1, 34 | "header": { 35 | "type": "PT_ENTITY_HEADER" 36 | }, 37 | "identifier": { 38 | "str": "test", 39 | "type": "PT_BASIC_ID" 40 | }, 41 | "last_column": 4, 42 | "last_line": 3, 43 | "type": "PT_ENTITY" 44 | }, 45 | "type": "PT_DESIGN_UNIT" 46 | } -------------------------------------------------------------------------------- /parser_tests/subtype_indication5.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | subtype t is foo range bar'baz; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication6.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "first_column": 5, 5 | "first_line": 2, 6 | "identifier": { 7 | "str": "t", 8 | "type": "PT_BASIC_ID" 9 | }, 10 | "last_column": 43, 11 | "last_line": 2, 12 | "subtype": { 13 | "constraint": { 14 | "attribute": { 15 | "str": "baz", 16 | "type": "PT_BASIC_ID" 17 | }, 18 | "name": { 19 | "str": "bar", 20 | "type": "PT_BASIC_ID" 21 | }, 22 | "type": "PT_NAME_ATTRIBUTE" 23 | }, 24 | "type": "PT_SUBTYPE_INDICATION", 25 | "type_mark": { 26 | "attribute": { 27 | "str": "subtype", 28 | "type": "PT_BASIC_ID" 29 | }, 30 | "name": { 31 | "str": "foo", 32 | "type": "PT_BASIC_ID" 33 | }, 34 | "type": "PT_NAME_ATTRIBUTE" 35 | } 36 | }, 37 | "type": "PT_SUBTYPE_DECLARATION" 38 | }, 39 | "first_column": 1, 40 | "first_line": 1, 41 | "header": { 42 | "type": "PT_ENTITY_HEADER" 43 | }, 44 | "identifier": { 45 | "str": "test", 46 | "type": "PT_BASIC_ID" 47 | }, 48 | "last_column": 4, 49 | "last_line": 3, 50 | "type": "PT_ENTITY" 51 | }, 52 | "type": "PT_DESIGN_UNIT" 53 | } -------------------------------------------------------------------------------- /parser_tests/subtype_indication6.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | subtype t is foo'subtype range bar'baz; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication7.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "first_column": 5, 5 | "first_line": 2, 6 | "identifier": { 7 | "str": "t", 8 | "type": "PT_BASIC_ID" 9 | }, 10 | "last_column": 42, 11 | "last_line": 2, 12 | "subtype": { 13 | "constraint": { 14 | "dir": "to", 15 | "type": "PT_RANGE", 16 | "x": { 17 | "str": "0", 18 | "type": "PT_LIT_DECIMAL" 19 | }, 20 | "y": { 21 | "str": "2", 22 | "type": "PT_LIT_DECIMAL" 23 | } 24 | }, 25 | "type": "PT_SUBTYPE_INDICATION", 26 | "type_mark": { 27 | "attribute": { 28 | "str": "subtype", 29 | "type": "PT_BASIC_ID" 30 | }, 31 | "name": { 32 | "str": "foo", 33 | "type": "PT_BASIC_ID" 34 | }, 35 | "type": "PT_NAME_ATTRIBUTE" 36 | } 37 | }, 38 | "type": "PT_SUBTYPE_DECLARATION" 39 | }, 40 | "first_column": 1, 41 | "first_line": 1, 42 | "header": { 43 | "type": "PT_ENTITY_HEADER" 44 | }, 45 | "identifier": { 46 | "str": "test", 47 | "type": "PT_BASIC_ID" 48 | }, 49 | "last_column": 4, 50 | "last_line": 3, 51 | "type": "PT_ENTITY" 52 | }, 53 | "type": "PT_DESIGN_UNIT" 54 | } -------------------------------------------------------------------------------- /parser_tests/subtype_indication7.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | subtype t is foo'subtype range 0 to 2; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication8.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "first_column": 5, 5 | "first_line": 2, 6 | "identifier": { 7 | "str": "t", 8 | "type": "PT_BASIC_ID" 9 | }, 10 | "last_column": 46, 11 | "last_line": 2, 12 | "subtype": { 13 | "constraint": { 14 | "dir": "to", 15 | "type": "PT_RANGE", 16 | "x": { 17 | "str": "0", 18 | "type": "PT_LIT_DECIMAL" 19 | }, 20 | "y": { 21 | "str": "2", 22 | "type": "PT_LIT_DECIMAL" 23 | } 24 | }, 25 | "resolution_indication": { 26 | "str": "bar", 27 | "type": "PT_BASIC_ID" 28 | }, 29 | "type": "PT_SUBTYPE_INDICATION", 30 | "type_mark": { 31 | "attribute": { 32 | "str": "subtype", 33 | "type": "PT_BASIC_ID" 34 | }, 35 | "name": { 36 | "str": "foo", 37 | "type": "PT_BASIC_ID" 38 | }, 39 | "type": "PT_NAME_ATTRIBUTE" 40 | } 41 | }, 42 | "type": "PT_SUBTYPE_DECLARATION" 43 | }, 44 | "first_column": 1, 45 | "first_line": 1, 46 | "header": { 47 | "type": "PT_ENTITY_HEADER" 48 | }, 49 | "identifier": { 50 | "str": "test", 51 | "type": "PT_BASIC_ID" 52 | }, 53 | "last_column": 4, 54 | "last_line": 3, 55 | "type": "PT_ENTITY" 56 | }, 57 | "type": "PT_DESIGN_UNIT" 58 | } -------------------------------------------------------------------------------- /parser_tests/subtype_indication8.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | subtype t is bar foo'subtype range 0 to 2; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication9.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "first_column": 5, 5 | "first_line": 2, 6 | "identifier": { 7 | "str": "t", 8 | "type": "PT_BASIC_ID" 9 | }, 10 | "last_column": 27, 11 | "last_line": 2, 12 | "subtype": { 13 | "resolution_indication": { 14 | "inner": { 15 | "str": "bar", 16 | "type": "PT_BASIC_ID" 17 | }, 18 | "type": "PT_ELEMENT_RESOLUTION_NEST" 19 | }, 20 | "type": "PT_SUBTYPE_INDICATION", 21 | "type_mark": { 22 | "str": "foo", 23 | "type": "PT_BASIC_ID" 24 | } 25 | }, 26 | "type": "PT_SUBTYPE_DECLARATION" 27 | }, 28 | "first_column": 1, 29 | "first_line": 1, 30 | "header": { 31 | "type": "PT_ENTITY_HEADER" 32 | }, 33 | "identifier": { 34 | "str": "test", 35 | "type": "PT_BASIC_ID" 36 | }, 37 | "last_column": 4, 38 | "last_line": 3, 39 | "type": "PT_ENTITY" 40 | }, 41 | "type": "PT_DESIGN_UNIT" 42 | } -------------------------------------------------------------------------------- /parser_tests/subtype_indication9.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | subtype t is (bar) foo; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication_generic_map_arrow1.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "first_column": 5, 5 | "first_line": 2, 6 | "generic_map": { 7 | "association_list": { 8 | "actual_part": { 9 | "str": "foo", 10 | "type": "PT_BASIC_ID" 11 | }, 12 | "formal_part": { 13 | "str": "c", 14 | "type": "PT_BASIC_ID" 15 | }, 16 | "type": "PT_ASSOCIATION_ELEMENT" 17 | }, 18 | "type": "PT_GENERIC_MAP_ASPECT" 19 | }, 20 | "identifier": { 21 | "str": "a", 22 | "type": "PT_BASIC_ID" 23 | }, 24 | "last_column": 45, 25 | "last_line": 2, 26 | "type": "PT_PACKAGE_INSTANTIATION_DECLARATION", 27 | "uninstantiated_name": { 28 | "str": "b", 29 | "type": "PT_BASIC_ID" 30 | } 31 | }, 32 | "first_column": 1, 33 | "first_line": 1, 34 | "header": { 35 | "type": "PT_ENTITY_HEADER" 36 | }, 37 | "identifier": { 38 | "str": "test", 39 | "type": "PT_BASIC_ID" 40 | }, 41 | "last_column": 4, 42 | "last_line": 3, 43 | "type": "PT_ENTITY" 44 | }, 45 | "type": "PT_DESIGN_UNIT" 46 | } -------------------------------------------------------------------------------- /parser_tests/subtype_indication_generic_map_arrow1.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | package a is new b generic map(c => foo); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication_generic_map_arrow10.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | package a is new b generic map(c => ((bar)) foo); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication_generic_map_arrow11.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | package a is new b generic map(c => ((bar baz)) foo); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication_generic_map_arrow12.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | package a is new b generic map(c => ((bar baz, qux zzz)) foo); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication_generic_map_arrow13.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "first_column": 5, 5 | "first_line": 2, 6 | "generic_map": { 7 | "association_list": { 8 | "actual_part": { 9 | "name": { 10 | "str": "foo", 11 | "type": "PT_BASIC_ID" 12 | }, 13 | "params": { 14 | "type": "PT_TOK_OPEN" 15 | }, 16 | "type": "PT_FUNCTION_CALL" 17 | }, 18 | "formal_part": { 19 | "str": "c", 20 | "type": "PT_BASIC_ID" 21 | }, 22 | "type": "PT_ASSOCIATION_ELEMENT" 23 | }, 24 | "type": "PT_GENERIC_MAP_ASPECT" 25 | }, 26 | "identifier": { 27 | "str": "a", 28 | "type": "PT_BASIC_ID" 29 | }, 30 | "last_column": 51, 31 | "last_line": 2, 32 | "type": "PT_PACKAGE_INSTANTIATION_DECLARATION", 33 | "uninstantiated_name": { 34 | "str": "b", 35 | "type": "PT_BASIC_ID" 36 | } 37 | }, 38 | "first_column": 1, 39 | "first_line": 1, 40 | "header": { 41 | "type": "PT_ENTITY_HEADER" 42 | }, 43 | "identifier": { 44 | "str": "test", 45 | "type": "PT_BASIC_ID" 46 | }, 47 | "last_column": 4, 48 | "last_line": 3, 49 | "type": "PT_ENTITY" 50 | }, 51 | "type": "PT_DESIGN_UNIT" 52 | } -------------------------------------------------------------------------------- /parser_tests/subtype_indication_generic_map_arrow13.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | package a is new b generic map(c => foo(open)); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication_generic_map_arrow14.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | package a is new b generic map(c => foo(open)(open)); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication_generic_map_arrow15.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | package a is new b generic map(c => foo(open, open)); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication_generic_map_arrow16.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | package a is new b generic map(c => foo(0 to 2)); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication_generic_map_arrow17.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | package a is new b generic map(c => foo(0 to 2, 1 to 3)); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication_generic_map_arrow18.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | package a is new b generic map(c => foo(bar (open))); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication_generic_map_arrow19.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | package a is new b generic map(c => foo(bar (open)(open))); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication_generic_map_arrow2.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "first_column": 5, 5 | "first_line": 2, 6 | "generic_map": { 7 | "association_list": { 8 | "actual_part": { 9 | "attribute": { 10 | "str": "bar", 11 | "type": "PT_BASIC_ID" 12 | }, 13 | "name": { 14 | "str": "foo", 15 | "type": "PT_BASIC_ID" 16 | }, 17 | "type": "PT_NAME_ATTRIBUTE" 18 | }, 19 | "formal_part": { 20 | "str": "c", 21 | "type": "PT_BASIC_ID" 22 | }, 23 | "type": "PT_ASSOCIATION_ELEMENT" 24 | }, 25 | "type": "PT_GENERIC_MAP_ASPECT" 26 | }, 27 | "identifier": { 28 | "str": "a", 29 | "type": "PT_BASIC_ID" 30 | }, 31 | "last_column": 49, 32 | "last_line": 2, 33 | "type": "PT_PACKAGE_INSTANTIATION_DECLARATION", 34 | "uninstantiated_name": { 35 | "str": "b", 36 | "type": "PT_BASIC_ID" 37 | } 38 | }, 39 | "first_column": 1, 40 | "first_line": 1, 41 | "header": { 42 | "type": "PT_ENTITY_HEADER" 43 | }, 44 | "identifier": { 45 | "str": "test", 46 | "type": "PT_BASIC_ID" 47 | }, 48 | "last_column": 4, 49 | "last_line": 3, 50 | "type": "PT_ENTITY" 51 | }, 52 | "type": "PT_DESIGN_UNIT" 53 | } -------------------------------------------------------------------------------- /parser_tests/subtype_indication_generic_map_arrow2.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | package a is new b generic map(c => foo'bar); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication_generic_map_arrow20.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | package a is new b generic map(c => foo(bar (open)(baz (quz'xxx)))); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication_generic_map_arrow21.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | package a is new b generic map(c => foo(bar (open)(open)(baz (quz'xxx)))); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication_generic_map_arrow22.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | package a is new b generic map(c => foo(0 to 2)(open)(bar'baz)); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication_generic_map_arrow23.json: -------------------------------------------------------------------------------- 1 | { 2 | "library_unit": { 3 | "declarations": { 4 | "first_column": 5, 5 | "first_line": 2, 6 | "generic_map": { 7 | "association_list": { 8 | "actual_part": { 9 | "name": { 10 | "str": "foo", 11 | "type": "PT_BASIC_ID" 12 | }, 13 | "parens": { 14 | "str": "bar", 15 | "type": "PT_BASIC_ID" 16 | }, 17 | "type": "PT_NAME_AMBIG_PARENS" 18 | }, 19 | "formal_part": { 20 | "str": "c", 21 | "type": "PT_BASIC_ID" 22 | }, 23 | "type": "PT_ASSOCIATION_ELEMENT" 24 | }, 25 | "type": "PT_GENERIC_MAP_ASPECT" 26 | }, 27 | "identifier": { 28 | "str": "a", 29 | "type": "PT_BASIC_ID" 30 | }, 31 | "last_column": 50, 32 | "last_line": 2, 33 | "type": "PT_PACKAGE_INSTANTIATION_DECLARATION", 34 | "uninstantiated_name": { 35 | "str": "b", 36 | "type": "PT_BASIC_ID" 37 | } 38 | }, 39 | "first_column": 1, 40 | "first_line": 1, 41 | "header": { 42 | "type": "PT_ENTITY_HEADER" 43 | }, 44 | "identifier": { 45 | "str": "test", 46 | "type": "PT_BASIC_ID" 47 | }, 48 | "last_column": 4, 49 | "last_line": 3, 50 | "type": "PT_ENTITY" 51 | }, 52 | "type": "PT_DESIGN_UNIT" 53 | } -------------------------------------------------------------------------------- /parser_tests/subtype_indication_generic_map_arrow23.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | package a is new b generic map(c => foo(bar)); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication_generic_map_arrow24.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | package a is new b generic map(c => foo(bar)(open)); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication_generic_map_arrow25.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | package a is new b generic map(c => foo(open)(bar)); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication_generic_map_arrow26.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | package a is new b generic map(c => foo(0 to 2)(bar)); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication_generic_map_arrow27.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | package a is new b generic map(c => foo(bar)(0 to 2)); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication_generic_map_arrow28.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | package a is new b generic map(c => foo(bar)(0 to 2)(open)); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication_generic_map_arrow3.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | package a is new b generic map(c => baz foo'bar); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication_generic_map_arrow4.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | package a is new b generic map(c => baz."=" foo'bar); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication_generic_map_arrow5.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | package a is new b generic map(c => foo range bar'baz); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication_generic_map_arrow6.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | package a is new b generic map(c => foo'subtype range bar'baz); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication_generic_map_arrow7.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | package a is new b generic map(c => foo'subtype range 0 to 2); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication_generic_map_arrow8.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | package a is new b generic map(c => bar foo'subtype range 0 to 2); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/subtype_indication_generic_map_arrow9.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | package a is new b generic map(c => (bar) foo); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/type_decl1.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ENTITY", 5 | "first_line": 1, 6 | "first_column": 1, 7 | "last_line": 3, 8 | "last_column": 4, 9 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 10 | "header": {"type": "PT_ENTITY_HEADER"}, 11 | "declarations": { 12 | "type": "PT_INCOMPLETE_TYPE_DECLARATION", 13 | "first_line": 2, 14 | "first_column": 5, 15 | "last_line": 2, 16 | "last_column": 11, 17 | "identifier": {"type": "PT_BASIC_ID", "str": "t"} 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /parser_tests/type_decl1.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | type t; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/type_decl2.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ENTITY", 5 | "first_line": 1, 6 | "first_column": 1, 7 | "last_line": 3, 8 | "last_column": 4, 9 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 10 | "header": {"type": "PT_ENTITY_HEADER"}, 11 | "declarations": { 12 | "type": "PT_FULL_TYPE_DECLARATION", 13 | "first_line": 2, 14 | "first_column": 5, 15 | "last_line": 2, 16 | "last_column": 27, 17 | "identifier": {"type": "PT_BASIC_ID", "str": "t"}, 18 | "definition": { 19 | "type": "PT_INTEGER_FLOAT_TYPE_DEFINITION", 20 | "range": { 21 | "type": "PT_RANGE", 22 | "dir": "to", 23 | "x": {"type": "PT_LIT_DECIMAL", "str": "0"}, 24 | "y": {"type": "PT_LIT_DECIMAL", "str": "2"} 25 | } 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /parser_tests/type_decl2.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | type t is range 0 to 2; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/type_decl3.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ENTITY", 5 | "first_line": 1, 6 | "first_column": 1, 7 | "last_line": 3, 8 | "last_column": 4, 9 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 10 | "header": {"type": "PT_ENTITY_HEADER"}, 11 | "declarations": { 12 | "type": "PT_FULL_TYPE_DECLARATION", 13 | "first_line": 2, 14 | "first_column": 5, 15 | "last_line": 2, 16 | "last_column": 31, 17 | "identifier": {"type": "PT_BASIC_ID", "str": "t"}, 18 | "definition": { 19 | "type": "PT_INTEGER_FLOAT_TYPE_DEFINITION", 20 | "range": { 21 | "type": "PT_RANGE", 22 | "dir": "downto", 23 | "x": {"type": "PT_LIT_DECIMAL", "str": "2"}, 24 | "y": {"type": "PT_LIT_DECIMAL", "str": "0"} 25 | } 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /parser_tests/type_decl3.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | type t is range 2 downto 0; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/type_decl4.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ENTITY", 5 | "first_line": 1, 6 | "first_column": 1, 7 | "last_line": 3, 8 | "last_column": 4, 9 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 10 | "header": {"type": "PT_ENTITY_HEADER"}, 11 | "declarations": { 12 | "type": "PT_FULL_TYPE_DECLARATION", 13 | "first_line": 2, 14 | "first_column": 5, 15 | "last_line": 2, 16 | "last_column": 28, 17 | "identifier": {"type": "PT_BASIC_ID", "str": "t"}, 18 | "definition": { 19 | "type": "PT_INTEGER_FLOAT_TYPE_DEFINITION", 20 | "range": { 21 | "type": "PT_NAME_ATTRIBUTE", 22 | "name": {"type": "PT_BASIC_ID", "str": "foo"}, 23 | "attribute": {"type": "PT_BASIC_ID", "str": "bar"} 24 | } 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /parser_tests/type_decl4.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | type t is range foo'bar; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/type_decl5.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ENTITY", 5 | "first_line": 1, 6 | "first_column": 1, 7 | "last_line": 3, 8 | "last_column": 4, 9 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 10 | "header": {"type": "PT_ENTITY_HEADER"}, 11 | "declarations": { 12 | "type": "PT_FULL_TYPE_DECLARATION", 13 | "first_line": 2, 14 | "first_column": 5, 15 | "last_line": 2, 16 | "last_column": 35, 17 | "identifier": {"type": "PT_BASIC_ID", "str": "t"}, 18 | "definition": { 19 | "type": "PT_ENUMERATION_TYPE_DEFINITION", 20 | "literals": { 21 | "type": "PT_ENUM_LITERAL_LIST", 22 | "rest": { 23 | "type": "PT_ENUM_LITERAL_LIST", 24 | "rest": { 25 | "type": "PT_ENUM_LITERAL_LIST", 26 | "rest": {"type": "PT_BASIC_ID", "str": "foo"}, 27 | "this_piece": {"type": "PT_BASIC_ID", "str": "bar"} 28 | }, 29 | "this_piece": {"type": "PT_LIT_CHAR", "char": "b"} 30 | }, 31 | "this_piece": {"type": "PT_LIT_CHAR", "char": "q"} 32 | } 33 | } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /parser_tests/type_decl5.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | type t is (foo, bar, 'b', 'q'); 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/type_decl6.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ENTITY", 5 | "first_line": 1, 6 | "first_column": 1, 7 | "last_line": 8, 8 | "last_column": 4, 9 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 10 | "header": {"type": "PT_ENTITY_HEADER"}, 11 | "declarations": { 12 | "type": "PT_FULL_TYPE_DECLARATION", 13 | "first_line": 2, 14 | "first_column": 5, 15 | "last_line": 7, 16 | "last_column": 14, 17 | "identifier": {"type": "PT_BASIC_ID", "str": "t"}, 18 | "definition": { 19 | "type": "PT_PHYSICAL_TYPE_DEFINITION", 20 | "range": { 21 | "type": "PT_RANGE", 22 | "dir": "to", 23 | "x": {"type": "PT_LIT_DECIMAL", "str": "0"}, 24 | "y": {"type": "PT_LIT_DECIMAL", "str": "10"} 25 | }, 26 | "primary": {"type": "PT_BASIC_ID", "str": "foo"}, 27 | "secondaries": { 28 | "type": "PT_SECONDARY_UNIT_DECLARATION_LIST", 29 | "rest": { 30 | "type": "PT_SECONDARY_UNIT_DECLARATION", 31 | "identifier": {"type": "PT_BASIC_ID", "str": "bar"}, 32 | "literal": { 33 | "type": "PT_LIT_PHYS", 34 | "unit": {"type": "PT_BASIC_ID", "str": "foo"}, 35 | "val": {"type": "PT_LIT_DECIMAL", "str": "2"} 36 | } 37 | }, 38 | "this_piece": { 39 | "type": "PT_SECONDARY_UNIT_DECLARATION", 40 | "identifier": {"type": "PT_BASIC_ID", "str": "baz"}, 41 | "literal": {"type": "PT_BASIC_ID", "str": "bar"} 42 | } 43 | } 44 | } 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /parser_tests/type_decl6.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | type t is range 0 to 10 units 3 | foo; 4 | 5 | bar = 2 foo; 6 | baz = bar; 7 | end units; 8 | end; 9 | -------------------------------------------------------------------------------- /parser_tests/type_decl7.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ENTITY", 5 | "first_line": 1, "first_column": 1, "last_line": 3, "last_column": 4, 6 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 7 | "header": {"type": "PT_ENTITY_HEADER"}, 8 | "declarations": { 9 | "type": "PT_FULL_TYPE_DECLARATION", 10 | "first_line": 2, "first_column": 5, 11 | "last_line": 2, "last_column": 25, 12 | "identifier": {"type": "PT_BASIC_ID", "str": "t"}, 13 | "definition": { 14 | "type": "PT_ACCESS_TYPE_DEFINITION", 15 | "subtype": { 16 | "type": "PT_SUBTYPE_INDICATION", 17 | "type_mark": {"type": "PT_BASIC_ID", "str": "foo"} 18 | } 19 | } 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /parser_tests/type_decl7.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | type t is access foo; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/type_decl8.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ENTITY", 5 | "first_line": 1, "first_column": 1, "last_line": 3, "last_column": 4, 6 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 7 | "header": {"type": "PT_ENTITY_HEADER"}, 8 | "declarations": { 9 | "type": "PT_FULL_TYPE_DECLARATION", 10 | "first_line": 2, "first_column": 5, 11 | "last_line": 2, "last_column": 26, 12 | "identifier": {"type": "PT_BASIC_ID", "str": "t"}, 13 | "definition": { 14 | "type": "PT_FILE_TYPE_DEFINITION", 15 | "type_mark": {"type": "PT_BASIC_ID", "str": "foo"} 16 | } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /parser_tests/type_decl8.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | type t is file of foo; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/type_decl9.fail: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArcaneNibble/yavhdl/0dae62b5ff56a48f54da24188ea4d30c64a93d4e/parser_tests/type_decl9.fail -------------------------------------------------------------------------------- /parser_tests/type_decl9.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | type t is file foo; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/type_decl_array1.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ENTITY", 5 | "first_line": 1, "first_column": 1, "last_line": 3, "last_column": 4, 6 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 7 | "header": {"type": "PT_ENTITY_HEADER"}, 8 | "declarations": { 9 | "type": "PT_FULL_TYPE_DECLARATION", 10 | "first_line": 2, "first_column": 5, 11 | "last_line": 2, "last_column": 35, 12 | "identifier": {"type": "PT_BASIC_ID", "str": "t"}, 13 | "definition": { 14 | "type": "PT_CONSTRAINED_ARRAY_DEFINITION", 15 | "index_constraint": { 16 | "type": "PT_RANGE", 17 | "dir": "to", 18 | "x": {"type": "PT_LIT_DECIMAL", "str": "0"}, 19 | "y": {"type": "PT_LIT_DECIMAL", "str": "1"} 20 | }, 21 | "element": { 22 | "type": "PT_SUBTYPE_INDICATION", 23 | "type_mark": {"type": "PT_BASIC_ID", "str": "foo"} 24 | } 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /parser_tests/type_decl_array1.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | type t is array(0 to 1) of foo; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/type_decl_array2.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ENTITY", 5 | "first_line": 1, "first_column": 1, "last_line": 3, "last_column": 4, 6 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 7 | "header": {"type": "PT_ENTITY_HEADER"}, 8 | "declarations": { 9 | "type": "PT_FULL_TYPE_DECLARATION", 10 | "first_line": 2, "first_column": 5, 11 | "last_line": 2, "last_column": 43, 12 | "identifier": {"type": "PT_BASIC_ID", "str": "t"}, 13 | "definition": { 14 | "type": "PT_CONSTRAINED_ARRAY_DEFINITION", 15 | "index_constraint": { 16 | "type": "PT_INDEX_CONSTRAINT", 17 | "rest": { 18 | "type": "PT_RANGE", 19 | "dir": "to", 20 | "x": {"type": "PT_LIT_DECIMAL", "str": "0"}, 21 | "y": {"type": "PT_LIT_DECIMAL", "str": "1"} 22 | }, 23 | "this_piece": { 24 | "type": "PT_RANGE", 25 | "dir": "to", 26 | "x": {"type": "PT_LIT_DECIMAL", "str": "2"}, 27 | "y": {"type": "PT_LIT_DECIMAL", "str": "3"} 28 | } 29 | }, 30 | "element": { 31 | "type": "PT_SUBTYPE_INDICATION", 32 | "type_mark": {"type": "PT_BASIC_ID", "str": "foo"} 33 | } 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /parser_tests/type_decl_array2.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | type t is array(0 to 1, 2 to 3) of foo; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/type_decl_array3.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ENTITY", 5 | "first_line": 1, "first_column": 1, "last_line": 3, "last_column": 4, 6 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 7 | "header": {"type": "PT_ENTITY_HEADER"}, 8 | "declarations": { 9 | "type": "PT_FULL_TYPE_DECLARATION", 10 | "first_line": 2, "first_column": 5, 11 | "last_line": 2, "last_column": 40, 12 | "identifier": {"type": "PT_BASIC_ID", "str": "t"}, 13 | "definition": { 14 | "type": "PT_UNBOUNDED_ARRAY_DEFINITION", 15 | "index_constraint": {"type": "PT_BASIC_ID", "str": "tt"}, 16 | "element": { 17 | "type": "PT_SUBTYPE_INDICATION", 18 | "type_mark": {"type": "PT_BASIC_ID", "str": "foo"} 19 | } 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /parser_tests/type_decl_array3.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | type t is array(tt range <>) of foo; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/type_decl_array4.fail: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArcaneNibble/yavhdl/0dae62b5ff56a48f54da24188ea4d30c64a93d4e/parser_tests/type_decl_array4.fail -------------------------------------------------------------------------------- /parser_tests/type_decl_array4.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | type t is array(0 to 2, tt range <>) of foo; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/type_decl_protected1.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ENTITY", 5 | "first_line": 1, "first_column": 1, "last_line": 3, "last_column": 4, 6 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 7 | "header": {"type": "PT_ENTITY_HEADER"}, 8 | "declarations": { 9 | "type": "PT_FULL_TYPE_DECLARATION", 10 | "first_line": 2, "first_column": 5, 11 | "last_line": 2, "last_column": 38, 12 | "identifier": {"type": "PT_BASIC_ID", "str": "t"}, 13 | "definition": {"type": "PT_PROTECTED_TYPE_DECLARATION"} 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /parser_tests/type_decl_protected1.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | type t is protected end protected; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/type_decl_protected_body1.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ENTITY", 5 | "first_line": 1, "first_column": 1, "last_line": 3, "last_column": 4, 6 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 7 | "header": {"type": "PT_ENTITY_HEADER"}, 8 | "declarations": { 9 | "type": "PT_FULL_TYPE_DECLARATION", 10 | "first_line": 2, "first_column": 5, 11 | "last_line": 2, "last_column": 48, 12 | "identifier": {"type": "PT_BASIC_ID", "str": "t"}, 13 | "definition": {"type": "PT_PROTECTED_TYPE_BODY"} 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /parser_tests/type_decl_protected_body1.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | type t is protected body end protected body; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/type_decl_protected_body2.fail: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArcaneNibble/yavhdl/0dae62b5ff56a48f54da24188ea4d30c64a93d4e/parser_tests/type_decl_protected_body2.fail -------------------------------------------------------------------------------- /parser_tests/type_decl_protected_body2.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | type t is protected body end protected; 3 | end; 4 | -------------------------------------------------------------------------------- /parser_tests/type_decl_record1.fail: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArcaneNibble/yavhdl/0dae62b5ff56a48f54da24188ea4d30c64a93d4e/parser_tests/type_decl_record1.fail -------------------------------------------------------------------------------- /parser_tests/type_decl_record1.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | type t is record 3 | end record; 4 | end; 5 | -------------------------------------------------------------------------------- /parser_tests/type_decl_record2.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ENTITY", 5 | "first_line": 1, "first_column": 1, "last_line": 5, "last_column": 4, 6 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 7 | "header": {"type": "PT_ENTITY_HEADER"}, 8 | "declarations": { 9 | "type": "PT_FULL_TYPE_DECLARATION", 10 | "first_line": 2, "first_column": 5, 11 | "last_line": 4, "last_column": 15, 12 | "identifier": {"type": "PT_BASIC_ID", "str": "t"}, 13 | "definition": { 14 | "type": "PT_RECORD_TYPE_DEFINITION", 15 | "elements": { 16 | "type": "PT_ELEMENT_DECLARATION", 17 | "identifiers": { 18 | "type": "PT_ID_LIST_REAL", 19 | "rest": {"type": "PT_BASIC_ID", "str": "foo"}, 20 | "this_piece": {"type": "PT_BASIC_ID", "str": "bar"} 21 | }, 22 | "subtype": { 23 | "type": "PT_SUBTYPE_INDICATION", 24 | "type_mark": {"type": "PT_BASIC_ID", "str": "baz"} 25 | } 26 | } 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /parser_tests/type_decl_record2.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | type t is record 3 | foo, bar : baz; 4 | end record; 5 | end; 6 | -------------------------------------------------------------------------------- /parser_tests/var_decl1.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ARCHITECTURE", 5 | "first_line": 1, "first_column": 1, "last_line": 3, "last_column": 10, 6 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 7 | "name": {"type": "PT_BASIC_ID", "str": "test2"}, 8 | "declarations": { 9 | "type": "PT_VARIABLE_DECLARATION", 10 | "first_line": 2, "first_column": 5, 11 | "last_line": 2, "last_column": 23, 12 | "identifiers": {"type": "PT_BASIC_ID", "str": "foo"}, 13 | "subtype": { 14 | "type": "PT_SUBTYPE_INDICATION", 15 | "type_mark": {"type": "PT_BASIC_ID", "str": "bar"} 16 | }, 17 | "shared": false 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /parser_tests/var_decl1.vhd: -------------------------------------------------------------------------------- 1 | architecture test of test2 is 2 | variable foo : bar; 3 | begin end; 4 | -------------------------------------------------------------------------------- /parser_tests/var_decl2.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ARCHITECTURE", 5 | "first_line": 1, "first_column": 1, "last_line": 3, "last_column": 10, 6 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 7 | "name": {"type": "PT_BASIC_ID", "str": "test2"}, 8 | "declarations": { 9 | "type": "PT_VARIABLE_DECLARATION", 10 | "first_line": 2, "first_column": 5, 11 | "last_line": 2, "last_column": 30, 12 | "identifiers": {"type": "PT_BASIC_ID", "str": "foo"}, 13 | "subtype": { 14 | "type": "PT_SUBTYPE_INDICATION", 15 | "type_mark": {"type": "PT_BASIC_ID", "str": "bar"} 16 | }, 17 | "expression": {"type": "PT_BASIC_ID", "str": "baz"}, 18 | "shared": false 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /parser_tests/var_decl2.vhd: -------------------------------------------------------------------------------- 1 | architecture test of test2 is 2 | variable foo : bar := baz; 3 | begin end; 4 | -------------------------------------------------------------------------------- /parser_tests/var_decl3.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ARCHITECTURE", 5 | "first_line": 1, "first_column": 1, "last_line": 3, "last_column": 10, 6 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 7 | "name": {"type": "PT_BASIC_ID", "str": "test2"}, 8 | "declarations": { 9 | "type": "PT_VARIABLE_DECLARATION", 10 | "first_line": 2, "first_column": 5, 11 | "last_line": 2, "last_column": 36, 12 | "identifiers": { 13 | "type": "PT_ID_LIST_REAL", 14 | "rest": {"type": "PT_BASIC_ID", "str": "foo"}, 15 | "this_piece": {"type": "PT_BASIC_ID", "str": "foo2"} 16 | }, 17 | "subtype": { 18 | "type": "PT_SUBTYPE_INDICATION", 19 | "type_mark": {"type": "PT_BASIC_ID", "str": "bar"} 20 | }, 21 | "expression": {"type": "PT_BASIC_ID", "str": "baz"}, 22 | "shared": false 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /parser_tests/var_decl3.vhd: -------------------------------------------------------------------------------- 1 | architecture test of test2 is 2 | variable foo, foo2 : bar := baz; 3 | begin end; 4 | -------------------------------------------------------------------------------- /parser_tests/var_decl4.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "PT_DESIGN_UNIT", 3 | "library_unit": { 4 | "type": "PT_ARCHITECTURE", 5 | "first_line": 1, "first_column": 1, "last_line": 3, "last_column": 10, 6 | "identifier": {"type": "PT_BASIC_ID", "str": "test"}, 7 | "name": {"type": "PT_BASIC_ID", "str": "test2"}, 8 | "declarations": { 9 | "type": "PT_VARIABLE_DECLARATION", 10 | "first_line": 2, "first_column": 5, 11 | "last_line": 2, "last_column": 43, 12 | "identifiers": { 13 | "type": "PT_ID_LIST_REAL", 14 | "rest": {"type": "PT_BASIC_ID", "str": "foo"}, 15 | "this_piece": {"type": "PT_BASIC_ID", "str": "foo2"} 16 | }, 17 | "subtype": { 18 | "type": "PT_SUBTYPE_INDICATION", 19 | "type_mark": {"type": "PT_BASIC_ID", "str": "bar"} 20 | }, 21 | "expression": {"type": "PT_BASIC_ID", "str": "baz"}, 22 | "shared": true 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /parser_tests/var_decl4.vhd: -------------------------------------------------------------------------------- 1 | architecture test of test2 is 2 | shared variable foo, foo2 : bar := baz; 3 | begin end; 4 | -------------------------------------------------------------------------------- /src/analyzer/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016-2017, Robert Ou 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 18 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 21 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | mod ast; 27 | mod core; 28 | mod design; 29 | mod identifier; 30 | mod objpools; 31 | mod util; 32 | 33 | pub use self::core::*; 34 | pub use self::identifier::*; 35 | pub use self::design::*; 36 | -------------------------------------------------------------------------------- /src/lib.rs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016-2017, Robert Ou 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 18 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 21 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | pub mod parser; 27 | pub mod analyzer; 28 | -------------------------------------------------------------------------------- /src/parser/bison/bindgen.hpp: -------------------------------------------------------------------------------- 1 | #define RUNNING_RUST_BINDGEN 2 | #include "vhdl_parser_glue.h" 3 | -------------------------------------------------------------------------------- /src/parser/bison/util.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016-2017, Robert Ou 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 18 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 21 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #ifndef UTIL_H 27 | #define UTIL_H 28 | 29 | #include 30 | 31 | namespace YaVHDL::Util 32 | { 33 | 34 | // Debugging "pretty-much-JSON" stuff 35 | void print_chr_escaped(char c); 36 | void print_string_escaped(std::string *s); 37 | 38 | } 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /test.vhd: -------------------------------------------------------------------------------- 1 | entity test is 2 | type test is (foo); 3 | function test1 (constant a : test) return test; 4 | begin end; 5 | --------------------------------------------------------------------------------