File src/make/make-parser.ypp changed (mode: 100644) (index dfc156f..b4dd3d7) |
... |
... |
targets |
725 |
725 |
; |
; |
726 |
726 |
|
|
727 |
727 |
recipes |
recipes |
728 |
|
: mid_recipes last_recipe |
|
729 |
|
{ $$ = tb->append($1, tb->addNode($2, @2, +MakeSType::Recipe)); } |
|
|
728 |
|
: mid_recipes last_recipe { $$ = tb->append($1, $2); } |
730 |
729 |
; |
; |
731 |
730 |
|
|
732 |
731 |
mid_recipes |
mid_recipes |
733 |
732 |
: %empty |
: %empty |
734 |
733 |
{ $$ = tb->addNode({ }, +MakeSType::TemporaryContainer); } |
{ $$ = tb->addNode({ }, +MakeSType::TemporaryContainer); } |
735 |
734 |
| mid_recipes recipe |
| mid_recipes recipe |
736 |
|
{ $$ = tb->append($1, tb->addNode($2, @2, +MakeSType::Recipe)); } |
|
|
735 |
|
{ $$ = tb->append($1, $2); } |
737 |
736 |
; |
; |
738 |
737 |
|
|
739 |
738 |
recipes_opt |
recipes_opt |
|
... |
... |
recipe |
752 |
751 |
; |
; |
753 |
752 |
|
|
754 |
753 |
last_recipe |
last_recipe |
755 |
|
: LEADING_TAB exprs_in_recipe { $$ = $2; } |
|
756 |
|
| NL conditional_in_recipe { $$ = $2; } |
|
|
754 |
|
: LEADING_TAB exprs_in_recipe |
|
755 |
|
{ $$ = tb->addNode($2, @2, +MakeSType::Recipe); } |
|
756 |
|
| NL conditional_in_recipe |
|
757 |
|
{ $$ = $2; } |
757 |
758 |
; |
; |
758 |
759 |
|
|
759 |
760 |
identifier |
identifier |
File tests/make/make-parsing.cpp changed (mode: 100644) (index 49180e5..3834faf) |
... |
... |
ifeq ($(VAR),) |
73 |
73 |
endif |
endif |
74 |
74 |
)"); |
)"); |
75 |
75 |
} |
} |
|
76 |
|
|
|
77 |
|
TEST_CASE("Conditionals don't mess up recipes", "[make][comparison][parsing]") |
|
78 |
|
{ |
|
79 |
|
diffMake(R"( |
|
80 |
|
target: |
|
81 |
|
ifeq ($(COND),y) |
|
82 |
|
command arg1 \ ## Moves |
|
83 |
|
arg2 \ ## Moves |
|
84 |
|
arg3 ## Moves |
|
85 |
|
do something \ |
|
86 |
|
else here |
|
87 |
|
some other test command ## Moves |
|
88 |
|
endif # COND |
|
89 |
|
)", R"( |
|
90 |
|
target: |
|
91 |
|
ifeq ($(COND),y) |
|
92 |
|
do something \ |
|
93 |
|
else here |
|
94 |
|
ifeq ($(NEW_COND),y) ## Additions |
|
95 |
|
@printf "if block" ## Additions |
|
96 |
|
else ## Additions |
|
97 |
|
@printf "else block" ## Additions |
|
98 |
|
command arg1 \ ## Moves |
|
99 |
|
arg2 \ ## Moves |
|
100 |
|
arg3 ## Moves |
|
101 |
|
some other test command ## Moves |
|
102 |
|
endif # NEW_COND ## Additions |
|
103 |
|
endif # COND |
|
104 |
|
)"); |
|
105 |
|
} |