diff options
Diffstat (limited to 'lrparser')
11 files changed, 39 insertions, 60 deletions
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/action/deprecated/C99ResolveParserAction.java b/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/action/deprecated/C99ResolveParserAction.java index f141fefbe98..922ad9724f1 100644 --- a/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/action/deprecated/C99ResolveParserAction.java +++ b/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/action/deprecated/C99ResolveParserAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2009 IBM Corporation and others. + * Copyright (c) 2006, 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 @@ -20,7 +20,6 @@ import java.util.List; import lpg.lpgjavaruntime.IToken; -import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.EScopeKind; import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression; import org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier; @@ -1327,21 +1326,19 @@ import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer; * eg) x.a; computes the type of a */ private C99Field computeFieldBinding(IType identType, String memberName, boolean isPointerDereference) { - try { - IType type = identType; - if(isPointerDereference) { - if(type instanceof IPointerType) - type = ((ITypeContainer)type).getType(); // do the dereference - else - return null; - } - - type = rawType(type); - if(type instanceof ICompositeType) { - ICompositeType struct = (ICompositeType) type; - return (C99Field) struct.findField(memberName); - } - } catch(DOMException _) {} + IType type = identType; + if(isPointerDereference) { + if(type instanceof IPointerType) + type = ((ITypeContainer)type).getType(); // do the dereference + else + return null; + } + + type = rawType(type); + if(type instanceof ICompositeType) { + ICompositeType struct = (ICompositeType) type; + return (C99Field) struct.findField(memberName); + } return null; } diff --git a/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99CompositeTypeScope.java b/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99CompositeTypeScope.java index 5ca2c946e79..398a2f62798 100644 --- a/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99CompositeTypeScope.java +++ b/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99CompositeTypeScope.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2008 IBM Corporation and others. + * Copyright (c) 2006, 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 @@ -10,7 +10,6 @@ *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.lrparser.c99.bindings; -import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.EScopeKind; import org.eclipse.cdt.core.dom.ast.IBinding; import org.eclipse.cdt.core.dom.ast.ICompositeType; @@ -31,7 +30,7 @@ public class C99CompositeTypeScope extends C99Scope implements ICCompositeTypeSc return struct; } - public IBinding getBinding(@SuppressWarnings("unused") char[] name) throws DOMException { + public IBinding getBinding(@SuppressWarnings("unused") char[] name) { throw new UnsupportedOperationException(); } } diff --git a/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99Enumeration.java b/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99Enumeration.java index 47b97f648a1..ee669909627 100644 --- a/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99Enumeration.java +++ b/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99Enumeration.java @@ -14,7 +14,6 @@ import java.util.ArrayList; import java.util.List; import org.eclipse.cdt.core.dom.ILinkage; -import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.core.dom.ast.IBinding; import org.eclipse.cdt.core.dom.ast.IEnumeration; @@ -107,7 +106,7 @@ public class C99Enumeration extends PlatformObject implements IC99Binding, IEnum this.scope = scope; } - public IBinding getOwner() throws DOMException { + public IBinding getOwner() { if (scope != null) { return CVisitor.findEnclosingFunction((IASTNode) scope.getScopeName()); // local or global } diff --git a/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99Enumerator.java b/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99Enumerator.java index 6a509d7f00c..1e5b68d5e90 100644 --- a/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99Enumerator.java +++ b/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99Enumerator.java @@ -11,7 +11,6 @@ package org.eclipse.cdt.internal.core.dom.lrparser.c99.bindings; import org.eclipse.cdt.core.dom.ILinkage; -import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.IBinding; import org.eclipse.cdt.core.dom.ast.IEnumerator; import org.eclipse.cdt.core.dom.ast.IScope; @@ -68,7 +67,7 @@ public class C99Enumerator extends PlatformObject implements IC99Binding, IEnume this.scope = scope; } - public IBinding getOwner() throws DOMException { + public IBinding getOwner() { if (type instanceof IBinding) return (IBinding) type; return null; diff --git a/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99Field.java b/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99Field.java index 502aed0de41..e17259e5da3 100644 --- a/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99Field.java +++ b/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99Field.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2008 IBM Corporation and others. + * Copyright (c) 2006, 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 @@ -10,7 +10,6 @@ *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.lrparser.c99.bindings; -import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.ICompositeType; import org.eclipse.cdt.core.dom.ast.IField; import org.eclipse.cdt.core.dom.ast.IScope; @@ -37,11 +36,7 @@ public class C99Field extends C99Variable implements IC99Binding, IField, ITypea @Override public IScope getScope() { - try { - return compositeTypeOwner.getCompositeScope(); - } catch (DOMException e) { - return null; // should never happen - } + return compositeTypeOwner.getCompositeScope(); } diff --git a/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99Label.java b/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99Label.java index 17e3db6f3b8..af6f4438930 100644 --- a/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99Label.java +++ b/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99Label.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2008 IBM Corporation and others. + * Copyright (c) 2006, 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 @@ -11,7 +11,6 @@ package org.eclipse.cdt.internal.core.dom.lrparser.c99.bindings; import org.eclipse.cdt.core.dom.ILinkage; -import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.IASTLabelStatement; import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.core.dom.ast.IBinding; @@ -64,7 +63,7 @@ public class C99Label extends PlatformObject implements IC99Binding, ILabel { this.scope = scope; } - public IBinding getOwner() throws DOMException { + public IBinding getOwner() { if (scope != null) { return CVisitor.findEnclosingFunction((IASTNode) scope.getScopeName()); // local or global } diff --git a/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99Scope.java b/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99Scope.java index af22d736608..58251314dd2 100644 --- a/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99Scope.java +++ b/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99Scope.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2009 IBM Corporation and others. + * Copyright (c) 2006, 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 @@ -11,7 +11,6 @@ package org.eclipse.cdt.internal.core.dom.lrparser.c99.bindings; import org.eclipse.cdt.core.dom.IName; -import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.EScopeKind; import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IASTNode; @@ -94,14 +93,13 @@ public class C99Scope implements IC99Scope, IASTInternalScope { } public IBinding getBinding(IASTName name, boolean resolve, - IIndexFileSet acceptLocalBindings) throws DOMException { + IIndexFileSet acceptLocalBindings) { // TODO Auto-generated method stub return null; } public IBinding[] getBindings(IASTName name, boolean resolve, - boolean prefixLookup, IIndexFileSet acceptLocalBindings) - throws DOMException { + boolean prefixLookup, IIndexFileSet acceptLocalBindings) { // TODO Auto-generated method stub return null; } diff --git a/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99Structure.java b/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99Structure.java index 57db1054b06..bc1ed79321a 100644 --- a/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99Structure.java +++ b/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99Structure.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2008 IBM Corporation and others. + * Copyright (c) 2006, 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 @@ -14,7 +14,6 @@ import java.util.LinkedHashMap; import java.util.Map; import org.eclipse.cdt.core.dom.ILinkage; -import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.core.dom.ast.IBinding; import org.eclipse.cdt.core.dom.ast.ICompositeType; @@ -148,7 +147,7 @@ public class C99Structure extends PlatformObject implements IC99Binding, ICompos this.scope = scope; } - public IBinding getOwner() throws DOMException { + public IBinding getOwner() { if (scope != null) { return CVisitor.findEnclosingFunction((IASTNode) scope.getScopeName()); // local or global } diff --git a/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99Typedef.java b/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99Typedef.java index e0fc274a87e..985902b3b52 100644 --- a/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99Typedef.java +++ b/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99Typedef.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2009 IBM Corporation and others. + * Copyright (c) 2006, 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 @@ -11,7 +11,6 @@ package org.eclipse.cdt.internal.core.dom.lrparser.c99.bindings; import org.eclipse.cdt.core.dom.ILinkage; -import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.core.dom.ast.IBinding; import org.eclipse.cdt.core.dom.ast.IScope; @@ -99,7 +98,7 @@ public class C99Typedef extends PlatformObject implements IC99Binding, ITypedef, this.scope = scope; } - public IBinding getOwner() throws DOMException { + public IBinding getOwner() { if (scope != null) { return CVisitor.findEnclosingFunction((IASTNode) scope.getScopeName()); // local or global } diff --git a/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99Variable.java b/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99Variable.java index 42c141b42d8..a185634d97b 100644 --- a/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99Variable.java +++ b/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99Variable.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2008 IBM Corporation and others. + * Copyright (c) 2006, 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 @@ -11,7 +11,6 @@ package org.eclipse.cdt.internal.core.dom.lrparser.c99.bindings; import org.eclipse.cdt.core.dom.ILinkage; -import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.core.dom.ast.IBinding; import org.eclipse.cdt.core.dom.ast.IScope; @@ -114,7 +113,7 @@ public class C99Variable extends PlatformObject implements IC99Binding, IVariabl this.scope = scope; } - public IBinding getOwner() throws DOMException { + public IBinding getOwner() { if (scope == null) return null; diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/BuildASTParserAction.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/BuildASTParserAction.java index 364aee71da3..0ff7eb74b49 100644 --- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/BuildASTParserAction.java +++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/BuildASTParserAction.java @@ -10,13 +10,14 @@ *******************************************************************************/ package org.eclipse.cdt.core.dom.lrparser.action; -import static org.eclipse.cdt.core.dom.lrparser.action.ParserUtil.*; +import static org.eclipse.cdt.core.dom.lrparser.action.ParserUtil.endOffset; +import static org.eclipse.cdt.core.dom.lrparser.action.ParserUtil.length; +import static org.eclipse.cdt.core.dom.lrparser.action.ParserUtil.offset; import java.util.List; import lpg.lpgjavaruntime.IToken; -import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.IASTASMDeclaration; import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator; import org.eclipse.cdt.core.dom.ast.IASTArrayModifier; @@ -35,6 +36,7 @@ import org.eclipse.cdt.core.dom.ast.IASTDeclarator; import org.eclipse.cdt.core.dom.ast.IASTDefaultStatement; import org.eclipse.cdt.core.dom.ast.IASTDoStatement; import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier; +import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator; import org.eclipse.cdt.core.dom.ast.IASTEqualsInitializer; import org.eclipse.cdt.core.dom.ast.IASTExpression; import org.eclipse.cdt.core.dom.ast.IASTExpressionList; @@ -67,11 +69,9 @@ import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression; import org.eclipse.cdt.core.dom.ast.IBinding; import org.eclipse.cdt.core.dom.ast.INodeFactory; import org.eclipse.cdt.core.dom.ast.IScope; -import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCastExpression; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLiteralExpression; import org.eclipse.cdt.core.dom.lrparser.ISecondaryParser; -import org.eclipse.cdt.core.dom.lrparser.LRParserPlugin; import org.eclipse.cdt.core.dom.lrparser.LRParserProperties; import org.eclipse.cdt.core.dom.parser.IBuiltinBindingsProvider; import org.eclipse.cdt.core.index.IIndex; @@ -136,12 +136,8 @@ public abstract class BuildASTParserAction extends AbstractParserAction { if (builtinBindingsProvider != null) { IScope tuScope = tu.getScope(); IBinding[] bindings = builtinBindingsProvider.getBuiltinBindings(tuScope); - try { - for (IBinding binding : bindings) { - ASTInternal.addBinding(tuScope, binding); - } - } catch (DOMException e) { - LRParserPlugin.logError(e); + for (IBinding binding : bindings) { + ASTInternal.addBinding(tuScope, binding); } } @@ -914,8 +910,8 @@ public abstract class BuildASTParserAction extends AbstractParserAction { declarator.setName(name); IASTPointerOperator[] pointers = decl.getPointerOperators(); - for(int i = 0; i < pointers.length; i++) { - declarator.addPointerOperator(pointers[i]); + for (IASTPointerOperator pointer : pointers) { + declarator.addPointerOperator(pointer); } int offset = offset(name); // TODO |