Skip to content

Commit 0a38cba

Browse files
committed
initial release
0 parents  commit 0a38cba

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+37256
-0
lines changed

.hgignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
syntax:glob
2+
*.pyc
3+
*.orig
4+
core
5+
6+
syntax:regexp
7+
^obj/

AUTHORS

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# This is the official list of RE2 authors for copyright purposes.
2+
# This file is distinct from the CONTRIBUTORS files.
3+
# See the latter for an explanation.
4+
5+
# Names should be added to this file as
6+
# Name or Organization <email address>
7+
# The email address is not required for organizations.
8+
9+
# Please keep the list sorted.
10+
11+
Google Inc.

CONTRIBUTORS

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# This is the official list of people who can contribute
2+
# (and typically have contributed) code to the RE2 repository.
3+
# The AUTHORS file lists the copyright holders; this file
4+
# lists people. For example, Google employees are listed here
5+
# but not in AUTHORS, because Google holds the copyright.
6+
#
7+
# The submission process automatically checks to make sure
8+
# that people submitting code are listed in this file (by email address).
9+
#
10+
# Names should be added to this file only after verifying that
11+
# the individual or the individual's organization has agreed to
12+
# the appropriate Contributor License Agreement, found here:
13+
#
14+
# http://code.google.com/legal/individual-cla-v1.0.html
15+
# http://code.google.com/legal/corporate-cla-v1.0.html
16+
#
17+
# The agreement for individuals can be filled out on the web.
18+
#
19+
# When adding J Random Contributor's name to this file,
20+
# either J's name or J's organization's name should be
21+
# added to the AUTHORS file, depending on whether the
22+
# individual or corporate CLA was used.
23+
24+
# Names should be added to this file like so:
25+
# Name <email address>
26+
27+
# Please keep the list sorted.
28+
29+
30+
31+
Sanjay Ghemawat <[email protected]>
32+
Srinivasan Venkatachary <[email protected]>

LICENSE

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright (c) 2009 The RE2 Authors. All rights reserved.
2+
//
3+
// Redistribution and use in source and binary forms, with or without
4+
// modification, are permitted provided that the following conditions are
5+
// met:
6+
//
7+
// * Redistributions of source code must retain the above copyright
8+
// notice, this list of conditions and the following disclaimer.
9+
// * Redistributions in binary form must reproduce the above
10+
// copyright notice, this list of conditions and the following disclaimer
11+
// in the documentation and/or other materials provided with the
12+
// distribution.
13+
// * Neither the name of Google Inc. nor the names of its
14+
// contributors may be used to endorse or promote products derived from
15+
// this software without specific prior written permission.
16+
//
17+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Makefile

