?? pas.y.old
字號(hào):
$$->AdoptChildren (1, FIXED_PART_LABEL, orphans); } | fixed_part ';' variant_part { $$ = new syntaxNode (FIELD_LIST_LABEL); orphans[0] = $1; orphans[1] = $3; $$->AdoptChildren (2, FIXED_VARIANT_LABEL, orphans); } | variant_part { $$ = new syntaxNode (FIELD_LIST_LABEL); orphans[0] = $1; $$->AdoptChildren (1, VARIANT_PART_LABEL, orphans); } ;fixed_part : fixed_part ';' record_section { $$ = new syntaxNode (FIXED_PART_LABEL); orphans[0] = $1; orphans[1] = $3; $$->AdoptChildren (2, FIXED_RECORD_LABEL, orphans); } | record_section { $$ = new syntaxNode (FIXED_PART_LABEL); orphans[0] = $1; $$->AdoptChildren (1, RECORD_SECTION_LABEL, orphans); } ;record_section : { its_a = ITS_A_FIELD; } newident_list ':' type { $$ = new syntaxNode (RECORD_SECTION_LABEL); orphans[0] = $2; orphans[3] = $4; $$->AdoptChildren (2, NEW_IDENT_COLON_TYPE_LABEL, orphans); } | /*empty*/ { $$ = new syntaxNode (RECORD_SECTION_LABEL); $$->AdoptChildren (0, EMPTY_RECORD_SECTION, orphans); } ;variant_part : CASE { its_a = ITS_A_FIELD; } tag_field OF variants { $$ = new syntaxNode (VARIANT_PART_LABEL); orphans[0] = $3; orphans[3] = $5; $$->AdoptChildren (2, CASE_TAG_OF_VARIANT_LABEL, orphans); } ;tag_field : newident ':' ident { $$ = new syntaxNode (TAG_FIELD_LABEL); orphans[0] = $1; orphans[3] = $3; $$->AdoptChildren (2, NEWIDENT_COLON_IDENT_LABEL, orphans); } | ident /*type*/ { $$ = new syntaxNode (TAG_FIELD_LABEL); orphans[0] = $1; $$->AdoptChildren (1, IDENT_LABEL, orphans); } ;variants : variants ';' variant { $$ = new syntaxNode (VARIANTS_LABEL); orphans[0] = $1; orphans[3] = $3; $$->AdoptChildren (2, VARIANTS_VARIANT_LABEL, orphans); } | variant { $$ = new syntaxNode (VARIANTS_LABEL); orphans[0] = $1; $$->AdoptChildren (1, VARIANT_LABEL, orphans); } ;variant : case_label_list ':' '(' field_list ')' { $$ = new syntaxNode (VARIANT_LABEL); orphans[0] = $1; orphans[1] = $4; $$->AdoptChildren (2, CASE_FIELD_LIST_LABEL, orphans); } | /*empty*/ { $$ = new syntaxNode (VARIANT_LABEL); $$->AdoptChildren (0, EMPTY_VARIANT, orphans); } ;var_dcl_part : VAR variable_dcls ';' { $$ = new syntaxNode (VAR_DCL_PART_LABEL); orphans[0] = $2; $$->AdoptChildren (1, VAR_DCLS_LABEL, orphans); } ;variable_dcls : variable_dcls ';' variable_dcl { $$ = new syntaxNode (VAR_DCLS_LABEL); orphans[0] = $1; orphans[1] = $3; $$->AdoptChildren (2, VARS_VAR_LABEL, orphans); } | variable_dcl { $$ = new syntaxNode (VAR_DCLS_LABEL); orphans[0] = $1; $$->AdoptChildren (1, VAR_DCL_LABEL, orphans); } ;variable_dcl : { its_a = ITS_A_VARIABLE; } newident_list ':' type { $$ = new syntaxNode (VAR_DCL_LABEL); orphans[0] = $2; orphans[1] = $4; $$->AdoptChildren (2, NEWIDENT_LIST_COLON_TYPE_LABEL, orphans); } ;newident_list : new_id_list { its_a = ITS_A_DONT_KNOW; } { $$ = new syntaxNode (NEWIDENT_LIST_LABEL); orphans[0] = $1; $$->AdoptChildren (1, NEW_ID_LIST_LABEL, orphans); } ;new_id_list : new_id_list ',' newident { $$ = new syntaxNode (NEW_ID_LIST_LABEL); orphans[0] = $1; orphans[1] = $3; $$->AdoptChildren (2, NEW_IDS_ID_LABEL, orphans); } | newident { $$ = new syntaxNode (NEW_ID_LIST_LABEL); orphans[0] = $1; $$->AdoptChildren (1, NEWIDENT_LABEL, orphans); } ;proc_dcl_part : proc_or_func { $$ = new syntaxNode (PROC_DCL_PART_LABEL); orphans[0] = $1; $$->AdoptChildren (1, PROC_OR_FUNC_LABEL, orphans); } ;proc_or_func : proc_heading ';' body ';' /*check if forward or fwd refd*/ { $$ = new syntaxNode (PROC_OR_FUNC_LABEL); orphans[0] = $1; orphans[1] = $3; $$->AdoptChildren (2, PROC_HEADING_BODY_LABEL, orphans); lexical_level--; } | func_heading ';' body ';' /*also func heading may be -type */ { $$ = new syntaxNode (PROC_OR_FUNC_LABEL); orphans[0] = $1; orphans[1] = $3; $$->AdoptChildren (2, FUNC_HEADING_BODY_LABEL, orphans); lexical_level--; } ;proc_heading : PROCEDURE { if (param_level==0) its_a = ITS_A_PROCEDURE; } newident {lexical_level++;} formal_params { $$ = new syntaxNode (PROC_HEADING_LABEL); orphans[0] = $3; orphans[1] = $5; $$->AdoptChildren (2, PROC_ID_PARAMS_LABEL, orphans); } ;func_heading : FUNCTION { if (param_level==0) its_a = ITS_A_FUNCTION; } newident {lexical_level++;} function_form { $$ = new syntaxNode (FUNC_HEADING_LABEL); orphans[0] = $3; orphans[1] = $5; $$->AdoptChildren (2, FUNC_ID_FORM_LABEL, orphans); } ;function_form : /*empty*/ /*if forward referenced*/ { $$ = new syntaxNode (FUNC_FORM_LABEL); $$->AdoptChildren (0, EMPTY_FUNC_FORM, orphans); } | formal_params ':' ident { $$ = new syntaxNode (FUNC_FORM_LABEL); orphans[0] = $1; orphans[1] = $3; $$->AdoptChildren (2, FUNC_PARAMS_ID_LABEL, orphans); } ;body : block /* result determined in block */ { $$ = new syntaxNode (BODY_LABEL); orphans[0] = $1; $$->AdoptChildren (1, BLOCK_LABEL, orphans); } | IDENTIFIER /*directive-FORWARD*/ { $$ = new syntaxNode (BODY_LABEL); $$->AdoptChildren (0, IDENTIFIER, orphans); $$->SetLexeme (last_id_token); } ;formal_params : /*empty*/ { $$ = new syntaxNode (FORMAL_PARAMS_LABEL); $$->AdoptChildren (0, EMPTY_FORMAL_PARAMS, orphans); } | '(' {param_level++;} formal_p_sects ')' { param_level--; $$ = new syntaxNode (FORMAL_PARAMS_LABEL); orphans[0] = $2; $$->AdoptChildren (1, FORMAL_P_SECTS_LABEL, orphans); } ;formal_p_sects : formal_p_sects ';' formal_p_sect { $$ = new syntaxNode (FORMAL_P_SECTS_LABEL); orphans[0] = $1; orphans[1] = $3; $$->AdoptChildren (2, PSECTS_PSECT_LABEL, orphans); } | formal_p_sect { $$ = new syntaxNode (FORMAL_P_SECTS_LABEL); orphans[0] = $1; $$->AdoptChildren (1, PSECT_LABEL, orphans); } ;formal_p_sect : { its_a = ITS_A_VALUE_PARAM; } param_group { $$ = new syntaxNode (PSECT_LABEL); orphans[0] = $2; $$->AdoptChildren (1, PARAM_GROUP_LABEL, orphans); } | VAR { its_a = ITS_A_VAR_PARAM; } param_group { $$ = new syntaxNode (PSECT_LABEL); orphans[0] = $3; $$->AdoptChildren (1, VAR_PARAM_GROUP_LABEL, orphans); } | { its_a = ITS_A_PROCEDURE_PARAM; } proc_heading { lexical_level--; $$ = new syntaxNode (PROC_HEADING_LABEL); orphans[0] = $2; $$->AdoptChildren (1, PARAM_GROUP_LABEL, orphans); } | { its_a = ITS_A_FUNCTION_PARAM; } func_heading { lexical_level--; $$ = new syntaxNode (PSECT_LABEL); orphans[0] = $2; $$->AdoptChildren (1, FUNC_HEADING_LABEL, orphans); } ;param_group : newident_list ':' paramtype { $$ = new syntaxNode (PARAM_GROUP_LABEL); orphans[0] = $1; orphans[1] = $3; $$->AdoptChildren (2, NEWID_LIST_COLON_TYPE_LABEL, orphans); } ;paramtype : ident { $$ = new syntaxNode (PARAM_TYPE_LABEL); orphans[0] = $1; $$->AdoptChildren (1, IDENT_LABEL, orphans); } | ARRAY '[' index_specs ']' OF paramtype { $$ = new syntaxNode (PARAM_TYPE_LABEL); orphans[0] = $3; orphans[1] = $6; $$->AdoptChildren (2, ARRAY_OF_PARAM_TYPE, orphans); } | PACKED ARRAY '[' index_spec ']' OF ident { $$ = new syntaxNode (PARAM_TYPE_LABEL); orphans[0] = $4; orphans[1] = $7; $$->AdoptChildren (2, PACK_ARRAY_INDEX_OF_ID_LABEL, orphans); } ;index_specs : index_specs ';' index_spec { $$ = new syntaxNode (INDEX_SPECS_LABEL); orphans[0] = $1; orphans[1] = $3; $$->AdoptChildren (2, INDEX_SPECS_SPEC_LABEL, orphans); } | index_spec { $$ = new syntaxNode (INDEX_SPECS_LABEL); orphans[0] = $1; $$->AdoptChildren (1, INDEX_SPEC_LABEL, orphans); } ;index_spec : { its_a = ITS_A_CONFORMANT_BOUND; } newident DOTDOT newident ':' ident { $$ = new syntaxNode (INDEX_SPEC_LABEL); orphans[0] = $2; orphans[1] = $3; orphans[3] = $6; $$->AdoptChildren (3, NEWID_DOTDOT_NEWID_COLON_ID_LABEL, orphans); } ;statement_part : compound_stmt { $$ = new syntaxNode (STATEMENT_PART_LABEL); orphans[0] = $1; $$->AdoptChildren (1, COMPOUND_STMT_LABEL, orphans); } ;compound_stmt : SBEGIN statements END { $$ = new syntaxNode (COMPOUND_STMT_LABEL); orphans[0] = $2; $$->AdoptChildren (1, STATEMENTS_LABEL, orphans); } ;statements : statements ';' statement { $$ = new syntaxNode (STATEMENTS_LABEL); orphans[0] = $1; orphans[1] = $3; $$->AdoptChildren (2, SEQUENTIAL_COMPOSITION_LABEL, orphans); } | statement { $$ = new syntaxNode (STATEMENTS_LABEL); orphans[0] = $1; $$->AdoptChildren (1, STATEMENT_LABEL, orphans); } ;statement : /*empty*/ { $$ = new syntaxNode (STATEMENT_LABEL); $$->AdoptChildren (0, EMPTY_STATEMENT, orphans); } | label ':' statement { $$ = new syntaxNode (STATEMENT_LABEL); orphans[0] = $3; $$->AdoptChildren (1, STATEMENT_LABEL, orphans); } | compound_stmt { $$ = new syntaxNode (STATEMENT_LABEL); orphans[0] = $1; $$->AdoptChildren (1, COMPOUND_STMT_LABEL, orphans); } | assignment { $$ = new syntaxNode (STATEMENT_LABEL); orphans[0] = $1; $$->AdoptChildren (1, ASSIGNMENT_LABEL, orphans); } | procedure_call { $$ = new syntaxNode (STATEMENT_LABEL); orphans[0] = $1; $$->AdoptChildren (1, PROCEDURE_CALL_LABEL, orphans); } | GOTO label { $$ = new syntaxNode (GOTO_LABEL); $$->AdoptChildren (0, GOTO, orphans); } | IF expression THEN statement { $$ = new syntaxNode (STATEMENT_LABEL); orphans[0] = $2; orphans[1] = $4; $$->AdoptChildren (2, IF_LABEL, orphans); } | IF expression THEN statement ELSE statement { $$ = new syntaxNode (STATEMENT_LABEL); orphans[0] = $2; orphans[1] = $4; orphans[2] = $6; $$->AdoptChildren (3, IF_ELSE_LABEL, orphans); } | CASE expression OF case_list END { $$ = new syntaxNode (STATEMENT_LABEL); orphans[0] = $2; orphans[1] = $4; $$->AdoptChildren (2, CASE_LABEL, orphans); } | WHILE expression DO statement { $$ = new syntaxNode (STATEMENT_LABEL); orphans[0] = $2; orphans[1] = $4; $$->AdoptChildren (2, WHILE_LABEL, orphans); } | REPEAT statements UNTIL expression { $$ = new syntaxNode (STATEMENT_LABEL); orphans[0] = $2; orphans[1] = $4; $$->AdoptChildren (2, REPEAT_LABEL, orphans); } | FOR ident BECOMES simple_expr direction simple_expr DO statement { $$ = new syntaxNode (STATEMENT_LABEL); orphans[0] = $2; orphans[1] = $4; orphans[2] = $5; orphans[3] = $6; orphans[4] = $8; $$->AdoptChildren (5, FOR_LABEL, orphans); } | WITH rec_var_list DO statement { $$ = new syntaxNode (STATEMENT_LABEL); orphans[0] = $4; $$->AdoptChildren (1, STATEMENT_LABEL, orphans); } ;direction : TO { $$ = new syntaxNode (DIRECTION_LABEL); $$->AdoptChildren (0, TO, orphans); } | DOWNTO { $$ = new syntaxNode (DIRECTION_LABEL); $$->AdoptChildren (0, DOWNTO, orphans); } ;assignment : variable BECOMES expression /* must test for fn_ident */ { $$ = new syntaxNode (ASSIGNMENT_LABEL); orphans[0] = $1; orphans[1] = $3;
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -