## sidekick
Class SideKickParser

    java.lang.Object
      sidekick.SideKickParser

Direct Known Subclasses:
  SourceParser

public abstract class SideKickParser
extends Object

An abstract base class for plugin-provided parser implementations.

Plugins can provide SideKick parsers by defining entries in their `services.xml` files like so:

    <SERVICE CLASS="sidekick.SideKickParser" NAME="name">
        new MyParser();
    </SERVICE>

See `org.gjt.sp.jedit.ServiceManager` for details.

Note that each `SideKickParser` subclass has a name which is used to key a property `sidekick.parser.name.label`.

To associate a parser with some edit modes, define properties like this:

    mode.scheme.sidekick.parser=lisp
    mode.lisp.sidekick.parser=lisp

Version:
  $Id: SideKickParser.java,v 1.20 2006/06/05 06:10:38 ezust Exp $
Author:
  Slava Pestov

Field Summary
`protected String` `name`
`static String` `SERVICE`

Constructor Summary
`SideKickParser(String name)` The parser constructor.

Method Summary
`void` `activate(EditPane editPane)` This method is called when a buffer using this parser is selected in the specified view.
`void` `activate(View view)` Deprecated. Use the form taking an `EditPane` instead.
`boolean` `canCompleteAnywhere()` Returns if completion popups should be shown after any period of inactivity.
`boolean` `canHandleBackspace()` Returns true if the parser can handle the backspace key being typed when the completion popup is open, else false if not.
`SideKickCompletion` `complete(EditPane editPane, int caret)` Returns completions suitable for insertion at the specified position.
`void` `deactivate(EditPane editPane)` This method is called when a buffer using this parser is no longer selected in the specified view.
`void` `deactivate(View view)` Deprecated. Use the form taking an `EditPane` instead.
`String` `getInstantCompletionTriggers()` Returns a list of characters which trigger completion immediately.
`String` `getName()` Returns the parser's name.
`String` `getParseTriggers()` Returns a list of characters which trigger a buffer re-parse.
`abstract SideKickParsedData` `parse(Buffer buffer, errorlist.DefaultErrorSource errorSource)` Parses the given text and returns a tree model.
`void` `stop()` Stops the parse request currently in progress.
`boolean` `supportsCompletion()` Returns if the parser supports code completion.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### SERVICE

    public static final String SERVICE

See Also:
  Constant Field Values

### name

    protected String name

Constructor Detail

### SideKickParser

    public SideKickParser(String name)

  The parser constructor.

Method Detail

### getName

    public final String getName()

  Returns the parser's name.

### stop

    public void stop()

  Stops the parse request currently in progress. It is up to the parser to implement this.

  Since:
    SideKick 0.3

### activate

    public void activate(View view)

  Deprecated. Use the form taking an `EditPane` instead.

  This method is called when a buffer using this parser is selected in the specified view.

  Parameters:
    `view` - The view
  Since:
    SideKick 0.2

### deactivate

    public void deactivate(View view)

  Deprecated. Use the form taking an `EditPane` instead.

  This method is called when a buffer using this parser is no longer selected in the specified view.

  Parameters:
    `view` - The view
  Since:
    SideKick 0.2

### activate

    public void activate(EditPane editPane)

  This method is called when a buffer using this parser is selected in the specified view.

  Parameters:
    `editPane` - The edit pane
  Since:
    SideKick 0.3.1

### deactivate

    public void deactivate(EditPane editPane)

  This method is called when a buffer using this parser is no longer selected in the specified view.

  Parameters:
    `editPane` - The edit pane
  Since:
    SideKick 0.3.1

### parse

    public abstract SideKickParsedData parse(Buffer buffer,
                                             errorlist.DefaultErrorSource errorSource)

  Parses the given text and returns a tree model.

  Parameters:
    `buffer` - The buffer to parse.
    `errorSource` - An error source to add errors to.
  Returns:
    A new instance of the `SideKickParsedData` class.

### supportsCompletion

    public boolean supportsCompletion()

  Returns if the parser supports code completion. Returns false by default.

### canHandleBackspace

    public boolean canHandleBackspace()

  Returns true if the parser can handle the backspace key being typed when the completion popup is open, else false if not.

  If false, the completion popup is closed when backspace is typed.

  If true, the `SideKickCompletion.handleKeystroke(int, char)` method must be overidden to handle receiving the backspace character, '\b', as a value for the keyChar parameter.

  Returns false by default.

  Since:
    SideKick 0.3.4

### canCompleteAnywhere

    public boolean canCompleteAnywhere()

  Returns if completion popups should be shown after any period of inactivity. Otherwise, they are only shown if explicitly requested by the user. Returns true by default.

### getInstantCompletionTriggers

    public String getInstantCompletionTriggers()

  Returns a list of characters which trigger completion immediately. Returns null by default.

### getParseTriggers

    public String getParseTriggers()

  Returns a list of characters which trigger a buffer re-parse. Returns null by default.

  Since:
    SideKick 0.3

### complete

    public SideKickCompletion complete(EditPane editPane,
                                       int caret)

  Returns completions suitable for insertion at the specified position. Returns null by default.

  Parameters:
    `editPane` - The edit pane involved.
    `caret` - The caret position.