Java Reference
In-Depth Information
1 import java.io.InputStreamReader;
2 import java.io.IOException;
3 import java.io.FileReader;
4 import java.io.Reader;
5 import java.util.Set
6 import java.util.TreeMap;
7 import java.util.List;
8 import java.util.ArrayList;
9 import java.util.Iterator;
10 import java.util.Map;
11
12 // Xref class interface: generate cross-reference
13 //
14 // CONSTRUCTION: with a Reader object
15 //
16 // ******************PUBLIC OPERATIONS***********************
17 // void generateCrossReference( ) --> Name says it all ...
18 // ******************ERRORS**********************************
19 // Error checking on comments and quotes is performed
20
21 public class Xref
22 {
23 public Xref( Reader inStream )
24 { tok = new Tokenizer( inStream ); }
25
26 public void generateCrossReference( )
27 { /* Figure 12.30 */ }
28
29 private Tokenizer tok; // tokenizer object
30 }
figure 12.26
The Xref class
skeleton
1 /**
2 * Return true if ch can be part of a Java identifier
3 */
4 private static final boolean isIdChar( char ch )
5 {
6 return Character.isJavaIdentifierPart( ch );
7 }
figure 12.27
A routine for testing
whether a character
could be part of an
identifier
The getNextID routine shown in Figure 12.29 is similar to the routine
shown in Figure 11.7. The difference is that here at line 17, if the first charac-
ter of an identifier is encountered, we call getRemainingString to return the
Search WWH ::




Custom Search