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

bug 39698 min and max operators for LR parser

This commit is contained in:
Mike Kucera 2009-02-02 19:49:53 +00:00
parent 62e51214ac
commit c97571595e
13 changed files with 6311 additions and 6182 deletions

View file

@ -19,10 +19,13 @@ $Terminals
typeof
__alignof__
MAX
MIN
__attribute__
__declspec
MAX
MIN
MAX ::= '>?'
MIN ::= '<?'
$End
@ -147,6 +150,12 @@ unary_expression
/. $Build consumeExpressionTypeId(IASTTypeIdExpression.op_typeof); $EndBuild ./
relational_expression
::= relational_expression '>?' shift_expression
/. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_max); $EndBuild ./
| relational_expression '<?' shift_expression
/. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_min); $EndBuild ./
typeof_type_specifier

View file

@ -1299,29 +1299,41 @@ private GCCBuildASTParserAction gnuAction;
//
case 352: { action. consumeExpressionTypeId(IASTTypeIdExpression.op_typeof); break;
}
//
// Rule 353: relational_expression ::= relational_expression >? shift_expression
//
case 353: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_max); break;
}
//
// Rule 354: relational_expression ::= relational_expression <? shift_expression
//
case 354: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_min); break;
}
//
// Rule 357: declaration_specifiers ::= <openscope-ast> typeof_declaration_specifiers
// Rule 359: declaration_specifiers ::= <openscope-ast> typeof_declaration_specifiers
//
case 357: { gnuAction.consumeDeclarationSpecifiersTypeof(); break;
case 359: { gnuAction.consumeDeclarationSpecifiersTypeof(); break;
}
//
// Rule 373: field_name_designator ::= identifier_token :
// Rule 375: field_name_designator ::= identifier_token :
//
case 373: { gnuAction.consumeDesignatorField(); break;
case 375: { gnuAction.consumeDesignatorField(); break;
}
//
// Rule 374: array_range_designator ::= [ constant_expression ... constant_expression ]
// Rule 376: array_range_designator ::= [ constant_expression ... constant_expression ]
//
case 374: { gnuAction.consumeDesignatorArray(); break;
case 376: { gnuAction.consumeDesignatorArray(); break;
}
//
// Rule 375: designated_initializer ::= <openscope-ast> field_name_designator initializer
// Rule 377: designated_initializer ::= <openscope-ast> field_name_designator initializer
//
case 375: { action. consumeInitializerDesignated(); break;
case 377: { action. consumeInitializerDesignated(); break;
}

View file

@ -24,7 +24,7 @@ public interface GCCParsersym {
TK_default = 42,
TK_do = 43,
TK_double = 50,
TK_else = 97,
TK_else = 99,
TK_enum = 61,
TK_extern = 30,
TK_float = 51,
@ -59,12 +59,12 @@ public interface GCCParsersym {
TK_identifier = 2,
TK_Completion = 5,
TK_EndOfCompletion = 3,
TK_Invalid = 98,
TK_Invalid = 100,
TK_LeftBracket = 35,
TK_LeftParen = 1,
TK_LeftBrace = 12,
TK_Dot = 70,
TK_Arrow = 83,
TK_Arrow = 85,
TK_PlusPlus = 15,
TK_MinusMinus = 16,
TK_And = 13,
@ -75,32 +75,32 @@ public interface GCCParsersym {
TK_Bang = 22,
TK_Slash = 71,
TK_Percent = 72,
TK_RightShift = 67,
TK_LeftShift = 68,
TK_RightShift = 66,
TK_LeftShift = 67,
TK_LT = 73,
TK_GT = 74,
TK_LE = 75,
TK_GE = 76,
TK_EQ = 78,
TK_NE = 79,
TK_Caret = 80,
TK_Or = 81,
TK_AndAnd = 82,
TK_OrOr = 84,
TK_Question = 85,
TK_EQ = 80,
TK_NE = 81,
TK_Caret = 82,
TK_Or = 83,
TK_AndAnd = 84,
TK_OrOr = 86,
TK_Question = 87,
TK_Colon = 65,
TK_DotDotDot = 69,
TK_Assign = 66,
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_Assign = 68,
TK_StarAssign = 88,
TK_SlashAssign = 89,
TK_PercentAssign = 90,
TK_PlusAssign = 91,
TK_MinusAssign = 92,
TK_RightShiftAssign = 93,
TK_LeftShiftAssign = 94,
TK_AndAssign = 95,
TK_CaretAssign = 96,
TK_OrAssign = 97,
TK_Comma = 38,
TK_RightBracket = 77,
TK_RightParen = 36,
@ -108,13 +108,13 @@ public interface GCCParsersym {
TK_SemiColon = 27,
TK_typeof = 9,
TK___alignof__ = 23,
TK_MAX = 99,
TK_MIN = 100,
TK___attribute__ = 6,
TK___declspec = 7,
TK_MAX = 78,
TK_MIN = 79,
TK_asm = 4,
TK_ERROR_TOKEN = 34,
TK_EOF_TOKEN = 96;
TK_EOF_TOKEN = 98;
public final static String orderedTerminalSymbols[] = {
"",
@ -183,9 +183,9 @@ public interface GCCParsersym {
"union",
"RightBrace",
"Colon",
"Assign",
"RightShift",
"LeftShift",
"Assign",
"DotDotDot",
"Dot",
"Slash",
@ -195,6 +195,8 @@ public interface GCCParsersym {
"LE",
"GE",
"RightBracket",
"MAX",
"MIN",
"EQ",
"NE",
"Caret",
@ -215,9 +217,7 @@ public interface GCCParsersym {
"OrAssign",
"EOF_TOKEN",
"else",
"Invalid",
"MAX",
"MIN"
"Invalid"
};
public final static boolean isValidForParser = true;

View file

@ -1281,35 +1281,47 @@ private GCCBuildASTParserAction gnuAction;
//
case 349: { action. consumeExpressionUnaryOperator(IASTUnaryExpression.op_typeof); break;
}
//
// Rule 354: declaration_specifiers ::= <openscope-ast> typeof_declaration_specifiers
//
case 354: { gnuAction.consumeDeclarationSpecifiersTypeof(); break;
}
//
// Rule 370: field_name_designator ::= identifier_token :
//
case 370: { gnuAction.consumeDesignatorField(); break;
}
//
// Rule 371: array_range_designator ::= [ constant_expression ... constant_expression ]
//
case 371: { gnuAction.consumeDesignatorArray(); break;
}
//
// Rule 372: designated_initializer ::= <openscope-ast> field_name_designator initializer
// Rule 350: relational_expression ::= relational_expression >? shift_expression
//
case 372: { action. consumeInitializerDesignated(); break;
case 350: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_max); break;
}
//
// Rule 374: no_sizeof_type_name_start ::= ERROR_TOKEN
// Rule 351: relational_expression ::= relational_expression <? shift_expression
//
case 374: { action. consumeExpressionProblem(); break;
case 351: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_min); break;
}
//
// Rule 356: declaration_specifiers ::= <openscope-ast> typeof_declaration_specifiers
//
case 356: { gnuAction.consumeDeclarationSpecifiersTypeof(); break;
}
//
// Rule 372: field_name_designator ::= identifier_token :
//
case 372: { gnuAction.consumeDesignatorField(); break;
}
//
// Rule 373: array_range_designator ::= [ constant_expression ... constant_expression ]
//
case 373: { gnuAction.consumeDesignatorArray(); break;
}
//
// Rule 374: designated_initializer ::= <openscope-ast> field_name_designator initializer
//
case 374: { action. consumeInitializerDesignated(); break;
}
//
// Rule 376: no_sizeof_type_name_start ::= ERROR_TOKEN
//
case 376: { action. consumeExpressionProblem(); break;
}

View file

@ -16,39 +16,39 @@ package org.eclipse.cdt.internal.core.dom.lrparser.gcc;
public interface GCCSizeofExpressionParsersym {
public final static int
TK_auto = 30,
TK_break = 86,
TK_case = 87,
TK_break = 88,
TK_case = 89,
TK_char = 39,
TK_const = 9,
TK_continue = 88,
TK_default = 89,
TK_do = 90,
TK_continue = 90,
TK_default = 91,
TK_do = 92,
TK_double = 40,
TK_else = 91,
TK_else = 93,
TK_enum = 52,
TK_extern = 31,
TK_float = 41,
TK_for = 92,
TK_goto = 93,
TK_if = 94,
TK_for = 94,
TK_goto = 95,
TK_if = 96,
TK_inline = 32,
TK_int = 42,
TK_long = 43,
TK_register = 33,
TK_restrict = 12,
TK_return = 95,
TK_return = 97,
TK_short = 44,
TK_signed = 45,
TK_sizeof = 20,
TK_static = 21,
TK_struct = 53,
TK_switch = 96,
TK_switch = 98,
TK_typedef = 34,
TK_union = 54,
TK_unsigned = 46,
TK_void = 47,
TK_volatile = 13,
TK_while = 97,
TK_while = 99,
TK__Bool = 48,
TK__Complex = 49,
TK__Imaginary = 50,
@ -59,12 +59,12 @@ public interface GCCSizeofExpressionParsersym {
TK_identifier = 1,
TK_Completion = 7,
TK_EndOfCompletion = 6,
TK_Invalid = 98,
TK_Invalid = 100,
TK_LeftBracket = 18,
TK_LeftParen = 2,
TK_LeftBrace = 29,
TK_Dot = 55,
TK_Arrow = 71,
TK_Arrow = 73,
TK_PlusPlus = 16,
TK_MinusMinus = 17,
TK_And = 14,
@ -75,46 +75,46 @@ public interface GCCSizeofExpressionParsersym {
TK_Bang = 26,
TK_Slash = 56,
TK_Percent = 57,
TK_RightShift = 37,
TK_LeftShift = 38,
TK_RightShift = 36,
TK_LeftShift = 37,
TK_LT = 58,
TK_GT = 59,
TK_LE = 60,
TK_GE = 61,
TK_EQ = 65,
TK_NE = 66,
TK_Caret = 67,
TK_Or = 68,
TK_AndAnd = 69,
TK_OrOr = 72,
TK_Question = 73,
TK_EQ = 67,
TK_NE = 68,
TK_Caret = 69,
TK_Or = 70,
TK_AndAnd = 71,
TK_OrOr = 74,
TK_Question = 75,
TK_Colon = 62,
TK_DotDotDot = 51,
TK_Assign = 63,
TK_StarAssign = 74,
TK_SlashAssign = 75,
TK_PercentAssign = 76,
TK_PlusAssign = 77,
TK_MinusAssign = 78,
TK_RightShiftAssign = 79,
TK_LeftShiftAssign = 80,
TK_AndAssign = 81,
TK_CaretAssign = 82,
TK_OrAssign = 83,
TK_StarAssign = 76,
TK_SlashAssign = 77,
TK_PercentAssign = 78,
TK_PlusAssign = 79,
TK_MinusAssign = 80,
TK_RightShiftAssign = 81,
TK_LeftShiftAssign = 82,
TK_AndAssign = 83,
TK_CaretAssign = 84,
TK_OrAssign = 85,
TK_Comma = 35,
TK_RightBracket = 64,
TK_RightParen = 27,
TK_RightBrace = 36,
TK_SemiColon = 84,
TK_RightBrace = 38,
TK_SemiColon = 86,
TK_typeof = 15,
TK___alignof__ = 28,
TK_MAX = 99,
TK_MIN = 100,
TK___attribute__ = 3,
TK___declspec = 4,
TK_MAX = 65,
TK_MIN = 66,
TK_asm = 5,
TK_ERROR_TOKEN = 70,
TK_EOF_TOKEN = 85;
TK_ERROR_TOKEN = 72,
TK_EOF_TOKEN = 87;
public final static String orderedTerminalSymbols[] = {
"",
@ -153,9 +153,9 @@ public interface GCCSizeofExpressionParsersym {
"register",
"typedef",
"Comma",
"RightBrace",
"RightShift",
"LeftShift",
"RightBrace",
"char",
"double",
"float",
@ -182,6 +182,8 @@ public interface GCCSizeofExpressionParsersym {
"Colon",
"Assign",
"RightBracket",
"MAX",
"MIN",
"EQ",
"NE",
"Caret",
@ -215,9 +217,7 @@ public interface GCCSizeofExpressionParsersym {
"return",
"switch",
"while",
"Invalid",
"MAX",
"MIN"
"Invalid"
};
public final static boolean isValidForParser = true;

View file

@ -2002,35 +2002,47 @@ private GPPBuildASTParserAction gnuAction;
//
case 573: { action. consumeExpressionTypeId(IASTTypeIdExpression.op_typeof); break;
}
//
// Rule 574: relational_expression ::= relational_expression >? shift_expression
//
case 574: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_max); break;
}
//
// Rule 575: relational_expression ::= relational_expression <? shift_expression
//
case 575: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_min); break;
}
//
// Rule 578: declaration_specifiers ::= <openscope-ast> typeof_declaration_specifiers
// Rule 580: declaration_specifiers ::= <openscope-ast> typeof_declaration_specifiers
//
case 578: { gnuAction.consumeDeclarationSpecifiersTypeof(); break;
case 580: { gnuAction.consumeDeclarationSpecifiersTypeof(); break;
}
//
// Rule 591: declarator ::= <openscope-ast> ptr_operator_seq attribute_or_decl_specifier_seq direct_declarator
// Rule 593: declarator ::= <openscope-ast> ptr_operator_seq attribute_or_decl_specifier_seq direct_declarator
//
case 591: { action. consumeDeclaratorWithPointer(true); break;
case 593: { action. consumeDeclaratorWithPointer(true); break;
}
//
// Rule 593: simple_type_specifier ::= _Complex
// Rule 595: simple_type_specifier ::= _Complex
//
case 593: { action. consumeToken(); break;
case 595: { action. consumeToken(); break;
}
//
// Rule 594: simple_type_specifier ::= _Imaginary
// Rule 596: simple_type_specifier ::= _Imaginary
//
case 594: { action. consumeToken(); break;
case 596: { action. consumeToken(); break;
}
//
// Rule 595: declaration_specifiers ::= <openscope-ast> simple_declaration_specifiers
// Rule 597: declaration_specifiers ::= <openscope-ast> simple_declaration_specifiers
//
case 595: { gnuAction.consumeDeclarationSpecifiersSimple(); break;
case 597: { gnuAction.consumeDeclarationSpecifiersSimple(); break;
}

View file

@ -22,7 +22,7 @@ public interface GPPParsersym {
TK_bool = 16,
TK_break = 82,
TK_case = 83,
TK_catch = 124,
TK_catch = 126,
TK_char = 17,
TK_class = 60,
TK_const = 28,
@ -33,7 +33,7 @@ public interface GPPParsersym {
TK_do = 86,
TK_double = 18,
TK_dynamic_cast = 48,
TK_else = 127,
TK_else = 129,
TK_enum = 62,
TK_explicit = 32,
TK_export = 92,
@ -51,9 +51,9 @@ public interface GPPParsersym {
TK_namespace = 66,
TK_new = 75,
TK_operator = 9,
TK_private = 108,
TK_protected = 109,
TK_public = 110,
TK_private = 110,
TK_protected = 111,
TK_public = 112,
TK_register = 37,
TK_reinterpret_cast = 50,
TK_return = 90,
@ -87,12 +87,12 @@ public interface GPPParsersym {
TK_identifier = 1,
TK_Completion = 2,
TK_EndOfCompletion = 11,
TK_Invalid = 128,
TK_Invalid = 130,
TK_LeftBracket = 69,
TK_LeftParen = 3,
TK_Dot = 125,
TK_Dot = 127,
TK_DotStar = 97,
TK_Arrow = 111,
TK_Arrow = 113,
TK_ArrowStar = 96,
TK_PlusPlus = 44,
TK_MinusMinus = 45,
@ -116,35 +116,35 @@ public interface GPPParsersym {
TK_Or = 105,
TK_AndAnd = 106,
TK_OrOr = 107,
TK_Question = 112,
TK_Question = 114,
TK_Colon = 77,
TK_ColonColon = 4,
TK_DotDotDot = 95,
TK_Assign = 79,
TK_StarAssign = 113,
TK_SlashAssign = 114,
TK_PercentAssign = 115,
TK_PlusAssign = 116,
TK_MinusAssign = 117,
TK_RightShiftAssign = 118,
TK_LeftShiftAssign = 119,
TK_AndAssign = 120,
TK_CaretAssign = 121,
TK_OrAssign = 122,
TK_StarAssign = 115,
TK_SlashAssign = 116,
TK_PercentAssign = 117,
TK_PlusAssign = 118,
TK_MinusAssign = 119,
TK_RightShiftAssign = 120,
TK_LeftShiftAssign = 121,
TK_AndAssign = 122,
TK_CaretAssign = 123,
TK_OrAssign = 124,
TK_Comma = 72,
TK_RightBracket = 123,
TK_RightBracket = 125,
TK_RightParen = 71,
TK_RightBrace = 80,
TK_SemiColon = 43,
TK_LeftBrace = 73,
TK_typeof = 27,
TK___alignof__ = 59,
TK_MAX = 129,
TK_MIN = 130,
TK___attribute__ = 7,
TK___declspec = 8,
TK_MAX = 108,
TK_MIN = 109,
TK_ERROR_TOKEN = 70,
TK_EOF_TOKEN = 126;
TK_EOF_TOKEN = 128;
public final static String orderedTerminalSymbols[] = {
"",
@ -255,6 +255,8 @@ public interface GPPParsersym {
"Or",
"AndAnd",
"OrOr",
"MAX",
"MIN",
"private",
"protected",
"public",
@ -275,9 +277,7 @@ public interface GPPParsersym {
"Dot",
"EOF_TOKEN",
"else",
"Invalid",
"MAX",
"MIN"
"Invalid"
};
public final static boolean isValidForParser = true;

View file

@ -1978,41 +1978,53 @@ private GPPBuildASTParserAction gnuAction;
//
case 569: { action. consumeExpressionUnaryOperator(IASTUnaryExpression.op_typeof); break;
}
//
// Rule 574: declaration_specifiers ::= <openscope-ast> typeof_declaration_specifiers
//
case 574: { gnuAction.consumeDeclarationSpecifiersTypeof(); break;
}
//
// Rule 587: declarator ::= <openscope-ast> ptr_operator_seq attribute_or_decl_specifier_seq direct_declarator
// Rule 570: relational_expression ::= relational_expression >? shift_expression
//
case 587: { action. consumeDeclaratorWithPointer(true); break;
case 570: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_max); break;
}
//
// Rule 589: simple_type_specifier ::= _Complex
// Rule 571: relational_expression ::= relational_expression <? shift_expression
//
case 589: { action. consumeToken(); break;
}
//
// Rule 590: simple_type_specifier ::= _Imaginary
//
case 590: { action. consumeToken(); break;
case 571: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_min); break;
}
//
// Rule 591: declaration_specifiers ::= <openscope-ast> simple_declaration_specifiers
// Rule 576: declaration_specifiers ::= <openscope-ast> typeof_declaration_specifiers
//
case 591: { gnuAction.consumeDeclarationSpecifiersSimple(); break;
case 576: { gnuAction.consumeDeclarationSpecifiersTypeof(); break;
}
//
// Rule 593: no_sizeof_type_id_start ::= ERROR_TOKEN
// Rule 589: declarator ::= <openscope-ast> ptr_operator_seq attribute_or_decl_specifier_seq direct_declarator
//
case 593: { action. consumeExpressionProblem(); break;
case 589: { action. consumeDeclaratorWithPointer(true); break;
}
//
// Rule 591: simple_type_specifier ::= _Complex
//
case 591: { action. consumeToken(); break;
}
//
// Rule 592: simple_type_specifier ::= _Imaginary
//
case 592: { action. consumeToken(); break;
}
//
// Rule 593: declaration_specifiers ::= <openscope-ast> simple_declaration_specifiers
//
case 593: { gnuAction.consumeDeclarationSpecifiersSimple(); break;
}
//
// Rule 595: no_sizeof_type_id_start ::= ERROR_TOKEN
//
case 595: { action. consumeExpressionProblem(); break;
}

View file

@ -22,7 +22,7 @@ public interface GPPSizeofExpressionParsersym {
TK_bool = 16,
TK_break = 82,
TK_case = 83,
TK_catch = 124,
TK_catch = 126,
TK_char = 17,
TK_class = 60,
TK_const = 28,
@ -33,7 +33,7 @@ public interface GPPSizeofExpressionParsersym {
TK_do = 86,
TK_double = 18,
TK_dynamic_cast = 48,
TK_else = 127,
TK_else = 129,
TK_enum = 63,
TK_explicit = 32,
TK_export = 92,
@ -51,9 +51,9 @@ public interface GPPSizeofExpressionParsersym {
TK_namespace = 67,
TK_new = 73,
TK_operator = 9,
TK_private = 108,
TK_protected = 109,
TK_public = 110,
TK_private = 110,
TK_protected = 111,
TK_public = 112,
TK_register = 37,
TK_reinterpret_cast = 50,
TK_return = 90,
@ -87,12 +87,12 @@ public interface GPPSizeofExpressionParsersym {
TK_identifier = 1,
TK_Completion = 2,
TK_EndOfCompletion = 10,
TK_Invalid = 128,
TK_Invalid = 130,
TK_LeftBracket = 68,
TK_LeftParen = 3,
TK_Dot = 125,
TK_Dot = 127,
TK_DotStar = 97,
TK_Arrow = 111,
TK_Arrow = 113,
TK_ArrowStar = 96,
TK_PlusPlus = 44,
TK_MinusMinus = 45,
@ -116,35 +116,35 @@ public interface GPPSizeofExpressionParsersym {
TK_Or = 105,
TK_AndAnd = 106,
TK_OrOr = 107,
TK_Question = 112,
TK_Question = 114,
TK_Colon = 77,
TK_ColonColon = 4,
TK_DotDotDot = 95,
TK_Assign = 79,
TK_StarAssign = 113,
TK_SlashAssign = 114,
TK_PercentAssign = 115,
TK_PlusAssign = 116,
TK_MinusAssign = 117,
TK_RightShiftAssign = 118,
TK_LeftShiftAssign = 119,
TK_AndAssign = 120,
TK_CaretAssign = 121,
TK_OrAssign = 122,
TK_StarAssign = 115,
TK_SlashAssign = 116,
TK_PercentAssign = 117,
TK_PlusAssign = 118,
TK_MinusAssign = 119,
TK_RightShiftAssign = 120,
TK_LeftShiftAssign = 121,
TK_AndAssign = 122,
TK_CaretAssign = 123,
TK_OrAssign = 124,
TK_Comma = 74,
TK_RightBracket = 123,
TK_RightBracket = 125,
TK_RightParen = 71,
TK_RightBrace = 80,
TK_SemiColon = 42,
TK_LeftBrace = 75,
TK_typeof = 27,
TK___alignof__ = 59,
TK_MAX = 129,
TK_MIN = 130,
TK___attribute__ = 6,
TK___declspec = 7,
TK_MAX = 108,
TK_MIN = 109,
TK_ERROR_TOKEN = 69,
TK_EOF_TOKEN = 126;
TK_EOF_TOKEN = 128;
public final static String orderedTerminalSymbols[] = {
"",
@ -255,6 +255,8 @@ public interface GPPSizeofExpressionParsersym {
"Or",
"AndAnd",
"OrOr",
"MAX",
"MIN",
"private",
"protected",
"public",
@ -275,9 +277,7 @@ public interface GPPSizeofExpressionParsersym {
"Dot",
"EOF_TOKEN",
"else",
"Invalid",
"MAX",
"MIN"
"Invalid"
};
public final static boolean isValidForParser = true;