@@ -57,26 +57,25 @@ impl Parse<Line> for IfStatementParser {
5757 let condition = ConditionParser . parse ( next_inner_pair ( & mut inner, "if condition" ) ?, ctx) ?;
5858
5959 let mut then_branch: Vec < Line > = Vec :: new ( ) ;
60- let mut else_if_branches : Vec < ( Condition , Vec < Line > , SourceLineNumber ) > = Vec :: new ( ) ;
60+ let mut elif_branches : Vec < ( Condition , Vec < Line > , SourceLineNumber ) > = Vec :: new ( ) ;
6161 let mut else_branch: Vec < Line > = Vec :: new ( ) ;
6262
6363 for item in inner {
6464 match item. as_rule ( ) {
6565 Rule :: statement => {
6666 Self :: add_statement_with_location ( & mut then_branch, item, ctx) ?;
6767 }
68- Rule :: else_if_clause => {
68+ Rule :: elif_clause => {
6969 let line_number = item. line_col ( ) . 0 ;
7070 let mut inner = item. into_inner ( ) ;
71- let else_if_condition =
72- ConditionParser . parse ( next_inner_pair ( & mut inner, "else if condition" ) ?, ctx) ?;
73- let mut else_if_branch = Vec :: new ( ) ;
74- for else_if_item in inner {
75- if else_if_item. as_rule ( ) == Rule :: statement {
76- Self :: add_statement_with_location ( & mut else_if_branch, else_if_item, ctx) ?;
71+ let elif_condition = ConditionParser . parse ( next_inner_pair ( & mut inner, "elif condition" ) ?, ctx) ?;
72+ let mut elif_branch = Vec :: new ( ) ;
73+ for elif_item in inner {
74+ if elif_item. as_rule ( ) == Rule :: statement {
75+ Self :: add_statement_with_location ( & mut elif_branch, elif_item, ctx) ?;
7776 }
7877 }
79- else_if_branches . push ( ( else_if_condition , else_if_branch , line_number) ) ;
78+ elif_branches . push ( ( elif_condition , elif_branch , line_number) ) ;
8079 }
8180 Rule :: else_clause => {
8281 for else_item in item. into_inner ( ) {
@@ -92,10 +91,10 @@ impl Parse<Line> for IfStatementParser {
9291 let mut outer_else_branch = Vec :: new ( ) ;
9392 let mut inner_else_branch = & mut outer_else_branch;
9493
95- for ( else_if_condition , else_if_branch , line_number) in else_if_branches . into_iter ( ) {
94+ for ( elif_condition , elif_branch , line_number) in elif_branches . into_iter ( ) {
9695 inner_else_branch. push ( Line :: IfCondition {
97- condition : else_if_condition ,
98- then_branch : else_if_branch ,
96+ condition : elif_condition ,
97+ then_branch : elif_branch ,
9998 else_branch : Vec :: new ( ) ,
10099 location : SourceLocation {
101100 file_id : ctx. current_file_id ,
0 commit comments