Commit Graph

74 Commits

Author SHA1 Message Date
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 b8c49b5946 style: python encoding
Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
2024-03-24 21:16:35 +02:00
Alon Bar-Lev 6aca7f56d5 style: remove trailing spaces
Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
2024-03-24 21:16:35 +02:00
Alon Bar-Lev b4d5c4e5d6 cleanup: use super() to call parent
Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
2024-03-23 18:48:35 +02:00
Jeremiah Leary 1ba9088374
Issue#1081: Adding configuration option for constant_400 (#1094)
* Issue#1081:  Adding configuration option for constant_400

* Adding options to concurrent_400 and sequential_400.

* Refactored base rules to improve readability.

* Merging base rules:

  align_tokens_in_region_between_tokens_unless_between_tokens merged into align_tokens_in_region_between_tokens

* Adding ignore_single_line_aggregates to rule constant_400

* Removing commented out code.

* Refactoring align_tokens_in_region_between_token_when_between_tokens_unless_between_tokens.

* Removing unused alignment options due to refactor.
2024-01-21 13:55:08 -06: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 7ba4904371
Issue#1053: Adding rule to check for reserved words. (#1055)
* Issue#1053:  Adding rule to check for reserved words.

* Removing unused token classes.

* Fixing documentation.
2023-12-01 07:41:39 -06:00
Jeremiah Leary a564870d0e
Issue#1034: Improving classification of functions and procedures. (#1045) 2023-11-12 07:05:38 -06:00
Jeremiah Leary e810689292
Issue 852 (#856)
* Updates for issue #852

Adding support the attributes in subtype indications.

  1)  Updated classifier subtype_indication to call type_mark
  2)  Updated get_sequence_of_tokens_matching

* Removing comments.
2022-11-04 09:01:33 -05:00
Jeremiah Leary 9f65068692
Updates for issue #559: (#798)
* Updates for issue #559:

Adding documentation for configuring indent rules.

* Adding documentation:

  1)  Updated whitespace_002
  2)  Added whitespace_014
  3)  Added configuring tabs vs spaces

* Adding example documentation.
Fixing table.

* Updated documentation:

  1)  Removed whitespace_014
  2)  Updated whitespace_002 to only work on middle tabs
  3)  Removed configuring_tabs_vs_spaces document
  4)  Removed tabs as an option for indenting

* Updating token indent rules.

* Adding smart_tabs test for rule assert_statement_001

* Updating rule assert_400 to allow smart tabs.

* Refactoring assert_400 to improve readability.

* Refactoring to reduce complexity.

* Updates for rule case_011 and assert_400:

  1) Replaced align_consecutive_lines_after_line_starting_with_token_and_stopping_with_token with assert_400
  2) Updated rule assert_400 to inherit align rule
  3) Changed rule case_011 to use align rule

* Removing rule case_021.

The function of the rule is now covered by comment_010.

* Deprecating rule case_generate_alternative_300.

* Refactoring analyze to _analyze.

* Splitting configuration of rule assert_400 into its own page.

* Updating multiline_alignment_between_tokens to handle smart tabs.

* Deprecating rules if_032 and if_033.  They are covered by comment_010.

* Updated report_statement_400 to use align_consecutive_lines_after_line_starting_with_token_and_stopping_with_token.

* Updating rule process_028 to handle smart-tabs

 1) Updated tests
 2) Updated base rule align_left_token_with_right_token_if_right_token_starts_a_line

* Updating rule library_009 to handle smart-tabs

  1)  Updated tests
  2)  Updated base rule align_consecutive_lines_starting_with_a_comment_above_line_starting_with_token

* Minor formatting updates.

* Adding methods to support multiline alignment base class.

* Refactored rule constant_012 to split indent and alignment whitespace.

* Adding smart-tab support to rule constant_012.

* Removing old classify code.

* Removing debug print statement.

* Updating documentation for assert and report_statement rules.

* Updating rule concurrent_009 to support smart-tabs.

  1)  Added tests
  2)  Updated rule to support smart-tabs

* Updating documentation to match current implementation.

* Taking a different approach for multiline_alignment_between_tokens.

  1)  Reverted smart_tabs changes
  2)  Updated base rule to method employed on concurrent_009
  3)  Commented out smart_tab tests

* Updated missing meta data to Toi in rule constant_014

Fixed error in align_left_no_align_paren_no analyzer.

* Adding smart-tab support to base rule multiline_alignment_between_tokens.

