1 | /*
|
---|
2 | * 09/23/2005
|
---|
3 | *
|
---|
4 | * Parser.java - An interface for a parser for RSyntaxTextArea.
|
---|
5 | *
|
---|
6 | * This library is distributed under a modified BSD license. See the included
|
---|
7 | * RSyntaxTextArea.License.txt file for details.
|
---|
8 | */
|
---|
9 | package org.fife.ui.rsyntaxtextarea.parser;
|
---|
10 |
|
---|
11 | import java.net.URL;
|
---|
12 |
|
---|
13 | import org.fife.ui.rsyntaxtextarea.RSyntaxDocument;
|
---|
14 | import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
|
---|
15 | import org.fife.ui.rsyntaxtextarea.SyntaxConstants;
|
---|
16 | import org.fife.ui.rsyntaxtextarea.focusabletip.FocusableTip;
|
---|
17 |
|
---|
18 |
|
---|
19 | /**
|
---|
20 | * An interface for a parser for content in an {@link RSyntaxTextArea}.
|
---|
21 | * A <code>Parser</code> returns a list of issues it finds in the text area's
|
---|
22 | * content, which the text area can flag (e.g. squiggle underline). It can
|
---|
23 | * also return descriptions of the issues, to be used in tool tips.<p>
|
---|
24 | *
|
---|
25 | * To install a <code>Parser</code>, simply call
|
---|
26 | * {@link RSyntaxTextArea#addParser(Parser)}.
|
---|
27 | *
|
---|
28 | * @author Robert Futrell
|
---|
29 | * @version 0.5
|
---|
30 | * @see AbstractParser
|
---|
31 | */
|
---|
32 | public interface Parser {
|
---|
33 |
|
---|
34 |
|
---|
35 | /**
|
---|
36 | * Returns the listener for hyperlink events from {@link FocusableTip}s,
|
---|
37 | * or <code>null</code> if none.
|
---|
38 | *
|
---|
39 | * @return The listener.
|
---|
40 | */
|
---|
41 | public ExtendedHyperlinkListener getHyperlinkListener();
|
---|
42 |
|
---|
43 |
|
---|
44 | /**
|
---|
45 | * Returns the base URL for any images displayed in returned
|
---|
46 | * {@link ParserNotice} HTML text. Note that if a parser notice's text
|
---|
47 | * is not HTML, this URL is not used.
|
---|
48 | *
|
---|
49 | * @return The URL. This may be <code>null</code>.
|
---|
50 | */
|
---|
51 | public URL getImageBase();
|
---|
52 |
|
---|
53 |
|
---|
54 | /**
|
---|
55 | * Returns whether this parser is enabled. If this returns
|
---|
56 | * <code>false</code>, it will not be run.
|
---|
57 | *
|
---|
58 | * @return Whether this parser is enabled.
|
---|
59 | */
|
---|
60 | public boolean isEnabled();
|
---|
61 |
|
---|
62 |
|
---|
63 | /**
|
---|
64 | * Parses input from the specified document.
|
---|
65 | *
|
---|
66 | * @param doc The document to parse. This document is in a read lock,
|
---|
67 | * so it cannot be modified while parsing is occurring.
|
---|
68 | * @param style The language being rendered, such as
|
---|
69 | * {@link SyntaxConstants#SYNTAX_STYLE_JAVA}.
|
---|
70 | * @return An object describing the section of the document parsed and the
|
---|
71 | * results. This is guaranteed to be non-<code>null</code>.
|
---|
72 | */
|
---|
73 | public ParseResult parse(RSyntaxDocument doc, String style);
|
---|
74 |
|
---|
75 |
|
---|
76 | } |
---|