Update semi-reserved keyword list

Magic constant names have been added after the PHP 7 release.

We do not support and likely will not support __halt_compiler here
due to lexer limitations.
This commit is contained in:
Nikita Popov 2016-02-09 13:30:39 +01:00
parent e05ef23743
commit d6361136e1
5 changed files with 3310 additions and 3156 deletions

View File

@ -21,6 +21,7 @@ reserved_non_modifiers:
| T_FINALLY | T_THROW | T_USE | T_INSTEADOF | T_GLOBAL | T_VAR | T_UNSET | T_ISSET | T_EMPTY | T_CONTINUE | T_GOTO
| T_FUNCTION | T_CONST | T_RETURN | T_PRINT | T_YIELD | T_LIST | T_SWITCH | T_ENDSWITCH | T_CASE | T_DEFAULT
| T_BREAK | T_ARRAY | T_CALLABLE | T_EXTENDS | T_IMPLEMENTS | T_NAMESPACE | T_TRAIT | T_INTERFACE | T_CLASS
| T_CLASS_C | T_TRAIT_C | T_FUNC_C | T_METHOD_C | T_LINE | T_FILE | T_DIR | T_NS_C | T_HALT_COMPILER
;
semi_reserved:

View File

@ -21,6 +21,7 @@ reserved_non_modifiers:
| T_FINALLY | T_THROW | T_USE | T_INSTEADOF | T_GLOBAL | T_VAR | T_UNSET | T_ISSET | T_EMPTY | T_CONTINUE | T_GOTO
| T_FUNCTION | T_CONST | T_RETURN | T_PRINT | T_YIELD | T_LIST | T_SWITCH | T_ENDSWITCH | T_CASE | T_DEFAULT
| T_BREAK | T_ARRAY | T_CALLABLE | T_EXTENDS | T_IMPLEMENTS | T_NAMESPACE | T_TRAIT | T_INTERFACE | T_CLASS
| T_CLASS_C | T_TRAIT_C | T_FUNC_C | T_METHOD_C | T_LINE | T_FILE | T_DIR | T_NS_C | T_HALT_COMPILER
;
semi_reserved:

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -13,6 +13,10 @@ class Test {
public $private;
const TRAIT = 3, FINAL = 4;
const __CLASS__ = 1, __TRAIT__ = 2, __FUNCTION__ = 3, __METHOD__ = 4, __LINE__ = 5,
__FILE__ = 6, __DIR__ = 7, __NAMESPACE__ = 8;
// __halt_compiler does not work
}
$t = new Test;
@ -130,6 +134,58 @@ array(
)
)
)
7: Stmt_ClassConst(
consts: array(
0: Const(
name: __CLASS__
value: Scalar_LNumber(
value: 1
)
)
1: Const(
name: __TRAIT__
value: Scalar_LNumber(
value: 2
)
)
2: Const(
name: __FUNCTION__
value: Scalar_LNumber(
value: 3
)
)
3: Const(
name: __METHOD__
value: Scalar_LNumber(
value: 4
)
)
4: Const(
name: __LINE__
value: Scalar_LNumber(
value: 5
)
)
5: Const(
name: __FILE__
value: Scalar_LNumber(
value: 6
)
)
6: Const(
name: __DIR__
value: Scalar_LNumber(
value: 7
)
)
7: Const(
name: __NAMESPACE__
value: Scalar_LNumber(
value: 8
)
)
)
)
)
)
1: Expr_Assign(
@ -321,4 +377,4 @@ array(
)
)
)
)
)