blob: c6bf2ef7c4fbdf965a0d8da51a3579376a5dd7bd [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.5.0_12) on Fri May 30 11:15:54 CDT 2008 -->
<TITLE>
ASTParser
</TITLE>
<META NAME="keywords" CONTENT="org.eclipse.wst.jsdt.core.dom.ASTParser class">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
parent.document.title="ASTParser";
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/ASTParser.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTNode.html" title="class in org.eclipse.wst.jsdt.core.dom"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTRequestor.html" title="class in org.eclipse.wst.jsdt.core.dom"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../index.html?org/eclipse/wst/jsdt/core/dom/ASTParser.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="ASTParser.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
org.eclipse.wst.jsdt.core.dom</FONT>
<BR>
Class ASTParser</H2>
<PRE>
java.lang.Object
<IMG SRC="../../../../../../resources/inherit.gif" ALT="extended by "><B>org.eclipse.wst.jsdt.core.dom.ASTParser</B>
</PRE>
<HR>
<DL>
<DT><PRE>public class <B>ASTParser</B><DT>extends java.lang.Object</DL>
</PRE>
<P>
A JavaScript language parser for creating abstract syntax trees (ASTs).
<p>
Example: Create basic AST from source string
<pre>
char[] source = ...;
ASTParser parser = ASTParser.newParser(AST.JLS3);
parser.setSource(source);
JavaScriptUnit result = (JavaScriptUnit) parser.createAST(null);
</pre>
Once a configured parser instance has been used to create an AST,
the settings are automatically reset to their defaults,
ready for the parser instance to be reused.
</p>
<p>
There are a number of configurable features:
<ul>
<li>Source string from <A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#setSource(char[])"><CODE>char[]</CODE></A>,
<A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#setSource(org.eclipse.wst.jsdt.core.IJavaScriptUnit)"><CODE>IJavaScriptUnit</CODE></A>,
or <A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#setSource(org.eclipse.wst.jsdt.core.IClassFile)"><CODE>IClassFile</CODE></A>, and limited
to a specified <A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#setSourceRange(int, int)">subrange</A>.</li>
<li>Whether <A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#setResolveBindings(boolean)">bindings</A> will be created.</li>
<li>Which <A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#setWorkingCopyOwner(org.eclipse.wst.jsdt.core.WorkingCopyOwner)">working set owner</A> to use when resolving bindings).</li>
<li>A hypothetical <A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#setUnitName(java.lang.String)">javaScript unit file name</A>
and <A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#setProject(org.eclipse.wst.jsdt.core.IJavaScriptProject)">JavaScript project</A>
for locating a raw source string in the JavaScript model (when
resolving bindings)</li>
<li>Which <A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#setCompilerOptions(java.util.Map)">validator options</A>
to use.</li>
<li>Whether to parse just <A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#setKind(int)">an expression, statements,
or body declarations</A> rather than an entire javaScript unit.</li>
<li>Whether to return a <A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#setFocalPosition(int)">abridged AST</A>
focused on the declaration containing a given source position.</li>
</ul>
</p>
Provisional API: This class/interface is part of an interim API that is still under development and expected to
change significantly before reaching stability. It is being made available at this early stage to solicit feedback
from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
(repeatedly) as the API evolves.
<P>
<P>
<HR>
<P>
<!-- =========== FIELD SUMMARY =========== -->
<A NAME="field_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Field Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#K_CLASS_BODY_DECLARATIONS">K_CLASS_BODY_DECLARATIONS</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Kind constant used to request that the source be parsed
as a sequence of class body declarations.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#K_COMPILATION_UNIT">K_COMPILATION_UNIT</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Kind constant used to request that the source be parsed
as a javaScript unit.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#K_EXPRESSION">K_EXPRESSION</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Kind constant used to request that the source be parsed
as a single expression.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#K_STATEMENTS">K_STATEMENTS</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Kind constant used to request that the source be parsed
as a sequence of statements.</TD>
</TR>
</TABLE>
&nbsp;
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTNode.html" title="class in org.eclipse.wst.jsdt.core.dom">ASTNode</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#createAST(IProgressMonitor)">createAST</A></B>(IProgressMonitor&nbsp;monitor)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates an abstract syntax tree.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#createASTs(org.eclipse.wst.jsdt.core.IJavaScriptUnit[], java.lang.String[], org.eclipse.wst.jsdt.core.dom.ASTRequestor, IProgressMonitor)">createASTs</A></B>(<A HREF="../../../../../../org/eclipse/wst/jsdt/core/IJavaScriptUnit.html" title="interface in org.eclipse.wst.jsdt.core">IJavaScriptUnit</A>[]&nbsp;compilationUnits,
java.lang.String[]&nbsp;bindingKeys,
<A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTRequestor.html" title="class in org.eclipse.wst.jsdt.core.dom">ASTRequestor</A>&nbsp;requestor,
IProgressMonitor&nbsp;monitor)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates ASTs for a batch of javaScript units.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/IBinding.html" title="interface in org.eclipse.wst.jsdt.core.dom">IBinding</A>[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#createBindings(org.eclipse.wst.jsdt.core.IJavaScriptElement[], IProgressMonitor)">createBindings</A></B>(<A HREF="../../../../../../org/eclipse/wst/jsdt/core/IJavaScriptElement.html" title="interface in org.eclipse.wst.jsdt.core">IJavaScriptElement</A>[]&nbsp;elements,
IProgressMonitor&nbsp;monitor)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates bindings for a batch of JavaScript elements.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;<A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html" title="class in org.eclipse.wst.jsdt.core.dom">ASTParser</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#newParser(int)">newParser</A></B>(int&nbsp;level)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a new object for creating a JavaScript abstract syntax tree
(AST) following the specified set of API rules.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#setBindingsRecovery(boolean)">setBindingsRecovery</A></B>(boolean&nbsp;enabled)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Requests that the validator should perform bindings recovery.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#setCompilerOptions(java.util.Map)">setCompilerOptions</A></B>(java.util.Map&nbsp;options)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the validator options to be used when parsing.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#setFocalPosition(int)">setFocalPosition</A></B>(int&nbsp;position)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Requests an abridged abstract syntax tree.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#setKind(int)">setKind</A></B>(int&nbsp;kind)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the kind of constructs to be parsed from the source.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#setProject(org.eclipse.wst.jsdt.core.IJavaScriptProject)">setProject</A></B>(<A HREF="../../../../../../org/eclipse/wst/jsdt/core/IJavaScriptProject.html" title="interface in org.eclipse.wst.jsdt.core">IJavaScriptProject</A>&nbsp;project)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the JavaScript project used when resolving bindings.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#setResolveBindings(boolean)">setResolveBindings</A></B>(boolean&nbsp;bindings)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Requests that the validator should provide binding information for
the AST nodes it creates.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#setSource(char[])">setSource</A></B>(char[]&nbsp;source)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the source code to be parsed.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#setSource(org.eclipse.wst.jsdt.core.IClassFile)">setSource</A></B>(<A HREF="../../../../../../org/eclipse/wst/jsdt/core/IClassFile.html" title="interface in org.eclipse.wst.jsdt.core">IClassFile</A>&nbsp;source)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the source code to be parsed.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#setSource(org.eclipse.wst.jsdt.core.IJavaScriptUnit)">setSource</A></B>(<A HREF="../../../../../../org/eclipse/wst/jsdt/core/IJavaScriptUnit.html" title="interface in org.eclipse.wst.jsdt.core">IJavaScriptUnit</A>&nbsp;source)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the source code to be parsed.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#setSource(org.eclipse.wst.jsdt.core.ITypeRoot)">setSource</A></B>(<A HREF="../../../../../../org/eclipse/wst/jsdt/core/ITypeRoot.html" title="interface in org.eclipse.wst.jsdt.core">ITypeRoot</A>&nbsp;source)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the source code to be parsed.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#setSourceRange(int, int)">setSourceRange</A></B>(int&nbsp;offset,
int&nbsp;length)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the subrange of the source code to be parsed.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#setStatementsRecovery(boolean)">setStatementsRecovery</A></B>(boolean&nbsp;enabled)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Requests that the validator should perform statements recovery.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#setUnitName(java.lang.String)">setUnitName</A></B>(java.lang.String&nbsp;unitName)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the name of the javaScript unit that would hypothetically contains
the source string.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#setWorkingCopyOwner(org.eclipse.wst.jsdt.core.WorkingCopyOwner)">setWorkingCopyOwner</A></B>(<A HREF="../../../../../../org/eclipse/wst/jsdt/core/WorkingCopyOwner.html" title="class in org.eclipse.wst.jsdt.core">WorkingCopyOwner</A>&nbsp;owner)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the working copy owner using when resolving bindings, where
<code>null</code> means the primary owner.</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>
<!-- ============ FIELD DETAIL =========== -->
<A NAME="field_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Field Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="K_EXPRESSION"><!-- --></A><H3>
K_EXPRESSION</H3>
<PRE>
public static final int <B>K_EXPRESSION</B></PRE>
<DL>
<DD>Kind constant used to request that the source be parsed
as a single expression.
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../../../../constant-values.html#org.eclipse.wst.jsdt.core.dom.ASTParser.K_EXPRESSION">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="K_STATEMENTS"><!-- --></A><H3>
K_STATEMENTS</H3>
<PRE>
public static final int <B>K_STATEMENTS</B></PRE>
<DL>
<DD>Kind constant used to request that the source be parsed
as a sequence of statements.
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../../../../constant-values.html#org.eclipse.wst.jsdt.core.dom.ASTParser.K_STATEMENTS">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="K_CLASS_BODY_DECLARATIONS"><!-- --></A><H3>
K_CLASS_BODY_DECLARATIONS</H3>
<PRE>
public static final int <B>K_CLASS_BODY_DECLARATIONS</B></PRE>
<DL>
<DD>Kind constant used to request that the source be parsed
as a sequence of class body declarations.
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../../../../constant-values.html#org.eclipse.wst.jsdt.core.dom.ASTParser.K_CLASS_BODY_DECLARATIONS">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="K_COMPILATION_UNIT"><!-- --></A><H3>
K_COMPILATION_UNIT</H3>
<PRE>
public static final int <B>K_COMPILATION_UNIT</B></PRE>
<DL>
<DD>Kind constant used to request that the source be parsed
as a javaScript unit.
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../../../../constant-values.html#org.eclipse.wst.jsdt.core.dom.ASTParser.K_COMPILATION_UNIT">Constant Field Values</A></DL>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="newParser(int)"><!-- --></A><H3>
newParser</H3>
<PRE>
public static <A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html" title="class in org.eclipse.wst.jsdt.core.dom">ASTParser</A> <B>newParser</B>(int&nbsp;level)</PRE>
<DL>
<DD>Creates a new object for creating a JavaScript abstract syntax tree
(AST) following the specified set of API rules.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>level</CODE> - the API level; one of the LEVEL constants
declared on <code>AST</code>
<DT><B>Returns:</B><DD>new ASTParser instance</DL>
</DD>
</DL>
<HR>
<A NAME="setBindingsRecovery(boolean)"><!-- --></A><H3>
setBindingsRecovery</H3>
<PRE>
public void <B>setBindingsRecovery</B>(boolean&nbsp;enabled)</PRE>
<DL>
<DD>Requests that the validator should perform bindings recovery.
When bindings recovery is enabled the validator returns incomplete bindings.
<p>
Default to <code>false</code>.
</p>
<p>This should be set to true only if bindings are resolved. It has no effect if there is no binding
resolution.</p>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>enabled</CODE> - <code>true</code> if incomplete bindings are expected,
and <code>false</code> if only complete bindings are expected.<DT><B>See Also:</B><DD><A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/IBinding.html#isRecovered()"><CODE>IBinding.isRecovered()</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="setCompilerOptions(java.util.Map)"><!-- --></A><H3>
setCompilerOptions</H3>
<PRE>
public void <B>setCompilerOptions</B>(java.util.Map&nbsp;options)</PRE>
<DL>
<DD>Sets the validator options to be used when parsing.
<p>
Note that <A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#setSource(org.eclipse.wst.jsdt.core.IClassFile)"><CODE>setSource(IClassFile)</CODE></A>,
<A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#setSource(org.eclipse.wst.jsdt.core.IJavaScriptUnit)"><CODE>setSource(IJavaScriptUnit)</CODE></A>,
and <A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#setProject(org.eclipse.wst.jsdt.core.IJavaScriptProject)"><CODE>setProject(IJavaScriptProject)</CODE></A> reset the validator options
based on the JavaScript project. In other cases, validator options default
to <A HREF="../../../../../../org/eclipse/wst/jsdt/core/JavaScriptCore.html#getOptions()"><CODE>JavaScriptCore.getOptions()</CODE></A>. In either case, and especially
in the latter, the caller should carefully weight the consequences of
allowing validator options to be defaulted as opposed to being
explicitly specified for the <code>ASTParser</code> instance.
For instance, there is a validator option called "Source Compatibility Mode"
which determines which JDK level the source code is expected to meet.
If you specify "1.4", then "assert" is treated as a keyword and disallowed
as an identifier; if you specify "1.3", then "assert" is allowed as an
identifier. So this particular setting has a major bearing on what is
considered syntactically legal. By explicitly specifying the setting,
the client control exactly how the parser works. On the other hand,
allowing default settings means the parsing behaves like other JDT tools.
</p>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>options</CODE> - the table of options (key type: <code>String</code>;
value type: <code>String</code>), or <code>null</code>
to set it back to the default</DL>
</DD>
</DL>
<HR>
<A NAME="setResolveBindings(boolean)"><!-- --></A><H3>
setResolveBindings</H3>
<PRE>
public void <B>setResolveBindings</B>(boolean&nbsp;bindings)</PRE>
<DL>
<DD>Requests that the validator should provide binding information for
the AST nodes it creates.
<p>
Default to <code>false</code> (no bindings).
</p>
<p>
If <code>setResolveBindings(true)</code>, the various names
and types appearing in the AST can be resolved to "bindings"
by calling the <code>resolveBinding</code> methods. These bindings
draw connections between the different parts of a program, and
generally afford a more powerful vantage point for clients who wish to
analyze a program's structure more deeply. These bindings come at a
considerable cost in both time and space, however, and should not be
requested frivolously. The additional space is not reclaimed until the
AST, all its nodes, and all its bindings become garbage. So it is very
important to not retain any of these objects longer than absolutely
necessary. Bindings are resolved at the time the AST is created. Subsequent
modifications to the AST do not affect the bindings returned by
<code>resolveBinding</code> methods in any way; these methods return the
same binding as before the AST was modified (including modifications
that rearrange subtrees by reparenting nodes).
If <code>setResolveBindings(false)</code> (the default), the analysis
does not go beyond parsing and building the tree, and all
<code>resolveBinding</code> methods return <code>null</code> from the
outset.
</p>
<p>
When bindings are requested, instead of considering javaScript units on disk only
one can supply a <code>WorkingCopyOwner</code>. Working copies owned
by this owner take precedence over the underlying javaScript units when looking
up names and drawing the connections.
</p>
<p>
Binding information is obtained from the JavaScript model.
This means that the javaScript unit must be located relative to the
JavaScript model. This happens automatically when the source code comes from
either <A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#setSource(org.eclipse.wst.jsdt.core.IJavaScriptUnit)"><CODE>setSource(IJavaScriptUnit)</CODE></A>
or <A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#setSource(org.eclipse.wst.jsdt.core.IClassFile)"><CODE>setSource(IClassFile)</CODE></A>.
When source is supplied by <A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#setSource(char[])"><CODE>setSource(char[])</CODE></A>,
the location must be extablished explicitly by calling
<A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#setProject(org.eclipse.wst.jsdt.core.IJavaScriptProject)"><CODE>setProject(IJavaScriptProject)</CODE></A> and <A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#setUnitName(java.lang.String)"><CODE>setUnitName(String)</CODE></A>.
Note that the validator options that affect doc comment checking may also
affect whether any bindings are resolved for nodes within doc comments.
</p>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>bindings</CODE> - <code>true</code> if bindings are wanted,
and <code>false</code> if bindings are not of interest</DL>
</DD>
</DL>
<HR>
<A NAME="setFocalPosition(int)"><!-- --></A><H3>
setFocalPosition</H3>
<PRE>
public void <B>setFocalPosition</B>(int&nbsp;position)</PRE>
<DL>
<DD>Requests an abridged abstract syntax tree.
By default, complete ASTs are returned.
<p>
When <code>true</code> the resulting AST does not have nodes for
the entire javaScript unit. Rather, the AST is only fleshed out
for the node that include the given source position. This kind of limited
AST is sufficient for certain purposes but totally unsuitable for others.
In places where it can be used, the limited AST offers the advantage of
being smaller and faster to construct.
</p>
<p>
The AST will include nodes for all of the javaScript unit's functions, top-level vars,
package, import, and top-level type declarations. It will also always contain
nodes for all the body declarations for those top-level types, as well
as body declarations for any member types. However, some of the body
declarations may be abridged. In particular, the statements ordinarily
found in the body of a method declaration node will not be included
(the block will be empty) unless the source position falls somewhere
within the source range of that method declaration node. The same is true
for initializer declarations; the statements ordinarily found in the body
of initializer node will not be included unless the source position falls
somewhere within the source range of that initializer declaration node.
Field declarations are never abridged. Note that the AST for the body of
that one unabridged method (or initializer) is 100% complete; it has all
its statements, including any local or anonymous type declarations
embedded within them. When the the given position is not located within
the source range of any body declaration of a top-level type, the AST
returned will be a skeleton that includes nodes for all and only the major
declarations; this kind of AST is still quite useful because it contains
all the constructs that introduce names visible to the world outside the
javaScript unit.
</p>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>position</CODE> - a position into the corresponding body declaration</DL>
</DD>
</DL>
<HR>
<A NAME="setKind(int)"><!-- --></A><H3>
setKind</H3>
<PRE>
public void <B>setKind</B>(int&nbsp;kind)</PRE>
<DL>
<DD>Sets the kind of constructs to be parsed from the source.
Defaults to an entire javaScript unit.
<p>
When the parse is successful the result returned includes the ASTs for the
requested source:
<ul>
<li><CODE>K_JAVASCRIPT_UNIT</CODE>: The result node
is a <A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/JavaScriptUnit.html" title="class in org.eclipse.wst.jsdt.core.dom"><CODE>JavaScriptUnit</CODE></A>.</li>
<li><A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#K_CLASS_BODY_DECLARATIONS"><CODE>K_CLASS_BODY_DECLARATIONS</CODE></A>: The result node
is a <A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/TypeDeclaration.html" title="class in org.eclipse.wst.jsdt.core.dom"><CODE>TypeDeclaration</CODE></A> whose
<A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/AbstractTypeDeclaration.html#bodyDeclarations()"><CODE>bodyDeclarations</CODE></A>
are the new trees. Other aspects of the type declaration are unspecified.</li>
<li><A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#K_STATEMENTS"><CODE>K_STATEMENTS</CODE></A>: The result node is a
<A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/Block.html" title="class in org.eclipse.wst.jsdt.core.dom"><CODE>Block</CODE></A> whose <A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/Block.html#statements()"><CODE>statements</CODE></A>
are the new trees. Other aspects of the block are unspecified.</li>
<li><A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#K_EXPRESSION"><CODE>K_EXPRESSION</CODE></A>: The result node is a subclass of
<A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/Expression.html" title="class in org.eclipse.wst.jsdt.core.dom"><CODE>Expression</CODE></A>. Other aspects of the expression are unspecified.</li>
</ul>
The resulting AST node is rooted under (possibly contrived)
<A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/JavaScriptUnit.html" title="class in org.eclipse.wst.jsdt.core.dom"><CODE>JavaScriptUnit</CODE></A> node, to allow the
client to retrieve the following pieces of information
available there:
<ul>
<li><A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/JavaScriptUnit.html#getLineNumber(int)">Line number map</A>. Line
numbers start at 1 and only cover the subrange scanned
(<code>source[offset]</code> through <code>source[offset+length-1]</code>).</li>
<li><A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/JavaScriptUnit.html#getMessages()">Compiler messages</A>
and <A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/JavaScriptUnit.html#getProblems()">detailed problem reports</A>.
Character positions are relative to the start of
<code>source</code>; line positions are for the subrange scanned.</li>
<li><A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/JavaScriptUnit.html#getCommentList()">Comment list</A>
for the subrange scanned.</li>
</ul>
The contrived nodes do not have source positions. Other aspects of the
<A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/JavaScriptUnit.html" title="class in org.eclipse.wst.jsdt.core.dom"><CODE>JavaScriptUnit</CODE></A> node are unspecified, including
the exact arrangment of intervening nodes.
</p>
<p>
Lexical or syntax errors detected while parsing can result in
a result node being marked as <A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTNode.html#MALFORMED"><CODE>MALFORMED</CODE></A>.
In more severe failure cases where the parser is unable to
recognize the input, this method returns
a <A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/JavaScriptUnit.html" title="class in org.eclipse.wst.jsdt.core.dom"><CODE>JavaScriptUnit</CODE></A> node with at least the
validator messages.
</p>
<p>Each node in the subtree (other than the contrived nodes)
carries source range(s) information relating back
to positions in the given source (the given source itself
is not remembered with the AST).
The source range usually begins at the first character of the first token
corresponding to the node; leading whitespace and comments are <b>not</b>
included. The source range usually extends through the last character of
the last token corresponding to the node; trailing whitespace and
comments are <b>not</b> included. There are a handful of exceptions
(including the various body declarations); the
specification for these node type spells out the details.
Source ranges nest properly: the source range for a child is always
within the source range of its parent, and the source ranges of sibling
nodes never overlap.
</p>
<p>
Binding information is only computed when <code>kind</code> is
<code>K_JAVASCRIPT_UNIT</code>.
</p>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>kind</CODE> - the kind of construct to parse: one of
<CODE>#K_JAVASCRIPT_UNIT</CODE>,
<A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#K_CLASS_BODY_DECLARATIONS"><CODE>K_CLASS_BODY_DECLARATIONS</CODE></A>,
<A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#K_EXPRESSION"><CODE>K_EXPRESSION</CODE></A>,
<A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#K_STATEMENTS"><CODE>K_STATEMENTS</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="setSource(char[])"><!-- --></A><H3>
setSource</H3>
<PRE>
public void <B>setSource</B>(char[]&nbsp;source)</PRE>
<DL>
<DD>Sets the source code to be parsed.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>source</CODE> - the source string to be parsed,
or <code>null</code> if none</DL>
</DD>
</DL>
<HR>
<A NAME="setSource(org.eclipse.wst.jsdt.core.IJavaScriptUnit)"><!-- --></A><H3>
setSource</H3>
<PRE>
public void <B>setSource</B>(<A HREF="../../../../../../org/eclipse/wst/jsdt/core/IJavaScriptUnit.html" title="interface in org.eclipse.wst.jsdt.core">IJavaScriptUnit</A>&nbsp;source)</PRE>
<DL>
<DD>Sets the source code to be parsed.
This method automatically sets the project (and compiler
options) based on the given javaScript unit, in a manner
equivalent to <code>setProject(source.getJavaProject())</code>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>source</CODE> - the JavaScript model javaScript unit whose source code
is to be parsed, or <code>null</code> if none</DL>
</DD>
</DL>
<HR>
<A NAME="setSource(org.eclipse.wst.jsdt.core.IClassFile)"><!-- --></A><H3>
setSource</H3>
<PRE>
public void <B>setSource</B>(<A HREF="../../../../../../org/eclipse/wst/jsdt/core/IClassFile.html" title="interface in org.eclipse.wst.jsdt.core">IClassFile</A>&nbsp;source)</PRE>
<DL>
<DD>Sets the source code to be parsed.
<p>This method automatically sets the project (and compiler
options) based on the given javaScript unit, in a manner
equivalent to <code>setProject(source.getJavaProject())</code>.</p>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>source</CODE> - the JavaScript file whose corresponding source code
is to be parsed, or <code>null</code> if none</DL>
</DD>
</DL>
<HR>
<A NAME="setSource(org.eclipse.wst.jsdt.core.ITypeRoot)"><!-- --></A><H3>
setSource</H3>
<PRE>
public void <B>setSource</B>(<A HREF="../../../../../../org/eclipse/wst/jsdt/core/ITypeRoot.html" title="interface in org.eclipse.wst.jsdt.core">ITypeRoot</A>&nbsp;source)</PRE>
<DL>
<DD>Sets the source code to be parsed.
<p>This method automatically sets the project (and compiler
options) based on the given javaScript unit, in a manner
equivalent to <code>setProject(source.getJavaProject())</code>.</p>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>source</CODE> - the JavaScript model javaScript unit whose corresponding source code
is to be parsed, or <code>null</code> if none</DL>
</DD>
</DL>
<HR>
<A NAME="setSourceRange(int, int)"><!-- --></A><H3>
setSourceRange</H3>
<PRE>
public void <B>setSourceRange</B>(int&nbsp;offset,
int&nbsp;length)</PRE>
<DL>
<DD>Sets the subrange of the source code to be parsed.
By default, the entire source string will be parsed
(<code>offset</code> 0 and <code>length</code> -1).
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>offset</CODE> - the index of the first character to parse<DD><CODE>length</CODE> - the number of characters to parse, or -1 if
the remainder of the source string is</DL>
</DD>
</DL>
<HR>
<A NAME="setStatementsRecovery(boolean)"><!-- --></A><H3>
setStatementsRecovery</H3>
<PRE>
public void <B>setStatementsRecovery</B>(boolean&nbsp;enabled)</PRE>
<DL>
<DD>Requests that the validator should perform statements recovery.
When statements recovery is enabled the validator tries to create statement nodes
from code containing syntax errors
<p>
Default to <code>false</code>.
</p>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>enabled</CODE> - <code>true</code> if statements containing syntax errors are wanted,
and <code>false</code> if these statements aren't wanted.</DL>
</DD>
</DL>
<HR>
<A NAME="setWorkingCopyOwner(org.eclipse.wst.jsdt.core.WorkingCopyOwner)"><!-- --></A><H3>
setWorkingCopyOwner</H3>
<PRE>
public void <B>setWorkingCopyOwner</B>(<A HREF="../../../../../../org/eclipse/wst/jsdt/core/WorkingCopyOwner.html" title="class in org.eclipse.wst.jsdt.core">WorkingCopyOwner</A>&nbsp;owner)</PRE>
<DL>
<DD>Sets the working copy owner using when resolving bindings, where
<code>null</code> means the primary owner. Defaults to the primary owner.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>owner</CODE> - the owner of working copies that take precedence over underlying
javaScript units, or <code>null</code> if the primary owner should be used</DL>
</DD>
</DL>
<HR>
<A NAME="setUnitName(java.lang.String)"><!-- --></A><H3>
setUnitName</H3>
<PRE>
public void <B>setUnitName</B>(java.lang.String&nbsp;unitName)</PRE>
<DL>
<DD>Sets the name of the javaScript unit that would hypothetically contains
the source string. This is used in conjunction with <A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#setSource(char[])"><CODE>setSource(char[])</CODE></A>
and <A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#setProject(org.eclipse.wst.jsdt.core.IJavaScriptProject)"><CODE>setProject(IJavaScriptProject)</CODE></A> to locate the javaScript unit relative to a JavaScript project.
Defaults to none (<code>null</code>).
<p>
The name of the javaScript unit must be supplied for resolving bindings.
This name should be suffixed by a dot ('.') followed by one of the
<A HREF="../../../../../../org/eclipse/wst/jsdt/core/JavaScriptCore.html#getJavaScriptLikeExtensions()"><CODE>JavaScript-like extensions</CODE></A>.
<p>This name must represent the full path of the unit inside the given project. For example, if the source
declares a public class named "Foo" in a project "P", the name of the javaScript unit must be
"/P/Foo.js". If the source declares a public class name "Bar" in a package "p1.p2" in a project "P",
the name of the javaScript unit must be "/P/p1/p2/Bar.js".</p>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>unitName</CODE> - the name of the javaScript unit that would contain the source
string, or <code>null</code> if none</DL>
</DD>
</DL>
<HR>
<A NAME="setProject(org.eclipse.wst.jsdt.core.IJavaScriptProject)"><!-- --></A><H3>
setProject</H3>
<PRE>
public void <B>setProject</B>(<A HREF="../../../../../../org/eclipse/wst/jsdt/core/IJavaScriptProject.html" title="interface in org.eclipse.wst.jsdt.core">IJavaScriptProject</A>&nbsp;project)</PRE>
<DL>
<DD>Sets the JavaScript project used when resolving bindings.
This method automatically sets the compiler
options based on the given project:
<pre>
setCompilerOptions(project.getOptions(true));
</pre>
See <A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#setCompilerOptions(java.util.Map)"><CODE>setCompilerOptions(Map)</CODE></A> for a discussion of
the pros and cons of using these options vs specifying
validator options explicitly.
This setting is used in conjunction with <code>setSource(char[])</code>.
For the purposes of resolving bindings, types declared in the
source string will hide types by the same name available
through the includepath of the given project.
Defaults to none (<code>null</code>).
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>project</CODE> - the JavaScript project used to resolve names, or
<code>null</code> if none</DL>
</DD>
</DL>
<HR>
<A NAME="createAST(IProgressMonitor)"><!-- --></A><H3>
createAST</H3>
<PRE>
public <A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTNode.html" title="class in org.eclipse.wst.jsdt.core.dom">ASTNode</A> <B>createAST</B>(IProgressMonitor&nbsp;monitor)</PRE>
<DL>
<DD>Creates an abstract syntax tree.
<p>
A successful call to this method returns all settings to their
default values so the object is ready to be reused.
</p>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>monitor</CODE> - the progress monitor used to report progress and request cancelation,
or <code>null</code> if none
<DT><B>Returns:</B><DD>an AST node whose type depends on the kind of parse
requested, with a fallback to a <code>JavaScriptUnit</code>
in the case of severe parsing errors
<DT><B>Throws:</B>
<DD><CODE>java.lang.IllegalStateException</CODE> - if the settings provided
are insufficient, contradictory, or otherwise unsupported</DL>
</DD>
</DL>
<HR>
<A NAME="createASTs(org.eclipse.wst.jsdt.core.IJavaScriptUnit[], java.lang.String[], org.eclipse.wst.jsdt.core.dom.ASTRequestor, IProgressMonitor)"><!-- --></A><H3>
createASTs</H3>
<PRE>
public void <B>createASTs</B>(<A HREF="../../../../../../org/eclipse/wst/jsdt/core/IJavaScriptUnit.html" title="interface in org.eclipse.wst.jsdt.core">IJavaScriptUnit</A>[]&nbsp;compilationUnits,
java.lang.String[]&nbsp;bindingKeys,
<A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTRequestor.html" title="class in org.eclipse.wst.jsdt.core.dom">ASTRequestor</A>&nbsp;requestor,
IProgressMonitor&nbsp;monitor)</PRE>
<DL>
<DD>Creates ASTs for a batch of javaScript units.
When bindings are being resolved, processing a
batch of javaScript units is more efficient because much
of the work involved in resolving bindings can be shared.
<p>
When bindings are being resolved, all javaScript units must
come from the same JavaScript project, which must be set beforehand
with <code>setProject</code>.
The javaScript units are processed one at a time in no
specified order. For each of the javaScript units in turn,
<ul>
<li><code>ASTParser.createAST</code> is called to parse it
and create a corresponding AST. The calls to
<code>ASTParser.createAST</code> all employ the same settings.</li>
<li><code>ASTRequestor.acceptAST</code> is called passing
the javaScript unit and the corresponding AST to
<code>requestor</code>.
</li>
</ul>
Note only ASTs from the given javaScript units are reported
to the requestor. If additional javaScript units are required to
resolve the original ones, the corresponding ASTs are <b>not</b>
reported to the requestor.
</p>
<p>
Note also the following parser parameters are used, regardless of what
may have been specified:
<ul>
<li>The <A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#setKind(int)">parser kind</A> is <code>K_JAVASCRIPT_UNIT</code></li>
<li>The <A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#setSourceRange(int, int)">source range</A> is <code>(0, -1)</code></li>
<li>The <A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#setFocalPosition(int)">focal position</A> is not set</li>
</ul>
</p>
<p>
The <code>bindingKeys</code> parameter specifies bindings keys
(<A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/IBinding.html#getKey()"><CODE>IBinding.getKey()</CODE></A>) that are to be looked up. These keys may
be for elements either inside or outside the set of compilation
units being processed. When bindings are being resolved,
the keys and corresponding bindings (or <code>null</code> if none) are
passed to <code>ASTRequestor.acceptBinding</code>. Note that binding keys
for elements outside the set of javaScript units being processed are looked up
after all <code>ASTRequestor.acceptAST</code> callbacks have been made.
Binding keys for elements inside the set of javaScript units being processed
are looked up and reported right after the corresponding
<code>ASTRequestor.acceptAST</code> callback has been made.
No <code>ASTRequestor.acceptBinding</code> callbacks are made unless
bindings are being resolved.
</p>
<p>
A successful call to this method returns all settings to their
default values so the object is ready to be reused.
</p>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>compilationUnits</CODE> - the javaScript units to create ASTs for<DD><CODE>bindingKeys</CODE> - the binding keys to create bindings for<DD><CODE>requestor</CODE> - the AST requestor that collects abtract syntax trees and bindings<DD><CODE>monitor</CODE> - the progress monitor used to report progress and request cancelation,
or <code>null</code> if none
<DT><B>Throws:</B>
<DD><CODE>java.lang.IllegalStateException</CODE> - if the settings provided
are insufficient, contradictory, or otherwise unsupported</DL>
</DD>
</DL>
<HR>
<A NAME="createBindings(org.eclipse.wst.jsdt.core.IJavaScriptElement[], IProgressMonitor)"><!-- --></A><H3>
createBindings</H3>
<PRE>
public <A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/IBinding.html" title="interface in org.eclipse.wst.jsdt.core.dom">IBinding</A>[] <B>createBindings</B>(<A HREF="../../../../../../org/eclipse/wst/jsdt/core/IJavaScriptElement.html" title="interface in org.eclipse.wst.jsdt.core">IJavaScriptElement</A>[]&nbsp;elements,
IProgressMonitor&nbsp;monitor)</PRE>
<DL>
<DD>Creates bindings for a batch of JavaScript elements. These elements are either
enclosed in <A HREF="../../../../../../org/eclipse/wst/jsdt/core/IJavaScriptUnit.html" title="interface in org.eclipse.wst.jsdt.core"><CODE>IJavaScriptUnit</CODE></A>s or in <A HREF="../../../../../../org/eclipse/wst/jsdt/core/IClassFile.html" title="interface in org.eclipse.wst.jsdt.core"><CODE>IClassFile</CODE></A>s.
<p>
All enclosing javaScript units must
come from the same JavaScript project, which must be set beforehand
with <code>setProject</code>.
</p>
<p>
All elements must exist. If one doesn't exist, an <code>IllegalStateException</code>
is thrown.
</p>
<p>
The returned array has the same size as the given elements array. At a given position
it contains the binding of the corresponding JavaScript element, or <code>null</code>
if no binding could be created.
</p>
<p>
Note also the following parser parameters are used, regardless of what
may have been specified:
<ul>
<li>The <A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#setResolveBindings(boolean)">binding resolution flag</A> is <code>true</code></li>
<li>The <A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#setKind(int)">parser kind</A> is <code>K_JAVASCRIPT_UNIT</code></li>
<li>The <A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#setSourceRange(int, int)">source range</A> is <code>(0, -1)</code></li>
<li>The <A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTParser.html#setFocalPosition(int)">focal position</A> is not set</li>
</ul>
</p>
<p>
A successful call to this method returns all settings to their
default values so the object is ready to be reused.
</p>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>elements</CODE> - the JavaScript elements to create bindings for
<DT><B>Returns:</B><DD>the bindings for the given JavaScript elements, possibly containing <code>null</code>s
if some bindings could not be created
<DT><B>Throws:</B>
<DD><CODE>java.lang.IllegalStateException</CODE> - if the settings provided
are insufficient, contradictory, or otherwise unsupported</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/ASTParser.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTNode.html" title="class in org.eclipse.wst.jsdt.core.dom"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../../../org/eclipse/wst/jsdt/core/dom/ASTRequestor.html" title="class in org.eclipse.wst.jsdt.core.dom"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../index.html?org/eclipse/wst/jsdt/core/dom/ASTParser.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="ASTParser.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
</BODY>
</HTML>