Skip to content

Commit 90a0495

Browse files
committed
Use long re2c options and adjust the --conditions
The --conditions option is available since re2c 1.1.
1 parent 1605e9c commit 90a0495

File tree

6 files changed

+37
-15
lines changed

6 files changed

+37
-15
lines changed

cmake/Zend/cmake/GenerateGrammar.cmake

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,9 @@ if(BISON_FOUND)
2626
${CMAKE_CURRENT_SOURCE_DIR}/zend_ini_parser.c
2727
HEADER
2828
${verbose}
29+
CODEGEN
2930
)
3031

31-
if(CMAKE_SCRIPT_MODE_FILE)
32-
set(verbose "")
33-
else()
34-
set(verbose VERBOSE)
35-
endif()
36-
3732
bison(
3833
zend_language_parser
3934
zend_language_parser.y
@@ -125,7 +120,12 @@ if(RE2C_FOUND)
125120
zend_ini_scanner.l
126121
${CMAKE_CURRENT_SOURCE_DIR}/zend_ini_scanner.c
127122
HEADER ${CMAKE_CURRENT_SOURCE_DIR}/zend_ini_scanner_defs.h
128-
OPTIONS --case-inverted -cbdF
123+
OPTIONS
124+
--case-inverted
125+
--conditions
126+
--bit-vectors
127+
--debug-output
128+
--flex-syntax
129129
CODEGEN
130130
)
131131

@@ -134,7 +134,12 @@ if(RE2C_FOUND)
134134
zend_language_scanner.l
135135
${CMAKE_CURRENT_SOURCE_DIR}/zend_language_scanner.c
136136
HEADER ${CMAKE_CURRENT_SOURCE_DIR}/zend_language_scanner_defs.h
137-
OPTIONS --case-inverted -cbdF
137+
OPTIONS
138+
--case-inverted
139+
--conditions
140+
--bit-vectors
141+
--debug-output
142+
--flex-syntax
138143
CODEGEN
139144
)
140145
endif()

cmake/cmake/modules/FindRE2C.cmake

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,19 @@ function(_re2c_process_options options result)
431431
list(PREPEND options ${RE2C_DEFAULT_OPTIONS})
432432
endif()
433433

434+
# Remove any generator expressions when running in script mode.
435+
if(CMAKE_SCRIPT_MODE_FILE)
436+
list(TRANSFORM options GENEX_STRIP)
437+
endif()
438+
439+
# Sync long -c variants. The long --conditions option was introduced in re2c
440+
# version 1.1 as a new alias for the legacy --start-conditions.
441+
if(RE2C_VERSION VERSION_LESS 1.1)
442+
list(TRANSFORM options REPLACE "^--conditions$" "--start-conditions")
443+
else()
444+
list(TRANSFORM options REPLACE "^--start-conditions$" "--conditions")
445+
endif()
446+
434447
set(${result} ${options})
435448

436449
return(PROPAGATE ${result})

cmake/ext/json/cmake/GenerateGrammar.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ if(BISON_FOUND)
1515
if(CMAKE_SCRIPT_MODE_FILE)
1616
set(verbose "")
1717
else()
18-
set(verbose VERBOSE) #REPORT_FILE json_parser.output)
18+
set(verbose VERBOSE)
1919
endif()
2020

2121
bison(
2222
php_ext_json_parser
2323
json_parser.y
2424
${CMAKE_CURRENT_SOURCE_DIR}/json_parser.tab.c
25-
${verbose}
2625
HEADER
26+
${verbose}
2727
CODEGEN
2828
)
2929
endif()
@@ -41,7 +41,7 @@ if(RE2C_FOUND)
4141
json_scanner.re
4242
${CMAKE_CURRENT_SOURCE_DIR}/json_scanner.c
4343
HEADER ${CMAKE_CURRENT_SOURCE_DIR}/php_json_scanner_defs.h
44-
OPTIONS -bc
44+
OPTIONS --bit-vectors --conditions
4545
CODEGEN
4646
)
4747
endif()

cmake/ext/phar/cmake/GenerateGrammar.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ if(RE2C_FOUND)
1212
php_ext_phar_path_check
1313
phar_path_check.re
1414
${CMAKE_CURRENT_SOURCE_DIR}/phar_path_check.c
15-
OPTIONS -b
15+
OPTIONS --bit-vectors
1616
CODEGEN
1717
)
1818
endif()

cmake/ext/standard/cmake/GenerateGrammar.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ if(RE2C_FOUND)
1515
php_ext_standard_url_scanner_ex
1616
url_scanner_ex.re
1717
${CMAKE_CURRENT_SOURCE_DIR}/url_scanner_ex.c
18-
OPTIONS -b
18+
OPTIONS --bit-vectors
1919
CODEGEN
2020
)
2121

2222
re2c(
2323
php_ext_standard_var_unserializer
2424
var_unserializer.re
2525
${CMAKE_CURRENT_SOURCE_DIR}/var_unserializer.c
26-
OPTIONS -b
26+
OPTIONS --bit-vectors
2727
CODEGEN
2828
)
2929
endif()

cmake/sapi/phpdbg/cmake/GenerateGrammar.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ if(RE2C_FOUND)
3737
php_sapi_phpdbg_lexer
3838
phpdbg_lexer.l
3939
${CMAKE_CURRENT_SOURCE_DIR}/phpdbg_lexer.c
40-
OPTIONS -cbdF
40+
OPTIONS
41+
--conditions
42+
--debug-output
43+
--bit-vectors
44+
--flex-syntax
4145
CODEGEN
4246
)
4347
endif()

0 commit comments

Comments
 (0)