Clover coverage report - DynamicJava Test Coverage (dynamicjava-20130622-r5436)
Coverage timestamp: Sat Jun 22 2013 03:01:29 CDT
file stats: LOC: 128   Methods: 6
NCLOC: 68   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
JavaCCParser.java 0% 16.7% 33.3% 17.5%
coverage coverage
 1    /*
 2    * DynamicJava - Copyright (C) 1999-2001
 3    *
 4    * Permission is hereby granted, free of charge, to any person obtaining a
 5    * copy of this software and associated documentation files
 6    * (the "Software"), to deal in the Software without restriction, including
 7    * without limitation the rights to use, copy, modify, merge, publish,
 8    * distribute, sublicense, and/or sell copies of the Software, and to permit
 9    * persons to whom the Software is furnished to do so, subject to the
 10    * following conditions:
 11    * The above copyright notice and this permission notice shall be included
 12    * in all copies or substantial portions of the Software.
 13    *
 14    * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 15    * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 16    * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 17    * IN NO EVENT SHALL DYADE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 18    * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 19    * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 20    * DEALINGS IN THE SOFTWARE.
 21    *
 22    * Except as contained in this notice, the name of Dyade shall not be
 23    * used in advertising or otherwise to promote the sale, use or other
 24    * dealings in this Software without prior written authorization from
 25    * Dyade.
 26    *
 27    */
 28   
 29    package koala.dynamicjava.parser.wrapper;
 30   
 31    import java.io.*;
 32    import java.util.*;
 33   
 34    import edu.rice.cs.dynamicjava.Options;
 35   
 36    import koala.dynamicjava.parser.impl.*;
 37    import koala.dynamicjava.tree.*;
 38   
 39    /**
 40    * The instances of this class represents a parser
 41    * generated with JavaCC.
 42    *
 43    * @author Stephane Hillion
 44    * @version 1.0 - 1999/06/12
 45    */
 46   
 47    public class JavaCCParser implements SourceCodeParser {
 48    /**
 49    * The parser
 50    */
 51    private final Parser _parser;
 52    private final File _f;
 53   
 54  0 public JavaCCParser(InputStream is, File f, Options opt) {
 55  0 _parser = new Parser(is);
 56  0 _parser.setFile(f);
 57  0 _parser.setOptions(opt);
 58  0 _f = f;
 59    }
 60   
 61  0 public JavaCCParser(InputStream is, Options opt) {
 62  0 _parser = new Parser(is);
 63  0 _parser.setOptions(opt);
 64  0 _f = null;
 65    }
 66   
 67  0 public JavaCCParser(Reader r, File f, Options opt) {
 68  0 _parser = new Parser(r);
 69  0 _parser.setFile(f);
 70  0 _parser.setOptions(opt);
 71  0 _f = f;
 72    }
 73   
 74  732 public JavaCCParser(Reader r, Options opt) {
 75  732 _parser = new Parser(r);
 76  732 _parser.setOptions(opt);
 77  732 _f = null;
 78    }
 79   
 80    /**
 81    * Parses top level statements
 82    * @return a list of nodes
 83    * @see koala.dynamicjava.tree.Node
 84    */
 85  732 public List<Node> parseStream() {
 86  732 try {
 87  732 return _parser.parseStream();
 88    }
 89    catch (ParseException e) {
 90  0 throw new ParseError(e, _f);
 91    }
 92    catch (TokenMgrError e) {
 93  0 throw new ParseError(e, SourceInfo.point(_f, 0, 0));
 94    }
 95    catch (Error e) {
 96    // JavaCharStream does not use a useful exception type for escape character errors
 97  0 String msg = e.getMessage();
 98  0 if (msg != null && msg.startsWith("Invalid escape character")) {
 99  0 throw new ParseError(e, SourceInfo.point(_f, 0, 0));
 100    }
 101  0 else { throw e; }
 102    }
 103    }
 104   
 105    /**
 106    * Parses a library file
 107    * @see koala.dynamicjava.tree.Node
 108    */
 109  0 public CompilationUnit parseCompilationUnit() {
 110  0 try {
 111  0 return _parser.parseCompilationUnit();
 112    }
 113    catch (ParseException e) {
 114  0 throw new ParseError(e, _f);
 115    }
 116    catch (TokenMgrError e) {
 117  0 throw new ParseError(e, SourceInfo.point(_f, 0, 0));
 118    }
 119    catch (Error e) {
 120    // JavaCharStream does not use a useful exception type for escape character errors
 121  0 String msg = e.getMessage();
 122  0 if (msg != null && msg.startsWith("Invalid escape character")) {
 123  0 throw new ParseError(e, SourceInfo.point(_f, 0, 0));
 124    }
 125  0 else { throw e; }
 126    }
 127    }
 128    }