Commit 6b1e7605dbd0b5bfdfd8ebafd656f77b5edeb43c
Tokenize word in a recipe's line in Makefiles
Container was missing and tokens were glued which prevented diffing.
Author: xaizek
Author date (UTC): 2022-11-29 19:15
Committer name: xaizek
Committer date (UTC): 2022-11-29 19:15
Parent(s): df7cf95a1a5c1f416004139660efa6fa7de11a0f
Signing key: 99DC5E4DB05F6BE2
Tree: 31c2d6b8fb23b8e12d565aec90d25028b717c143
File src/make/make-parser.ypp changed (mode: 100644) (index b74672c..dfc156f) |
... |
... |
mid_recipes |
737 |
737 |
; |
; |
738 |
738 |
|
|
739 |
739 |
recipes_opt |
recipes_opt |
740 |
|
: comment_opt NL { $$ = $1; } |
|
741 |
|
| comment_opt recipes NL { $$ = tb->addNode({ $1, $2 }); } |
|
|
740 |
|
: comment_opt NL |
|
741 |
|
{ $$ = $1; } |
|
742 |
|
| comment_opt recipes NL |
|
743 |
|
{ $$ = tb->addNode({ $1, $2 }, +MakeSType::TemporaryContainer); } |
742 |
744 |
; |
; |
743 |
745 |
|
|
744 |
746 |
recipe |
recipe |
File tests/make/make-parsing.cpp changed (mode: 100644) (index a786823..49180e5) |
... |
... |
target: |
58 |
58 |
# echo '#define HAVE_FILE_PROG' >> $@; |
# echo '#define HAVE_FILE_PROG' >> $@; |
59 |
59 |
)"); |
)"); |
60 |
60 |
} |
} |
|
61 |
|
|
|
62 |
|
TEST_CASE("Lines of recipes are tokenized", "[make][comparison][parsing]") |
|
63 |
|
{ |
|
64 |
|
diffMake(R"( |
|
65 |
|
a: b |
|
66 |
|
ifeq ($(VAR),) |
|
67 |
|
cp from to |
|
68 |
|
endif |
|
69 |
|
)", R"( |
|
70 |
|
a: b |
|
71 |
|
ifeq ($(VAR),) |
|
72 |
|
cp -r from to ## Mixed |
|
73 |
|
endif |
|
74 |
|
)"); |
|
75 |
|
} |