Question about new language grammar


#1

Hi all,

I’m writing a grammar for a language. I’m actually almost done, but I would like to add a specific feature which I’m not sure how to do.

I would like to highlight the calls to the functions defined in the current file. For example, defining the function test() will highlight it, but I would like to use the same color for whenever I call test().

I know it’s possible as the C grammar does this but I’m having trouble understanding the C grammar file to extract that behaviour.

I’m currently matching the function definition as:

    {
    'comment':  'Function definitions (begin)'
    'match':    '^\\s*(local|global|)\\s*(function)\\s*(\\w*)'
    'captures':
        '1':
            'name':     'variable.other.svl'
        '2':
            'name':     'variable.other.svl'
        '3':
            'name':     'support.function.any-method.svl'
}

which will match:

local function test fct_arguments

Thanks!