Warning, /libraries/twine2/kbindinggenerator/cpp_grammer.txt is written in an unsupported language. File is not indexed.
0001 0002 precedence = (('right','UMINUS'), ) 0003 """declarations : member 0004 | member_list member""" 0005 0006 """member : namespace_decl 0007 | class_decl 0008 | enum_decl 0009 | typedef_decl 0010 | q_declare_flags 0011 | function_decl 0012 | variable_decl 0013 | template_decl 0014 | skip_macro""" 0015 0016 """member_list : member 0017 | member_list member""" 0018 0019 'namespace_decl : namespace_name LBRACE member_list RBRACE' 0020 0021 'namespace_decl : namespace_name LBRACE RBRACE' 0022 0023 'namespace_decl : namespace LBRACE member_list RBRACE' 0024 0025 'namespace_name : namespace ID' 0026 0027 'empty :' 0028 0029 """decl_end : SEMI 0030 | inline_code""" 0031 0032 """class_decl : class_header class_member_list RBRACE decl_end 0033 | opaque_class 0034 | class_header RBRACE decl_end""" 0035 0036 'class_decl : class_header class_member_list RBRACE id_list decl_end' 0037 0038 """class_member : class_decl 0039 | enum_decl 0040 | typedef_decl 0041 | q_declare_flags 0042 | access_specifier 0043 | function_decl 0044 | variable_decl 0045 | template_decl 0046 | skip_macro""" 0047 0048 """access_specifier : public COLON 0049 | public slots COLON 0050 | protected COLON 0051 | protected slots COLON 0052 | private COLON 0053 | private slots COLON 0054 | signals COLON 0055 | slots COLON""" 0056 0057 """base_access_specifier : public 0058 | protected 0059 | private""" 0060 0061 """class_member_list : class_member 0062 | class_member_list class_member""" 0063 0064 """class_header : class_name LBRACE 0065 | class_name COLON base_list LBRACE 0066 | class_from_typedef""" 0067 0068 """class_header : union LBRACE 0069 | struct LBRACE""" 0070 0071 """class_name : class ID 0072 | struct ID 0073 | union ID 0074 | class template_type""" 0075 0076 'opaque_class : class_name SEMI' 0077 0078 """base_list_element : base_access_specifier qualified_id 0079 | base_access_specifier template_type""" 0080 0081 """base_list_element : virtual base_access_specifier qualified_id 0082 | virtual base_access_specifier template_type""" 0083 0084 'base_list_element : qualified_id' 0085 0086 """base_list : base_list_element 0087 | base_list COMMA base_list_element""" 0088 0089 'enum_decl : enum_statement SEMI' 0090 0091 'enum_decl : enum_statement id_list SEMI' 0092 0093 """enum_statement : enum_name enumerator_list RBRACE 0094 | enum_name RBRACE""" 0095 0096 """enum_name : enum ID LBRACE 0097 | enum LBRACE""" 0098 0099 'enum_name : enum_from_typedef' 0100 0101 """enumerator : ID 0102 | ID EQUALS expression""" 0103 0104 0105 """enumerator : DOC ID 0106 | DOC ID EQUALS expression""" 0107 0108 0109 """enumerator : ID UPDOC 0110 | ID EQUALS expression UPDOC""" 0111 0112 0113 """enumerator_list : enumerator 0114 | enumerator_list enum_delim enumerator 0115 | enumerator_list UPDOC""" 0116 0117 """enum_delim : COMMA 0118 | COMMA UPDOC""" 0119 0120 'enum_delim : COMMA UPDOC DOC' 0121 0122 """enum_delim : COMMA DOC 0123 | DOC COMMA""" 0124 0125 'id_list_element : ID' 0126 0127 """id_list_element : ASTERISK ID 0128 | AMPERSAND ID""" 0129 0130 """id_list : id_list_element 0131 | id_list COMMA id_list_element""" 0132 0133 """qualified_id : ID 0134 | nested_name_specifier""" 0135 0136 """nested_name_specifier : ID COLON2 ID 0137 | nested_name_specifier COLON2 ID 0138 | template_type COLON2 ID""" 0139 0140 'nested_name_specifier : COLON2 ID' 0141 0142 """template_type : qualified_id LT type_specifier_list GT 0143 | qualified_id LT static_cast_expression GT""" 0144 0145 0146 """elaborated_type : enum qualified_id 0147 | class qualified_id 0148 | struct qualified_id 0149 | union qualified_id 0150 | typename qualified_id""" 0151 0152 """type_specifier_base : qualified_id 0153 | template_type 0154 | elaborated_type 0155 | int 0156 | unsigned int 0157 | signed int 0158 | char 0159 | unsigned char 0160 | signed char 0161 | float 0162 | double 0163 | long 0164 | long int 0165 | unsigned long 0166 | unsigned long int 0167 | long unsigned int 0168 | signed long 0169 | signed long int 0170 | long long 0171 | unsigned long long 0172 | signed long long 0173 | signed long long int 0174 | short 0175 | unsigned short 0176 | signed short 0177 | short int 0178 | unsigned short int 0179 | signed short int 0180 | unsigned 0181 | signed 0182 | bool 0183 | void 0184 | wchar_t""" 0185 0186 'type_specifier : type_specifier_base ' 0187 0188 'type_specifier : CVQUAL type_specifier_base' 0189 0190 'type_specifier : type_specifier_base type_decorator' 0191 0192 'type_specifier : CVQUAL type_specifier_base type_decorator' 0193 0194 'type_specifier : type_specifier_base CVQUAL type_decorator' 0195 0196 """type_decorator : ASTERISK 0197 | AMPERSAND 0198 | ASTERISK CVQUAL 0199 | ASTERISK AMPERSAND 0200 | ASTERISK ASTERISK 0201 | ASTERISK ASTERISK ASTERISK 0202 | ARRAYOP""" 0203 0204 """type_specifier_list : type_specifier 0205 | type_specifier_list COMMA type_specifier""" 0206 0207 """typedef_decl : typedef_simple SEMI 0208 | typedef_elaborated SEMI 0209 | typedef_function_ptr SEMI""" 0210 0211 'typedef_simple : typedef type_specifier ID' 0212 0213 'typedef_simple : typedef type_specifier ID ARRAYOP' 0214 0215 'q_declare_flags_name : Q_DECLARE_FLAGS LPAREN ID COMMA ID' 0216 0217 'q_declare_flags : q_declare_flags_name RPAREN' 0218 0219 """typedef_elaborated : typedef class qualified_id ID 0220 | typedef struct qualified_id ID 0221 | typedef union qualified_id ID 0222 | typedef enum qualified_id ID""" 0223 0224 """class_from_typedef : typedef class ID LBRACE 0225 | typedef struct ID LBRACE 0226 | typedef union ID LBRACE""" 0227 0228 """class_from_typedef : typedef struct LBRACE 0229 | typedef union LBRACE""" 0230 0231 """enum_from_typedef : typedef enum ID LBRACE 0232 | typedef enum LBRACE""" 0233 0234 """pointer_to_function_pfx : ASTERISK FUNCPTR 0235 | type_specifier FUNCPTR""" 0236 0237 'pointer_to_function_name : pointer_to_function_pfx ID' 0238 0239 """pointer_to_function_args : RPAREN LPAREN type_specifier_list 0240 | RPAREN LPAREN empty""" 0241 0242 'pointer_to_function : pointer_to_function_name pointer_to_function_args RPAREN' 0243 0244 'typedef_function_ptr : typedef pointer_to_function' 0245 0246 'array_variable : ID ARRAYOP' 0247 0248 """argument_specifier : type_specifier 0249 | ELLIPSIS""" 0250 0251 """argument_specifier : type_specifier ID 0252 | type_specifier array_variable""" 0253 0254 'argument_specifier : type_specifier EQUALS expression' 0255 0256 """argument_specifier : type_specifier ID EQUALS expression 0257 | type_specifier array_variable EQUALS expression""" 0258 0259 'argument_specifier : pointer_to_function' 0260 0261 """argument_list : argument_specifier""" 0262 # | type_specifier""" 0263 0264 """argument_list : argument_list COMMA argument_specifier 0265 | argument_list COMMA type_specifier""" 0266 0267 'decl_starter : type_specifier qualified_id' 0268 0269 'decl_starter : STORAGE type_specifier qualified_id' 0270 0271 'variable_decl : decl_starter SEMI' 0272 0273 'variable_decl : argument_specifier SEMI' 0274 0275 'variable_decl : STORAGE argument_specifier SEMI' 0276 0277 'variable_decl : type_specifier id_list SEMI' 0278 0279 'variable_decl : STORAGE type_specifier id_list SEMI' 0280 0281 'variable_decl : type_specifier CVQUAL ID SEMI' 0282 0283 'variable_decl : type_specifier ID COLON ICONST SEMI' 0284 0285 'variable_decl : pointer_to_function SEMI' 0286 0287 'function_name : decl_starter LPAREN' 0288 0289 'operator_pfx : type_specifier operator' 0290 0291 """operator_name : operator_pfx PLUS LPAREN 0292 | operator_pfx MINUS LPAREN 0293 | operator_pfx ASTERISK LPAREN 0294 | operator_pfx SLASH LPAREN 0295 | operator_pfx PERCENT LPAREN 0296 | operator_pfx VBAR LPAREN 0297 | operator_pfx AMPERSAND LPAREN 0298 | operator_pfx LT LPAREN 0299 | operator_pfx LT LT LPAREN 0300 | operator_pfx GT LPAREN 0301 | operator_pfx GT GT LPAREN 0302 | operator_pfx LOR LPAREN 0303 | operator_pfx LAND LPAREN 0304 | operator_pfx BANG LPAREN 0305 | operator_pfx LE LPAREN 0306 | operator_pfx GE LPAREN 0307 | operator_pfx EQ LPAREN 0308 | operator_pfx EQUALS LPAREN 0309 | operator_pfx TIMESEQUAL LPAREN 0310 | operator_pfx DIVEQUAL LPAREN 0311 | operator_pfx MODEQUAL LPAREN 0312 | operator_pfx PLUSEQUAL LPAREN 0313 | operator_pfx MINUSEQUAL LPAREN 0314 | operator_pfx LSHIFTEQUAL LPAREN 0315 | operator_pfx GT GE LPAREN 0316 | operator_pfx ANDEQUAL LPAREN 0317 | operator_pfx OREQUAL LPAREN 0318 | operator_pfx XOREQUAL LPAREN 0319 | operator_pfx PLUSPLUS LPAREN 0320 | operator_pfx MINUSMINUS LPAREN 0321 | operator_pfx ARRAYOP LPAREN 0322 | operator_pfx LPAREN RPAREN LPAREN 0323 | operator_pfx ARROW LPAREN 0324 | operator_pfx NE LPAREN""" 0325 0326 'cast_operator_name : operator type_specifier LPAREN RPAREN' 0327 0328 'cast_operator_name : operator type_specifier LPAREN RPAREN CVQUAL' 0329 0330 """cast_operator_stmt : cast_operator_name decl_end 0331 | virtual cast_operator_name decl_end""" 0332 0333 """operator_primary : operator_name argument_list RPAREN 0334 | operator_name RPAREN""" 0335 0336 """operator_primary : virtual operator_name argument_list RPAREN 0337 | virtual operator_name RPAREN""" 0338 0339 """operator_stmt : operator_primary decl_end 0340 | operator_primary pure_virtual_suffix decl_end""" 0341 0342 """operator_stmt : operator_primary CVQUAL decl_end 0343 | operator_primary CVQUAL pure_virtual_suffix""" 0344 0345 'ctor_name : qualified_id LPAREN' 0346 0347 'ctor_name : explicit qualified_id LPAREN' 0348 0349 'dtor_name : TILDE ID' 0350 0351 'virtual_dtor_name : virtual dtor_name' 0352 0353 """function_decl : ctor_stmt 0354 | dtor_stmt 0355 | function_stmt 0356 | operator_stmt 0357 | cast_operator_stmt 0358 | virtual_stmt 0359 | pure_virtual""" 0360 0361 """function_primary : function_name RPAREN 0362 | function_name argument_list RPAREN""" 0363 0364 'function_stmt : function_primary decl_end' 0365 0366 'function_stmt : function_primary CVQUAL decl_end' 0367 0368 """ctor_primary : ctor_name RPAREN 0369 | ctor_name argument_list RPAREN""" 0370 0371 """ctor_initializer : qualified_id LPAREN expression_list RPAREN 0372 | qualified_id LPAREN RPAREN 0373 | template_type LPAREN expression_list RPAREN 0374 | template_type LPAREN RPAREN""" 0375 0376 """ctor_initializer_list : ctor_initializer 0377 | ctor_initializer_list COMMA ctor_initializer""" 0378 0379 0380 """ctor_stmt : ctor_primary decl_end 0381 | ctor_primary COLON ctor_initializer_list decl_end""" 0382 0383 'dtor_primary : dtor_name LPAREN RPAREN' 0384 0385 'dtor_primary : virtual_dtor_name LPAREN RPAREN' 0386 0387 'dtor_stmt : dtor_primary decl_end' 0388 0389 """virtual_primary : virtual function_name RPAREN 0390 | virtual function_name argument_list RPAREN""" 0391 0392 'virtual_stmt : virtual_primary decl_end' 0393 0394 'virtual_stmt : virtual_primary CVQUAL decl_end' 0395 0396 'pure_virtual_suffix : EQUALS PURESFX' 0397 0398 """pure_virtual : virtual_primary pure_virtual_suffix 0399 | virtual_primary CVQUAL pure_virtual_suffix""" 0400 0401 """template_param : type_specifier 0402 | type_specifier ID""" 0403 0404 """template_param_list : template_param 0405 | template_param_list COMMA template_param""" 0406 0407 'template_decl : template LT template_param_list GT' 0408 0409 # def p_skip_macro (self, p): 0410 # 'skip_macro : MACROCALL MACROBODY' 0411 # pass 0412 0413 """expression_list : expression 0414 | expression_list COMMA expression""" 0415 0416 """expression : add_expression 0417 | sub_expression 0418 | mult_expression 0419 | div_expression 0420 | mod_expression 0421 | unary_expression 0422 | or_expression 0423 | and_expression 0424 | xor_expression 0425 | bitor_expression 0426 | bitand_expression 0427 | lt_expression 0428 | le_expression 0429 | eq_expression 0430 | ge_expression 0431 | gt_expression 0432 | lshift_expression 0433 | rshift_expression 0434 | ptr_expression 0435 | dot_expression 0436 | new_expression 0437 | static_cast_expression 0438 | ICONST 0439 | FCONST 0440 | HEXCONST 0441 | CCONST 0442 | SCONST""" 0443 0444 'expression : LPAREN expression RPAREN' 0445 0446 'expression : qualified_id' 0447 0448 """expression : type_specifier LPAREN expression_list RPAREN 0449 | type_specifier LPAREN RPAREN""" 0450 0451 """expression : type_specifier PERIOD ID LPAREN expression_list RPAREN 0452 | type_specifier PERIOD ID LPAREN RPAREN""" 0453 0454 'expression : type_specifier PERIOD ID' 0455 0456 """expression_list : expression 0457 | expression_list COMMA expression""" 0458 0459 """unary_expression : sign_expression 0460 | not_expression 0461 | bitnot_expression 0462 | new_expression""" 0463 0464 'add_expression : expression PLUS expression' 0465 0466 'sub_expression : expression MINUS expression' 0467 0468 'mult_expression : expression ASTERISK expression' 0469 0470 'div_expression : expression SLASH expression' 0471 0472 'mod_expression : expression PERCENT expression' 0473 0474 'sign_expression : MINUS expression %prec UMINUS' 0475 0476 'or_expression : expression LOR expression' 0477 0478 'and_expression : expression LAND expression' 0479 0480 'xor_expression : expression CARET expression' 0481 0482 'bitor_expression : expression VBAR expression' 0483 0484 'bitand_expression : expression AMPERSAND expression' 0485 0486 'lt_expression : expression LT expression' 0487 0488 'le_expression : expression LE expression' 0489 0490 'eq_expression : expression EQ expression' 0491 0492 'ge_expression : expression GE expression' 0493 0494 'gt_expression : expression GT expression' 0495 0496 'lshift_expression : expression GT GT expression' 0497 0498 'rshift_expression : expression LT LT expression' 0499 0500 'not_expression : BANG expression' 0501 0502 'bitnot_expression : TILDE expression' 0503 0504 'new_expression : new expression' 0505 0506 'static_cast_expression : static_cast LT type_specifier GT LPAREN expression RPAREN' 0507 0508 'ptr_expression : expression ARROW expression' 0509 0510 'dot_expression : expression PERIOD expression' 0511 0512 """inline_code : STMT_BEGIN code_list STMT_END 0513 | STMT_BEGIN code_list STMT_END SEMI 0514 | STMT_BEGIN STMT_END 0515 | STMT_BEGIN STMT_END SEMI""" 0516 0517 """code_list_block : CODE_STMT_BEGIN code_list STMT_END 0518 | CODE_STMT_BEGIN STMT_END""" 0519 0520 """code_list : CODE_TOKEN 0521 | code_list_block 0522 | code_list code_list_block 0523 | code_list CODE_TOKEN""" 0524 0525 0526 'skip_macro : MACROCALL MACRO_CALL_BEGIN macro_call_element_list MACRO_CALL_END' 0527 0528 """macro_call_parens : LPAREN RPAREN 0529 | LPAREN macro_call_element_list RPAREN""" 0530 0531 'macro_call_element_list : MACRO_ELEMENT' 0532 0533 'macro_call_element_list : macro_call_element_list MACRO_ELEMENT' 0534 0535 'macro_call_element_list : macro_call_element_list macro_call_parens' 0536 0537 'macro_call_element_list : macro_call_parens' 0538 0539 0540 0541 =========================================================================== 0542 Typedef Enum: 0543 0544 """enum_statement : enum_name enumerator_list RBRACE 0545 | enum_name RBRACE""" 0546 0547 'enum_name : enum_from_typedef' 0548 """enum_from_typedef : typedef enum ID LBRACE 0549 | typedef enum LBRACE""" 0550 0551 """enumerator_list : enumerator 0552 | enumerator_list enum_delim enumerator 0553 | enumerator_list UPDOC""" 0554 0555 =========================================================================== 0556 Templates: 0557 0558 """template_type : qualified_id LT type_specifier_list GT 0559 | qualified_id LT static_cast_expression GT""" 0560 0561 """template_param : type_specifier 0562 | type_specifier ID""" 0563 0564 """template_param_list : template_param 0565 | template_param_list COMMA template_param""" 0566 0567 'template_decl : template LT template_param_list GT'