+151
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
# Copyright 2009 The RE2 Authors. All Rights Reserved.
2+
# Use of this source code is governed by a BSD-style
3+
# license that can be found in the LICENSE file.
4+
5+
all: obj/libre2.a
6+
7+
# to build against PCRE for testing or benchmarking,
8+
# uncomment the next two lines
9+
CCPCRE=-I/usr/local/include -DUSEPCRE
10+
LDPCRE=-L/usr/local/lib -lpcre
11+
12+
CC=g++
13+
CFLAGS=-c -Wall -Wno-sign-compare -O3 -g -I. $(CCPCRE)
14+
AR=ar
15+
ARFLAGS=rsc
16+
NM=nm
17+
NMFLAGS=-p
18+
19+
HFILES=\
20+
util/arena.h\
21+
util/atomicops.h\
22+
util/benchmark.h\
23+
util/hash_map.h\
24+
util/logging.h\
25+
util/mutex.h\
26+
util/pcre.h\
27+
util/random.h\
28+
util/sparse_array.h\
29+
util/test.h\
30+
util/utf.h\
31+
util/util.h\
32+
re2/filtered_re2.h\
33+
re2/prefilter.h\
34+
re2/prefilter_tree.h\
35+
re2/prog.h\
36+
re2/re2.h\
37+
re2/regexp.h\
38+
re2/stringpiece.h\
39+
re2/testing/exhaustive_tester.h\
40+
re2/testing/regexp_generator.h\
41+
re2/testing/string_generator.h\
42+
re2/testing/tester.h\
43+
re2/unicode_casefold.h\
44+
re2/unicode_groups.h\
45+
re2/walker-inl.h\
46+
47+
OFILES=\
48+
obj/util/arena.o\
49+
obj/util/hash.o\
50+
obj/util/rune.o\
51+
obj/util/stringpiece.o\
52+
obj/util/stringprintf.o\
53+
obj/util/strutil.o\
54+
obj/re2/bitstate.o\
55+
obj/re2/compile.o\
56+
obj/re2/dfa.o\
57+
obj/re2/filtered_re2.o\
58+
obj/re2/mimics_pcre.o\
59+
obj/re2/nfa.o\
60+
obj/re2/onepass.o\
61+
obj/re2/parse.o\
62+
obj/re2/perl_groups.o\
63+
obj/re2/prefilter.o\
64+
obj/re2/prefilter_tree.o\
65+
obj/re2/prog.o\
66+
obj/re2/re2.o\
67+
obj/re2/regexp.o\
68+
obj/re2/simplify.o\
69+
obj/re2/tostring.o\
70+
obj/re2/unicode_casefold.o\
71+
obj/re2/unicode_groups.o\
72+
73+
TESTOFILES=\
74+
obj/util/pcre.o\
75+
obj/util/random.o\
76+
obj/util/thread.o\
77+
obj/re2/testing/backtrack.o\
78+
obj/re2/testing/dump.o\
79+
obj/re2/testing/exhaustive_tester.o\
80+
obj/re2/testing/null_walker.o\
81+
obj/re2/testing/regexp_generator.o\
82+
obj/re2/testing/string_generator.o\
83+
obj/re2/testing/tester.o\
84+
85+
TESTS=\
86+
obj/test/charclass_test\
87+
obj/test/compile_test\
88+
obj/test/filtered_re2_test\
89+
obj/test/mimics_pcre_test\
90+
obj/test/parse_test\
91+
obj/test/possible_match_test\
92+
obj/test/re2_test\
93+
obj/test/re2_arg_test\
94+
obj/test/required_prefix_test\
95+
obj/test/search_test\
96+
obj/test/simplify_test\
97+
obj/test/string_generator_test\
98+
obj/test/dfa_test\
99+
obj/test/exhaustive1_test\
100+
obj/test/exhaustive2_test\
101+
obj/test/exhaustive3_test\
102+
obj/test/exhaustive_test\
103+
obj/test/random_test\
104+
105+
obj/%.o: %.cc $(HFILES)
106+
@mkdir -p $$(dirname $@)
107+
$(CC) -o $@ $(CFLAGS) $*.cc 2>&1 | sed 5q
108+
109+
obj/%.o: %.c $(HFILES)
110+
@mkdir -p $$(dirname $@)
111+
$(CC) -o $@ $(CFLAGS) $*.c 2>&1 | sed 5q
112+
113+
obj/libre2.a: $(OFILES)
114+
@mkdir -p obj
115+
$(AR) $(ARFLAGS) obj/libre2.a $(OFILES)
116+
117+
obj/test/%: obj/libre2.a obj/re2/testing/%.o $(TESTOFILES) obj/util/test.o
118+
@mkdir -p obj/test
119+
$(CC) -o $@ obj/re2/testing/$*.o $(TESTOFILES) obj/util/test.o obj/libre2.a -lpthread $(LDPCRE)
120+
121+
obj/test/regexp_benchmark: obj/libre2.a obj/re2/testing/regexp_benchmark.o $(TESTOFILES) obj/util/benchmark.o
122+
@mkdir -p obj/test
123+
$(CC) -o $@ obj/re2/testing/regexp_benchmark.o $(TESTOFILES) obj/util/benchmark.o obj/libre2.a -lpthread $(LDPCRE)
124+
125+
clean:
126+
rm -rf obj
127+
128+
testofiles: $(TESTOFILES)
129+
130+
test: $(TESTS)
131+
@./runtests $(TESTS)
132+
133+
benchmark: obj/test/regexp_benchmark
134+
135+
install: obj/libre2.a
136+
mkdir -p /usr/local/include/re2
137+
install -m 444 re2/re2.h /usr/local/include/re2/re2.h
138+
install -m 444 re2/stringpiece.h /usr/local/include/re2/stringpiece.h
139+
install -m 555 obj/libre2.a /usr/local/lib/libre2.a
140+
141+
testinstall:
142+
@mkdir -p obj
143+
cp testinstall.cc obj
144+
(cd obj && g++ -I/usr/local/include testinstall.cc -lre2 -o testinstall)
145+
obj/testinstall
146+
147+
benchlog: obj/test/regexp_benchmark
148+
(echo '==BENCHMARK==' `hostname` `date`; \
149+
(uname -a; g++ --version; hg identify; file obj/test/regexp_benchmark) | sed 's/^/# /'; \
150+
echo; \
151+
./obj/test/regexp_benchmark 'PCRE|RE2') | tee -a benchlog.$$(hostname | sed 's/\..*//')

README

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
This is the source code repository for RE2, a regular expression library.
2+
3+
For documentation about how to install and use RE2,
4+
visit http://code.google.com/p/re2/.
5+
6+
The short version is:
7+
8+
make
9+
make test
10+
make install
11+
make testinstall
12+
13+
Unless otherwise noted, the RE2 source files are distributed
14+
under the BSD-style license found in the LICENSE file.

0 commit comments

Comments
 (0)