boschresearch/blech

syntax highlighting for external variables and functions

mterber opened this issue · 0 comments

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.