Skip to content

Commit

Permalink
fix: Handle trailing spaces for multi-line rule detection (#41)
Browse files Browse the repository at this point in the history
Closes #25
  • Loading branch information
theofidry authored Oct 1, 2023
1 parent 3302fb4 commit 6be4ed9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ private static function parseLine(
bool &$multiline,
bool &$ignoreNextLinesOfMultiline
): array {
$line = rtrim($line);

if (!self::isRule($line)) {
return $parsedRules;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public static function makefileContentProvider(): iterable
MAKEFILE,
[
new Rule('.PHONY', ['command']),
new Rule('command', ['foo', '\\']),
new Rule('command', ['foo', 'bar', '$(DEP)']),
],
];

Expand Down

0 comments on commit 6be4ed9

Please sign in to comment.