📄 simple-c.y
字号:
any_word : identifier | scspec | TYPESPEC | TYPE_QUAL ;scspec : STATIC | SCSPEC ;init : expr_no_commas | ' initlist_maybe_comma '}' | error ;initlist_maybe_comma : | initlist1 maybecomma ;initlist1 : initelt | initlist1 ',' initelt ;initelt : designator_list '=' initval | array_designator initval | identifier ':' initval | initval ;initval : ' initlist_maybe_comma '}' | expr_no_commas | error ;designator_list : designator | designator_list designator ;designator : '.' identifier | array_designator ;array_designator : '[' expr_no_commas ELLIPSIS expr_no_commas ']' | '[' expr_no_commas ']' ;nested_function : declarator } old_style_parm_decls save_location compstmt ;notype_nested_function : notype_declarator } old_style_parm_decls save_location compstmt ;declarator : after_type_declarator | notype_declarator ;after_type_declarator : '(' maybe_attribute after_type_declarator ')' | after_type_declarator '(' parmlist_or_identifiers %prec '.' | after_type_declarator array_declarator %prec '.' | '*' maybe_type_quals_attrs after_type_declarator %prec UNARY | TYPENAME ;parm_declarator : parm_declarator_starttypename | parm_declarator_nostarttypename ;parm_declarator_starttypename : parm_declarator_starttypename '(' parmlist_or_identifiers %prec '.' | parm_declarator_starttypename array_declarator %prec '.' | TYPENAME ;parm_declarator_nostarttypename : parm_declarator_nostarttypename '(' parmlist_or_identifiers %prec '.' | parm_declarator_nostarttypename array_declarator %prec '.' | '*' maybe_type_quals_attrs parm_declarator_starttypename %prec UNARY | '*' maybe_type_quals_attrs parm_declarator_nostarttypename %prec UNARY | '(' maybe_attribute parm_declarator_nostarttypename ')' ;notype_declarator : notype_declarator '(' parmlist_or_identifiers %prec '.' | '(' maybe_attribute notype_declarator ')' | '*' maybe_type_quals_attrs notype_declarator %prec UNARY | notype_declarator array_declarator %prec '.' | IDENTIFIER ;struct_head : STRUCT | STRUCT attributes ;union_head : UNION | UNION attributes ;enum_head : ENUM | ENUM attributes ;structsp_attr : struct_head identifier ' component_decl_list '}' maybe_attribute | struct_head ' | union_head identifier ' component_decl_list '}' maybe_attribute | union_head ' | enum_head identifier ' enumlist maybecomma_warn '}' maybe_attribute | enum_head ' enumlist maybecomma_warn '}' maybe_attribute ;structsp_nonattr : struct_head identifier | union_head identifier | enum_head identifier ;maybecomma : | ',' ;maybecomma_warn : | ',' ;component_decl_list : component_decl_list2 | component_decl_list2 component_decl ;component_decl_list2 : | component_decl_list2 ';';component_decl : declspecs_nosc_ts setspecs components | declspecs_nosc_ts setspecs | declspecs_nosc_nots setspecs components_notype | declspecs_nosc_nots | error | extension component_decl ;components : component_declarator | components ',' maybe_resetattrs component_declarator ;components_notype : component_notype_declarator | components_notype ',' maybe_resetattrs component_notype_declarator ;component_declarator : declarator maybe_attribute | declarator ':' expr_no_commas maybe_attribute | ':' expr_no_commas maybe_attribute ;component_notype_declarator : notype_declarator maybe_attribute | notype_declarator ':' expr_no_commas maybe_attribute | ':' expr_no_commas maybe_attribute ;enumlist : enumerator | enumlist ',' enumerator | error ;enumerator : identifier | identifier '=' expr_no_commas ;typename : declspecs_nosc absdcl ;absdcl : ;absdcl_maybe_attribute : | absdcl1_noea attributes ;absdcl1 : | absdcl1_noea ;absdcl1_noea : direct_absdcl1 | '*' maybe_type_quals_attrs absdcl1_noea ;absdcl1_ea : '*' maybe_type_quals_attrs | '*' maybe_type_quals_attrs absdcl1_ea ;direct_absdcl1 : '(' maybe_attribute absdcl1 ')' | direct_absdcl1 '(' parmlist | direct_absdcl1 array_declarator | '(' parmlist | array_declarator ;array_declarator : '[' maybe_type_quals_attrs expr_no_commas ']' | '[' maybe_type_quals_attrs ']' | '[' maybe_type_quals_attrs '*' ']' | '[' STATIC maybe_type_quals_attrs expr_no_commas ']' | '[' declspecs_nosc_nots STATIC expr_no_commas ']' ;stmts_and_decls : lineno_stmt_decl_or_labels_ending_stmt | lineno_stmt_decl_or_labels_ending_decl | lineno_stmt_decl_or_labels_ending_label | lineno_stmt_decl_or_labels_ending_error ;lineno_stmt_decl_or_labels_ending_stmt : lineno_stmt | lineno_stmt_decl_or_labels_ending_stmt lineno_stmt | lineno_stmt_decl_or_labels_ending_decl lineno_stmt | lineno_stmt_decl_or_labels_ending_label lineno_stmt | lineno_stmt_decl_or_labels_ending_error lineno_stmt ;lineno_stmt_decl_or_labels_ending_decl : lineno_decl | lineno_stmt_decl_or_labels_ending_stmt lineno_decl | lineno_stmt_decl_or_labels_ending_decl lineno_decl | lineno_stmt_decl_or_labels_ending_error lineno_decl ;lineno_stmt_decl_or_labels_ending_label : lineno_label | lineno_stmt_decl_or_labels_ending_stmt lineno_label | lineno_stmt_decl_or_labels_ending_decl lineno_label | lineno_stmt_decl_or_labels_ending_label lineno_label | lineno_stmt_decl_or_labels_ending_error lineno_label ;lineno_stmt_decl_or_labels_ending_error : errstmt | lineno_stmt_decl_or_labels errstmt ;lineno_stmt_decl_or_labels : lineno_stmt_decl_or_labels_ending_stmt | lineno_stmt_decl_or_labels_ending_decl | lineno_stmt_decl_or_labels_ending_label | lineno_stmt_decl_or_labels_ending_error ;errstmt : ;c99_block_start : maybe_label_decls: | label_decls ;label_decls : label_decl | label_decls label_decl ;label_decl : LABEL identifiers_or_typenames ';'};compstmt_or_error : compstmt | error compstmt ;compstmt_start : compstmt_nostart: '}' | maybe_label_decls compstmt_contents_nonempty '}' ;compstmt_contents_nonempty : stmts_and_decls | error ;compstmt_primary_start: '(' '{' ;compstmt : ;save_location : ;lineno_labels : | lineno_labels lineno_label ;c99_block_lineno_labeled_stmt : c99_block_start lineno_labels lineno_stmt ;lineno_stmt : save_location stmt ;lineno_label : save_location label ;condition : ;if_statement_1 : c99_block_start lineno_labels if_statement ;if_statement_2 : c99_block_start lineno_labels ';' | c99_block_lineno_labeled_stmt ;if_statement : IF c99_block_start save_location '(' condition ')' if_statement_1 ELSE if_statement_2 | IF c99_block_start save_location '(' condition ')' if_statement_2 ELSE if_statement_2 | IF c99_block_start save_location '(' condition ')' if_statement_1 %prec IF | IF c99_block_start save_location '(' condition ')' if_statement_2 %prec IF ;start_break : start_continue: ;while_statement : WHILE c99_block_start save_location '(' condition ')' start_break start_continue c99_block_lineno_labeled_stmt ;do_statement : DO c99_block_start save_location start_break start_continue c99_block_lineno_labeled_stmt WHILE '(' condition ')' ';';xexpr : | expr ;for_init_stmt : xexpr ';'| decl;for_cond_expr : else $$ = NULL;};for_incr_expr : ;for_statement : FOR c99_block_start '(' for_init_stmt save_location for_cond_expr ';' for_incr_expr ')'start_break start_continue c99_block_lineno_labeled_stmt;switch_statement : SWITCH c99_block_start '(' expr ')' start_break c99_block_lineno_labeled_stmt ;stmt_nocomp : expr ';' | if_statement | while_statement | do_statement | for_statement | switch_statement | BREAK ';' | CONTINUE ';' | RETURN ';' | RETURN expr ';' | asm_stmt | GOTO identifier ';' | GOTO '*' expr ';' | ';' ;stmt : compstmt | stmt_nocomp ;label : CASE expr_no_commas ':' | CASE expr_no_commas ELLIPSIS expr_no_commas ':' | DEFAULT ':' | identifier save_location ':' maybe_attribute ;simple_asm_expr : ASM_KEYWORD stop_string_translation '(' asm_string ')' start_string_translation ;maybeasm : | simple_asm_expr ;asmdef : simple_asm_expr ';' | ASM_KEYWORD error start_string_translation ';' ;asm_stmt : ASM_KEYWORD maybe_volatile stop_string_translation '(' asm_argument ')' start_string_translation ';' ;asm_argument : asm_string | asm_string ':' asm_operands | asm_string ':' asm_operands ':' asm_operands | asm_string ':' asm_operands ':' asm_operands ':' asm_clobbers ;maybe_volatile: /* empty */ | TYPE_QUAL ;asm_operands : ;nonnull_asm_operands : asm_operand | nonnull_asm_operands ',' asm_operand ;asm_operand : asm_string start_string_translation '(' expr ')' stop_string_translation | '[' identifier ']' asm_string start_string_translation '(' expr ')' stop_string_translation ;asm_clobbers : asm_string | asm_clobbers ',' asm_string ;asm_string : STRING else $$ = $1; };stop_string_translation : ;start_string_translation : ;parmlist : maybe_attribute parmlist_1 ;parmlist_1 : parmlist_2 ')' | parms ';'maybe_attributeparmlist_1| error ')';parmlist_2 : | parms | parms ',' ELLIPSIS ;parms : firstparm | parms ',' parm ;parm : declspecs_ts setspecs parm_declarator maybe_attribute | declspecs_ts setspecs notype_declarator maybe_attribute | declspecs_ts setspecs absdcl_maybe_attribute | declspecs_nots setspecs notype_declarator maybe_attribute | declspecs_nots setspecs absdcl_maybe_attribute ;firstparm : declspecs_ts_nosa setspecs_fp parm_declarator maybe_attribute | declspecs_ts_nosa setspecs_fp notype_declarator maybe_attribute | declspecs_ts_nosa setspecs_fp absdcl_maybe_attribute | declspecs_nots_nosa setspecs_fp notype_declarator maybe_attribute | declspecs_nots_nosa setspecs_fp absdcl_maybe_attribute ;setspecs_fp : setspecs ;parmlist_or_identifiers : maybe_attribute parmlist_or_identifiers_1 ;parmlist_or_identifiers_1 : parmlist_1 | identifiers ')' ;identifiers : IDENTIFIER | identifiers ',' IDENTIFIER ;identifiers_or_typenames : identifier | identifiers_or_typenames ',' identifier ;extension : EXTENSION ;%%
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -