Skip to content

Treating "!" in if-statement as beginning of line comment in line #128

Closed
@AndreHorst

Description

I think since v1.10 there is apparently a parsing bug. Maybe this was introduces when fixing #118 ? I'm not sure, but this is what happens:

When having a simple if-statement, there is a parsing error when a "!" is part of the if () clause:

if (string == "test") then
  call message("This works fine!")
end if

if (string == "#test") then
  call message("This works fine!")
end if

if (string == ".test") then
  call message("This works fine!")
end if

if (string == "test") then
  call some_routine("!",testing_parameter)
  call message("This also works fine, because the ! is not inside the if() clause!")
end if

if (string == "!test") then
  call message("This breaks fortls, because of a ! in the if() clause!")
  call message("Warnings are primary 'unexpected end of scope' which, I guess, come  from treating the ! as the start of a comment?")
  call message("The rest of the warnings are follow-ups.")
end if

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions