1
0
mirror of https://github.com/php/php-src.git synced 2026-04-04 22:52:40 +02:00

Allow arbitrary number of space characters between type-hint and method/function parameter

This commit is contained in:
Ilia Alshanetsky
2010-05-23 18:09:32 +00:00
parent a0269a6a72
commit ab9de550e2
4 changed files with 389 additions and 240 deletions

View File

@@ -0,0 +1,18 @@
--TEST--
Parameter type hint - formatting
--FILE--
<?php
function test(int$foo) { print "ok\n";}
test(1);
function test2(int
$foo) { print "ok\n";}
test2(1);
?>
--EXPECT--
ok
ok

File diff suppressed because it is too large Load Diff

View File

@@ -1172,7 +1172,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
return T_ARRAY;
}
<ST_IN_SCRIPTING>("bool"|"boolean"){TABS_AND_SPACES}[ \t&]+"$" {
<ST_IN_SCRIPTING>("bool"|"boolean"){TABS_AND_SPACES}[ \r\n\t&]*"$" {
if (yytext[4] == 'e') {
yyless((sizeof("boolean") - 1));
} else {
@@ -1181,12 +1181,12 @@ NEWLINE ("\r"|"\n"|"\r\n")
return T_BOOL_HINT;
}
<ST_IN_SCRIPTING>("string"|"binary"){TABS_AND_SPACES}[ \t&]+"$" {
<ST_IN_SCRIPTING>("string"|"binary"){TABS_AND_SPACES}[ \r\n\t&]*"$" {
yyless(6);
return T_STRING_HINT;
}
<ST_IN_SCRIPTING>("int"|"integer"|"long"){TABS_AND_SPACES}[ \t&]+"$" {
<ST_IN_SCRIPTING>("int"|"integer"|"long"){TABS_AND_SPACES}[ \r\n\t&]*"$" {
if (yytext[3] == 'e') {
yyless((sizeof("integer") - 1));
} else if (yytext[3] == 'g') {
@@ -1197,7 +1197,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
return T_INT_HINT;
}
<ST_IN_SCRIPTING>("real"|"double"|"float"){TABS_AND_SPACES}[ \t&]+"$" {
<ST_IN_SCRIPTING>("real"|"double"|"float"){TABS_AND_SPACES}[ \r\n\t&]*"$" {
if (yytext[4] == 'l') {
yyless((sizeof("double") - 1));
} else if (yytext[4] == 't') {
@@ -1208,12 +1208,12 @@ NEWLINE ("\r"|"\n"|"\r\n")
return T_DOUBLE_HINT;
}
<ST_IN_SCRIPTING>"resource"{TABS_AND_SPACES}[ \t&]+"$" {
<ST_IN_SCRIPTING>"resource"{TABS_AND_SPACES}[ \t\r\n&]*"$" {
yyless((sizeof("resource") - 1));
return T_RESOURCE_HINT;
}
<ST_IN_SCRIPTING>"object"{TABS_AND_SPACES}[ \t&]+"$" {
<ST_IN_SCRIPTING>"object"{TABS_AND_SPACES}[ \t\r\n&]*"$" {
yyless((sizeof("object") - 1));
return T_OBJECT_HINT;
}

View File

@@ -1,4 +1,4 @@
/* Generated by re2c 0.13.5 on Thu May 20 09:19:36 2010 */
/* Generated by re2c 0.13.5 on Sun May 23 14:06:04 2010 */
#line 3 "Zend/zend_language_scanner_defs.h"
enum YYCONDTYPE {