<commit_before>URI_RE = '((http:\\/\\/)?.*\\.(js|coffee))(\\?[^:]*)*'
LINE_RE = ':(\\d+)(:(\\d+))*'

spectacular.errors = {}

class spectacular.errors.GeckoParser
  match: (stack) -> /@/g.test stack
  filter: (line) -> /@/.test line
  details: (line) ->
    re = ///\s*([^\s]*)(@)#{URI_RE}#{LINE_RE}///
    [match, method, p, file, h, e, q, line, c, column] = re.exec line

    {file, line, column, method}

class spectacular.errors.V8Parser
  match: (stack) -> /\s+at\s+/g.test stack
  filter: (line) -> /\s+at\s+/.test line
  details: (line) ->
    re = ///(at\s*([^\s]*)\s*\(|\()#{URI_RE}#{LINE_RE}///
    [match, p, method, file, h, e, q, line, c, column] = re.exec line

    {file, line, column, method, params: q}

class spectacular.errors.ErrorParser
  @supportedFormats = [
    new spectacular.errors.V8Parser
    new spectacular.errors.GeckoParser
  ]<commit_msg>refactor(errors): take care of v8 errors without function name<commit_after>URI_RE = '((http:\\/\\/)?.*\\.(js|coffee))(\\?[^:]*)*'
LINE_RE = ':(\\d+)(:(\\d+))*'

spectacular.errors = {}

class spectacular.errors.GeckoParser
  match: (stack) -> /@/g.test stack
  filter: (line) -> /@/.test line
  details: (line) ->
    re = ///\s*([^\s]*)(@)#{URI_RE}#{LINE_RE}///
    [match, method, p, file, h, e, q, line, c, column] = re.exec line

    {file, line, column, method}

class spectacular.errors.V8Parser
  match: (stack) -> /\s+at\s+/g.test stack
  filter: (line) -> /\s+at\s+/.test line
  details: (line) ->
    re = ///at\s*(([^\s]*)\s*\(|\()*#{URI_RE}#{LINE_RE}///
    [match, p, method, file, h, e, q, line, c, column] = re.exec line

    {file, line, column, method, params: q}

class spectacular.errors.ErrorParser
  @supportedFormats = [
    new spectacular.errors.V8Parser
    new spectacular.errors.GeckoParser
  ]
{'fraction_non_alphanumeric': 0.2463768115942029, 'fraction_numerical': 0.002787068004459309, 'mean_word_length': 3.1075514874141876, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '3052101', 'n_tokens_mistral': 727, 'n_tokens_neox': 706, 'n_words': 156}