cppparser: Fix syntax error with C++11 attributes in declarators

This commit is contained in:
rdb 2022-10-23 16:39:43 +02:00
parent 6fe25d3edc
commit dd662a6eaa
3 changed files with 4922 additions and 5124 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
/* A Bison parser, made by GNU Bison 3.5.3. */ /* A Bison parser, made by GNU Bison 3.8.2. */
/* Bison interface for Yacc-like parsers in C /* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation, Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
Inc. Inc.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
@ -16,7 +16,7 @@
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains /* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work part or all of the Bison parser skeleton and distribute that work
@ -31,8 +31,9 @@
This special exception was added by the Free Software Foundation in This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */ version 2.2 of Bison. */
/* Undocumented macros, especially those whose name start with YY_, /* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
are private implementation details. Do not rely on them. */ especially those whose name start with YY_ or yy_. They are
private implementation details that can be changed or removed. */
#ifndef YY_CPPYY_BUILT_TMP_CPPBISON_YXX_H_INCLUDED #ifndef YY_CPPYY_BUILT_TMP_CPPBISON_YXX_H_INCLUDED
# define YY_CPPYY_BUILT_TMP_CPPBISON_YXX_H_INCLUDED # define YY_CPPYY_BUILT_TMP_CPPBISON_YXX_H_INCLUDED
@ -44,158 +45,167 @@
extern int cppyydebug; extern int cppyydebug;
#endif #endif
/* Token type. */ /* Token kinds. */
#ifndef YYTOKENTYPE #ifndef YYTOKENTYPE
# define YYTOKENTYPE # define YYTOKENTYPE
enum yytokentype enum yytokentype
{ {
REAL = 258, YYEMPTY = -2,
INTEGER = 259, YYEOF = 0, /* "end of file" */
CHAR_TOK = 260, YYerror = 256, /* error */
SIMPLE_STRING = 261, YYUNDEF = 257, /* "invalid token" */
SIMPLE_IDENTIFIER = 262, REAL = 258, /* REAL */
STRING_LITERAL = 263, INTEGER = 259, /* INTEGER */
CUSTOM_LITERAL = 264, CHAR_TOK = 260, /* CHAR_TOK */
IDENTIFIER = 265, SIMPLE_STRING = 261, /* SIMPLE_STRING */
TYPENAME_IDENTIFIER = 266, SIMPLE_IDENTIFIER = 262, /* SIMPLE_IDENTIFIER */
TYPEPACK_IDENTIFIER = 267, STRING_LITERAL = 263, /* STRING_LITERAL */
SCOPING = 268, CUSTOM_LITERAL = 264, /* CUSTOM_LITERAL */
TYPEDEFNAME = 269, IDENTIFIER = 265, /* IDENTIFIER */
ELLIPSIS = 270, TYPENAME_IDENTIFIER = 266, /* TYPENAME_IDENTIFIER */
OROR = 271, TYPEPACK_IDENTIFIER = 267, /* TYPEPACK_IDENTIFIER */
ANDAND = 272, SCOPING = 268, /* SCOPING */
EQCOMPARE = 273, TYPEDEFNAME = 269, /* TYPEDEFNAME */
NECOMPARE = 274, ELLIPSIS = 270, /* ELLIPSIS */
LECOMPARE = 275, OROR = 271, /* OROR */
GECOMPARE = 276, ANDAND = 272, /* ANDAND */
LSHIFT = 277, EQCOMPARE = 273, /* EQCOMPARE */
RSHIFT = 278, NECOMPARE = 274, /* NECOMPARE */
POINTSAT_STAR = 279, LECOMPARE = 275, /* LECOMPARE */
DOT_STAR = 280, GECOMPARE = 276, /* GECOMPARE */
UNARY = 281, LSHIFT = 277, /* LSHIFT */
UNARY_NOT = 282, RSHIFT = 278, /* RSHIFT */
UNARY_NEGATE = 283, POINTSAT_STAR = 279, /* POINTSAT_STAR */
UNARY_MINUS = 284, DOT_STAR = 280, /* DOT_STAR */
UNARY_PLUS = 285, UNARY = 281, /* UNARY */
UNARY_STAR = 286, UNARY_NOT = 282, /* UNARY_NOT */
UNARY_REF = 287, UNARY_NEGATE = 283, /* UNARY_NEGATE */
POINTSAT = 288, UNARY_MINUS = 284, /* UNARY_MINUS */
SCOPE = 289, UNARY_PLUS = 285, /* UNARY_PLUS */
PLUSPLUS = 290, UNARY_STAR = 286, /* UNARY_STAR */
MINUSMINUS = 291, UNARY_REF = 287, /* UNARY_REF */
TIMESEQUAL = 292, POINTSAT = 288, /* POINTSAT */
DIVIDEEQUAL = 293, SCOPE = 289, /* SCOPE */
MODEQUAL = 294, PLUSPLUS = 290, /* PLUSPLUS */
PLUSEQUAL = 295, MINUSMINUS = 291, /* MINUSMINUS */
MINUSEQUAL = 296, TIMESEQUAL = 292, /* TIMESEQUAL */
OREQUAL = 297, DIVIDEEQUAL = 293, /* DIVIDEEQUAL */
ANDEQUAL = 298, MODEQUAL = 294, /* MODEQUAL */
XOREQUAL = 299, PLUSEQUAL = 295, /* PLUSEQUAL */
LSHIFTEQUAL = 300, MINUSEQUAL = 296, /* MINUSEQUAL */
RSHIFTEQUAL = 301, OREQUAL = 297, /* OREQUAL */
ATTR_LEFT = 302, ANDEQUAL = 298, /* ANDEQUAL */
ATTR_RIGHT = 303, XOREQUAL = 299, /* XOREQUAL */
KW_ALIGNAS = 304, LSHIFTEQUAL = 300, /* LSHIFTEQUAL */
KW_ALIGNOF = 305, RSHIFTEQUAL = 301, /* RSHIFTEQUAL */
KW_AUTO = 306, ATTR_LEFT = 302, /* ATTR_LEFT */
KW_BEGIN_PUBLISH = 307, ATTR_RIGHT = 303, /* ATTR_RIGHT */
KW_BLOCKING = 308, KW_ALIGNAS = 304, /* KW_ALIGNAS */
KW_BOOL = 309, KW_ALIGNOF = 305, /* KW_ALIGNOF */
KW_CATCH = 310, KW_AUTO = 306, /* KW_AUTO */
KW_CHAR = 311, KW_BEGIN_PUBLISH = 307, /* KW_BEGIN_PUBLISH */
KW_CHAR16_T = 312, KW_BLOCKING = 308, /* KW_BLOCKING */
KW_CHAR32_T = 313, KW_BOOL = 309, /* KW_BOOL */
KW_CLASS = 314, KW_CATCH = 310, /* KW_CATCH */
KW_CONST = 315, KW_CHAR = 311, /* KW_CHAR */
KW_CONSTEXPR = 316, KW_CHAR16_T = 312, /* KW_CHAR16_T */
KW_CONST_CAST = 317, KW_CHAR32_T = 313, /* KW_CHAR32_T */
KW_DECLTYPE = 318, KW_CLASS = 314, /* KW_CLASS */
KW_DEFAULT = 319, KW_CONST = 315, /* KW_CONST */
KW_DELETE = 320, KW_CONSTEXPR = 316, /* KW_CONSTEXPR */
KW_DOUBLE = 321, KW_CONST_CAST = 317, /* KW_CONST_CAST */
KW_DYNAMIC_CAST = 322, KW_DECLTYPE = 318, /* KW_DECLTYPE */
KW_ELSE = 323, KW_DEFAULT = 319, /* KW_DEFAULT */
KW_END_PUBLISH = 324, KW_DELETE = 320, /* KW_DELETE */
KW_ENUM = 325, KW_DOUBLE = 321, /* KW_DOUBLE */
KW_EXTENSION = 326, KW_DYNAMIC_CAST = 322, /* KW_DYNAMIC_CAST */
KW_EXTERN = 327, KW_ELSE = 323, /* KW_ELSE */
KW_EXPLICIT = 328, KW_END_PUBLISH = 324, /* KW_END_PUBLISH */
KW_PUBLISHED = 329, KW_ENUM = 325, /* KW_ENUM */
KW_FALSE = 330, KW_EXTENSION = 326, /* KW_EXTENSION */
KW_FINAL = 331, KW_EXTERN = 327, /* KW_EXTERN */
KW_FLOAT = 332, KW_EXPLICIT = 328, /* KW_EXPLICIT */
KW_FRIEND = 333, KW_PUBLISHED = 329, /* KW_PUBLISHED */
KW_FOR = 334, KW_FALSE = 330, /* KW_FALSE */
KW_GOTO = 335, KW_FINAL = 331, /* KW_FINAL */
KW_HAS_VIRTUAL_DESTRUCTOR = 336, KW_FLOAT = 332, /* KW_FLOAT */
KW_IF = 337, KW_FRIEND = 333, /* KW_FRIEND */
KW_INLINE = 338, KW_FOR = 334, /* KW_FOR */
KW_INT = 339, KW_GOTO = 335, /* KW_GOTO */
KW_IS_ABSTRACT = 340, KW_HAS_VIRTUAL_DESTRUCTOR = 336, /* KW_HAS_VIRTUAL_DESTRUCTOR */
KW_IS_BASE_OF = 341, KW_IF = 337, /* KW_IF */
KW_IS_CLASS = 342, KW_INLINE = 338, /* KW_INLINE */
KW_IS_CONSTRUCTIBLE = 343, KW_INT = 339, /* KW_INT */
KW_IS_CONVERTIBLE_TO = 344, KW_IS_ABSTRACT = 340, /* KW_IS_ABSTRACT */
KW_IS_DESTRUCTIBLE = 345, KW_IS_BASE_OF = 341, /* KW_IS_BASE_OF */
KW_IS_EMPTY = 346, KW_IS_CLASS = 342, /* KW_IS_CLASS */
KW_IS_ENUM = 347, KW_IS_CONSTRUCTIBLE = 343, /* KW_IS_CONSTRUCTIBLE */
KW_IS_FINAL = 348, KW_IS_CONVERTIBLE_TO = 344, /* KW_IS_CONVERTIBLE_TO */
KW_IS_FUNDAMENTAL = 349, KW_IS_DESTRUCTIBLE = 345, /* KW_IS_DESTRUCTIBLE */
KW_IS_POD = 350, KW_IS_EMPTY = 346, /* KW_IS_EMPTY */
KW_IS_POLYMORPHIC = 351, KW_IS_ENUM = 347, /* KW_IS_ENUM */
KW_IS_STANDARD_LAYOUT = 352, KW_IS_FINAL = 348, /* KW_IS_FINAL */
KW_IS_TRIVIAL = 353, KW_IS_FUNDAMENTAL = 349, /* KW_IS_FUNDAMENTAL */
KW_IS_UNION = 354, KW_IS_POD = 350, /* KW_IS_POD */
KW_LONG = 355, KW_IS_POLYMORPHIC = 351, /* KW_IS_POLYMORPHIC */
KW_MAKE_MAP_KEYS_SEQ = 356, KW_IS_STANDARD_LAYOUT = 352, /* KW_IS_STANDARD_LAYOUT */
KW_MAKE_MAP_PROPERTY = 357, KW_IS_TRIVIAL = 353, /* KW_IS_TRIVIAL */
KW_MAKE_PROPERTY = 358, KW_IS_UNION = 354, /* KW_IS_UNION */
KW_MAKE_PROPERTY2 = 359, KW_LONG = 355, /* KW_LONG */
KW_MAKE_SEQ = 360, KW_MAKE_MAP_KEYS_SEQ = 356, /* KW_MAKE_MAP_KEYS_SEQ */
KW_MAKE_SEQ_PROPERTY = 361, KW_MAKE_MAP_PROPERTY = 357, /* KW_MAKE_MAP_PROPERTY */
KW_MUTABLE = 362, KW_MAKE_PROPERTY = 358, /* KW_MAKE_PROPERTY */
KW_NAMESPACE = 363, KW_MAKE_PROPERTY2 = 359, /* KW_MAKE_PROPERTY2 */
KW_NEW = 364, KW_MAKE_SEQ = 360, /* KW_MAKE_SEQ */
KW_NOEXCEPT = 365, KW_MAKE_SEQ_PROPERTY = 361, /* KW_MAKE_SEQ_PROPERTY */
KW_NULLPTR = 366, KW_MUTABLE = 362, /* KW_MUTABLE */
KW_OPERATOR = 367, KW_NAMESPACE = 363, /* KW_NAMESPACE */
KW_OVERRIDE = 368, KW_NEW = 364, /* KW_NEW */
KW_PRIVATE = 369, KW_NOEXCEPT = 365, /* KW_NOEXCEPT */
KW_PROTECTED = 370, KW_NULLPTR = 366, /* KW_NULLPTR */
KW_PUBLIC = 371, KW_OPERATOR = 367, /* KW_OPERATOR */
KW_REGISTER = 372, KW_OVERRIDE = 368, /* KW_OVERRIDE */
KW_REINTERPRET_CAST = 373, KW_PRIVATE = 369, /* KW_PRIVATE */
KW_RETURN = 374, KW_PROTECTED = 370, /* KW_PROTECTED */
KW_SHORT = 375, KW_PUBLIC = 371, /* KW_PUBLIC */
KW_SIGNED = 376, KW_REGISTER = 372, /* KW_REGISTER */
KW_SIZEOF = 377, KW_REINTERPRET_CAST = 373, /* KW_REINTERPRET_CAST */
KW_STATIC = 378, KW_RETURN = 374, /* KW_RETURN */
KW_STATIC_ASSERT = 379, KW_SHORT = 375, /* KW_SHORT */
KW_STATIC_CAST = 380, KW_SIGNED = 376, /* KW_SIGNED */
KW_STRUCT = 381, KW_SIZEOF = 377, /* KW_SIZEOF */
KW_TEMPLATE = 382, KW_STATIC = 378, /* KW_STATIC */
KW_THREAD_LOCAL = 383, KW_STATIC_ASSERT = 379, /* KW_STATIC_ASSERT */
KW_THROW = 384, KW_STATIC_CAST = 380, /* KW_STATIC_CAST */
KW_TRUE = 385, KW_STRUCT = 381, /* KW_STRUCT */
KW_TRY = 386, KW_TEMPLATE = 382, /* KW_TEMPLATE */
KW_TYPEDEF = 387, KW_THREAD_LOCAL = 383, /* KW_THREAD_LOCAL */
KW_TYPEID = 388, KW_THROW = 384, /* KW_THROW */
KW_TYPENAME = 389, KW_TRUE = 385, /* KW_TRUE */
KW_UNDERLYING_TYPE = 390, KW_TRY = 386, /* KW_TRY */
KW_UNION = 391, KW_TYPEDEF = 387, /* KW_TYPEDEF */
KW_UNSIGNED = 392, KW_TYPEID = 388, /* KW_TYPEID */
KW_USING = 393, KW_TYPENAME = 389, /* KW_TYPENAME */
KW_VIRTUAL = 394, KW_UNDERLYING_TYPE = 390, /* KW_UNDERLYING_TYPE */
KW_VOID = 395, KW_UNION = 391, /* KW_UNION */
KW_VOLATILE = 396, KW_UNSIGNED = 392, /* KW_UNSIGNED */
KW_WCHAR_T = 397, KW_USING = 393, /* KW_USING */
KW_WHILE = 398, KW_VIRTUAL = 394, /* KW_VIRTUAL */
START_CPP = 399, KW_VOID = 395, /* KW_VOID */
START_CONST_EXPR = 400, KW_VOLATILE = 396, /* KW_VOLATILE */
START_TYPE = 401 KW_WCHAR_T = 397, /* KW_WCHAR_T */
KW_WHILE = 398, /* KW_WHILE */
START_CPP = 399, /* START_CPP */
START_CONST_EXPR = 400, /* START_CONST_EXPR */
START_TYPE = 401 /* START_TYPE */
}; };
typedef enum yytokentype yytoken_kind_t;
#endif #endif
/* Tokens. */ /* Token kinds. */
#define YYEMPTY -2
#define YYEOF 0
#define YYerror 256
#define YYUNDEF 257
#define REAL 258 #define REAL 258
#define INTEGER 259 #define INTEGER 259
#define CHAR_TOK 260 #define CHAR_TOK 260
@ -359,6 +369,8 @@ struct YYLTYPE
int cppyyparse (void); int cppyyparse (void);
#endif /* !YY_CPPYY_BUILT_TMP_CPPBISON_YXX_H_INCLUDED */ #endif /* !YY_CPPYY_BUILT_TMP_CPPBISON_YXX_H_INCLUDED */

