<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace SQMReorderer.SqmParser
{
    public class ParsingHelperFunctions
    {
        private readonly Regex startBracketRegex = new Regex(@"\s*\{\s*", RegexOptions.Compiled);
        private readonly Regex endBracketRegex = new Regex(@"\s*\}\s*", RegexOptions.Compiled);

        public BracketPositionResult GetNextBracketsPositions(string[] inputText, int currentPosition)
        {
            var result = new BracketPositionResult();
            result.Success = false;

            for (int position = currentPosition; position < inputText.Count(); position++)
            {
                var currentLine = inputText[position];

                var startBracketMatch = startBracketRegex.Match(currentLine);

                if(startBracketMatch.Success)
                {
                    result.StartBracketPosition = position;
                }

                var endBracketMatch = endBracketRegex.Match(currentLine);

                if (endBracketMatch.Success)
                {
                    result.EndBracketPosition = position;

                    result.Success = true;
                }
            }

            return result;
        }
    }<commit_msg>Small changes that did not come in previous commit.<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace SQMReorderer.SqmParser
{
    public class ParsingHelperFunctions
    {
        private readonly Regex startBracketRegex = new Regex(@"\s*\{\s*", RegexOptions.Compiled);
        private readonly Regex endBracketRegex = new Regex(@"\s*\}\s*", RegexOptions.Compiled);

        public BracketPositionResult GetNextBracketsPositions(string[] inputText, int currentPosition)
        {
            var result = new BracketPositionResult();
            result.Success = false;

            var foundStartBracket = false;

            for (int position = currentPosition; position < inputText.Count(); position++)
            {
                var currentLine = inputText[position];

                var startBracketMatch = startBracketRegex.Match(currentLine);

                if(startBracketMatch.Success)
                {
                    result.StartBracketPosition = position;

                    foundStartBracket = true;
                }

                var endBracketMatch = endBracketRegex.Match(currentLine);

                if (endBracketMatch.Success)
                {
                    if(foundStartBracket)
                    {
                        result.EndBracketPosition = position;

                        result.Success = true;

                        return result;
                    }
                }
            }

            return result;
        }
    }
{'fraction_non_alphanumeric': 0.07863247863247863, 'fraction_numerical': 0.0, 'mean_word_length': 1.7840152235965747, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2891685', 'n_tokens_mistral': 738, 'n_tokens_neox': 686, 'n_words': 152}