Skip to content

KIND_SPEC_REGEX fails on space between * and kind specifier  #142

Closed
@kemlath

Description

fortls failes on variable declarations like 'REAL * 8' where there is a space between the * and the kind specifier

Adding a [ ]* to the *[0-9:] alternative in [ ]*([*]?\([ ]*[a-z0-9_*:]|\*[0-9:]*) yields:

KIND_SPEC_REGEX = re.compile(r'[ ]*([*]?\([ ]*[a-z0-9_*:]|\*[ ]*[0-9:]*)', re.I)

which matches '* 8'.

However this match is longer than 2 so in addition in parse_fortran.py line 326 in routine read_var_def one has to replace

kind_str = kind_match.group(1).strip()

with

kind_str = kind_match.group(1).replace(' ','')

which then finally yield '*8' which can be processed by the rest of the routine

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions