/[classpath]/gjdoc/src/gnu/classpath/tools/gjdoc/Parser.java
ViewVC logotype

Diff of /gjdoc/src/gnu/classpath/tools/gjdoc/Parser.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by julian, Thu Jan 16 21:45:02 2003 UTC revision 1.8 by julian, Mon Nov 22 12:42:22 2004 UTC
# Line 288  import com.sun.javadoc.*; Line 288  import com.sun.javadoc.*;
288           if (parser.addComments)           if (parser.addComments)
289              execDoc.setRawCommentText(parser.getLastComment());              execDoc.setRawCommentText(parser.getLastComment());
290    
291             parser.setLastComment(null);
292    
293           if (execDoc.isIncluded()) {           if (execDoc.isIncluded()) {
294    
295              if (execDoc.isMethod()) {              if (execDoc.isMethod()) {
# Line 304  import com.sun.javadoc.*; Line 306  import com.sun.javadoc.*;
306              parser.ctx.maybeSerMethodList.add(execDoc);              parser.ctx.maybeSerMethodList.add(execDoc);
307           }           }
308    
          parser.setLastComment(null);  
309           return endIndex;           return endIndex;
310        }        }
311    
# Line 436  import com.sun.javadoc.*; Line 437  import com.sun.javadoc.*;
437           parser.classOpened(source, startIndex, endIndex);           parser.classOpened(source, startIndex, endIndex);
438           if (parser.addComments)           if (parser.addComments)
439              parser.ctx.classDoc.setRawCommentText(parser.getLastComment());              parser.ctx.classDoc.setRawCommentText(parser.getLastComment());
440             parser.setLastComment(null);
441    
442           int rc=parser.parse(source, endIndex, parser.classLevelComponents);           int rc=parser.parse(source, endIndex, parser.classLevelComponents);
          parser.setLastComment(null);  
443           return rc;           return rc;
444        }        }
445    
# Line 504  public class Parser { Line 505  public class Parser {
505    
506     private static final int READ_BUFFER_SIZE = 512;     private static final int READ_BUFFER_SIZE = 512;
507    
508     static char[] loadFile(File file) throws IOException {     static char[] loadFile(File file, String encoding) throws IOException {
509        StringWriter writer=new StringWriter();        StringWriter writer = new StringWriter();
510        FileReader reader=new FileReader(file);        FileInputStream in = new FileInputStream(file);
511          Reader reader;
512          if (null != encoding) {
513             reader = new InputStreamReader(in, encoding);
514          }
515          else {
516             reader = new InputStreamReader(in);
517          }
518        char[] buffer = new char[READ_BUFFER_SIZE];        char[] buffer = new char[READ_BUFFER_SIZE];
519        int nread;        int nread;
520        while ((nread=reader.read(buffer))>=0) {        while ((nread=reader.read(buffer))>=0) {
# Line 553  public class Parser { Line 561  public class Parser {
561    
562     static Set processedFiles = new HashSet();     static Set processedFiles = new HashSet();
563    
564     void processSourceFile(File file, boolean addComments) throws IOException, ParseException {     void processSourceFile(File file, boolean addComments, String encoding) throws IOException, ParseException {
565    
566        this.addComments=addComments;        this.addComments=addComments;
567    
# Line 571  public class Parser { Line 579  public class Parser {
579            
580        currentLine = 1;        currentLine = 1;
581    
582        char[] source = loadFile(file);        char[] source = loadFile(file, encoding);
583        parse(source, 0, sourceLevelComponents);        parse(source, 0, sourceLevelComponents);
584    
585        ClassDoc[] importedClasses=(ClassDoc[])importedClassesList.toArray(new ClassDoc[0]);        ClassDoc[] importedClasses=(ClassDoc[])importedClassesList.toArray(new ClassDoc[0]);
# Line 630  public class Parser { Line 638  public class Parser {
638        return rc;        return rc;
639     }     }
640    
641     public void processSourceDir(File dir) throws IOException, ParseException {     public void processSourceDir(File dir, String encoding) throws IOException, ParseException {
642        Debug.log(9,"Processing "+dir.getParentFile().getName()+"."+dir.getName());        Debug.log(9,"Processing "+dir.getParentFile().getName()+"."+dir.getName());
643        File[] files=dir.listFiles();        File[] files=dir.listFiles();
644        if (null!=files) {        if (null!=files) {
645           for (int i=0; i<files.length; ++i) {           for (int i=0; i<files.length; ++i) {
646              if (files[i].getName().toLowerCase().endsWith(".java")) {              if (files[i].getName().toLowerCase().endsWith(".java")) {
647                 processSourceFile(files[i], true);                 processSourceFile(files[i], true, encoding);
648              }              }
649           }           }
650        }        }
# Line 722  public class Parser { Line 730  public class Parser {
730     }     }
731        
732     String lastComment = null;     String lastComment = null;
733     PackageDocImpl currentPackage = null;     PackageDocImpl currentPackage = PackageDocImpl.DEFAULT_PACKAGE;
734     ClassDocImpl currentClass = null;     ClassDocImpl currentClass = null;
735     List ordinaryClassesList  = new ArrayList();     List ordinaryClassesList  = new ArrayList();
736     List allClassesList       = new ArrayList();     List allClassesList       = new ArrayList();

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26