KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > api > gsf > Parser


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 package org.netbeans.api.gsf;
20
21 import java.util.List JavaDoc;
22 import org.netbeans.api.gsf.annotations.NonNull;
23 import org.netbeans.api.gsf.CompilationInfo;
24 import org.netbeans.api.gsf.annotations.NonNull;
25 import org.netbeans.api.gsf.OccurrencesFinder;
26 import org.netbeans.api.gsf.SemanticAnalyzer;
27 import org.netbeans.api.gsf.Element;
28 import org.netbeans.api.gsf.ElementHandle;
29
30
31 /**
32  *
33  * @author <a HREF="mailto:tor.norbye@sun.com">Tor Norbye</a>
34  */

35 public interface Parser {
36     /** Parse the given set of files, and notify the parse listener for each transition
37      * (compilation results are attached to the events). The SourceFileReader can be used
38      * to get the contents of the files to be parsed.
39      */

40     void parseFiles(@NonNull List JavaDoc<ParserFile> files,/* @NonNull ErrorHandler errorHandler, */
41             @NonNull ParseListener listener, @NonNull SourceFileReader reader);
42     
43     /**
44      * Return an object capable of providing source offsets for objects produced by the parser
45      */

46     PositionManager getPositionManager();
47
48     /**
49      * HACK HACK HACK
50      * This should be done through a source task factory
51      *
52      * TODO: Document specific conventions here: highlighting unused vars, parameters, etc. Point
53      * to ColoringAttributes etc.
54      */

55     SemanticAnalyzer getSemanticAnalysisTask();
56
57     /**
58      * HACK HACK HACK
59      * This should be done through a source task factory
60      *
61      * TODO: Document expected conventions here, like placing the caret over a return value
62      * should highlight all exit points, over a throws clause should highlight all points
63      * throwing or catching that particular exception, etc.
64      */

65     OccurrencesFinder getMarkOccurrencesTask(int caretPosition);
66
67     /**
68      * Create a "handle" for the given element. The handle should be able to be
69      * mapped to an equivalent element in a separate parse tree through the
70      * {@link #resolveHandle} method.
71      */

72     <T extends Element> ElementHandle<T> createHandle(CompilationInfo info, final T element);
73
74     /**
75      * For the given handle, resolve it to an equivalent element in the new
76      * parse tree pointed to by the updated CompilationInfo.
77      */

78     <T extends Element> T resolveHandle(CompilationInfo info, ElementHandle<T> handle);
79 }
80
Popular Tags