Serhioromano / vscode-st

Extension for VS Code to support Structured Text language.
https://marketplace.visualstudio.com/items?itemName=Serhioromano.vscode-st#overview
MIT License
142 stars 28 forks source link

Wrong line comment character #52

Closed AndersHogqvist closed 1 year ago

AndersHogqvist commented 1 year ago

According to the IEC standard comments shall be surrounded by '(' and ')', this extension however uses '//' for line comments. If there are companies that deviate from the standard and actually use '//', perhaps this could be added as a configuration item?

PTKu commented 1 year ago

FYI All following is valid according to the latest:

Single line comments:

m:= 42; // comment for one line 
// a single line comment can start at
// the first character position. 

Multiline comments

(* comment *)
(***************************
 Nice frame comment
****************************)

Multi-line comment //

/* comment in one 
or more lines */

Nested comment ( .. ( .. ) ..)

(* (* NESTING *) *)

Nested comment / .. / .. / .. /

/* /* NESTING */ */

in other words:

MULTI_LINE_COMMENT 
    :   ('(*' | '/*') .*? ('*)' | '*/')
    ;

SINGLE_LINE_COMMENT
    :   '//' ~[\r\n]*
    ;
AndersHogqvist commented 1 year ago

Ok, didn't know that. We're working in OpenPCS from Kollmorgen/infoteam Software that only supports what seems like the first edition of the standard.

Since I can use comment blocks for lines as well I guess it's not worth it to add this as a configurable option. I'll close the ticket.