Removed some duplicate code, as I also feel the pain. I like the patch, but

I question using the Java14 lexer/recognizer first. Is this because most of
the time it will succeed (especially with 1.4 source:-). Be great if a
comment could be added to the code.
This commit is contained in:
Oliver Burn 2002-03-14 10:20:46 +00:00
parent e2ec464f27
commit b671e6bb1c
1 changed files with 3 additions and 8 deletions

View File

@ -229,10 +229,10 @@ public class Checker
try {
fireFileStarted(aFileName);
final String[] lines = getLines(aFileName);
final Reader sar = new StringArrayReader(lines);
VerifierSingleton.getInstance().clearMessages();
VerifierSingleton.getInstance().setLines(lines);
try {
VerifierSingleton.getInstance().clearMessages();
VerifierSingleton.getInstance().setLines(lines);
final Reader sar = new StringArrayReader(lines);
final GeneratedJava14Lexer jl = new GeneratedJava14Lexer(sar);
jl.setFilename(aFileName);
final GeneratedJava14Recognizer jr =
@ -242,17 +242,12 @@ public class Checker
jr.compilationUnit();
}
catch (RecognitionException re) {
// Parsing might have failed because the checked
// filecontains "assert" statement. Retry with a
// grammar that treats "assert" as an identifier
// and not as a keyword
// Arghh - the pain - duplicate code!
VerifierSingleton.getInstance().clearMessages();
VerifierSingleton.getInstance().setLines(lines);
final Reader sar = new StringArrayReader(lines);
final GeneratedJavaLexer jl = new GeneratedJavaLexer(sar);
jl.setFilename(aFileName);
final GeneratedJavaRecognizer jr =