Commit Graph

31 Commits

Author SHA1 Message Date
JHertz5 7f51f89dce
#Issue1212: VSG crashes when encountering generate statement corner case. (#1222)
* Issue#1212: Corrected order of operations in extract_pairs to ensure that it does not return an empty list as one of the pairs.

* Issue#1212: Updated the tests to exercise failure case that raised this isssue.

* Issue#1212: Updated extract_indexes_from_pairs to strip any empty pairs from the input list.
2024-09-21 21:40:13 -05:00
Jeremiah Leary 95fabcf752
Issue#1196: Adding rules to check for subprogram designators. (#1197) 2024-07-12 03:14:37 -05:00
Jeremiah Leary ce70761895
Issue#1059: Performance improvements: (#1064)
* Issue#1059:  Performance improvements:

  * Added lower value to token and removed .lower() in other files
  * Simplified find_next_token

* Attempt at new algorithm for closest pair.

NOTE:  attempt has been commented out.

* WIP:  Improved token pairs process:

NOTE:  It does not appear to complete all the  matches.

* Revert "WIP:  Improved token pairs process:"

This reverts commit f41254087e84caa42b02058fd9fbb6cfcce673fc.

* Revert "Attempt at new algorithm for closest pair."

This reverts commit 4a972793883b9aa54a6e7ccd15e1cc26b8296fec.

* Updates for black.
2024-04-09 06:52:40 -05:00
Alon Bar-Lev c22a86025f style: apply black
Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
2024-03-24 21:16:35 +02:00
Alon Bar-Lev 5b4bae04aa style: apply isort
Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
2024-03-24 21:16:35 +02:00
Alon Bar-Lev b8c49b5946 style: python encoding
Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
2024-03-24 21:16:35 +02:00
Jeremiah Leary dd644d442d
Issue#551: Fixing scoping of consistent token case rules. (#1052)
* Issue#551:  Fixing scoping of consistent token case rules.

Issue#755:
Issue#998:
Issue#1023

* Updating additional consistent case rules:

  1)  architecture_600
  2)  entity_600
2024-01-21 12:36:29 -06:00
Jeremiah Leary 0b3d446dd5
Issue#1091: Fixing token_map.get_index_of_carriage_return_before_index method (#1092)
Method was not returning correct index if token was the first character in file.
2024-01-07 09:18:20 -06:00
Jeremiah Leary 33a209b9b1
Issue#1061: Updates for pragma use cases (#1063)
* Issue#1061:  Updates for pragma use cases

Pragmas are now treated as comments:

  *  Pragmas are now a subclass of comments
  *  Move rules will not move tokens if it crosses a pragma

* Fixing issue with expression classification causing infinite loop.
2023-12-12 06:41:06 -06:00
Jeremiah Leary a4fedc7230
Issue#909: Changed conflict between library_007 and entity_203 (#1043)
* no_blank_line_unless_different_library does not flag if previous line has a design_unit semicolon.
2023-11-19 07:47:33 -06:00
Jeremiah Leary bab5fbd1f4
Issue#929: Fixing issue with moving label and the postponed keyword. (#933)
* Issue#929:  Fixing issue with moving label and the postponed keyword.

* Refactoring per code climate.

* Removing unused parameter.

* Adding rule process_039 to enforce postponed on same line as process.
2023-04-20 06:46:52 -05:00
Jeremiah Leary fcf2610649
Issue 762 (#769)
* Updates for issue #762

Fixing issue with nested generates and rule generate_403.

  1)  Updated tests to expose the issue
  2)  Updated token_map.get_token_pair_indexes to honor nesting

* Removing debug code.

* Refactoring method get_token_pair_indexes to improve readability.

* Refactoring to reduce complexity.

* Fixing nested pair logic to properly extract pairs within pairs.

* Refactoring to reduce complexity.

* Formatting updates.

* Refactoring to improve readability.

* Fixing issue where VSG would crash if a requested pair of tokens did not exist.

  1)  Added test to expose the issue
  2)  Added debug message to base rule
2022-05-02 06:20:15 -05:00
Jeremiah Leary 22b5b51102
Revert "Updates for issue #762 (#766)" (#770)
This reverts commit e4226681bc.
2022-05-01 17:33:02 -05:00
Jeremiah Leary e4226681bc
Updates for issue #762 (#766)
* Updates for issue #762

Fixing issue with nested generates and rule generate_403.

  1)  Updated tests to expose the issue
  2)  Updated token_map.get_token_pair_indexes to honor nesting

