mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
[98346] Added handling of EOC to enumSpecifier.
This commit is contained in:
parent
2ecabcefbe
commit
a90cfa1442
1 changed files with 18 additions and 6 deletions
|
@ -1243,7 +1243,14 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
|||
name.setPropertyInParent(IASTEnumerationSpecifier.ENUMERATION_NAME);
|
||||
|
||||
consume(IToken.tLBRACE);
|
||||
while (LT(1) != IToken.tRBRACE) {
|
||||
enumLoop: while (true) {
|
||||
|
||||
switch (LT(1)) {
|
||||
case IToken.tRBRACE:
|
||||
case IToken.tEOC:
|
||||
break enumLoop;
|
||||
}
|
||||
|
||||
IASTName enumeratorName = null;
|
||||
|
||||
int lastOffset = 0;
|
||||
|
@ -1283,10 +1290,16 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
|||
|
||||
break;
|
||||
}
|
||||
if (LT(1) != IToken.tCOMMA) {
|
||||
|
||||
switch (LT(1)) {
|
||||
case IToken.tCOMMA:
|
||||
case IToken.tEOC:
|
||||
consume();
|
||||
break;
|
||||
default:
|
||||
throwBacktrack(mark.getOffset(), mark.getLength());
|
||||
}
|
||||
|
||||
|
||||
enumerator = createEnumerator();
|
||||
enumerator.setName(enumeratorName);
|
||||
((ASTNode) enumerator).setOffsetAndLength(
|
||||
|
@ -1305,10 +1318,9 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
|||
enumerator.setParent(result);
|
||||
enumerator
|
||||
.setPropertyInParent(IASTEnumerationSpecifier.ENUMERATOR);
|
||||
|
||||
consume(IToken.tCOMMA);
|
||||
}
|
||||
int lastOffset = consume(IToken.tRBRACE).getEndOffset();
|
||||
|
||||
int lastOffset = consume().getEndOffset();
|
||||
((ASTNode) result).setLength(lastOffset - startOffset);
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue