1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

Added token, scanner and problem subpackages to org.eclipse.cdt.internal.core.parser. Updated tests to accommodate.

This commit is contained in:
John Camelon 2004-01-22 20:15:31 +00:00
parent 34754f2099
commit e35bc93925
30 changed files with 54 additions and 41 deletions

View file

@ -1,3 +1,6 @@
2004-01-22 John Camelon
Updated Scanner tests for package updates in the core.
2004-01-19 John Camelon
Updated ParserSymbolTableTest to accommodate new constructors for COMPLETE_PARSE ASTNodes (line # info).
Updated CModelElementsTest to enable testing for line numbers.

View file

@ -4,7 +4,7 @@ import java.util.EmptyStackException;
import junit.framework.TestCase;
import org.eclipse.cdt.internal.core.parser.BranchTracker;
import org.eclipse.cdt.internal.core.parser.scanner.BranchTracker;
/**
* @author jcamelon

View file

@ -14,7 +14,7 @@ import org.eclipse.cdt.core.parser.ParserFactoryError;
import org.eclipse.cdt.core.parser.ParserMode;
import org.eclipse.cdt.core.parser.ScannerException;
import org.eclipse.cdt.core.parser.ast.IASTInclusion;
import org.eclipse.cdt.internal.core.parser.Token;
import org.eclipse.cdt.internal.core.parser.token.Token;
/**
* @author jcamelon

View file

@ -1,3 +1,6 @@
2004-01-22 John Camelon
Added token, scanner and problem subpackages to org.eclipse.cdt.internal.core.parser.
2004-01-22 Hoda Amer
Solved a small problem in the ASTCompleteParseASTFactory sent to me by Dave.

View file

@ -15,15 +15,15 @@ import java.io.Reader;
import org.eclipse.cdt.core.parser.ast.IASTFactory;
import org.eclipse.cdt.internal.core.parser.CompleteParser;
import org.eclipse.cdt.internal.core.parser.ContextualParser;
import org.eclipse.cdt.internal.core.parser.LineOffsetReconciler;
import org.eclipse.cdt.internal.core.parser.Preprocessor;
import org.eclipse.cdt.internal.core.parser.QuickParseCallback;
import org.eclipse.cdt.internal.core.parser.QuickParser;
import org.eclipse.cdt.internal.core.parser.Scanner;
import org.eclipse.cdt.internal.core.parser.StructuralParser;
import org.eclipse.cdt.internal.core.parser.StructuralParseCallback;
import org.eclipse.cdt.internal.core.parser.ast.complete.CompleteParseASTFactory;
import org.eclipse.cdt.internal.core.parser.ast.quick.QuickParseASTFactory;
import org.eclipse.cdt.internal.core.parser.scanner.LineOffsetReconciler;
import org.eclipse.cdt.internal.core.parser.scanner.Preprocessor;
import org.eclipse.cdt.internal.core.parser.scanner.Scanner;
/**

View file

@ -14,6 +14,6 @@ package org.eclipse.cdt.core.parser.ast;
* @author jcamelon
*
*/
public class ExpressionEvaluationException extends Exception
public class ASTExpressionEvaluationException extends Exception
{
}

View file

@ -139,7 +139,7 @@ public interface IASTExpression extends ISourceElementCallbackDelegate
public IASTTypeId getTypeId();
public IASTNewExpressionDescriptor getNewExpressionDescriptor();
public int evaluateExpression() throws ExpressionEvaluationException;
public int evaluateExpression() throws ASTExpressionEvaluationException;
public void reconcileReferences() throws ASTNotImplementedException;
public void purgeReferences() throws ASTNotImplementedException;

View file

@ -30,6 +30,7 @@ import org.eclipse.cdt.core.parser.ast.IASTNode;
import org.eclipse.cdt.core.parser.ast.IASTScope;
import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
import org.eclipse.cdt.internal.core.parser.ast.ASTCompletionNode;
import org.eclipse.cdt.internal.core.parser.token.*;
/**
* @author jcamelon

View file

@ -60,7 +60,8 @@ import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier.ClassNameType;
import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
import org.eclipse.cdt.core.parser.ast.IASTExpression.Kind;
import org.eclipse.cdt.internal.core.parser.KeywordSets.Key;
import org.eclipse.cdt.internal.core.parser.token.*;
import org.eclipse.cdt.internal.core.parser.token.KeywordSets.Key;
/**
* This is our first implementation of the IParser interface, serving as a parser for

View file

@ -16,7 +16,7 @@ import java.util.List;
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
import org.eclipse.cdt.core.parser.ITokenDuple;
import org.eclipse.cdt.core.parser.ast.ASTNotImplementedException;
import org.eclipse.cdt.core.parser.ast.ExpressionEvaluationException;
import org.eclipse.cdt.core.parser.ast.ASTExpressionEvaluationException;
import org.eclipse.cdt.core.parser.ast.IASTExpression;
import org.eclipse.cdt.core.parser.ast.IASTReference;
import org.eclipse.cdt.core.parser.ast.IASTTypeId;
@ -114,9 +114,9 @@ public class ASTExpression implements IASTExpression
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTExpression#evaluateExpression()
*/
public int evaluateExpression() throws ExpressionEvaluationException
public int evaluateExpression() throws ASTExpressionEvaluationException
{
throw new ExpressionEvaluationException();
throw new ASTExpressionEvaluationException();
}
public List getReferences()

View file

@ -8,7 +8,7 @@ package org.eclipse.cdt.internal.core.parser.ast.quick;
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
import org.eclipse.cdt.core.parser.ast.ASTNotImplementedException;
import org.eclipse.cdt.core.parser.ast.ExpressionEvaluationException;
import org.eclipse.cdt.core.parser.ast.ASTExpressionEvaluationException;
import org.eclipse.cdt.core.parser.ast.IASTExpression;
import org.eclipse.cdt.core.parser.ast.IASTTypeId;
@ -99,7 +99,7 @@ public class ASTExpression implements IASTExpression {
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTExpression#evaluateExpression()
*/
public int evaluateExpression() throws ExpressionEvaluationException {
public int evaluateExpression() throws ASTExpressionEvaluationException {
// primary expressions
if( getExpressionKind() == IASTExpression.Kind.PRIMARY_INTEGER_LITERAL )
{
@ -115,7 +115,7 @@ public class ASTExpression implements IASTExpression {
}
catch( NumberFormatException nfe )
{
throw new ExpressionEvaluationException();
throw new ASTExpressionEvaluationException();
}
}
if( getExpressionKind() == IASTExpression.Kind.PRIMARY_BRACKETED_EXPRESSION )
@ -171,7 +171,7 @@ public class ASTExpression implements IASTExpression {
if( getExpressionKind() == IASTExpression.Kind.LOGICALOREXPRESSION )
return( ( getLHSExpression().evaluateExpression() != 0 ) || ( getRHSExpression().evaluateExpression() != 0 ) ) ? 1 : 0 ;
throw new ExpressionEvaluationException();
throw new ASTExpressionEvaluationException();
}
/* (non-Javadoc)

View file

@ -8,7 +8,7 @@
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.internal.core.parser;
package org.eclipse.cdt.internal.core.parser.problem;
import java.util.Map;

View file

@ -8,7 +8,7 @@
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.internal.core.parser;
package org.eclipse.cdt.internal.core.parser.problem;
import java.util.Map;

View file

@ -8,7 +8,7 @@
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.internal.core.parser;
package org.eclipse.cdt.internal.core.parser.problem;
import java.util.Map;

View file

@ -1,4 +1,4 @@
package org.eclipse.cdt.internal.core.parser;
package org.eclipse.cdt.internal.core.parser.scanner;
import java.util.EmptyStackException;
import java.util.Stack;

View file

@ -8,7 +8,7 @@
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.internal.core.parser;
package org.eclipse.cdt.internal.core.parser.scanner;
/**
* @author jcamelon

View file

@ -9,7 +9,7 @@
* IBM Corp. - Rational Software - initial implementation
******************************************************************************/
package org.eclipse.cdt.internal.core.parser;
package org.eclipse.cdt.internal.core.parser.scanner;
import java.io.IOException;
import java.io.Reader;
@ -22,7 +22,7 @@ import org.eclipse.cdt.core.parser.IParserLogService;
import org.eclipse.cdt.core.parser.IProblem;
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
import org.eclipse.cdt.core.parser.ast.IASTInclusion;
import org.eclipse.cdt.internal.core.parser.IScannerContext.ContextKind;
import org.eclipse.cdt.internal.core.parser.scanner.IScannerContext.ContextKind;
/**
* @author aniefer

View file

@ -8,7 +8,7 @@
* Contributors:
* Rational Software - initial implementation
******************************************************************************/
package org.eclipse.cdt.internal.core.parser;
package org.eclipse.cdt.internal.core.parser.scanner;
import java.util.Iterator;
import java.util.List;

View file

@ -1,4 +1,4 @@
package org.eclipse.cdt.internal.core.parser;
package org.eclipse.cdt.internal.core.parser.scanner;
import java.io.IOException;
import java.io.Reader;

View file

@ -8,7 +8,7 @@
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.internal.core.parser;
package org.eclipse.cdt.internal.core.parser.scanner;
import java.io.IOException;
import java.io.Reader;

View file

@ -8,13 +8,14 @@
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.internal.core.parser;
package org.eclipse.cdt.internal.core.parser.scanner;
import java.io.IOException;
import java.io.Reader;
import org.eclipse.cdt.core.parser.ILineOffsetReconciler;
import org.eclipse.cdt.core.parser.IOffsetDuple;
import org.eclipse.cdt.internal.core.parser.token.OffsetDuple;
/**
* @author jcamelon

View file

@ -8,7 +8,7 @@
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.internal.core.parser;
package org.eclipse.cdt.internal.core.parser.scanner;
import java.util.ArrayList;
import java.util.List;

View file

@ -8,7 +8,7 @@
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.internal.core.parser;
package org.eclipse.cdt.internal.core.parser.scanner;
import java.io.Reader;

View file

@ -8,7 +8,7 @@
* Contributors:
* Rational Software - initial implementation
******************************************************************************/
package org.eclipse.cdt.internal.core.parser;
package org.eclipse.cdt.internal.core.parser.scanner;
import java.io.File;
import java.io.FileNotFoundException;
@ -46,10 +46,12 @@ import org.eclipse.cdt.core.parser.ParserMode;
import org.eclipse.cdt.core.parser.ScannerException;
import org.eclipse.cdt.core.parser.ScannerInfo;
import org.eclipse.cdt.core.parser.IMacroDescriptor.MacroType;
import org.eclipse.cdt.core.parser.ast.ExpressionEvaluationException;
import org.eclipse.cdt.core.parser.ast.ASTExpressionEvaluationException;
import org.eclipse.cdt.core.parser.ast.IASTExpression;
import org.eclipse.cdt.core.parser.ast.IASTFactory;
import org.eclipse.cdt.core.parser.ast.IASTInclusion;
import org.eclipse.cdt.internal.core.parser.problem.IProblemFactory;
import org.eclipse.cdt.internal.core.parser.token.Token;
/**
* @author jcamelon
@ -2035,7 +2037,7 @@ public class Scanner implements IScanner {
{
handleProblem( IProblem.PREPROCESSOR_CONDITIONAL_EVAL_ERROR, expression, beginningOffset, false, true );
}
catch (ExpressionEvaluationException e) {
catch (ASTExpressionEvaluationException e) {
handleProblem( IProblem.PREPROCESSOR_CONDITIONAL_EVAL_ERROR, expression, beginningOffset, false, true );
} catch (EndOfFileException e) {
handleProblem( IProblem.PREPROCESSOR_CONDITIONAL_EVAL_ERROR, expression, beginningOffset, false, true );
@ -2674,11 +2676,11 @@ public class Scanner implements IScanner {
// is this identifier in the parameterNames
// list?
int index = parameterNames.indexOf(t.image);
int index = parameterNames.indexOf(t.getImage());
if (index == -1 ) {
// not found
// just add image to buffer
buffer.append(t.image );
buffer.append(t.getImage() );
} else {
buffer.append(
(String) parameterValues.elementAt(index) );
@ -2687,7 +2689,7 @@ public class Scanner implements IScanner {
//next token should be a parameter which needs to be turned into
//a string literal
t = (Token) tokens.get( ++i );
int index = parameterNames.indexOf(t.image);
int index = parameterNames.indexOf(t.getImage());
if( index == -1 ){
handleProblem( IProblem.PREPROCESSOR_MACRO_USAGE_ERROR, expansion.getName(), getCurrentOffset(), false, true );
return;
@ -2736,7 +2738,7 @@ public class Scanner implements IScanner {
break;
default:
buffer.append(t.image);
buffer.append(t.getImage());
break;
}
}

View file

@ -8,7 +8,7 @@
* Contributors:
* Rational Software - initial implementation
******************************************************************************/
package org.eclipse.cdt.internal.core.parser;
package org.eclipse.cdt.internal.core.parser.scanner;
import java.io.IOException;
import java.io.Reader;

View file

@ -8,12 +8,13 @@
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.internal.core.parser;
package org.eclipse.cdt.internal.core.parser.scanner;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.cdt.core.parser.IProblem;
import org.eclipse.cdt.internal.core.parser.problem.*;
/**
* @author jcamelon

View file

@ -8,7 +8,7 @@
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.internal.core.parser;
package org.eclipse.cdt.internal.core.parser.token;
import java.util.HashSet;
import java.util.Hashtable;

View file

@ -8,7 +8,7 @@
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.internal.core.parser;
package org.eclipse.cdt.internal.core.parser.token;
import org.eclipse.cdt.core.parser.IOffsetDuple;

View file

@ -8,9 +8,10 @@
* Contributors:
* Rational Software - initial implementation
******************************************************************************/
package org.eclipse.cdt.internal.core.parser;
package org.eclipse.cdt.internal.core.parser.token;
import org.eclipse.cdt.core.parser.IToken;
import org.eclipse.cdt.internal.core.parser.scanner.*;
public class Token implements IToken {

View file

@ -8,7 +8,7 @@
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.internal.core.parser;
package org.eclipse.cdt.internal.core.parser.token;
import java.util.Iterator;
import java.util.NoSuchElementException;