1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-11 10:15:39 +02:00

[273080] [XLC Parser] support for decimal floating point types (_Decimal32, _Decimal64, _Decimal128)

This commit is contained in:
Mike Kucera 2009-04-21 15:11:35 +00:00
parent 795dbe40e0
commit 698d5bb0ba
17 changed files with 4873 additions and 4852 deletions

View file

@ -907,28 +907,21 @@ function_specifier
simple_type_specifier
::= simple_type_specifier_token
/. $Build consumeToken(); $EndBuild ./
simple_type_specifier_token
::= 'char'
/. $Build consumeToken(); $EndBuild ./
| 'wchar_t'
/. $Build consumeToken(); $EndBuild ./
| 'bool'
/. $Build consumeToken(); $EndBuild ./
| 'short'
/. $Build consumeToken(); $EndBuild ./
| 'int'
/. $Build consumeToken(); $EndBuild ./
| 'long'
/. $Build consumeToken(); $EndBuild ./
| 'signed'
/. $Build consumeToken(); $EndBuild ./
| 'unsigned'
/. $Build consumeToken(); $EndBuild ./
| 'float'
/. $Build consumeToken(); $EndBuild ./
| 'double'
/. $Build consumeToken(); $EndBuild ./
| 'void'
/. $Build consumeToken(); $EndBuild ./
-- last two rules moved here from simple_type_specifier

View file

@ -20,6 +20,10 @@ $Terminals
pixel
bool
_Decimal32
_Decimal64
_Decimal128
$End
@ -28,6 +32,14 @@ $End
$Rules
simple_type_specifier_token
::= '_Decimal32'
| '_Decimal64'
| '_Decimal128'
type_id
::= vector_type
/. $Build consumeTypeId(false); $EndBuild ./

View file