* Updating alignment rules to support smart tabs.

  1)  Updated base rules
      a) vsg/rules/align_tokens_in_region_between_tokens.py
      b) vsg/rules/align_tokens_in_region_between_tokens_skipping_lines_starting_with_tokens.py
      c) vsg/rules/align_tokens_in_region_between_tokens_unless_between_tokens.py
  2)  Updated rule concurrent_008
  3)  Added tests

* Fixing issue with rule port_map_009 misfiring if the following token sequence occured:  comma, whitespace, carraige return.

* Updating solution for indent rules to give required tabs and spaces.
Fixing several bugs in indent implementation:
  1)  checking for smart-tabs instead of smart_tabs

* Updates for Codacy issues.

* Additional Codacy updates.

* Fixing style issues identified by CodeClimate.

* Additional style fixes identified by CodeClimate.

* Refactoring alignment rules:

  1)  Created utils file specifically for alignment rules
  2)  Refactored rules to move identical code into utils file

* Moving update_column_width into alignment_utils file.

* Moving functions into alignment_utils:
  1)  get_first_line_info
  2)  starts_with_paren

* Using functions in alignment_utils.

* Collapsing branches to improve readability.

* Refactoring to improve readability.
2022-10-07 08:01:03 -05:00
Jeremiah Leary 7225df8b9d
Updates for issue #539 (#751)
* Updates for issue #539

Adding multiline structural rule for rule signal_016.

  1)  Added test cases
  2)  Update rule signal_016
  3)  Updated documentation

* Adding test for arrays.

* Adding functions to combine slices into a single object

* Adding array_first_paren_new_line option.

* Removing unused code.

* Adding tests for the following parameter options:

  1)  array_first_paren_new_line (yes/no)
  2)  first_paren_new_line (yes/no)

* Adding documentation for configuring multiline constraint rules.

* Minor grammar updates.

* Updating per feedback:

  1)  Made symbols in table with a transparent background
  2)  Minor grammar updates
  3)  Fixed indenting in code examples

* Adding correct red penta star png file.

* Upated third example to correctly show behavior.

* Updated figure with correct indenting.
Fixed indenting in example 2.

* Adjusting indent on example 3 and example 4.

* Initial rewrite to classify constraints.

* Converting variable_declaration to call subtype_indication.classify.

* Changing constant_declaration to use subtype_indication.classify

* Changing unbounded_array_definition to use subtype_indication.classify

* Changing subtype_declaration to use subtype_indication.classify

* Changed interface_variable_declaration to call subtype_indication.classify

* Changing the following to use subtype_indication.classify:

  interface_constant_declaration
  interface_file_declaration
  interface_signal_declaration
  interface_unkown_declaration

* Changing the following to use subtype_indication.classify:

  constrained_array_definition

* Changing the following to use subtype_indication.classify

  element_subtype_definition

* Changing the following to use subtype_indication.classify:

  alias_declaration

* removing commented out line.

* Changing the following to use subtype_indication.classify:

  file_declaration

* Changing the following to use subtype_indication.classify

  access_type_definition

* Removing subtype_indication.classify_until

* Initial commit of rule signal_017

  * Implemented record_constraint_open_paren = add_new_line

* Minor refactoring.

* Extracted the following functions:

  _check_add_new_line
  _token_at_beginning_of_line

* Adding the following options to rule signal_017

  *  record_constraint_open_paren :: remove_new_line

* Adding the following options:

  record_constraint_close_paren :: add_new_line
  record_constraint_close_paren :: remove_new_line

* Adding the following options:

  record_constraint_comma :: remove_new_line

* Adding the following option:

  record_constraint_element :: add_new_line
  record_constraint_element :: remove_new_line

* Adding the following option:

  * array_constraint :: all_in_one_line

* Fixing issue with array_constraint::all_in_one_line not detecting multiline array_constraints.

* Adding the following options:

  array_constraint :: one_line_per_dimension

* Adding rule signal_400 to handle indenting of multiline signal constraints.

* Fixing issues for Codacy.

* Refactoring to reduce complexity and improve readability.

* Adding links to new rules.

* Refactoring to improve readability.

* Refactoring to improve readability.

* Fixing style issues.

* Updating for style issues.

* Updating formatting issues.

* Removing unused file.

* Removing commented out debug statements.

* Minor formatting updates.

* Adding metadata attribute and methods.

* Refactoring _check_array_contraint_one_line_per_dimension function to improve readability.

* Refactoring _check_array_constraint_all_in_one_line function to improve readability.

