<commit_before>%YAML 1.2
---
# http://www.sublimetext.com/docs/3/syntax.html
name: GDScript (Godot Engine)
file_extensions:
  - gd
scope: source.gdscript

variables:
  # todo: single underscore isn't allowed as var name (Godot bug?)
  identifier: \b[a-zA-Z_][a-zA-Z_0-9]*\b

contexts:
  prototype:
    - include: comments
    - include: line-continuation
  main:
    - match: ^(""")
      captures:
        1: punctuation.definition.comment.triple-quote.gdscript
      push:
        - meta_scope: comment.block.triple-quote
        - match: (""")
          captures:
            1: punctuation.definition.comment.triple-quote.gdscript
          pop: true
    - include: strings
    - match: '"""'
      push:
        - meta_scope: string.quoted.triple.gdscript
        - match: (?<!\\)"""
          pop: true
    - match: '@"'
      push:
        - meta_scope: string.quoted.double.node-path.gdscript
        - match: (?<!\\)"
          pop: true
    - match: \b(?i:0x\h*)\b
      scope: constant.numeric.integer.hexadecimal.gdscript
    - match: '\b(?i:(\d+\.\d*(e[\-\+]?\d+)?))\b'
      scope: constant.numeric.float.gdscript
    - match: '\b(?i:(\.\d+(e[\-\+]?\d+)?))\b'
      scope: constant.numeric.float.gdscript
    - match: '\b(?i:(\d+e[\-\+]?\d+))\b'
      scope: constant.numeric.float.gdscript
    - match: \b\d+\b
      scope: constant.numeric.integer.gdscript
    - match: \b(?i:elif|else|for|if|while|break|continue|pass|return)\b
      scope: keyword.control.flow.gdscript
    - match: \b(?i:&&|and|in|is|!|not|\|\||or)\b
      scope: keyword.operator.logical.gdscript
    - match: <=|>=|==|<|>|!=
      scope: keyword.operator.comparison.gdscript
    - match: \+=|-=|\*=|/=|%=|&=|\|=|\*|/|%|\+|-|<<|>>|&|\||\^|~
      scope: keyword.operator.arithmetic.gdscript
    - match: "="
      scope: keyword.operator.assignment.gdscript

    - include: builtin-types
    
    - match: '^\s*(?i:(class))\s+({{identifier}})\s*:'
      captures:
        1: storage.type.class.gdscript
        2: entity.name.type.class.gdscript

    - include: functions
    - include: signals

    - match: '(?i:\b(?:(onready)\s+)?(var))\s+({{identifier}})'
      captures:
        1: keyword.other.onready.gdscript
        2: storage.type.var.gdscript
        3: variable.other.gdscript
    - match: '\b(?i:(const))\s+({{identifier}})'
      captures:
        1: storage.type.const.gdscript
        2: variable.other.gdscript
    - match: '\b(?i:(enum))\s+({{identifier}})'
      captures:
        1: storage.type.enum.gdscript
        2: variable.other.gdscript
    - match: \b(?i:extends|assert|breakpoint)\b
      scope: keyword.other.gdscript
    - match: '(?<=extends)\s+{{identifier}}(\.({{identifier}}))?'
      scope: entity.other.inherited-class.gdscript
    - match: \b(?i:true|false|null)\b
      scope: constant.language.gdscript
    - match: \b(?i:export|tool)\b
      scope: storage.modifier.static.gdscript
    - match: '\b((?i:setget))\b\s+(?:,?({{identifier}})|({{identifier}})\s*,\s*({{identifier}}))'
      captures:
        1: keyword.operator.setget.gdscript
        2: entity.name.function.gdscript
        3: entity.name.function.gdscript
        4: entity.name.function.gdscript
    - match: \b(?i:yield)\b
      scope: keyword.control.flow.yield.gdscript
    - match: \b(?i:var|const|onready|enum|class|func|signal)\b
      scope: invalid.illegal
    - match: "([A-Z][a-zA-Z_0-9]*)"
      scope: entity.name.type.class-type.gdscript
    - match: "([a-z_][a-zA-Z_0-9]*)"
      scope: entity.name.type.variant.gdscript
    - match: '([a-z][a-zA-Z_0-9]*)\s*\('
      captures:
        1: entity.name.function.reference.gdscript
      push:
        - match: \)
          pop: true<commit_msg>Don't call things variant by default<commit_after>%YAML 1.2
---
# http://www.sublimetext.com/docs/3/syntax.html
name: GDScript (Godot Engine)
file_extensions:
  - gd
scope: source.gdscript

variables:
  # todo: single underscore isn't allowed as var name (Godot bug?)
  identifier: \b[a-zA-Z_][a-zA-Z_0-9]*\b

contexts:
  prototype:
    - include: comments
    - include: line-continuation
  main:
    - match: ^(""")
      captures:
        1: punctuation.definition.comment.triple-quote.gdscript
      push:
        - meta_scope: comment.block.triple-quote
        - match: (""")
          captures:
            1: punctuation.definition.comment.triple-quote.gdscript
          pop: true
    - include: strings
    - match: '"""'
      push:
        - meta_scope: string.quoted.triple.gdscript
        - match: (?<!\\)"""
          pop: true
    - match: '@"'
      push:
        - meta_scope: string.quoted.double.node-path.gdscript
        - match: (?<!\\)"
          pop: true
    - match: \b(?i:0x\h*)\b
      scope: constant.numeric.integer.hexadecimal.gdscript
    - match: '\b(?i:(\d+\.\d*(e[\-\+]?\d+)?))\b'
      scope: constant.numeric.float.gdscript
    - match: '\b(?i:(\.\d+(e[\-\+]?\d+)?))\b'
      scope: constant.numeric.float.gdscript
    - match: '\b(?i:(\d+e[\-\+]?\d+))\b'
      scope: constant.numeric.float.gdscript
    - match: \b\d+\b
      scope: constant.numeric.integer.gdscript
    - match: \b(?i:elif|else|for|if|while|break|continue|pass|return)\b
      scope: keyword.control.flow.gdscript
    - match: \b(?i:&&|and|in|is|!|not|\|\||or)\b
      scope: keyword.operator.logical.gdscript
    - match: <=|>=|==|<|>|!=
      scope: keyword.operator.comparison.gdscript
    - match: \+=|-=|\*=|/=|%=|&=|\|=|\*|/|%|\+|-|<<|>>|&|\||\^|~
      scope: keyword.operator.arithmetic.gdscript
    - match: "="
      scope: keyword.operator.assignment.gdscript

    - include: builtin-types
    
    - match: '^\s*(?i:(class))\s+({{identifier}})\s*:'
      captures:
        1: storage.type.class.gdscript
        2: entity.name.type.class.gdscript

    - include: functions
    - include: signals

    - match: '(?i:\b(?:(onready)\s+)?(var))\s+({{identifier}})'
      captures:
        1: keyword.other.onready.gdscript
        2: storage.type.var.gdscript
        3: variable.other.gdscript
    - match: '\b(?i:(const))\s+({{identifier}})'
      captures:
        1: storage.type.const.gdscript
        2: variable.other.gdscript
    - match: '\b(?i:(enum))\s+({{identifier}})'
      captures:
        1: storage.type.enum.gdscript
        2: variable.other.gdscript
    - match: \b(?i:extends|assert|breakpoint)\b
      scope: keyword.other.gdscript
    - match: '(?<=extends)\s+{{identifier}}(\.({{identifier}}))?'
      scope: entity.other.inherited-class.gdscript
    - match: \b(?i:true|false|null)\b
      scope: constant.language.gdscript
    - match: \b(?i:export|tool)\b
      scope: storage.modifier.static.gdscript
    - match: '\b((?i:setget))\b\s+(?:,?({{identifier}})|({{identifier}})\s*,\s*({{identifier}}))'
      captures:
        1: keyword.operator.setget.gdscript
        2: entity.name.function.gdscript
        3: entity.name.function.gdscript
        4: entity.name.function.gdscript
    - match: \b(?i:yield)\b
      scope: keyword.control.flow.yield.gdscript
    - match: \b(?i:var|const|onready|enum|class|func|signal)\b
      scope: invalid.illegal
    - match: "([A-Z][a-zA-Z_0-9]*)"
      scope: entity.name.type.class-type.gdscript
    - match: '([a-z][a-zA-Z_0-9]*)\s*\('
      captures:
        1: entity.name.function.reference.gdscript
      push:
        - match: \)
          pop: true
{'fraction_non_alphanumeric': 0.204356705241661, 'fraction_numerical': 0.007351940095302927, 'mean_word_length': 2.432710280373832, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '775681', 'n_tokens_mistral': 2737, 'n_tokens_neox': 2624, 'n_words': 370}