mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-11 18:25:40 +02:00
[273080] [XLC Parser] support for decimal floating point types (_Decimal32, _Decimal64, _Decimal128)
This commit is contained in:
parent
795dbe40e0
commit
698d5bb0ba
17 changed files with 4873 additions and 4852 deletions
|
@ -907,28 +907,21 @@ function_specifier
|
||||||
|
|
||||||
|
|
||||||
simple_type_specifier
|
simple_type_specifier
|
||||||
|
::= simple_type_specifier_token
|
||||||
|
/. $Build consumeToken(); $EndBuild ./
|
||||||
|
|
||||||
|
simple_type_specifier_token
|
||||||
::= 'char'
|
::= 'char'
|
||||||
/. $Build consumeToken(); $EndBuild ./
|
|
||||||
| 'wchar_t'
|
| 'wchar_t'
|
||||||
/. $Build consumeToken(); $EndBuild ./
|
|
||||||
| 'bool'
|
| 'bool'
|
||||||
/. $Build consumeToken(); $EndBuild ./
|
|
||||||
| 'short'
|
| 'short'
|
||||||
/. $Build consumeToken(); $EndBuild ./
|
|
||||||
| 'int'
|
| 'int'
|
||||||
/. $Build consumeToken(); $EndBuild ./
|
|
||||||
| 'long'
|
| 'long'
|
||||||
/. $Build consumeToken(); $EndBuild ./
|
|
||||||
| 'signed'
|
| 'signed'
|
||||||
/. $Build consumeToken(); $EndBuild ./
|
|
||||||
| 'unsigned'
|
| 'unsigned'
|
||||||
/. $Build consumeToken(); $EndBuild ./
|
|
||||||
| 'float'
|
| 'float'
|
||||||
/. $Build consumeToken(); $EndBuild ./
|
|
||||||
| 'double'
|
| 'double'
|
||||||
/. $Build consumeToken(); $EndBuild ./
|
|
||||||
| 'void'
|
| 'void'
|
||||||
/. $Build consumeToken(); $EndBuild ./
|
|
||||||
|
|
||||||
|
|
||||||
-- last two rules moved here from simple_type_specifier
|
-- last two rules moved here from simple_type_specifier
|
||||||
|
|
|
@ -20,6 +20,10 @@ $Terminals
|
||||||
pixel
|
pixel
|
||||||
bool
|
bool
|
||||||
|
|
||||||
|
_Decimal32
|
||||||
|
_Decimal64
|
||||||
|
_Decimal128
|
||||||
|
|
||||||
$End
|
$End
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,6 +32,14 @@ $End
|
||||||
|
|
||||||
$Rules
|
$Rules
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
simple_type_specifier_token
|
||||||
|
::= '_Decimal32'
|
||||||
|
| '_Decimal64'
|
||||||
|
| '_Decimal128'
|
||||||
|
|
||||||
|
|
||||||
type_id
|
type_id
|
||||||
::= vector_type
|
::= vector_type
|
||||||
/. $Build consumeTypeId(false); $EndBuild ./
|
/. $Build consumeTypeId(false); $EndBuild ./
|
||||||
|
|
|
@ -17,9 +17,12 @@ import org.eclipse.cdt.core.dom.lrparser.IParser;
|
||||||
import org.eclipse.cdt.core.dom.lrparser.gnu.GCCLanguage;
|
import org.eclipse.cdt.core.dom.lrparser.gnu.GCCLanguage;
|
||||||
import org.eclipse.cdt.core.dom.parser.IScannerExtensionConfiguration;
|
import org.eclipse.cdt.core.dom.parser.IScannerExtensionConfiguration;
|
||||||
import org.eclipse.cdt.core.index.IIndex;
|
import org.eclipse.cdt.core.index.IIndex;
|
||||||
|
import org.eclipse.cdt.core.lrparser.xlc.preferences.XlcLanguagePreferences;
|
||||||
|
import org.eclipse.cdt.core.lrparser.xlc.preferences.XlcPreferenceKeys;
|
||||||
import org.eclipse.cdt.core.model.ICLanguageKeywords;
|
import org.eclipse.cdt.core.model.ICLanguageKeywords;
|
||||||
import org.eclipse.cdt.core.parser.IScanner;
|
import org.eclipse.cdt.core.parser.IScanner;
|
||||||
import org.eclipse.cdt.internal.core.lrparser.xlc.c.XlcCParser;
|
import org.eclipse.cdt.internal.core.lrparser.xlc.c.XlcCParser;
|
||||||
|
import org.eclipse.core.resources.IProject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -37,8 +40,11 @@ public class XlcCLanguage extends GCCLanguage {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected IParser<IASTTranslationUnit> getParser(IScanner scanner, IIndex index, Map<String,String> properties) {
|
protected IParser<IASTTranslationUnit> getParser(IScanner scanner, IIndex index, Map<String,String> properties) {
|
||||||
boolean supportVectors = XlcCPPLanguage.supportVectors(properties);
|
IProject project = XlcCPPLanguage.getProject(properties);
|
||||||
return new XlcCParser(scanner, new XlcCTokenMap(supportVectors), getBuiltinBindingsProvider(), index, properties);
|
boolean supportVectors = Boolean.valueOf(XlcLanguagePreferences.get(XlcPreferenceKeys.KEY_SUPPORT_VECTOR_TYPES, project));
|
||||||
|
boolean supportDecimals = Boolean.valueOf(XlcLanguagePreferences.get(XlcPreferenceKeys.KEY_SUPPORT_DECIMAL_FLOATING_POINT_TYPES, project));
|
||||||
|
|
||||||
|
return new XlcCParser(scanner, new XlcCTokenMap(supportVectors, supportDecimals), getBuiltinBindingsProvider(), index, properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
|
@ -55,7 +61,7 @@ public class XlcCLanguage extends GCCLanguage {
|
||||||
@Override
|
@Override
|
||||||
public Object getAdapter(Class adapter) {
|
public Object getAdapter(Class adapter) {
|
||||||
if(ICLanguageKeywords.class.equals(adapter))
|
if(ICLanguageKeywords.class.equals(adapter))
|
||||||
return XlcKeywords.C;
|
return XlcKeywords.ALL_C_KEYWORDS;
|
||||||
|
|
||||||
return super.getAdapter(adapter);
|
return super.getAdapter(adapter);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,8 @@ public class XlcCPPLanguage extends GPPLanguage {
|
||||||
return DEFAULT;
|
return DEFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean supportVectors(Map<String,String> properties) {
|
|
||||||
|
static IProject getProject(Map<String,String> properties) {
|
||||||
String path = properties.get(LRParserProperties.TRANSLATION_UNIT_PATH);
|
String path = properties.get(LRParserProperties.TRANSLATION_UNIT_PATH);
|
||||||
System.out.println("path: " + path);
|
System.out.println("path: " + path);
|
||||||
IFile[] file = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(new Path(path));
|
IFile[] file = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(new Path(path));
|
||||||
|
@ -52,14 +53,18 @@ public class XlcCPPLanguage extends GPPLanguage {
|
||||||
project = file[0].getProject();
|
project = file[0].getProject();
|
||||||
}
|
}
|
||||||
|
|
||||||
return Boolean.valueOf(XlcLanguagePreferences.getPreference(XlcPreferenceKeys.KEY_SUPPORT_VECTOR_TYPES, project));
|
return project;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected IParser<IASTTranslationUnit> getParser(IScanner scanner, IIndex index, Map<String,String> properties) {
|
protected IParser<IASTTranslationUnit> getParser(IScanner scanner, IIndex index, Map<String,String> properties) {
|
||||||
boolean supportVectors = supportVectors(properties);
|
IProject project = getProject(properties);
|
||||||
XlcCPPParser parser = new XlcCPPParser(scanner, new XlcCPPTokenMap(supportVectors), getBuiltinBindingsProvider(), index, properties);
|
boolean supportVectors = Boolean.valueOf(XlcLanguagePreferences.get(XlcPreferenceKeys.KEY_SUPPORT_VECTOR_TYPES, project));
|
||||||
|
boolean supportDecimals = Boolean.valueOf(XlcLanguagePreferences.get(XlcPreferenceKeys.KEY_SUPPORT_DECIMAL_FLOATING_POINT_TYPES, project));
|
||||||
|
|
||||||
|
|
||||||
|
XlcCPPParser parser = new XlcCPPParser(scanner, new XlcCPPTokenMap(supportVectors, supportDecimals), getBuiltinBindingsProvider(), index, properties);
|
||||||
return parser;
|
return parser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +82,7 @@ public class XlcCPPLanguage extends GPPLanguage {
|
||||||
@Override
|
@Override
|
||||||
public Object getAdapter(Class adapter) {
|
public Object getAdapter(Class adapter) {
|
||||||
if(ICLanguageKeywords.class.equals(adapter))
|
if(ICLanguageKeywords.class.equals(adapter))
|
||||||
return XlcKeywords.CPP;
|
return XlcKeywords.ALL_CPP_KEYWORDS;
|
||||||
|
|
||||||
return super.getAdapter(adapter);
|
return super.getAdapter(adapter);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ import static org.eclipse.cdt.internal.core.lrparser.xlc.cpp.XlcCPPParsersym.*;
|
||||||
import org.eclipse.cdt.core.dom.lrparser.IDOMTokenMap;
|
import org.eclipse.cdt.core.dom.lrparser.IDOMTokenMap;
|
||||||
import org.eclipse.cdt.core.parser.IGCCToken;
|
import org.eclipse.cdt.core.parser.IGCCToken;
|
||||||
import org.eclipse.cdt.core.parser.IToken;
|
import org.eclipse.cdt.core.parser.IToken;
|
||||||
|
import org.eclipse.cdt.core.parser.ParserLanguage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maps tokens types returned by CPreprocessor to token types
|
* Maps tokens types returned by CPreprocessor to token types
|
||||||
|
@ -25,10 +26,10 @@ import org.eclipse.cdt.core.parser.IToken;
|
||||||
*/
|
*/
|
||||||
public class XlcCPPTokenMap implements IDOMTokenMap {
|
public class XlcCPPTokenMap implements IDOMTokenMap {
|
||||||
|
|
||||||
private final boolean supportVectors;
|
private final XlcKeywords keywordMap;
|
||||||
|
|
||||||
public XlcCPPTokenMap(boolean supportVectors) {
|
public XlcCPPTokenMap(boolean supportVectors, boolean supportDecimalFloatingPoint) {
|
||||||
this.supportVectors = supportVectors;
|
keywordMap = new XlcKeywords(ParserLanguage.CPP, supportVectors, supportDecimalFloatingPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,14 +45,9 @@ public class XlcCPPTokenMap implements IDOMTokenMap {
|
||||||
|
|
||||||
switch(token.getType()) {
|
switch(token.getType()) {
|
||||||
case tIDENTIFIER :
|
case tIDENTIFIER :
|
||||||
if(supportVectors) {
|
Integer keywordKind = keywordMap.getTokenKind(token.getCharImage());
|
||||||
Integer keywordKind = XlcKeywords.CPP.getTokenKind(token.getCharImage());
|
return keywordKind == null ? TK_identifier : keywordKind;
|
||||||
return keywordKind == null ? TK_identifier : keywordKind;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return TK_identifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
case tINTEGER : return TK_integer;
|
case tINTEGER : return TK_integer;
|
||||||
case tCOLONCOLON : return TK_ColonColon;
|
case tCOLONCOLON : return TK_ColonColon;
|
||||||
case tCOLON : return TK_Colon;
|
case tCOLON : return TK_Colon;
|
||||||
|
|
|
@ -16,6 +16,7 @@ import static org.eclipse.cdt.internal.core.lrparser.xlc.c.XlcCParsersym.*;
|
||||||
import org.eclipse.cdt.core.dom.lrparser.IDOMTokenMap;
|
import org.eclipse.cdt.core.dom.lrparser.IDOMTokenMap;
|
||||||
import org.eclipse.cdt.core.parser.IGCCToken;
|
import org.eclipse.cdt.core.parser.IGCCToken;
|
||||||
import org.eclipse.cdt.core.parser.IToken;
|
import org.eclipse.cdt.core.parser.IToken;
|
||||||
|
import org.eclipse.cdt.core.parser.ParserLanguage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maps tokens types returned by CPreprocessor to token types
|
* Maps tokens types returned by CPreprocessor to token types
|
||||||
|
@ -25,10 +26,10 @@ import org.eclipse.cdt.core.parser.IToken;
|
||||||
*/
|
*/
|
||||||
public final class XlcCTokenMap implements IDOMTokenMap {
|
public final class XlcCTokenMap implements IDOMTokenMap {
|
||||||
|
|
||||||
private final boolean supportVectors;
|
private final XlcKeywords keywordMap;
|
||||||
|
|
||||||
public XlcCTokenMap(boolean supportVectors) {
|
public XlcCTokenMap(boolean supportVectors, boolean supportDecimalFloatingPoint) {
|
||||||
this.supportVectors = supportVectors;
|
keywordMap = new XlcKeywords(ParserLanguage.C, supportVectors, supportDecimalFloatingPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,13 +45,8 @@ public final class XlcCTokenMap implements IDOMTokenMap {
|
||||||
|
|
||||||
switch(token.getType()) {
|
switch(token.getType()) {
|
||||||
case tIDENTIFIER :
|
case tIDENTIFIER :
|
||||||
if(supportVectors) {
|
Integer keywordKind = keywordMap.getTokenKind(token.getCharImage());
|
||||||
Integer keywordKind = XlcKeywords.C.getTokenKind(token.getCharImage());
|
return keywordKind == null ? TK_identifier : keywordKind;
|
||||||
return keywordKind == null ? TK_identifier : keywordKind;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return TK_identifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
case tINTEGER : return TK_integer;
|
case tINTEGER : return TK_integer;
|
||||||
case tCOLON : return TK_Colon;
|
case tCOLON : return TK_Colon;
|
||||||
|
|
|
@ -23,32 +23,46 @@ import org.eclipse.cdt.internal.core.lrparser.xlc.cpp.XlcCPPParsersym;
|
||||||
|
|
||||||
public class XlcKeywords extends CLanguageKeywords {
|
public class XlcKeywords extends CLanguageKeywords {
|
||||||
|
|
||||||
public static final XlcKeywords C = new XlcKeywords(ParserLanguage.C);
|
public static final XlcKeywords ALL_C_KEYWORDS = new XlcKeywords(ParserLanguage.C, true, true);
|
||||||
static {
|
public static final XlcKeywords ALL_CPP_KEYWORDS = new XlcKeywords(ParserLanguage.CPP, true, true);
|
||||||
C.map.put("vector".toCharArray(), XlcCParsersym.TK_vector);
|
|
||||||
C.map.put("__vector".toCharArray(), XlcCParsersym.TK_vector);
|
|
||||||
C.map.put("pixel".toCharArray(), XlcCParsersym.TK_pixel);
|
|
||||||
C.map.put("__pixel".toCharArray(), XlcCParsersym.TK_pixel);
|
|
||||||
C.map.put("bool".toCharArray(), XlcCParsersym.TK_bool);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final XlcKeywords CPP = new XlcKeywords(ParserLanguage.CPP);
|
|
||||||
static {
|
|
||||||
CPP.map.put("vector".toCharArray(), XlcCPPParsersym.TK_vector);
|
|
||||||
CPP.map.put("__vector".toCharArray(), XlcCPPParsersym.TK_vector);
|
|
||||||
CPP.map.put("pixel".toCharArray(), XlcCPPParsersym.TK_pixel);
|
|
||||||
CPP.map.put("__pixel".toCharArray(), XlcCPPParsersym.TK_pixel);
|
|
||||||
// bool is already a C++ keyword
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private final CharArrayMap<Integer> map = new CharArrayMap<Integer>();
|
private final CharArrayMap<Integer> map = new CharArrayMap<Integer>();
|
||||||
private final ParserLanguage language;
|
private final ParserLanguage language;
|
||||||
private String[] allKeywords = null;
|
private String[] allKeywords = null;
|
||||||
|
|
||||||
private XlcKeywords(ParserLanguage language) {
|
public XlcKeywords(ParserLanguage language, boolean supportVectors, boolean supportDeclimalFloatingPoint) {
|
||||||
super(language, XlcScannerExtensionConfiguration.getInstance());
|
super(language, XlcScannerExtensionConfiguration.getInstance());
|
||||||
this.language = language;
|
this.language = language;
|
||||||
|
|
||||||
|
if(language.isCPP()) {
|
||||||
|
if(supportVectors) {
|
||||||
|
map.put("vector".toCharArray(), XlcCPPParsersym.TK_vector);
|
||||||
|
map.put("__vector".toCharArray(), XlcCPPParsersym.TK_vector);
|
||||||
|
map.put("pixel".toCharArray(), XlcCPPParsersym.TK_pixel);
|
||||||
|
map.put("__pixel".toCharArray(), XlcCPPParsersym.TK_pixel);
|
||||||
|
}
|
||||||
|
if(supportDeclimalFloatingPoint) {
|
||||||
|
map.put("_Decimal32".toCharArray(), XlcCPPParsersym.TK__Decimal32);
|
||||||
|
map.put("_Decimal64".toCharArray(), XlcCPPParsersym.TK__Decimal64);
|
||||||
|
map.put("_Decimal128".toCharArray(), XlcCPPParsersym.TK__Decimal128);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if(supportVectors) {
|
||||||
|
map.put("vector".toCharArray(), XlcCParsersym.TK_vector);
|
||||||
|
map.put("__vector".toCharArray(), XlcCParsersym.TK_vector);
|
||||||
|
map.put("pixel".toCharArray(), XlcCParsersym.TK_pixel);
|
||||||
|
map.put("__pixel".toCharArray(), XlcCParsersym.TK_pixel);
|
||||||
|
map.put("bool".toCharArray(), XlcCParsersym.TK_bool);
|
||||||
|
}
|
||||||
|
if(supportDeclimalFloatingPoint) {
|
||||||
|
map.put("_Decimal32".toCharArray(), XlcCParsersym.TK__Decimal32);
|
||||||
|
map.put("_Decimal64".toCharArray(), XlcCParsersym.TK__Decimal64);
|
||||||
|
map.put("_Decimal128".toCharArray(), XlcCParsersym.TK__Decimal128);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -30,9 +30,10 @@ public class XlcLanguagePreferences {
|
||||||
private static final String XLC_PREFERENCES_NODE = "xlc.preferences";
|
private static final String XLC_PREFERENCES_NODE = "xlc.preferences";
|
||||||
|
|
||||||
|
|
||||||
public static void initializeDefaultPreferences() {
|
static void initializeDefaultPreferences() {
|
||||||
Preferences prefs = getDefaultPreferences();
|
Preferences prefs = getDefaultPreferences();
|
||||||
prefs.putBoolean(XlcPreferenceKeys.KEY_SUPPORT_VECTOR_TYPES, true);
|
prefs.putBoolean(XlcPreferenceKeys.KEY_SUPPORT_VECTOR_TYPES, true);
|
||||||
|
prefs.putBoolean(XlcPreferenceKeys.KEY_SUPPORT_DECIMAL_FLOATING_POINT_TYPES, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setProjectPreference(String key, String value, IProject project) {
|
public static void setProjectPreference(String key, String value, IProject project) {
|
||||||
|
@ -66,23 +67,24 @@ public class XlcLanguagePreferences {
|
||||||
*
|
*
|
||||||
* @param project If null then just the workspace and default preferences will be checked.
|
* @param project If null then just the workspace and default preferences will be checked.
|
||||||
*/
|
*/
|
||||||
public static String getPreference(String key, IProject project) {
|
public static String get(String key, IProject project) {
|
||||||
Preferences[] prefs;
|
return Platform.getPreferencesService().get(key, null, getPreferences(key, project));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Preferences[] getPreferences(String key, IProject project) {
|
||||||
if(project == null) {
|
if(project == null) {
|
||||||
prefs = new Preferences[] {
|
return new Preferences[] {
|
||||||
getWorkspacePreferences(),
|
getWorkspacePreferences(),
|
||||||
getDefaultPreferences()
|
getDefaultPreferences()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
prefs = new Preferences[] {
|
return new Preferences[] {
|
||||||
getProjectPreferences(project),
|
getProjectPreferences(project),
|
||||||
getWorkspacePreferences(),
|
getWorkspacePreferences(),
|
||||||
getDefaultPreferences()
|
getDefaultPreferences()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return Platform.getPreferencesService().get(key, null, prefs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,10 +15,8 @@ public final class XlcPreferenceKeys {
|
||||||
|
|
||||||
private XlcPreferenceKeys() {}
|
private XlcPreferenceKeys() {}
|
||||||
|
|
||||||
/**
|
|
||||||
* Type: boolean
|
|
||||||
* Default: false
|
|
||||||
*/
|
|
||||||
public static final String KEY_SUPPORT_VECTOR_TYPES = "vectorTypes";
|
public static final String KEY_SUPPORT_VECTOR_TYPES = "vectorTypes";
|
||||||
|
|
||||||
|
public static final String KEY_SUPPORT_DECIMAL_FLOATING_POINT_TYPES = "floatingPointTypes";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1376,51 +1376,51 @@ private GNUBuildASTParserAction gnuAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Rule 388: type_id ::= vector_type
|
// Rule 391: type_id ::= vector_type
|
||||||
//
|
//
|
||||||
case 388: { action. consumeTypeId(false); break;
|
case 391: { action. consumeTypeId(false); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Rule 389: type_id ::= vector_type abstract_declarator
|
// Rule 392: type_id ::= vector_type abstract_declarator
|
||||||
//
|
//
|
||||||
case 389: { action. consumeTypeId(true); break;
|
case 392: { action. consumeTypeId(true); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Rule 390: vector_declaration ::= vector_type <openscope-ast> init_declarator_list ;
|
// Rule 393: vector_declaration ::= vector_type <openscope-ast> init_declarator_list ;
|
||||||
//
|
//
|
||||||
case 390: { action. consumeDeclarationSimple(true); break;
|
case 393: { action. consumeDeclarationSimple(true); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Rule 391: vector_type ::= <openscope-ast> no_type_declaration_specifiers_opt vector vector_type_specifier all_specifier_qualifier_list_opt
|
// Rule 394: vector_type ::= <openscope-ast> no_type_declaration_specifiers_opt vector vector_type_specifier all_specifier_qualifier_list_opt
|
||||||
//
|
//
|
||||||
case 391: { action. consumeVectorTypeSpecifier(); break;
|
case 394: { action. consumeVectorTypeSpecifier(); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Rule 392: vector_type_specifier ::= vector_type_specifier_token
|
// Rule 395: vector_type_specifier ::= vector_type_specifier_token
|
||||||
//
|
//
|
||||||
case 392: { action. consumeToken(); break;
|
case 395: { action. consumeToken(); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Rule 414: declarator_id_name ::= pixel
|
// Rule 417: declarator_id_name ::= pixel
|
||||||
//
|
//
|
||||||
case 414: { action. consumeIdentifierName(); break;
|
case 417: { action. consumeIdentifierName(); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Rule 415: declarator_id_name ::= vector
|
// Rule 418: declarator_id_name ::= vector
|
||||||
//
|
//
|
||||||
case 415: { action. consumeIdentifierName(); break;
|
case 418: { action. consumeIdentifierName(); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Rule 416: declarator_id_name ::= bool
|
// Rule 419: declarator_id_name ::= bool
|
||||||
//
|
//
|
||||||
case 416: { action. consumeIdentifierName(); break;
|
case 419: { action. consumeIdentifierName(); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -24,8 +24,8 @@ public interface XlcCParsersym {
|
||||||
TK_default = 53,
|
TK_default = 53,
|
||||||
TK_do = 54,
|
TK_do = 54,
|
||||||
TK_double = 55,
|
TK_double = 55,
|
||||||
TK_else = 102,
|
TK_else = 105,
|
||||||
TK_enum = 65,
|
TK_enum = 68,
|
||||||
TK_extern = 33,
|
TK_extern = 33,
|
||||||
TK_float = 40,
|
TK_float = 40,
|
||||||
TK_for = 56,
|
TK_for = 56,
|
||||||
|
@ -41,10 +41,10 @@ public interface XlcCParsersym {
|
||||||
TK_signed = 44,
|
TK_signed = 44,
|
||||||
TK_sizeof = 20,
|
TK_sizeof = 20,
|
||||||
TK_static = 30,
|
TK_static = 30,
|
||||||
TK_struct = 66,
|
TK_struct = 69,
|
||||||
TK_switch = 60,
|
TK_switch = 60,
|
||||||
TK_typedef = 36,
|
TK_typedef = 36,
|
||||||
TK_union = 67,
|
TK_union = 70,
|
||||||
TK_unsigned = 45,
|
TK_unsigned = 45,
|
||||||
TK_void = 61,
|
TK_void = 61,
|
||||||
TK_volatile = 28,
|
TK_volatile = 28,
|
||||||
|
@ -59,12 +59,12 @@ public interface XlcCParsersym {
|
||||||
TK_identifier = 2,
|
TK_identifier = 2,
|
||||||
TK_Completion = 11,
|
TK_Completion = 11,
|
||||||
TK_EndOfCompletion = 6,
|
TK_EndOfCompletion = 6,
|
||||||
TK_Invalid = 103,
|
TK_Invalid = 106,
|
||||||
TK_LeftBracket = 37,
|
TK_LeftBracket = 37,
|
||||||
TK_LeftParen = 1,
|
TK_LeftParen = 1,
|
||||||
TK_LeftBrace = 18,
|
TK_LeftBrace = 18,
|
||||||
TK_Dot = 72,
|
TK_Dot = 75,
|
||||||
TK_Arrow = 87,
|
TK_Arrow = 90,
|
||||||
TK_PlusPlus = 16,
|
TK_PlusPlus = 16,
|
||||||
TK_MinusMinus = 17,
|
TK_MinusMinus = 17,
|
||||||
TK_And = 15,
|
TK_And = 15,
|
||||||
|
@ -73,51 +73,54 @@ public interface XlcCParsersym {
|
||||||
TK_Minus = 14,
|
TK_Minus = 14,
|
||||||
TK_Tilde = 24,
|
TK_Tilde = 24,
|
||||||
TK_Bang = 25,
|
TK_Bang = 25,
|
||||||
TK_Slash = 73,
|
TK_Slash = 76,
|
||||||
TK_Percent = 74,
|
TK_Percent = 77,
|
||||||
TK_RightShift = 69,
|
TK_RightShift = 72,
|
||||||
TK_LeftShift = 70,
|
TK_LeftShift = 73,
|
||||||
TK_LT = 75,
|
TK_LT = 78,
|
||||||
TK_GT = 76,
|
TK_GT = 79,
|
||||||
TK_LE = 77,
|
TK_LE = 80,
|
||||||
TK_GE = 78,
|
TK_GE = 81,
|
||||||
TK_EQ = 81,
|
TK_EQ = 84,
|
||||||
TK_NE = 82,
|
TK_NE = 85,
|
||||||
TK_Caret = 83,
|
TK_Caret = 86,
|
||||||
TK_Or = 84,
|
TK_Or = 87,
|
||||||
TK_AndAnd = 85,
|
TK_AndAnd = 88,
|
||||||
TK_OrOr = 88,
|
TK_OrOr = 91,
|
||||||
TK_Question = 89,
|
TK_Question = 92,
|
||||||
TK_Colon = 49,
|
TK_Colon = 49,
|
||||||
TK_DotDotDot = 86,
|
TK_DotDotDot = 89,
|
||||||
TK_Assign = 71,
|
TK_Assign = 74,
|
||||||
TK_StarAssign = 90,
|
TK_StarAssign = 93,
|
||||||
TK_SlashAssign = 91,
|
TK_SlashAssign = 94,
|
||||||
TK_PercentAssign = 92,
|
TK_PercentAssign = 95,
|
||||||
TK_PlusAssign = 93,
|
TK_PlusAssign = 96,
|
||||||
TK_MinusAssign = 94,
|
TK_MinusAssign = 97,
|
||||||
TK_RightShiftAssign = 95,
|
TK_RightShiftAssign = 98,
|
||||||
TK_LeftShiftAssign = 96,
|
TK_LeftShiftAssign = 99,
|
||||||
TK_AndAssign = 97,
|
TK_AndAssign = 100,
|
||||||
TK_CaretAssign = 98,
|
TK_CaretAssign = 101,
|
||||||
TK_OrAssign = 99,
|
TK_OrAssign = 102,
|
||||||
TK_Comma = 46,
|
TK_Comma = 46,
|
||||||
TK_RightBracket = 100,
|
TK_RightBracket = 103,
|
||||||
TK_RightParen = 47,
|
TK_RightParen = 47,
|
||||||
TK_RightBrace = 68,
|
TK_RightBrace = 71,
|
||||||
TK_SemiColon = 31,
|
TK_SemiColon = 31,
|
||||||
TK_typeof = 12,
|
TK_typeof = 12,
|
||||||
TK___alignof__ = 26,
|
TK___alignof__ = 26,
|
||||||
TK___attribute__ = 8,
|
TK___attribute__ = 8,
|
||||||
TK___declspec = 9,
|
TK___declspec = 9,
|
||||||
TK_MAX = 79,
|
TK_MAX = 82,
|
||||||
TK_MIN = 80,
|
TK_MIN = 83,
|
||||||
TK_asm = 7,
|
TK_asm = 7,
|
||||||
TK_vector = 5,
|
TK_vector = 5,
|
||||||
TK_pixel = 3,
|
TK_pixel = 3,
|
||||||
TK_bool = 4,
|
TK_bool = 4,
|
||||||
|
TK__Decimal32 = 65,
|
||||||
|
TK__Decimal64 = 66,
|
||||||
|
TK__Decimal128 = 67,
|
||||||
TK_ERROR_TOKEN = 38,
|
TK_ERROR_TOKEN = 38,
|
||||||
TK_EOF_TOKEN = 101;
|
TK_EOF_TOKEN = 104;
|
||||||
|
|
||||||
public final static String orderedTerminalSymbols[] = {
|
public final static String orderedTerminalSymbols[] = {
|
||||||
"",
|
"",
|
||||||
|
@ -185,6 +188,9 @@ public interface XlcCParsersym {
|
||||||
"_Bool",
|
"_Bool",
|
||||||
"_Complex",
|
"_Complex",
|
||||||
"_Imaginary",
|
"_Imaginary",
|
||||||
|
"_Decimal32",
|
||||||
|
"_Decimal64",
|
||||||
|
"_Decimal128",
|
||||||
"enum",
|
"enum",
|
||||||
"struct",
|
"struct",
|
||||||
"union",
|
"union",
|
||||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -17,137 +17,140 @@ public interface XlcCPPParsersym {
|
||||||
public final static int
|
public final static int
|
||||||
TK__Complex = 24,
|
TK__Complex = 24,
|
||||||
TK__Imaginary = 25,
|
TK__Imaginary = 25,
|
||||||
TK_restrict = 32,
|
TK_restrict = 35,
|
||||||
TK_asm = 7,
|
TK_asm = 7,
|
||||||
TK_auto = 34,
|
TK_auto = 37,
|
||||||
TK_bool = 15,
|
TK_bool = 15,
|
||||||
TK_break = 85,
|
TK_break = 88,
|
||||||
TK_case = 86,
|
TK_case = 89,
|
||||||
TK_catch = 129,
|
TK_catch = 132,
|
||||||
TK_char = 16,
|
TK_char = 16,
|
||||||
TK_class = 50,
|
TK_class = 53,
|
||||||
TK_const = 30,
|
TK_const = 33,
|
||||||
TK_const_cast = 52,
|
TK_const_cast = 55,
|
||||||
TK_continue = 87,
|
TK_continue = 90,
|
||||||
TK_default = 88,
|
TK_default = 91,
|
||||||
TK_delete = 78,
|
TK_delete = 81,
|
||||||
TK_do = 89,
|
TK_do = 92,
|
||||||
TK_double = 26,
|
TK_double = 26,
|
||||||
TK_dynamic_cast = 53,
|
TK_dynamic_cast = 56,
|
||||||
TK_else = 132,
|
TK_else = 135,
|
||||||
TK_enum = 65,
|
TK_enum = 68,
|
||||||
TK_explicit = 35,
|
TK_explicit = 38,
|
||||||
TK_export = 90,
|
TK_export = 93,
|
||||||
TK_extern = 36,
|
TK_extern = 39,
|
||||||
TK_false = 54,
|
TK_false = 57,
|
||||||
TK_float = 17,
|
TK_float = 17,
|
||||||
TK_for = 91,
|
TK_for = 94,
|
||||||
TK_friend = 37,
|
TK_friend = 40,
|
||||||
TK_goto = 92,
|
TK_goto = 95,
|
||||||
TK_if = 93,
|
TK_if = 96,
|
||||||
TK_inline = 38,
|
TK_inline = 41,
|
||||||
TK_int = 18,
|
TK_int = 18,
|
||||||
TK_long = 19,
|
TK_long = 19,
|
||||||
TK_mutable = 39,
|
TK_mutable = 42,
|
||||||
TK_namespace = 68,
|
TK_namespace = 71,
|
||||||
TK_new = 79,
|
TK_new = 82,
|
||||||
TK_operator = 12,
|
TK_operator = 12,
|
||||||
TK_private = 113,
|
TK_private = 116,
|
||||||
TK_protected = 114,
|
TK_protected = 117,
|
||||||
TK_public = 115,
|
TK_public = 118,
|
||||||
TK_register = 40,
|
TK_register = 43,
|
||||||
TK_reinterpret_cast = 55,
|
TK_reinterpret_cast = 58,
|
||||||
TK_return = 94,
|
TK_return = 97,
|
||||||
TK_short = 20,
|
TK_short = 20,
|
||||||
TK_signed = 21,
|
TK_signed = 21,
|
||||||
TK_sizeof = 56,
|
TK_sizeof = 59,
|
||||||
TK_static = 41,
|
TK_static = 44,
|
||||||
TK_static_cast = 57,
|
TK_static_cast = 60,
|
||||||
TK_struct = 66,
|
TK_struct = 69,
|
||||||
TK_switch = 95,
|
TK_switch = 98,
|
||||||
TK_template = 49,
|
TK_template = 52,
|
||||||
TK_this = 58,
|
TK_this = 61,
|
||||||
TK_throw = 73,
|
TK_throw = 76,
|
||||||
TK_try = 81,
|
TK_try = 84,
|
||||||
TK_true = 59,
|
TK_true = 62,
|
||||||
TK_typedef = 42,
|
TK_typedef = 45,
|
||||||
TK_typeid = 60,
|
TK_typeid = 63,
|
||||||
TK_typename = 22,
|
TK_typename = 22,
|
||||||
TK_union = 67,
|
TK_union = 70,
|
||||||
TK_unsigned = 23,
|
TK_unsigned = 23,
|
||||||
TK_using = 71,
|
TK_using = 74,
|
||||||
TK_virtual = 33,
|
TK_virtual = 36,
|
||||||
TK_void = 27,
|
TK_void = 27,
|
||||||
TK_volatile = 31,
|
TK_volatile = 34,
|
||||||
TK_wchar_t = 28,
|
TK_wchar_t = 28,
|
||||||
TK_while = 84,
|
TK_while = 87,
|
||||||
TK_integer = 61,
|
TK_integer = 64,
|
||||||
TK_floating = 62,
|
TK_floating = 65,
|
||||||
TK_charconst = 63,
|
TK_charconst = 66,
|
||||||
TK_stringlit = 44,
|
TK_stringlit = 47,
|
||||||
TK_identifier = 1,
|
TK_identifier = 1,
|
||||||
TK_Completion = 4,
|
TK_Completion = 4,
|
||||||
TK_EndOfCompletion = 11,
|
TK_EndOfCompletion = 11,
|
||||||
TK_Invalid = 133,
|
TK_Invalid = 136,
|
||||||
TK_LeftBracket = 74,
|
TK_LeftBracket = 77,
|
||||||
TK_LeftParen = 5,
|
TK_LeftParen = 5,
|
||||||
TK_Dot = 130,
|
TK_Dot = 133,
|
||||||
TK_DotStar = 100,
|
TK_DotStar = 103,
|
||||||
TK_Arrow = 116,
|
TK_Arrow = 119,
|
||||||
TK_ArrowStar = 99,
|
TK_ArrowStar = 102,
|
||||||
TK_PlusPlus = 47,
|
TK_PlusPlus = 50,
|
||||||
TK_MinusMinus = 48,
|
TK_MinusMinus = 51,
|
||||||
TK_And = 14,
|
TK_And = 14,
|
||||||
TK_Star = 13,
|
TK_Star = 13,
|
||||||
TK_Plus = 45,
|
TK_Plus = 48,
|
||||||
TK_Minus = 46,
|
TK_Minus = 49,
|
||||||
TK_Tilde = 10,
|
TK_Tilde = 10,
|
||||||
TK_Bang = 51,
|
TK_Bang = 54,
|
||||||
TK_Slash = 101,
|
TK_Slash = 104,
|
||||||
TK_Percent = 102,
|
TK_Percent = 105,
|
||||||
TK_RightShift = 96,
|
TK_RightShift = 99,
|
||||||
TK_LeftShift = 97,
|
TK_LeftShift = 100,
|
||||||
TK_LT = 69,
|
TK_LT = 72,
|
||||||
TK_GT = 80,
|
TK_GT = 83,
|
||||||
TK_LE = 103,
|
TK_LE = 106,
|
||||||
TK_GE = 104,
|
TK_GE = 107,
|
||||||
TK_EQ = 105,
|
TK_EQ = 108,
|
||||||
TK_NE = 106,
|
TK_NE = 109,
|
||||||
TK_Caret = 107,
|
TK_Caret = 110,
|
||||||
TK_Or = 108,
|
TK_Or = 111,
|
||||||
TK_AndAnd = 109,
|
TK_AndAnd = 112,
|
||||||
TK_OrOr = 110,
|
TK_OrOr = 113,
|
||||||
TK_Question = 117,
|
TK_Question = 120,
|
||||||
TK_Colon = 77,
|
TK_Colon = 80,
|
||||||
TK_ColonColon = 6,
|
TK_ColonColon = 6,
|
||||||
TK_DotDotDot = 98,
|
TK_DotDotDot = 101,
|
||||||
TK_Assign = 82,
|
TK_Assign = 85,
|
||||||
TK_StarAssign = 118,
|
TK_StarAssign = 121,
|
||||||
TK_SlashAssign = 119,
|
TK_SlashAssign = 122,
|
||||||
TK_PercentAssign = 120,
|
TK_PercentAssign = 123,
|
||||||
TK_PlusAssign = 121,
|
TK_PlusAssign = 124,
|
||||||
TK_MinusAssign = 122,
|
TK_MinusAssign = 125,
|
||||||
TK_RightShiftAssign = 123,
|
TK_RightShiftAssign = 126,
|
||||||
TK_LeftShiftAssign = 124,
|
TK_LeftShiftAssign = 127,
|
||||||
TK_AndAssign = 125,
|
TK_AndAssign = 128,
|
||||||
TK_CaretAssign = 126,
|
TK_CaretAssign = 129,
|
||||||
TK_OrAssign = 127,
|
TK_OrAssign = 130,
|
||||||
TK_Comma = 76,
|
TK_Comma = 79,
|
||||||
TK_RightBracket = 128,
|
TK_RightBracket = 131,
|
||||||
TK_RightParen = 75,
|
TK_RightParen = 78,
|
||||||
TK_RightBrace = 83,
|
TK_RightBrace = 86,
|
||||||
TK_SemiColon = 43,
|
TK_SemiColon = 46,
|
||||||
TK_LeftBrace = 70,
|
TK_LeftBrace = 73,
|
||||||
TK_typeof = 29,
|
TK_typeof = 32,
|
||||||
TK___alignof__ = 64,
|
TK___alignof__ = 67,
|
||||||
TK___attribute__ = 8,
|
TK___attribute__ = 8,
|
||||||
TK___declspec = 9,
|
TK___declspec = 9,
|
||||||
TK_MAX = 111,
|
TK_MAX = 114,
|
||||||
TK_MIN = 112,
|
TK_MIN = 115,
|
||||||
TK_vector = 3,
|
TK_vector = 3,
|
||||||
TK_pixel = 2,
|
TK_pixel = 2,
|
||||||
TK_ERROR_TOKEN = 72,
|
TK__Decimal32 = 29,
|
||||||
TK_EOF_TOKEN = 131;
|
TK__Decimal64 = 30,
|
||||||
|
TK__Decimal128 = 31,
|
||||||
|
TK_ERROR_TOKEN = 75,
|
||||||
|
TK_EOF_TOKEN = 134;
|
||||||
|
|
||||||
public final static String orderedTerminalSymbols[] = {
|
public final static String orderedTerminalSymbols[] = {
|
||||||
"",
|
"",
|
||||||
|
@ -179,6 +182,9 @@ public interface XlcCPPParsersym {
|
||||||
"double",
|
"double",
|
||||||
"void",
|
"void",
|
||||||
"wchar_t",
|
"wchar_t",
|
||||||
|
"_Decimal32",
|
||||||
|
"_Decimal64",
|
||||||
|
"_Decimal128",
|
||||||
"typeof",
|
"typeof",
|
||||||
"const",
|
"const",
|
||||||
"volatile",
|
"volatile",
|
||||||
|
|
|
@ -26,7 +26,8 @@ public class PreferenceMessages extends NLS {
|
||||||
public static String
|
public static String
|
||||||
XlcLanguageOptionsPreferencePage_link,
|
XlcLanguageOptionsPreferencePage_link,
|
||||||
XlcLanguageOptionsPreferencePage_group,
|
XlcLanguageOptionsPreferencePage_group,
|
||||||
XlcLanguageOptionsPreferencePage_preference_vectors;
|
XlcLanguageOptionsPreferencePage_preference_vectors,
|
||||||
|
XlcLanguageOptionsPreferencePage_preference_decimals;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,10 +61,29 @@ public class XlcLanguageOptionsPreferencePage extends PreferencePage implements
|
||||||
|
|
||||||
buttonVectors = ControlFactory.createCheckBox(group, PreferenceMessages.XlcLanguageOptionsPreferencePage_preference_vectors);
|
buttonVectors = ControlFactory.createCheckBox(group, PreferenceMessages.XlcLanguageOptionsPreferencePage_preference_vectors);
|
||||||
initCheckbox(buttonVectors, XlcPreferenceKeys.KEY_SUPPORT_VECTOR_TYPES);
|
initCheckbox(buttonVectors, XlcPreferenceKeys.KEY_SUPPORT_VECTOR_TYPES);
|
||||||
|
buttonDecimals = ControlFactory.createCheckBox(group, PreferenceMessages.XlcLanguageOptionsPreferencePage_preference_decimals);
|
||||||
|
initCheckbox(buttonDecimals, XlcPreferenceKeys.KEY_SUPPORT_DECIMAL_FLOATING_POINT_TYPES);
|
||||||
|
|
||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void performDefaults() {
|
||||||
|
buttonVectors.setSelection(Boolean.valueOf(XlcLanguagePreferences.getDefaultPreference(XlcPreferenceKeys.KEY_SUPPORT_VECTOR_TYPES)));
|
||||||
|
buttonDecimals.setSelection(Boolean.valueOf(XlcLanguagePreferences.getDefaultPreference(XlcPreferenceKeys.KEY_SUPPORT_DECIMAL_FLOATING_POINT_TYPES)));
|
||||||
|
|
||||||
|
super.performDefaults();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean performOk() {
|
||||||
|
setPreference(XlcPreferenceKeys.KEY_SUPPORT_VECTOR_TYPES, buttonVectors.getSelection(), getProject());
|
||||||
|
setPreference(XlcPreferenceKeys.KEY_SUPPORT_DECIMAL_FLOATING_POINT_TYPES, buttonDecimals.getSelection(), getProject());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void initCheckbox(Button checkbox, String prefKey) {
|
private void initCheckbox(Button checkbox, String prefKey) {
|
||||||
String preference = null;
|
String preference = null;
|
||||||
|
@ -83,21 +102,6 @@ public class XlcLanguageOptionsPreferencePage extends PreferencePage implements
|
||||||
|
|
||||||
checkbox.setSelection(Boolean.valueOf(preference));
|
checkbox.setSelection(Boolean.valueOf(preference));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void performDefaults() {
|
|
||||||
buttonVectors.setSelection(Boolean.valueOf(XlcLanguagePreferences.getDefaultPreference(XlcPreferenceKeys.KEY_SUPPORT_VECTOR_TYPES)));
|
|
||||||
|
|
||||||
super.performDefaults();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean performOk() {
|
|
||||||
setPreference(XlcPreferenceKeys.KEY_SUPPORT_VECTOR_TYPES, buttonVectors.getSelection(), getProject());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private IProject getProject() {
|
private IProject getProject() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue