Changeset 25 for branches/t3e-tools/t3q/src/org/etsi
- Timestamp:
- 08/24/10 18:11:38 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/t3e-tools/t3q/src/org/etsi/t3q/T3Q.java
r16 r25 7 7 import java.util.HashMap; 8 8 import java.util.List; 9 10 import javax.sound.midi.SysexMessage; 9 11 10 12 import org.apache.commons.cli.CommandLine; … … 169 171 + analyzer.getFilename(); 170 172 //TODO: adapt to T3D as well 171 String tree = "";172 tree = LocationAST.dumpTree((LocationAST)analyzer.getParser().getAST(),1,tree);173 173 if (getLogLevel().equals(LogLevel.DEBUG)) { 174 String tree = ""; 175 tree = LocationAST.dumpTree((LocationAST)analyzer.getParser().getAST(),1,tree); 174 176 exceptionMessage+="\n" + 175 177 "Parse-tree trace:\n" + … … 183 185 } catch (TTCN3ParserException e) { 184 186 System.err.println(e.getLocalizedMessage()); 185 for (int i1 = 0; i1 < analyzer.getExceptions() 186 .size(); i1++) { 187 System.err.println("Line " 188 + analyzer.getExceptions().get(i1) 189 .getLine() 190 + ": " 191 + analyzer.getExceptions().get(i1) 192 .getMessage()); 193 } 194 // e.printStackTrace(); 187 dumpParserExceptions(analyzer); 195 188 } 196 189 } … … 260 253 // parsing error 261 254 System.err.println(e.getLocalizedMessage()); 262 for (int i = 0; i < analyzer.getExceptions().size(); i++) { 263 System.err.println("Line " 264 + analyzer.getExceptions().get(i).getLine() + ": " 265 + analyzer.getExceptions().get(i).getMessage()); 266 } 255 dumpParserExceptions(analyzer); 267 256 // TODO: Isolate different steps and implement a recovery mechanism: 268 257 269 258 } 270 259 260 } 261 262 private void dumpParserExceptions(TTCN3Analyzer analyzer) { 263 for (RecognitionException re : analyzer.getExceptions()) { 264 System.err.println(" Cause:\tLine " 265 + re.getLine() 266 + ": " 267 + re.getMessage()); 268 269 String className = re.getStackTrace()[0].getClassName(); 270 System.err.println(" Parser:\t" 271 + className.substring(className.lastIndexOf(".")+1)); 272 System.err.println(" Rule: \t" 273 + re.getStackTrace()[0].getMethodName()); 274 } 271 275 } 272 276 … … 342 346 // System.out.println("OutputPath: \t\t"+outputPath); 343 347 // System.out.println("****************************"); 344 //System.out.println(formatted);348 System.out.println(formatted); 345 349 // System.out.println(outputPath); 346 MiscTools.writeFile(outputPath, formatted);350 // MiscTools.writeFile(outputPath, formatted); 347 351 System.out.println("File \""+outputPath+"\" written successfully!"); 348 352 349 353 } catch (RecognitionException e1) { 350 System.err.println("Recognition exception:"); 351 System.err.println(e1.getLocalizedMessage()); 354 System.err.println("TTCN-3 Recognition exception: "+e1.getLocalizedMessage()); 355 System.err.println(" Cause:\tLine " 356 + e1.getLine() 357 + ": " 358 + e1.getMessage()); 359 360 String className = e1.getStackTrace()[0].getClassName(); 361 System.err.println(" Parser:\t" 362 + className.substring(className.lastIndexOf(".")+1)); 363 System.err.println(" Rule/Method: \t" 364 + e1.getStackTrace()[0].getMethodName()); 365 352 366 } catch (TokenStreamException e) { 353 367 System.err.println("Token stream exception:");
Note: See TracChangeset
for help on using the changeset viewer.