summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-05-25 21:00:01 -0400
committerFrederic Guillot <fred@kanboard.net>2016-05-25 21:00:01 -0400
commit74a84a28e34f3c1c38631fb80cc74ab589a44298 (patch)
tree463733e4aef46fa1012b2bd3fdba6f56b6f68afd /app
parent774734a820cd26616e8069385d8250af1ae539b1 (diff)
Support strtotime strings for date search
Diffstat (limited to 'app')
-rw-r--r--app/Core/Filter/Lexer.php11
1 files changed, 6 insertions, 5 deletions
diff --git a/app/Core/Filter/Lexer.php b/app/Core/Filter/Lexer.php
index 041b58d3..8a7a68b1 100644
--- a/app/Core/Filter/Lexer.php
+++ b/app/Core/Filter/Lexer.php
@@ -26,9 +26,10 @@ class Lexer
*/
private $tokenMap = array(
"/^(\s+)/" => 'T_WHITESPACE',
- '/^([<=>]{0,2}[0-9]{4}-[0-9]{2}-[0-9]{2})/' => 'T_DATE',
- '/^(yesterday|tomorrow|today)/' => 'T_DATE',
- '/^("(.*?)")/' => 'T_STRING',
+ '/^([<=>]{0,2}[0-9]{4}-[0-9]{2}-[0-9]{2})/' => 'T_STRING',
+ '/^([<=>]{1,2}\w+)/' => 'T_STRING',
+ '/^([<=>]{1,2}".+")/' => 'T_STRING',
+ '/^("(.+)")/' => 'T_STRING',
"/^(\w+)/" => 'T_STRING',
"/^(#\d+)/" => 'T_STRING',
);
@@ -107,7 +108,7 @@ class Lexer
$this->offset += strlen($matches[1]);
return array(
- 'match' => trim($matches[1], '"'),
+ 'match' => str_replace('"', '', $matches[1]),
'token' => $name,
);
}
@@ -134,7 +135,7 @@ class Lexer
} else {
$next = next($tokens);
- if ($next !== false && in_array($next['token'], array('T_STRING', 'T_DATE'))) {
+ if ($next !== false && $next['token'] === 'T_STRING') {
$map[$token['token']][] = $next['match'];
}
}