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

Module etc. rexexp fixes and cleanup (#1861) #1862

Merged
merged 1 commit into from
Feb 3, 2024
Merged

Module etc. rexexp fixes and cleanup (#1861) #1862

merged 1 commit into from
Feb 3, 2024

Conversation

rlarv
Copy link
Contributor

@rlarv rlarv commented Jan 31, 2024

meant for issue #1861
indentation problem when there is a signal named "module_something"

cleanup:
remove a superflous extra \> end-of-word delimiter

fixes:
use shy-grouping \(?: \) to fix \< and \> begin/end-of-word
which were accidentaly not used for each alternative in some \| regexp

!!! beware of "assert" !!!
I might have broken that by adding bow and eof regexps.
May be something like \<assert\(?:_always\)?\>
or something even longer, should be used here

meant for issue  #1861
  indentation problem when there is a signal named "module_something"

cleanup:
  remove a superflous extra \\> end-of-word delimiter

fixes:
  use shy-grouping \\(?: \\) to fix \\< and \\> begin/end-of-word
  which were accidentaly not used for each alternative in some \\| regexp
Copy link
Member

@wsnyder wsnyder left a comment

Choose a reason for hiding this comment

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

Looks good, one minor fix (that was broken before).

@@ -5039,7 +5039,7 @@ More specifically, after a generate and before an endgenerate."
(save-excursion
(while (and
(/= nest 0)
(verilog-re-search-backward "\\<\\(fork\\)\\|\\(join\\(_any\\|_none\\)?\\)\\>" lim 'move)
(verilog-re-search-backward "\\<\\(?:\\(fork\\)\\|\\(join\\(_any\\|_none\\)?\\)\\)\\>" lim 'move)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
(verilog-re-search-backward "\\<\\(?:\\(fork\\)\\|\\(join\\(_any\\|_none\\)?\\)\\)\\>" lim 'move)
(verilog-re-search-backward "\\<\\(?:\\(fork\\)\\|\\(join\\(?:_any\\|_none\\)?\\)\\)\\>" lim 'move)

@wsnyder wsnyder changed the title consider some rexexp fixes and cleanup consider some rexexp fixes and cleanup (#1861) Feb 1, 2024
@wsnyder wsnyder changed the title consider some rexexp fixes and cleanup (#1861) Module etc. rexexp fixes and cleanup (#1861) Feb 1, 2024
@rlarv
Copy link
Contributor Author

rlarv commented Feb 2, 2024

Yes, of course, that gets rid of one unused "group".
Of course there are more such unused groups, for example the \(un\) groups for "unsigned".
And there is this nice "rx" macro of emacs which would improve readabilty and maintainabilty quite a bit.
Some info is here https://www.emacswiki.org/emacs/rx
For example
(rx bow (or (group "fork") (group "join" (opt (or "_any" "_none")))) eow)
or even
(rx bow (or (group "fork") (group (or "join" "join_any" "join_none"))) eow)
which yields and even optimizes a bit to
"\\<\\(?:\\(fork\\)\\|\\(\\(?:join\\(?:_\\(?:any\\|none\\)\\)?\\)\\)\\)\\>"
at macro expansion time.
But I think this is not available in xemacs.
Regards,

@wsnyder wsnyder merged commit 6e056e2 into veripool:master Feb 3, 2024
2 checks passed
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.

2 participants