Sublime Forum

[solved] New Syntax - highlighting function in conflict with keywords

#1

i made this with how little i understood

main:
    #- include: pawn_string
    #- include: pawn_character
    #- include: pawn_coment
    - include: pawn_function
    #- include: pawn_numbers
    - include: pawn_keywords
#
pawn_function: # function definition... start with public or stock
#
    # "\s" no work for newline, any idea?
    - match: '(public|stock)[\s]*([A-Za-z_][\w_]*)[\s]*(\()' 
      captures:
        2: entity.name.function.definition.c
        3: punctuation.definition.group.start
      push:
        - match: \)
          scope: punctuation.definition.group.end
          pop: true
#
 pawn_keywords:
    - match: \s*\b(Float|new|enum|public|forward|native|char|const|static|stock)\b
      scope: storage.type.c

but conflicts with pawn_keywords and not set storage.type.c to public/stock

0 Likes

#2

tl;dr:

  • regular expressions can only match one line at a time in syntax definitions
  • characters are consumed so that if one expression matches public or stock, the other can’t unless it uses a lookbehind (not recommended)
1 Like

#3

thanks for the info :slightly_smiling:

0 Likes