* Refactoring _create_violation to just take oToi as a parameter.

* Adding exception logic.

* Refactoring to improve readability.

* Refactored analyze_exception_one to improve readability.

* Refactoring the following functions:

  * _check_array_constraint_all_in_one_line
  * _check_array_constraint_one_line_per_dimension

* Refactoring the following functions:

  *  add_index_constraint_open_parenthesis
  *  add_index_constraint_close_parenthesis
  *  add_record_constraint_open_parenthesis
  *  add_record_constraint_close_parenthesis

* Refactoring to improve readability.

* Minor formatting updates.

* Adjusting signal_400 to remove extra level of indent.

* Updates for rule signal_400:

  1)  Modified base rule multiline_alignment_between_tokens to support signal_400
  2)  Added tests for the four variants of options.

* Fixing style issues.

* Simplifying _check_new_line_after_comma function.

* Deprecating rule signal_016.

* Removing unused base rule multiline_declaration_structure.

* Style and minor refactorings.

* Moving filtering of toi's from _analyze to _get_tokens_of_interest.

* Extracted update_open_paren_counter from _classify_assignment

* Extracted update_close_paren_counter form _classify_assignment

* Refactoring _fix_violation to reduce complexity

* Refactored _create_violation:

  1)  Placed violation information into oToi object

* Refactoring to reduce complexity.

* Adding rule constant_017

* Adding rule variable_017

* Updating links to rules.

* Adding rule variable_400.

* Minor cleanup of documentation.

* Adding default values for options.

* Minor updates for formatting:
2022-07-08 08:26:29 -05:00
Jeremiah Leary 267b17e72a
Updates for issue #730 (#741)
* Updates for issue #730

Adding rules to handle case for use_clause selected names.

  1)  Added new tokens to use_clause
  2)  selected names now parsed with new tokens
  3)  Added rules:
      a)  use_clause_500
      b)  use_clause_501
      c)  use_clause_502
      d)  use_clause_503
  4)  Added tests

Resolves #730

* Refactoring to reduce duplication.
Removing trailing whitespace.

* Changing exceptions to case_exceptions.

1)  case::name rules allow case_exceptions by default
2)  Updated instantiated_unit to split entity_name with a library name
3)  Rule instantiation_028 simplified
4)  Removed unused test file

* Refactoring to reduce complexity.

* Refactoring to improve readability.

* Fixed isue with procedure_506 crashing VSG due to missing variable.

* Fixing missing call to lowercase list.

* Adding the following rules:

  context_ref_500
  context_ref_501

Deprecated the following rules:

  context_ref_004

* Placing common code into a single file.

* Removing trailing whitespace.

* Refactoring to reduce the number of parameters.
2022-04-19 19:21:20 -05:00
Jeremiah Leary ab566beed2
Updates for issue #750 (#752)
* Updates for issue #750

Fixed code tags to allow for comments within the tag.

  1)  Updated tests
  2)  Updated documentation
  3)  Updated code tag logic to ignore anything after the : within the code tag

* Additional code tag updates
Added parsing of exponents.

* Minor formatting fixes.

* Refactored split_natural_numbers to improve readability.

* Refactoring code tag logic to improve readability.

* Minor formatting updates.

* Removing trailing whitespace.

* Refactoring to improve readability.

* Refactoring to reduce line length.

* Fixing indent.

* Adding rule exponent_500.
2022-04-10 20:10:49 -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 443fb0b260 Updates for issue #559
Adding rule whitespace_001 to detect and fix trailing whitespace.

  1)  Updated documentation
  2)  Added tests for whitespace_001
  3)  Removed trailing whitespace for test files which are not testing whitespace_001
  4)  Added rule whitespace_001
2021-10-02 11:07:52 -05:00
Jeremiah Leary 0bec7656a2 Updates for issue #512:
Added filename to output of parsing error message.
2021-01-13 19:13:53 -06:00
Jeremiah Leary 585208ad61 Updates for issue #503:
Adding ability to parse preprocessor commands embedded in VHDL code.

  1)  Added preprocessor token
  2)  Added preprocessor classifier
2020-12-21 14:15:48 -06:00
Jeremiah Leary be88d4a462 Updates for issue #445
Adding ability for the user to adjust the indenting algorithm.

  1)  Added documentation
  2)  Refactored indent algorithm
      a)  Changed algorithm to use a YAML configuration file
  3)  Added indent dictionary to -oc output
  4)  Updated tests to use new YAML configuration file
