mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Update IASTExpression.
Move Parser.Backtrack and Parser.EndOfFile to external interface.
This commit is contained in:
parent
d16fc6884e
commit
728848ffc6
23 changed files with 205 additions and 73 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2003-06-26 John Camelon
|
||||||
|
Update IASTExpression.
|
||||||
|
Move Parser.Backtrack and Parser.EndOfFile to external interface.
|
||||||
|
|
||||||
2003-06-25 John Camelon
|
2003-06-25 John Camelon
|
||||||
Added DOMFailedTest::testBug39349().
|
Added DOMFailedTest::testBug39349().
|
||||||
Added DOMTests::testBug39348().
|
Added DOMTests::testBug39348().
|
||||||
|
|
|
@ -15,11 +15,11 @@ import java.io.StringReader;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.parser.EndOfFile;
|
||||||
import org.eclipse.cdt.core.parser.IScanner;
|
import org.eclipse.cdt.core.parser.IScanner;
|
||||||
import org.eclipse.cdt.core.parser.IToken;
|
import org.eclipse.cdt.core.parser.IToken;
|
||||||
import org.eclipse.cdt.core.parser.ParserFactory;
|
import org.eclipse.cdt.core.parser.ParserFactory;
|
||||||
import org.eclipse.cdt.core.parser.ScannerException;
|
import org.eclipse.cdt.core.parser.ScannerException;
|
||||||
import org.eclipse.cdt.internal.core.parser.Parser;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
|
@ -54,7 +54,7 @@ public class BaseScannerTest extends TestCase {
|
||||||
t= scanner.nextToken();
|
t= scanner.nextToken();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Parser.EndOfFile e)
|
catch ( EndOfFile e)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
catch (ScannerException se)
|
catch (ScannerException se)
|
||||||
|
@ -69,7 +69,7 @@ public class BaseScannerTest extends TestCase {
|
||||||
IToken t= scanner.nextToken();
|
IToken t= scanner.nextToken();
|
||||||
assertTrue(t.getType() == IToken.tIDENTIFIER);
|
assertTrue(t.getType() == IToken.tIDENTIFIER);
|
||||||
assertTrue(t.getImage().equals(expectedImage));
|
assertTrue(t.getImage().equals(expectedImage));
|
||||||
} catch (Parser.EndOfFile e) {
|
} catch (EndOfFile e) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ public class BaseScannerTest extends TestCase {
|
||||||
IToken t= scanner.nextToken();
|
IToken t= scanner.nextToken();
|
||||||
assertTrue(t.getType() == IToken.tINTEGER);
|
assertTrue(t.getType() == IToken.tINTEGER);
|
||||||
assertTrue(t.getImage().equals(expectedImage));
|
assertTrue(t.getImage().equals(expectedImage));
|
||||||
} catch (Parser.EndOfFile e) {
|
} catch (EndOfFile e) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ public class BaseScannerTest extends TestCase {
|
||||||
IToken t= scanner.nextToken();
|
IToken t= scanner.nextToken();
|
||||||
assertTrue(t.getType() == IToken.tFLOATINGPT);
|
assertTrue(t.getType() == IToken.tFLOATINGPT);
|
||||||
assertTrue(t.getImage().equals(expectedImage));
|
assertTrue(t.getImage().equals(expectedImage));
|
||||||
} catch (Parser.EndOfFile e) {
|
} catch (EndOfFile e) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ public class BaseScannerTest extends TestCase {
|
||||||
assertTrue(t.getType() == IToken.tCHAR );
|
assertTrue(t.getType() == IToken.tCHAR );
|
||||||
Character c = new Character( expected );
|
Character c = new Character( expected );
|
||||||
assertEquals( t.getImage(), c.toString() );
|
assertEquals( t.getImage(), c.toString() );
|
||||||
} catch (Parser.EndOfFile e) {
|
} catch (EndOfFile e) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ public class BaseScannerTest extends TestCase {
|
||||||
IToken t= scanner.nextToken();
|
IToken t= scanner.nextToken();
|
||||||
assertTrue(t.getType() == IToken.tCHAR );
|
assertTrue(t.getType() == IToken.tCHAR );
|
||||||
assertEquals( t.getImage(), expected );
|
assertEquals( t.getImage(), expected );
|
||||||
} catch (Parser.EndOfFile e) {
|
} catch (EndOfFile e) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -132,7 +132,7 @@ public class BaseScannerTest extends TestCase {
|
||||||
else
|
else
|
||||||
assertTrue(t.getType() == IToken.tSTRING);
|
assertTrue(t.getType() == IToken.tSTRING);
|
||||||
assertTrue(t.getImage().equals(expectedImage));
|
assertTrue(t.getImage().equals(expectedImage));
|
||||||
} catch (Parser.EndOfFile e) {
|
} catch (EndOfFile e) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ public class BaseScannerTest extends TestCase {
|
||||||
try {
|
try {
|
||||||
IToken t= scanner.nextToken();
|
IToken t= scanner.nextToken();
|
||||||
assertTrue(t.getType() == tokenType);
|
assertTrue(t.getType() == tokenType);
|
||||||
} catch (Parser.EndOfFile e) {
|
} catch (EndOfFile e) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -161,7 +161,7 @@ public class BaseScannerTest extends TestCase {
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
assertNull(scanner.nextToken());
|
assertNull(scanner.nextToken());
|
||||||
} catch (Parser.EndOfFile e) {
|
} catch (EndOfFile e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,11 +4,11 @@ import java.io.StringWriter;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.parser.EndOfFile;
|
||||||
import org.eclipse.cdt.core.parser.IMacroDescriptor;
|
import org.eclipse.cdt.core.parser.IMacroDescriptor;
|
||||||
import org.eclipse.cdt.core.parser.IToken;
|
import org.eclipse.cdt.core.parser.IToken;
|
||||||
import org.eclipse.cdt.core.parser.ParserMode;
|
import org.eclipse.cdt.core.parser.ParserMode;
|
||||||
import org.eclipse.cdt.core.parser.ScannerException;
|
import org.eclipse.cdt.core.parser.ScannerException;
|
||||||
import org.eclipse.cdt.internal.core.parser.Parser;
|
|
||||||
import org.eclipse.cdt.internal.core.parser.Token;
|
import org.eclipse.cdt.internal.core.parser.Token;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -847,7 +847,7 @@ public class ScannerTestCase extends BaseScannerTest
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testQuickScan() throws Parser.EndOfFile
|
public void testQuickScan() throws EndOfFile
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
2003-06-26 John Camelon
|
||||||
|
Update IASTExpression.
|
||||||
|
Move Parser.Backtrack and Parser.EndOfFile to external interface.
|
||||||
|
|
||||||
2003-06-25 John Camelon
|
2003-06-25 John Camelon
|
||||||
Fixed bug39348 - sizeof elaborated types fail in parsing expression
|
Fixed bug39348 - sizeof elaborated types fail in parsing expression
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* Copyright (c) 2002,2003 Rational Software Corporation and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Common Public License v0.5
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/cpl-v05.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* IBM Rational Software - Initial API and implementation
|
||||||
|
***********************************************************************/
|
||||||
|
package org.eclipse.cdt.core.parser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class Backtrack extends Exception
|
||||||
|
{
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* Copyright (c) 2002,2003 Rational Software Corporation and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Common Public License v0.5
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/cpl-v05.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* IBM Rational Software - Initial API and implementation
|
||||||
|
***********************************************************************/
|
||||||
|
package org.eclipse.cdt.core.parser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class EndOfFile extends Backtrack
|
||||||
|
{
|
||||||
|
}
|
|
@ -8,20 +8,18 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Rational Software - Initial API and implementation
|
* IBM Rational Software - Initial API and implementation
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
package org.eclipse.cdt.core.parser.ast;
|
package org.eclipse.cdt.core.parser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ClassNameType {
|
public class Enum
|
||||||
|
{
|
||||||
public static final ClassNameType IDENTIFIER = new ClassNameType( 1 );
|
protected Enum( int enumValue )
|
||||||
public static final ClassNameType TEMPLATE = new ClassNameType( 2 );
|
|
||||||
|
|
||||||
private final int type;
|
|
||||||
private ClassNameType( int t )
|
|
||||||
{
|
{
|
||||||
type = t;
|
this.enumValue = enumValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int enumValue;
|
||||||
}
|
}
|
|
@ -10,7 +10,6 @@
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
package org.eclipse.cdt.core.parser;
|
package org.eclipse.cdt.core.parser;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.core.parser.Parser.Backtrack;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -3,7 +3,6 @@ package org.eclipse.cdt.core.parser;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTFactory;
|
import org.eclipse.cdt.core.parser.ast.IASTFactory;
|
||||||
import org.eclipse.cdt.internal.core.parser.Parser;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
|
@ -24,8 +23,8 @@ public interface IScanner {
|
||||||
public void overwriteIncludePath( List newIncludePaths );
|
public void overwriteIncludePath( List newIncludePaths );
|
||||||
public void setRequestor( ISourceElementRequestor r );
|
public void setRequestor( ISourceElementRequestor r );
|
||||||
|
|
||||||
public IToken nextToken() throws ScannerException, Parser.EndOfFile;
|
public IToken nextToken() throws ScannerException, EndOfFile;
|
||||||
public IToken nextToken( boolean next ) throws ScannerException, Parser.EndOfFile;
|
public IToken nextToken( boolean next ) throws ScannerException, EndOfFile;
|
||||||
|
|
||||||
public void setCppNature( boolean value );
|
public void setCppNature( boolean value );
|
||||||
|
|
||||||
|
@ -37,7 +36,7 @@ public interface IScanner {
|
||||||
/**
|
/**
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public IToken nextTokenForStringizing() throws ScannerException, Parser.EndOfFile;
|
public IToken nextTokenForStringizing() throws ScannerException, EndOfFile;
|
||||||
/**
|
/**
|
||||||
* @param b
|
* @param b
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -10,11 +10,13 @@
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
package org.eclipse.cdt.core.parser.ast;
|
package org.eclipse.cdt.core.parser.ast;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.parser.Enum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class AccessVisibility {
|
public class AccessVisibility extends Enum {
|
||||||
|
|
||||||
public static final AccessVisibility PUBLIC = new AccessVisibility( 1 );
|
public static final AccessVisibility PUBLIC = new AccessVisibility( 1 );
|
||||||
public static final AccessVisibility PROTECTED = new AccessVisibility( 2 );
|
public static final AccessVisibility PROTECTED = new AccessVisibility( 2 );
|
||||||
|
@ -22,8 +24,7 @@ public class AccessVisibility {
|
||||||
|
|
||||||
private AccessVisibility( int constant)
|
private AccessVisibility( int constant)
|
||||||
{
|
{
|
||||||
value = constant;
|
super( constant );
|
||||||
}
|
}
|
||||||
|
|
||||||
private final int value;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,22 +10,22 @@
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
package org.eclipse.cdt.core.parser.ast;
|
package org.eclipse.cdt.core.parser.ast;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.parser.Enum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ClassKind {
|
public class ClassKind extends Enum {
|
||||||
|
|
||||||
public final static ClassKind CLASS = new ClassKind( 1 );
|
public final static ClassKind CLASS = new ClassKind( 1 );
|
||||||
public final static ClassKind STRUCT = new ClassKind( 2 );
|
public final static ClassKind STRUCT = new ClassKind( 2 );
|
||||||
public final static ClassKind UNION = new ClassKind( 3 );
|
public final static ClassKind UNION = new ClassKind( 3 );
|
||||||
public final static ClassKind ENUM = new ClassKind( 4 );
|
public final static ClassKind ENUM = new ClassKind( 4 );
|
||||||
|
|
||||||
protected ClassKind( int value )
|
private ClassKind( int value )
|
||||||
{
|
{
|
||||||
this.value = value;
|
super( value );
|
||||||
}
|
}
|
||||||
|
|
||||||
private final int value;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@ package org.eclipse.cdt.core.parser.ast;
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface IASTConstantExpression extends IASTExpression
|
public class ExpressionEvaluationException extends Exception
|
||||||
{
|
{
|
||||||
public int evaluate();
|
|
||||||
}
|
}
|
|
@ -12,12 +12,25 @@ package org.eclipse.cdt.core.parser.ast;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.parser.Enum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface IASTClassSpecifier extends IASTTypeSpecifier, IASTScope, IASTOffsetableNamedElement, IASTTemplatedDeclaration {
|
public interface IASTClassSpecifier extends IASTTypeSpecifier, IASTScope, IASTOffsetableNamedElement, IASTTemplatedDeclaration {
|
||||||
|
|
||||||
|
public class ClassNameType extends Enum {
|
||||||
|
|
||||||
|
public static final ClassNameType IDENTIFIER = new ClassNameType( 1 );
|
||||||
|
public static final ClassNameType TEMPLATE = new ClassNameType( 2 );
|
||||||
|
|
||||||
|
private ClassNameType( int t )
|
||||||
|
{
|
||||||
|
super( t );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public ClassNameType getClassNameType();
|
public ClassNameType getClassNameType();
|
||||||
|
|
||||||
public ClassKind getClassKind();
|
public ClassKind getClassKind();
|
||||||
|
|
|
@ -10,11 +10,99 @@
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
package org.eclipse.cdt.core.parser.ast;
|
package org.eclipse.cdt.core.parser.ast;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.parser.Enum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface IASTExpression
|
public interface IASTExpression
|
||||||
{
|
{
|
||||||
|
public class ExpressionKind extends Enum
|
||||||
|
{
|
||||||
|
public static final ExpressionKind PRIMARY_INTEGER_LITERAL = new ExpressionKind( 0 );
|
||||||
|
public static final ExpressionKind PRIMARY_CHAR_LITERAL = new ExpressionKind( 1 );
|
||||||
|
public static final ExpressionKind PRIMARY_FLOAT_LITERAL = new ExpressionKind( 2 );
|
||||||
|
public static final ExpressionKind PRIMARY_STRING_LITERAL = new ExpressionKind( 3 );
|
||||||
|
public static final ExpressionKind PRIMARY_BOOLEAN_LITERAL = new ExpressionKind( 4 );
|
||||||
|
public static final ExpressionKind PRIMARY_THIS = new ExpressionKind( 5 );
|
||||||
|
public static final ExpressionKind PRIMARY_BRACKETED_EXPRESSION = new ExpressionKind( 6 );
|
||||||
|
public static final ExpressionKind ID_EXPRESSION = new ExpressionKind( 7 );
|
||||||
|
public static final ExpressionKind POSTFIX_ARRAY = new ExpressionKind( 8 );
|
||||||
|
public static final ExpressionKind POSTFIX_CONSTRUCT = new ExpressionKind( 9 );
|
||||||
|
public static final ExpressionKind POSTFIX_SIMPLETYPE_CONSTRUCT = new ExpressionKind( 10 );
|
||||||
|
public static final ExpressionKind POSTFIX_TYPENAME_IDENTIFIER = new ExpressionKind( 11 );
|
||||||
|
public static final ExpressionKind POSTFIX_TYPENAME_TEMPLATEID = new ExpressionKind( 12 );
|
||||||
|
public static final ExpressionKind POSTFIX_DOT_IDEXPRESSION = new ExpressionKind( 13 );
|
||||||
|
public static final ExpressionKind POSTFIX_ARROW_IDEXPRESSION = new ExpressionKind( 14 );
|
||||||
|
public static final ExpressionKind POSTFIX_DOT_DESTRUCTOR = new ExpressionKind( 15 );
|
||||||
|
public static final ExpressionKind POSTFIX_ARROW_DESTRUCTOR = new ExpressionKind( 16 );
|
||||||
|
public static final ExpressionKind POSTFIX_INCREMENT = new ExpressionKind( 17 );
|
||||||
|
public static final ExpressionKind POSTFIX_DECREMENT = new ExpressionKind( 18 );
|
||||||
|
public static final ExpressionKind POSTFIX_DYNAMIC_CAST = new ExpressionKind( 19 );
|
||||||
|
public static final ExpressionKind POSTFIX_REINTERPRET_CAST = new ExpressionKind( 20 );
|
||||||
|
public static final ExpressionKind POSTFIX_STATIC_CAST = new ExpressionKind( 21 );
|
||||||
|
public static final ExpressionKind POSTFIX_CONST_CAST = new ExpressionKind( 22 );
|
||||||
|
public static final ExpressionKind POSTFIX_TYPEID_EXPRESSION = new ExpressionKind( 23 );
|
||||||
|
public static final ExpressionKind POSTFIX_TYPEID_TYPEID = new ExpressionKind( 24 );
|
||||||
|
public static final ExpressionKind UNARY_INCREMENT = new ExpressionKind( 25 );
|
||||||
|
public static final ExpressionKind UNARY_DECREMENT = new ExpressionKind( 26 );
|
||||||
|
public static final ExpressionKind UNARY_STAR_CASTEXPRESSION = new ExpressionKind( 27 );
|
||||||
|
public static final ExpressionKind UNARY_AMPSND_CASTEXPRESSION = new ExpressionKind( 28 );
|
||||||
|
public static final ExpressionKind UNARY_PLUS_CASTEXPRESSION = new ExpressionKind( 29 );
|
||||||
|
public static final ExpressionKind UNARY_MINUS_CASTEXPRESSION = new ExpressionKind( 30 );
|
||||||
|
public static final ExpressionKind UNARY_NOT_CASTEXPRESSION = new ExpressionKind( 31 );
|
||||||
|
public static final ExpressionKind UNARY_TILDE_CASTEXPRESSION = new ExpressionKind( 32 );
|
||||||
|
public static final ExpressionKind UNARY_SIZEOF_UNARYEXPRESSION = new ExpressionKind( 33 );
|
||||||
|
public static final ExpressionKind UNARY_SIZEOF_TYPEID = new ExpressionKind( 34 );
|
||||||
|
public static final ExpressionKind NEW_NEWTYPEID = new ExpressionKind( 35 );
|
||||||
|
public static final ExpressionKind NEW_TYPEID = new ExpressionKind( 36 );
|
||||||
|
public static final ExpressionKind DELETE_CASTEXPRESSION = new ExpressionKind( 37 );
|
||||||
|
public static final ExpressionKind DELETE_VECTORCASTEXPRESSION = new ExpressionKind( 38 );
|
||||||
|
public static final ExpressionKind CASTEXPRESSION = new ExpressionKind( 39 );
|
||||||
|
public static final ExpressionKind PM_DOTSTAR = new ExpressionKind( 40 );
|
||||||
|
public static final ExpressionKind PM_ARROWSTAR = new ExpressionKind( 41 );
|
||||||
|
public static final ExpressionKind MULTIPLICATIVE_MULTIPLY = new ExpressionKind( 42 );
|
||||||
|
public static final ExpressionKind MULTIPLICATIVE_DIVIDE = new ExpressionKind( 43 );
|
||||||
|
public static final ExpressionKind MULTIPLICATIVE_MODULUS = new ExpressionKind( 44 );
|
||||||
|
public static final ExpressionKind ADDITIVE_PLUS = new ExpressionKind( 45 );
|
||||||
|
public static final ExpressionKind ADDITIVE_MINUS = new ExpressionKind( 46 );
|
||||||
|
public static final ExpressionKind SHIFT_LEFT = new ExpressionKind( 47 );
|
||||||
|
public static final ExpressionKind SHIFT_RIGHT = new ExpressionKind( 48 );
|
||||||
|
public static final ExpressionKind RELATIONAL_LESSTHAN = new ExpressionKind( 49 );
|
||||||
|
public static final ExpressionKind RELATIONAL_GREATERTHAN = new ExpressionKind( 50 );
|
||||||
|
public static final ExpressionKind RELATIONAL_LESSTHANEQUALTO = new ExpressionKind( 51 );
|
||||||
|
public static final ExpressionKind RELATIONAL_GREATERTHANEQUALTO= new ExpressionKind( 52 );
|
||||||
|
public static final ExpressionKind EQUALITY_EQUALS = new ExpressionKind( 53 );
|
||||||
|
public static final ExpressionKind EQUALITY_NOTEQUALS = new ExpressionKind( 54 );
|
||||||
|
public static final ExpressionKind ANDEXPRESSION = new ExpressionKind( 55 );
|
||||||
|
public static final ExpressionKind EXCLUSIVEOREXPRESSION = new ExpressionKind( 56 );
|
||||||
|
public static final ExpressionKind INCLUSIVEOREXPRESSION = new ExpressionKind( 57 );
|
||||||
|
public static final ExpressionKind LOGICALANDEXPRESSION = new ExpressionKind( 58 );
|
||||||
|
public static final ExpressionKind LOGICALOREXPRESSION = new ExpressionKind( 59 );
|
||||||
|
public static final ExpressionKind CONDITIONALEXPRESSION = new ExpressionKind( 60 );
|
||||||
|
public static final ExpressionKind THROWEXPRESSION = new ExpressionKind( 61 );
|
||||||
|
public static final ExpressionKind ASSIGNMENTEXPRESSION = new ExpressionKind( 62 );
|
||||||
|
public static final ExpressionKind EXPRESSIONLIST = new ExpressionKind( 63 );
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param enumValue
|
||||||
|
*/
|
||||||
|
private ExpressionKind(int enumValue)
|
||||||
|
{
|
||||||
|
super(enumValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExpressionKind getExpressionKind();
|
||||||
|
public IASTExpression getLHSExpression();
|
||||||
|
public IASTExpression getRHSExpression();
|
||||||
|
public String getLiteralString();
|
||||||
|
public String getTypeId();
|
||||||
|
public String getId();
|
||||||
|
|
||||||
|
public int evaluateExpression() throws ExpressionEvaluationException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,9 @@
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
package org.eclipse.cdt.core.parser.ast;
|
package org.eclipse.cdt.core.parser.ast;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.parser.Backtrack;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier.ClassNameType;
|
||||||
import org.eclipse.cdt.internal.core.parser.TokenDuple;
|
import org.eclipse.cdt.internal.core.parser.TokenDuple;
|
||||||
import org.eclipse.cdt.internal.core.parser.Parser.Backtrack;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
|
|
|
@ -10,11 +10,13 @@
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
package org.eclipse.cdt.core.parser.ast;
|
package org.eclipse.cdt.core.parser.ast;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.parser.Enum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class TemplateDeclarationType {
|
public class TemplateDeclarationType extends Enum {
|
||||||
|
|
||||||
public static final TemplateDeclarationType CLASS = new TemplateDeclarationType(1);
|
public static final TemplateDeclarationType CLASS = new TemplateDeclarationType(1);
|
||||||
public static final TemplateDeclarationType FUNCTION = new TemplateDeclarationType( 2 );
|
public static final TemplateDeclarationType FUNCTION = new TemplateDeclarationType( 2 );
|
||||||
|
@ -22,11 +24,9 @@ public class TemplateDeclarationType {
|
||||||
public static final TemplateDeclarationType METHOD = new TemplateDeclarationType( 4 );
|
public static final TemplateDeclarationType METHOD = new TemplateDeclarationType( 4 );
|
||||||
public static final TemplateDeclarationType FIELD = new TemplateDeclarationType( 5 );
|
public static final TemplateDeclarationType FIELD = new TemplateDeclarationType( 5 );
|
||||||
|
|
||||||
|
|
||||||
private final int type;
|
|
||||||
private TemplateDeclarationType( int t )
|
private TemplateDeclarationType( int t )
|
||||||
{
|
{
|
||||||
type = t;
|
super( t );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
* Rational Software - Initial API and implementation
|
* Rational Software - Initial API and implementation
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.parser;
|
package org.eclipse.cdt.internal.core.parser;
|
||||||
|
import org.eclipse.cdt.core.parser.Backtrack;
|
||||||
|
import org.eclipse.cdt.core.parser.EndOfFile;
|
||||||
import org.eclipse.cdt.core.parser.IParser;
|
import org.eclipse.cdt.core.parser.IParser;
|
||||||
import org.eclipse.cdt.core.parser.IParserCallback;
|
import org.eclipse.cdt.core.parser.IParserCallback;
|
||||||
import org.eclipse.cdt.core.parser.IScanner;
|
import org.eclipse.cdt.core.parser.IScanner;
|
||||||
|
@ -19,7 +21,6 @@ import org.eclipse.cdt.core.parser.ParserMode;
|
||||||
import org.eclipse.cdt.core.parser.ScannerException;
|
import org.eclipse.cdt.core.parser.ScannerException;
|
||||||
import org.eclipse.cdt.core.parser.ast.AccessVisibility;
|
import org.eclipse.cdt.core.parser.ast.AccessVisibility;
|
||||||
import org.eclipse.cdt.core.parser.ast.ClassKind;
|
import org.eclipse.cdt.core.parser.ast.ClassKind;
|
||||||
import org.eclipse.cdt.core.parser.ast.ClassNameType;
|
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
|
import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
|
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
|
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
|
||||||
|
@ -31,6 +32,7 @@ import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTScope;
|
import org.eclipse.cdt.core.parser.ast.IASTScope;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTUsingDeclaration;
|
import org.eclipse.cdt.core.parser.ast.IASTUsingDeclaration;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
|
import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier.ClassNameType;
|
||||||
import org.eclipse.cdt.internal.core.model.Util;
|
import org.eclipse.cdt.internal.core.model.Util;
|
||||||
/**
|
/**
|
||||||
* This is our first implementation of the IParser interface, serving as a parser for
|
* This is our first implementation of the IParser interface, serving as a parser for
|
||||||
|
@ -4147,22 +4149,9 @@ public class Parser implements IParser
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Class that represents the a request to backtrack.
|
|
||||||
*/
|
|
||||||
public static class Backtrack extends Exception
|
|
||||||
{
|
|
||||||
}
|
|
||||||
// the static instance we always use
|
// the static instance we always use
|
||||||
private static Backtrack backtrack = new Backtrack();
|
private static Backtrack backtrack = new Backtrack();
|
||||||
/**
|
|
||||||
* Class that represents encountering EOF.
|
|
||||||
*
|
|
||||||
* End of file generally causes backtracking
|
|
||||||
*/
|
|
||||||
public static class EndOfFile extends Backtrack
|
|
||||||
{
|
|
||||||
}
|
|
||||||
// the static instance we always use
|
// the static instance we always use
|
||||||
public static EndOfFile endOfFile = new EndOfFile();
|
public static EndOfFile endOfFile = new EndOfFile();
|
||||||
// Token management
|
// Token management
|
||||||
|
|
|
@ -13,6 +13,7 @@ package org.eclipse.cdt.internal.core.parser;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.parser.EndOfFile;
|
||||||
import org.eclipse.cdt.core.parser.IPreprocessor;
|
import org.eclipse.cdt.core.parser.IPreprocessor;
|
||||||
import org.eclipse.cdt.core.parser.ScannerException;
|
import org.eclipse.cdt.core.parser.ScannerException;
|
||||||
|
|
||||||
|
@ -42,7 +43,7 @@ public class Preprocessor extends Scanner implements IPreprocessor {
|
||||||
{
|
{
|
||||||
// callback IProblem here
|
// callback IProblem here
|
||||||
}
|
}
|
||||||
catch( Parser.EndOfFile eof )
|
catch( EndOfFile eof )
|
||||||
{
|
{
|
||||||
// expected
|
// expected
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ import java.util.Map;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.parser.EndOfFile;
|
||||||
import org.eclipse.cdt.core.parser.IMacroDescriptor;
|
import org.eclipse.cdt.core.parser.IMacroDescriptor;
|
||||||
import org.eclipse.cdt.core.parser.IParser;
|
import org.eclipse.cdt.core.parser.IParser;
|
||||||
import org.eclipse.cdt.core.parser.IParserCallback;
|
import org.eclipse.cdt.core.parser.IParserCallback;
|
||||||
|
@ -467,12 +468,11 @@ public class Scanner implements IScanner {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public IToken nextToken() throws ScannerException, Parser.EndOfFile {
|
public IToken nextToken() throws ScannerException, EndOfFile {
|
||||||
return nextToken( true );
|
return nextToken( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IToken nextToken( boolean pasting ) throws ScannerException, EndOfFile
|
||||||
public IToken nextToken( boolean pasting ) throws ScannerException, Parser.EndOfFile
|
|
||||||
{
|
{
|
||||||
if( cachedToken != null ){
|
if( cachedToken != null ){
|
||||||
setCurrentToken( cachedToken );
|
setCurrentToken( cachedToken );
|
||||||
|
@ -560,7 +560,7 @@ public class Scanner implements IScanner {
|
||||||
IToken next = null;
|
IToken next = null;
|
||||||
try{
|
try{
|
||||||
next = nextToken( true );
|
next = nextToken( true );
|
||||||
} catch( Parser.EndOfFile e ){
|
} catch( EndOfFile e ){
|
||||||
next = null;
|
next = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -570,7 +570,7 @@ public class Scanner implements IScanner {
|
||||||
currentToken = returnToken;
|
currentToken = returnToken;
|
||||||
try{
|
try{
|
||||||
next = nextToken( true );
|
next = nextToken( true );
|
||||||
} catch( Parser.EndOfFile e ){
|
} catch( EndOfFile e ){
|
||||||
next = null;
|
next = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1366,7 +1366,7 @@ public class Scanner implements IScanner {
|
||||||
// the static instance we always use
|
// the static instance we always use
|
||||||
protected static endOfMacroTokenException endOfMacroToken = new endOfMacroTokenException();
|
protected static endOfMacroTokenException endOfMacroToken = new endOfMacroTokenException();
|
||||||
|
|
||||||
public IToken nextTokenForStringizing() throws ScannerException, Parser.EndOfFile
|
public IToken nextTokenForStringizing() throws ScannerException, EndOfFile
|
||||||
{
|
{
|
||||||
int c = getChar();
|
int c = getChar();
|
||||||
StringBuffer tokenImage = new StringBuffer();
|
StringBuffer tokenImage = new StringBuffer();
|
||||||
|
@ -1799,7 +1799,7 @@ public class Scanner implements IScanner {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void poundDefine(int beginning) throws ScannerException, Parser.EndOfFile {
|
protected void poundDefine(int beginning) throws ScannerException, EndOfFile {
|
||||||
skipOverWhitespace();
|
skipOverWhitespace();
|
||||||
// definition
|
// definition
|
||||||
String key = getNextIdentifier();
|
String key = getNextIdentifier();
|
||||||
|
@ -1896,7 +1896,7 @@ public class Scanner implements IScanner {
|
||||||
t = helperScanner.nextToken(false);
|
t = helperScanner.nextToken(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch( Parser.EndOfFile eof )
|
catch( EndOfFile eof )
|
||||||
{
|
{
|
||||||
// good
|
// good
|
||||||
}
|
}
|
||||||
|
@ -2001,7 +2001,7 @@ public class Scanner implements IScanner {
|
||||||
}
|
}
|
||||||
space = true;
|
space = true;
|
||||||
}
|
}
|
||||||
} catch (Parser.EndOfFile e) {
|
} catch (EndOfFile e) {
|
||||||
// Good
|
// Good
|
||||||
parameterValues.add(str);
|
parameterValues.add(str);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@ import java.util.Iterator;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.parser.ast.AccessVisibility;
|
import org.eclipse.cdt.core.parser.ast.AccessVisibility;
|
||||||
import org.eclipse.cdt.core.parser.ast.ClassKind;
|
import org.eclipse.cdt.core.parser.ast.ClassKind;
|
||||||
import org.eclipse.cdt.core.parser.ast.ClassNameType;
|
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration;
|
import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration;
|
||||||
import org.eclipse.cdt.internal.core.parser.pst.IDerivableContainerSymbol;
|
import org.eclipse.cdt.internal.core.parser.pst.IDerivableContainerSymbol;
|
||||||
import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
|
import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
|
||||||
|
|
|
@ -12,10 +12,10 @@ package org.eclipse.cdt.internal.core.parser.ast.full;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.parser.Backtrack;
|
||||||
import org.eclipse.cdt.core.parser.IToken;
|
import org.eclipse.cdt.core.parser.IToken;
|
||||||
import org.eclipse.cdt.core.parser.ast.AccessVisibility;
|
import org.eclipse.cdt.core.parser.ast.AccessVisibility;
|
||||||
import org.eclipse.cdt.core.parser.ast.ClassKind;
|
import org.eclipse.cdt.core.parser.ast.ClassKind;
|
||||||
import org.eclipse.cdt.core.parser.ast.ClassNameType;
|
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
|
import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
|
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
|
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
|
||||||
|
@ -28,8 +28,8 @@ import org.eclipse.cdt.core.parser.ast.IASTScope;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration;
|
import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTUsingDeclaration;
|
import org.eclipse.cdt.core.parser.ast.IASTUsingDeclaration;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
|
import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier.ClassNameType;
|
||||||
import org.eclipse.cdt.internal.core.parser.TokenDuple;
|
import org.eclipse.cdt.internal.core.parser.TokenDuple;
|
||||||
import org.eclipse.cdt.internal.core.parser.Parser.Backtrack;
|
|
||||||
import org.eclipse.cdt.internal.core.parser.ast.BaseASTFactory;
|
import org.eclipse.cdt.internal.core.parser.ast.BaseASTFactory;
|
||||||
import org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol;
|
import org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol;
|
||||||
import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
|
import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
|
||||||
|
|
|
@ -16,7 +16,6 @@ import java.util.Stack;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.parser.ast.AccessVisibility;
|
import org.eclipse.cdt.core.parser.ast.AccessVisibility;
|
||||||
import org.eclipse.cdt.core.parser.ast.ClassKind;
|
import org.eclipse.cdt.core.parser.ast.ClassKind;
|
||||||
import org.eclipse.cdt.core.parser.ast.ClassNameType;
|
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier;
|
import org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
|
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
|
import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
|
||||||
|
|
|
@ -10,9 +10,9 @@
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.parser.ast.quick;
|
package org.eclipse.cdt.internal.core.parser.ast.quick;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.parser.Backtrack;
|
||||||
import org.eclipse.cdt.core.parser.ast.AccessVisibility;
|
import org.eclipse.cdt.core.parser.ast.AccessVisibility;
|
||||||
import org.eclipse.cdt.core.parser.ast.ClassKind;
|
import org.eclipse.cdt.core.parser.ast.ClassKind;
|
||||||
import org.eclipse.cdt.core.parser.ast.ClassNameType;
|
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
|
import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier;
|
import org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
|
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
|
||||||
|
@ -27,8 +27,8 @@ import org.eclipse.cdt.core.parser.ast.IASTScope;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration;
|
import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTUsingDeclaration;
|
import org.eclipse.cdt.core.parser.ast.IASTUsingDeclaration;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
|
import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier.ClassNameType;
|
||||||
import org.eclipse.cdt.internal.core.parser.TokenDuple;
|
import org.eclipse.cdt.internal.core.parser.TokenDuple;
|
||||||
import org.eclipse.cdt.internal.core.parser.Parser.Backtrack;
|
|
||||||
import org.eclipse.cdt.internal.core.parser.ast.BaseASTFactory;
|
import org.eclipse.cdt.internal.core.parser.ast.BaseASTFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue