[syntax] How to match block when the C preprocessor is unbalancing brackets?
This is my syntax: https://github.com/evandrocoan/SublimeAmxxPawn/blob/d69028089ce379aea51a520e74eb5a54b518bc03/AmxxPawn.sublime-syntax#L204-L216
It is working fine, if the C preprocessor do not mess with it. Example, this will unbalance the brackets, from the line 359 up it will show one extra scope meta.block
which does not popped, as on the preprocessor define
there is one opening unclosed bracket at the line 352.
337: public own_type:on_damage( id )
338: {
339: new attacker = own_type: get_user_attacker( id )
340:
341: #if defined DAMAGE_RECIEVED
342: // id should be connected if this message is sent, but lets check anyway
343: if( is_user_connected( id )
344: && is_user_connected( attacker ) )
345: if( get_user_flags( attacker ) & ADMIN_LEVEL_H )
346: {
347: new damage = read_data( 2 )
348: ShowSyncHudMsg( id, g_MsgSync2, "%i^n", damage )
349: #else
350: if( is_user_connected( attacker )
351: && ( get_user_flags( attacker ) & ADMIN_LEVEL_H ) )
352: {
353: new damage = read_data( 2 )
354: #endif
355: ShowSyncHudMsg( attacker, g_MsgSync, "%i^n", damage )
356: }
357: hi_girl()
358: }
359:
360: public on_damage( id )
361: {
362: get_user_attacker( id )
363: }
How to drop the scope for the unclosed bracket?
I am capturing blocks like this:
# "PAWN Function"
pawn_function:
- include: function_definition
- match: '{'
scope: keyword.brackets.AmxxPawn
push:
- meta_scope: meta.block.AmxxPawn
- include: function_call
- match: '}'
scope: keyword.brackets.AmxxPawn
pop: true
- include: pawn_function
- include: pawn_function_includes