summaryrefslogtreecommitdiff
path: root/Zend
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2007-11-06 07:29:41 +0000
committerDmitry Stogov <dmitry@php.net>2007-11-06 07:29:41 +0000
commite860d95d24a80213d863fa30dd6d18da7e78bf1f (patch)
tree13bb84e7b7d1e41e61711cc81fdcbd67b617fca4 /Zend
parent449ec5eee654a6c705d8881cc40da0a80a340bd0 (diff)
downloadphp-git-e860d95d24a80213d863fa30dd6d18da7e78bf1f.tar.gz
T_IMPORT -> T_USE
Diffstat (limited to 'Zend')
-rwxr-xr-xZend/tests/bug42859.phpt4
-rwxr-xr-xZend/tests/ns_002.phpt6
-rwxr-xr-xZend/tests/ns_010.phpt2
-rwxr-xr-xZend/tests/ns_012.phpt4
-rwxr-xr-xZend/tests/ns_020.phpt2
-rwxr-xr-xZend/tests/ns_022.phpt2
-rwxr-xr-xZend/tests/ns_029.phpt2
-rwxr-xr-xZend/tests/ns_030.phpt2
-rwxr-xr-xZend/tests/ns_033.phpt4
-rwxr-xr-xZend/tests/ns_034.phpt2
-rwxr-xr-xZend/tests/ns_036.phpt2
-rwxr-xr-xZend/tests/ns_037.phpt2
-rw-r--r--Zend/tests/ns_040.phpt2
-rw-r--r--Zend/tests/ns_042.phpt4
-rw-r--r--Zend/zend_compile.c8
-rw-r--r--Zend/zend_compile.h2
-rw-r--r--Zend/zend_language_parser.y12
-rw-r--r--Zend/zend_language_scanner.l4
18 files changed, 27 insertions, 39 deletions
diff --git a/Zend/tests/bug42859.phpt b/Zend/tests/bug42859.phpt
index 6464f9b4c7..475c583465 100755
--- a/Zend/tests/bug42859.phpt
+++ b/Zend/tests/bug42859.phpt
@@ -5,8 +5,8 @@ Bug #42859 import always conflicts with internal classes
namespace Foo;
class Ex {}
-import Blah::Exception;
-import Blah::Ex;
+use Blah::Exception;
+use Blah::Ex;
?>
--EXPECTF--
Fatal error: Import name 'Ex' conflicts with defined class in %sbug42859.php on line 6 \ No newline at end of file
diff --git a/Zend/tests/ns_002.phpt b/Zend/tests/ns_002.phpt
index 4b17012a94..7faca97cd3 100755
--- a/Zend/tests/ns_002.phpt
+++ b/Zend/tests/ns_002.phpt
@@ -10,9 +10,9 @@ class Foo {
}
}
-import test::ns1::Foo as Bar;
-import test::ns1 as ns2;
-import test::ns1;
+use test::ns1::Foo as Bar;
+use test::ns1 as ns2;
+use test::ns1;
Foo::bar();
test::ns1::Foo::bar();
diff --git a/Zend/tests/ns_010.phpt b/Zend/tests/ns_010.phpt
index 7be99e49bf..95172e0ec3 100755
--- a/Zend/tests/ns_010.phpt
+++ b/Zend/tests/ns_010.phpt
@@ -3,7 +3,7 @@
--FILE--
<?php
namespace X;
-import X as Y;
+use X as Y;
class Foo {
const C = "const ok\n";
static $var = "var ok\n";
diff --git a/Zend/tests/ns_012.phpt b/Zend/tests/ns_012.phpt
index aa50661e79..ce16db1ab9 100755
--- a/Zend/tests/ns_012.phpt
+++ b/Zend/tests/ns_012.phpt
@@ -8,8 +8,8 @@ function foo() {
echo __FUNCTION__,"\n";
}
-import test::ns1 as ns2;
-import test as ns3;
+use test::ns1 as ns2;
+use test as ns3;
foo();
bar();
diff --git a/Zend/tests/ns_020.phpt b/Zend/tests/ns_020.phpt
index 32325e09d2..9d2e8a7ccb 100755
--- a/Zend/tests/ns_020.phpt
+++ b/Zend/tests/ns_020.phpt
@@ -3,7 +3,7 @@
--FILE--
<?php
namespace X;
-import X as Y;
+use X as Y;
function foo() {
echo __FUNCTION__,"\n";
}
diff --git a/Zend/tests/ns_022.phpt b/Zend/tests/ns_022.phpt
index f46a856d01..6944ca403f 100755
--- a/Zend/tests/ns_022.phpt
+++ b/Zend/tests/ns_022.phpt
@@ -4,7 +4,7 @@
<?php
namespace a::b::c;
-import a::b::c as test;
+use a::b::c as test;
require "ns_022.inc";
diff --git a/Zend/tests/ns_029.phpt b/Zend/tests/ns_029.phpt
index a76f4fa9cd..1b82b052e5 100755
--- a/Zend/tests/ns_029.phpt
+++ b/Zend/tests/ns_029.phpt
@@ -2,7 +2,7 @@
029: Name ambiguity (class name & import name)
--FILE--
<?php
-import A::B as Foo;
+use A::B as Foo;
class Foo {
}
diff --git a/Zend/tests/ns_030.phpt b/Zend/tests/ns_030.phpt
index c87b293bb6..83a86b1fd1 100755
--- a/Zend/tests/ns_030.phpt
+++ b/Zend/tests/ns_030.phpt
@@ -5,7 +5,7 @@
class Foo {
}
-import A::B as Foo;
+use A::B as Foo;
new Foo();
--EXPECTF--
diff --git a/Zend/tests/ns_033.phpt b/Zend/tests/ns_033.phpt
index bd0bebd4bd..dc431d82b9 100755
--- a/Zend/tests/ns_033.phpt
+++ b/Zend/tests/ns_033.phpt
@@ -2,7 +2,7 @@
033: Import statement with non-compound name
--FILE--
<?php
-import A;
+use A;
--EXPECTF--
-Warning: The import statement with non-compound name 'A' has no effect in %sns_033.php on line 2
+Warning: The use statement with non-compound name 'A' has no effect in %sns_033.php on line 2
diff --git a/Zend/tests/ns_034.phpt b/Zend/tests/ns_034.phpt
index a0424a9997..f8669cfb74 100755
--- a/Zend/tests/ns_034.phpt
+++ b/Zend/tests/ns_034.phpt
@@ -3,7 +3,7 @@
--FILE--
<?php
namespace A;
-import A as B;
+use A as B;
class Foo {
const C = "ok\n";
}
diff --git a/Zend/tests/ns_036.phpt b/Zend/tests/ns_036.phpt
index 9825c8fc1f..6fee2cb006 100755
--- a/Zend/tests/ns_036.phpt
+++ b/Zend/tests/ns_036.phpt
@@ -5,7 +5,7 @@
--FILE--
<?php
namespace A;
-import A as B;
+use A as B;
class ArrayObject {
const STD_PROP_LIST = 2;
}
diff --git a/Zend/tests/ns_037.phpt b/Zend/tests/ns_037.phpt
index 4e6c248546..ed36e0bb57 100755
--- a/Zend/tests/ns_037.phpt
+++ b/Zend/tests/ns_037.phpt
@@ -3,7 +3,7 @@
--FILE--
<?php
namespace X;
-import X as Y;
+use X as Y;
class X {
const C = "const ok\n";
static $var = "var ok\n";
diff --git a/Zend/tests/ns_040.phpt b/Zend/tests/ns_040.phpt
index 11799f9a73..f017aff0bd 100644
--- a/Zend/tests/ns_040.phpt
+++ b/Zend/tests/ns_040.phpt
@@ -3,7 +3,7 @@
--FILE--
<?php
namespace X;
-import X as Y;
+use X as Y;
const A = "ok\n";
const B = A;
const C = array(A);
diff --git a/Zend/tests/ns_042.phpt b/Zend/tests/ns_042.phpt
index bda697bff9..eecd5f9256 100644
--- a/Zend/tests/ns_042.phpt
+++ b/Zend/tests/ns_042.phpt
@@ -6,8 +6,8 @@ namespace test::ns1;
const FOO = "ok\n";
-import test::ns1 as ns2;
-import test as ns3;
+use test::ns1 as ns2;
+use test as ns3;
echo FOO;
echo test::ns1::FOO;
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 9e880bb36c..bd18b97ac1 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -5113,7 +5113,7 @@ void zend_do_namespace(znode *name TSRMLS_DC) /* {{{ */
}
/* }}} */
-void zend_do_import(znode *ns_name, znode *new_name TSRMLS_DC) /* {{{ */
+void zend_do_use(znode *ns_name, znode *new_name TSRMLS_DC) /* {{{ */
{
unsigned int lcname_len;
zstr lcname;
@@ -5130,8 +5130,8 @@ void zend_do_import(znode *ns_name, znode *new_name TSRMLS_DC) /* {{{ */
if (new_name) {
name = &new_name->u.constant;
} else {
- /* The form "import A::B" is eqivalent to "import A::B as B".
- So we extract the last part of compound name ti use as a new_name */
+ /* The form "use A::B" is eqivalent to "use A::B as B".
+ So we extract the last part of compound name to use as a new_name */
name = &tmp;
if (UG(unicode)) {
UChar *p = u_memrchr(Z_USTRVAL_P(ns), ':', Z_USTRLEN_P(ns));
@@ -5191,7 +5191,7 @@ void zend_do_import(znode *ns_name, znode *new_name TSRMLS_DC) /* {{{ */
zend_error(E_COMPILE_ERROR, "Cannot reuse import name");
}
if (warn) {
- zend_error(E_WARNING, "The import statement with non-compound name '%R' has no effect", Z_TYPE_P(name), Z_UNIVAL_P(name));
+ zend_error(E_WARNING, "The use statement with non-compound name '%R' has no effect", Z_TYPE_P(name), Z_UNIVAL_P(name));
}
efree(lcname.v);
zval_dtor(name);
diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h
index ec26c360a0..4ab381f925 100644
--- a/Zend/zend_compile.h
+++ b/Zend/zend_compile.h
@@ -521,7 +521,7 @@ void zend_do_abstract_method(znode *function_name, znode *modifiers, znode *body
void zend_do_declare_constant(znode *name, znode *value TSRMLS_DC);
void zend_do_build_namespace_name(znode *result, znode *prefix, znode *name TSRMLS_DC);
void zend_do_namespace(znode *name TSRMLS_DC);
-void zend_do_import(znode *name, znode *new_name TSRMLS_DC);
+void zend_do_use(znode *name, znode *new_name TSRMLS_DC);
void zend_do_end_compilation(TSRMLS_D);
ZEND_API void function_add_ref(zend_function *function TSRMLS_DC);
diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y
index a658e98ea3..6b9b49f07c 100644
--- a/Zend/zend_language_parser.y
+++ b/Zend/zend_language_parser.y
@@ -147,7 +147,6 @@
%token T_BINARY_DOUBLE
%token T_BINARY_HEREDOC
%token T_NAMESPACE
-%token T_IMPORT
%token T_NS_C
%% /* Rules */
@@ -172,8 +171,8 @@ top_statement:
| class_declaration_statement { zend_do_early_binding(TSRMLS_C); }
| T_HALT_COMPILER '(' ')' ';' { zend_do_halt_compiler_register(TSRMLS_C); YYACCEPT; }
| T_NAMESPACE namespace_name ';' { zend_do_namespace(&$2 TSRMLS_CC); }
- | T_IMPORT namespace_name ';' { zend_do_import(&$2, NULL TSRMLS_CC); }
- | T_IMPORT namespace_name T_AS T_STRING ';' { zend_do_import(&$2, &$4 TSRMLS_CC); }
+ | T_USE namespace_name ';' { zend_do_use(&$2, NULL TSRMLS_CC); }
+ | T_USE namespace_name T_AS T_STRING ';' { zend_do_use(&$2, &$4 TSRMLS_CC); }
| constant_declaration ';'
;
@@ -229,7 +228,6 @@ unticked_statement:
| T_ECHO echo_expr_list ';'
| T_INLINE_HTML { zend_do_echo(&$1, 1 TSRMLS_CC); }
| expr ';' { zend_do_free(&$1 TSRMLS_CC); }
- | T_USE use_filename ';' { zend_error(E_COMPILE_ERROR,"use: Not yet supported. Please use include_once() or require_once()"); zval_dtor(&$2.u.constant); }
| T_UNSET '(' unset_variables ')' ';'
| T_FOREACH '(' variable T_AS
{ zend_do_foreach_begin(&$1, &$2, &$3, &$4, 1 TSRMLS_CC); }
@@ -277,12 +275,6 @@ unset_variable:
variable { zend_do_end_variable_parse(BP_VAR_UNSET, 0 TSRMLS_CC); zend_do_unset(&$1 TSRMLS_CC); }
;
-use_filename:
- T_CONSTANT_ENCAPSED_STRING { $$ = $1; }
- | '(' T_CONSTANT_ENCAPSED_STRING ')' { $$ = $2; }
-;
-
-
function_declaration_statement:
unticked_function_declaration_statement { zend_do_ticks(TSRMLS_C); }
;
diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l
index 791437cd93..647ddbd955 100644
--- a/Zend/zend_language_scanner.l
+++ b/Zend/zend_language_scanner.l
@@ -1661,10 +1661,6 @@ HEREDOC_CHARS ("{"*([^$\n\r\\{]|("\\"[^\n\r]))|{HEREDOC_LITERAL_DOLLAR}|({
return T_NAMESPACE;
}
-<ST_IN_SCRIPTING>"import" {
- return T_IMPORT;
-}
-
<ST_IN_SCRIPTING>"use" {
return T_USE;
}