boschresearch / blech

Blech is a language for developing reactive, real-time critical embedded software.
Apache License 2.0
72 stars 5 forks source link

syntax highlighting for external variables and functions #8

Open mterber opened 4 years ago

mterber commented 4 years ago

Is your feature request related to a problem? Please describe. As already discussed here it might be useful for the Blech user to provide a special syntax highlighting for external function calls and variables.

Describe the solution you'd like Example:

@[CFunction(binding = "SPI_beginTransfer", header = "bind/rf.h")]
extern singleton function SPI_beginTransfer ()
@[CFunction(binding = "SPI_endTransfer", header = "bind/rf.h")]
extern singleton function SPI_endTransfer ()

activity RF_sendCmdWord (cmd: uint8, dataTx: [SPI_TX_BUF]uint8, len: uint8)(dataRx: [SPI_TX_BUF]uint8) returns int8
    SPI_beginTransfer() // external function call

    var res: int8

    // Send command.
    var tmp: [SPI_TX_BUF]uint8 = {cmd}
    res = run SPI_txRxBytes(tmp, 1)(dataRx)

    if res == 0 then
        // Send data.
        res = run SPI_txRxBytes(dataTx, len)(dataRx)
    end

    SPI_endTransfer() // external function call

    return res
end

Calls to SPI_beginTransfer() and SPI_endTransfer() could be highlighted in italic font for instance.