mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
This commit is contained in:
parent
ae1b577d72
commit
af85de7600
6 changed files with 31 additions and 14 deletions
|
@ -1,3 +1,6 @@
|
|||
2004-04-22 John Camelon
|
||||
Fixed https://bugs.eclipse.org/bugs/show_bug.cgi?id=59507
|
||||
|
||||
2004-04-22 John Camelon
|
||||
Fixed https://bugs.eclipse.org/bugs/show_bug.cgi?id=59179
|
||||
Fixed https://bugs.eclipse.org/bugs/show_bug.cgi?id=59143
|
||||
|
|
|
@ -97,13 +97,13 @@ public class GCCScannerExtension implements IScannerExtension {
|
|||
//TODO - these macros should not be visible as macros in the scanner's definition list
|
||||
//need to make a public/private table i think
|
||||
if( scannerData.getScanner().getDefinition( __ATTRIBUTE__) == null )
|
||||
scannerData.getScanner().addDefinition( __ATTRIBUTE__, new FunctionMacroDescriptor( __ATTRIBUTE__, simpleIdentifiersDeclSpec, EMPTY_LIST, "" )); //$NON-NLS-1$ $NON-NLS-2$
|
||||
scannerData.getPrivateDefinitions().put( __ATTRIBUTE__, new FunctionMacroDescriptor( __ATTRIBUTE__, simpleIdentifiersDeclSpec, EMPTY_LIST, "" )); //$NON-NLS-1$ $NON-NLS-2$
|
||||
|
||||
if( scannerData.getScanner().getDefinition( __DECLSPEC) == null )
|
||||
scannerData.getScanner().addDefinition( __DECLSPEC, new FunctionMacroDescriptor( __ATTRIBUTE__, simpleIdentifiersDeclSpec, EMPTY_LIST, "" )); //$NON-NLS-1$ $NON-NLS-2$
|
||||
scannerData.getPrivateDefinitions().put( __DECLSPEC, new FunctionMacroDescriptor( __ATTRIBUTE__, simpleIdentifiersDeclSpec, EMPTY_LIST, "" )); //$NON-NLS-1$ $NON-NLS-2$
|
||||
|
||||
if( scannerData.getScanner().getDefinition( __EXTENSION__ ) == null )
|
||||
scannerData.getScanner().addDefinition( __EXTENSION__, new ObjectMacroDescriptor( __EXTENSION__, EMPTY_STRING ));
|
||||
scannerData.getPrivateDefinitions().put( __EXTENSION__, new ObjectMacroDescriptor( __EXTENSION__, EMPTY_STRING ));
|
||||
|
||||
setupAlternativeKeyword(scannerData, __CONST__, Keywords.CONST);
|
||||
setupAlternativeKeyword(scannerData, __CONST, Keywords.CONST);
|
||||
|
@ -126,7 +126,7 @@ public class GCCScannerExtension implements IScannerExtension {
|
|||
// alternate keyword forms
|
||||
// TODO - make this more efficient - update TokenFactory to avoid a context push for these token to token cases
|
||||
if( scannerData.getScanner().getDefinition( keyword ) == null )
|
||||
scannerData.getScanner().addDefinition( keyword, new ObjectMacroDescriptor( __CONST__, mapping )); //$NON-NLS-1$
|
||||
scannerData.getPrivateDefinitions().put( keyword, new ObjectMacroDescriptor( __CONST__, mapping )); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
private static final Set directives;
|
||||
|
|
|
@ -51,7 +51,8 @@ public interface IScannerData {
|
|||
public abstract IASTFactory getASTFactory();
|
||||
public abstract void setASTFactory(IASTFactory factory);
|
||||
public abstract BranchTracker getBranchTracker();
|
||||
public abstract Map getDefinitions();
|
||||
public abstract Map getPublicDefinitions();
|
||||
public Map getPrivateDefinitions();
|
||||
/**
|
||||
* @return Returns the problemFactory.
|
||||
*/
|
||||
|
|
|
@ -120,6 +120,7 @@ public class Scanner implements IScanner {
|
|||
scannerData.setDefinitions( definitions );
|
||||
scannerData.setIncludePathNames( includePaths );
|
||||
scannerData.setASTFactory( ParserFactory.createASTFactory( this, scannerData.getParserMode(), language ) );
|
||||
setupBuiltInMacros();
|
||||
}
|
||||
|
||||
public Scanner(Reader reader, String filename, IScannerInfo info, ISourceElementRequestor requestor, ParserMode parserMode, ParserLanguage language, IParserLogService log, IScannerExtension extension, List workingCopies ) {
|
||||
|
@ -322,7 +323,7 @@ public class Scanner implements IScanner {
|
|||
}
|
||||
|
||||
public void addDefinition(String key, IMacroDescriptor macro) {
|
||||
scannerData.getDefinitions().put(key, macro);
|
||||
scannerData.getPublicDefinitions().put(key, macro);
|
||||
}
|
||||
|
||||
public void addDefinition(String key, String value) {
|
||||
|
@ -332,7 +333,10 @@ public class Scanner implements IScanner {
|
|||
}
|
||||
|
||||
public final IMacroDescriptor getDefinition(String key) {
|
||||
return (IMacroDescriptor) scannerData.getDefinitions().get(key);
|
||||
IMacroDescriptor descriptor = (IMacroDescriptor) scannerData.getPublicDefinitions().get(key);
|
||||
if( descriptor != null )
|
||||
return descriptor;
|
||||
return (IMacroDescriptor) scannerData.getPrivateDefinitions().get(key);
|
||||
}
|
||||
|
||||
public final String[] getIncludePaths() {
|
||||
|
@ -2080,7 +2084,7 @@ public class Scanner implements IScanner {
|
|||
* @param key
|
||||
*/
|
||||
protected void removeSymbol(String key) {
|
||||
scannerData.getDefinitions().remove(key);
|
||||
scannerData.getPublicDefinitions().remove(key);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2422,7 +2426,7 @@ public class Scanner implements IScanner {
|
|||
IScanner trial = new Scanner(
|
||||
new StringReader(expressionBuffer.toString()),
|
||||
EXPRESSION,
|
||||
scannerData.getDefinitions(),
|
||||
scannerData.getPublicDefinitions(),
|
||||
scannerData.getIncludePathNames(),
|
||||
NULL_REQUESTOR,
|
||||
ParserMode.QUICK_PARSE,
|
||||
|
@ -2574,7 +2578,7 @@ public class Scanner implements IScanner {
|
|||
|
||||
protected void temporarilyReplaceDefinitionsMap()
|
||||
{
|
||||
definitionsBackupMap = scannerData.getDefinitions();
|
||||
definitionsBackupMap = scannerData.getPublicDefinitions();
|
||||
scannerData.setDefinitions( EMPTY_MAP );
|
||||
}
|
||||
|
||||
|
@ -2851,7 +2855,7 @@ public class Scanner implements IScanner {
|
|||
Scanner tokenizer = new Scanner(
|
||||
new StringReader(params),
|
||||
TEXT,
|
||||
scannerData.getDefinitions(),
|
||||
scannerData.getPublicDefinitions(),
|
||||
scannerData.getIncludePathNames(),
|
||||
NULL_REQUESTOR,
|
||||
scannerData.getParserMode(),
|
||||
|
@ -3170,7 +3174,7 @@ public class Scanner implements IScanner {
|
|||
* @see org.eclipse.cdt.core.parser.IScanner#getDefinitions()
|
||||
*/
|
||||
public Map getDefinitions() {
|
||||
return Collections.unmodifiableMap(scannerData.getDefinitions());
|
||||
return Collections.unmodifiableMap(scannerData.getPublicDefinitions());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -46,6 +46,7 @@ public class ScannerData implements IScannerData
|
|||
private final IScannerInfo originalConfig;
|
||||
private List includePathNames = new ArrayList();
|
||||
private static final Iterator EMPTY_ITERATOR = new EmptyIterator();
|
||||
private final Map privateDefinitions;
|
||||
/**
|
||||
* @return Returns the contextStack.
|
||||
*/
|
||||
|
@ -96,7 +97,7 @@ public class ScannerData implements IScannerData
|
|||
return branches;
|
||||
}
|
||||
|
||||
public Map getDefinitions()
|
||||
public Map getPublicDefinitions()
|
||||
{
|
||||
return definitions;
|
||||
}
|
||||
|
@ -160,6 +161,7 @@ public class ScannerData implements IScannerData
|
|||
this.originalConfig = info;
|
||||
this.contextStack = stack;
|
||||
this.workingCopies = workingCopies;
|
||||
privateDefinitions = new Hashtable();
|
||||
}
|
||||
|
||||
|
||||
|
@ -183,4 +185,11 @@ public class ScannerData implements IScannerData
|
|||
return workingCopies.iterator();
|
||||
return EMPTY_ITERATOR;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.scanner.IScannerData#getPrivateDefinitions()
|
||||
*/
|
||||
public Map getPrivateDefinitions() {
|
||||
return privateDefinitions;
|
||||
}
|
||||
}
|
|
@ -159,7 +159,7 @@ public class ScannerUtility {
|
|||
Scanner helperScanner = new Scanner(
|
||||
new StringReader(includeLine),
|
||||
null,
|
||||
scannerData.getDefinitions(), scannerData.getIncludePathNames(),
|
||||
scannerData.getPublicDefinitions(), scannerData.getIncludePathNames(),
|
||||
NULL_REQUESTOR,
|
||||
scannerData.getParserMode(),
|
||||
scannerData.getLanguage(), NULL_LOG_SERVICE, extension );
|
||||
|
|
Loading…
Add table
Reference in a new issue