1: <?php
2: class Horde_Date_Parser_Locale_Base_Pointer
3: {
4: public $scanner = array(
5: '/\bpast\b/' => 'past',
6: '/\bfuture\b/' => 'future',
7: '/\bin\b/' => 'future',
8: );
9:
10: public function scan($tokens)
11: {
12: foreach ($tokens as &$token) {
13: if ($t = $this->scanForAll($token)) {
14: $token->tag('pointer', $t);
15: }
16: }
17: return $tokens;
18: }
19:
20: public function scanForAll($token)
21: {
22: foreach ($this->scanner as $scannerItem => $scannerTag) {
23: if (preg_match($scannerItem, $token->word)) {
24: return $scannerTag;
25: }
26: }
27: }
28:
29: }
30: