protected void writeArrayModifier(IASTArrayModifier modifier) { scribe.print('['); IASTExpression ex = modifier.getConstantExpression(); if (ex != null) { ex.accept(visitor); } scribe.print(']'); }
private IASTDeclarator createDeclarator( INodeFactory nodeFactory, IASTDeclarator sourceDeclarator, String name) { IASTName astName = name != null ? nodeFactory.newName(name.toCharArray()) : nodeFactory.newName(); IASTDeclarator declarator; if (sourceDeclarator instanceof IASTArrayDeclarator) { IASTArrayDeclarator arrDeclarator = (IASTArrayDeclarator) sourceDeclarator; IASTArrayDeclarator arrayDeclarator = nodeFactory.newArrayDeclarator(astName); IASTArrayModifier[] arrayModifiers = arrDeclarator.getArrayModifiers(); for (IASTArrayModifier arrayModifier : arrayModifiers) { arrayDeclarator.addArrayModifier(arrayModifier.copy(CopyStyle.withLocations)); } declarator = arrayDeclarator; } else { declarator = nodeFactory.newDeclarator(astName); } for (IASTPointerOperator pointerOp : sourceDeclarator.getPointerOperators()) { declarator.addPointerOperator(pointerOp.copy(CopyStyle.withLocations)); } return declarator; }