blob: 272ce3c9539862a3126a6aa20247a1b9732c47c2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
/*******************************************************************************
* Copyright (c) 2005, 2009 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* QNX - Initial API and implementation
* Markus Schorn (Wind River Systems)
* IBM Corporation
* Anton Leherbauer (Wind River Systems)
* Mike Kucera - IBM
*******************************************************************************/
package org.eclipse.cdt.core.dom.ast.gnu.cpp;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ILinkage;
import org.eclipse.cdt.core.dom.parser.AbstractCLikeLanguage;
import org.eclipse.cdt.core.dom.parser.IScannerExtensionConfiguration;
import org.eclipse.cdt.core.dom.parser.ISourceCodeParser;
import org.eclipse.cdt.core.dom.parser.cpp.GPPParserExtensionConfiguration;
import org.eclipse.cdt.core.dom.parser.cpp.GPPScannerExtensionConfiguration;
import org.eclipse.cdt.core.dom.parser.cpp.ICPPParserExtensionConfiguration;
import org.eclipse.cdt.core.index.IIndex;
import org.eclipse.cdt.core.parser.IParserLogService;
import org.eclipse.cdt.core.parser.IScanner;
import org.eclipse.cdt.core.parser.IScannerInfo;
import org.eclipse.cdt.core.parser.ParserLanguage;
import org.eclipse.cdt.core.parser.ParserMode;
import org.eclipse.cdt.internal.core.dom.parser.cpp.GNUCPPSourceParser;
import org.eclipse.cdt.internal.core.pdom.dom.IPDOMLinkageFactory;
import org.eclipse.cdt.internal.core.pdom.dom.cpp.PDOMCPPLinkageFactory;
/**
* Concrete ILanguage implementation for the DOM C++ parser.
*/
public class GPPLanguage extends AbstractCLikeLanguage {
protected static final GPPScannerExtensionConfiguration CPP_GNU_SCANNER_EXTENSION= GPPScannerExtensionConfiguration.getInstance();
protected static final GPPParserExtensionConfiguration CPP_GNU_PARSER_EXTENSION= GPPParserExtensionConfiguration.getInstance();
public static final String ID = CCorePlugin.PLUGIN_ID + ".g++"; //$NON-NLS-1$
/**
* @since 5.6
*/
public static final int GNU_LATEST_VERSION_MAJOR = 4,
GNU_LATEST_VERSION_MINOR = 7;
private static final GPPLanguage DEFAULT_INSTANCE = new GPPLanguage();
public static GPPLanguage getDefault() {
return DEFAULT_INSTANCE;
}
@Override
@SuppressWarnings("rawtypes")
public Object getAdapter(Class adapter) {
if (adapter == IPDOMLinkageFactory.class) {
return new PDOMCPPLinkageFactory();
}
return super.getAdapter(adapter);
}
@Override
public String getId() {
return ID;
}
@Override
public int getLinkageID() {
return ILinkage.CPP_LINKAGE_ID;
}
/**
* @nooverride This method is not intended to be re-implemented or extended by clients.
* @deprecated Since 5.4 not called by the framework. Override
* {@link #getScannerExtensionConfiguration(IScannerInfo)} instead.
*/
@Deprecated
@Override
protected IScannerExtensionConfiguration getScannerExtensionConfiguration() {
return CPP_GNU_SCANNER_EXTENSION;
}
/**
* @since 5.4
*/
@Override
protected IScannerExtensionConfiguration getScannerExtensionConfiguration(IScannerInfo info) {
return GPPScannerExtensionConfiguration.getInstance(info);
}
/**
* Returns the extension configuration used for creating the parser.
* @since 5.1
*/
protected ICPPParserExtensionConfiguration getParserExtensionConfiguration() {
return CPP_GNU_PARSER_EXTENSION;
}
@Override
protected ISourceCodeParser createParser(IScanner scanner, ParserMode parserMode, IParserLogService logService, IIndex index) {
return new GNUCPPSourceParser(scanner, parserMode, logService, getParserExtensionConfiguration(), index);
}
@Override
protected ParserLanguage getParserLanguage() {
return ParserLanguage.CPP;
}
}
|