]> granicus.if.org Git - php/commitdiff
- support for "callback" type
authorHartmut Holzgraefe <hholzgra@php.net>
Fri, 28 Feb 2003 06:37:05 +0000 (06:37 +0000)
committerHartmut Holzgraefe <hholzgra@php.net>
Fri, 28 Feb 2003 06:37:05 +0000 (06:37 +0000)
- proto syntax errors are now passed back to the top level parser

scripts/ext_skel_ng/extension_parser.php
scripts/ext_skel_ng/php_function.php

index 3323f52593990683750103c1336866a71f20c7e1..dca18325a4ab177721d1dfd1a766b560c8271c28 100644 (file)
                                $this->private_functions[$attr['name']] = $function;
                                break;
                        case "public":
+                               if(is_string($function->status)) $this->error($function->status." in prototype");
                                $this->functions[$attr['name']] = $function;
                                break;
                        default:
index 5360e7977224b9d395dde5c9c7aef1a9eb5e2943..e6cc4ce0a161d46f52b588d4ab9330f73f2e4290 100644 (file)
@@ -8,7 +8,7 @@
                        $this->desc = empty($desc) ? "&warn.undocumented.func;" : $desc;
       $this->code = $code;
                        $this->role = empty($role) ? "public" : $role;
-                       if($this->role === "public") $this->parse_proto($proto);
+                       if($this->role === "public") $this->status = $this->parse_proto($proto);
                } 
                
                function parse_proto($proto) {
@@ -32,9 +32,9 @@
                        $opts=0;
                        $params=array();
                        $return_type = ($this->is_type($tokens[$n])) ? $tokens[$n++] : "void";
-                       if(! $this->is_name($tokens[$n])) die("$tokens[$n] is not a valid function name");
+                       if(! $this->is_name($tokens[$n])) return("$tokens[$n] is not a valid function name");
                        $function_name = $tokens[$n++];
-                       if($tokens[$n]!='(') die("'(' expected instead of '$tokens[$n]'");
+                       if($tokens[$n]!='(') return("'(' expected instead of '$tokens[$n]'");
                        if($tokens[++$n]!=')') {                        
                                for($param=0;$tokens[$n];$n++,$param++) {
                                        if($tokens[$n]=='[') {
                                                $opts++;
                                                $n++;
                                                if($param>0) { 
-                                                       if ($tokens[$n]!=',') die("',' expected after '[' instead of $token[$n]");
+                                                       if ($tokens[$n]!=',') return("',' expected after '[' instead of '$token[$n]'");
                                                        $n++;
                                                }
                                        }
-                                       if(!$this->is_type($tokens[$n])) die("type name expected instead of $tokens[$n]");
+                                       if(!$this->is_type($tokens[$n])) return("type name expected instead of '$tokens[$n]'");
                                        $params[$param]['type']=$tokens[$n];
                                        $n++;
                                        if($this->is_name($tokens[$n])) {
                                $n++;
                                $opts--;
                        }
-                       if($opts!=0) die ("'[' / ']' count mismatch");
-                       if($tokens[$n] != ')') die ("')' expected instead of $tokens[$n]");
+                       if($opts!=0) return ("'[' / ']' count mismatch");
+                       if($tokens[$n] != ')') return("')' expected instead of '$tokens[$n]'");
                        
                        $this->name     = $function_name;
                        $this->returns  = $return_type;
                        $this->params   = $params;
                        $this->optional = $numopts;
+
+                       return true;
                }
 
                function c_code() {
                                                        ."  }\n";
                                                break;
                                        case "mixed":
+                                       case "callback":
                                                $arg_string.="z";
                                                $code .= "  zval * $name = NULL;\n";
                                                break;