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 6, 2023
1 parent a85d340 commit dbd49d4
Show file tree
Hide file tree
Showing 5 changed files with 371 additions and 335 deletions.
13 changes: 12 additions & 1 deletion src/Latte/Compiler/TagParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ final class TagParser extends TagParserData
private const
SchemaExpression = 'e',
SchemaArguments = 'a',
SchemaFilters = 'm';
SchemaFilters = 'm',
SchemaForeachVariable = 'f';

private const SymbolNone = -1;

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


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


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

0 comments on commit dbd49d4

Please sign in to comment.