VACUMM / sphinx-fortran

Fortran domain and autodoc extensions to Sphinx
Other
45 stars 29 forks source link

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

Open sradanov opened 3 years ago

sradanov commented 3 years ago

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

sradanov commented 3 years ago

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