FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

MAINT: crackfortran regex simplify by tylerjereddy · Pull Request #18072 · numpy/numpy · GitHub

/ numpy Public

MAINT: crackfortran regex simplify - #18072

Merged
charris merged 2 commits into
numpy:masterfrom
tylerjereddy:treddy_crackfortran_regex_simplify_1
Dec 27, 2020
Merged

charris merged 2 commits into
numpy:masterfrom
tylerjereddy:treddy_crackfortran_regex_simplify_1

Conversation

Copy link
Copy Markdown
Contributor
  • remove extraneous character class markers used in
    crackline_re_1: \w and = on their own have no
    benefit to character class [] inclusion

  • name_match has a character class that can be
    simplified because \w metacharacter already
    encompasses the digit metacharacter and the
    underscore

* remove extraneous character class markers used in
`crackline_re_1`: `\w` and `=` on their own have no
benefit to character class `[]` inclusion

* `name_match` has a character class that can be
simplified because `\w` metacharacter already
encompasses the digit metacharacter and the
underscore

mattip left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Looks correct to me

Comment thread numpy/f2py/crackfortran.py Outdated

dep_matches = {}
name_match = re.compile(r'\w[\w\d_$]*').match
name_match = re.compile(r'\w[\w$]*').match

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I suspect the original here was wrong.

A Fortran identifier must satisfy the following rules:
The first character must be a letter, The remaining characters, if any, may be letters, digits, or underscores, Fortran identifiers are case insensitive. That is, Smith, smith, sMiTh, SMiTH, smitH are all identical identifiers.

The first \w should probably be [A-Za-z]. The addition of \d_ is consistent with misunderstanding of \w not to include digits and underscores. The $ could probably be omitted, but it seems to work as is.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks, I revised based on your feedback

* `name_match` regular expression now starts by
matching a letter only, based on reviewer
feedback
charris merged commit caa27a9 into numpy:master Dec 27, 2020

charris commented Dec 27, 2020

Copy link
Copy Markdown
Member

Thanks Tyler. Looks like $ is sometimes a valid character in names, so that is also correct.

As vendor extension, the dollar sign ($) is additionally permitted with the option -fdollar-ok, but not as first character and only if the target system supports it.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL