Home Download Buy Blog Forum Support

SourcePawn Symbol List Possible?

SourcePawn Symbol List Possible?

Postby Snaph on Sun Feb 03, 2013 8:31 pm

I want to create a tmLanguage file that will capture functions in SourcePawn files and add them to the symbol list.

The problem I'm having is that Pawn has no keyword to denote a function definition and semicolons are optional. Therefore I can't seem to find a way to match function definitions using the single-line regex that Sublime uses and I can't figure out how to make a begin/end work.

Take this code for example (formatting purposely inconsistent):

Code: Select all
1. public Action:RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
2. {
3.     CheckWinCondition(true);
4. }
6. CheckWinCondition(bool:round_end = false)
7. {
8.     // ...
9.     if (!round_end)
10.     {
11.         SetVariantInt(TEAM_BLU)
12.         AcceptEntityInput(master_cp, "SetWinner")
13.     }
14. }
16. StartBeacon(client) {
17.     // ...
18. }

Using this begin/end

Code: Select all

doesn't work because it also captures function calls and consumes everything between the function call and the next '{'. So, it will capture everything between lines 3 and 7 and lines 11 and 16.

Is there any way to make this work? I'm currently generating completions using a plugin, but there is no API to allow a plugin to populate the symbol list so there is no way to easily navigate to function definitions.
Posts: 2
Joined: Sun Feb 03, 2013 7:57 pm

Return to General Discussion

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 18 guests