<commit_before>package com.squarespace.template;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import com.squarespace.template.Instructions.AlternatesWithInst;
import com.squarespace.template.Instructions.CommentInst;
import com.squarespace.template.Instructions.EndInst;
import com.squarespace.template.Instructions.EofInst;
import com.squarespace.template.Instructions.IfInst;
import com.squarespace.template.Instructions.IfPredicateInst;
import com.squarespace.template.Instructions.MetaInst;
import com.squarespace.template.Instructions.NewlineInst;
import com.squarespace.template.Instructions.PredicateInst;
import com.squarespace.template.Instructions.RepeatedInst;
import com.squarespace.template.Instructions.RootInst;
import com.squarespace.template.Instructions.SectionInst;
import com.squarespace.template.Instructions.SpaceInst;
import com.squarespace.template.Instructions.TabInst;
import com.squarespace.template.Instructions.TextInst;
import com.squarespace.template.Instructions.VariableInst;


/**
 * CodeMaker makes creating instances of instructions less verbose. Also useful
 * to shorten a lot of boilerplate in test cases.
 */
public class CodeMaker {

  public AlternatesWithInst alternates() {
    return new AlternatesWithInst();
  }
  
  public Arguments args() {
    return new Arguments();
  }
  
  public Arguments args(String args) {
    return new Arguments(view(args));
  }
  
  public StringBuilder buf() {
    return new StringBuilder();
  }

  public CommentInst comment(StringView view) {
    return new CommentInst(view);
  }
  
  public CommentInst comment(String str) {
    return new CommentInst(new StringView(str));
  }
  
  public CommentInst comment(String str, int start, int end) {
    return new CommentInst(new StringView(str, start, end));
  }

  public CommentInst mcomment(StringView view) {
    return new CommentInst(view, true);
  }
  
  public CommentInst mcomment(String str) {
    return new CommentInst(new StringView(str), true);
  }
  
  public CommentInst mcomment(String str, int start, int end) {
    return new CommentInst(new StringView(str, start, end), true);
  }
  
  public EndInst end() {
    return new EndInst();
  }
  
  public EofInst eof() {
    return new EofInst();
  }

  public FormatterCall fmt(Formatter formatter) {
    return fmt(formatter, Constants.EMPTY_ARGUMENTS);
  }
  
  public FormatterCall fmt(Formatter formatter, Arguments args) {
    return new FormatterCall(formatter, args);
  }
  
  public List<FormatterCall> formatters(Formatter ... formatters) {
    List<FormatterCall> list = new ArrayList<>(formatters.length);
    for (Formatter impl : formatters) {
      list.add(new FormatterCall(impl, Constants.EMPTY_ARGUMENTS));
    }
    return list;
  }

  public List<FormatterCall> formatters(FormatterCall ... formatters) {
    return Arrays.asList(formatters);
  }

  /**
   * Yeah, "ifn" represents an IF instruction, since "if" cannot be a method name.
   */
  public IfInst ifexpn(List<String> vars, List<Operator> ops) {
    return new IfInst(vars, ops);
  }

  public IfPredicateInst ifpred(Predicate predicate) {<commit_msg>[template] Removed old comment.<commit_after>package com.squarespace.template;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import com.squarespace.template.Instructions.AlternatesWithInst;
import com.squarespace.template.Instructions.CommentInst;
import com.squarespace.template.Instructions.EndInst;
import com.squarespace.template.Instructions.EofInst;
import com.squarespace.template.Instructions.IfInst;
import com.squarespace.template.Instructions.IfPredicateInst;
import com.squarespace.template.Instructions.MetaInst;
import com.squarespace.template.Instructions.NewlineInst;
import com.squarespace.template.Instructions.PredicateInst;
import com.squarespace.template.Instructions.RepeatedInst;
import com.squarespace.template.Instructions.RootInst;
import com.squarespace.template.Instructions.SectionInst;
import com.squarespace.template.Instructions.SpaceInst;
import com.squarespace.template.Instructions.TabInst;
import com.squarespace.template.Instructions.TextInst;
import com.squarespace.template.Instructions.VariableInst;


/**
 * CodeMaker makes creating instances of instructions less verbose. Also useful
 * to shorten a lot of boilerplate in test cases.
 */
public class CodeMaker {

  public AlternatesWithInst alternates() {
    return new AlternatesWithInst();
  }
  
  public Arguments args() {
    return new Arguments();
  }
  
  public Arguments args(String args) {
    return new Arguments(view(args));
  }
  
  public StringBuilder buf() {
    return new StringBuilder();
  }

  public CommentInst comment(StringView view) {
    return new CommentInst(view);
  }
  
  public CommentInst comment(String str) {
    return new CommentInst(new StringView(str));
  }
  
  public CommentInst comment(String str, int start, int end) {
    return new CommentInst(new StringView(str, start, end));
  }

  public CommentInst mcomment(StringView view) {
    return new CommentInst(view, true);
  }
  
  public CommentInst mcomment(String str) {
    return new CommentInst(new StringView(str), true);
  }
  
  public CommentInst mcomment(String str, int start, int end) {
    return new CommentInst(new StringView(str, start, end), true);
  }
  
  public EndInst end() {
    return new EndInst();
  }
  
  public EofInst eof() {
    return new EofInst();
  }

  public FormatterCall fmt(Formatter formatter) {
    return fmt(formatter, Constants.EMPTY_ARGUMENTS);
  }
  
  public FormatterCall fmt(Formatter formatter, Arguments args) {
    return new FormatterCall(formatter, args);
  }
  
  public List<FormatterCall> formatters(Formatter ... formatters) {
    List<FormatterCall> list = new ArrayList<>(formatters.length);
    for (Formatter impl : formatters) {
      list.add(new FormatterCall(impl, Constants.EMPTY_ARGUMENTS));
    }
    return list;
  }

  public List<FormatterCall> formatters(FormatterCall ... formatters) {
    return Arrays.asList(formatters);
  }

  public IfInst ifexpn(List<String> vars, List<Operator> ops) {
    return new IfInst(vars, ops);
  }

  public IfPredicateInst ifpred(Predicate predicate) {
{'fraction_non_alphanumeric': 0.09513239257967337, 'fraction_numerical': 0.0, 'mean_word_length': 4.543057996485062, 'pattern_counts': {'":': 0, '<': 15, '<?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': '251328', 'n_tokens_mistral': 1921, 'n_tokens_neox': 1895, 'n_words': 449}