mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Updated Scanner for content assist in preprocessor directives.
This commit is contained in:
parent
f26c374088
commit
7c3ab2617b
3 changed files with 32 additions and 3 deletions
|
@ -1,3 +1,6 @@
|
|||
2004-01-23 John Camelon
|
||||
Added support for content assist in the scanner..
|
||||
|
||||
2004-01-22 John Camelon
|
||||
Added token, scanner and problem subpackages to org.eclipse.cdt.internal.core.parser.
|
||||
|
||||
|
|
|
@ -10,16 +10,26 @@
|
|||
***********************************************************************/
|
||||
package org.eclipse.cdt.core.parser;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ast.IASTCompletionNode;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public class OffsetLimitReachedException extends EndOfFileException {
|
||||
|
||||
private final IASTCompletionNode node;
|
||||
private final IToken finalToken;
|
||||
|
||||
public OffsetLimitReachedException( IASTCompletionNode node )
|
||||
{
|
||||
this.node = node;
|
||||
finalToken = null;
|
||||
}
|
||||
|
||||
public OffsetLimitReachedException( IToken token )
|
||||
{
|
||||
finalToken = token;
|
||||
node = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -29,4 +39,16 @@ public class OffsetLimitReachedException extends EndOfFileException {
|
|||
return finalToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return returns the IASTCompletionNode
|
||||
*/
|
||||
public IASTCompletionNode getCompletionNode()
|
||||
{
|
||||
return node;
|
||||
}
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
|
||||
}
|
||||
|
|
|
@ -1194,6 +1194,7 @@ public class Scanner implements IScanner {
|
|||
c = getChar();
|
||||
continue;
|
||||
case PreprocessorDirectives.IF :
|
||||
//TODO add in content assist stuff here
|
||||
// get the rest of the line
|
||||
int currentOffset = getCurrentOffset();
|
||||
String expression = getRestOfPreprocessorLine();
|
||||
|
@ -1210,6 +1211,7 @@ public class Scanner implements IScanner {
|
|||
|
||||
|
||||
case PreprocessorDirectives.IFDEF :
|
||||
//TODO add in content assist stuff here
|
||||
skipOverWhitespace();
|
||||
if (getDefinition(getNextIdentifier()) == null) {
|
||||
// not defined
|
||||
|
@ -1234,6 +1236,7 @@ public class Scanner implements IScanner {
|
|||
continue;
|
||||
|
||||
case PreprocessorDirectives.IFNDEF :
|
||||
//TODO add in content assist stuff here
|
||||
skipOverWhitespace();
|
||||
if (getDefinition(getNextIdentifier()) != null) {
|
||||
// not defined
|
||||
|
@ -1247,6 +1250,7 @@ public class Scanner implements IScanner {
|
|||
continue;
|
||||
|
||||
case PreprocessorDirectives.ELSE :
|
||||
//TODO add in content assist stuff here
|
||||
try
|
||||
{
|
||||
passOnToClient = branches.poundelse();
|
||||
|
@ -1264,6 +1268,7 @@ public class Scanner implements IScanner {
|
|||
continue;
|
||||
|
||||
case PreprocessorDirectives.ELIF :
|
||||
//TODO add in content assist stuff here
|
||||
int co = getCurrentOffset();
|
||||
String elsifExpression = getRestOfPreprocessorLine().trim();
|
||||
|
||||
|
@ -1291,7 +1296,6 @@ public class Scanner implements IScanner {
|
|||
continue;
|
||||
|
||||
case PreprocessorDirectives.LINE :
|
||||
//TO DO
|
||||
skipOverTextUntilNewline();
|
||||
c = getChar();
|
||||
continue;
|
||||
|
@ -1839,7 +1843,7 @@ public class Scanner implements IScanner {
|
|||
|
||||
if( finalToken.getEndOffset() == offsetLimit )
|
||||
throw new OffsetLimitReachedException(finalToken);
|
||||
throw new OffsetLimitReachedException( null );
|
||||
throw new OffsetLimitReachedException( (IToken)null );
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue