~ubuntu-branches/debian/sid/eclipse-cdt/sid

« back to all changes in this revision

Viewing changes to core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/AbstractCLikeLanguage.java

  • Committer: Package Import Robot
  • Author(s): Jakub Adam
  • Date: 2013-10-03 20:30:16 UTC
  • mfrom: (1.1.11)
  • Revision ID: package-import@ubuntu.com-20131003203016-d4ug6l0xgosasumq
Tags: 8.2.1-1
* New upstream release.
* Updated autotools documentation sources.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*******************************************************************************
2
 
 * Copyright (c) 2007, 2009 IBM Corporation and others.
 
2
 * Copyright (c) 2007, 2013 IBM Corporation and others.
3
3
 * All rights reserved. This program and the accompanying materials
4
4
 * are made available under the terms of the Eclipse Public License v1.0
5
5
 * which accompanies this distribution, and is available at
9
9
 *     Anton Leherbauer (Wind River Systems) - initial API and implementation
10
10
 *     Markus Schorn (Wind River Systems)
11
11
 *     Mike Kucera (IBM)
 
12
 *     Sergey Prigogin (Google)
12
13
 *******************************************************************************/
13
14
package org.eclipse.cdt.core.dom.parser;
14
15
 
26
27
import org.eclipse.cdt.core.model.ICLanguageKeywords;
27
28
import org.eclipse.cdt.core.model.IContributedModelBuilder;
28
29
import org.eclipse.cdt.core.model.ITranslationUnit;
 
30
import org.eclipse.cdt.core.parser.ExtendedScannerInfo;
29
31
import org.eclipse.cdt.core.parser.FileContent;
30
32
import org.eclipse.cdt.core.parser.IParserLogService;
31
33
import org.eclipse.cdt.core.parser.IScanner;
44
46
 * for the DOM parser framework.
45
47
 * 
46
48
 * This class uses the template method pattern, derived classes need only implement
47
 
 * {@link AbstractCLikeLanguage#getScannerExtensionConfiguration()},
 
49
 * {@link AbstractCLikeLanguage#getScannerExtensionConfiguration(IScannerInfo info)},
48
50
 * {@link AbstractCLikeLanguage#getParserLanguage()} and
49
51
 * {@link AbstractCLikeLanguage#createParser(IScanner scanner, ParserMode parserMode,
50
52
 *                                           IParserLogService logService, IIndex index)}.
54
56
 * @since 5.0
55
57
 */
56
58
public abstract class AbstractCLikeLanguage extends AbstractLanguage implements ICLanguageKeywords {
57
 
        
 
59
        private static final AbstractScannerExtensionConfiguration DUMMY_SCANNER_EXTENSION_CONFIGURATION =
 
60
                        new AbstractScannerExtensionConfiguration() {};
 
61
 
58
62
        static class NameCollector extends ASTVisitor {
59
63
                {
60
64
                        shouldVisitNames= true;
74
78
        }
75
79
        
76
80
        /**
77
 
         * @return the scanner extension configuration for this language, may not
78
 
         *         return <code>null</code>
 
81
         * @nooverride This method is not intended to be re-implemented or extended by clients.
 
82
         * @deprecated Do not override this method.
 
83
         *     Override {@link #getScannerExtensionConfiguration(IScannerInfo)} instead.
79
84
         */
80
 
        protected abstract IScannerExtensionConfiguration getScannerExtensionConfiguration();
 
85
        @Deprecated
 
86
        protected IScannerExtensionConfiguration getScannerExtensionConfiguration() {
 
87
                return DUMMY_SCANNER_EXTENSION_CONFIGURATION;
 
88
        }
81
89
 
82
90
        /**
83
 
         * @return the scanner extension configuration for this language, may not
84
 
         *         return <code>null</code>
 
91
         * @return the scanner extension configuration for this language. May not return {@code null}.
85
92
         * @since 5.4
86
93
         */
87
94
        protected IScannerExtensionConfiguration getScannerExtensionConfiguration(IScannerInfo info) {
181
188
         * @param log  the parser log service
182
189
         * @param index  the index to help resolve bindings
183
190
         * @param forCompletion  whether the parser is used for code completion
184
 
         * @param options for valid options see {@link AbstractLanguage#getASTTranslationUnit(FileContent, IScannerInfo, IncludeFileContentProvider, IIndex, int, IParserLogService)}
 
191
         * @param options for valid options see
 
192
         *     {@link AbstractLanguage#getASTTranslationUnit(FileContent, IScannerInfo, IncludeFileContentProvider, IIndex, int, IParserLogService)}
185
193
         * @return  an instance of ISourceCodeParser
186
194
         */
187
195
        protected ISourceCodeParser createParser(IScanner scanner, IParserLogService log, IIndex index, boolean forCompletion, int options) {
249
257
        }
250
258
 
251
259
        private ICLanguageKeywords cLanguageKeywords;
252
 
        
 
260
 
253
261
        private synchronized ICLanguageKeywords getCLanguageKeywords() {
254
 
                if (cLanguageKeywords == null)
255
 
                        cLanguageKeywords = new CLanguageKeywords(getParserLanguage(), getScannerExtensionConfiguration());
 
262
                if (cLanguageKeywords == null) {
 
263
                        cLanguageKeywords = new CLanguageKeywords(getParserLanguage(),
 
264
                                        getScannerExtensionConfiguration(new ExtendedScannerInfo()));
 
265
                }
256
266
                return cLanguageKeywords;
257
267
        }
258
 
        
 
268
 
259
269
        @Override
260
270
        @SuppressWarnings("rawtypes")
261
271
        public Object getAdapter(Class adapter) {