| 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>java_1_5.g</code> file. Go to the org.eclipse.jdt.core plugins |
<blockquote>The latest grammar is always located in the <code>java_1_5.g</code> file. (N.B.: Older versions of the grammar, such as java_1_4.g are not supported and are no longer functional.) 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">grammar</font> directory. Then search for the <font color="#3366FF">java_1_5.g</font> file inside the |
<font color="#3366FF">grammar</font> directory. Then search for the <font color="#3366FF">java_1_5.g</font> file inside the |
| 35 |
folder <font color="#3366FF">grammar</font>. Then copy its contents from: |
folder <font color="#3366FF">grammar</font>. Then copy its contents from: |
| 41 |
</PRE> |
</PRE> |
| 42 |
into a file called <font color="#3366FF">java.g</font>. It is important to add a carriage return at the end of the last line. |
into a file called <font color="#3366FF">java.g</font>. It is important to add a carriage return at the end of the last line. |
| 43 |
You can save this file where you want, we will assume from thereon you saved it in <code>d:\temp\</code>. |
You can save this file where you want, we will assume from thereon you saved it in <code>d:\temp\</code>. |
| 44 |
|
<!-- Also make sure that the file has Unix-style end-of-line characters (i.e., not those of MS-DOS), as the parser generator is quite picky about this. --> |
| 45 |
</blockquote> |
</blockquote> |
| 46 |
</p> |
</p> |
| 47 |
</td> |
</td> |
| 50 |
<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> |
| 51 |
<td WIDTH="98%"><b>What to do with these files and update the parser class...</b><br> |
<td WIDTH="98%"><b>What to do with these files and update the parser class...</b><br> |
| 52 |
<blockquote> |
<blockquote> |
| 53 |
Assuming, the LPG executable (<code>lpg.exe</code> or <code>jikespg.exe</code>) is located inside <code>d:\lpg</code>. |
Assuming the LPG executable (<code>lpg.exe</code> or <code>jikespg.exe</code>) is located in <code>d:\lpg</code>. |
| 54 |
<ol> |
<ol> |
| 55 |
<li>First in a console, run: |
<li>First in a console, run: |
| 56 |
<PRE> |
<PRE> |
| 129 |
|
|
| 130 |
Escaped symbol $error is an invalid C variable. |
Escaped symbol $error is an invalid C variable. |
| 131 |
</PRE> |
</PRE> |
| 132 |
It can be quite different if the output changed since the version 2.30 of lpg. The important part is:<br> |
It can be quite different if the output changed since version 2.30 of LPG. The important part is:<br> |
| 133 |
<blockquote><b>This grammar is LALR(1).</b></blockquote> |
<blockquote><b>This grammar is LALR(1).</b></blockquote> |
| 134 |
This creates in the current directory some java source files and information files. |
This creates some java source files and information files in the current directory. |
| 135 |
<blockquote><table BORDER=1 CELLSPACING=2 CELLPADDING=10> |
<blockquote><table BORDER=1 CELLSPACING=2 CELLPADDING=10> |
| 136 |
<tr> |
<tr> |
| 137 |
<th VALIGN=top align=left>java.l</th> |
<th VALIGN=top align=left>java.l</th> |
| 138 |
<td VALIGN=top>Information generated by lpg/jikespg. Enumarate all the states created for the automaton, etc.</td> |
<td VALIGN=top>Log information generated by lpg/jikespg. Enumarates all the states created for the automaton, etc.</td> |
| 139 |
</tr> |
</tr> |
| 140 |
<tr> |
<tr> |
| 141 |
<th VALIGN=top align=left>JavaAction.java</th> |
<th VALIGN=top align=left>JavaAction.java</th> |
| 142 |
<td>It contains the method consumeRule(int) of the class org.eclipse.jdt.internal.compiler.parser.Parser that handles all semantic actions dispatches.</td> |
<td>Contains the method consumeRule(int) of class org.eclipse.jdt.internal.compiler.parser.Parser, which handles all semantic action dispatches.</td> |
| 143 |
</tr> |
</tr> |
| 144 |
<tr> |
<tr> |
| 145 |
<th VALIGN=top align=left>javahdr.java</th> |
<th VALIGN=top align=left>javahdr.java</th> |
| 146 |
<td>This files is used to generate the resources files.</td> |
<td>Used to generate the resources files.</td> |
| 147 |
</tr> |
</tr> |
| 148 |
<tr> |
<tr> |
| 149 |
<th VALIGN=top align=left>javadcl.java</th> |
<th VALIGN=top align=left>javadcl.java</th> |
| 150 |
<td>This files is used to generate the resources files.</td> |
<td>Used to generate the resources files.</td> |
| 151 |
</tr> |
</tr> |
| 152 |
<tr> |
<tr> |
| 153 |
<th VALIGN=top align=left>javasym.java</th> |
<th VALIGN=top align=left>javasym.java</th> |
| 168 |
<ol> |
<ol> |
| 169 |
<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. |
| 170 |
</li> |
</li> |
| 171 |
<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 contents of the file <font color="#3366FF">javadef.java</font>. Don't copy the |
| 172 |
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> |
| 173 |
|
<li>Similarly, update the class <font color="#3366FF">org.eclipse.jdt.internal.compiler.parser.TerminalTokens</font> with the contents of the file <font color="#3366FF">javasym.java</font>. |
| 174 |
<li>The last step is to update the resource files:<br> |
<li>The last step is to update the resource files:<br> |
| 175 |
Copy the jdtcore.jar file in d:\temp. Compile this <A HREF="UpdateParserFiles.java">source</A> inside d:\temp. You will have a file UpdateParserFiles.class. |
Copy the jdtcore.jar file in d:\temp. Compile this <A HREF="UpdateParserFiles.java">source</A> inside d:\temp. You will have a file UpdateParserFiles.class. |
| 176 |
Then run the following command-line: |
Then run the following command-line: |