Skip to content

Compiling a ST program ending in a comment fails #761

@lucasoethe

Description

@lucasoethe

Expected Behavior

Either:
(a) Compiling an ST program with a comment at the end for the OpenPLC Runtime v3 should work
(b) When attempting to compile an ST program without a newline at the end, it is automatically added (For why this might be a solution see below)

Not sure if this is related, but sometimes when saving a ST file trailing whitespace(Newline/space) is trimmed, causing compilation to fail on the second attempt.

Current Behavior

Compiling an ST program ending in a comment fails with the message below. This can be mitigated by adding trailing whitespace (Newline/Space) to the program. Unfortunately this whitespace is removed after compilation, meaning a second compilation attempt will fail. Additionally the whitespace is removed when initially opening a project, meaning it needs to be manually added before each compilation.

[18-05-26 17:58:07]: iec2c process exited with code 1
[18-05-26 17:58:07]: /home/soethe/Documents/min-broken/build/OpenPLC Runtime v3/src/program.st:6-27..13-23: error: invalid variable before ':=' in ST assignment statement.
[18-05-26 17:58:07]: 6 | OUT := TRUE; (* Test *)*)
[18-05-26 17:58:07]: | ^

Steps to Reproduce

  1. Download the project min-broken.zip
  2. Attempt to compile it for the OpenPLC Runtime V3
    Optional (to see the behaviour listed above)
  3. Add a trailing whitespace
  4. Compile it
  5. Attempt to compile it again

Possible Solution (Not obligatory)

Context

I'm running a lab at our university where the students have to program in OpenPLC to control a small model plant. After adding a comment to the end of the program it no longer compiles.

Your Environment

  • Version : 4.1.4
  • Operating System and version : Arch Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions