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

fortran_domain doesn't handle arguments declared as "double precision" correctly. #38

Open
sradanov opened this issue Jul 22, 2021 · 1 comment

Comments

@sradanov
Copy link
Contributor

An argument of a subroutine declared as
DOUBLE PRECISION,DIMENSION(:,:),INTENT(IN):: MYVAR
appears as

  • precision [double]
    in the documentation, instead of something like
  • myvar(,)[double precision, in]
    I suppose something is going wrong around this line:
    re_fieldname_match = re.compile( r'(?P<type>\b\w+\b(?P<kind>\s*\(.*\))?)?\s*(?P<name>\b\w+\b)\s*(?P<shape>\(.*\))?\s*(?P<sattrs>\[.+\])?').match
    since everything seems to be fine until the scan_fieldarg method of the FortranDocFieldTransformer class
    where
    print(fieldname)
    gives
    double precision myvar(,) [in]
    but the method returns
    precision None double None
    instead of
    myvar (,) double precision in
@sradanov
Copy link
Contributor Author

An idea of how to change re_fieldname_match:
Option 1 : let double precision be a special case of type : re_fieldname_match = re.compile(r'(?P<type>\b(?:double precision|\w+)\b(?P<kind>\s*\(.*\))?)?\s*(?P<name>\b\w+\b)\s*(?P<shape>\(.*\))?\s*(?P<sattrs>\[.+\])?').match

Option 2 : accept only variable names without spaces but types are accepted with one space :
re_fieldname_match = re.compile(r'(?P<type>\b\w+ ?(?:\w+)?\b(?P<kind>\s*\(.*\))?)?\s*(?P<name>\b\w+\b)\s*(?P<shape>\(.*\))?\s*(?P<sattrs>\[.+\])?').match

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

No branches or pull requests

1 participant