Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PLC Structured text language support IEC61131 #3120

Closed
iAnyKey opened this issue Apr 9, 2021 · 1 comment
Closed

PLC Structured text language support IEC61131 #3120

iAnyKey opened this issue Apr 9, 2021 · 1 comment
Labels
3rd_party help welcome Could use help from community language

Comments

@iAnyKey
Copy link

iAnyKey commented Apr 9, 2021

Pleas add support of the syntax hihglighting for Structured text languages used in programmable logic controllers (PLC) as defined in IEC 61131-3 (for example CoDeSys or Siemens SCL)
s. Wikipedia Article with references for more detailed information.

They are basically wery similar to PASCAL and it is possible to use this language definition for highlighting.
But as you can see below, some specific constructions remain not parsed:

// PLC configuration
CONFIGURATION DefaultCfg
    VAR_GLOBAL
        b_Start_Stop  : BOOL;         // Global variable to represent a boolean.
        b_ON_OFF      : BOOL;         // Global variable to represent a boolean.
        Start_Stop AT %IX0.0:BOOL;    // Digital   input of the PLC (Address 0.0)
        ON_OFF     AT %QX0.0:BOOL;    // Digital output of the PLC (Address 0.0). (Coil)
    END_VAR

    // Schedule the main program to be executed every 20 ms
    TASK Tick(INTERVAL := t#20ms);

    PROGRAM Main WITH Tick : Monitor_Start_Stop;
END_CONFIGURATION

PROGRAM Monitor_Start_Stop          // Actual Program
    VAR_EXTERNAL
        Start_Stop  : BOOL;
        ON_OFF      : BOOL;
    END_VAR
    VAR                             // Temporary variables for logic handling
        ONS_Trig    : BOOL;
        Rising_ONS  : BOOL;
    END_VAR

    // Start of Logic
    // Catch the Rising Edge One Shot of the Start_Stop input
    ONS_Trig    := Start_Stop AND NOT Rising_ONS;
    
    // Main Logic for Run_Contact -- Toggle ON / Toggle OFF ---
    ON_OFF := (ONS_Trig AND NOT ON_OFF) OR (ON_OFF AND NOT ONS_Trig);

    // Rising One Shot logic   
    Rising_ONS := Start_Stop;
END_PROGRAM
@joshgoebel
Copy link
Member

joshgoebel commented Apr 9, 2021

Closing per our policy on language requests. https://highlightjs.readthedocs.io/en/latest/language-requests.html

You're welcome to add your request to the wiki (with a link to this issue), but generally nothing comes of doing so. https://github.com/highlightjs/highlight.js/wiki/Grammar-Requests

If you'd be interested in working on this yourself and contributing a 3rd party grammar we'd be happy to have it! Looks like it might be a pretty simple grammar as far as such things go.

@joshgoebel joshgoebel added 3rd_party help welcome Could use help from community language labels Apr 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3rd_party help welcome Could use help from community language
Projects
None yet
Development

No branches or pull requests

2 participants