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
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.
This program is free software: you can redistribute it and/or modify
@ -16,7 +16,7 @@
GNU General Public License for more details.
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
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
version 2.2 of Bison. */
/* Undocumented macros, especially those whose name start with YY_,
are private implementation details. Do not rely on them. */
/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
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
# define YY_CPPYY_BUILT_TMP_CPPBISON_YXX_H_INCLUDED
@ -44,158 +45,167 @@
extern int cppyydebug;
#endif
/* Token type. */
/* Token kinds. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
enum yytokentype
{
REAL = 258,
INTEGER = 259,
CHAR_TOK = 260,
SIMPLE_STRING = 261,
SIMPLE_IDENTIFIER = 262,
STRING_LITERAL = 263,
CUSTOM_LITERAL = 264,
IDENTIFIER = 265,
TYPENAME_IDENTIFIER = 266,
TYPEPACK_IDENTIFIER = 267,
SCOPING = 268,
TYPEDEFNAME = 269,
ELLIPSIS = 270,
OROR = 271,
ANDAND = 272,
EQCOMPARE = 273,
NECOMPARE = 274,
LECOMPARE = 275,
GECOMPARE = 276,
LSHIFT = 277,
RSHIFT = 278,
POINTSAT_STAR = 279,
DOT_STAR = 280,
UNARY = 281,
UNARY_NOT = 282,
UNARY_NEGATE = 283,
UNARY_MINUS = 284,
UNARY_PLUS = 285,
UNARY_STAR = 286,
UNARY_REF = 287,
POINTSAT = 288,
SCOPE = 289,
PLUSPLUS = 290,
MINUSMINUS = 291,
TIMESEQUAL = 292,
DIVIDEEQUAL = 293,
MODEQUAL = 294,
PLUSEQUAL = 295,
MINUSEQUAL = 296,
OREQUAL = 297,
ANDEQUAL = 298,
XOREQUAL = 299,
LSHIFTEQUAL = 300,
RSHIFTEQUAL = 301,
ATTR_LEFT = 302,
ATTR_RIGHT = 303,
KW_ALIGNAS = 304,
KW_ALIGNOF = 305,
KW_AUTO = 306,
KW_BEGIN_PUBLISH = 307,
KW_BLOCKING = 308,
KW_BOOL = 309,
KW_CATCH = 310,
KW_CHAR = 311,
KW_CHAR16_T = 312,
KW_CHAR32_T = 313,
KW_CLASS = 314,
KW_CONST = 315,
KW_CONSTEXPR = 316,
KW_CONST_CAST = 317,
KW_DECLTYPE = 318,
KW_DEFAULT = 319,
KW_DELETE = 320,
KW_DOUBLE = 321,
KW_DYNAMIC_CAST = 322,
KW_ELSE = 323,
KW_END_PUBLISH = 324,
KW_ENUM = 325,
KW_EXTENSION = 326,
KW_EXTERN = 327,
KW_EXPLICIT = 328,
KW_PUBLISHED = 329,
KW_FALSE = 330,
KW_FINAL = 331,
KW_FLOAT = 332,
KW_FRIEND = 333,
KW_FOR = 334,
KW_GOTO = 335,
KW_HAS_VIRTUAL_DESTRUCTOR = 336,
KW_IF = 337,
KW_INLINE = 338,
KW_INT = 339,
KW_IS_ABSTRACT = 340,
KW_IS_BASE_OF = 341,
KW_IS_CLASS = 342,
KW_IS_CONSTRUCTIBLE = 343,
KW_IS_CONVERTIBLE_TO = 344,
KW_IS_DESTRUCTIBLE = 345,
KW_IS_EMPTY = 346,
KW_IS_ENUM = 347,
KW_IS_FINAL = 348,
KW_IS_FUNDAMENTAL = 349,
KW_IS_POD = 350,
KW_IS_POLYMORPHIC = 351,
KW_IS_STANDARD_LAYOUT = 352,
KW_IS_TRIVIAL = 353,
KW_IS_UNION = 354,
KW_LONG = 355,
KW_MAKE_MAP_KEYS_SEQ = 356,
KW_MAKE_MAP_PROPERTY = 357,
KW_MAKE_PROPERTY = 358,
KW_MAKE_PROPERTY2 = 359,
KW_MAKE_SEQ = 360,
KW_MAKE_SEQ_PROPERTY = 361,
KW_MUTABLE = 362,
KW_NAMESPACE = 363,
KW_NEW = 364,
KW_NOEXCEPT = 365,
KW_NULLPTR = 366,
KW_OPERATOR = 367,
KW_OVERRIDE = 368,
KW_PRIVATE = 369,
KW_PROTECTED = 370,
KW_PUBLIC = 371,
KW_REGISTER = 372,
KW_REINTERPRET_CAST = 373,
KW_RETURN = 374,
KW_SHORT = 375,
KW_SIGNED = 376,
KW_SIZEOF = 377,
KW_STATIC = 378,
KW_STATIC_ASSERT = 379,
KW_STATIC_CAST = 380,
KW_STRUCT = 381,
KW_TEMPLATE = 382,
KW_THREAD_LOCAL = 383,
KW_THROW = 384,
KW_TRUE = 385,
KW_TRY = 386,
KW_TYPEDEF = 387,
KW_TYPEID = 388,
KW_TYPENAME = 389,
KW_UNDERLYING_TYPE = 390,
KW_UNION = 391,
KW_UNSIGNED = 392,
KW_USING = 393,
KW_VIRTUAL = 394,
KW_VOID = 395,
KW_VOLATILE = 396,
KW_WCHAR_T = 397,
KW_WHILE = 398,
START_CPP = 399,
START_CONST_EXPR = 400,
START_TYPE = 401
YYEMPTY = -2,
YYEOF = 0, /* "end of file" */
YYerror = 256, /* error */
YYUNDEF = 257, /* "invalid token" */
REAL = 258, /* REAL */
INTEGER = 259, /* INTEGER */
CHAR_TOK = 260, /* CHAR_TOK */
SIMPLE_STRING = 261, /* SIMPLE_STRING */
SIMPLE_IDENTIFIER = 262, /* SIMPLE_IDENTIFIER */
STRING_LITERAL = 263, /* STRING_LITERAL */
CUSTOM_LITERAL = 264, /* CUSTOM_LITERAL */
IDENTIFIER = 265, /* IDENTIFIER */
TYPENAME_IDENTIFIER = 266, /* TYPENAME_IDENTIFIER */
TYPEPACK_IDENTIFIER = 267, /* TYPEPACK_IDENTIFIER */
SCOPING = 268, /* SCOPING */
TYPEDEFNAME = 269, /* TYPEDEFNAME */
ELLIPSIS = 270, /* ELLIPSIS */
OROR = 271, /* OROR */
ANDAND = 272, /* ANDAND */
EQCOMPARE = 273, /* EQCOMPARE */
NECOMPARE = 274, /* NECOMPARE */
LECOMPARE = 275, /* LECOMPARE */
GECOMPARE = 276, /* GECOMPARE */
LSHIFT = 277, /* LSHIFT */
RSHIFT = 278, /* RSHIFT */
POINTSAT_STAR = 279, /* POINTSAT_STAR */
DOT_STAR = 280, /* DOT_STAR */
UNARY = 281, /* UNARY */
UNARY_NOT = 282, /* UNARY_NOT */
UNARY_NEGATE = 283, /* UNARY_NEGATE */
UNARY_MINUS = 284, /* UNARY_MINUS */
UNARY_PLUS = 285, /* UNARY_PLUS */
UNARY_STAR = 286, /* UNARY_STAR */
UNARY_REF = 287, /* UNARY_REF */
POINTSAT = 288, /* POINTSAT */
SCOPE = 289, /* SCOPE */
PLUSPLUS = 290, /* PLUSPLUS */
MINUSMINUS = 291, /* MINUSMINUS */
TIMESEQUAL = 292, /* TIMESEQUAL */
DIVIDEEQUAL = 293, /* DIVIDEEQUAL */
MODEQUAL = 294, /* MODEQUAL */
PLUSEQUAL = 295, /* PLUSEQUAL */
MINUSEQUAL = 296, /* MINUSEQUAL */
OREQUAL = 297, /* OREQUAL */
ANDEQUAL = 298, /* ANDEQUAL */
XOREQUAL = 299, /* XOREQUAL */
LSHIFTEQUAL = 300, /* LSHIFTEQUAL */
RSHIFTEQUAL = 301, /* RSHIFTEQUAL */
ATTR_LEFT = 302, /* ATTR_LEFT */
ATTR_RIGHT = 303, /* ATTR_RIGHT */
KW_ALIGNAS = 304, /* KW_ALIGNAS */
KW_ALIGNOF = 305, /* KW_ALIGNOF */
KW_AUTO = 306, /* KW_AUTO */
KW_BEGIN_PUBLISH = 307, /* KW_BEGIN_PUBLISH */
KW_BLOCKING = 308, /* KW_BLOCKING */
KW_BOOL = 309, /* KW_BOOL */
KW_CATCH = 310, /* KW_CATCH */
KW_CHAR = 311, /* KW_CHAR */
KW_CHAR16_T = 312, /* KW_CHAR16_T */
KW_CHAR32_T = 313, /* KW_CHAR32_T */
KW_CLASS = 314, /* KW_CLASS */
KW_CONST = 315, /* KW_CONST */
KW_CONSTEXPR = 316, /* KW_CONSTEXPR */
KW_CONST_CAST = 317, /* KW_CONST_CAST */
KW_DECLTYPE = 318, /* KW_DECLTYPE */
KW_DEFAULT = 319, /* KW_DEFAULT */
KW_DELETE = 320, /* KW_DELETE */
KW_DOUBLE = 321, /* KW_DOUBLE */
KW_DYNAMIC_CAST = 322, /* KW_DYNAMIC_CAST */
KW_ELSE = 323, /* KW_ELSE */
KW_END_PUBLISH = 324, /* KW_END_PUBLISH */
KW_ENUM = 325, /* KW_ENUM */
KW_EXTENSION = 326, /* KW_EXTENSION */
KW_EXTERN = 327, /* KW_EXTERN */
KW_EXPLICIT = 328, /* KW_EXPLICIT */
KW_PUBLISHED = 329, /* KW_PUBLISHED */
KW_FALSE = 330, /* KW_FALSE */
KW_FINAL = 331, /* KW_FINAL */
KW_FLOAT = 332, /* KW_FLOAT */
KW_FRIEND = 333, /* KW_FRIEND */
KW_FOR = 334, /* KW_FOR */
KW_GOTO = 335, /* KW_GOTO */
KW_HAS_VIRTUAL_DESTRUCTOR = 336, /* KW_HAS_VIRTUAL_DESTRUCTOR */
KW_IF = 337, /* KW_IF */
KW_INLINE = 338, /* KW_INLINE */
KW_INT = 339, /* KW_INT */
KW_IS_ABSTRACT = 340, /* KW_IS_ABSTRACT */
KW_IS_BASE_OF = 341, /* KW_IS_BASE_OF */
KW_IS_CLASS = 342, /* KW_IS_CLASS */
KW_IS_CONSTRUCTIBLE = 343, /* KW_IS_CONSTRUCTIBLE */
KW_IS_CONVERTIBLE_TO = 344, /* KW_IS_CONVERTIBLE_TO */
KW_IS_DESTRUCTIBLE = 345, /* KW_IS_DESTRUCTIBLE */
KW_IS_EMPTY = 346, /* KW_IS_EMPTY */
KW_IS_ENUM = 347, /* KW_IS_ENUM */
KW_IS_FINAL = 348, /* KW_IS_FINAL */
KW_IS_FUNDAMENTAL = 349, /* KW_IS_FUNDAMENTAL */
KW_IS_POD = 350, /* KW_IS_POD */
KW_IS_POLYMORPHIC = 351, /* KW_IS_POLYMORPHIC */
KW_IS_STANDARD_LAYOUT = 352, /* KW_IS_STANDARD_LAYOUT */
KW_IS_TRIVIAL = 353, /* KW_IS_TRIVIAL */
KW_IS_UNION = 354, /* KW_IS_UNION */
KW_LONG = 355, /* KW_LONG */
KW_MAKE_MAP_KEYS_SEQ = 356, /* KW_MAKE_MAP_KEYS_SEQ */
KW_MAKE_MAP_PROPERTY = 357, /* KW_MAKE_MAP_PROPERTY */
KW_MAKE_PROPERTY = 358, /* KW_MAKE_PROPERTY */
KW_MAKE_PROPERTY2 = 359, /* KW_MAKE_PROPERTY2 */
KW_MAKE_SEQ = 360, /* KW_MAKE_SEQ */
KW_MAKE_SEQ_PROPERTY = 361, /* KW_MAKE_SEQ_PROPERTY */
KW_MUTABLE = 362, /* KW_MUTABLE */
KW_NAMESPACE = 363, /* KW_NAMESPACE */
KW_NEW = 364, /* KW_NEW */
KW_NOEXCEPT = 365, /* KW_NOEXCEPT */
KW_NULLPTR = 366, /* KW_NULLPTR */
KW_OPERATOR = 367, /* KW_OPERATOR */
KW_OVERRIDE = 368, /* KW_OVERRIDE */
KW_PRIVATE = 369, /* KW_PRIVATE */
KW_PROTECTED = 370, /* KW_PROTECTED */
KW_PUBLIC = 371, /* KW_PUBLIC */
KW_REGISTER = 372, /* KW_REGISTER */
KW_REINTERPRET_CAST = 373, /* KW_REINTERPRET_CAST */
KW_RETURN = 374, /* KW_RETURN */
KW_SHORT = 375, /* KW_SHORT */
KW_SIGNED = 376, /* KW_SIGNED */
KW_SIZEOF = 377, /* KW_SIZEOF */
KW_STATIC = 378, /* KW_STATIC */
KW_STATIC_ASSERT = 379, /* KW_STATIC_ASSERT */
KW_STATIC_CAST = 380, /* KW_STATIC_CAST */
KW_STRUCT = 381, /* KW_STRUCT */
KW_TEMPLATE = 382, /* KW_TEMPLATE */
KW_THREAD_LOCAL = 383, /* KW_THREAD_LOCAL */
KW_THROW = 384, /* KW_THROW */
KW_TRUE = 385, /* KW_TRUE */
KW_TRY = 386, /* KW_TRY */
KW_TYPEDEF = 387, /* KW_TYPEDEF */
KW_TYPEID = 388, /* KW_TYPEID */
KW_TYPENAME = 389, /* KW_TYPENAME */
KW_UNDERLYING_TYPE = 390, /* KW_UNDERLYING_TYPE */
KW_UNION = 391, /* KW_UNION */
KW_UNSIGNED = 392, /* KW_UNSIGNED */
KW_USING = 393, /* KW_USING */
KW_VIRTUAL = 394, /* KW_VIRTUAL */
KW_VOID = 395, /* KW_VOID */
KW_VOLATILE = 396, /* KW_VOLATILE */
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
/* Tokens. */
/* Token kinds. */
#define YYEMPTY -2
#define YYEOF 0
#define YYerror 256
#define YYUNDEF 257
#define REAL 258
#define INTEGER 259
#define CHAR_TOK 260
@ -359,6 +369,8 @@ struct YYLTYPE
int cppyyparse (void);
#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_specifier
| attribute_specifier ',' attribute_specifiers
@ -1777,11 +1784,11 @@ template_formal_parameter_type:
instance_identifier:
name_no_final
name_no_final optional_attributes
{
$$ = new CPPInstanceIdentifier($1);
}
| KW_OPERATOR function_operator
| KW_OPERATOR function_operator optional_attributes
{
// For an operator function. We implement this simply by building a
// ficticious name for the function; in other respects it's just
@ -1795,7 +1802,7 @@ instance_identifier:
$$ = new CPPInstanceIdentifier(ident);
}
| KW_OPERATOR SIMPLE_STRING IDENTIFIER
| KW_OPERATOR SIMPLE_STRING IDENTIFIER optional_attributes
{
// A C++11 literal operator.
if (!$2.empty()) {
@ -1820,27 +1827,27 @@ instance_identifier:
$$ = $2;
$$->add_modifier(IIT_volatile);
}
| '*' 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
| '*' optional_attributes instance_identifier %prec UNARY
{
$$ = $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);
}
| instance_identifier '[' optional_const_expr ']'
| instance_identifier '[' optional_const_expr ']' optional_attributes
{
$$ = $1;
$$->add_array_modifier($3);
@ -2162,7 +2169,7 @@ not_paren_formal_parameter_identifier:
{
$$ = new CPPInstanceIdentifier(nullptr);
}
| name_no_final
| name_no_final optional_attributes
{
$$ = new CPPInstanceIdentifier($1);
}
@ -2176,27 +2183,27 @@ not_paren_formal_parameter_identifier:
$$ = $2;
$$->add_modifier(IIT_volatile);
}
| '*' 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
| '*' optional_attributes not_paren_formal_parameter_identifier %prec UNARY
{
$$ = $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);
}
| not_paren_formal_parameter_identifier '[' optional_const_expr ']'
| not_paren_formal_parameter_identifier '[' optional_const_expr ']' optional_attributes
{
$$ = $1;
$$->add_array_modifier($3);
@ -2208,7 +2215,7 @@ formal_parameter_identifier:
{
$$ = new CPPInstanceIdentifier(nullptr);
}
| name_no_final
| name_no_final optional_attributes
{
$$ = new CPPInstanceIdentifier($1);
}
@ -2222,27 +2229,27 @@ formal_parameter_identifier:
$$ = $2;
$$->add_modifier(IIT_volatile);
}
| '*' 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
| '*' optional_attributes formal_parameter_identifier %prec UNARY
{
$$ = $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);
}
| formal_parameter_identifier '[' optional_const_expr ']'
| formal_parameter_identifier '[' optional_const_expr ']' optional_attributes
{
$$ = $1;
$$->add_array_modifier($3);
@ -2266,7 +2273,7 @@ parameter_pack_identifier:
$$ = new CPPInstanceIdentifier(nullptr);
$$->_packed = true;
}
| ELLIPSIS name
| ELLIPSIS name optional_attributes
{
$$ = new CPPInstanceIdentifier($2);
$$->_packed = true;
@ -2281,27 +2288,27 @@ parameter_pack_identifier:
$$ = $2;
$$->add_modifier(IIT_volatile);
}
| '*' 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
| '*' optional_attributes parameter_pack_identifier %prec UNARY
{
$$ = $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);
}
| parameter_pack_identifier '[' optional_const_expr ']'
| parameter_pack_identifier '[' optional_const_expr ']' optional_attributes
{
$$ = $1;
$$->add_array_modifier($3);
@ -2329,7 +2336,7 @@ not_paren_empty_instance_identifier:
$$ = new CPPInstanceIdentifier(nullptr);
$$->_packed = true;
}
| ELLIPSIS name
| ELLIPSIS name optional_attributes
{
$$ = new CPPInstanceIdentifier($2);
$$->_packed = true;
@ -2344,27 +2351,27 @@ not_paren_empty_instance_identifier:
$$ = $2;
$$->add_modifier(IIT_volatile);
}
| '*' 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
| '*' optional_attributes not_paren_empty_instance_identifier %prec UNARY
{
$$ = $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);
}
| not_paren_empty_instance_identifier '[' optional_const_expr ']'
| not_paren_empty_instance_identifier '[' optional_const_expr ']' optional_attributes
{
$$ = $1;
$$->add_array_modifier($3);
@ -2381,7 +2388,7 @@ empty_instance_identifier:
$$ = new CPPInstanceIdentifier(nullptr);
$$->_packed = true;
}
| ELLIPSIS name
| ELLIPSIS name optional_attributes
{
$$ = new CPPInstanceIdentifier($2);
$$->_packed = true;
@ -2396,27 +2403,27 @@ empty_instance_identifier:
$$ = $2;
$$->add_modifier(IIT_volatile);
}
| '*' 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
| '*' optional_attributes not_paren_empty_instance_identifier %prec UNARY
{
$$ = $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);
}
| not_paren_empty_instance_identifier '[' optional_const_expr ']'
| not_paren_empty_instance_identifier '[' optional_const_expr ']' optional_attributes
{
$$ = $1;
$$->add_array_modifier($3);
@ -2427,26 +2434,26 @@ empty_instance_identifier:
$$->add_modifier(IIT_paren);
$$->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_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_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_paren);
$$->add_func_modifier($6, $8, $9);
$$->add_func_modifier($7, $9, $10);
}
;