Skip to content

Commit

Permalink
Add re2c patches
Browse files Browse the repository at this point in the history
  • Loading branch information
petk committed Dec 30, 2024
1 parent 90a0495 commit dd9fb8e
Show file tree
Hide file tree
Showing 3 changed files with 198 additions and 0 deletions.
66 changes: 66 additions & 0 deletions patches/8.3/re2c.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
From: Peter Kokot <[email protected]>
Subject: Fix re2c -Wuseless-escape warnings

re2c version 4 enables some warnigns by default. This fixes the
-Wuseless-escape warnings.
---
Zend/zend_ini_scanner.l | 6 +++---
Zend/zend_language_scanner.l | 4 ++--
sapi/phpdbg/phpdbg_lexer.l | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/Zend/zend_ini_scanner.l b/Zend/zend_ini_scanner.l
index 44159297a0..b87f4e33cc 100644
--- a/Zend/zend_ini_scanner.l
+++ b/Zend/zend_ini_scanner.l
@@ -352,16 +352,16 @@ restart:
/*!re2c
re2c:yyfill:check = 0;
LNUM [0-9]+
-DNUM ([0-9]*[\.][0-9]+)|([0-9]+[\.][0-9]*)
+DNUM ([0-9]*[.][0-9]+)|([0-9]+[.][0-9]*)
NUMBER [-]?{LNUM}|{DNUM}
ANY_CHAR (.|[\n\t])
NEWLINE ("\r"|"\n"|"\r\n")
TABS_AND_SPACES [ \t]
WHITESPACE [ \t]+
CONSTANT [a-zA-Z_][a-zA-Z0-9_]*
-LABEL_CHAR [^=\n\r\t;&|^$~(){}!"\[\]\x00]
+LABEL_CHAR [^=\n\r\t;&|^$~(){}!"[\]\x00]
LABEL ({LABEL_CHAR}+)
-TOKENS [:,.\[\]"'()&|^+-/*=%$!~<>?@{}]
+TOKENS [:,.[\]"'()&|^+-/*=%$!~<>?@{}]
OPERATORS [&|^~()!]
DOLLAR_CURLY "${"

diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l
index 25e1ecbca6..3ea51fe7c9 100644
--- a/Zend/zend_language_scanner.l
+++ b/Zend/zend_language_scanner.l
@@ -1801,11 +1801,11 @@ OPTIONAL_WHITESPACE_OR_COMMENTS ({WHITESPACE}|{MULTI_LINE_COMMENT}|{SINGLE_LINE_
RETURN_TOKEN(T_MUL_EQUAL);
}

-<ST_IN_SCRIPTING>"*\*" {
+<ST_IN_SCRIPTING>"**" {
RETURN_TOKEN(T_POW);
}

-<ST_IN_SCRIPTING>"*\*=" {
+<ST_IN_SCRIPTING>"**=" {
RETURN_TOKEN(T_POW_EQUAL);
}

diff --git a/sapi/phpdbg/phpdbg_lexer.l b/sapi/phpdbg/phpdbg_lexer.l
index 6245262a00..bcfefcba81 100644
--- a/sapi/phpdbg/phpdbg_lexer.l
+++ b/sapi/phpdbg/phpdbg_lexer.l
@@ -77,7 +77,7 @@ T_IF 'if'
T_RUN 'run'
T_RUN_SHORT "r"
WS [ \r\t]+
-DIGITS [-]?[0-9\.]+
+DIGITS [-]?[0-9.]+
ID [^ \r\n\t:#\000]+
GENERIC_ID ([^ \r\n\t:#\000"']|":\\")+|["]([^\n\000"\\]|"\\\\"|"\\"["])+["]|[']([^\n\000'\\]|"\\\\"|"\\"['])+[']
ADDR [0][x][a-fA-F0-9]+
66 changes: 66 additions & 0 deletions patches/8.4/re2c.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
From: Peter Kokot <[email protected]>
Subject: Fix re2c -Wuseless-escape warnings

re2c version 4 enables some warnigns by default. This fixes the
-Wuseless-escape warnings.
---
Zend/zend_ini_scanner.l | 6 +++---
Zend/zend_language_scanner.l | 4 ++--
sapi/phpdbg/phpdbg_lexer.l | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/Zend/zend_ini_scanner.l b/Zend/zend_ini_scanner.l
index 44159297a0..b87f4e33cc 100644
--- a/Zend/zend_ini_scanner.l
+++ b/Zend/zend_ini_scanner.l
@@ -352,16 +352,16 @@ restart:
/*!re2c
re2c:yyfill:check = 0;
LNUM [0-9]+
-DNUM ([0-9]*[\.][0-9]+)|([0-9]+[\.][0-9]*)
+DNUM ([0-9]*[.][0-9]+)|([0-9]+[.][0-9]*)
NUMBER [-]?{LNUM}|{DNUM}
ANY_CHAR (.|[\n\t])
NEWLINE ("\r"|"\n"|"\r\n")
TABS_AND_SPACES [ \t]
WHITESPACE [ \t]+
CONSTANT [a-zA-Z_][a-zA-Z0-9_]*
-LABEL_CHAR [^=\n\r\t;&|^$~(){}!"\[\]\x00]
+LABEL_CHAR [^=\n\r\t;&|^$~(){}!"[\]\x00]
LABEL ({LABEL_CHAR}+)
-TOKENS [:,.\[\]"'()&|^+-/*=%$!~<>?@{}]
+TOKENS [:,.[\]"'()&|^+-/*=%$!~<>?@{}]
OPERATORS [&|^~()!]
DOLLAR_CURLY "${"

diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l
index 7ae7387592..988ec6366a 100644
--- a/Zend/zend_language_scanner.l
+++ b/Zend/zend_language_scanner.l
@@ -1813,11 +1813,11 @@ OPTIONAL_WHITESPACE_OR_COMMENTS ({WHITESPACE}|{MULTI_LINE_COMMENT}|{SINGLE_LINE_
RETURN_TOKEN(T_MUL_EQUAL);
}

-<ST_IN_SCRIPTING>"*\*" {
+<ST_IN_SCRIPTING>"**" {
RETURN_TOKEN(T_POW);
}

-<ST_IN_SCRIPTING>"*\*=" {
+<ST_IN_SCRIPTING>"**=" {
RETURN_TOKEN(T_POW_EQUAL);
}

diff --git a/sapi/phpdbg/phpdbg_lexer.l b/sapi/phpdbg/phpdbg_lexer.l
index 6245262a00..bcfefcba81 100644
--- a/sapi/phpdbg/phpdbg_lexer.l
+++ b/sapi/phpdbg/phpdbg_lexer.l
@@ -77,7 +77,7 @@ T_IF 'if'
T_RUN 'run'
T_RUN_SHORT "r"
WS [ \r\t]+
-DIGITS [-]?[0-9\.]+
+DIGITS [-]?[0-9.]+
ID [^ \r\n\t:#\000]+
GENERIC_ID ([^ \r\n\t:#\000"']|":\\")+|["]([^\n\000"\\]|"\\\\"|"\\"["])+["]|[']([^\n\000'\\]|"\\\\"|"\\"['])+[']
ADDR [0][x][a-fA-F0-9]+
66 changes: 66 additions & 0 deletions patches/8.5/re2c.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
From: Peter Kokot <[email protected]>
Subject: Fix re2c -Wuseless-escape warnings

re2c version 4 enables some warnigns by default. This fixes the
-Wuseless-escape warnings.
---
Zend/zend_ini_scanner.l | 6 +++---
Zend/zend_language_scanner.l | 4 ++--
sapi/phpdbg/phpdbg_lexer.l | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/Zend/zend_ini_scanner.l b/Zend/zend_ini_scanner.l
index 44159297a0..b87f4e33cc 100644
--- a/Zend/zend_ini_scanner.l
+++ b/Zend/zend_ini_scanner.l
@@ -352,16 +352,16 @@ restart:
/*!re2c
re2c:yyfill:check = 0;
LNUM [0-9]+
-DNUM ([0-9]*[\.][0-9]+)|([0-9]+[\.][0-9]*)
+DNUM ([0-9]*[.][0-9]+)|([0-9]+[.][0-9]*)
NUMBER [-]?{LNUM}|{DNUM}
ANY_CHAR (.|[\n\t])
NEWLINE ("\r"|"\n"|"\r\n")
TABS_AND_SPACES [ \t]
WHITESPACE [ \t]+
CONSTANT [a-zA-Z_][a-zA-Z0-9_]*
-LABEL_CHAR [^=\n\r\t;&|^$~(){}!"\[\]\x00]
+LABEL_CHAR [^=\n\r\t;&|^$~(){}!"[\]\x00]
LABEL ({LABEL_CHAR}+)
-TOKENS [:,.\[\]"'()&|^+-/*=%$!~<>?@{}]
+TOKENS [:,.[\]"'()&|^+-/*=%$!~<>?@{}]
OPERATORS [&|^~()!]
DOLLAR_CURLY "${"

diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l
index 7ae7387592..988ec6366a 100644
--- a/Zend/zend_language_scanner.l
+++ b/Zend/zend_language_scanner.l
@@ -1813,11 +1813,11 @@ OPTIONAL_WHITESPACE_OR_COMMENTS ({WHITESPACE}|{MULTI_LINE_COMMENT}|{SINGLE_LINE_
RETURN_TOKEN(T_MUL_EQUAL);
}

-<ST_IN_SCRIPTING>"*\*" {
+<ST_IN_SCRIPTING>"**" {
RETURN_TOKEN(T_POW);
}

-<ST_IN_SCRIPTING>"*\*=" {
+<ST_IN_SCRIPTING>"**=" {
RETURN_TOKEN(T_POW_EQUAL);
}

diff --git a/sapi/phpdbg/phpdbg_lexer.l b/sapi/phpdbg/phpdbg_lexer.l
index 6245262a00..bcfefcba81 100644
--- a/sapi/phpdbg/phpdbg_lexer.l
+++ b/sapi/phpdbg/phpdbg_lexer.l
@@ -77,7 +77,7 @@ T_IF 'if'
T_RUN 'run'
T_RUN_SHORT "r"
WS [ \r\t]+
-DIGITS [-]?[0-9\.]+
+DIGITS [-]?[0-9.]+
ID [^ \r\n\t:#\000]+
GENERIC_ID ([^ \r\n\t:#\000"']|":\\")+|["]([^\n\000"\\]|"\\\\"|"\\"["])+["]|[']([^\n\000'\\]|"\\\\"|"\\"['])+[']
ADDR [0][x][a-fA-F0-9]+

0 comments on commit dd9fb8e

Please sign in to comment.