All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jsimpledb.cli.CommandParser Maven / Gradle / Ivy

There is a newer version: 3.6.1
Show newest version

/*
 * Copyright (C) 2015 Archie L. Cobbs. All rights reserved.
 */

package org.jsimpledb.cli;

import org.jsimpledb.parse.ParseSession;
import org.jsimpledb.parse.Parser;
import org.jsimpledb.parse.WordParser;
import org.jsimpledb.util.ParseContext;

public class CommandParser implements Parser {

    /**
     * Parse a command and return the corresponding {@link CliSession.Action}.
     */
    @Override
    public CliSession.Action parse(ParseSession parseSession, ParseContext ctx, boolean complete) {
        final CliSession session = (CliSession)parseSession;
        final String commandName = new WordParser(session.getCommands().keySet(), "command").parse(session, ctx, complete);
        return session.getCommands().get(commandName).parse(session, ctx, complete);
    }
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy