jeremiah-c-leary / vhdl-style-guide

Style guide enforcement for VHDL
GNU General Public License v3.0
192 stars 39 forks source link

Shift operators are not parsed properly #1302

Open JHertz5 opened 3 weeks ago

JHertz5 commented 3 weeks ago

Environment v3.27.0

Describe the bug The shift operators (e.g. sll) are parsed as parser.todo tokens, rather than the proper corresponding shift operator token.

To Reproduce Steps to reproduce the behavior:

  1. Create a VHDL file called test.vhd, including the snippet
    A <= X sll Y;
    A <= X srl Y;
    A <= X sla Y;
    A <= X sra Y;
    A <= X rol Y;
    A <= X ror Y;
  2. Run ./bin/vsg_parser -f test.vhd
  3. Observe the output
    --------------------------------------------------------------------------------
    11 |   A <= X sll Y;
    <class 'vsg.token.concurrent_simple_signal_assignment.target'>
    <class 'vsg.token.concurrent_simple_signal_assignment.assignment'>
    <class 'vsg.parser.todo'>
    <class 'vsg.parser.todo'>
    <class 'vsg.parser.todo'>
    <class 'vsg.token.concurrent_simple_signal_assignment.semicolon'>
    --------------------------------------------------------------------------------
    12 |   A <= X srl Y;
    <class 'vsg.token.concurrent_simple_signal_assignment.target'>
    <class 'vsg.token.concurrent_simple_signal_assignment.assignment'>
    <class 'vsg.parser.todo'>
    <class 'vsg.parser.todo'>
    <class 'vsg.parser.todo'>
    <class 'vsg.token.concurrent_simple_signal_assignment.semicolon'>
    --------------------------------------------------------------------------------
    13 |   A <= X sla Y;
    <class 'vsg.token.concurrent_simple_signal_assignment.target'>
    <class 'vsg.token.concurrent_simple_signal_assignment.assignment'>
    <class 'vsg.parser.todo'>
    <class 'vsg.parser.todo'>
    <class 'vsg.parser.todo'>
    <class 'vsg.token.concurrent_simple_signal_assignment.semicolon'>
    --------------------------------------------------------------------------------
    14 |   A <= X sra Y;
    <class 'vsg.token.concurrent_simple_signal_assignment.target'>
    <class 'vsg.token.concurrent_simple_signal_assignment.assignment'>
    <class 'vsg.parser.todo'>
    <class 'vsg.parser.todo'>
    <class 'vsg.parser.todo'>
    <class 'vsg.token.concurrent_simple_signal_assignment.semicolon'>
    --------------------------------------------------------------------------------
    15 |   A <= X rol Y;
    <class 'vsg.token.concurrent_simple_signal_assignment.target'>
    <class 'vsg.token.concurrent_simple_signal_assignment.assignment'>
    <class 'vsg.parser.todo'>
    <class 'vsg.parser.todo'>
    <class 'vsg.parser.todo'>
    <class 'vsg.token.concurrent_simple_signal_assignment.semicolon'>
    --------------------------------------------------------------------------------
    16 |   A <= X ror Y;
    <class 'vsg.token.concurrent_simple_signal_assignment.target'>
    <class 'vsg.token.concurrent_simple_signal_assignment.assignment'>
    <class 'vsg.parser.todo'>
    <class 'vsg.parser.todo'>
    <class 'vsg.parser.todo'>
    <class 'vsg.token.concurrent_simple_signal_assignment.semicolon'>
    --------------------------------------------------------------------------------

Expected behavior I expect these tokens to be parsed as the tokens in vsg/token/shift_operator.py

JHertz5 commented 3 weeks ago

PR #1302 raised to address this issue.

JHertz5 commented 3 weeks ago

This being completed facilitates new rules that act on shift operators, e.g. whitespace and capitalisation rules. I plan to raise issues and PRs for these in the near future.