diff options
author | Matt A. Tobin <email@mattatobin.com> | 2020-11-04 19:46:11 -0500 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2020-11-04 20:27:57 -0500 |
commit | 78b3a722b4b91c2482fed60d7e970a3f57645456 (patch) | |
tree | 717c2e8f2e1a110295f525e9cca666469dbe8049 /js/src/regexp/update-headers.py | |
parent | 2e07199197e94ed02926c77bd3bd10d187b352b0 (diff) | |
download | UXP-78b3a722b4b91c2482fed60d7e970a3f57645456.tar UXP-78b3a722b4b91c2482fed60d7e970a3f57645456.tar.gz UXP-78b3a722b4b91c2482fed60d7e970a3f57645456.tar.lz UXP-78b3a722b4b91c2482fed60d7e970a3f57645456.tar.xz UXP-78b3a722b4b91c2482fed60d7e970a3f57645456.zip |
Issue #1677 - Part 1: Import new V8 regexp code with Mozilla's header modifications
Diffstat (limited to 'js/src/regexp/update-headers.py')
-rw-r--r-- | js/src/regexp/update-headers.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/js/src/regexp/update-headers.py b/js/src/regexp/update-headers.py new file mode 100644 index 000000000..0cff9d6ae --- /dev/null +++ b/js/src/regexp/update-headers.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this file, +# You can obtain one at http://mozilla.org/MPL/2.0/. + +# +# This script modifies V8 regexp source files to make them suitable for +# inclusion in SpiderMonkey. Specifically, it: +# +# 1. Rewrites all #includes of V8 regexp headers to point to their location in +# the SM tree: src/regexp/* --> regexp/* +# 2. Removes all #includes of other V8 src/* headers. The required definitions +# will be provided by regexp-shim.h. +# +# Usage: +# cd js/src/regexp +# find . -name "*.h" -o -name "*.cc" | xargs ./update_headers.py +# + +import fileinput +import re +import sys + +# 1. Rewrite includes of V8 regexp headers +regexp_include = re.compile('#include "src/regexp') +regexp_include_new = '#include "regexp' + +# 2. Remove includes of other V8 headers +other_include = re.compile('#include "src/') + +for line in fileinput.input(inplace=1): + if regexp_include.search(line): + sys.stdout.write(re.sub(regexp_include, regexp_include_new, line)) + elif other_include.search(line): + pass + else: + sys.stdout.write(line) |