mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-13 19:25:38 +02:00
[273326] [XLC Parser] support variable length arrays in C++
This commit is contained in:
parent
6262b1fe81
commit
bf83a3a2a2
16 changed files with 3417 additions and 3025 deletions
|
@ -2,6 +2,7 @@
|
||||||
<?eclipse version="3.2"?>
|
<?eclipse version="3.2"?>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
|
||||||
|
<!--
|
||||||
<extension point="org.eclipse.cdt.core.language">
|
<extension point="org.eclipse.cdt.core.language">
|
||||||
<language
|
<language
|
||||||
class="org.eclipse.cdt.core.dom.lrparser.c99.C99Language"
|
class="org.eclipse.cdt.core.dom.lrparser.c99.C99Language"
|
||||||
|
@ -25,5 +26,6 @@
|
||||||
name="LR GPP">
|
name="LR GPP">
|
||||||
</language>
|
</language>
|
||||||
</extension>
|
</extension>
|
||||||
|
-->
|
||||||
|
|
||||||
</plugin>
|
</plugin>
|
|
@ -4,6 +4,7 @@ Bundle-Name: Xlc
|
||||||
Bundle-SymbolicName: org.eclipse.cdt.core.lrparser.xlc;singleton:=true
|
Bundle-SymbolicName: org.eclipse.cdt.core.lrparser.xlc;singleton:=true
|
||||||
Bundle-Version: 1.0.0
|
Bundle-Version: 1.0.0
|
||||||
Bundle-RequiredExecutionEnvironment: J2SE-1.5
|
Bundle-RequiredExecutionEnvironment: J2SE-1.5
|
||||||
|
Bundle-Localization: plugin
|
||||||
Require-Bundle: org.eclipse.cdt.core;bundle-version="5.1.0",
|
Require-Bundle: org.eclipse.cdt.core;bundle-version="5.1.0",
|
||||||
org.eclipse.cdt.core.lrparser;bundle-version="5.1.0",
|
org.eclipse.cdt.core.lrparser;bundle-version="5.1.0",
|
||||||
org.eclipse.core.runtime;bundle-version="3.5.0",
|
org.eclipse.core.runtime;bundle-version="3.5.0",
|
||||||
|
@ -17,6 +18,7 @@ Export-Package: org.eclipse.cdt.core.lrparser.xlc,
|
||||||
org.eclipse.cdt.core.lrparser.xlc.preferences,
|
org.eclipse.cdt.core.lrparser.xlc.preferences,
|
||||||
org.eclipse.cdt.internal.core.lrparser.xlc.ast,
|
org.eclipse.cdt.internal.core.lrparser.xlc.ast,
|
||||||
org.eclipse.cdt.internal.core.lrparser.xlc.c,
|
org.eclipse.cdt.internal.core.lrparser.xlc.c,
|
||||||
org.eclipse.cdt.internal.core.lrparser.xlc.cpp
|
org.eclipse.cdt.internal.core.lrparser.xlc.cpp,
|
||||||
|
org.eclipse.cdt.internal.core.lrparser.xlc.ui.preferences
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Bundle-Activator: org.eclipse.cdt.core.lrparser.xlc.activator.XlcParserPlugin
|
Bundle-Activator: org.eclipse.cdt.core.lrparser.xlc.activator.XlcParserPlugin
|
||||||
|
|
|
@ -74,4 +74,29 @@ specifier_qualifier
|
||||||
::= 'typedef'
|
::= 'typedef'
|
||||||
/. $Build consumeToken(); $EndBuild ./
|
/. $Build consumeToken(); $EndBuild ./
|
||||||
|
|
||||||
|
|
||||||
|
array_modifier
|
||||||
|
::= '[' <openscope-ast> array_modifier_type_qualifiers ']'
|
||||||
|
/. $Build consumeDirectDeclaratorModifiedArrayModifier(false, false, true, false); $EndBuild ./
|
||||||
|
| '[' <openscope-ast> array_modifier_type_qualifiers assignment_expression ']'
|
||||||
|
/. $Build consumeDirectDeclaratorModifiedArrayModifier(false, false, true, true); $EndBuild ./
|
||||||
|
| '[' 'static' assignment_expression ']'
|
||||||
|
/. $Build consumeDirectDeclaratorModifiedArrayModifier(true, false, false, true); $EndBuild ./
|
||||||
|
| '[' 'static' <openscope-ast> array_modifier_type_qualifiers assignment_expression ']'
|
||||||
|
/. $Build consumeDirectDeclaratorModifiedArrayModifier(true, false, true, true); $EndBuild ./
|
||||||
|
| '[' <openscope-ast> array_modifier_type_qualifiers 'static' assignment_expression ']'
|
||||||
|
/. $Build consumeDirectDeclaratorModifiedArrayModifier(true, false, true, true); $EndBuild ./
|
||||||
|
| '[' '*' ']'
|
||||||
|
/. $Build consumeDirectDeclaratorModifiedArrayModifier(false, true, false, false); $EndBuild ./
|
||||||
|
| '[' <openscope-ast> array_modifier_type_qualifiers '*' ']'
|
||||||
|
/. $Build consumeDirectDeclaratorModifiedArrayModifier(false, true, true, false); $EndBuild ./
|
||||||
|
|
||||||
|
|
||||||
|
array_modifier_type_qualifiers
|
||||||
|
::= type_qualifier_list
|
||||||
|
|
||||||
|
type_qualifier_list
|
||||||
|
::= cv_qualifier
|
||||||
|
| type_qualifier_list cv_qualifier
|
||||||
|
|
||||||
$End
|
$End
|
|
@ -12,10 +12,14 @@ package org.eclipse.cdt.core.lrparser.xlc.action;
|
||||||
|
|
||||||
import lpg.lpgjavaruntime.IToken;
|
import lpg.lpgjavaruntime.IToken;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
|
import org.eclipse.cdt.core.dom.lrparser.action.ITokenMap;
|
||||||
import org.eclipse.cdt.core.dom.lrparser.action.ITokenStream;
|
import org.eclipse.cdt.core.dom.lrparser.action.ITokenStream;
|
||||||
import org.eclipse.cdt.core.dom.lrparser.action.ScopedStack;
|
import org.eclipse.cdt.core.dom.lrparser.action.ScopedStack;
|
||||||
|
import org.eclipse.cdt.core.dom.lrparser.action.TokenMap;
|
||||||
import org.eclipse.cdt.core.dom.lrparser.action.cpp.ICPPSecondaryParserFactory;
|
import org.eclipse.cdt.core.dom.lrparser.action.cpp.ICPPSecondaryParserFactory;
|
||||||
import org.eclipse.cdt.core.dom.lrparser.action.gnu.GPPBuildASTParserAction;
|
import org.eclipse.cdt.core.dom.lrparser.action.gnu.GPPBuildASTParserAction;
|
||||||
|
import org.eclipse.cdt.core.lrparser.xlc.ast.IXlcCPPASTModifiedArrayModifier;
|
||||||
import org.eclipse.cdt.core.lrparser.xlc.ast.IXlcCPPASTVectorTypeSpecifier;
|
import org.eclipse.cdt.core.lrparser.xlc.ast.IXlcCPPASTVectorTypeSpecifier;
|
||||||
import org.eclipse.cdt.core.lrparser.xlc.ast.IXlcCPPNodeFactory;
|
import org.eclipse.cdt.core.lrparser.xlc.ast.IXlcCPPNodeFactory;
|
||||||
import org.eclipse.cdt.internal.core.lrparser.xlc.cpp.XlcCPPParsersym;
|
import org.eclipse.cdt.internal.core.lrparser.xlc.cpp.XlcCPPParsersym;
|
||||||
|
@ -23,6 +27,7 @@ import org.eclipse.cdt.internal.core.lrparser.xlc.cpp.XlcCPPParsersym;
|
||||||
public class XlcCPPBuildASTParserAction extends GPPBuildASTParserAction {
|
public class XlcCPPBuildASTParserAction extends GPPBuildASTParserAction {
|
||||||
|
|
||||||
private IXlcCPPNodeFactory nodeFactory;
|
private IXlcCPPNodeFactory nodeFactory;
|
||||||
|
private final ITokenMap tokenMap;
|
||||||
|
|
||||||
|
|
||||||
public XlcCPPBuildASTParserAction(ITokenStream parser,
|
public XlcCPPBuildASTParserAction(ITokenStream parser,
|
||||||
|
@ -30,6 +35,7 @@ public class XlcCPPBuildASTParserAction extends GPPBuildASTParserAction {
|
||||||
ICPPSecondaryParserFactory parserFactory) {
|
ICPPSecondaryParserFactory parserFactory) {
|
||||||
super(parser, astStack, nodeFactory, parserFactory);
|
super(parser, astStack, nodeFactory, parserFactory);
|
||||||
this.nodeFactory = nodeFactory;
|
this.nodeFactory = nodeFactory;
|
||||||
|
this.tokenMap = new TokenMap(XlcCPPParsersym.orderedTerminalSymbols, parser.getOrderedTerminalSymbols());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -41,7 +47,7 @@ public class XlcCPPBuildASTParserAction extends GPPBuildASTParserAction {
|
||||||
|
|
||||||
for(Object specifier : astStack.closeScope()) {
|
for(Object specifier : astStack.closeScope()) {
|
||||||
if(specifier instanceof IToken) {
|
if(specifier instanceof IToken) {
|
||||||
switch(((IToken)specifier).getKind()) {
|
switch(tokenMap.mapKind(((IToken)specifier).getKind())) {
|
||||||
case XlcCPPParsersym.TK_pixel :
|
case XlcCPPParsersym.TK_pixel :
|
||||||
declSpec.setPixel(true);
|
declSpec.setPixel(true);
|
||||||
continue;
|
continue;
|
||||||
|
@ -57,4 +63,34 @@ public class XlcCPPBuildASTParserAction extends GPPBuildASTParserAction {
|
||||||
astStack.push(declSpec);
|
astStack.push(declSpec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void consumeDirectDeclaratorModifiedArrayModifier(boolean isStatic,
|
||||||
|
boolean isVarSized, boolean hasTypeQualifierList, boolean hasAssignmentExpr) {
|
||||||
|
assert isStatic || isVarSized || hasTypeQualifierList;
|
||||||
|
|
||||||
|
IXlcCPPASTModifiedArrayModifier arrayModifier = nodeFactory.newModifiedArrayModifier(null);
|
||||||
|
|
||||||
|
// consume all the stuff between the square brackets into an array modifier
|
||||||
|
arrayModifier.setStatic(isStatic);
|
||||||
|
arrayModifier.setVariableSized(isVarSized);
|
||||||
|
|
||||||
|
if(hasAssignmentExpr)
|
||||||
|
arrayModifier.setConstantExpression((IASTExpression)astStack.pop());
|
||||||
|
|
||||||
|
if(hasTypeQualifierList)
|
||||||
|
collectArrayModifierTypeQualifiers(arrayModifier);
|
||||||
|
|
||||||
|
setOffsetAndLength(arrayModifier);
|
||||||
|
astStack.push(arrayModifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void collectArrayModifierTypeQualifiers(IXlcCPPASTModifiedArrayModifier arrayModifier) {
|
||||||
|
for(Object o : astStack.closeScope()) {
|
||||||
|
switch(tokenMap.mapKind(((IToken)o).getKind())) {
|
||||||
|
case XlcCPPParsersym.TK_const: arrayModifier.setConst(true); break;
|
||||||
|
case XlcCPPParsersym.TK_restrict: arrayModifier.setRestrict(true); break;
|
||||||
|
case XlcCPPParsersym.TK_volatile: arrayModifier.setVolatile(true); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,101 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2009 IBM Corporation and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* IBM Corporation - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.core.lrparser.xlc.ast;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allow C99 style variable length arrays in XL C++.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface IXlcCPPASTModifiedArrayModifier extends IASTArrayModifier {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is the const modifier used?
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public boolean isConst();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is the static modifier used?
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public boolean isStatic();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is the restrict modifier used?
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public boolean isRestrict();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is the volatile modifier used?
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public boolean isVolatile();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set true/false that the const modifier is used.
|
||||||
|
*
|
||||||
|
* @param value
|
||||||
|
* boolean
|
||||||
|
*/
|
||||||
|
public void setConst(boolean value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set true/false that the volatile modifier is used.
|
||||||
|
*
|
||||||
|
* @param value
|
||||||
|
* boolean
|
||||||
|
*/
|
||||||
|
public void setVolatile(boolean value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set true/false that the restrict modifier is used.
|
||||||
|
*
|
||||||
|
* @param value
|
||||||
|
* boolean
|
||||||
|
*/
|
||||||
|
public void setRestrict(boolean value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set true/false that the static modifier is used.
|
||||||
|
*
|
||||||
|
* @param value
|
||||||
|
* boolean
|
||||||
|
*/
|
||||||
|
public void setStatic(boolean value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is the array variable sized? ( used ... )
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public boolean isVariableSized();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the array to be variable sized dependent upon value.
|
||||||
|
*
|
||||||
|
* @param value
|
||||||
|
* boolean
|
||||||
|
*/
|
||||||
|
public void setVariableSized(boolean value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
public IXlcCPPASTModifiedArrayModifier copy();
|
||||||
|
|
||||||
|
}
|
|
@ -10,10 +10,12 @@ Corporation and others.
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.lrparser.xlc.ast;
|
package org.eclipse.cdt.core.lrparser.xlc.ast;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNodeFactory;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNodeFactory;
|
||||||
|
|
||||||
public interface IXlcCPPNodeFactory extends ICPPNodeFactory {
|
public interface IXlcCPPNodeFactory extends ICPPNodeFactory {
|
||||||
|
|
||||||
public IXlcCPPASTVectorTypeSpecifier newVectorTypeSpecifier();
|
public IXlcCPPASTVectorTypeSpecifier newVectorTypeSpecifier();
|
||||||
|
|
||||||
|
public IXlcCPPASTModifiedArrayModifier newModifiedArrayModifier(IASTExpression expr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ package org.eclipse.cdt.internal.core.lrparser.xlc.ast;
|
||||||
import org.eclipse.cdt.core.lrparser.xlc.ast.IXlcCASTVectorTypeSpecifier;
|
import org.eclipse.cdt.core.lrparser.xlc.ast.IXlcCASTVectorTypeSpecifier;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.c.CASTSimpleDeclSpecifier;
|
import org.eclipse.cdt.internal.core.dom.parser.c.CASTSimpleDeclSpecifier;
|
||||||
|
|
||||||
|
@SuppressWarnings("restriction")
|
||||||
public class XlcCASTVectorTypeSpecifier extends CASTSimpleDeclSpecifier implements IXlcCASTVectorTypeSpecifier {
|
public class XlcCASTVectorTypeSpecifier extends CASTSimpleDeclSpecifier implements IXlcCASTVectorTypeSpecifier {
|
||||||
|
|
||||||
private boolean isPixel;
|
private boolean isPixel;
|
||||||
|
|
|
@ -14,6 +14,7 @@ import org.eclipse.cdt.core.lrparser.xlc.ast.IXlcCASTVectorTypeSpecifier;
|
||||||
import org.eclipse.cdt.core.lrparser.xlc.ast.IXlcCNodeFactory;
|
import org.eclipse.cdt.core.lrparser.xlc.ast.IXlcCNodeFactory;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.c.CNodeFactory;
|
import org.eclipse.cdt.internal.core.dom.parser.c.CNodeFactory;
|
||||||
|
|
||||||
|
@SuppressWarnings("restriction")
|
||||||
public class XlcCNodeFactory extends CNodeFactory implements IXlcCNodeFactory {
|
public class XlcCNodeFactory extends CNodeFactory implements IXlcCNodeFactory {
|
||||||
|
|
||||||
private static final XlcCNodeFactory DEFAULT_INSTANCE = new XlcCNodeFactory();
|
private static final XlcCNodeFactory DEFAULT_INSTANCE = new XlcCNodeFactory();
|
||||||
|
|
|
@ -0,0 +1,91 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2009 IBM Corporation and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* IBM Corporation - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.internal.core.lrparser.xlc.ast;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
|
import org.eclipse.cdt.core.lrparser.xlc.ast.IXlcCPPASTModifiedArrayModifier;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTArrayModifier;
|
||||||
|
|
||||||
|
@SuppressWarnings("restriction")
|
||||||
|
public class XlcCPPASTModifiedArrayModifier extends CPPASTArrayModifier implements IXlcCPPASTModifiedArrayModifier {
|
||||||
|
|
||||||
|
private boolean isVolatile;
|
||||||
|
private boolean isRestrict;
|
||||||
|
private boolean isStatic;
|
||||||
|
private boolean isConst;
|
||||||
|
private boolean varSized;
|
||||||
|
|
||||||
|
public XlcCPPASTModifiedArrayModifier() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public XlcCPPASTModifiedArrayModifier(IASTExpression exp) {
|
||||||
|
super(exp);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public XlcCPPASTModifiedArrayModifier copy() {
|
||||||
|
IASTExpression exp = getConstantExpression();
|
||||||
|
XlcCPPASTModifiedArrayModifier copy = new XlcCPPASTModifiedArrayModifier(exp == null ? null : exp.copy());
|
||||||
|
copy.isVolatile = isVolatile;
|
||||||
|
copy.isRestrict = isRestrict;
|
||||||
|
copy.isStatic = isStatic;
|
||||||
|
copy.isConst = isConst;
|
||||||
|
copy.varSized = varSized;
|
||||||
|
copy.setOffsetAndLength(this);
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isConst() {
|
||||||
|
return isConst;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isStatic() {
|
||||||
|
return isStatic;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isRestrict() {
|
||||||
|
return isRestrict;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isVolatile() {
|
||||||
|
return isVolatile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConst(boolean value) {
|
||||||
|
assertNotFrozen();
|
||||||
|
this.isConst = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVolatile(boolean value) {
|
||||||
|
assertNotFrozen();
|
||||||
|
this.isVolatile = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRestrict(boolean value) {
|
||||||
|
assertNotFrozen();
|
||||||
|
this.isRestrict = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatic(boolean value) {
|
||||||
|
assertNotFrozen();
|
||||||
|
this.isStatic = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isVariableSized() {
|
||||||
|
return varSized;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVariableSized(boolean value) {
|
||||||
|
assertNotFrozen();
|
||||||
|
varSized = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -13,6 +13,7 @@ package org.eclipse.cdt.internal.core.lrparser.xlc.ast;
|
||||||
import org.eclipse.cdt.core.lrparser.xlc.ast.IXlcCPPASTVectorTypeSpecifier;
|
import org.eclipse.cdt.core.lrparser.xlc.ast.IXlcCPPASTVectorTypeSpecifier;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTSimpleDeclSpecifier;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTSimpleDeclSpecifier;
|
||||||
|
|
||||||
|
@SuppressWarnings("restriction")
|
||||||
public class XlcCPPASTVectorTypeSpecifier extends CPPASTSimpleDeclSpecifier implements IXlcCPPASTVectorTypeSpecifier {
|
public class XlcCPPASTVectorTypeSpecifier extends CPPASTSimpleDeclSpecifier implements IXlcCPPASTVectorTypeSpecifier {
|
||||||
|
|
||||||
private boolean isPixel;
|
private boolean isPixel;
|
||||||
|
|
|
@ -10,10 +10,13 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.lrparser.xlc.ast;
|
package org.eclipse.cdt.internal.core.lrparser.xlc.ast;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
|
import org.eclipse.cdt.core.lrparser.xlc.ast.IXlcCPPASTModifiedArrayModifier;
|
||||||
import org.eclipse.cdt.core.lrparser.xlc.ast.IXlcCPPASTVectorTypeSpecifier;
|
import org.eclipse.cdt.core.lrparser.xlc.ast.IXlcCPPASTVectorTypeSpecifier;
|
||||||
import org.eclipse.cdt.core.lrparser.xlc.ast.IXlcCPPNodeFactory;
|
import org.eclipse.cdt.core.lrparser.xlc.ast.IXlcCPPNodeFactory;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPNodeFactory;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPNodeFactory;
|
||||||
|
|
||||||
|
@SuppressWarnings("restriction")
|
||||||
public class XlcCPPNodeFactory extends CPPNodeFactory implements IXlcCPPNodeFactory {
|
public class XlcCPPNodeFactory extends CPPNodeFactory implements IXlcCPPNodeFactory {
|
||||||
|
|
||||||
private static final XlcCPPNodeFactory DEFAULT_INSTANCE = new XlcCPPNodeFactory();
|
private static final XlcCPPNodeFactory DEFAULT_INSTANCE = new XlcCPPNodeFactory();
|
||||||
|
@ -25,4 +28,8 @@ private static final XlcCPPNodeFactory DEFAULT_INSTANCE = new XlcCPPNodeFactory(
|
||||||
public IXlcCPPASTVectorTypeSpecifier newVectorTypeSpecifier() {
|
public IXlcCPPASTVectorTypeSpecifier newVectorTypeSpecifier() {
|
||||||
return new XlcCPPASTVectorTypeSpecifier();
|
return new XlcCPPASTVectorTypeSpecifier();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IXlcCPPASTModifiedArrayModifier newModifiedArrayModifier(IASTExpression expr) {
|
||||||
|
return new XlcCPPASTModifiedArrayModifier(expr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2079,6 +2079,48 @@ private GNUBuildASTParserAction gnuAction;
|
||||||
case 643: { action. consumeToken(); break;
|
case 643: { action. consumeToken(); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Rule 644: array_modifier ::= [ <openscope-ast> array_modifier_type_qualifiers ]
|
||||||
|
//
|
||||||
|
case 644: { action. consumeDirectDeclaratorModifiedArrayModifier(false, false, true, false); break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Rule 645: array_modifier ::= [ <openscope-ast> array_modifier_type_qualifiers assignment_expression ]
|
||||||
|
//
|
||||||
|
case 645: { action. consumeDirectDeclaratorModifiedArrayModifier(false, false, true, true); break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Rule 646: array_modifier ::= [ static assignment_expression ]
|
||||||
|
//
|
||||||
|
case 646: { action. consumeDirectDeclaratorModifiedArrayModifier(true, false, false, true); break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Rule 647: array_modifier ::= [ static <openscope-ast> array_modifier_type_qualifiers assignment_expression ]
|
||||||
|
//
|
||||||
|
case 647: { action. consumeDirectDeclaratorModifiedArrayModifier(true, false, true, true); break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Rule 648: array_modifier ::= [ <openscope-ast> array_modifier_type_qualifiers static assignment_expression ]
|
||||||
|
//
|
||||||
|
case 648: { action. consumeDirectDeclaratorModifiedArrayModifier(true, false, true, true); break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Rule 649: array_modifier ::= [ * ]
|
||||||
|
//
|
||||||
|
case 649: { action. consumeDirectDeclaratorModifiedArrayModifier(false, true, false, false); break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Rule 650: array_modifier ::= [ <openscope-ast> array_modifier_type_qualifiers * ]
|
||||||
|
//
|
||||||
|
case 650: { action. consumeDirectDeclaratorModifiedArrayModifier(false, true, true, false); break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -19,137 +19,137 @@ public interface XlcCPPParsersym {
|
||||||
TK__Imaginary = 25,
|
TK__Imaginary = 25,
|
||||||
TK_restrict = 35,
|
TK_restrict = 35,
|
||||||
TK_asm = 7,
|
TK_asm = 7,
|
||||||
TK_auto = 37,
|
TK_auto = 38,
|
||||||
TK_bool = 15,
|
TK_bool = 15,
|
||||||
TK_break = 88,
|
TK_break = 88,
|
||||||
TK_case = 89,
|
TK_case = 89,
|
||||||
TK_catch = 133,
|
TK_catch = 133,
|
||||||
TK_char = 16,
|
TK_char = 16,
|
||||||
TK_class = 52,
|
TK_class = 66,
|
||||||
TK_const = 32,
|
TK_const = 33,
|
||||||
TK_const_cast = 55,
|
TK_const_cast = 53,
|
||||||
TK_continue = 90,
|
TK_continue = 90,
|
||||||
TK_default = 91,
|
TK_default = 91,
|
||||||
TK_delete = 82,
|
TK_delete = 80,
|
||||||
TK_do = 92,
|
TK_do = 92,
|
||||||
TK_double = 26,
|
TK_double = 26,
|
||||||
TK_dynamic_cast = 56,
|
TK_dynamic_cast = 54,
|
||||||
TK_else = 135,
|
TK_else = 135,
|
||||||
TK_enum = 57,
|
TK_enum = 68,
|
||||||
TK_explicit = 38,
|
TK_explicit = 39,
|
||||||
TK_export = 93,
|
TK_export = 93,
|
||||||
TK_extern = 39,
|
TK_extern = 40,
|
||||||
TK_false = 58,
|
TK_false = 55,
|
||||||
TK_float = 17,
|
TK_float = 17,
|
||||||
TK_for = 94,
|
TK_for = 94,
|
||||||
TK_friend = 40,
|
TK_friend = 41,
|
||||||
TK_goto = 95,
|
TK_goto = 95,
|
||||||
TK_if = 96,
|
TK_if = 96,
|
||||||
TK_inline = 41,
|
TK_inline = 42,
|
||||||
TK_int = 18,
|
TK_int = 18,
|
||||||
TK_long = 19,
|
TK_long = 19,
|
||||||
TK_mutable = 42,
|
TK_mutable = 43,
|
||||||
TK_namespace = 73,
|
TK_namespace = 73,
|
||||||
TK_new = 83,
|
TK_new = 81,
|
||||||
TK_operator = 12,
|
TK_operator = 11,
|
||||||
TK_private = 130,
|
TK_private = 130,
|
||||||
TK_protected = 131,
|
TK_protected = 131,
|
||||||
TK_public = 132,
|
TK_public = 132,
|
||||||
TK_register = 43,
|
TK_register = 44,
|
||||||
TK_reinterpret_cast = 59,
|
TK_reinterpret_cast = 56,
|
||||||
TK_return = 97,
|
TK_return = 97,
|
||||||
TK_short = 20,
|
TK_short = 20,
|
||||||
TK_signed = 21,
|
TK_signed = 21,
|
||||||
TK_sizeof = 60,
|
TK_sizeof = 57,
|
||||||
TK_static = 44,
|
TK_static = 36,
|
||||||
TK_static_cast = 61,
|
TK_static_cast = 58,
|
||||||
TK_struct = 62,
|
TK_struct = 69,
|
||||||
TK_switch = 98,
|
TK_switch = 98,
|
||||||
TK_template = 53,
|
TK_template = 67,
|
||||||
TK_this = 63,
|
TK_this = 59,
|
||||||
TK_throw = 78,
|
TK_throw = 74,
|
||||||
TK_try = 84,
|
TK_try = 84,
|
||||||
TK_true = 64,
|
TK_true = 60,
|
||||||
TK_typedef = 45,
|
TK_typedef = 45,
|
||||||
TK_typeid = 65,
|
TK_typeid = 61,
|
||||||
TK_typename = 23,
|
TK_typename = 23,
|
||||||
TK_union = 66,
|
TK_union = 70,
|
||||||
TK_unsigned = 22,
|
TK_unsigned = 22,
|
||||||
TK_using = 74,
|
TK_using = 75,
|
||||||
TK_virtual = 36,
|
TK_virtual = 37,
|
||||||
TK_void = 27,
|
TK_void = 27,
|
||||||
TK_volatile = 33,
|
TK_volatile = 34,
|
||||||
TK_wchar_t = 28,
|
TK_wchar_t = 28,
|
||||||
TK_while = 87,
|
TK_while = 87,
|
||||||
TK_integer = 67,
|
TK_integer = 62,
|
||||||
TK_floating = 68,
|
TK_floating = 63,
|
||||||
TK_charconst = 69,
|
TK_charconst = 64,
|
||||||
TK_stringlit = 49,
|
TK_stringlit = 48,
|
||||||
TK_identifier = 1,
|
TK_identifier = 1,
|
||||||
TK_Completion = 4,
|
TK_Completion = 4,
|
||||||
TK_EndOfCompletion = 11,
|
TK_EndOfCompletion = 12,
|
||||||
TK_Invalid = 136,
|
TK_Invalid = 136,
|
||||||
TK_LeftBracket = 75,
|
TK_LeftBracket = 76,
|
||||||
TK_LeftParen = 5,
|
TK_LeftParen = 5,
|
||||||
TK_Dot = 129,
|
TK_Dot = 129,
|
||||||
TK_DotStar = 103,
|
TK_DotStar = 104,
|
||||||
TK_Arrow = 116,
|
TK_Arrow = 117,
|
||||||
TK_ArrowStar = 102,
|
TK_ArrowStar = 102,
|
||||||
TK_PlusPlus = 50,
|
TK_PlusPlus = 49,
|
||||||
TK_MinusMinus = 51,
|
TK_MinusMinus = 50,
|
||||||
TK_And = 14,
|
TK_And = 14,
|
||||||
TK_Star = 13,
|
TK_Star = 13,
|
||||||
TK_Plus = 47,
|
TK_Plus = 46,
|
||||||
TK_Minus = 48,
|
TK_Minus = 47,
|
||||||
TK_Tilde = 10,
|
TK_Tilde = 10,
|
||||||
TK_Bang = 54,
|
TK_Bang = 52,
|
||||||
TK_Slash = 104,
|
TK_Slash = 105,
|
||||||
TK_Percent = 105,
|
TK_Percent = 106,
|
||||||
TK_RightShift = 99,
|
TK_RightShift = 99,
|
||||||
TK_LeftShift = 100,
|
TK_LeftShift = 100,
|
||||||
TK_LT = 71,
|
TK_LT = 71,
|
||||||
TK_GT = 81,
|
TK_GT = 83,
|
||||||
TK_LE = 106,
|
TK_LE = 107,
|
||||||
TK_GE = 107,
|
TK_GE = 108,
|
||||||
TK_EQ = 108,
|
TK_EQ = 109,
|
||||||
TK_NE = 109,
|
TK_NE = 110,
|
||||||
TK_Caret = 110,
|
TK_Caret = 111,
|
||||||
TK_Or = 111,
|
TK_Or = 112,
|
||||||
TK_AndAnd = 112,
|
TK_AndAnd = 113,
|
||||||
TK_OrOr = 113,
|
TK_OrOr = 114,
|
||||||
TK_Question = 117,
|
TK_Question = 118,
|
||||||
TK_Colon = 80,
|
TK_Colon = 82,
|
||||||
TK_ColonColon = 6,
|
TK_ColonColon = 6,
|
||||||
TK_DotDotDot = 101,
|
TK_DotDotDot = 101,
|
||||||
TK_Assign = 85,
|
TK_Assign = 85,
|
||||||
TK_StarAssign = 118,
|
TK_StarAssign = 119,
|
||||||
TK_SlashAssign = 119,
|
TK_SlashAssign = 120,
|
||||||
TK_PercentAssign = 120,
|
TK_PercentAssign = 121,
|
||||||
TK_PlusAssign = 121,
|
TK_PlusAssign = 122,
|
||||||
TK_MinusAssign = 122,
|
TK_MinusAssign = 123,
|
||||||
TK_RightShiftAssign = 123,
|
TK_RightShiftAssign = 124,
|
||||||
TK_LeftShiftAssign = 124,
|
TK_LeftShiftAssign = 125,
|
||||||
TK_AndAssign = 125,
|
TK_AndAssign = 126,
|
||||||
TK_CaretAssign = 126,
|
TK_CaretAssign = 127,
|
||||||
TK_OrAssign = 127,
|
TK_OrAssign = 128,
|
||||||
TK_Comma = 79,
|
TK_Comma = 79,
|
||||||
TK_RightBracket = 128,
|
TK_RightBracket = 103,
|
||||||
TK_RightParen = 76,
|
TK_RightParen = 77,
|
||||||
TK_RightBrace = 86,
|
TK_RightBrace = 86,
|
||||||
TK_SemiColon = 46,
|
TK_SemiColon = 51,
|
||||||
TK_LeftBrace = 72,
|
TK_LeftBrace = 72,
|
||||||
TK_typeof = 34,
|
TK_typeof = 32,
|
||||||
TK___alignof__ = 70,
|
TK___alignof__ = 65,
|
||||||
TK___attribute__ = 8,
|
TK___attribute__ = 8,
|
||||||
TK___declspec = 9,
|
TK___declspec = 9,
|
||||||
TK_MAX = 114,
|
TK_MAX = 115,
|
||||||
TK_MIN = 115,
|
TK_MIN = 116,
|
||||||
TK_vector = 3,
|
TK_vector = 3,
|
||||||
TK_pixel = 2,
|
TK_pixel = 2,
|
||||||
TK__Decimal32 = 29,
|
TK__Decimal32 = 29,
|
||||||
TK__Decimal64 = 30,
|
TK__Decimal64 = 30,
|
||||||
TK__Decimal128 = 31,
|
TK__Decimal128 = 31,
|
||||||
TK_ERROR_TOKEN = 77,
|
TK_ERROR_TOKEN = 78,
|
||||||
TK_EOF_TOKEN = 134;
|
TK_EOF_TOKEN = 134;
|
||||||
|
|
||||||
public final static String orderedTerminalSymbols[] = {
|
public final static String orderedTerminalSymbols[] = {
|
||||||
|
@ -164,8 +164,8 @@ public interface XlcCPPParsersym {
|
||||||
"__attribute__",
|
"__attribute__",
|
||||||
"__declspec",
|
"__declspec",
|
||||||
"Tilde",
|
"Tilde",
|
||||||
"EndOfCompletion",
|
|
||||||
"operator",
|
"operator",
|
||||||
|
"EndOfCompletion",
|
||||||
"Star",
|
"Star",
|
||||||
"And",
|
"And",
|
||||||
"bool",
|
"bool",
|
||||||
|
@ -185,10 +185,11 @@ public interface XlcCPPParsersym {
|
||||||
"_Decimal32",
|
"_Decimal32",
|
||||||
"_Decimal64",
|
"_Decimal64",
|
||||||
"_Decimal128",
|
"_Decimal128",
|
||||||
|
"typeof",
|
||||||
"const",
|
"const",
|
||||||
"volatile",
|
"volatile",
|
||||||
"typeof",
|
|
||||||
"restrict",
|
"restrict",
|
||||||
|
"static",
|
||||||
"virtual",
|
"virtual",
|
||||||
"auto",
|
"auto",
|
||||||
"explicit",
|
"explicit",
|
||||||
|
@ -197,46 +198,45 @@ public interface XlcCPPParsersym {
|
||||||
"inline",
|
"inline",
|
||||||
"mutable",
|
"mutable",
|
||||||
"register",
|
"register",
|
||||||
"static",
|
|
||||||
"typedef",
|
"typedef",
|
||||||
"SemiColon",
|
|
||||||
"Plus",
|
"Plus",
|
||||||
"Minus",
|
"Minus",
|
||||||
"stringlit",
|
"stringlit",
|
||||||
"PlusPlus",
|
"PlusPlus",
|
||||||
"MinusMinus",
|
"MinusMinus",
|
||||||
"class",
|
"SemiColon",
|
||||||
"template",
|
|
||||||
"Bang",
|
"Bang",
|
||||||
"const_cast",
|
"const_cast",
|
||||||
"dynamic_cast",
|
"dynamic_cast",
|
||||||
"enum",
|
|
||||||
"false",
|
"false",
|
||||||
"reinterpret_cast",
|
"reinterpret_cast",
|
||||||
"sizeof",
|
"sizeof",
|
||||||
"static_cast",
|
"static_cast",
|
||||||
"struct",
|
|
||||||
"this",
|
"this",
|
||||||
"true",
|
"true",
|
||||||
"typeid",
|
"typeid",
|
||||||
"union",
|
|
||||||
"integer",
|
"integer",
|
||||||
"floating",
|
"floating",
|
||||||
"charconst",
|
"charconst",
|
||||||
"__alignof__",
|
"__alignof__",
|
||||||
|
"class",
|
||||||
|
"template",
|
||||||
|
"enum",
|
||||||
|
"struct",
|
||||||
|
"union",
|
||||||
"LT",
|
"LT",
|
||||||
"LeftBrace",
|
"LeftBrace",
|
||||||
"namespace",
|
"namespace",
|
||||||
|
"throw",
|
||||||
"using",
|
"using",
|
||||||
"LeftBracket",
|
"LeftBracket",
|
||||||
"RightParen",
|
"RightParen",
|
||||||
"ERROR_TOKEN",
|
"ERROR_TOKEN",
|
||||||
"throw",
|
|
||||||
"Comma",
|
"Comma",
|
||||||
"Colon",
|
|
||||||
"GT",
|
|
||||||
"delete",
|
"delete",
|
||||||
"new",
|
"new",
|
||||||
|
"Colon",
|
||||||
|
"GT",
|
||||||
"try",
|
"try",
|
||||||
"Assign",
|
"Assign",
|
||||||
"RightBrace",
|
"RightBrace",
|
||||||
|
@ -256,6 +256,7 @@ public interface XlcCPPParsersym {
|
||||||
"LeftShift",
|
"LeftShift",
|
||||||
"DotDotDot",
|
"DotDotDot",
|
||||||
"ArrowStar",
|
"ArrowStar",
|
||||||
|
"RightBracket",
|
||||||
"DotStar",
|
"DotStar",
|
||||||
"Slash",
|
"Slash",
|
||||||
"Percent",
|
"Percent",
|
||||||
|
@ -281,7 +282,6 @@ public interface XlcCPPParsersym {
|
||||||
"AndAssign",
|
"AndAssign",
|
||||||
"CaretAssign",
|
"CaretAssign",
|
||||||
"OrAssign",
|
"OrAssign",
|
||||||
"RightBracket",
|
|
||||||
"Dot",
|
"Dot",
|
||||||
"private",
|
"private",
|
||||||
"protected",
|
"protected",
|
||||||
|
|
|
@ -9,10 +9,12 @@
|
||||||
# IBM Corporation - initial API and implementation
|
# IBM Corporation - initial API and implementation
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
Bundle-Name.0 = LR Parser Plug-in
|
Bundle-Name.0 = XLCParser Plug-in
|
||||||
Bundle-Vendor.0 = Eclipse.org
|
Bundle-Vendor.0 = Eclipse.org
|
||||||
Bundle-Name.1 = LR Parser Plug-in
|
Bundle-Name.1 = XLC Parser Plug-in
|
||||||
|
|
||||||
# built-in languages
|
# built-in languages
|
||||||
language.name.c99= C99
|
language.name.c=XL C
|
||||||
language.name.isocpp= ISO C++
|
language.name.cpp=XL C++
|
||||||
|
|
||||||
|
preferences.page.title=XL C/C++ Language Options
|
|
@ -5,13 +5,13 @@
|
||||||
<language
|
<language
|
||||||
class="org.eclipse.cdt.core.lrparser.xlc.XlcCLanguage"
|
class="org.eclipse.cdt.core.lrparser.xlc.XlcCLanguage"
|
||||||
id="c"
|
id="c"
|
||||||
name="XLC C">
|
name="%language.name.c">
|
||||||
</language>
|
</language>
|
||||||
|
|
||||||
<language
|
<language
|
||||||
class="org.eclipse.cdt.core.lrparser.xlc.XlcCPPLanguage"
|
class="org.eclipse.cdt.core.lrparser.xlc.XlcCPPLanguage"
|
||||||
id="cpp"
|
id="cpp"
|
||||||
name="XLC C++">
|
name="%language.name.cpp">
|
||||||
</language>
|
</language>
|
||||||
</extension>
|
</extension>
|
||||||
<extension
|
<extension
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
category="org.eclipse.cdt.ui.preferences.CPluginPreferencePage"
|
category="org.eclipse.cdt.ui.preferences.CPluginPreferencePage"
|
||||||
class="org.eclipse.cdt.internal.core.lrparser.xlc.ui.preferences.XlcLanguageOptionsPreferencePage"
|
class="org.eclipse.cdt.internal.core.lrparser.xlc.ui.preferences.XlcLanguageOptionsPreferencePage"
|
||||||
id="org.eclipse.cdt.core.lrparser.xlc.ui.XlcLanguagePreferencePage"
|
id="org.eclipse.cdt.core.lrparser.xlc.ui.XlcLanguagePreferencePage"
|
||||||
name="XLC Language Options">
|
name="%preferences.page.title">
|
||||||
</page>
|
</page>
|
||||||
</extension>
|
</extension>
|
||||||
<extension
|
<extension
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
category="org.eclipse.cdt.ui.newui.Page_head_general"
|
category="org.eclipse.cdt.ui.newui.Page_head_general"
|
||||||
class="org.eclipse.cdt.internal.core.lrparser.xlc.ui.preferences.XlcLanguageOptionsPreferencePage"
|
class="org.eclipse.cdt.internal.core.lrparser.xlc.ui.preferences.XlcLanguageOptionsPreferencePage"
|
||||||
id="org.eclipse.cdt.core.lrparser.xlc.ui.XlcLanguagePropertyPage"
|
id="org.eclipse.cdt.core.lrparser.xlc.ui.XlcLanguagePropertyPage"
|
||||||
name="XLC Language Options">
|
name="%preferences.page.title">
|
||||||
</page>
|
</page>
|
||||||
</extension>
|
</extension>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
Loading…
Add table
Reference in a new issue