@ -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.parser.IScannerExtensionConfiguration;
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.parser.IScanner;
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
protected IParser<IASTTranslationUnit> getParser(IScanner scanner, IIndex index, Map<String,String> properties) {
boolean supportVectors = XlcCPPLanguage.supportVectors(properties);
return new XlcCParser(scanner, new XlcCTokenMap(supportVectors), getBuiltinBindingsProvider(), index, properties);
IProject project = XlcCPPLanguage.getProject(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() {
@ -55,7 +61,7 @@ public class XlcCLanguage extends GCCLanguage {
@Override
public Object getAdapter(Class adapter) {
if(ICLanguageKeywords.class.equals(adapter))
return XlcKeywords.C;
return XlcKeywords.ALL_C_KEYWORDS;
return super.getAdapter(adapter);
}

View file

@ -42,7 +42,8 @@ public class XlcCPPLanguage extends GPPLanguage {
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);
System.out.println("path: " + path);
IFile[] file = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(new Path(path));
@ -52,14 +53,18 @@ public class XlcCPPLanguage extends GPPLanguage {
project = file[0].getProject();
}
return Boolean.valueOf(XlcLanguagePreferences.getPreference(XlcPreferenceKeys.KEY_SUPPORT_VECTOR_TYPES, project));
return project;
}
@Override
protected IParser<IASTTranslationUnit> getParser(IScanner scanner, IIndex index, Map<String,String> properties) {
boolean supportVectors = supportVectors(properties);
XlcCPPParser parser = new XlcCPPParser(scanner, new XlcCPPTokenMap(supportVectors), getBuiltinBindingsProvider(), index, properties);
IProject project = getProject(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;
}
@ -77,7 +82,7 @@ public class XlcCPPLanguage extends GPPLanguage {
@Override
public Object getAdapter(Class adapter) {
if(ICLanguageKeywords.class.equals(adapter))
return XlcKeywords.CPP;
return XlcKeywords.ALL_CPP_KEYWORDS;
return super.getAdapter(adapter);
}

View file

@ -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.parser.IGCCToken;
import org.eclipse.cdt.core.parser.IToken;
import org.eclipse.cdt.core.parser.ParserLanguage;
/**
* 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 {
private final boolean supportVectors;
private final XlcKeywords keywordMap;
public XlcCPPTokenMap(boolean supportVectors) {
this.supportVectors = supportVectors;
public XlcCPPTokenMap(boolean supportVectors, boolean supportDecimalFloatingPoint) {
keywordMap = new XlcKeywords(ParserLanguage.CPP, supportVectors, supportDecimalFloatingPoint);
}
@ -44,14 +45,9 @@ public class XlcCPPTokenMap implements IDOMTokenMap {
switch(token.getType()) {
case tIDENTIFIER :
if(supportVectors) {
Integer keywordKind = XlcKeywords.CPP.getTokenKind(token.getCharImage());
return keywordKind == null ? TK_identifier : keywordKind;
}
else {
return TK_identifier;
}
Integer keywordKind = keywordMap.getTokenKind(token.getCharImage());
return keywordKind == null ? TK_identifier : keywordKind;
case tINTEGER : return TK_integer;
case tCOLONCOLON : return TK_ColonColon;
case tCOLON : return TK_Colon;

View file

@ -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.parser.IGCCToken;
import org.eclipse.cdt.core.parser.IToken;
import org.eclipse.cdt.core.parser.ParserLanguage;
/**
* 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 {
private final boolean supportVectors;
private final XlcKeywords keywordMap;
public XlcCTokenMap(boolean supportVectors) {
this.supportVectors = supportVectors;
public XlcCTokenMap(boolean supportVectors, boolean supportDecimalFloatingPoint) {
keywordMap = new XlcKeywords(ParserLanguage.C, supportVectors, supportDecimalFloatingPoint);
}
@ -44,13 +45,8 @@ public final class XlcCTokenMap implements IDOMTokenMap {
switch(token.getType()) {
case tIDENTIFIER :
if(supportVectors) {
Integer keywordKind = XlcKeywords.C.getTokenKind(token.getCharImage());
return keywordKind == null ? TK_identifier : keywordKind;
}
else {
return TK_identifier;
}
Integer keywordKind = keywordMap.getTokenKind(token.getCharImage());
return keywordKind == null ? TK_identifier : keywordKind;
case tINTEGER : return TK_integer;
case tCOLON : return TK_Colon;

View file

@ -23,32 +23,46 @@ import org.eclipse.cdt.internal.core.lrparser.xlc.cpp.XlcCPPParsersym;
public class XlcKeywords extends CLanguageKeywords {
public static final XlcKeywords C = new XlcKeywords(ParserLanguage.C);
static {
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
}
public static final XlcKeywords ALL_C_KEYWORDS = new XlcKeywords(ParserLanguage.C, true, true);
public static final XlcKeywords ALL_CPP_KEYWORDS = new XlcKeywords(ParserLanguage.CPP, true, true);
private final CharArrayMap<Integer> map = new CharArrayMap<Integer>();
private final ParserLanguage language;
private String[] allKeywords = null;
private XlcKeywords(ParserLanguage language) {
public XlcKeywords(ParserLanguage language, boolean supportVectors, boolean supportDeclimalFloatingPoint) {
super(language, XlcScannerExtensionConfiguration.getInstance());
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);
}
}
}
/**

View file

@ -30,9 +30,10 @@ public class XlcLanguagePreferences {
private static final String XLC_PREFERENCES_NODE = "xlc.preferences";
public static void initializeDefaultPreferences() {
static void initializeDefaultPreferences() {
Preferences prefs = getDefaultPreferences();
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) {
@ -66,23 +67,24 @@ public class XlcLanguagePreferences {
*
* @param project If null then just the workspace and default preferences will be checked.
*/
public static String getPreference(String key, IProject project) {
Preferences[] prefs;
public static String get(String key, IProject project) {
return Platform.getPreferencesService().get(key, null, getPreferences(key, project));
}
private static Preferences[] getPreferences(String key, IProject project) {
if(project == null) {
prefs = new Preferences[] {
return new Preferences[] {
getWorkspacePreferences(),
getDefaultPreferences()
};
}
else {
prefs = new Preferences[] {
return new Preferences[] {
getProjectPreferences(project),
getWorkspacePreferences(),
getDefaultPreferences()
};
}
return Platform.getPreferencesService().get(key, null, prefs);
}

View file

@ -15,10 +15,8 @@ public final class XlcPreferenceKeys {
private XlcPreferenceKeys() {}
/**
* Type: boolean
* Default: false
*/
public static final String KEY_SUPPORT_VECTOR_TYPES = "vectorTypes";
public static final String KEY_SUPPORT_DECIMAL_FLOATING_POINT_TYPES = "floatingPointTypes";
}

View file

@ -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;
}

View file

@ -24,8 +24,8 @@ public interface XlcCParsersym {
TK_default = 53,
TK_do = 54,
TK_double = 55,
TK_else = 102,
TK_enum = 65,
TK_else = 105,
TK_enum = 68,
TK_extern = 33,
TK_float = 40,
TK_for = 56,
@ -41,10 +41,10 @@ public interface XlcCParsersym {
TK_signed = 44,
TK_sizeof = 20,
TK_static = 30,
TK_struct = 66,
TK_struct = 69,
TK_switch = 60,
TK_typedef = 36,
TK_union = 67,
TK_union = 70,
TK_unsigned = 45,
TK_void = 61,
TK_volatile = 28,
@ -59,12 +59,12 @@ public interface XlcCParsersym {
TK_identifier = 2,
TK_Completion = 11,
TK_EndOfCompletion = 6,
TK_Invalid = 103,
TK_Invalid = 106,
TK_LeftBracket = 37,
TK_LeftParen = 1,
TK_LeftBrace = 18,
TK_Dot = 72,
TK_Arrow = 87,
TK_Dot = 75,
TK_Arrow = 90,
TK_PlusPlus = 16,
TK_MinusMinus = 17,
TK_And = 15,
@ -73,51 +73,54 @@ public interface XlcCParsersym {
TK_Minus = 14,
TK_Tilde = 24,
TK_Bang = 25,
TK_Slash = 73,
TK_Percent = 74,
TK_RightShift = 69,
TK_LeftShift = 70,
TK_LT = 75,
TK_GT = 76,
TK_LE = 77,
TK_GE = 78,
TK_EQ = 81,
TK_NE = 82,
TK_Caret = 83,
TK_Or = 84,
TK_AndAnd = 85,
TK_OrOr = 88,
TK_Question = 89,
TK_Slash = 76,
TK_Percent = 77,
TK_RightShift = 72,
TK_LeftShift = 73,
TK_LT = 78,
TK_GT = 79,
TK_LE = 80,
TK_GE = 81,
TK_EQ = 84,
TK_NE = 85,
TK_Caret = 86,
TK_Or = 87,
TK_AndAnd = 88,
TK_OrOr = 91,
TK_Question = 92,
TK_Colon = 49,
TK_DotDotDot = 86,
TK_Assign = 71,
TK_StarAssign = 90,
TK_SlashAssign = 91,
TK_PercentAssign = 92,
TK_PlusAssign = 93,
TK_MinusAssign = 94,
TK_RightShiftAssign = 95,
TK_LeftShiftAssign = 96,
TK_AndAssign = 97,
TK_CaretAssign = 98,
TK_OrAssign = 99,
TK_DotDotDot = 89,
TK_Assign = 74,
TK_StarAssign = 93,
TK_SlashAssign = 94,
TK_PercentAssign = 95,
TK_PlusAssign = 96,
TK_MinusAssign = 97,
TK_RightShiftAssign = 98,
TK_LeftShiftAssign = 99,
TK_AndAssign = 100,
TK_CaretAssign = 101,
TK_OrAssign = 102,
TK_Comma = 46,
TK_RightBracket = 100,
TK_RightBracket = 103,
TK_RightParen = 47,
TK_RightBrace = 68,
TK_RightBrace = 71,
TK_SemiColon = 31,
TK_typeof = 12,
TK___alignof__ = 26,
TK___attribute__ = 8,
TK___declspec = 9,
TK_MAX = 79,
TK_MIN = 80,
TK_MAX = 82,
TK_MIN = 83,
TK_asm = 7,
TK_vector = 5,
TK_pixel = 3,
TK_bool = 4,
TK__Decimal32 = 65,
TK__Decimal64 = 66,
TK__Decimal128 = 67,
TK_ERROR_TOKEN = 38,
TK_EOF_TOKEN = 101;
TK_EOF_TOKEN = 104;
public final static String orderedTerminalSymbols[] = {
"",
@ -185,6 +188,9 @@ public interface XlcCParsersym {
"_Bool",
"_Complex",
"_Imaginary",
"_Decimal32",
"_Decimal64",
"_Decimal128",
"enum",
"struct",
"union",

View file

@ -17,137 +17,140 @@ public interface XlcCPPParsersym {
public final static int
TK__Complex = 24,
TK__Imaginary = 25,
TK_restrict = 32,
TK_restrict = 35,
TK_asm = 7,
TK_auto = 34,
TK_auto = 37,
TK_bool = 15,
TK_break = 85,
TK_case = 86,
TK_catch = 129,
TK_break = 88,
TK_case = 89,
TK_catch = 132,
TK_char = 16,
TK_class = 50,
TK_const = 30,
TK_const_cast = 52,
TK_continue = 87,
TK_default = 88,
TK_delete = 78,
TK_do = 89,
TK_class = 53,
TK_const = 33,
TK_const_cast = 55,
TK_continue = 90,
TK_default = 91,
TK_delete = 81,
TK_do = 92,
TK_double = 26,
TK_dynamic_cast = 53,
TK_else = 132,
TK_enum = 65,
TK_explicit = 35,
TK_export = 90,
TK_extern = 36,
TK_false = 54,
TK_dynamic_cast = 56,
TK_else = 135,
TK_enum = 68,
TK_explicit = 38,
TK_export = 93,
TK_extern = 39,
TK_false = 57,
TK_float = 17,
TK_for = 91,
TK_friend = 37,
TK_goto = 92,
TK_if = 93,
TK_inline = 38,
TK_for = 94,
TK_friend = 40,
TK_goto = 95,
TK_if = 96,
TK_inline = 41,
TK_int = 18,
TK_long = 19,
TK_mutable = 39,
TK_namespace = 68,
TK_new = 79,
TK_mutable = 42,
TK_namespace = 71,
TK_new = 82,
TK_operator = 12,
TK_private = 113,
TK_protected = 114,
TK_public = 115,
TK_register = 40,
TK_reinterpret_cast = 55,
TK_return = 94,
TK_private = 116,
TK_protected = 117,
TK_public = 118,
TK_register = 43,
TK_reinterpret_cast = 58,
TK_return = 97,
TK_short = 20,
TK_signed = 21,
TK_sizeof = 56,
TK_static = 41,
TK_static_cast = 57,
TK_struct = 66,
TK_switch = 95,
TK_template = 49,
TK_this = 58,
TK_throw = 73,
TK_try = 81,
TK_true = 59,
TK_typedef = 42,
TK_typeid = 60,
TK_sizeof = 59,
TK_static = 44,
TK_static_cast = 60,
TK_struct = 69,
TK_switch = 98,
TK_template = 52,
TK_this = 61,
TK_throw = 76,
TK_try = 84,
TK_true = 62,
TK_typedef = 45,
TK_typeid = 63,
TK_typename = 22,
TK_union = 67,
TK_union = 70,
TK_unsigned = 23,
TK_using = 71,
TK_virtual = 33,
TK_using = 74,
TK_virtual = 36,
TK_void = 27,
TK_volatile = 31,
TK_volatile = 34,
TK_wchar_t = 28,
TK_while = 84,
TK_integer = 61,
TK_floating = 62,
TK_charconst = 63,
TK_stringlit = 44,
TK_while = 87,
TK_integer = 64,
TK_floating = 65,
TK_charconst = 66,
TK_stringlit = 47,
TK_identifier = 1,
TK_Completion = 4,
TK_EndOfCompletion = 11,
TK_Invalid = 133,
TK_LeftBracket = 74,
TK_Invalid = 136,
TK_LeftBracket = 77,
TK_LeftParen = 5,
TK_Dot = 130,
TK_DotStar = 100,
TK_Arrow = 116,
TK_ArrowStar = 99,
TK_PlusPlus = 47,
TK_MinusMinus = 48,
TK_Dot = 133,
TK_DotStar = 103,
TK_Arrow = 119,
TK_ArrowStar = 102,
TK_PlusPlus = 50,
TK_MinusMinus = 51,
TK_And = 14,
TK_Star = 13,
TK_Plus = 45,
TK_Minus = 46,
TK_Plus = 48,
TK_Minus = 49,
TK_Tilde = 10,
TK_Bang = 51,
TK_Slash = 101,
TK_Percent = 102,
TK_RightShift = 96,
TK_LeftShift = 97,
TK_LT = 69,
TK_GT = 80,
TK_LE = 103,
TK_GE = 104,
TK_EQ = 105,
TK_NE = 106,
TK_Caret = 107,
TK_Or = 108,
TK_AndAnd = 109,
TK_OrOr = 110,
TK_Question = 117,
TK_Colon = 77,
TK_Bang = 54,
TK_Slash = 104,
TK_Percent = 105,
TK_RightShift = 99,
TK_LeftShift = 100,
TK_LT = 72,
TK_GT = 83,
TK_LE = 106,
TK_GE = 107,
TK_EQ = 108,
TK_NE = 109,
TK_Caret = 110,
TK_Or = 111,
TK_AndAnd = 112,
TK_OrOr = 113,
TK_Question = 120,
TK_Colon = 80,
TK_ColonColon = 6,
TK_DotDotDot = 98,
TK_Assign = 82,
TK_StarAssign = 118,
TK_SlashAssign = 119,
TK_PercentAssign = 120,
TK_PlusAssign = 121,
TK_MinusAssign = 122,
TK_RightShiftAssign = 123,
TK_LeftShiftAssign = 124,
TK_AndAssign = 125,
TK_CaretAssign = 126,
TK_OrAssign = 127,
TK_Comma = 76,
TK_RightBracket = 128,
TK_RightParen = 75,
TK_RightBrace = 83,
TK_SemiColon = 43,
TK_LeftBrace = 70,
TK_typeof = 29,
TK___alignof__ = 64,
TK_DotDotDot = 101,
TK_Assign = 85,
TK_StarAssign = 121,
TK_SlashAssign = 122,
TK_PercentAssign = 123,
TK_PlusAssign = 124,
TK_MinusAssign = 125,
TK_RightShiftAssign = 126,
TK_LeftShiftAssign = 127,
TK_AndAssign = 128,
TK_CaretAssign = 129,
TK_OrAssign = 130,
TK_Comma = 79,
TK_RightBracket = 131,
TK_RightParen = 78,
TK_RightBrace = 86,
TK_SemiColon = 46,
TK_LeftBrace = 73,
TK_typeof = 32,
TK___alignof__ = 67,
TK___attribute__ = 8,
TK___declspec = 9,
TK_MAX = 111,
TK_MIN = 112,
TK_MAX = 114,
TK_MIN = 115,
TK_vector = 3,
TK_pixel = 2,
TK_ERROR_TOKEN = 72,
TK_EOF_TOKEN = 131;
TK__Decimal32 = 29,
TK__Decimal64 = 30,
TK__Decimal128 = 31,
TK_ERROR_TOKEN = 75,
TK_EOF_TOKEN = 134;
public final static String orderedTerminalSymbols[] = {
"",
@ -179,6 +182,9 @@ public interface XlcCPPParsersym {
"double",
"void",
"wchar_t",
"_Decimal32",
"_Decimal64",
"_Decimal128",
"typeof",
"const",
"volatile",

View file

@ -26,7 +26,8 @@ public class PreferenceMessages extends NLS {
public static String
XlcLanguageOptionsPreferencePage_link,
XlcLanguageOptionsPreferencePage_group,
XlcLanguageOptionsPreferencePage_preference_vectors;
XlcLanguageOptionsPreferencePage_preference_vectors,
XlcLanguageOptionsPreferencePage_preference_decimals;
}

View file

@ -61,10 +61,29 @@ public class XlcLanguageOptionsPreferencePage extends PreferencePage implements
buttonVectors = ControlFactory.createCheckBox(group, PreferenceMessages.XlcLanguageOptionsPreferencePage_preference_vectors);
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;
}
@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) {
String preference = null;
@ -83,21 +102,6 @@ public class XlcLanguageOptionsPreferencePage extends PreferencePage implements
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() {