diff options
author | Markus Schorn | 2009-06-24 12:31:43 +0000 |
---|---|---|
committer | Markus Schorn | 2009-06-24 12:31:43 +0000 |
commit | 35b88d24a94ea7d44886b12c16cf61b8a22ba869 (patch) | |
tree | ce9b3edbdd7fe274e6113e00af792162f0f58776 /core/org.eclipse.cdt.core | |
parent | b9dc7d8fdb364ec72e8313e35cc30e79776e4217 (diff) | |
download | org.eclipse.cdt-35b88d24a94ea7d44886b12c16cf61b8a22ba869.tar.gz org.eclipse.cdt-35b88d24a94ea7d44886b12c16cf61b8a22ba869.tar.xz org.eclipse.cdt-35b88d24a94ea7d44886b12c16cf61b8a22ba869.zip |
Navigation of macro parameters, bug 105929
Diffstat (limited to 'core/org.eclipse.cdt.core')
-rw-r--r-- | core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/ASTPreprocessorNode.java | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/ASTPreprocessorNode.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/ASTPreprocessorNode.java index 5ee55e3d2bf..9597f994af5 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/ASTPreprocessorNode.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/ASTPreprocessorNode.java @@ -275,7 +275,7 @@ class ASTInclusionStatement extends ASTPreprocessorNode implements IASTPreproces class ASTMacroDefinition extends ASTPreprocessorNode implements IASTPreprocessorObjectStyleMacroDefinition { private final ASTPreprocessorName fName; - private final int fExpansionNumber; + protected final int fExpansionNumber; private final int fExpansionOffset; private final boolean fActive; @@ -404,8 +404,27 @@ class ASTFunctionStyleMacroDefinition extends ASTMacroDefinition implements IAST IMacroBinding macro= getMacro(); char[][] paramList= macro.getParameterList(); IASTFunctionStyleMacroParameter[] result= new IASTFunctionStyleMacroParameter[paramList.length]; + char[] image= getRawSignatureChars(); + int idx= 0; + int defOffset = getOffset(); + int endIdx= Math.min(fExpansionNumber - defOffset, image.length); + char start= '('; for (int i = 0; i < result.length; i++) { - result[i]= new ASTMacroParameter(this, paramList[i], -1, -1); + while(idx < endIdx && image[idx] != start) + idx++; + idx++; + while(idx < endIdx && Character.isWhitespace(image[idx])) + idx++; + start= ','; + + char[] param = paramList[i]; + int poffset= -1; + int pendOffset= -1; + if (idx + param.length <= endIdx) { + poffset= defOffset+idx; + pendOffset= poffset+param.length; + } + result[i]= new ASTMacroParameter(this, param, poffset, pendOffset); } return result; } |