Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ The configure script has many options (to see them all, run
* `--enable-ocaml`
Build re2ocaml (identical to `re2c --lang ocaml`). This is on by default.

* `--enable-php`
Build re2php (identical to `re2c --lang php`). This is on by default.

* `--enable-python`
Build re2py (identical to `re2c --lang python`). This is on by default.

Expand Down
16 changes: 16 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ option(RE2C_BUILD_RE2HS "Build re2hs executable (an alias for `re2c --lang haske
option(RE2C_BUILD_RE2JAVA "Build re2java executable (an alias for `re2c --lang java`)" ON)
option(RE2C_BUILD_RE2JS "Build re2js executable (an alias for `re2c --lang js`)" ON)
option(RE2C_BUILD_RE2OCAML "Build re2ocaml executable (an alias for `re2c --lang ocaml`)" ON)
option(RE2C_BUILD_RE2PHP "Build re2php executable (an alias for `re2c --lang php`)" ON)
option(RE2C_BUILD_RE2PY "Build re2py executable (an alias for `re2c --lang python`)" ON)
option(RE2C_BUILD_RE2RUST "Build re2rust executable (an alias for `re2c --lang rust`)" ON)
option(RE2C_BUILD_RE2V "Build re2v executable (an alias for `re2c --lang v`)" ON)
Expand Down Expand Up @@ -92,6 +93,7 @@ set(re2c_manpage_haskell "${CMAKE_CURRENT_BINARY_DIR}/doc/re2hs.1")
set(re2c_manpage_java "${CMAKE_CURRENT_BINARY_DIR}/doc/re2java.1")
set(re2c_manpage_js "${CMAKE_CURRENT_BINARY_DIR}/doc/re2js.1")
set(re2c_manpage_ocaml "${CMAKE_CURRENT_BINARY_DIR}/doc/re2ocaml.1")
set(re2c_manpage_php "${CMAKE_CURRENT_BINARY_DIR}/doc/re2php.1")
set(re2c_manpage_python "${CMAKE_CURRENT_BINARY_DIR}/doc/re2py.1")
set(re2c_manpage_rust "${CMAKE_CURRENT_BINARY_DIR}/doc/re2rust.1")
set(re2c_manpage_v "${CMAKE_CURRENT_BINARY_DIR}/doc/re2v.1")
Expand All @@ -103,6 +105,7 @@ set(re2c_help_haskell "${CMAKE_CURRENT_BINARY_DIR}/src/msg/help_re2hs.cc")
set(re2c_help_java "${CMAKE_CURRENT_BINARY_DIR}/src/msg/help_re2java.cc")
set(re2c_help_js "${CMAKE_CURRENT_BINARY_DIR}/src/msg/help_re2js.cc")
set(re2c_help_ocaml "${CMAKE_CURRENT_BINARY_DIR}/src/msg/help_re2ocaml.cc")
set(re2c_help_php "${CMAKE_CURRENT_BINARY_DIR}/src/msg/help_re2php.cc")
set(re2c_help_python "${CMAKE_CURRENT_BINARY_DIR}/src/msg/help_re2py.cc")
set(re2c_help_rust "${CMAKE_CURRENT_BINARY_DIR}/src/msg/help_re2rust.cc")
set(re2c_help_v "${CMAKE_CURRENT_BINARY_DIR}/src/msg/help_re2v.cc")
Expand Down Expand Up @@ -172,6 +175,7 @@ add_library(re2c_objects_autogen OBJECT
"${CMAKE_CURRENT_BINARY_DIR}/src/default_syntax_java.h"
"${CMAKE_CURRENT_BINARY_DIR}/src/default_syntax_js.h"
"${CMAKE_CURRENT_BINARY_DIR}/src/default_syntax_ocaml.h"
"${CMAKE_CURRENT_BINARY_DIR}/src/default_syntax_php.h"
"${CMAKE_CURRENT_BINARY_DIR}/src/default_syntax_python.h"
"${CMAKE_CURRENT_BINARY_DIR}/src/default_syntax_rust.h"
"${CMAKE_CURRENT_BINARY_DIR}/src/default_syntax_v.h"
Expand Down Expand Up @@ -260,6 +264,7 @@ re2c_bootstrap_syntax("include/syntax/haskell" "src/default_syntax_haskell.h")
re2c_bootstrap_syntax("include/syntax/java" "src/default_syntax_java.h")
re2c_bootstrap_syntax("include/syntax/js" "src/default_syntax_js.h")
re2c_bootstrap_syntax("include/syntax/ocaml" "src/default_syntax_ocaml.h")
re2c_bootstrap_syntax("include/syntax/php" "src/default_syntax_php.h")
re2c_bootstrap_syntax("include/syntax/python" "src/default_syntax_python.h")
re2c_bootstrap_syntax("include/syntax/rust" "src/default_syntax_rust.h")
re2c_bootstrap_syntax("include/syntax/v" "src/default_syntax_v.h")
Expand Down Expand Up @@ -344,6 +349,17 @@ if (RE2C_BUILD_RE2OCAML)
)
endif()

# re2php
if (RE2C_BUILD_RE2PHP)
re2c_gen_help("${re2c_help_source}" "${re2c_help_php}")
re2c_gen_manpage("${re2c_manpage_source}" "${re2c_manpage_php}")
add_executable(re2php ${re2c_sources} "${re2c_help_php}")
target_compile_definitions(re2php PUBLIC
"RE2C_LANG=Lang::PHP"
"RE2C_PROG=\"re2php\""
)
endif()

# re2py
if (RE2C_BUILD_RE2PY)
re2c_gen_help("${re2c_help_source}" "${re2c_help_python}")
Expand Down
41 changes: 41 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ re2c_GEN_STX = \
src/default_syntax_java.h \
src/default_syntax_js.h \
src/default_syntax_ocaml.h \
src/default_syntax_php.h \
src/default_syntax_python.h \
src/default_syntax_rust.h \
src/default_syntax_v.h \
Expand All @@ -173,6 +174,7 @@ re2c_BOOT = \
bootstrap/doc/re2java.1 \
bootstrap/doc/re2js.1 \
bootstrap/doc/re2ocaml.1 \
bootstrap/doc/re2php.1 \
bootstrap/doc/re2py.1 \
bootstrap/doc/re2rust.1 \
bootstrap/doc/re2v.1 \
Expand All @@ -184,6 +186,7 @@ re2c_BOOT = \
bootstrap/src/default_syntax_java.h \
bootstrap/src/default_syntax_js.h \
bootstrap/src/default_syntax_ocaml.h \
bootstrap/src/default_syntax_php.h \
bootstrap/src/default_syntax_python.h \
bootstrap/src/default_syntax_rust.h \
bootstrap/src/default_syntax_v.h \
Expand All @@ -196,6 +199,7 @@ re2c_BOOT = \
bootstrap/src/msg/help_re2js.cc \
bootstrap/src/msg/help_re2ocaml.cc \
bootstrap/src/msg/help_re2py.cc \
bootstrap/src/msg/help_re2php.cc \
bootstrap/src/msg/help_re2rust.cc \
bootstrap/src/msg/help_re2v.cc \
bootstrap/src/msg/help_re2zig.cc \
Expand Down Expand Up @@ -234,6 +238,7 @@ re2c_SRC_DOC_EXT = \
doc/manual/basics/api/api2_rust.rst_ \
doc/manual/basics/api/api2_v.rst_ \
doc/manual/basics/api/api2_zig.rst_ \
doc/manual/basics/api/api2_php.rst_ \
doc/manual/basics/api/api3.rst_ \
doc/manual/basics/blocks.rst_ \
doc/manual/basics/directives.rst_ \
Expand Down Expand Up @@ -440,6 +445,29 @@ re2c_SRC_DOC_EXT = \
examples/ocaml/submatch/02_mtags.re \
examples/ocaml/submatch/03_captures.re \
examples/ocaml/submatch/04_posix_captures.re \
examples/php/01_basic.php \
examples/php/01_basic.re \
examples/php/conditions/parse_u32_blocks.re \
examples/php/conditions/parse_u32_conditions.re \
examples/php/encodings/unicode_identifier.re \
examples/php/eof/01_sentinel.re \
examples/php/eof/02_bounds_checking.re \
examples/php/eof/03_eof_rule.re \
examples/php/eof/04_fake_sentinel.re \
examples/php/fill/01_fill.re \
examples/php/fill/02_fill.re \
examples/php/headers/header.re \
examples/php/headers/lexer/state.php \
examples/php/includes/definitions.php \
examples/php/includes/include.re \
examples/php/reuse/reuse.re \
examples/php/reuse/usedir.re \
examples/php/state/push.re \
examples/php/submatch/01_stags_fill.re \
examples/php/submatch/01_stags.re \
examples/php/submatch/02_mtags.re \
examples/php/submatch/03_captures.re \
examples/php/submatch/04_posix_captures.re \
examples/python/01_basic.py \
examples/python/01_basic.re \
examples/python/conditions/parse_u32_blocks.re \
Expand Down Expand Up @@ -560,6 +588,10 @@ if WITH_OCAML
DOCS += doc/re2ocaml.1
HELP += src/msg/help_re2ocaml.cc
endif
if WITH_PHP
DOCS += doc/re2php.1
HELP += src/msg/help_re2php.cc
endif
if WITH_PYTHON
DOCS += doc/re2py.1
HELP += src/msg/help_re2py.cc
Expand Down Expand Up @@ -589,6 +621,7 @@ dist_stdlib_DATA = \
include/syntax/java \
include/syntax/js \
include/syntax/ocaml \
include/syntax/php \
include/syntax/python \
include/syntax/rust \
include/syntax/v \
Expand Down Expand Up @@ -822,6 +855,14 @@ re2ocaml_SOURCES = $(re2c_SOURCES)
nodist_re2ocaml_SOURCES = $(re2c_GEN) src/msg/help_re2ocaml.cc
endif

# re2php
if WITH_PHP
bin_PROGRAMS += re2php
re2php_CXXFLAGS = $(AM_CXXFLAGS) -DRE2C_LANG=Lang::PHP -DRE2C_PROG=\"re2php\"
re2php_SOURCES = $(re2c_SOURCES)
nodist_re2php_SOURCES = $(re2c_GEN) src/msg/help_re2php.cc
endif

# re2py
if WITH_PYTHON
bin_PROGRAMS += re2py
Expand Down
Loading