mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-24 01:15:29 +02:00
fix for bug 226121 for LR parsers, support for asm labels
This commit is contained in:
parent
abbbe44a24
commit
27e180373f
11 changed files with 3595 additions and 3458 deletions
|
@ -25,6 +25,13 @@ $Import
|
|||
$End
|
||||
|
||||
|
||||
-- Tokens used by GCC but not part of the C99 spec
|
||||
$Terminals
|
||||
|
||||
asm
|
||||
|
||||
$End
|
||||
|
||||
|
||||
-- Hook the extensions into the main grammar.
|
||||
$Rules
|
||||
|
|
|
@ -15,8 +15,15 @@
|
|||
|
||||
|
||||
$Terminals
|
||||
-- additional GCC only tokens as defined in IGCCToken
|
||||
|
||||
typeof
|
||||
__alignof__
|
||||
MAX
|
||||
MIN
|
||||
__attribute__
|
||||
__declspec
|
||||
|
||||
$End
|
||||
|
||||
|
||||
|
@ -29,6 +36,7 @@ $Rules
|
|||
attribute_or_decl_specifier
|
||||
::= attribute_specifier
|
||||
| decl_specifier
|
||||
| asm_label
|
||||
|
||||
attribute_or_decl_specifier_seq
|
||||
::= attribute_or_decl_specifier
|
||||
|
@ -80,4 +88,17 @@ extended_decl_modifier
|
|||
| 'identifier' '(' ')'
|
||||
| 'identifier' '(' 'identifier' ')'
|
||||
|
||||
$End
|
||||
|
||||
------------------------------------------------------------------------------------
|
||||
-- Other stuff
|
||||
------------------------------------------------------------------------------------
|
||||
|
||||
asm_label
|
||||
::= 'asm' '(' 'stringlit' ')'
|
||||
|
||||
asm_label_opt
|
||||
::= asm_label
|
||||
| $empty
|
||||
|
||||
$End
|
||||
|
||||
|
|
|
@ -1136,7 +1136,6 @@ public class CPPBuildASTParserAction extends BuildASTParserAction {
|
|||
// * declaration_specifiers ::= <openscope> type_name_declaration_specifiers
|
||||
// */
|
||||
public void consumeDeclarationSpecifiersTypeName() {
|
||||
System.out.println("consumeDeclarationSpecifiersTypeName");
|
||||
List<Object> topScope = astStack.closeScope();
|
||||
// There's a name somewhere on the stack, find it
|
||||
IASTName typeName = findFirstAndRemove(topScope, IASTName.class);
|
||||
|
|
|
@ -138,7 +138,16 @@ public final class DOMToGCCTokenMap implements IDOMTokenMap {
|
|||
case tEOC : return TK_EndOfCompletion;
|
||||
case tEND_OF_INPUT : return TK_EOF_TOKEN;
|
||||
|
||||
|
||||
case IGCCToken.t_typeof : return TK_typeof;
|
||||
case IGCCToken.t___alignof__ : return TK___alignof__;
|
||||
case IGCCToken.tMAX : return TK_MAX;
|
||||
case IGCCToken.tMIN : return TK_MIN;
|
||||
case IGCCToken.t__attribute__ : return TK___attribute__;
|
||||
case IGCCToken.t__declspec : return TK___declspec;
|
||||
|
||||
case t_asm: return TK_asm;
|
||||
|
||||
|
||||
default:
|
||||
assert false : "token not recognized by the GCC parser: " + token.getType(); //$NON-NLS-1$
|
||||
|
|
|
@ -169,8 +169,13 @@ public class DOMToGPPTokenMap implements IDOMTokenMap {
|
|||
case tEOC : return TK_EndOfCompletion;
|
||||
case tEND_OF_INPUT : return TK_EOF_TOKEN;
|
||||
|
||||
case IGCCToken.t_typeof : return TK_typeof;
|
||||
case IGCCToken.t___alignof__ : return TK___alignof__;
|
||||
case IGCCToken.tMAX : return TK_MAX;
|
||||
case IGCCToken.tMIN : return TK_MIN;
|
||||
case IGCCToken.t__attribute__ : return TK___attribute__;
|
||||
|
||||
case IGCCToken.t__declspec : return TK___declspec;
|
||||
|
||||
default:
|
||||
assert false : "token not recognized by the GPP parser: " + token.getType(); //$NON-NLS-1$
|
||||
return TK_Invalid;
|
||||
|
|
|
@ -1257,9 +1257,9 @@ public GCCParser(String[] mapFrom) { // constructor
|
|||
}
|
||||
|
||||
//
|
||||
// Rule 330: attribute_parameter ::= assignment_expression
|
||||
// Rule 331: attribute_parameter ::= assignment_expression
|
||||
//
|
||||
case 330: { action. consumeIgnore(); break;
|
||||
case 331: { action. consumeIgnore(); break;
|
||||
}
|
||||
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -15,101 +15,106 @@ package org.eclipse.cdt.internal.core.dom.lrparser.gcc;
|
|||
|
||||
public interface GCCParsersym {
|
||||
public final static int
|
||||
TK_auto = 26,
|
||||
TK_break = 33,
|
||||
TK_case = 34,
|
||||
TK_char = 45,
|
||||
TK_const = 21,
|
||||
TK_continue = 35,
|
||||
TK_default = 36,
|
||||
TK_do = 37,
|
||||
TK_double = 46,
|
||||
TK_else = 81,
|
||||
TK_enum = 57,
|
||||
TK_extern = 27,
|
||||
TK_float = 47,
|
||||
TK_for = 38,
|
||||
TK_goto = 39,
|
||||
TK_if = 40,
|
||||
TK_inline = 28,
|
||||
TK_int = 48,
|
||||
TK_long = 49,
|
||||
TK_register = 29,
|
||||
TK_restrict = 22,
|
||||
TK_return = 41,
|
||||
TK_short = 50,
|
||||
TK_signed = 51,
|
||||
TK_sizeof = 14,
|
||||
TK_static = 25,
|
||||
TK_struct = 58,
|
||||
TK_switch = 42,
|
||||
TK_typedef = 30,
|
||||
TK_union = 59,
|
||||
TK_unsigned = 52,
|
||||
TK_void = 53,
|
||||
TK_volatile = 23,
|
||||
TK_while = 32,
|
||||
TK__Bool = 54,
|
||||
TK__Complex = 55,
|
||||
TK__Imaginary = 56,
|
||||
TK_integer = 15,
|
||||
TK_floating = 16,
|
||||
TK_charconst = 17,
|
||||
TK_stringlit = 18,
|
||||
TK_auto = 27,
|
||||
TK_break = 34,
|
||||
TK_case = 35,
|
||||
TK_char = 46,
|
||||
TK_const = 22,
|
||||
TK_continue = 36,
|
||||
TK_default = 37,
|
||||
TK_do = 38,
|
||||
TK_double = 47,
|
||||
TK_else = 82,
|
||||
TK_enum = 58,
|
||||
TK_extern = 28,
|
||||
TK_float = 48,
|
||||
TK_for = 39,
|
||||
TK_goto = 40,
|
||||
TK_if = 41,
|
||||
TK_inline = 29,
|
||||
TK_int = 49,
|
||||
TK_long = 50,
|
||||
TK_register = 30,
|
||||
TK_restrict = 23,
|
||||
TK_return = 42,
|
||||
TK_short = 51,
|
||||
TK_signed = 52,
|
||||
TK_sizeof = 16,
|
||||
TK_static = 26,
|
||||
TK_struct = 59,
|
||||
TK_switch = 43,
|
||||
TK_typedef = 31,
|
||||
TK_union = 60,
|
||||
TK_unsigned = 53,
|
||||
TK_void = 54,
|
||||
TK_volatile = 24,
|
||||
TK_while = 33,
|
||||
TK__Bool = 55,
|
||||
TK__Complex = 56,
|
||||
TK__Imaginary = 57,
|
||||
TK_integer = 17,
|
||||
TK_floating = 18,
|
||||
TK_charconst = 19,
|
||||
TK_stringlit = 13,
|
||||
TK_identifier = 1,
|
||||
TK_Completion = 6,
|
||||
TK_Completion = 7,
|
||||
TK_EndOfCompletion = 3,
|
||||
TK_Invalid = 95,
|
||||
TK_LeftBracket = 43,
|
||||
TK_Invalid = 96,
|
||||
TK_LeftBracket = 44,
|
||||
TK_LeftParen = 2,
|
||||
TK_LeftBrace = 8,
|
||||
TK_Dot = 68,
|
||||
TK_Arrow = 82,
|
||||
TK_PlusPlus = 12,
|
||||
TK_MinusMinus = 13,
|
||||
TK_And = 11,
|
||||
TK_Star = 7,
|
||||
TK_Plus = 9,
|
||||
TK_Minus = 10,
|
||||
TK_Tilde = 19,
|
||||
TK_Bang = 20,
|
||||
TK_Slash = 69,
|
||||
TK_Percent = 70,
|
||||
TK_RightShift = 64,
|
||||
TK_LeftShift = 65,
|
||||
TK_LT = 71,
|
||||
TK_GT = 72,
|
||||
TK_LE = 73,
|
||||
TK_GE = 74,
|
||||
TK_EQ = 76,
|
||||
TK_NE = 77,
|
||||
TK_Caret = 78,
|
||||
TK_Or = 79,
|
||||
TK_AndAnd = 80,
|
||||
TK_OrOr = 83,
|
||||
TK_Question = 84,
|
||||
TK_Colon = 62,
|
||||
TK_DotDotDot = 66,
|
||||
TK_Assign = 63,
|
||||
TK_StarAssign = 85,
|
||||
TK_SlashAssign = 86,
|
||||
TK_PercentAssign = 87,
|
||||
TK_PlusAssign = 88,
|
||||
TK_MinusAssign = 89,
|
||||
TK_RightShiftAssign = 90,
|
||||
TK_LeftShiftAssign = 91,
|
||||
TK_AndAssign = 92,
|
||||
TK_CaretAssign = 93,
|
||||
TK_OrAssign = 94,
|
||||
TK_Comma = 60,
|
||||
TK_RightBracket = 67,
|
||||
TK_RightParen = 44,
|
||||
TK_RightBrace = 61,
|
||||
TK_SemiColon = 24,
|
||||
TK_LeftBrace = 9,
|
||||
TK_Dot = 69,
|
||||
TK_Arrow = 83,
|
||||
TK_PlusPlus = 14,
|
||||
TK_MinusMinus = 15,
|
||||
TK_And = 12,
|
||||
TK_Star = 8,
|
||||
TK_Plus = 10,
|
||||
TK_Minus = 11,
|
||||
TK_Tilde = 20,
|
||||
TK_Bang = 21,
|
||||
TK_Slash = 70,
|
||||
TK_Percent = 71,
|
||||
TK_RightShift = 65,
|
||||
TK_LeftShift = 66,
|
||||
TK_LT = 72,
|
||||
TK_GT = 73,
|
||||
TK_LE = 74,
|
||||
TK_GE = 75,
|
||||
TK_EQ = 77,
|
||||
TK_NE = 78,
|
||||
TK_Caret = 79,
|
||||
TK_Or = 80,
|
||||
TK_AndAnd = 81,
|
||||
TK_OrOr = 84,
|
||||
TK_Question = 85,
|
||||
TK_Colon = 63,
|
||||
TK_DotDotDot = 67,
|
||||
TK_Assign = 64,
|
||||
TK_StarAssign = 86,
|
||||
TK_SlashAssign = 87,
|
||||
TK_PercentAssign = 88,
|
||||
TK_PlusAssign = 89,
|
||||
TK_MinusAssign = 90,
|
||||
TK_RightShiftAssign = 91,
|
||||
TK_LeftShiftAssign = 92,
|
||||
TK_AndAssign = 93,
|
||||
TK_CaretAssign = 94,
|
||||
TK_OrAssign = 95,
|
||||
TK_Comma = 61,
|
||||
TK_RightBracket = 68,
|
||||
TK_RightParen = 45,
|
||||
TK_RightBrace = 62,
|
||||
TK_SemiColon = 25,
|
||||
TK_typeof = 97,
|
||||
TK___alignof__ = 98,
|
||||
TK_MAX = 99,
|
||||
TK_MIN = 100,
|
||||
TK___attribute__ = 4,
|
||||
TK___declspec = 5,
|
||||
TK_ERROR_TOKEN = 31,
|
||||
TK_EOF_TOKEN = 75;
|
||||
TK_asm = 6,
|
||||
TK_ERROR_TOKEN = 32,
|
||||
TK_EOF_TOKEN = 76;
|
||||
|
||||
public final static String orderedTerminalSymbols[] = {
|
||||
"",
|
||||
|
@ -118,19 +123,20 @@ public interface GCCParsersym {
|
|||
"EndOfCompletion",
|
||||
"__attribute__",
|
||||
"__declspec",
|
||||
"asm",
|
||||
"Completion",
|
||||
"Star",
|
||||
"LeftBrace",
|
||||
"Plus",
|
||||
"Minus",
|
||||
"And",
|
||||
"stringlit",
|
||||
"PlusPlus",
|
||||
"MinusMinus",
|
||||
"sizeof",
|
||||
"integer",
|
||||
"floating",
|
||||
"charconst",
|
||||
"stringlit",
|
||||
"Tilde",
|
||||
"Bang",
|
||||
"const",
|
||||
|
@ -207,7 +213,11 @@ public interface GCCParsersym {
|
|||
"AndAssign",
|
||||
"CaretAssign",
|
||||
"OrAssign",
|
||||
"Invalid"
|
||||
"Invalid",
|
||||
"typeof",
|
||||
"__alignof__",
|
||||
"MAX",
|
||||
"MIN"
|
||||
};
|
||||
|
||||
public final static boolean isValidForParser = true;
|
||||
|
|
|
@ -1972,9 +1972,9 @@ public GPPParser(String[] mapFrom) { // constructor
|
|||
}
|
||||
|
||||
//
|
||||
// Rule 551: attribute_parameter ::= assignment_expression
|
||||
// Rule 552: attribute_parameter ::= assignment_expression
|
||||
//
|
||||
case 551: { action. consumeIgnore(); break;
|
||||
case 552: { action. consumeIgnore(); break;
|
||||
}
|
||||
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -15,73 +15,73 @@ package org.eclipse.cdt.internal.core.dom.lrparser.gpp;
|
|||
|
||||
public interface GPPParsersym {
|
||||
public final static int
|
||||
TK_asm = 66,
|
||||
TK_auto = 28,
|
||||
TK_bool = 13,
|
||||
TK_asm = 5,
|
||||
TK_auto = 29,
|
||||
TK_bool = 14,
|
||||
TK_break = 79,
|
||||
TK_case = 80,
|
||||
TK_catch = 121,
|
||||
TK_char = 14,
|
||||
TK_class = 42,
|
||||
TK_const = 24,
|
||||
TK_const_cast = 45,
|
||||
TK_char = 15,
|
||||
TK_class = 43,
|
||||
TK_const = 25,
|
||||
TK_const_cast = 46,
|
||||
TK_continue = 81,
|
||||
TK_default = 82,
|
||||
TK_delete = 68,
|
||||
TK_do = 83,
|
||||
TK_double = 15,
|
||||
TK_dynamic_cast = 46,
|
||||
TK_double = 16,
|
||||
TK_dynamic_cast = 47,
|
||||
TK_else = 124,
|
||||
TK_enum = 58,
|
||||
TK_explicit = 29,
|
||||
TK_enum = 59,
|
||||
TK_explicit = 30,
|
||||
TK_export = 89,
|
||||
TK_extern = 30,
|
||||
TK_false = 47,
|
||||
TK_float = 16,
|
||||
TK_extern = 31,
|
||||
TK_false = 48,
|
||||
TK_float = 17,
|
||||
TK_for = 84,
|
||||
TK_friend = 31,
|
||||
TK_friend = 32,
|
||||
TK_goto = 85,
|
||||
TK_if = 86,
|
||||
TK_inline = 32,
|
||||
TK_int = 17,
|
||||
TK_long = 18,
|
||||
TK_mutable = 33,
|
||||
TK_namespace = 62,
|
||||
TK_inline = 33,
|
||||
TK_int = 18,
|
||||
TK_long = 19,
|
||||
TK_mutable = 34,
|
||||
TK_namespace = 63,
|
||||
TK_new = 69,
|
||||
TK_operator = 8,
|
||||
TK_operator = 9,
|
||||
TK_private = 105,
|
||||
TK_protected = 106,
|
||||
TK_public = 107,
|
||||
TK_register = 34,
|
||||
TK_reinterpret_cast = 48,
|
||||
TK_register = 35,
|
||||
TK_reinterpret_cast = 49,
|
||||
TK_return = 87,
|
||||
TK_short = 19,
|
||||
TK_signed = 20,
|
||||
TK_sizeof = 49,
|
||||
TK_static = 35,
|
||||
TK_static_cast = 50,
|
||||
TK_struct = 59,
|
||||
TK_short = 20,
|
||||
TK_signed = 21,
|
||||
TK_sizeof = 50,
|
||||
TK_static = 36,
|
||||
TK_static_cast = 51,
|
||||
TK_struct = 60,
|
||||
TK_switch = 88,
|
||||
TK_template = 43,
|
||||
TK_this = 51,
|
||||
TK_throw = 63,
|
||||
TK_template = 44,
|
||||
TK_this = 52,
|
||||
TK_throw = 64,
|
||||
TK_try = 77,
|
||||
TK_true = 52,
|
||||
TK_typedef = 36,
|
||||
TK_typeid = 53,
|
||||
TK_typename = 12,
|
||||
TK_union = 60,
|
||||
TK_unsigned = 21,
|
||||
TK_using = 64,
|
||||
TK_virtual = 25,
|
||||
TK_void = 22,
|
||||
TK_volatile = 27,
|
||||
TK_wchar_t = 23,
|
||||
TK_true = 53,
|
||||
TK_typedef = 37,
|
||||
TK_typeid = 54,
|
||||
TK_typename = 13,
|
||||
TK_union = 61,
|
||||
TK_unsigned = 22,
|
||||
TK_using = 65,
|
||||
TK_virtual = 26,
|
||||
TK_void = 23,
|
||||
TK_volatile = 28,
|
||||
TK_wchar_t = 24,
|
||||
TK_while = 78,
|
||||
TK_integer = 54,
|
||||
TK_floating = 55,
|
||||
TK_charconst = 56,
|
||||
TK_stringlit = 41,
|
||||
TK_integer = 55,
|
||||
TK_floating = 56,
|
||||
TK_charconst = 57,
|
||||
TK_stringlit = 40,
|
||||
TK_identifier = 1,
|
||||
TK_Completion = 2,
|
||||
TK_EndOfCompletion = 10,
|
||||
|
@ -91,21 +91,21 @@ public interface GPPParsersym {
|
|||
TK_Dot = 122,
|
||||
TK_DotStar = 94,
|
||||
TK_Arrow = 108,
|
||||
TK_ArrowStar = 92,
|
||||
TK_PlusPlus = 39,
|
||||
TK_MinusMinus = 40,
|
||||
TK_And = 11,
|
||||
TK_Star = 9,
|
||||
TK_Plus = 37,
|
||||
TK_Minus = 38,
|
||||
TK_Tilde = 7,
|
||||
TK_Bang = 44,
|
||||
TK_ArrowStar = 93,
|
||||
TK_PlusPlus = 41,
|
||||
TK_MinusMinus = 42,
|
||||
TK_And = 12,
|
||||
TK_Star = 11,
|
||||
TK_Plus = 38,
|
||||
TK_Minus = 39,
|
||||
TK_Tilde = 8,
|
||||
TK_Bang = 45,
|
||||
TK_Slash = 95,
|
||||
TK_Percent = 96,
|
||||
TK_RightShift = 90,
|
||||
TK_LeftShift = 91,
|
||||
TK_LT = 61,
|
||||
TK_GT = 73,
|
||||
TK_LT = 62,
|
||||
TK_GT = 72,
|
||||
TK_LE = 97,
|
||||
TK_GE = 98,
|
||||
TK_EQ = 99,
|
||||
|
@ -117,7 +117,7 @@ public interface GPPParsersym {
|
|||
TK_Question = 109,
|
||||
TK_Colon = 74,
|
||||
TK_ColonColon = 4,
|
||||
TK_DotDotDot = 93,
|
||||
TK_DotDotDot = 92,
|
||||
TK_Assign = 75,
|
||||
TK_StarAssign = 110,
|
||||
TK_SlashAssign = 111,
|
||||
|
@ -133,12 +133,16 @@ public interface GPPParsersym {
|
|||
TK_RightBracket = 120,
|
||||
TK_RightParen = 71,
|
||||
TK_RightBrace = 76,
|
||||
TK_SemiColon = 26,
|
||||
TK_LeftBrace = 72,
|
||||
TK___attribute__ = 5,
|
||||
TK___declspec = 6,
|
||||
TK_ERROR_TOKEN = 65,
|
||||
TK_0 = 57,
|
||||
TK_SemiColon = 27,
|
||||
TK_LeftBrace = 73,
|
||||
TK_typeof = 126,
|
||||
TK___alignof__ = 127,
|
||||
TK_MAX = 128,
|
||||
TK_MIN = 129,
|
||||
TK___attribute__ = 6,
|
||||
TK___declspec = 7,
|
||||
TK_ERROR_TOKEN = 66,
|
||||
TK_0 = 58,
|
||||
TK_EOF_TOKEN = 123;
|
||||
|
||||
public final static String orderedTerminalSymbols[] = {
|
||||
|
@ -147,12 +151,13 @@ public interface GPPParsersym {
|
|||
"Completion",
|
||||
"LeftParen",
|
||||
"ColonColon",
|
||||
"asm",
|
||||
"__attribute__",
|
||||
"__declspec",
|
||||
"Tilde",
|
||||
"operator",
|
||||
"Star",
|
||||
"EndOfCompletion",
|
||||
"Star",
|
||||
"And",
|
||||
"typename",
|
||||
"bool",
|
||||
|
@ -181,9 +186,9 @@ public interface GPPParsersym {
|
|||
"typedef",
|
||||
"Plus",
|
||||
"Minus",
|
||||
"stringlit",
|
||||
"PlusPlus",
|
||||
"MinusMinus",
|
||||
"stringlit",
|
||||
"class",
|
||||
"template",
|
||||
"Bang",
|
||||
|
@ -208,14 +213,13 @@ public interface GPPParsersym {
|
|||
"throw",
|
||||
"using",
|
||||
"ERROR_TOKEN",
|
||||
"asm",
|
||||
"LeftBracket",
|
||||
"delete",
|
||||
"new",
|
||||
"Comma",
|
||||
"RightParen",
|
||||
"LeftBrace",
|
||||
"GT",
|
||||
"LeftBrace",
|
||||
"Colon",
|
||||
"Assign",
|
||||
"RightBrace",
|
||||
|
@ -234,8 +238,8 @@ public interface GPPParsersym {
|
|||
"export",
|
||||
"RightShift",
|
||||
"LeftShift",
|
||||
"ArrowStar",
|
||||
"DotDotDot",
|
||||
"ArrowStar",
|
||||
"DotStar",
|
||||
"Slash",
|
||||
"Percent",
|
||||
|
@ -267,7 +271,11 @@ public interface GPPParsersym {
|
|||
"Dot",
|
||||
"EOF_TOKEN",
|
||||
"else",
|
||||
"Invalid"
|
||||
"Invalid",
|
||||
"typeof",
|
||||
"__alignof__",
|
||||
"MAX",
|
||||
"MIN"
|
||||
};
|
||||
|
||||
public final static boolean isValidForParser = true;
|
||||
|
|
Loading…
Add table
Reference in a new issue