<commit_before>_ = require 'underscore-plus'

AllDigitsRegex = /\\\d+/g
CustomCaptureIndexRegex = /\$(\d+)|\${(\d+):\/(downcase|upcase)}/
DigitRegex = /\\\d+/

module.exports =
class Pattern
  constructor: (@grammar, @registry, options={}) ->
    {name, contentName, match, begin, end, patterns} = options
    {captures, beginCaptures, endCaptures} = options
    {@include, @popRule, @hasBackReferences} = options

    @pushRule = null
    @capture = null
    @backReferences = null
    @scopeName = name
    @contentScopeName = contentName

    if match
      if (end or @popRule) and @hasBackReferences ?= DigitRegex.test(match)
        @match = match<commit_msg>Remove unused ivar<commit_after>_ = require 'underscore-plus'

AllDigitsRegex = /\\\d+/g
CustomCaptureIndexRegex = /\$(\d+)|\${(\d+):\/(downcase|upcase)}/
DigitRegex = /\\\d+/

module.exports =
class Pattern
  constructor: (@grammar, @registry, options={}) ->
    {name, contentName, match, begin, end, patterns} = options
    {captures, beginCaptures, endCaptures} = options
    {@include, @popRule, @hasBackReferences} = options

    @pushRule = null
    @backReferences = null
    @scopeName = name
    @contentScopeName = contentName

    if match
      if (end or @popRule) and @hasBackReferences ?= DigitRegex.test(match)
        @match = match
{'fraction_non_alphanumeric': 0.1520912547528517, 'fraction_numerical': 0.0, 'mean_word_length': 3.6013986013986012, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '2837057', 'n_tokens_mistral': 442, 'n_tokens_neox': 417, 'n_words': 103}