From 40a3530d8e555dec2a594939ccb7995e6ca25f76 Mon Sep 17 00:00:00 2001 From: Hartmut Holzgraefe Date: Fri, 28 Feb 2003 06:37:05 +0000 Subject: [PATCH] - support for "callback" type - proto syntax errors are now passed back to the top level parser --- scripts/ext_skel_ng/extension_parser.php | 1 + scripts/ext_skel_ng/php_function.php | 17 ++++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/scripts/ext_skel_ng/extension_parser.php b/scripts/ext_skel_ng/extension_parser.php index 3323f52593..dca18325a4 100644 --- a/scripts/ext_skel_ng/extension_parser.php +++ b/scripts/ext_skel_ng/extension_parser.php @@ -196,6 +196,7 @@ $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: diff --git a/scripts/ext_skel_ng/php_function.php b/scripts/ext_skel_ng/php_function.php index 5360e79772..e6cc4ce0a1 100644 --- a/scripts/ext_skel_ng/php_function.php +++ b/scripts/ext_skel_ng/php_function.php @@ -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]=='[') { @@ -42,11 +42,11 @@ $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])) { @@ -67,13 +67,15 @@ $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() { @@ -154,6 +156,7 @@ ." }\n"; break; case "mixed": + case "callback": $arg_string.="z"; $code .= " zval * $name = NULL;\n"; break; -- 2.50.1