summaryrefslogtreecommitdiff
path: root/scripts/ext_skel_ng/php_function.php
diff options
context:
space:
mode:
authorHartmut Holzgraefe <hholzgra@php.net>2003-02-28 06:37:05 +0000
committerHartmut Holzgraefe <hholzgra@php.net>2003-02-28 06:37:05 +0000
commit40a3530d8e555dec2a594939ccb7995e6ca25f76 (patch)
tree81730fe4480e4204a654856dd06756502ac5661a /scripts/ext_skel_ng/php_function.php
parente9787cd2fd303c1cbefdb47d11885e5d8b3ee0cc (diff)
downloadphp-git-40a3530d8e555dec2a594939ccb7995e6ca25f76.tar.gz
- support for "callback" type
- proto syntax errors are now passed back to the top level parser
Diffstat (limited to 'scripts/ext_skel_ng/php_function.php')
-rw-r--r--scripts/ext_skel_ng/php_function.php17
1 files changed, 10 insertions, 7 deletions
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;