Skip to content

Commit f84ef47

Browse files
author
Claudiu Popa
committed
Improve Pipeline grammar, by rearraging the terms.
Now AssignmentExpression is checked last. This adds new cases which can be discovered.
1 parent 3f86fe7 commit f84ef47

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

tests/test_grammar.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1963,6 +1963,7 @@ def test_statement_list(self):
19631963
elseif ($grade -ge 70) { "Grade C" }
19641964
elseif ($grade -ge 60) { "Grade D" }
19651965
else { "Grade F" }'''),
1966+
'{ $value * 10 }',
19661967
]
19671968
self._test_expected(StatementList, stmts)
19681969

wispy/grammar.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,9 +1037,9 @@ class AssignmentExpression(Grammar):
10371037

10381038
class Pipeline(Grammar):
10391039
grammar = OR(
1040-
AssignmentExpression,
10411040
(Expression, OPTIONAL(Redirection), OPTIONAL(PipelineTail)),
1042-
(Command, OPTIONAL(PipelineTail))
1041+
(Command, OPTIONAL(PipelineTail)),
1042+
AssignmentExpression,
10431043
)
10441044

10451045

0 commit comments

Comments
 (0)