Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SystemVerilog: let tagNameList() skip paren on RHS #2644

Merged
merged 2 commits into from
Sep 14, 2020

Conversation

hirooih
Copy link
Contributor

@hirooih hirooih commented Sep 13, 2020

This fixes one of issues on #2618

  // src/tlm2/uvm_tlm2_generic_payload.svh:494
  string msg = $sformatf("GP miscompare between '%s' and '%s':\nlhs = %s\nrhs = %s",
      bar(), 1, 2, 3);  // register:bar => not defined

verilog.c: L1275

				} while (c != EOF && c != ','  &&  c != ';' && c != ')');

tagNameList() looks for ,, ;, or ) as the end of an expression of the right-hand-side (RHS) of an assignment.
) of bar() is detected as the end of an expression. This confuses the parser.

It is fixed by calling skipPastMatch ("()").

I also added testcases for assignment pattern.
User defined type variables are not emitted due to #2413 issue. When #2413 is fixed, they will be emitted. expected.tags must be updated at that time.

(I tried rebase -i but failed. Commit logs for merged commits remains. Sorry.)

@coveralls
Copy link

coveralls commented Sep 13, 2020

Coverage Status

Coverage increased (+0.0006%) to 86.925% when pulling 3b8b5bd on hirooih:sv-tagNameList-paren-on-RHS into c88becd on universal-ctags:master.

@masatake
Copy link
Member

I will arrange the commits and push the result to your branch with "git push --force".

@hirooih
Copy link
Contributor Author

hirooih commented Sep 13, 2020

I did "git push --force" before sending pull-request.

I did now again but same result.

$ git pull --force
Already up to date.
$

I probably I made a mistake.
I might do git merge upstream/master on this branch (but not sure).
I should do it on my master branch and do rebase master on this branch.

Any clue?

@masatake
Copy link
Member

masatake commented Sep 13, 2020

I rearranged your commits in the branch.
I found 3 new commits:

The first thing that I want you to do is verifying the 3 commits and make sure they are the commits you want me to pull.
This is an important step because the next steps can break your commits in your local PC.

@codecov
Copy link

codecov bot commented Sep 13, 2020

Codecov Report

Merging #2644 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2644   +/-   ##
=======================================
  Coverage   86.82%   86.82%           
=======================================
  Files         183      183           
  Lines       38971    38973    +2     
=======================================
+ Hits        33837    33839    +2     
  Misses       5134     5134           