2020-12-20 18:06:07 -06:00
Jeremiah Leary 8613276dd0 Performance updates: Adding parameters to tokens to support a token map. 2020-11-28 14:57:54 -06:00
Jeremiah Leary a0a9813d89 Codacy fixes. 2020-11-24 17:14:00 -06:00
Jeremiah Leary 72099b17a1 Refactoring code tags to work with new parser.
1)  Added code tags to tokens
  2)  Added methods to parse code tags
  3)  Updated tests
2020-11-22 10:24:00 -06:00
Jeremiah Leary 36d24bf31c Refactoring rule whitespace_007 for new parser. 2020-11-02 22:12:45 -06:00
Jeremiah Leary ffe6b3271e Refactoring rule signal_012 for new parser. 2020-10-31 12:52:16 -05:00
Jeremiah Leary e0ca2f59ae Refactoring rule process_029 for new parser. 2020-10-25 11:20:08 -05:00
Jeremiah Leary 5f6e293f3d Refactoring additional if_statement rules for new parser. 2020-10-24 17:01:50 -05:00
Jeremiah Leary 2b508cd6a2 Refactored rule architecture_001 to use new parser.
1)  Added token_indent rule
 2)  Improved testing
2020-09-21 07:03:22 -05:00
Jeremiah Leary 6c44ef62f7 Convertering rule whitespace_003 to new parser. 2020-09-20 10:19:48 -05:00
Jeremiah Leary 75ed817ecb Removing remanants of older parser.
Moving classification tests under vhdlFile_new.
2020-09-19 12:31:18 -05:00
Jeremiah Leary a95bd04873 Replacing older parser with newer one:
1)  Called out parsers from classify_new instead of classify
  2)  Updated invalid test inputs
  3)  Updated test results
  4)  Removed unused files
2020-09-19 07:46:35 -05:00
Jeremiah Leary 00ef847d09 Temporary commit for case_statement. Need to implement signal_assignment_statement and variable_assignment_statement. 2020-09-11 16:53:49 -05:00
Jeremiah Leary 65e4678e29 Adding parsing of alias_declaration. 2020-09-09 07:35:53 -05:00
Jeremiah Leary 074979cea3 Adding parsing of constant_declaration.
Fixing issues with conccurent parsing.
2020-09-08 17:37:49 -05:00
Jeremiah Leary a8e914b5d9 Adding parsing of package_declaration. 2020-09-05 19:38:43 -05:00
Jeremiah Leary 0bd423a102 Adding concurrent_procedure_call_statement parsing. 2020-09-03 08:28:44 -05:00
Jeremiah Leary 3222f34323 Bug fixes to support the concurrent_statement test. 2020-09-02 21:31:11 -05:00
Jeremiah Leary d7825ae51f Adding concurrent_simple_signal_assignment parsing. 2020-08-31 14:16:15 -05:00
Jeremiah Leary d623e8d105 Adding parsing support for concurrent selected signal_assignments. 2020-08-31 12:45:32 -05:00
Jeremiah Leary 3c64992874 Adding parsing support for concurrent_conditional_assignments. 2020-08-31 11:19:11 -05:00
Jeremiah Leary 5a3272a562 Adding support for case generate statements. 2020-08-30 09:41:23 -05:00
Jeremiah Leary 0b00107d4a Refactoring new classifier logic. 2020-08-29 15:18:06 -05:00
Jeremiah Leary 7af7a41ce0 Refactored architecture_body into it's own file. 2020-08-19 22:51:34 -05:00
Jeremiah Leary 4b1fb9c144 Attempting new method to classify tokens using a forward looking algorithm. 2020-08-19 21:34:30 -05:00
Jeremiah Leary 1941c2af8f Added concurrent_assertion_statement objects and refactored parser.assertion objects into token objects. 2020-08-14 19:42:42 -05:00
Jeremiah Leary 30d900e3da Added delay_machinism and concurrent_simple_signal_assignment objects. 2020-08-14 10:38:51 -05:00
Jeremiah Leary 971e67c3d0 Adding procedure_specification tokens. 2020-08-10 08:24:28 -05:00
Jeremiah Leary 69c3b9ef07 Adding type objects. 2020-08-09 08:55:36 -05:00
Jeremiah Leary e9332a4d45 Adding alias declaration objects. 2020-08-07 18:21:31 -05:00
Jeremiah Leary 05889e8176 Adding component declaration objects and refactored parser.variable objects into token.variable_declaration objects. 2020-08-07 07:21:54 -05:00