Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2003-03-03 13:36:23 -0500
committerDoug Schaefer2003-03-03 13:36:23 -0500
commit9b8ab7bb2eaf865a7cb98b62ba3747e706252df4 (patch)
tree2c189270eb9156cd190a5aa38ef5ba3073573128
parent56fcb869cb3157c58f43fa3eb4e97632ea252537 (diff)
downloadorg.eclipse.cdt-9b8ab7bb2eaf865a7cb98b62ba3747e706252df4.tar.gz
org.eclipse.cdt-9b8ab7bb2eaf865a7cb98b62ba3747e706252df4.tar.xz
org.eclipse.cdt-9b8ab7bb2eaf865a7cb98b62ba3747e706252df4.zip
Patch for John Camelon:
- some of the outline view going with new parser
-rw-r--r--core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/model/NewModelBuilder.java2
-rw-r--r--core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/model/SimpleDeclarationWrapper.java3
-rw-r--r--core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/newparser/Scanner.java2
-rw-r--r--core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/newparser/Token.java5
4 files changed, 8 insertions, 4 deletions
diff --git a/core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/model/NewModelBuilder.java b/core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/model/NewModelBuilder.java
index 83c9fbd3de..7216d6b17b 100644
--- a/core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/model/NewModelBuilder.java
+++ b/core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/model/NewModelBuilder.java
@@ -72,7 +72,7 @@ public class NewModelBuilder implements IParserCallback {
String name = currName.toString();
Structure elem = ((Structure)container.getElement());
elem.setElementName( name );
- elem.setIdPos(currName.getEndOffset() - 2, name.length());
+ elem.setIdPos(currName.getEndOffset(), name.length());
elem.setPos(currName.getEndOffset(), name.length());
}
diff --git a/core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/model/SimpleDeclarationWrapper.java b/core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/model/SimpleDeclarationWrapper.java
index eacc6630c2..65add198e6 100644
--- a/core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/model/SimpleDeclarationWrapper.java
+++ b/core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/model/SimpleDeclarationWrapper.java
@@ -112,7 +112,8 @@ public class SimpleDeclarationWrapper extends DeclSpecifier implements Declarati
}
// hook up the offsets
- declaration.setIdPos( currentDeclarator.getName().getEndOffset() - 2,currentDeclarator.getName().toString().length());
+ declaration.setIdPos(
+currentDeclarator.getName().getEndOffset(),currentDeclarator.getName().toString().length());
declaration.setPos( currentDeclarator.getName().getEndOffset(), currentDeclarator.getName().toString().length() );
// add to parent
diff --git a/core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/newparser/Scanner.java b/core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/newparser/Scanner.java
index aacbe0cbab..a84c0e973b 100644
--- a/core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/newparser/Scanner.java
+++ b/core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/newparser/Scanner.java
@@ -260,7 +260,7 @@ public class Scanner implements IScanner {
}
// constants
- private static final int NOCHAR = -1;
+ public static final int NOCHAR = -1;
private static final String TEXT = "<text>";
private static final String START = "<initial reader>";
diff --git a/core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/newparser/Token.java b/core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/newparser/Token.java
index d1a45809a7..dac2866e6f 100644
--- a/core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/newparser/Token.java
+++ b/core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/newparser/Token.java
@@ -16,7 +16,10 @@ public class Token {
type = t;
image = i;
filename = context.getFilename();
- offset = context.getOffset();
+ offset = context.getOffset() - image.length();
+
+ if( context.getUndo() != Scanner.NOCHAR )
+ offset -= 1;
}
public Token(int t, String i) {

Back to the top