Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.maddyhome.idea.vim.ex
Class CommandParser  view CommandParser download CommandParser.java

java.lang.Object
  extended bycom.maddyhome.idea.vim.ex.CommandParser

public class CommandParser
extends java.lang.Object

Maintains a tree of Ex commands based on the required and optional parts of the command names. Parses and executes Ex commands entered by the user.


Field Summary
private static Logger logger
           
private static CommandParser ourInstance
           
private  CommandNode root
           
private static int STATE_CMD_ARG
           
private static int STATE_COMMAND
           
private static int STATE_ERROR
           
private static int STATE_RANGE
           
private static int STATE_RANGE_ALL
           
private static int STATE_RANGE_CURRENT
           
private static int STATE_RANGE_DONE
           
private static int STATE_RANGE_LAST
           
private static int STATE_RANGE_LINE
           
private static int STATE_RANGE_MARK
           
private static int STATE_RANGE_MARK_CHAR
           
private static int STATE_RANGE_MAYBE_DONE
           
private static int STATE_RANGE_OFFSET
           
private static int STATE_RANGE_OFFSET_DONE
           
private static int STATE_RANGE_OFFSET_MAYBE_DONE
           
private static int STATE_RANGE_OFFSET_NUM
           
private static int STATE_RANGE_PATTERN
           
private static int STATE_RANGE_PATTERN_MAYBE_DONE
           
private static int STATE_RANGE_SEPARATOR
           
private static int STATE_RANGE_SHORT_PATTERN
           
private static int STATE_START
           
 
Constructor Summary
private CommandParser()
          Don't let anyone create one of these.
 
Method Summary
 void addHandler(CommandHandler handler)
          Adds a command handler to the parser
static CommandParser getInstance()
          There is only one parser.
 ParseResult parse(java.lang.String cmd)
          Parse the text entered by the user.
 void processCommand(Editor editor, DataContext context, java.lang.String cmd, int count)
          Parse and execute an Ex command entered by the user
 boolean processLastCommand(Editor editor, DataContext context, int count)
          Used to rerun the last Ex command, if any
 void registerHandlers()
          Registers all the supported Ex commands
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

root

private CommandNode root

ourInstance

private static CommandParser ourInstance

STATE_START

private static final int STATE_START
See Also:
Constant Field Values

STATE_COMMAND

private static final int STATE_COMMAND
See Also:
Constant Field Values

STATE_CMD_ARG

private static final int STATE_CMD_ARG
See Also:
Constant Field Values

STATE_RANGE

private static final int STATE_RANGE
See Also:
Constant Field Values

STATE_RANGE_LINE

private static final int STATE_RANGE_LINE
See Also:
Constant Field Values

STATE_RANGE_CURRENT

private static final int STATE_RANGE_CURRENT
See Also:
Constant Field Values

STATE_RANGE_LAST

private static final int STATE_RANGE_LAST
See Also:
Constant Field Values

STATE_RANGE_MARK

private static final int STATE_RANGE_MARK
See Also:
Constant Field Values

STATE_RANGE_MARK_CHAR

private static final int STATE_RANGE_MARK_CHAR
See Also:
Constant Field Values

STATE_RANGE_ALL

private static final int STATE_RANGE_ALL
See Also:
Constant Field Values

STATE_RANGE_PATTERN

private static final int STATE_RANGE_PATTERN
See Also:
Constant Field Values

STATE_RANGE_SHORT_PATTERN

private static final int STATE_RANGE_SHORT_PATTERN
See Also:
Constant Field Values

STATE_RANGE_PATTERN_MAYBE_DONE

private static final int STATE_RANGE_PATTERN_MAYBE_DONE
See Also:
Constant Field Values

STATE_RANGE_OFFSET

private static final int STATE_RANGE_OFFSET
See Also:
Constant Field Values

STATE_RANGE_OFFSET_NUM

private static final int STATE_RANGE_OFFSET_NUM
See Also:
Constant Field Values

STATE_RANGE_OFFSET_DONE

private static final int STATE_RANGE_OFFSET_DONE
See Also:
Constant Field Values

STATE_RANGE_OFFSET_MAYBE_DONE

private static final int STATE_RANGE_OFFSET_MAYBE_DONE
See Also:
Constant Field Values

STATE_RANGE_SEPARATOR

private static final int STATE_RANGE_SEPARATOR
See Also:
Constant Field Values

STATE_RANGE_MAYBE_DONE

private static final int STATE_RANGE_MAYBE_DONE
See Also:
Constant Field Values

STATE_RANGE_DONE

private static final int STATE_RANGE_DONE
See Also:
Constant Field Values

STATE_ERROR

private static final int STATE_ERROR
See Also:
Constant Field Values

logger

private static Logger logger
Constructor Detail

CommandParser

private CommandParser()
Don't let anyone create one of these.

Method Detail

getInstance

public static CommandParser getInstance()
There is only one parser.


registerHandlers

public void registerHandlers()
Registers all the supported Ex commands


processLastCommand

public boolean processLastCommand(Editor editor,
                                  DataContext context,
                                  int count)
                           throws ExException
Used to rerun the last Ex command, if any


processCommand

public void processCommand(Editor editor,
                           DataContext context,
                           java.lang.String cmd,
                           int count)
                    throws ExException
Parse and execute an Ex command entered by the user


parse

public ParseResult parse(java.lang.String cmd)
                  throws ExException
Parse the text entered by the user. This does not include the leading colon.


addHandler

public void addHandler(CommandHandler handler)
Adds a command handler to the parser