]> granicus.if.org Git - php/commitdiff
better 'name' regex
authorHartmut Holzgraefe <hholzgra@php.net>
Sat, 26 Apr 2003 15:34:10 +0000 (15:34 +0000)
committerHartmut Holzgraefe <hholzgra@php.net>
Sat, 26 Apr 2003 15:34:10 +0000 (15:34 +0000)
scripts/ext_skel_ng/php_element.php

index bbbdc8bb5e6b1f3e1410978a384f1e7932cc692d..4e17d297f7db12edbf5d691a0cbb6c929a800a53 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 
 class php_element {
+
        function is_type($name) {
                $types = array("void"     => "void", 
                                                                         "bool"     => "bool", 
@@ -18,7 +19,7 @@ class php_element {
                                                                         "callback" => "callback",
                                                                         );
                
-               if(isset($types[$name])) {
+               if (isset($types[$name])) {
                        return $types[$name];
                } else {
                        return false;
@@ -26,7 +27,7 @@ class php_element {
        }
 
        function is_name($name) {
-               if(ereg("[a-zA-Z0-9_]",$name)) {
+               if (ereg("^[[:alpha:]_][[:alnum:]_]*$",$name)) {
                        // TODO reserved words
                        return true;
                } 
@@ -49,7 +50,7 @@ class php_element {
        function docbook_editor_footer($level=3) {
                return '
 <!-- Keep this comment at the end of the file
-Local variables:
+Local'.' variables:
 mode: sgml
 sgml-omittag:t
 sgml-shorttag:t