Skip to content

Commit

Permalink
fixed lexing expression ending with spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Nov 28, 2013
1 parent 8a780a9 commit 4c0b44e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Symfony/Component/ExpressionLanguage/Lexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ public function tokenize($expression)
$end = strlen($expression);

while ($cursor < $end) {
while (' ' == $expression[$cursor]) {
if (' ' == $expression[$cursor]) {
++$cursor;

continue;
}

if (preg_match('/[0-9]+(?:\.[0-9]+)?/A', $expression, $match, null, $cursor)) {
Expand Down
4 changes: 4 additions & 0 deletions src/Symfony/Component/ExpressionLanguage/Tests/LexerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ public function testTokenize($tokens, $expression)
public function getTokenizeData()
{
return array(
array(
array(new Token('name', 'a', 3)),
' a ',
),
array(
array(new Token('name', 'a', 1)),
'a',
Expand Down

0 comments on commit 4c0b44e

Please sign in to comment.