| 29 |
<tr> |
<tr> |
| 30 |
<td ALIGN=RIGHT VALIGN=TOP WIDTH="2%"><img SRC="http://dev.eclipse.org/images/Adarrow.gif" NOSAVE BORDER=0 height=16 width=16></td> |
<td ALIGN=RIGHT VALIGN=TOP WIDTH="2%"><img SRC="http://dev.eclipse.org/images/Adarrow.gif" NOSAVE BORDER=0 height=16 width=16></td> |
| 31 |
<td WIDTH="98%"><b>Where to get the grammar</b><br> |
<td WIDTH="98%"><b>Where to get the grammar</b><br> |
| 32 |
<blockquote>The latest grammar is always located in the <code>grammar()</code> method of the <code>Parser</code> class. Go to the org.eclipse.jdt.core plugins |
<blockquote>The latest grammar is always located in the <code>java_1_4.g</code> file. Go to the org.eclipse.jdt.core plugins |
| 33 |
directory (<font color="#3366FF">eclipse\plugins\org.eclipse.jdt.core</font> where eclipse is the root of your eclipse installation) and open the |
directory (<font color="#3366FF">eclipse\plugins\org.eclipse.jdt.core</font> where eclipse is the root of your eclipse installation) and open the |
| 34 |
<font color="#3366FF">jdtcoresrc.zip</font> file. Then search for the <font color="#3366FF">Parser.java</font> inside the |
<font color="#3366FF">grammar</font> directory. Then search for the <font color="#3366FF">java_1_4.g</font> file inside the |
| 35 |
folder <font color="#3366FF">org\eclipse\jdt\internal\compiler\parser\</font>. You need to look for the method named |
folder <font color="#3366FF">grammar</font>. Then copy its contents from: |
|
<code>grammar()</code>. Then copy its contents from: |
|
| 36 |
<PRE>--main options |
<PRE>--main options |
| 37 |
%options ACTION, AN=JavaAction.java, GP=java, |
%options ACTION, AN=JavaAction.java, GP=java, |
| 38 |
.... |
.... |
| 142 |
</tr> |
</tr> |
| 143 |
<tr> |
<tr> |
| 144 |
<th VALIGN=top align=left>javahdr.java</th> |
<th VALIGN=top align=left>javahdr.java</th> |
| 145 |
<td>You don't need this file. It is actually empty.</td> |
<td>This files is used to generate the resources files..</td> |
| 146 |
</tr> |
</tr> |
| 147 |
<tr> |
<tr> |
| 148 |
<th VALIGN=top align=left>javadcl.java</th> |
<th VALIGN=top align=left>javadcl.java</th> |
| 171 |
<ol> |
<ol> |
| 172 |
<li>Copy the contents of the <font color="#3366FF">JavaAction.java</font> file into the <font color="#3366FF">consumeRule(int)</font> method of the org.eclipse.jdt.internal.compiler.parser.Parser class. |
<li>Copy the contents of the <font color="#3366FF">JavaAction.java</font> file into the <font color="#3366FF">consumeRule(int)</font> method of the org.eclipse.jdt.internal.compiler.parser.Parser class. |
| 173 |
</li> |
</li> |
|
<li>The definition of the Parser needs to be updated with three tables from <font color="#3366FF">javadcl.java</font>. Those are <font color="#3366FF">rhs[]</font>, <font color="#3366FF">name[]</font> and <font color="#3366FF">scope_la[]</font>. |
|
|
The following entries in name[] need to be replaced: |
|
|
<ul> |
|
|
<li><font color="#3366FF">$eof</font> with <font color="#3366FF">UNEXPECTED_EOF</font></li> |
|
|
<li><font color="#3366FF">$error</font> with <font color="#3366FF">"Invalid Character"</font></li> |
|
|
</ul> |
|
|
The previous definition of name[] will guide you. |
|
|
</li> |
|
| 174 |
<li>The class <font color="#3366FF">org.eclipse.jdt.internal.compiler.parser.ParserBasicInformation</font> needs to be updated with the content of the file <font color="#3366FF">javadef.java</font>. Don't copy the |
<li>The class <font color="#3366FF">org.eclipse.jdt.internal.compiler.parser.ParserBasicInformation</font> needs to be updated with the content of the file <font color="#3366FF">javadef.java</font>. Don't copy the |
| 175 |
interface name. Simply copy the field declarations. The actual source of this class will guide you.</li> |
interface name. Simply copy the field declarations. The actual source of this class will guide you.</li> |
| 176 |
<li>This is the contents of the class org.eclipse.jdt.internal.compiler.parser.TerminalTokens. You need to replace:<br> |
<li>This is the contents of the class org.eclipse.jdt.internal.compiler.parser.TerminalTokens. You need to replace:<br> |
| 185 |
<PRE> |
<PRE> |
| 186 |
D:\temp>java -classpath jdtcore.jar:. UpdateParserFiles javadcl.java |
D:\temp>java -classpath jdtcore.jar:. UpdateParserFiles javadcl.java |
| 187 |
</PRE> |
</PRE> |
| 188 |
Once this done, you will end up with 16 new files inside d:\temp. They are called parser<n>.rsc, with n equals to 1..16. |
Once this done, you will end up with 21 new files inside d:\temp. They are called parser<n>.rsc, with n equals to 1..20 and readableNames.properties. |
| 189 |
All these files need to be moved to the org\eclipse\jdt\internal\compiler\parser folder. Now you are ready to execute and test |
All these files need to be moved to the org\eclipse\jdt\internal\compiler\parser folder. Now you are ready to execute and test |
| 190 |
the new parser. |
the new parser. |
| 191 |
</li> |
</li> |