Skip to content

Commit 0a882b8

Browse files
author
dlsmith
committed
Fixed handling of TokenMgrErrors in parser
git-svn-id: file:///tmp/test-svn/trunk@4656 fe72c1cf-3628-48e9-8b72-1c46755d3cff
1 parent b9385cb commit 0a882b8

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

dynamicjava/src/koala/dynamicjava/parser/wrapper/JavaCCParser.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,11 @@ public SourceCodeParser createParser(Reader r, String fname) {
9494
public List<Node> parseStream() {
9595
try {
9696
return parser.parseStream();
97-
} catch (ParseException e) {
97+
}
98+
catch (ParseException e) {
99+
throw new ParseError(e);
100+
}
101+
catch (TokenMgrError e) {
98102
throw new ParseError(e);
99103
}
100104
}
@@ -106,7 +110,11 @@ public List<Node> parseStream() {
106110
public List<Node> parseCompilationUnit() {
107111
try {
108112
return parser.parseCompilationUnit();
109-
} catch (ParseException e) {
113+
}
114+
catch (ParseException e) {
115+
throw new ParseError(e);
116+
}
117+
catch (TokenMgrError e) {
110118
throw new ParseError(e);
111119
}
112120
}

dynamicjava/src/koala/dynamicjava/parser/wrapper/ParseError.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131

3232
import koala.dynamicjava.parser.impl.ParseException;
33+
import koala.dynamicjava.parser.impl.TokenMgrError;
3334

3435
/**
3536
* This error is thrown when an unexpected error append while
@@ -92,6 +93,10 @@ public ParseError(ParseException e) {
9293
pe = e;
9394
}
9495

96+
public ParseError(TokenMgrError e) {
97+
this(e.getMessage(), "", -1, -1);
98+
}
99+
95100
/**
96101
* Constructs an <code>ExecutionError</code> with the specified
97102
* detail message, filename, line and column.

0 commit comments

Comments
 (0)