Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Camelon2003-06-13 19:59:47 +0000
committerJohn Camelon2003-06-13 19:59:47 +0000
commitd6640934203007c9463160d61b9f1af4a6050b6d (patch)
treee219d487234a7dcde3b85ce110f52c3ccf43f4dd /core/org.eclipse.cdt.ui.tests
parent56d196d558dafc2aeee8dbe28d8a735107b64ce4 (diff)
downloadorg.eclipse.cdt-d6640934203007c9463160d61b9f1af4a6050b6d.tar.gz
org.eclipse.cdt-d6640934203007c9463160d61b9f1af4a6050b6d.tar.xz
org.eclipse.cdt-d6640934203007c9463160d61b9f1af4a6050b6d.zip
Added Class/Base infrastructure to public interfaces & requestor callback.
Moved many internal interfaces to external packages. Organized imports.
Diffstat (limited to 'core/org.eclipse.cdt.ui.tests')
-rw-r--r--core/org.eclipse.cdt.ui.tests/ChangeLog5
-rw-r--r--core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/AutomatedFramework.java2
-rw-r--r--core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/BaseScannerTest.java44
-rw-r--r--core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/BranchTrackerTest.java2
-rw-r--r--core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/DOMTests.java13
-rw-r--r--core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/LineNumberTest.java12
-rw-r--r--core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/ParserTestSuite.java1
-rw-r--r--core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/ScannerTestCase.java313
8 files changed, 199 insertions, 193 deletions
diff --git a/core/org.eclipse.cdt.ui.tests/ChangeLog b/core/org.eclipse.cdt.ui.tests/ChangeLog
index 2aa1a839d0..04787b9363 100644
--- a/core/org.eclipse.cdt.ui.tests/ChangeLog
+++ b/core/org.eclipse.cdt.ui.tests/ChangeLog
@@ -1,3 +1,8 @@
+2003-06-13 John Camelon
+ Added Class/Base infrastructure to public interfaces & requestor callback.
+ Moved many internal interfaces to external packages.
+ Organized imports.
+
2003-06-13 Victor Mozgin
Renamed NullParserCallback into NullSourceElementRequester in AutomatedFramework.
diff --git a/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/AutomatedFramework.java b/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/AutomatedFramework.java
index 9b70537a3a..30dcd0c49d 100644
--- a/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/AutomatedFramework.java
+++ b/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/AutomatedFramework.java
@@ -24,7 +24,7 @@ import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
-import org.eclipse.cdt.internal.core.parser.IParserCallback;
+import org.eclipse.cdt.core.parser.IParserCallback;
import org.eclipse.cdt.internal.core.parser.NullSourceElementRequestor;
/**
diff --git a/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/BaseScannerTest.java b/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/BaseScannerTest.java
index 8cf6adae8e..954d2c208a 100644
--- a/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/BaseScannerTest.java
+++ b/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/BaseScannerTest.java
@@ -15,10 +15,10 @@ import java.io.StringReader;
import junit.framework.TestCase;
+import org.eclipse.cdt.core.parser.IToken;
+import org.eclipse.cdt.core.parser.ScannerException;
import org.eclipse.cdt.internal.core.parser.Parser;
import org.eclipse.cdt.internal.core.parser.Scanner;
-import org.eclipse.cdt.internal.core.parser.ScannerException;
-import org.eclipse.cdt.internal.core.parser.Token;
/**
* @author jcamelon
@@ -43,13 +43,13 @@ public class BaseScannerTest extends TestCase {
{
try
{
- Token t= scanner.nextToken();
+ IToken t= scanner.nextToken();
while (t != null)
{
if (verbose)
System.out.println("Token t = " + t);
- if ((t.type < 1) || (t.type > Token.tLAST))
+ if ((t.getType()> IToken.tLAST))
System.out.println("Unknown type for token " + t);
t= scanner.nextToken();
}
@@ -66,9 +66,9 @@ public class BaseScannerTest extends TestCase {
public void validateIdentifier(String expectedImage) throws ScannerException
{
try {
- Token t= scanner.nextToken();
- assertTrue(t.type == Token.tIDENTIFIER);
- assertTrue(t.image.equals(expectedImage));
+ IToken t= scanner.nextToken();
+ assertTrue(t.getType() == IToken.tIDENTIFIER);
+ assertTrue(t.getImage().equals(expectedImage));
} catch (Parser.EndOfFile e) {
assertTrue(false);
}
@@ -77,9 +77,9 @@ public class BaseScannerTest extends TestCase {
public void validateInteger(String expectedImage) throws ScannerException
{
try {
- Token t= scanner.nextToken();
- assertTrue(t.type == Token.tINTEGER);
- assertTrue(t.image.equals(expectedImage));
+ IToken t= scanner.nextToken();
+ assertTrue(t.getType() == IToken.tINTEGER);
+ assertTrue(t.getImage().equals(expectedImage));
} catch (Parser.EndOfFile e) {
assertTrue(false);
}
@@ -88,9 +88,9 @@ public class BaseScannerTest extends TestCase {
public void validateFloatingPointLiteral(String expectedImage) throws ScannerException
{
try {
- Token t= scanner.nextToken();
- assertTrue(t.type == Token.tFLOATINGPT);
- assertTrue(t.image.equals(expectedImage));
+ IToken t= scanner.nextToken();
+ assertTrue(t.getType() == IToken.tFLOATINGPT);
+ assertTrue(t.getImage().equals(expectedImage));
} catch (Parser.EndOfFile e) {
assertTrue(false);
}
@@ -99,8 +99,8 @@ public class BaseScannerTest extends TestCase {
public void validateChar( char expected )throws ScannerException
{
try {
- Token t= scanner.nextToken();
- assertTrue(t.getType() == Token.tCHAR );
+ IToken t= scanner.nextToken();
+ assertTrue(t.getType() == IToken.tCHAR );
Character c = new Character( expected );
assertEquals( t.getImage(), c.toString() );
} catch (Parser.EndOfFile e) {
@@ -110,8 +110,8 @@ public class BaseScannerTest extends TestCase {
public void validateChar( String expected ) throws ScannerException
{
try {
- Token t= scanner.nextToken();
- assertTrue(t.getType() == Token.tCHAR );
+ IToken t= scanner.nextToken();
+ assertTrue(t.getType() == IToken.tCHAR );
assertEquals( t.getImage(), expected );
} catch (Parser.EndOfFile e) {
assertTrue(false);
@@ -126,11 +126,11 @@ public class BaseScannerTest extends TestCase {
public void validateString(String expectedImage, boolean lString ) throws ScannerException
{
try {
- Token t= scanner.nextToken();
+ IToken t= scanner.nextToken();
if( lString )
- assertTrue(t.getType() == Token.tLSTRING);
+ assertTrue(t.getType() == IToken.tLSTRING);
else
- assertTrue(t.getType() == Token.tSTRING);
+ assertTrue(t.getType() == IToken.tSTRING);
assertTrue(t.getImage().equals(expectedImage));
} catch (Parser.EndOfFile e) {
assertTrue(false);
@@ -140,8 +140,8 @@ public class BaseScannerTest extends TestCase {
public void validateToken(int tokenType) throws ScannerException
{
try {
- Token t= scanner.nextToken();
- assertTrue(t.type == tokenType);
+ IToken t= scanner.nextToken();
+ assertTrue(t.getType() == tokenType);
} catch (Parser.EndOfFile e) {
assertTrue(false);
}
diff --git a/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/BranchTrackerTest.java b/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/BranchTrackerTest.java
index 96250bb040..3e1380052b 100644
--- a/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/BranchTrackerTest.java
+++ b/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/BranchTrackerTest.java
@@ -2,8 +2,8 @@ package org.eclipse.cdt.core.parser.tests;
import junit.framework.TestCase;
+import org.eclipse.cdt.core.parser.ScannerException;
import org.eclipse.cdt.internal.core.parser.BranchTracker;
-import org.eclipse.cdt.internal.core.parser.ScannerException;
/**
* @author jcamelon
diff --git a/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/DOMTests.java b/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/DOMTests.java
index f8c5fd6fc2..8077467077 100644
--- a/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/DOMTests.java
+++ b/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/DOMTests.java
@@ -6,6 +6,7 @@ import java.io.Writer;
import java.util.Iterator;
import java.util.List;
+import org.eclipse.cdt.core.parser.IToken;
import org.eclipse.cdt.internal.core.dom.ASMDefinition;
import org.eclipse.cdt.internal.core.dom.AccessSpecifier;
import org.eclipse.cdt.internal.core.dom.ArrayQualifier;
@@ -356,7 +357,7 @@ public class DOMTests extends BaseDOMTest {
assertEquals( 1, exp.elements().size() );
Token t = (Token)exp.elements().get(0);
assertEquals( t.getImage(), "5" );
- assertEquals( t.getType(), Token.tINTEGER);
+ assertEquals( t.getType(), IToken.tINTEGER);
}
/**
@@ -574,10 +575,10 @@ public class DOMTests extends BaseDOMTest {
Token t1 = (Token)initialValueParm1.elements().get( 0 );
Token t2 = (Token)initialValueParm1.elements().get( 1 );
Token t3 = (Token)initialValueParm1.elements().get( 2 );
- assertEquals( t1.getType(), Token.tINTEGER );
+ assertEquals( t1.getType(), IToken.tINTEGER );
assertEquals( t1.getImage(), "3" );
- assertEquals( t3.getType(), Token.tSTAR );
- assertEquals( t2.getType(), Token.tINTEGER );
+ assertEquals( t3.getType(), IToken.tSTAR );
+ assertEquals( t2.getType(), IToken.tINTEGER );
assertEquals( t2.getImage(), "4" );
ParameterDeclaration parm2 = (ParameterDeclaration)parameterDecls.get( 1 );
@@ -794,7 +795,7 @@ public class DOMTests extends BaseDOMTest {
assertFalse( po1.isVolatile() );
assertEquals( po1.getType(), PointerOperator.t_pointer );
Token t1 = (Token)initValue1.elements().get(0);
- assertEquals( t1.getType(), Token.tINTEGER );
+ assertEquals( t1.getType(), IToken.tINTEGER );
assertEquals( t1.getImage(), "0");
Declarator declarator2 = (Declarator)decl1.getDeclarators().get( 1 );
@@ -932,7 +933,7 @@ public class DOMTests extends BaseDOMTest {
assertEquals( expression.getExpression().elements().size(), 1 );
Token t = (Token)expression.getExpression().elements().get(0);
assertEquals( t.getImage(), "0");
- assertEquals( t.getType(), Token.tINTEGER );
+ assertEquals( t.getType(), IToken.tINTEGER );
diff --git a/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/LineNumberTest.java b/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/LineNumberTest.java
index af95172e01..5d49518375 100644
--- a/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/LineNumberTest.java
+++ b/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/LineNumberTest.java
@@ -20,6 +20,7 @@ import java.util.List;
import junit.framework.TestCase;
import org.eclipse.cdt.core.parser.IParser;
+import org.eclipse.cdt.core.parser.IToken;
import org.eclipse.cdt.internal.core.dom.ClassSpecifier;
import org.eclipse.cdt.internal.core.dom.DOMBuilder;
import org.eclipse.cdt.internal.core.dom.EnumerationSpecifier;
@@ -29,7 +30,6 @@ import org.eclipse.cdt.internal.core.dom.SimpleDeclaration;
import org.eclipse.cdt.internal.core.dom.TemplateDeclaration;
import org.eclipse.cdt.internal.core.parser.Parser;
import org.eclipse.cdt.internal.core.parser.Scanner;
-import org.eclipse.cdt.internal.core.parser.Token;
import org.eclipse.core.runtime.Path;
/**
@@ -57,25 +57,25 @@ public class LineNumberTest extends TestCase {
Reader reader = new StringReader( "int x = 3;\n foo\nfire\nfoe ");
scanner.initialize( reader, "string");
scanner.mapLineNumbers(true);
- Token t = scanner.nextToken();
- assertEquals( t.getType(), Token.t_int );
+ IToken t = scanner.nextToken();
+ assertEquals( t.getType(), IToken.t_int );
assertEquals( scanner.getLineNumberForOffset(t.getOffset()), 1 );
t = scanner.nextToken();
assertEquals( t.getImage(), "x");
assertEquals( scanner.getLineNumberForOffset(t.getOffset()), 1 );
t = scanner.nextToken();
- assertEquals( t.getType(), Token.tASSIGN );
+ assertEquals( t.getType(), IToken.tASSIGN );
assertEquals( scanner.getLineNumberForOffset(t.getOffset()), 1 );
t = scanner.nextToken();
assertEquals( t.getImage(), "3" );
assertEquals( scanner.getLineNumberForOffset(t.getOffset()), 1 );
t = scanner.nextToken();
- assertEquals( t.getType(), Token.tSEMI);
+ assertEquals( t.getType(), IToken.tSEMI);
assertEquals( scanner.getLineNumberForOffset(t.getOffset()), 1 );
for( int i = 2; i < 5; ++i )
{
t = scanner.nextToken();
- assertEquals( t.getType(), Token.tIDENTIFIER);
+ assertEquals( t.getType(), IToken.tIDENTIFIER);
assertEquals( scanner.getLineNumberForOffset(t.getOffset()), i );
}
diff --git a/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/ParserTestSuite.java b/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/ParserTestSuite.java
index 25a733fbdf..6b8bb5ebb6 100644
--- a/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/ParserTestSuite.java
+++ b/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/ParserTestSuite.java
@@ -15,7 +15,6 @@ import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.eclipse.cdt.core.model.tests.CModelElementsTests;
-import org.eclipse.cdt.core.parser.failedTests.*;
/**
* @author jcamelon
diff --git a/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/ScannerTestCase.java b/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/ScannerTestCase.java
index f6f04e10c5..1cbbd46774 100644
--- a/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/ScannerTestCase.java
+++ b/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/ScannerTestCase.java
@@ -4,9 +4,10 @@ import java.io.StringWriter;
import java.io.Writer;
import java.util.List;
-import org.eclipse.cdt.internal.core.parser.IMacroDescriptor;
+import org.eclipse.cdt.core.parser.IMacroDescriptor;
+import org.eclipse.cdt.core.parser.IToken;
+import org.eclipse.cdt.core.parser.ScannerException;
import org.eclipse.cdt.internal.core.parser.Parser;
-import org.eclipse.cdt.internal.core.parser.ScannerException;
import org.eclipse.cdt.internal.core.parser.Token;
/**
@@ -182,7 +183,7 @@ public class ScannerTestCase extends BaseScannerTest
validateFloatingPointLiteral( "3.");
validateFloatingPointLiteral( "4E5");
validateFloatingPointLiteral( "2.01E-03" );
- validateToken( Token.tELIPSE );
+ validateToken( IToken.tELIPSE );
validateEOF();
}
catch( ScannerException se )
@@ -207,42 +208,42 @@ public class ScannerTestCase extends BaseScannerTest
try
{
initializeScanner("#define SIMPLE_NUMERIC 5\nint x = SIMPLE_NUMERIC");
- validateToken(Token.t_int);
+ validateToken(IToken.t_int);
validateDefinition("SIMPLE_NUMERIC", "5");
validateIdentifier("x");
- validateToken(Token.tASSIGN);
+ validateToken(IToken.tASSIGN);
validateInteger("5");
validateEOF();
initializeScanner("#define SIMPLE_STRING \"This is a simple string.\"\n\nconst char * myVariable = SIMPLE_STRING;");
- validateToken(Token.t_const);
+ validateToken(IToken.t_const);
validateDefinition("SIMPLE_STRING", "\"This is a simple string.\"");
- validateToken(Token.t_char);
- validateToken(Token.tSTAR);
+ validateToken(IToken.t_char);
+ validateToken(IToken.tSTAR);
validateIdentifier("myVariable");
- validateToken(Token.tASSIGN);
+ validateToken(IToken.tASSIGN);
validateString("This is a simple string.");
- validateToken(Token.tSEMI);
+ validateToken(IToken.tSEMI);
validateEOF();
initializeScanner("#define FOOL 5 \n int tryAFOOL = FOOL + FOOL;");
- validateToken(Token.t_int);
+ validateToken(IToken.t_int);
validateIdentifier("tryAFOOL");
- validateToken(Token.tASSIGN);
+ validateToken(IToken.tASSIGN);
validateInteger("5");
- validateToken(Token.tPLUS);
+ validateToken(IToken.tPLUS);
validateInteger("5");
- validateToken(Token.tSEMI);
+ validateToken(IToken.tSEMI);
validateEOF();
initializeScanner("#define FOOL 5 \n int FOOLer = FOOL;");
- validateToken(Token.t_int);
+ validateToken(IToken.t_int);
validateIdentifier("FOOLer");
- validateToken(Token.tASSIGN);
+ validateToken(IToken.tASSIGN);
validateInteger("5");
- validateToken(Token.tSEMI);
+ validateToken(IToken.tSEMI);
validateEOF();
// the case we were failing against in ctype.h
@@ -384,13 +385,13 @@ public class ScannerTestCase extends BaseScannerTest
try
{
initializeScanner("#define F1 3\n#define F2 F1##F1\nint x=F2;");
- validateToken(Token.t_int);
+ validateToken(IToken.t_int);
validateDefinition("F1", "3");
validateDefinition( "F2", "F1##F1");
validateIdentifier("x");
- validateToken(Token.tASSIGN);
+ validateToken(IToken.tASSIGN);
validateInteger("33");
- validateToken(Token.tSEMI);
+ validateToken(IToken.tSEMI);
validateEOF();
initializeScanner("#define PREFIX RT_\n#define RUN PREFIX##Run");
@@ -406,18 +407,18 @@ public class ScannerTestCase extends BaseScannerTest
try
{
initializeScanner( "#define DECLARE_HANDLE(name) struct name##__ { int unused; }; typedef struct name##__ *name\n DECLARE_HANDLE( joe )" );
- validateToken( Token.t_struct );
+ validateToken( IToken.t_struct );
validateIdentifier( "joe__");
- validateToken( Token.tLBRACE);
- validateToken( Token.t_int );
+ validateToken( IToken.tLBRACE);
+ validateToken( IToken.t_int );
validateIdentifier( "unused");
- validateToken( Token.tSEMI );
- validateToken( Token.tRBRACE );
- validateToken( Token.tSEMI );
- validateToken( Token.t_typedef );
- validateToken( Token.t_struct );
+ validateToken( IToken.tSEMI );
+ validateToken( IToken.tRBRACE );
+ validateToken( IToken.tSEMI );
+ validateToken( IToken.t_typedef );
+ validateToken( IToken.t_struct );
validateIdentifier( "joe__" );
- validateToken( Token.tSTAR );
+ validateToken( IToken.tSTAR );
validateIdentifier( "joe");
validateEOF();
}
@@ -434,36 +435,36 @@ public class ScannerTestCase extends BaseScannerTest
initializeScanner("#define SYMBOL 5\n#ifdef SYMBOL\nint counter(SYMBOL);\n#endif");
- validateToken(Token.t_int);
+ validateToken(IToken.t_int);
validateIdentifier("counter");
- validateToken(Token.tLPAREN);
+ validateToken(IToken.tLPAREN);
validateInteger("5");
- validateToken(Token.tRPAREN);
- validateToken(Token.tSEMI);
+ validateToken(IToken.tRPAREN);
+ validateToken(IToken.tSEMI);
validateEOF();
initializeScanner("#define SYMBOL 5\n#ifndef SYMBOL\nint counter(SYMBOL);\n#endif");
validateEOF();
initializeScanner("#ifndef DEFINED\n#define DEFINED 100\n#endif\nint count = DEFINED;");
- validateToken(Token.t_int);
+ validateToken(IToken.t_int);
validateDefinition("DEFINED", "100");
validateIdentifier("count");
- validateToken(Token.tASSIGN);
+ validateToken(IToken.tASSIGN);
validateInteger("100");
- validateToken(Token.tSEMI);
+ validateToken(IToken.tSEMI);
validateEOF();
initializeScanner("#ifndef DEFINED\n#define DEFINED 100\n#endif\nint count = DEFINED;");
scanner.addDefinition("DEFINED", "101");
validateDefinition("DEFINED", "101");
- validateToken(Token.t_int);
+ validateToken(IToken.t_int);
validateIdentifier("count");
- validateToken(Token.tASSIGN);
+ validateToken(IToken.tASSIGN);
validateInteger("101");
- validateToken(Token.tSEMI);
+ validateToken(IToken.tSEMI);
validateEOF();
initializeScanner( "/* NB: This is #if 0'd out */");
@@ -483,7 +484,7 @@ public class ScannerTestCase extends BaseScannerTest
code.write( " + 44\n\nCOMPLEX_MACRO");
initializeScanner( code.toString() );
validateInteger( "33" );
- validateToken( Token.tPLUS );
+ validateToken( IToken.tPLUS );
validateInteger( "44" );
}
@@ -504,32 +505,32 @@ public class ScannerTestCase extends BaseScannerTest
{
initializeScanner("#ifndef ONE\n#define ONE 1\n#ifdef TWO\n#define THREE ONE + TWO\n#endif\n#endif\nint three(THREE);");
- validateToken(Token.t_int);
+ validateToken(IToken.t_int);
validateDefinition("ONE", "1");
validateAsUndefined("TWO");
validateAsUndefined("THREE");
validateIdentifier("three");
- validateToken(Token.tLPAREN);
+ validateToken(IToken.tLPAREN);
validateIdentifier("THREE");
- validateToken(Token.tRPAREN);
- validateToken(Token.tSEMI);
+ validateToken(IToken.tRPAREN);
+ validateToken(IToken.tSEMI);
validateEOF();
validateBalance();
initializeScanner("#ifndef ONE\n#define ONE 1\n#ifdef TWO\n#define THREE ONE + TWO\n#endif\n#endif\nint three(THREE);");
scanner.addDefinition("TWO", "2");
- validateToken(Token.t_int);
+ validateToken(IToken.t_int);
validateDefinition("ONE", "1");
validateDefinition("TWO", "2");
validateDefinition("THREE", "ONE + TWO");
validateIdentifier("three");
- validateToken(Token.tLPAREN);
+ validateToken(IToken.tLPAREN);
validateInteger("1");
- validateToken(Token.tPLUS);
+ validateToken(IToken.tPLUS);
validateInteger("2");
- validateToken(Token.tRPAREN);
- validateToken(Token.tSEMI);
+ validateToken(IToken.tRPAREN);
+ validateToken(IToken.tSEMI);
validateEOF();
validateBalance();
@@ -685,7 +686,7 @@ public class ScannerTestCase extends BaseScannerTest
try
{
initializeScanner("#if ! 0\n#error Correct!\n#endif");
- Token t= scanner.nextToken();
+ IToken t= scanner.nextToken();
fail(EXPECTED_FAILURE);
}
catch (ScannerException se)
@@ -704,12 +705,12 @@ public class ScannerTestCase extends BaseScannerTest
try
{
initializeScanner("#define GO(x) x+1\nint y(5);\ny = GO(y);");
- validateToken(Token.t_int);
+ validateToken(IToken.t_int);
validateIdentifier("y");
- validateToken(Token.tLPAREN);
+ validateToken(IToken.tLPAREN);
validateInteger("5");
- validateToken(Token.tRPAREN);
- validateToken(Token.tSEMI);
+ validateToken(IToken.tRPAREN);
+ validateToken(IToken.tSEMI);
IMacroDescriptor descriptor=
(IMacroDescriptor) scanner.getDefinition("GO");
@@ -721,18 +722,18 @@ public class ScannerTestCase extends BaseScannerTest
List expansion= descriptor.getTokenizedExpansion();
assertNotNull(parms);
assertTrue(expansion.size() == 3);
- assertTrue(((Token) expansion.get(0)).type == Token.tIDENTIFIER);
+ assertTrue(((Token) expansion.get(0)).type == IToken.tIDENTIFIER);
assertTrue(((Token) expansion.get(0)).image.equals("x"));
- assertTrue(((Token) expansion.get(1)).type == Token.tPLUS);
- assertTrue(((Token) expansion.get(2)).type == Token.tINTEGER);
+ assertTrue(((Token) expansion.get(1)).type == IToken.tPLUS);
+ assertTrue(((Token) expansion.get(2)).type == IToken.tINTEGER);
assertTrue(((Token) expansion.get(2)).image.equals("1"));
validateIdentifier("y");
- validateToken(Token.tASSIGN);
+ validateToken(IToken.tASSIGN);
validateIdentifier("y");
- validateToken(Token.tPLUS);
+ validateToken(IToken.tPLUS);
validateInteger("1");
- validateToken(Token.tSEMI);
+ validateToken(IToken.tSEMI);
validateEOF();
validateBalance();
@@ -740,25 +741,25 @@ public class ScannerTestCase extends BaseScannerTest
"#define ONE 1\n"
+ "#define SUM(a,b,c,d,e,f,g) ( a + b + c + d + e + f + g )\n"
+ "int daSum = SUM(ONE,3,5,7,9,11,13);");
- validateToken(Token.t_int);
+ validateToken(IToken.t_int);
validateIdentifier("daSum");
- validateToken(Token.tASSIGN);
- validateToken(Token.tLPAREN);
+ validateToken(IToken.tASSIGN);
+ validateToken(IToken.tLPAREN);
validateInteger("1");
- validateToken(Token.tPLUS);
+ validateToken(IToken.tPLUS);
validateInteger("3");
- validateToken(Token.tPLUS);
+ validateToken(IToken.tPLUS);
validateInteger("5");
- validateToken(Token.tPLUS);
+ validateToken(IToken.tPLUS);
validateInteger("7");
- validateToken(Token.tPLUS);
+ validateToken(IToken.tPLUS);
validateInteger("9");
- validateToken(Token.tPLUS);
+ validateToken(IToken.tPLUS);
validateInteger("11");
- validateToken(Token.tPLUS);
+ validateToken(IToken.tPLUS);
validateInteger("13");
- validateToken(Token.tRPAREN);
- validateToken(Token.tSEMI);
+ validateToken(IToken.tRPAREN);
+ validateToken(IToken.tSEMI);
validateEOF();
IMacroDescriptor macro= (IMacroDescriptor) scanner.getDefinition("SUM");
@@ -772,61 +773,61 @@ public class ScannerTestCase extends BaseScannerTest
initializeScanner("#define LOG( format, var1) printf( format, var1 )\nLOG( \"My name is %s\", \"Bogdan\" );\n");
validateIdentifier("printf");
- validateToken(Token.tLPAREN);
+ validateToken(IToken.tLPAREN);
validateString("My name is %s");
- validateToken(Token.tCOMMA);
+ validateToken(IToken.tCOMMA);
validateString("Bogdan");
- validateToken(Token.tRPAREN);
- validateToken(Token.tSEMI);
+ validateToken(IToken.tRPAREN);
+ validateToken(IToken.tSEMI);
validateEOF();
initializeScanner("#define INCR( x ) ++x\nint y(2);\nINCR(y);");
- validateToken(Token.t_int);
+ validateToken(IToken.t_int);
validateIdentifier("y");
- validateToken(Token.tLPAREN);
+ validateToken(IToken.tLPAREN);
validateInteger("2");
- validateToken(Token.tRPAREN);
- validateToken(Token.tSEMI);
- validateToken(Token.tINCR);
+ validateToken(IToken.tRPAREN);
+ validateToken(IToken.tSEMI);
+ validateToken(IToken.tINCR);
validateIdentifier("y");
- validateToken(Token.tSEMI);
+ validateToken(IToken.tSEMI);
validateEOF();
initializeScanner("#define CHECK_AND_SET( x, y, z ) if( x ) { \\\n y = z; \\\n }\n\nCHECK_AND_SET( 1, balance, 5000 );\nCHECK_AND_SET( confused(), you, dumb );");
- validateToken(Token.t_if);
- validateToken(Token.tLPAREN);
+ validateToken(IToken.t_if);
+ validateToken(IToken.tLPAREN);
validateInteger("1");
- validateToken(Token.tRPAREN);
- validateToken(Token.tLBRACE);
+ validateToken(IToken.tRPAREN);
+ validateToken(IToken.tLBRACE);
validateIdentifier("balance");
- validateToken(Token.tASSIGN);
+ validateToken(IToken.tASSIGN);
validateInteger("5000");
- validateToken(Token.tSEMI);
- validateToken(Token.tRBRACE);
- validateToken(Token.tSEMI);
+ validateToken(IToken.tSEMI);
+ validateToken(IToken.tRBRACE);
+ validateToken(IToken.tSEMI);
- validateToken(Token.t_if);
- validateToken(Token.tLPAREN);
+ validateToken(IToken.t_if);
+ validateToken(IToken.tLPAREN);
validateIdentifier("confused");
- validateToken(Token.tLPAREN);
- validateToken(Token.tRPAREN);
- validateToken(Token.tRPAREN);
- validateToken(Token.tLBRACE);
+ validateToken(IToken.tLPAREN);
+ validateToken(IToken.tRPAREN);
+ validateToken(IToken.tRPAREN);
+ validateToken(IToken.tLBRACE);
validateIdentifier("you");
- validateToken(Token.tASSIGN);
+ validateToken(IToken.tASSIGN);
validateIdentifier("dumb");
- validateToken(Token.tSEMI);
- validateToken(Token.tRBRACE);
- validateToken(Token.tSEMI);
+ validateToken(IToken.tSEMI);
+ validateToken(IToken.tRBRACE);
+ validateToken(IToken.tSEMI);
validateEOF();
initializeScanner("#define ON 7\n#if defined(ON)\nint itsOn = ON;\n#endif");
- validateToken(Token.t_int);
+ validateToken(IToken.t_int);
validateBalance(1);
validateIdentifier("itsOn");
- validateToken(Token.tASSIGN);
+ validateToken(IToken.tASSIGN);
validateInteger("7");
- validateToken(Token.tSEMI);
+ validateToken(IToken.tSEMI);
validateEOF();
validateBalance();
@@ -851,11 +852,11 @@ public class ScannerTestCase extends BaseScannerTest
{
initializeScanner( "#if X + 5 < 7\n int found = 1;\n#endif" );
scanner.setQuickScan( true );
- validateToken( Token.t_int );
+ validateToken( IToken.t_int );
validateIdentifier( "found" );
- validateToken( Token.tASSIGN );
+ validateToken( IToken.tASSIGN );
validateInteger( "1");
- validateToken( Token.tSEMI );
+ validateToken( IToken.tSEMI );
validateEOF();
}
@@ -997,46 +998,46 @@ public class ScannerTestCase extends BaseScannerTest
{
initializeScanner( "X::X( const X & rtg_arg ) : U( rtg_arg ) , Z( rtg_arg.Z ) , er( rtg_arg.er ){}" );
validateIdentifier("X");
- validateToken( Token.tCOLONCOLON);
+ validateToken( IToken.tCOLONCOLON);
validateIdentifier("X");
- validateToken( Token.tLPAREN );
- validateToken( Token.t_const );
+ validateToken( IToken.tLPAREN );
+ validateToken( IToken.t_const );
validateIdentifier("X");
- validateToken( Token.tAMPER );
+ validateToken( IToken.tAMPER );
validateIdentifier( "rtg_arg");
- validateToken( Token.tRPAREN );
- validateToken( Token.tCOLON );
+ validateToken( IToken.tRPAREN );
+ validateToken( IToken.tCOLON );
validateIdentifier( "U");
- validateToken( Token.tLPAREN );
+ validateToken( IToken.tLPAREN );
validateIdentifier( "rtg_arg");
- validateToken( Token.tRPAREN );
- validateToken( Token.tCOMMA );
+ validateToken( IToken.tRPAREN );
+ validateToken( IToken.tCOMMA );
validateIdentifier( "Z");
- validateToken( Token.tLPAREN );
+ validateToken( IToken.tLPAREN );
validateIdentifier( "rtg_arg");
- validateToken( Token.tDOT );
+ validateToken( IToken.tDOT );
validateIdentifier( "Z");
- validateToken( Token.tRPAREN );
- validateToken( Token.tCOMMA );
+ validateToken( IToken.tRPAREN );
+ validateToken( IToken.tCOMMA );
validateIdentifier( "er");
- validateToken( Token.tLPAREN );
+ validateToken( IToken.tLPAREN );
validateIdentifier( "rtg_arg");
- validateToken( Token.tDOT );
+ validateToken( IToken.tDOT );
validateIdentifier( "er");
- validateToken( Token.tRPAREN );
- validateToken( Token.tLBRACE);
- validateToken( Token.tRBRACE);
+ validateToken( IToken.tRPAREN );
+ validateToken( IToken.tLBRACE);
+ validateToken( IToken.tRBRACE);
validateEOF();
initializeScanner( "foo.*bar");
validateIdentifier("foo");
- validateToken( Token.tDOTSTAR );
+ validateToken( IToken.tDOTSTAR );
validateIdentifier("bar");
validateEOF();
initializeScanner( "foo...bar");
validateIdentifier("foo");
- validateToken( Token.tELIPSE );
+ validateToken( IToken.tELIPSE );
validateIdentifier("bar");
validateEOF();
}
@@ -1097,41 +1098,41 @@ public class ScannerTestCase extends BaseScannerTest
break;
}
- validateToken( Token.t_int );
+ validateToken( IToken.t_int );
validateIdentifier( "foobar");
- validateToken( Token.tLPAREN );
- validateToken( Token.t_int );
+ validateToken( IToken.tLPAREN );
+ validateToken( IToken.t_int );
validateIdentifier( "a" );
- validateToken( Token.tRPAREN );
- validateToken( Token.tLBRACE );
- validateToken( Token.t_if );
- validateToken( Token.tLPAREN );
+ validateToken( IToken.tRPAREN );
+ validateToken( IToken.tLBRACE );
+ validateToken( IToken.t_if );
+ validateToken( IToken.tLPAREN );
validateIdentifier( "a" );
- validateToken( Token.tEQUAL );
+ validateToken( IToken.tEQUAL );
validateInteger( "0" );
- validateToken( Token.tRPAREN );
- validateToken( Token.tLBRACE );
+ validateToken( IToken.tRPAREN );
+ validateToken( IToken.tLBRACE );
if( i <= 1 )
{
- validateToken( Token.tRBRACE );
- validateToken( Token.t_else );
- validateToken( Token.tLBRACE );
- validateToken( Token.tRBRACE );
+ validateToken( IToken.tRBRACE );
+ validateToken( IToken.t_else );
+ validateToken( IToken.tLBRACE );
+ validateToken( IToken.tRBRACE );
}
if( i == 2 )
{
- validateToken( Token.tRBRACE );
- validateToken( Token.t_else );
- validateToken( Token.tLBRACE );
- validateToken( Token.tRBRACE );
+ validateToken( IToken.tRBRACE );
+ validateToken( IToken.t_else );
+ validateToken( IToken.tLBRACE );
+ validateToken( IToken.tRBRACE );
}
- validateToken( Token.t_return );
+ validateToken( IToken.t_return );
validateInteger( "0");
- validateToken( Token.tSEMI );
- validateToken( Token.tRBRACE );
+ validateToken( IToken.tSEMI );
+ validateToken( IToken.tRBRACE );
validateEOF();
}
} catch( ScannerException se )
@@ -1160,7 +1161,7 @@ public class ScannerTestCase extends BaseScannerTest
validateIdentifier("B");
validateDefinition("A", "B->A");
- validateToken(Token.tARROW);
+ validateToken(IToken.tARROW);
validateIdentifier("A");
validateEOF();
}
@@ -1218,14 +1219,14 @@ public class ScannerTestCase extends BaseScannerTest
initializeScanner( writer.toString() );
//printf("x1=%d, x2= %s", x1, x2);
validateIdentifier( "printf" );
- validateToken( Token.tLPAREN );
+ validateToken( IToken.tLPAREN );
validateString("x1= %d, x2= %s");
- validateToken(Token.tCOMMA);
+ validateToken(IToken.tCOMMA);
validateIdentifier("x1");
- validateToken(Token.tCOMMA);
+ validateToken(IToken.tCOMMA);
validateIdentifier("x2");
- validateToken(Token.tRPAREN);
- validateToken(Token.tSEMI);
+ validateToken(IToken.tRPAREN);
+ validateToken(IToken.tSEMI);
validateEOF();
}
@@ -1249,12 +1250,12 @@ public class ScannerTestCase extends BaseScannerTest
initializeScanner( writer.toString() );
validateIdentifier("fputs");
- validateToken(Token.tLPAREN);
+ validateToken(IToken.tLPAREN);
validateString("strncmp ( \\\"abc\\\\0d\\\" , \\\"abc\\\" , '\\\\4' ) == 0");
- validateToken(Token.tCOMMA);
+ validateToken(IToken.tCOMMA);
validateIdentifier("s");
- validateToken(Token.tRPAREN);
- validateToken(Token.tSEMI);
+ validateToken(IToken.tRPAREN);
+ validateToken(IToken.tSEMI);
}
public void testBug36770() throws Exception

Back to the top