* Removing debug code.

* Refactoring method get_token_pair_indexes to improve readability.

* Refactoring to reduce complexity.

* Fixing nested pair logic to properly extract pairs within pairs.

* Refactoring to reduce complexity.

* Formatting updates.

* Refactoring to improve readability.
2022-04-30 08:27:41 -05:00
Jeremiah Leary 940fa31e15
Updates for issue #679 (#753)
* Updates for issue #679

Fixing encoding issues when reading and writing files.

  1)  Added utf-8 encoding and decoding
  2)  Fixed issue with token map which was causing vsg to crash.

* Removing trailing whitespace.
2022-04-13 19:51:59 -05:00
Jeremiah Leary a0709483e0
Updates for issue #542: (#734)
* Updates for issue #542:

Rule comment_010 was firing after block_comment rules were ran:

  1)  Updated indent logic to take block comments into consideration
  2)  Added attributes to comment class to indicate if it is a block comment
  3)  Updated tests
  4)  Simplified extractor
  5)  Added method to token_map

* Refactoring functions to reduce duplication and complexity.

* Removing trailing whitespace.

* Removing excess blank lines.

* Refactoring to remove identical code.

* Refactoring to reduce complexity.

* Refactoring to reduction complexity.

* Refactoring to improve readability.

* Reverting to previous utils.py due to inadvertant commit.

* Refactoring block_comment_002 to reduce complexity and improve readability.

* Refactored block_comment_002 to reduce complexity.

* Refactoring block_comment_002 to reduce complexity.

* Refactoring block_comment_002 to improve readability.

* Refactoring to improve readability.

* Moving _analyze from block_comment_002 and block_comment_003 into base block_rule.

* Minor formatting updates.

* Updated base rule to ignore leading and trailing vsg code tags.

* Forcing tags of vsg_on to be applied on the next token.

* Refactoring methods to make them more readable.
2022-02-20 08:29:41 -06:00
Jeremiah Leary a18fe76779
Issue 575 (#703)
* Update for issue #575:

Fixing alignment rules as they were introducing syntax errors:
  align_tokens_in_region_between_tokens
  align_tokens_in_region_between_tokens_skiping_lines_starting_with_tokens

* Refactoring to improve readability.

* Addressing issues from Codacy and Codeclimate

* Refactoring number_of_tokens_in_token_list to improve readability.

* Refactoring utils functions to improve readability.

* Removing unused variable.

* An exit statement with a <= was being classified as a signal assignment.

* Fixed issue with improper classification of character literals.

* Extracting class from tokens.py

* Refactoring tokens.py to improve readability.

* Fixing issue when attempting to detect trailing whitespace.

* Updating tests to reflect changes in tokens.py

* Refactoring combine_characters_into_words to improve readability.

* Refactoring combine_string_literals to improve readability.

* Refactoring find_indexes_of_double_quote_pairs to improve readability.

* Refactoring combine_character_literals to improve readability.

* Refactoring to improve readability.

* Removing unused functions.

* Adding additional tests for tokenizer.

* Moving rule variable_assignment_004 to phase 5 and subphase 2 to ensure it runs correctly.

* Updating documentation for variable_assignment_004 change in phase.

* Rule constant_012 was operating on constant which were not arrays.

* Removing unused function.

* Removing unused function.

* Moving rule generic_001 to entity_200 to properly handle generic_clause in a package declaration.

* Refactoring extract routines to improve readability.

* Refactoring base rule to improve readability.

* Fixing Minor formatting issues.

* Removing unused function.

* Removing unused functions.

* Improving code coverage.

* Improving code coverage:

  1)  Removed unused functions
  2)  Removed unreachable code

* Refactoring constant_012 to improve readability.

* Refactoring analyze to _analyze:

  1)  Updated _get_tokens_of_interest to add more info into the token object

* Refactoring to improve readability.

* Refactoring generate_paren_dicts function to improve readability.

* Refactoring check_indents to improve readability.

* Refactoring to improve readability.

* Updates for rule constant_012:

  1)  Arguments align_left False and align_paren True working

* Refactored analyze_align_left_true_align_paren_false function in rule constant_012

* Refactored _analyze_align_paren_true_align_left_true function for rule constant_012.

* Removed unused functions and methods for rule constant_012.

