<commit_before>
package main

import (
  "fmt"
  "os"
  "flag"
  "regexp"
)

var (
  help *bool = flag.Bool("h", false, "to show help")
  mode *bool = flag.Bool("m", false, "to run in std mode")
  sub *bool = flag.Bool("sub", false, "care about submatches?")
  runs *int = flag.Int("runs", 100000, "number of runs to do")
  re *string = flag.String("re", "(a|(b))+", "regexp to build")
  s *string = flag.String("s", "aba", "string to match")
)

func main() {
  flag.Parse()
  if *help {
    flag.PrintDefaults()
    return
  }

  if !*mode {
    // use new regexp impl
    r := Parse(*re)

    for i := 0; i < len(r.prog); i++ {
      fmt.Fprintln(os.Stderr, i, r.prog[i].str())
    }

    result := false
    var alt []int
    for i := 0; i < *runs; i++ {
      if *sub {
        result, alt = r.RunSubMatch(*s)
      } else {
        result = r.RunSimple(*s)
      }
    }

    fmt.Fprintln(os.Stderr, "new result", result, "alt", alt)
  } else {
    if !*sub {
      panic("unsupported")
    }

    // use old regexp impl
    r := regexp.MustCompile(*re)
    var result []int
    for i := 0; i < *runs; i++ {
      result = r.ExecuteString(*s)
    }
    success := (len(result) != 0)
    fmt.Fprintln(os.Stderr, "std result", success, "alt", result)
  }
}<commit_msg>output to stdout, not stderr<commit_after>
package main

import (
  "fmt"
  "os"
  "flag"
  "regexp"
)

var (
  help *bool = flag.Bool("h", false, "to show help")
  mode *bool = flag.Bool("m", false, "to run in std mode")
  sub *bool = flag.Bool("sub", false, "care about submatches?")
  runs *int = flag.Int("runs", 100000, "number of runs to do")
  re *string = flag.String("re", "(a|(b))+", "regexp to build")
  s *string = flag.String("s", "aba", "string to match")
)

func main() {
  flag.Parse()
  if *help {
    flag.PrintDefaults()
    return
  }

  if !*mode {
    // use new regexp impl
    r := Parse(*re)

    for i := 0; i < len(r.prog); i++ {
      fmt.Fprintln(os.Stderr, i, r.prog[i].str())
    }

    result := false
    var alt []int
    for i := 0; i < *runs; i++ {
      if *sub {
        result, alt = r.RunSubMatch(*s)
      } else {
        result = r.RunSimple(*s)
      }
    }

    fmt.Fprintln(os.Stdout, "new result", result, "alt", alt)
  } else {
    if !*sub {
      panic("unsupported")
    }

    // use old regexp impl
    r := regexp.MustCompile(*re)
    var result []int
    for i := 0; i < *runs; i++ {
      result = r.ExecuteString(*s)
    }
    success := (len(result) != 0)
    fmt.Fprintln(os.Stdout, "std result", success, "alt", result)
  }
}
{'fraction_non_alphanumeric': 0.18576456785295267, 'fraction_numerical': 0.007821666014861166, 'mean_word_length': 2.379128137384412, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, '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': '1898489', 'n_tokens_mistral': 1006, 'n_tokens_neox': 968, 'n_words': 272}