cvs: pear /DBA Sql_lex.php ctype.php
| From: | Brent Cook | Date: | Fri, 19 Jul 2002 16:20:51 +0000 |
| Subject: | cvs: pear /DBA Sql_lex.php ctype.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-5200@lists.php.net to get a copy of this message | ||
busterb Fri Jul 19 12:20:51 2002 EDT
Modified files:
/pear/DBA Sql_lex.php ctype.php
Log:
convert to use ctype(ord()) rather than the sizeof() construct
Index: pear/DBA/Sql_lex.php
diff -u pear/DBA/Sql_lex.php:1.18 pear/DBA/Sql_lex.php:1.19
--- pear/DBA/Sql_lex.php:1.18 Fri Jul 19 11:55:16 2002
+++ pear/DBA/Sql_lex.php Fri Jul 19 12:20:51 2002
@@ -18,7 +18,7 @@
// | Foundation, Inc., 59 Temple Place, Suite 330,Boston,MA 02111-1307 USA|
// +----------------------------------------------------------------------+
//
-// $Id: Sql_lex.php,v 1.18 2002/07/19 15:55:16 busterb Exp $
+// $Id: Sql_lex.php,v 1.19 2002/07/19 16:20:51 busterb Exp $
//
include 'DB/DBA/ctype.php';
@@ -123,17 +123,17 @@
$state = 18;
break;
}
- if (sizeof($c) && ctype_alpha($c)) {
+ if (ctype_alpha(ord($c))) {
$state = 1;
break;
}
- if (sizeof($c) && ctype_digit($c)) {
+ if (ctype_digit(ord($c))) {
$state = 5;
break;
}
if ($c == '.') {
$t = $this->get();
- if (sizeof($c) && ctype_digit($t)) {
+ if (ctype_digit(ord($t))) {
$this->unget();
$state = 7;
break;
@@ -164,7 +164,7 @@
// {{{ State 1 : Incomplete keyword or ident
case 1:
$c = $this->get();
- if (sizeof($c) && ctype_alnum($c) || ($c == '_')) {
+ if (ctype_alnum(ord($c)) || ($c == '_')) {
$state = 1;
break;
}
@@ -191,7 +191,7 @@
// {{{ State 5: Incomplete real or int number
case 5:
$c = $this->get();
- if (sizeof($c) && ctype_digit($c)) {
+ if (ctype_digit(ord($c))) {
$state = 5;
break;
}
@@ -224,7 +224,7 @@
}
/* Analogy End */
- if (sizeof($c) && ctype_digit($c)) {
+ if (ctype_digit(ord($c))) {
$state = 7;
break;
}
@@ -244,7 +244,7 @@
// {{{ State 9: Incomplete signed number
case 9:
$c = $this->get();
- if (sizeof($c) && ctype_digit($c)) {
+ if (ctype_digit(ord($c))) {
$state = 5;
break;
}
@@ -346,7 +346,7 @@
// {{{ state 16: Exponent Value-first digit in Scientific Notation
case 16:
$c = $this->get();
- if (sizeof($c) && ctype_digit($c)) {
+ if (ctype_digit(ord($c))) {
$state = 17;
break;
}
@@ -357,7 +357,7 @@
// {{{ State 17: Exponent Value in Scientific Notation
case 17:
$c = $this->get();
- if (sizeof($c) && ctype_digit($c)) {
+ if (ctype_digit(ord($c))) {
$state = 17;
break;
}
@@ -369,7 +369,7 @@
// {{{ State 18 : Incomplete System Variable
case 18:
$c = $this->get();
- if (sizeof($c) && ctype_alnum($c) || $c == '_') {
+ if (ctype_alnum(ord($c)) || $c == '_') {
$state = 18;
break;
}
Index: pear/DBA/ctype.php
diff -u pear/DBA/ctype.php:1.1 pear/DBA/ctype.php:1.2
--- pear/DBA/ctype.php:1.1 Fri Jul 19 01:35:26 2002
+++ pear/DBA/ctype.php Fri Jul 19 12:20:51 2002
@@ -6,55 +6,53 @@
* @author John Millaway
* @author Brent Cook
*
- * Note: These functions expect a character, * such as 'a', or '?', not an
- * integer. If you want to use integers, first convert the integer using
- * the chr() function.
+ * Note: These functions expect an integer character, like the
*
*/
-if (!function_exists('ctype_alnum')) {
+if (!extension_loaded('ctype')) {
function ctype_alnum($c) {
global $ctype__;
- return !($ctype__[ord($c)] & (01 | 02 | 04));
+ return !($ctype__[$c] & (01 | 02 | 04));
}
function ctype_alpha($c) {
global $ctype__;
- return !($ctype__[ord($c)] & (01 | 02));
+ return !($ctype__[$c] & (01 | 02));
}
function ctype_cntrl($c) {
global $ctype__;
- return !($ctype__[ord($c)] & 040);
+ return !($ctype__[$c] & 040);
}
function ctype_digit($c) {
global $ctype__;
- return !($ctype__[ord($c)] & 04);
+ return !($ctype__[$c] & 04);
}
function ctype_graph($c) {
global $ctype__;
- return !($ctype__[ord($c)] & (020 | 01 | 02 | 04));
+ return !($ctype__[$c] & (020 | 01 | 02 | 04));
}
function ctype_lower($c) {
global $ctype__;
- return !($ctype__[ord($c)] & 02);
+ return !($ctype__[$c] & 02);
}
function ctype_print($c) {
global $ctype__;
- return !($ctype__[ord($c)] & (020 | 01 | 02 | 04 | 0200));
+ return !($ctype__[$c] & (020 | 01 | 02 | 04 | 0200));
}
function ctype_punct($c) {
global $ctype__;
- return !($ctype__[ord($c)] & 020);
+ return !($ctype__[$c] & 020);
}
function ctype_space($c) {
global $ctype__;
- return !($ctype__[ord($c)] & 010);
+ return !($ctype__[$c] & 010);
}
function ctype_upper($c) {
global $ctype__;
- return !($ctype__[ord($c)] & 01);
+ return !($ctype__[$c] & 01);
}
function ctype_xdigit($c) {
global $ctype__;
- return !($ctype__[ord($c)] & (0100 | 04));
+ return !($ctype__[$c] & (0100 | 04));
}
$ctype__ =
array(32,32,32,32,32,32,32,32,32,40,40,40,40,40,32,32,32,32,32,32,32,32,32,