1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-09 10:46:02 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2010-10-05 06:16:16 +00:00
parent 927436127c
commit a10ba4bd8b

View file

@ -28,7 +28,6 @@ import org.eclipse.cdt.internal.core.parser.token.KeywordSets;
* @since 5.1 * @since 5.1
*/ */
public class CLanguageKeywords implements ICLanguageKeywords { public class CLanguageKeywords implements ICLanguageKeywords {
private final ParserLanguage language; private final ParserLanguage language;
private final IScannerExtensionConfiguration config; private final IScannerExtensionConfiguration config;
@ -37,25 +36,22 @@ public class CLanguageKeywords implements ICLanguageKeywords {
private String[] builtinTypes = null; private String[] builtinTypes = null;
private String[] preprocessorKeywords = null; private String[] preprocessorKeywords = null;
/** /**
* @throws NullPointerException if either parameter is null * @throws NullPointerException if either parameter is null
*/ */
public CLanguageKeywords(ParserLanguage language, IScannerExtensionConfiguration config) { public CLanguageKeywords(ParserLanguage language, IScannerExtensionConfiguration config) {
if(language == null) if (language == null)
throw new NullPointerException("language is null"); //$NON-NLS-1$ throw new NullPointerException("language is null"); //$NON-NLS-1$
if(config == null) if (config == null)
throw new NullPointerException("config is null"); //$NON-NLS-1$ throw new NullPointerException("config is null"); //$NON-NLS-1$
this.language = language; this.language = language;
this.config = config; this.config = config;
} }
public String[] getKeywords() { public String[] getKeywords() {
if(keywords == null) { if (keywords == null) {
Set<String> keywordSet = new HashSet<String>(KeywordSets.getKeywords(KeywordSetKey.KEYWORDS, language)); Set<String> keywordSet = new HashSet<String>(KeywordSets.getKeywords(KeywordSetKey.KEYWORDS, language));
CharArrayIntMap additionalKeywords = config.getAdditionalKeywords(); CharArrayIntMap additionalKeywords = config.getAdditionalKeywords();
if (additionalKeywords != null) { if (additionalKeywords != null) {
for (Iterator<char[]> iterator = additionalKeywords.toList().iterator(); iterator.hasNext(); ) { for (Iterator<char[]> iterator = additionalKeywords.toList().iterator(); iterator.hasNext(); ) {
@ -68,19 +64,16 @@ public class CLanguageKeywords implements ICLanguageKeywords {
return keywords; return keywords;
} }
public String[] getBuiltinTypes() { public String[] getBuiltinTypes() {
if(builtinTypes == null) { if (builtinTypes == null) {
Set<String> types = KeywordSets.getKeywords(KeywordSetKey.TYPES, language); Set<String> types = KeywordSets.getKeywords(KeywordSetKey.TYPES, language);
builtinTypes = types.toArray(new String[types.size()]); builtinTypes = types.toArray(new String[types.size()]);
} }
return builtinTypes; return builtinTypes;
} }
public String[] getPreprocessorKeywords() { public String[] getPreprocessorKeywords() {
if(preprocessorKeywords == null) { if (preprocessorKeywords == null) {
Set<String> keywords = new HashSet<String>(KeywordSets.getKeywords(KeywordSetKey.PP_DIRECTIVE, language)); Set<String> keywords = new HashSet<String>(KeywordSets.getKeywords(KeywordSetKey.PP_DIRECTIVE, language));
CharArrayIntMap additionalKeywords= config.getAdditionalPreprocessorKeywords(); CharArrayIntMap additionalKeywords= config.getAdditionalPreprocessorKeywords();
if (additionalKeywords != null) { if (additionalKeywords != null) {
@ -93,6 +86,4 @@ public class CLanguageKeywords implements ICLanguageKeywords {
} }
return preprocessorKeywords; return preprocessorKeywords;
} }
} }