## sidekick.enhanced
Class SourceParser

    java.lang.Object
      sidekick.SideKickParser
          sidekick.enhanced.SourceParser

public class SourceParser
extends SideKickParser

SourceParser: parses source and builds a sidekick structure tree Parsers are based on regular expressions and will therefore not able to correctly parse irregular source

Version:
  $Revision: 1.5 $
Author:
  Martin Raspe

Nested Class Summary
`protected class` `SourceParser.AssetComparator`
`protected class` `SourceParser.PackageComparator`
`protected class` `SourceParser.PackageMap`

Field Summary
`protected SourceAsset` `_asset`
`protected Position` `_end`
`protected int` `_lastLineNumber`
`protected SourceAsset` `_pkgAsset`
`protected Position` `_start`
`String` `COMMENT`
`ImageIcon` `COMMENT_ICON`
`protected ArrayList` `commentList`
`protected SideKickParsedData` `data`
`String` `LINE_COMMENT`
`String` `MAIN`
`ImageIcon` `PACKAGE_ICON`
`ImageIcon` `PACKAGE_INVALID_ICON`
`protected SourceParser.PackageMap` `packages`
`String` `PKG_KEY`
`ImageIcon` `SUB_ICON`
`ImageIcon` `SUB_INVALID_ICON`
`String` `SUB_KEY`
`String` `USE`
`ImageIcon` `USE_ICON`
`ImageIcon` `USE_INVALID_ICON`
`String` `USE_KEY`

Fields inherited from class sidekick.SideKickParser
`name, SERVICE`

Constructor Summary
`SourceParser(String name)` Constructs a new SourceParser object
`SourceParser(String name, Class cls)`

Method Summary
`protected void` `addAsset(String typ, String p, String name, int lineNo, Position start)`
`protected void` `addCommentAsset(String name, int lineNo, Position start)`
`protected void` `addLineAsset(String typ, String p, String name, int lineNo, Position start, Position end)`
`protected void` `addList(DefaultMutableTreeNode t, ArrayList list, ImageIcon icon)`
`protected void` `addPackageAsset(String name, int lineNo, Position start)`
`protected void` `buildTrees()`
`protected void` `completeAsset(Position end)`
`protected void` `completeAsset(Position end, int lineNo)`
`protected void` `completeAsset(Position end, String desc)`
`protected void` `completePackageAsset(Position end, int lineNo)`
`protected String` `find(String line, Pattern p, int g)`
`protected String[]` `find2(String line, Pattern p)`
`protected ImageIcon` `loadIcon(String name, Class cls, String icon)`
`protected void` `loadIcons(String name, Class cls)`
`protected void` `newTree(DefaultMutableTreeNode n, String name, ArrayList list, ImageIcon icon)`
`SideKickParsedData` `parse(Buffer buffer, errorlist.DefaultErrorSource errorSource)` Parses the given text and returns a tree model.
`protected void` `parseBuffer(Buffer buffer, errorlist.DefaultErrorSource errorSource)`

Methods inherited from class sidekick.SideKickParser
`activate, activate, canCompleteAnywhere, canHandleBackspace, complete, deactivate, deactivate, getInstantCompletionTriggers, getName, getParseTriggers, stop, supportsCompletion`

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

Field Detail

### PACKAGE_ICON

    public ImageIcon PACKAGE_ICON

### USE_ICON

    public ImageIcon USE_ICON

### SUB_ICON

    public ImageIcon SUB_ICON

### PACKAGE_INVALID_ICON

    public ImageIcon PACKAGE_INVALID_ICON

### USE_INVALID_ICON

    public ImageIcon USE_INVALID_ICON

### SUB_INVALID_ICON

    public ImageIcon SUB_INVALID_ICON

### COMMENT_ICON

    public ImageIcon COMMENT_ICON

### LINE_COMMENT

    public String LINE_COMMENT

### COMMENT

    public String COMMENT

### MAIN

    public String MAIN

### USE

    public String USE

### USE_KEY

    public String USE_KEY

### SUB_KEY

    public String SUB_KEY

### PKG_KEY

    public String PKG_KEY

### data

    protected SideKickParsedData data

### packages

    protected SourceParser.PackageMap packages

### commentList

    protected ArrayList commentList

### _asset

    protected SourceAsset _asset

### _pkgAsset

    protected SourceAsset _pkgAsset

### _start

    protected Position _start

### _end

    protected Position _end

### _lastLineNumber

    protected int _lastLineNumber

Constructor Detail

### SourceParser

    public SourceParser(String name)

  Constructs a new SourceParser object

Parameters:
  `name` - See sidekick.SidekickParser.

### SourceParser

    public SourceParser(String name,
                        Class cls)

Method Detail

### parse

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

  Parses the given text and returns a tree model.

  Specified by:
    `parse` in class `SideKickParser`
  Parameters:
    `buffer` - The buffer to parse.
    `errorSource` - An error source to add errors to.
  Returns:
    A new instance of the `SourceParsedData` class.

### parseBuffer

    protected void parseBuffer(Buffer buffer,
                               errorlist.DefaultErrorSource errorSource)

### loadIcons

    protected void loadIcons(String name,
                             Class cls)

### loadIcon

    protected ImageIcon loadIcon(String name,
                                 Class cls,
                                 String icon)

### completeAsset

    protected void completeAsset(Position end)

### completeAsset

    protected void completeAsset(Position end,
                                 String desc)

### completeAsset

    protected void completeAsset(Position end,
                                 int lineNo)

### completePackageAsset

    protected void completePackageAsset(Position end,
                                        int lineNo)

### addAsset

    protected void addAsset(String typ,
                            String p,
                            String name,
                            int lineNo,
                            Position start)

### addLineAsset

    protected void addLineAsset(String typ,
                                String p,
                                String name,
                                int lineNo,
                                Position start,
                                Position end)

### addCommentAsset

    protected void addCommentAsset(String name,
                                   int lineNo,
                                   Position start)

### addPackageAsset

    protected void addPackageAsset(String name,
                                   int lineNo,
                                   Position start)

### buildTrees

    protected void buildTrees()

### newTree

    protected void newTree(DefaultMutableTreeNode n,
                           String name,
                           ArrayList list,
                           ImageIcon icon)

### addList

    protected void addList(DefaultMutableTreeNode t,
                           ArrayList list,
                           ImageIcon icon)

### find

    protected String find(String line,
                          Pattern p,
                          int g)

### find2

    protected String[] find2(String line,
                             Pattern p)