<commit_before>package seedu.task.logic.parser;

import static seedu.task.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
import static seedu.task.commons.core.Messages.MESSAGE_UNKNOWN_COMMAND;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import seedu.task.logic.commands.AddCommand;
import seedu.task.logic.commands.ClearCommand;
import seedu.task.logic.commands.Command;
import seedu.task.logic.commands.DeleteCommand;
import seedu.task.logic.commands.DoneCommand;
import seedu.task.logic.commands.EditCommand;
import seedu.task.logic.commands.ExitCommand;
import seedu.task.logic.commands.FindCommand;
import seedu.task.logic.commands.HelpCommand;
import seedu.task.logic.commands.IncorrectCommand;
import seedu.task.logic.commands.ListCommand;
import seedu.task.logic.commands.SelectCommand;
import seedu.task.logic.commands.SortCommand;
import seedu.task.logic.commands.UndoCommand;
import seedu.task.logic.commands.PathCommand;

/**
 * Parses user input.
 */
public class Parser {

    /**
     * Used for initial separation of command word and arguments.
     */
    private static final Pattern BASIC_COMMAND_FORMAT = Pattern.compile("(?<commandWord>\\S+)(?<arguments>.*)");

    /**
     * Parses user input into command for execution.
     *
     * @param userInput
     *            full user input string
     * @return the command based on the user input
     */
    public Command parseCommand(String userInput) {
	final Matcher matcher = BASIC_COMMAND_FORMAT.matcher(userInput.trim());
	if (!matcher.matches()) {
	    return new IncorrectCommand(String.format(MESSAGE_INVALID_COMMAND_FORMAT, HelpCommand.MESSAGE_USAGE));
	}

	final String commandWord = matcher.group("commandWord");
	final String arguments = matcher.group("arguments");
	switch (commandWord) {

	case AddCommand.COMMAND_WORD:
	    return new AddCommandParser().parse(arguments);

	case EditCommand.COMMAND_WORD:
	    return new EditCommandParser().parse(arguments);

	case SelectCommand.COMMAND_WORD:
	    return new SelectCommandParser().parse(arguments);

	case DeleteCommand.COMMAND_WORD:
	    return new DeleteCommandParser().parse(arguments);
	 
	case DoneCommand.COMMAND_WORD:
	    return new DoneCommandParser().parse(arguments);

	case ClearCommand.COMMAND_WORD:
	    return new ClearCommand();

	case FindCommand.COMMAND_WORD:
	    return new FindCommandParser().parse(arguments);

	case ListCommand.COMMAND_WORD:
	    return new ListCommand();

	case ExitCommand.COMMAND_WORD:
	    return new ExitCommand();

	case HelpCommand.COMMAND_WORD:
	    return new HelpCommand();
	
	case UndoCommand.COMMAND_WORD:
		return new UndoCommand();
		<commit_msg>Update Parser.java<commit_after>package seedu.task.logic.parser;

import static seedu.task.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
import static seedu.task.commons.core.Messages.MESSAGE_UNKNOWN_COMMAND;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import seedu.task.logic.commands.AddCommand;
import seedu.task.logic.commands.ClearCommand;
import seedu.task.logic.commands.Command;
import seedu.task.logic.commands.DeleteCommand;
import seedu.task.logic.commands.DoneCommand;
import seedu.task.logic.commands.EditCommand;
import seedu.task.logic.commands.ExitCommand;
import seedu.task.logic.commands.FindCommand;
import seedu.task.logic.commands.HelpCommand;
import seedu.task.logic.commands.IncorrectCommand;
import seedu.task.logic.commands.ListCommand;
import seedu.task.logic.commands.SelectCommand;
import seedu.task.logic.commands.SortCommand;
import seedu.task.logic.commands.UndoCommand;
import seedu.task.logic.commands.PathCommand;

/**
 * Parses user input.
 */
public class Parser {

    /**
     * Used for initial separation of command word and arguments.
     */
    private static final Pattern BASIC_COMMAND_FORMAT = Pattern.compile("(?<commandWord>\\S+)(?<arguments>.*)");

    /**
     * Parses user input into command for execution.
     *
     * @param userInput
     *            full user input string
     * @return the command based on the user input
     */
    public Command parseCommand(String userInput) {
	final Matcher matcher = BASIC_COMMAND_FORMAT.matcher(userInput.trim());
	if (!matcher.matches()) {
	    return new IncorrectCommand(String.format(MESSAGE_INVALID_COMMAND_FORMAT, HelpCommand.MESSAGE_USAGE));
	}

	final String commandWord = matcher.group("commandWord");
	final String arguments = matcher.group("arguments");
	switch (commandWord) {

	case AddCommand.COMMAND_WORD:
	    return new AddCommandParser().parse(arguments);

	case EditCommand.COMMAND_WORD:
	    return new EditCommandParser().parse(arguments);

	case SelectCommand.COMMAND_WORD:
	    return new SelectCommandParser().parse(arguments);
//@@author A0146757R
	case DeleteCommand.COMMAND_WORD:
	    return new DeleteCommandParser().parse(arguments);
//@@author	 
	case DoneCommand.COMMAND_WORD:
	    return new DoneCommandParser().parse(arguments);

	case ClearCommand.COMMAND_WORD:
	    return new ClearCommand();

	case FindCommand.COMMAND_WORD:
	    return new FindCommandParser().parse(arguments);

	case ListCommand.COMMAND_WORD:
	    return new ListCommand();

	case ExitCommand.COMMAND_WORD:
	    return new ExitCommand();

	case HelpCommand.COMMAND_WORD:
	    return new HelpCommand();
	
	case UndoCommand.COMMAND_WORD:
		return new UndoCommand();
		
{'fraction_non_alphanumeric': 0.10188116967777985, 'fraction_numerical': 0.001303780964797914, 'mean_word_length': 4.7006369426751595, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '4817150', 'n_tokens_mistral': 1610, 'n_tokens_neox': 1542, 'n_words': 330}