1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Cleaned up translationUnit() backtracking.

This commit is contained in:
John Camelon 2004-05-25 18:04:24 +00:00
parent 9eda3a1323
commit 7b873687b6

View file

@ -141,7 +141,7 @@ public abstract class Parser extends ExpressionParser implements IParser
return; return;
} }
IToken lastBacktrack = null; int lastBacktrack = -1;
while (true) while (true)
{ {
@ -163,7 +163,7 @@ public abstract class Parser extends ExpressionParser implements IParser
{ {
// Mark as failure and try to reach a recovery point // Mark as failure and try to reach a recovery point
failParse(); failParse();
if (lastBacktrack != null && lastBacktrack == LA(1)) if (lastBacktrack != -1 && lastBacktrack == LA(1).hashCode())
{ {
// we haven't progressed from the last backtrack // we haven't progressed from the last backtrack
// try and find tne next definition // try and find tne next definition
@ -172,7 +172,7 @@ public abstract class Parser extends ExpressionParser implements IParser
else else
{ {
// start again from here // start again from here
lastBacktrack = LA(1); lastBacktrack = LA(1).hashCode();
} }
} }
catch (EndOfFileException e) catch (EndOfFileException e)