BadVPN – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 <?php
2  
3 function tokenize ($str, &$out) {
4 $out = array();
5  
6 while (strlen($str) > 0) {
7 if (preg_match('/^\\/\\/.*/', $str, $matches)) {
8 $str = substr($str, strlen($matches[0]));
9 }
10 else if (preg_match('/^\\s+/', $str, $matches)) {
11 $str = substr($str, strlen($matches[0]));
12 }
13 else if (preg_match('/^[0-9]+/', $str, $matches)) {
14 $out[] = array('number', $matches[0]);
15 $str = substr($str, strlen($matches[0]));
16 }
17 else if (preg_match('/^[a-zA-Z_][a-zA-Z0-9_]*/', $str, $matches)) {
18 $out[] = array('name', $matches[0]);
19 $str = substr($str, strlen($matches[0]));
20 }
21 else {
22 return FALSE;
23 }
24 }
25  
26 return TRUE;
27 }
28  
29 function fatal_error ($message)
30 {
31 fwrite(STDERR, "Fatal error: $message\n");
32  
33 ob_get_clean();
34 exit(1);
35 }