Skip to content

Commit

Permalink
ForeachNode, TagParser: added native parser for foreach-variables [Cl…
Browse files Browse the repository at this point in the history
…oses #342]
  • Loading branch information
dg committed Aug 9, 2023
1 parent b58721d commit 4489567
Show file tree
Hide file tree
Showing 5 changed files with 371 additions and 338 deletions.
13 changes: 12 additions & 1 deletion src/Latte/Compiler/TagParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ final class TagParser extends TagParserData
private const
SchemaExpression = 'e',
SchemaArguments = 'a',
SchemaFilters = 'm';
SchemaFilters = 'm',
SchemaForeach = 'f';

private const SymbolNone = -1;

Expand Down Expand Up @@ -120,6 +121,16 @@ public function parseType(): ?Node\SuperiorTypeNode
}


/**
* Parses variables used in foreach.
* @internal
*/
public function parseForeach(): array
{
return $this->parse(self::SchemaForeach);
}


/**
* Consumes optional token followed by whitespace. Suitable before parseUnquotedStringOrExpression().
*/
Expand Down
Loading

0 comments on commit 4489567

Please sign in to comment.