Split complex regexes to multiple lines in zend_vm_gen.php

As requested by Dmitry in GH-12461 for easier reviewing.
This commit is contained in:
Ilija Tovilo 2023-10-27 18:10:48 +02:00
parent d97ce2f086
commit 964e9d806b
No known key found for this signature in database
GPG Key ID: A4F5D403F118200A

View File

@ -2414,7 +2414,16 @@ function gen_vm($def, $skel) {
strpos($line,"ZEND_VM_COLD_CONSTCONST_HANDLER(") === 0) {
// Parsing opcode handler's definition
if (preg_match(
"/^ZEND_VM_(HOT_|INLINE_|HOT_OBJ_|HOT_SEND_|HOT_NOCONST_|HOT_NOCONSTCONST_|COLD_|COLD_CONST_|COLD_CONSTCONST_)?HANDLER\(\s*([0-9]+)\s*,\s*([A-Z_]+)\s*,\s*([A-Z_|]+)\s*,\s*([A-Z_|]+)\s*(,\s*([A-Z_|]+)\s*)?(,\s*SPEC\(([A-Z_|=,]+)\)\s*)?\)/",
"/^
ZEND_VM_(HOT_|INLINE_|HOT_OBJ_|HOT_SEND_|HOT_NOCONST_|HOT_NOCONSTCONST_|COLD_|COLD_CONST_|COLD_CONSTCONST_)?HANDLER\(
\s*([0-9]+)\s*,
\s*([A-Z_]+)\s*,
\s*([A-Z_|]+)\s*,
\s*([A-Z_|]+)\s*
(,\s*([A-Z_|]+)\s*)?
(,\s*SPEC\(([A-Z_|=,]+)\)\s*)?
\)
$/x",
$line,
$m) == 0) {
die("ERROR ($def:$lineno): Invalid ZEND_VM_HANDLER definition.\n");
@ -2465,7 +2474,17 @@ function gen_vm($def, $skel) {
strpos($line,"ZEND_VM_HOT_OBJ_TYPE_SPEC_HANDLER(") === 0) {
// Parsing opcode handler's definition
if (preg_match(
"/^ZEND_VM_(HOT_|INLINE_|HOT_OBJ_|HOT_SEND_|HOT_NOCONST_|HOT_NOCONSTCONST_)?TYPE_SPEC_HANDLER\(\s*([A-Z_|]+)\s*,\s*((?:[^(,]|\([^()]*|(?R)*\))*),\s*([A-Za-z_]+)\s*,\s*([A-Z_|]+)\s*,\s*([A-Z_|]+)\s*(,\s*([A-Z_|]+)\s*)?(,\s*SPEC\(([A-Z_|=,]+)\)\s*)?\)/",
"/^
ZEND_VM_(HOT_|INLINE_|HOT_OBJ_|HOT_SEND_|HOT_NOCONST_|HOT_NOCONSTCONST_)?TYPE_SPEC_HANDLER\(
\s*([A-Z_|]+)\s*,
\s*((?:[^(,]|\([^()]*|(?R)*\))*),
\s*([A-Za-z_]+)\s*,
\s*([A-Z_|]+)\s*,
\s*([A-Z_|]+)\s*
(,\s*([A-Z_|]+)\s*)?
(,\s*SPEC\(([A-Z_|=,]+)\)\s*)?
\)
$/x",
$line,
$m) == 0) {
die("ERROR ($def:$lineno): Invalid ZEND_VM_TYPE_HANDLER_HANDLER definition.\n");
@ -2513,7 +2532,15 @@ function gen_vm($def, $skel) {
strpos($line,"ZEND_VM_HOT_HELPER(") === 0) {
// Parsing helper's definition
if (preg_match(
"/^ZEND_VM(_INLINE|_COLD|_HOT)?_HELPER\(\s*([A-Za-z_]+)\s*,\s*([A-Z_|]+)\s*,\s*([A-Z_|]+)\s*(?:,\s*SPEC\(([A-Z_|=,]+)\)\s*)?(?:,\s*([^)]*)\s*)?\)/",
"/^
ZEND_VM(_INLINE|_COLD|_HOT)?_HELPER\(
\s*([A-Za-z_]+)\s*,
\s*([A-Z_|]+)\s*,
\s*([A-Z_|]+)\s*
(?:,\s*SPEC\(([A-Z_|=,]+)\)\s*)?
(?:,\s*([^)]*)\s*)?
\)
$/x",
$line,
$m) == 0) {
die("ERROR ($def:$lineno): Invalid ZEND_VM_HELPER definition.\n");