* Updated rule constant_012 to use the indent step

* Refactoring to functions into methods.

* Removing unused file.

* Refactoring rule constant_012 to improve readability.

* Additional refactoring to improve readability.

* Refactoring check_left_aligned_line function to use less parameters.

* Removing unused variables.

* Attempting to get JSON extract test to pass on CI server.

* Removing unused functions.

* Updates for rule comment_100:

  Rule was error out if a comment was only 3 characters and the third was not a letter or number.

    1) Updated test
    2) Added check for length of comment

* Updates for parsing procedure_calls_statements:

Procedure call with <= was being classified as a simple waveform.

  1)  Updated test to expose issue
  2)  Updated classification code

* Refactoring to reduce cyclomatic complexity.

* Refactoring to reduce cyclomatic complexity.

* Minor formatting updates.

* Adding parsing of physical_type_definitions:

  1)  Added tokens
      a)  physical_type_definition
      b)  primary_unit_declaration
      c)  secondary_unit_declaration
  2)  Added classifiers
      a)  physical_type_definition
      b)  primary_unit_declaration
      c)  secondary_unit_declaration
  3)  Added test
      a)  full_type_declaration

* Minor formatting fix.

* Fixed bug with concurrent_simple_signal_assignment.

  A <= in a generic map was causing the generic map to be classified as a concurrent_simple_signal_assignment.

  1)  Updated test
  2)  Updated concurrent_simple_signal_assignment classifier

* Refactoring to reduce cyclomatic complexity.

* Adding classification of configuration_specification:

  1)  Added tests
  2)  Added classifiers for configuration_specification.

* Minor formatting updates.

* Fixing issue with previous_line rule if there were no lines above.

* Assert_statement was being classified before exiting block_statement.

* A backslash in a string literal was not be classified as a string literal.
2022-01-22 19:01:08 -06:00
Jeremiah Leary eabfaedd2a Updates for issue #592
Adding rule to move then keyword in if statements.

  1)  Added documentation
  2)  Added tests
  3)  Added rule if_036
2021-05-29 10:11:38 -05:00
Jeremiah Leary 62b716be7d Updates for issue #541
Fixing comment_011 to handle comments at the beginning of the line.

  1)  Updated tests to expose the issue
  2)  Updated code
      a)  Updated token_map method
      b)  Updated extract function
2021-03-24 17:31:39 -05:00
Jeremiah Leary 61de3b1e11 Updates for issue #501:
Fixing issue in token map where it was returning a list with None if the end pair token was not found.
2020-12-22 09:11:57 -06:00
Jeremiah Leary 7a25ded9ef Updates for issues #457 and #444:
Adding block rules.

  1)  Added documentation
  2)  Added tests
  3)  Added initial block rules
2020-12-10 13:48:21 -06:00
Jeremiah Leary 4721ae0322 Updates for Codacy flagged issues. 2020-12-04 13:27:19 -06:00
Jeremiah Leary a0d6bc4af1 Refactoring get_sequence_of_tokens_not_matching
1)  Moved from vsg.vhdlFile to vsg.vhdlFile.extract
  2)  Refactored to use token map
2020-12-02 14:19:21 -06:00
Jeremiah Leary 93f3f2970a Adding copy option to token map get_token_indexes method. 2020-12-02 10:25:38 -06:00
Jeremiah Leary af9a75dc38 Improving performace from last commit. 2020-12-02 10:21:36 -06:00
Jeremiah Leary 8d88659179 Fixed issue with rule if_002.
The base rule remove_excessive_blank_lines_above_line_starting_with_token was able to alter the token map.
This was due to the token map not returning a copy of it's lists.
2020-12-02 10:14:24 -06:00
Jeremiah Leary 9229214e85 Refactoring extract.get_n_token_after_tokens_between_tokens to use token map. 2020-12-01 08:35:28 -06:00
Jeremiah Leary 676df9b37f Refactoring several extract rules to use local token class. 2020-12-01 08:05:50 -06:00
Jeremiah Leary ccc3803613 Refactoring extract, base rules and token rules to use tokenMap. 2020-11-30 20:39:51 -06:00
Jeremiah Leary 17b5f2f21a Performance enhancement: Upgrading several extract routines to use the tokenMap. 2020-11-28 19:40:46 -06:00
Jeremiah Leary ca555d364c Performance updates: Adding token_map. 2020-11-28 14:58:58 -06:00