private function extractConcatenation(Group $group) { $groupedExpression = $group->getExpression(); if ($groupedExpression instanceof Concatenation) { return $groupedExpression; } throw new \Exception('grouped expression is not a concatenation'); }
private function extractChoice(Group $group) { $groupedExpression = $group->getExpression(); if ($groupedExpression instanceof Choice) { return $groupedExpression; } throw new \Exception('first grouped expression is not a choice'); }