mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-26 02:15:31 +02:00
[98777] Fixed up handling of EOC in do statements.
This commit is contained in:
parent
b66ffc6cd2
commit
f2c74bc84e
1 changed files with 24 additions and 7 deletions
|
@ -1879,10 +1879,23 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
int startOffset;
|
int startOffset;
|
||||||
startOffset = consume(IToken.t_do).getOffset();
|
startOffset = consume(IToken.t_do).getOffset();
|
||||||
IASTStatement do_body = statement();
|
IASTStatement do_body = statement();
|
||||||
consume(IToken.t_while);
|
|
||||||
consume(IToken.tLPAREN);
|
IASTExpression do_condition = null;
|
||||||
IASTExpression do_condition = condition();
|
if (LT(1) != IToken.tEOC) {
|
||||||
int lastOffset = consume(IToken.tRPAREN).getEndOffset();
|
consume(IToken.t_while);
|
||||||
|
consume(IToken.tLPAREN);
|
||||||
|
do_condition = condition();
|
||||||
|
}
|
||||||
|
|
||||||
|
int lastOffset;
|
||||||
|
switch (LT(1)) {
|
||||||
|
case IToken.tRPAREN:
|
||||||
|
case IToken.tEOC:
|
||||||
|
lastOffset = consume().getEndOffset();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw backtrack;
|
||||||
|
}
|
||||||
|
|
||||||
IASTDoStatement do_statement = createDoStatement();
|
IASTDoStatement do_statement = createDoStatement();
|
||||||
((ASTNode) do_statement).setOffsetAndLength(startOffset, lastOffset
|
((ASTNode) do_statement).setOffsetAndLength(startOffset, lastOffset
|
||||||
|
@ -1890,9 +1903,13 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
do_statement.setBody(do_body);
|
do_statement.setBody(do_body);
|
||||||
do_body.setParent(do_statement);
|
do_body.setParent(do_statement);
|
||||||
do_body.setPropertyInParent(IASTDoStatement.BODY);
|
do_body.setPropertyInParent(IASTDoStatement.BODY);
|
||||||
do_statement.setCondition(do_condition);
|
|
||||||
do_condition.setParent(do_statement);
|
if (do_condition != null) {
|
||||||
do_condition.setPropertyInParent(IASTDoStatement.CONDITION);
|
do_statement.setCondition(do_condition);
|
||||||
|
do_condition.setParent(do_statement);
|
||||||
|
do_condition.setPropertyInParent(IASTDoStatement.CONDITION);
|
||||||
|
}
|
||||||
|
|
||||||
return do_statement;
|
return do_statement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue