mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Content assist for array dimensions/indices in C.
This commit is contained in:
parent
22d8e3c713
commit
80830d7267
1 changed files with 25 additions and 2 deletions
|
@ -455,6 +455,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
consumedSemi = true;
|
consumedSemi = true;
|
||||||
break;
|
break;
|
||||||
case IToken.tLBRACE:
|
case IToken.tLBRACE:
|
||||||
|
case IToken.tEOC:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throwBacktrack(firstOffset, LA(1).getEndOffset() - firstOffset);
|
throwBacktrack(firstOffset, LA(1).getEndOffset() - firstOffset);
|
||||||
|
@ -932,7 +933,18 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
// array access
|
// array access
|
||||||
consume(IToken.tLBRACKET);
|
consume(IToken.tLBRACKET);
|
||||||
secondExpression = expression();
|
secondExpression = expression();
|
||||||
int last = consume(IToken.tRBRACKET).getEndOffset();
|
int last;
|
||||||
|
switch (LT(1)) {
|
||||||
|
case IToken.tRBRACKET:
|
||||||
|
last = consume(IToken.tRBRACKET).getEndOffset();
|
||||||
|
break;
|
||||||
|
case IToken.tEOC:
|
||||||
|
last = Integer.MAX_VALUE;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw backtrack;
|
||||||
|
}
|
||||||
|
|
||||||
IASTArraySubscriptExpression s = createArraySubscriptExpression();
|
IASTArraySubscriptExpression s = createArraySubscriptExpression();
|
||||||
((ASTNode) s).setOffsetAndLength(((ASTNode) firstExpression)
|
((ASTNode) s).setOffsetAndLength(((ASTNode) firstExpression)
|
||||||
.getOffset(), last
|
.getOffset(), last
|
||||||
|
@ -2108,7 +2120,18 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
else
|
else
|
||||||
exp = constantExpression();
|
exp = constantExpression();
|
||||||
}
|
}
|
||||||
int lastOffset = consume(IToken.tRBRACKET).getEndOffset();
|
int lastOffset;
|
||||||
|
switch (LT(1)) {
|
||||||
|
case IToken.tRBRACKET:
|
||||||
|
lastOffset = consume(IToken.tRBRACKET).getEndOffset();
|
||||||
|
break;
|
||||||
|
case IToken.tEOC:
|
||||||
|
lastOffset = Integer.MAX_VALUE;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw backtrack;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
IASTArrayModifier arrayMod = null;
|
IASTArrayModifier arrayMod = null;
|
||||||
if (!(isStatic || isRestrict || isConst || isVolatile || isVarSized))
|
if (!(isStatic || isRestrict || isConst || isVolatile || isVarSized))
|
||||||
|
|
Loading…
Add table
Reference in a new issue