diff options
Diffstat (limited to 'xlc/org.eclipse.cdt.core.lrparser.xlc/parser/org/eclipse/cdt/core/lrparser/xlc/action/XlcCPPBuildASTParserAction.java')
-rw-r--r-- | xlc/org.eclipse.cdt.core.lrparser.xlc/parser/org/eclipse/cdt/core/lrparser/xlc/action/XlcCPPBuildASTParserAction.java | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/xlc/org.eclipse.cdt.core.lrparser.xlc/parser/org/eclipse/cdt/core/lrparser/xlc/action/XlcCPPBuildASTParserAction.java b/xlc/org.eclipse.cdt.core.lrparser.xlc/parser/org/eclipse/cdt/core/lrparser/xlc/action/XlcCPPBuildASTParserAction.java index 7505e2be10a..288a23c69b3 100644 --- a/xlc/org.eclipse.cdt.core.lrparser.xlc/parser/org/eclipse/cdt/core/lrparser/xlc/action/XlcCPPBuildASTParserAction.java +++ b/xlc/org.eclipse.cdt.core.lrparser.xlc/parser/org/eclipse/cdt/core/lrparser/xlc/action/XlcCPPBuildASTParserAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 IBM Corporation and others. + * Copyright (c) 2009, 2010 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 @@ -12,13 +12,16 @@ package org.eclipse.cdt.core.lrparser.xlc.action; import lpg.lpgjavaruntime.IToken; +import org.eclipse.cdt.core.dom.ast.IASTConditionalExpression; import org.eclipse.cdt.core.dom.ast.IASTExpression; +import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLiteralExpression; 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.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.gnu.GPPBuildASTParserAction; +import org.eclipse.cdt.core.lrparser.xlc.ast.ICPPASTStaticAssertDeclaration; 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.IXlcCPPNodeFactory; @@ -93,4 +96,16 @@ public class XlcCPPBuildASTParserAction extends GPPBuildASTParserAction { } } } + + /** + * staticAssertDeclaration ::= '__static_assert' '(' expression ',' literal ')' ';' + */ + public void consumeCPPASTStaticAssertDeclaration() { + ICPPASTLiteralExpression message = (ICPPASTLiteralExpression) astStack.pop(); + IASTExpression condition = (IASTExpression) astStack.pop(); + + ICPPASTStaticAssertDeclaration assertDeclaration = nodeFactory.newStaticAssertion(condition, message); + setOffsetAndLength(assertDeclaration); + astStack.push(assertDeclaration); + } } |