Impacted Files Coverage Δ
parsers/verilog.c 97.21% <100.00%> (+0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b599093...3b8b5bd. Read the comment docs.

@masatake
Copy link
Member

After verifying, you can go to the following steps for pulling the rearranging I made here to your local PC (your workspace):

$ git checkout master
$ git pull upstream master:master
$ git checkout -b sv-tagNameList-paren-on-RHS-rebased
$ git pull origin sv-tagNameList-paren-on-RHS:sv-tagNameList-paren-on-RHS-rebased

Here
upstream is defined in .git/config as

[remote "upstream"]
        url = https://github.com/universal-ctags/ctags.git
        fetch = +refs/heads/*:refs/remotes/upstream/*

I guess origin is already defined in .git/config.

sv-tagNameList-paren-on-RHS-rebased is the new workspace for imporving the commits.

After improving the commits, you can reflect the result to this pull request with following command:

git push origin --force sv-tagNameList-paren-on-RHS-rebased:sv-tagNameList-paren-on-RHS

@masatake
Copy link
Member

BTW, don't you should not put your local change to your master branch.
As far as I know, you should use the master branch for pulling the changes made in the master branch of the upstream repository.
If your changes are merged to the upstream repository, "git pull upstream master:master" is the way for reflecting your changes to your master branch (of your local PC).

@masatake
Copy link
Member

If your side is ready, let me know. I will start my review.

However, taking time for understanding git operations is not a bad idea.
The knowledge of git operations helps you keep commits clean, and helps you manage more branches.

This fixes one of issues on universal-ctags#2618

  // src/tlm2/uvm_tlm2_generic_payload.svh:494
  string msg = $sformatf("GP miscompare between '%s' and '%s':\nlhs = %s\nrhs = %s",
      bar(), 1, 2, 3);  // register:bar => not defined

verilog.c: L1275

				} while (c != EOF && c != ','  &&  c != ';' && c != ')');

tagNameList() looks for ,, ;, or ) as the end of an expression of the
right-hand-side (RHS) of an assignment.
) of bar() is detected as the end of an expression. This confuses the
parser.

It is fixed by calling skipPastMatch ("()").
@hirooih
Copy link
Contributor Author

hirooih commented Sep 13, 2020

My Master,

I've update the commit log. It works great!
Thank you for your teaching me!

struct { int x; int y; } s4 = '{x:2, y:3+k};

st s5 = '{default:2};
ab abkey[1:0] = '{'{a:1, b:1.0}, '{int:2, shortreal:2.0}};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ab is not typedef'ed. It this o.k.?

If possible, make a test input valid as SystemVerilog input.

@hirooih
Copy link
Contributor Author

hirooih commented Sep 13, 2020

Sorry I made mistake on the definition of y. 2c49261
If you are OK for the fixes, I will squash 3 commits for Units test.

@masatake
Copy link
Member

This fixes one of issues on #2618

  // src/tlm2/uvm_tlm2_generic_payload.svh:494
  string msg = $sformatf("GP miscompare between '%s' and '%s':\nlhs = %s\nrhs = %s",
      bar(), 1, 2, 3);  // register:bar => not defined

verilog.c: L1275

				} while (c != EOF && c != ','  &&  c != ';' && c != ')');

tagNameList() looks for ,, ;, or ) as the end of an expression of the right-hand-side (RHS) of an assignment.
) of bar() is detected as the end of an expression. This confuses the parser.

It is fixed by calling skipPastMatch ("()").

This comment may be helpful for people who does 'git log parsers/verilog.c'.
So put this to the commit log of 7db1ab6.

User defined type variables are not emitted due to #2413 issue. When #2413 is fixed, they will be emitted. expected.tags must be updated at that time.

You can put this to Units/parser-verilog.r/systemverilog-assignment.d/README (or anywhere in the commits.)

IF you have the original source of input.sv, write it to input.sv as a comment.

// Taken from https://developers.google.com/protocol-buffers/docs/reference/proto3-spec
is an example.

As you wrote, please squash the commits into 1, 2 or 3 commits when ready for merging.

User defined type variables are not emitted due to #2413 issue. When #2413 is fixed, they will be emitted. expected.tags must be updated at that time.

Will you try to fix #2413? I expect your answer is yes:-)

@hirooih
Copy link
Contributor Author

hirooih commented Sep 13, 2020

You can put this to Units/parser-verilog.r/systemverilog-assignment.d/README (or anywhere in the commits.)

It's already on the head of input.sv.

  // user defined types are ignored.
  //   https://github.com/universal-ctags/ctags/issues/2413
  // Update expected.tags when #2413 is fixed.

IF you have the original source of input.sv, write it to input.sv as a comment.

It's already in comments in input.sv.
LRM stands for Language Reference Manual. It is a very common acronym in Verilog world.
https://ieeexplore.ieee.org/document/8299595. You can download it with no charge. I recommend you to get it.

As you wrote, please squash the commits into 1, 2 or 3 commits when ready for merging.

I did it now.

Will you try to fix #2413? I expect your answer is yes:-)

It is a next topic. I am studying it now. Let's discuss on #2413.

@masatake
Copy link
Member

As you wrote, three commits for a test case can be squashed into one.

@hirooih
Copy link
Contributor Author

hirooih commented Sep 14, 2020

As you wrote, three commits for a test case can be squashed into one.

Sorry, this morning I typed wrong password on git push.

@masatake masatake merged commit dc02aee into universal-ctags:master Sep 14, 2020
@masatake
Copy link
Member

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants