<commit_before>package org.mvel.util;

import org.mvel.*;
import static org.mvel.DataConversion.canConvert;
import static org.mvel.DataConversion.convert;
import static org.mvel.ExpressionParser.eval;
import org.mvel.integration.VariableResolverFactory;
import org.mvel.optimizers.ExecutableStatement;
import org.mvel.optimizers.impl.refl.ConstructorAccessor;
import org.mvel.optimizers.impl.refl.ReflectiveAccessor;

import static java.lang.Character.isWhitespace;
import static java.lang.Class.forName;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.*;

public class ParseTools {
    public static String[] parseMethodOrConstructor(char[] parm) {
        int start = -1;
        for (int i = 0; i < parm.length; i++) {
            if (parm[i] == '(') {
                start = ++i;
                break;
            }
        }
        if (start != -1) {
            for (int i = parm.length - 1; i > 0; i--) {
                if (parm[i] == ')') {
                    return parseParameterList(parm, start, i - start);
                }
            }
        }

        return null;
    }

    public static String[] parseParameterList(char[] parm, int offset, int length) {
        List<String> list = new LinkedList<String>();

        if (length == -1) length = parm.length;

        int adepth = 0;
        int start = offset;
        int i = offset;
        int end = i + length;

        for (; i < end; i++) {
            switch (parm[i]) {
                case'[':
                case'{':
                    if (adepth++ == 0) start = i;
                    continue;

                case']':
                case'}':
                    if (--adepth == 0) {
                        list.add(new String(parm, start, i - start + 1));

                        while (isWhitespace(parm[i])) i++;

                        start = i + 1;
                    }
                    continue;

                case'\'':
                    while (++i < end && parm[i] != '\'') {
                        if (parm[i] == '\\') handleEscapeSequence(parm[++i]);
                    }

                    if (i == end || parm[i] != '\'') {
                        throw new CompileException("unterminated literal: " + new String(parm));
                    }
                    continue;

                case'"':
                    while (++i < end && parm[i] != '"') {
                        if (parm[i] == '\\') handleEscapeSequence(parm[++i]);
                    }

                    if (i == end || parm[i] != '\'') {
                        throw new CompileException("unterminated literal: " + new String(parm));
                    }
                    continue;

                case',':
                    if (adepth != 0) continue;

                    if (i > start) {
                        while (isWhitespace(parm[start])) start++;

                        list.add(new String(parm, start, i - start));
                    }

                    while (isWhitespace(parm[i])) i++;<commit_msg>JIT Integrated<commit_after>package org.mvel.util;

import org.mvel.*;
import static org.mvel.DataConversion.canConvert;
import static org.mvel.DataConversion.convert;
import static org.mvel.ExpressionParser.eval;
import org.mvel.integration.VariableResolverFactory;
import org.mvel.optimizers.ExecutableStatement;
import org.mvel.optimizers.impl.refl.ConstructorAccessor;
import org.mvel.optimizers.impl.refl.ReflectiveAccessor;

import static java.lang.Character.isWhitespace;
import static java.lang.Class.forName;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.*;

public class ParseTools {
    public static String[] parseMethodOrConstructor(char[] parm) {
        int start = -1;
        for (int i = 0; i < parm.length; i++) {
            if (parm[i] == '(') {
                start = ++i;
                break;
            }
        }
        if (start != -1) {
            for (int i = parm.length - 1; i > 0; i--) {
                if (parm[i] == ')') {
                    return parseParameterList(parm, start, i - start);
                }
            }
        }

        return null;
    }

    public static String[] parseParameterList(char[] parm, int offset, int length) {
        List<String> list = new LinkedList<String>();

        if (length == -1) length = parm.length;

        int adepth = 0;

        int start = offset;
        int i = offset;
        int end = i + length;

        for (; i < end; i++) {
            switch (parm[i]) {
                case'[':
                case'{':
                    if (adepth++ == 0) start = i;
                    continue;

                case']':
                case'}':
                    if (--adepth == 0) {
                        list.add(new String(parm, start, i - start + 1));

                        while (isWhitespace(parm[i])) i++;

                        start = i + 1;
                    }
                    continue;

                case'\'':
                    int rStart = i;
                    while (++i < end && parm[i] != '\'') {
                        if (parm[i] == '\\') handleEscapeSequence(parm[++i]);
                    }

                    if (i == end || parm[i] != '\'') {
                        throw new CompileException("unterminated literal starting at index " + rStart + ": " + new String(parm));
                    }
                    continue;

                case'"':
                    rStart = i;
                    while (++i < end && parm[i] != '"') {
                        if (parm[i] == '\\') handleEscapeSequence(parm[++i]);
                    }

                    if (i == end || parm[i] != '\'') {
                        throw new CompileException("unterminated literal starting at index " + rStart + ": " + new String(parm));
                    }
                    continue;

                case',':
                    if (adepth != 0) continue;

                    if (i > start) {
                        while (isWhitespace(parm[start])) start++;

                        list.add(new String(parm, start, i - start));
                    }

                    while (isWhitespace(parm[i])) i++;
{'fraction_non_alphanumeric': 0.13211701793016672, 'fraction_numerical': 0.0037747719408619063, 'mean_word_length': 1.3174198250728864, 'pattern_counts': {'":': 2, '<': 15, '<?xml version=': 0, '>': 11, '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': '3822488', 'n_tokens_mistral': 1846, 'n_tokens_neox': 1711, 'n_words': 409}