View File

@ -1034,6 +1034,13 @@ storage_class:
} }
; ;
optional_attributes:
empty
| ATTR_LEFT attribute_specifiers ATTR_RIGHT optional_attributes
| KW_ALIGNAS '(' const_expr ')' optional_attributes
| KW_ALIGNAS '(' type_decl ')' optional_attributes
;
attribute_specifiers: attribute_specifiers:
attribute_specifier attribute_specifier
| attribute_specifier ',' attribute_specifiers | attribute_specifier ',' attribute_specifiers
@ -1777,11 +1784,11 @@ template_formal_parameter_type:
instance_identifier: instance_identifier:
name_no_final name_no_final optional_attributes
{ {
$$ = new CPPInstanceIdentifier($1); $$ = new CPPInstanceIdentifier($1);
} }
| KW_OPERATOR function_operator | KW_OPERATOR function_operator optional_attributes
{ {
// For an operator function. We implement this simply by building a // For an operator function. We implement this simply by building a
// ficticious name for the function; in other respects it's just // ficticious name for the function; in other respects it's just
@ -1795,7 +1802,7 @@ instance_identifier:
$$ = new CPPInstanceIdentifier(ident); $$ = new CPPInstanceIdentifier(ident);
} }
| KW_OPERATOR SIMPLE_STRING IDENTIFIER | KW_OPERATOR SIMPLE_STRING IDENTIFIER optional_attributes
{ {
// A C++11 literal operator. // A C++11 literal operator.
if (!$2.empty()) { if (!$2.empty()) {
@ -1820,27 +1827,27 @@ instance_identifier:
$$ = $2; $$ = $2;
$$->add_modifier(IIT_volatile); $$->add_modifier(IIT_volatile);
} }
| '*' instance_identifier %prec UNARY | '*' optional_attributes instance_identifier %prec UNARY
{
$$ = $2;
$$->add_modifier(IIT_pointer);
}
| '&' instance_identifier %prec UNARY
{
$$ = $2;
$$->add_modifier(IIT_reference);
}
| ANDAND instance_identifier %prec UNARY
{
$$ = $2;
$$->add_modifier(IIT_rvalue_reference);
}
| SCOPING '*' instance_identifier %prec UNARY
{ {
$$ = $3; $$ = $3;
$$->add_modifier(IIT_pointer);
}
| '&' optional_attributes instance_identifier %prec UNARY
{
$$ = $3;
$$->add_modifier(IIT_reference);
}
| ANDAND optional_attributes instance_identifier %prec UNARY
{
$$ = $3;
$$->add_modifier(IIT_rvalue_reference);
}
| SCOPING '*' optional_attributes instance_identifier %prec UNARY
{
$$ = $4;
$$->add_scoped_pointer_modifier($1); $$->add_scoped_pointer_modifier($1);
} }
| instance_identifier '[' optional_const_expr ']' | instance_identifier '[' optional_const_expr ']' optional_attributes
{ {
$$ = $1; $$ = $1;
$$->add_array_modifier($3); $$->add_array_modifier($3);
@ -2162,7 +2169,7 @@ not_paren_formal_parameter_identifier:
{ {
$$ = new CPPInstanceIdentifier(nullptr); $$ = new CPPInstanceIdentifier(nullptr);
} }
| name_no_final | name_no_final optional_attributes
{ {
$$ = new CPPInstanceIdentifier($1); $$ = new CPPInstanceIdentifier($1);
} }
@ -2176,27 +2183,27 @@ not_paren_formal_parameter_identifier:
$$ = $2; $$ = $2;
$$->add_modifier(IIT_volatile); $$->add_modifier(IIT_volatile);
} }
| '*' not_paren_formal_parameter_identifier %prec UNARY | '*' optional_attributes not_paren_formal_parameter_identifier %prec UNARY
{
$$ = $2;
$$->add_modifier(IIT_pointer);
}
| '&' not_paren_formal_parameter_identifier %prec UNARY
{
$$ = $2;
$$->add_modifier(IIT_reference);
}
| ANDAND not_paren_formal_parameter_identifier %prec UNARY
{
$$ = $2;
$$->add_modifier(IIT_rvalue_reference);
}
| SCOPING '*' not_paren_formal_parameter_identifier %prec UNARY
{ {
$$ = $3; $$ = $3;
$$->add_modifier(IIT_pointer);
}
| '&' optional_attributes not_paren_formal_parameter_identifier %prec UNARY
{
$$ = $3;
$$->add_modifier(IIT_reference);
}
| ANDAND optional_attributes not_paren_formal_parameter_identifier %prec UNARY
{
$$ = $3;
$$->add_modifier(IIT_rvalue_reference);
}
| SCOPING '*' optional_attributes not_paren_formal_parameter_identifier %prec UNARY
{
$$ = $4;
$$->add_scoped_pointer_modifier($1); $$->add_scoped_pointer_modifier($1);
} }
| not_paren_formal_parameter_identifier '[' optional_const_expr ']' | not_paren_formal_parameter_identifier '[' optional_const_expr ']' optional_attributes
{ {
$$ = $1; $$ = $1;
$$->add_array_modifier($3); $$->add_array_modifier($3);
@ -2208,7 +2215,7 @@ formal_parameter_identifier:
{ {
$$ = new CPPInstanceIdentifier(nullptr); $$ = new CPPInstanceIdentifier(nullptr);
} }
| name_no_final | name_no_final optional_attributes
{ {
$$ = new CPPInstanceIdentifier($1); $$ = new CPPInstanceIdentifier($1);
} }
@ -2222,27 +2229,27 @@ formal_parameter_identifier:
$$ = $2; $$ = $2;
$$->add_modifier(IIT_volatile); $$->add_modifier(IIT_volatile);
} }
| '*' formal_parameter_identifier %prec UNARY | '*' optional_attributes formal_parameter_identifier %prec UNARY
{
$$ = $2;
$$->add_modifier(IIT_pointer);
}
| '&' formal_parameter_identifier %prec UNARY
{
$$ = $2;
$$->add_modifier(IIT_reference);
}
| ANDAND formal_parameter_identifier %prec UNARY
{
$$ = $2;
$$->add_modifier(IIT_rvalue_reference);
}
| SCOPING '*' formal_parameter_identifier %prec UNARY
{ {
$$ = $3; $$ = $3;
$$->add_modifier(IIT_pointer);
}
| '&' optional_attributes formal_parameter_identifier %prec UNARY
{
$$ = $3;
$$->add_modifier(IIT_reference);
}
| ANDAND optional_attributes formal_parameter_identifier %prec UNARY
{
$$ = $3;
$$->add_modifier(IIT_rvalue_reference);
}
| SCOPING '*' optional_attributes formal_parameter_identifier %prec UNARY
{
$$ = $4;
$$->add_scoped_pointer_modifier($1); $$->add_scoped_pointer_modifier($1);
} }
| formal_parameter_identifier '[' optional_const_expr ']' | formal_parameter_identifier '[' optional_const_expr ']' optional_attributes
{ {
$$ = $1; $$ = $1;
$$->add_array_modifier($3); $$->add_array_modifier($3);
@ -2266,7 +2273,7 @@ parameter_pack_identifier:
$$ = new CPPInstanceIdentifier(nullptr); $$ = new CPPInstanceIdentifier(nullptr);
$$->_packed = true; $$->_packed = true;
} }
| ELLIPSIS name | ELLIPSIS name optional_attributes
{ {
$$ = new CPPInstanceIdentifier($2); $$ = new CPPInstanceIdentifier($2);
$$->_packed = true; $$->_packed = true;
@ -2281,27 +2288,27 @@ parameter_pack_identifier:
$$ = $2; $$ = $2;
$$->add_modifier(IIT_volatile); $$->add_modifier(IIT_volatile);
} }
| '*' parameter_pack_identifier %prec UNARY | '*' optional_attributes parameter_pack_identifier %prec UNARY
{
$$ = $2;
$$->add_modifier(IIT_pointer);
}
| '&' parameter_pack_identifier %prec UNARY
{
$$ = $2;
$$->add_modifier(IIT_reference);
}
| ANDAND parameter_pack_identifier %prec UNARY
{
$$ = $2;
$$->add_modifier(IIT_rvalue_reference);
}
| SCOPING '*' parameter_pack_identifier %prec UNARY
{ {
$$ = $3; $$ = $3;
$$->add_modifier(IIT_pointer);
}
| '&' optional_attributes parameter_pack_identifier %prec UNARY
{
$$ = $3;
$$->add_modifier(IIT_reference);
}
| ANDAND optional_attributes parameter_pack_identifier %prec UNARY
{
$$ = $3;
$$->add_modifier(IIT_rvalue_reference);
}
| SCOPING '*' optional_attributes parameter_pack_identifier %prec UNARY
{
$$ = $4;
$$->add_scoped_pointer_modifier($1); $$->add_scoped_pointer_modifier($1);
} }
| parameter_pack_identifier '[' optional_const_expr ']' | parameter_pack_identifier '[' optional_const_expr ']' optional_attributes
{ {
$$ = $1; $$ = $1;
$$->add_array_modifier($3); $$->add_array_modifier($3);
@ -2329,7 +2336,7 @@ not_paren_empty_instance_identifier:
$$ = new CPPInstanceIdentifier(nullptr); $$ = new CPPInstanceIdentifier(nullptr);
$$->_packed = true; $$->_packed = true;
} }
| ELLIPSIS name | ELLIPSIS name optional_attributes
{ {
$$ = new CPPInstanceIdentifier($2); $$ = new CPPInstanceIdentifier($2);
$$->_packed = true; $$->_packed = true;
@ -2344,27 +2351,27 @@ not_paren_empty_instance_identifier:
$$ = $2; $$ = $2;
$$->add_modifier(IIT_volatile); $$->add_modifier(IIT_volatile);
} }
| '*' not_paren_empty_instance_identifier %prec UNARY | '*' optional_attributes not_paren_empty_instance_identifier %prec UNARY
{
$$ = $2;
$$->add_modifier(IIT_pointer);
}
| '&' not_paren_empty_instance_identifier %prec UNARY
{
$$ = $2;
$$->add_modifier(IIT_reference);
}
| ANDAND not_paren_empty_instance_identifier %prec UNARY
{
$$ = $2;
$$->add_modifier(IIT_rvalue_reference);
}
| SCOPING '*' not_paren_empty_instance_identifier %prec UNARY
{ {
$$ = $3; $$ = $3;
$$->add_modifier(IIT_pointer);
}
| '&' optional_attributes not_paren_empty_instance_identifier %prec UNARY
{
$$ = $3;
$$->add_modifier(IIT_reference);
}
| ANDAND optional_attributes not_paren_empty_instance_identifier %prec UNARY
{
$$ = $3;
$$->add_modifier(IIT_rvalue_reference);
}
| SCOPING '*' optional_attributes not_paren_empty_instance_identifier %prec UNARY
{
$$ = $4;
$$->add_scoped_pointer_modifier($1); $$->add_scoped_pointer_modifier($1);
} }
| not_paren_empty_instance_identifier '[' optional_const_expr ']' | not_paren_empty_instance_identifier '[' optional_const_expr ']' optional_attributes
{ {
$$ = $1; $$ = $1;
$$->add_array_modifier($3); $$->add_array_modifier($3);
@ -2381,7 +2388,7 @@ empty_instance_identifier:
$$ = new CPPInstanceIdentifier(nullptr); $$ = new CPPInstanceIdentifier(nullptr);
$$->_packed = true; $$->_packed = true;
} }
| ELLIPSIS name | ELLIPSIS name optional_attributes
{ {
$$ = new CPPInstanceIdentifier($2); $$ = new CPPInstanceIdentifier($2);
$$->_packed = true; $$->_packed = true;
@ -2396,27 +2403,27 @@ empty_instance_identifier:
$$ = $2; $$ = $2;
$$->add_modifier(IIT_volatile); $$->add_modifier(IIT_volatile);
} }
| '*' not_paren_empty_instance_identifier %prec UNARY | '*' optional_attributes not_paren_empty_instance_identifier %prec UNARY
{
$$ = $2;
$$->add_modifier(IIT_pointer);
}
| '&' not_paren_empty_instance_identifier %prec UNARY
{
$$ = $2;
$$->add_modifier(IIT_reference);
}
| ANDAND not_paren_empty_instance_identifier %prec UNARY
{
$$ = $2;
$$->add_modifier(IIT_rvalue_reference);
}
| SCOPING '*' not_paren_empty_instance_identifier %prec UNARY
{ {
$$ = $3; $$ = $3;
$$->add_modifier(IIT_pointer);
}
| '&' optional_attributes not_paren_empty_instance_identifier %prec UNARY
{
$$ = $3;
$$->add_modifier(IIT_reference);
}
| ANDAND optional_attributes not_paren_empty_instance_identifier %prec UNARY
{
$$ = $3;
$$->add_modifier(IIT_rvalue_reference);
}
| SCOPING '*' optional_attributes not_paren_empty_instance_identifier %prec UNARY
{
$$ = $4;
$$->add_scoped_pointer_modifier($1); $$->add_scoped_pointer_modifier($1);
} }
| not_paren_empty_instance_identifier '[' optional_const_expr ']' | not_paren_empty_instance_identifier '[' optional_const_expr ']' optional_attributes
{ {
$$ = $1; $$ = $1;
$$->add_array_modifier($3); $$->add_array_modifier($3);
@ -2427,26 +2434,26 @@ empty_instance_identifier:
$$->add_modifier(IIT_paren); $$->add_modifier(IIT_paren);
$$->add_func_modifier($2, $4, $5); $$->add_func_modifier($2, $4, $5);
} }
| '(' '*' not_paren_empty_instance_identifier ')' '(' function_parameter_list ')' function_post maybe_trailing_return_type | '(' '*' optional_attributes not_paren_empty_instance_identifier ')' '(' function_parameter_list ')' function_post maybe_trailing_return_type
{ {
$$ = $3; $$ = $4;
$$->add_modifier(IIT_pointer); $$->add_modifier(IIT_pointer);
$$->add_modifier(IIT_paren); $$->add_modifier(IIT_paren);
$$->add_func_modifier($6, $8, $9); $$->add_func_modifier($7, $9, $10);
} }
| '(' '&' not_paren_empty_instance_identifier ')' '(' function_parameter_list ')' function_post maybe_trailing_return_type | '(' '&' optional_attributes not_paren_empty_instance_identifier ')' '(' function_parameter_list ')' function_post maybe_trailing_return_type
{ {
$$ = $3; $$ = $4;
$$->add_modifier(IIT_reference); $$->add_modifier(IIT_reference);
$$->add_modifier(IIT_paren); $$->add_modifier(IIT_paren);
$$->add_func_modifier($6, $8, $9); $$->add_func_modifier($7, $9, $10);
} }
| '(' ANDAND not_paren_empty_instance_identifier ')' '(' function_parameter_list ')' function_post maybe_trailing_return_type | '(' ANDAND optional_attributes not_paren_empty_instance_identifier ')' '(' function_parameter_list ')' function_post maybe_trailing_return_type
{ {
$$ = $3; $$ = $4;
$$->add_modifier(IIT_rvalue_reference); $$->add_modifier(IIT_rvalue_reference);
$$->add_modifier(IIT_paren); $$->add_modifier(IIT_paren);
$$->add_func_modifier($6, $8, $9); $$->add_func_modifier($7, $9, $10);
} }
; ;