Skip to content
Permalink
Browse files

initial release

  • Loading branch information...
rsc committed Mar 3, 2010
0 parents commit 0a38cba1d9dcfbd713141095582597af700f22e9
Showing with 37,256 additions and 0 deletions.
  1. +7 −0 .hgignore
  2. +11 −0 AUTHORS
  3. +32 −0 CONTRIBUTORS
  4. +27 −0 LICENSE
  5. +151 −0 Makefile
  6. +14 −0 README
  7. +2,211 −0 benchlog/benchlog.c2
  8. +582 −0 benchlog/benchlog.mini
  9. +1,475 −0 benchlog/benchlog.r70
  10. +1,058 −0 benchlog/benchlog.wreck
  11. +155 −0 benchlog/mktable
  12. +1 −0 doc/README.xkcd
  13. +42 −0 doc/mksyntaxhtml
  14. +388 −0 doc/syntax.html
  15. +373 −0 doc/syntax.txt
  16. BIN doc/xkcd.png
  17. +1 −0 re2/Makefile
  18. +377 −0 re2/bitstate.cc
  19. +948 −0 re2/compile.cc
  20. +2,020 −0 re2/dfa.cc
  21. +100 −0 re2/filtered_re2.cc
  22. +92 −0 re2/filtered_re2.h
  23. +128 −0 re2/make_perl_groups.pl
  24. +109 −0 re2/make_unicode_casefold.py
  25. +111 −0 re2/make_unicode_groups.py
  26. +184 −0 re2/mimics_pcre.cc
  27. +707 −0 re2/nfa.cc
  28. +604 −0 re2/onepass.cc
  29. +1,792 −0 re2/parse.cc
  30. +209 −0 re2/perl_groups.cc
  31. +665 −0 re2/prefilter.cc
  32. +105 −0 re2/prefilter.h
  33. +398 −0 re2/prefilter_tree.cc
  34. +130 −0 re2/prefilter_tree.h
  35. +337 −0 re2/prog.cc
  36. +347 −0 re2/prog.h
  37. +1,224 −0 re2/re2.cc
  38. +846 −0 re2/re2.h
  39. +570 −0 re2/regexp.cc
  40. +505 −0 re2/regexp.h
  41. +380 −0 re2/simplify.cc
  42. +177 −0 re2/stringpiece.h
  43. +253 −0 re2/testing/backtrack.cc
  44. +188 −0 re2/testing/charclass_test.cc
  45. +171 −0 re2/testing/compile_test.cc
  46. +347 −0 re2/testing/dfa_test.cc
  47. +164 −0 re2/testing/dump.cc
  48. +42 −0 re2/testing/exhaustive1_test.cc
  49. +70 −0 re2/testing/exhaustive2_test.cc
  50. +94 −0 re2/testing/exhaustive3_test.cc
  51. +38 −0 re2/testing/exhaustive_test.cc
  52. +109 −0 re2/testing/exhaustive_tester.cc
  53. +85 −0 re2/testing/exhaustive_tester.h
  54. +248 −0 re2/testing/filtered_re2_test.cc
  55. +76 −0 re2/testing/mimics_pcre_test.cc
  56. +44 −0 re2/testing/null_walker.cc
  57. +318 −0 re2/testing/parse_test.cc
  58. +245 −0 re2/testing/possible_match_test.cc
  59. +87 −0 re2/testing/random_test.cc
  60. +140 −0 re2/testing/re2_arg_test.cc
  61. +1,176 −0 re2/testing/re2_test.cc
  62. +1,461 −0 re2/testing/regexp_benchmark.cc
  63. +264 −0 re2/testing/regexp_generator.cc
  64. +70 −0 re2/testing/regexp_generator.h
  65. +67 −0 re2/testing/required_prefix_test.cc
  66. +279 −0 re2/testing/search_test.cc
  67. +166 −0 re2/testing/simplify_test.cc
  68. +114 −0 re2/testing/string_generator.cc
  69. +58 −0 re2/testing/string_generator.h
  70. +109 −0 re2/testing/string_generator_test.cc
  71. +636 −0 re2/testing/tester.cc
  72. +107 −0 re2/testing/tester.h
  73. +207 −0 re2/testing/unicode_test.py
  74. +333 −0 re2/tostring.cc
  75. +297 −0 re2/unicode.py
  76. +297 −0 re2/unicode_casefold.cc
  77. +67 −0 re2/unicode_casefold.h
  78. +4,710 −0 re2/unicode_groups.cc
  79. +63 −0 re2/unicode_groups.h
  80. +243 −0 re2/walker-inl.h
  81. +21 −0 runtests
  82. +13 −0 testinstall.cc
  83. +168 −0 util/arena.cc
  84. +103 −0 util/arena.h
  85. +36 −0 util/atomicops.h
  86. +153 −0 util/benchmark.cc
  87. +41 −0 util/benchmark.h
  88. +27 −0 util/flags.h
  89. +231 −0 util/hash.cc
  90. +24 −0 util/hash_map.h
  91. +70 −0 util/logging.h
  92. +190 −0 util/mutex.h
  93. +963 −0 util/pcre.cc
  94. +679 −0 util/pcre.h
  95. +34 −0 util/random.cc
  96. +29 −0 util/random.h
  97. +258 −0 util/rune.cc
  98. +440 −0 util/sparse_array.h
  99. +150 −0 util/sparse_array_test.cc
  100. +87 −0 util/stringpiece.cc
  101. +78 −0 util/stringprintf.cc
  102. +97 −0 util/strutil.cc
  103. +39 −0 util/test.cc
  104. +57 −0 util/test.h
  105. +44 −0 util/thread.cc
  106. +26 −0 util/thread.h
  107. +43 −0 util/utf.h
  108. +119 −0 util/util.h
@@ -0,0 +1,7 @@
syntax:glob
*.pyc
*.orig
core

syntax:regexp
^obj/
11 AUTHORS
@@ -0,0 +1,11 @@
# This is the official list of RE2 authors for copyright purposes.
# This file is distinct from the CONTRIBUTORS files.
# See the latter for an explanation.

# Names should be added to this file as
# Name or Organization <email address>
# The email address is not required for organizations.

# Please keep the list sorted.

Google Inc.
@@ -0,0 +1,32 @@
# This is the official list of people who can contribute
# (and typically have contributed) code to the RE2 repository.
# The AUTHORS file lists the copyright holders; this file
# lists people. For example, Google employees are listed here
# but not in AUTHORS, because Google holds the copyright.
#
# The submission process automatically checks to make sure
# that people submitting code are listed in this file (by email address).
#
# Names should be added to this file only after verifying that
# the individual or the individual's organization has agreed to
# the appropriate Contributor License Agreement, found here:
#
# http://code.google.com/legal/individual-cla-v1.0.html
# http://code.google.com/legal/corporate-cla-v1.0.html
#
# The agreement for individuals can be filled out on the web.
#
# When adding J Random Contributor's name to this file,
# either J's name or J's organization's name should be
# added to the AUTHORS file, depending on whether the
# individual or corporate CLA was used.

# Names should be added to this file like so:
# Name <email address>

# Please keep the list sorted.

Rob Pike <r@google.com>
Russ Cox <rsc@google.com>
Sanjay Ghemawat <sanjay@google.com>
Srinivasan Venkatachary <vsri@google.com>
27 LICENSE
@@ -0,0 +1,27 @@
// Copyright (c) 2009 The RE2 Authors. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
151 Makefile
@@ -0,0 +1,151 @@
# Copyright 2009 The RE2 Authors. All Rights Reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.

all: obj/libre2.a

# to build against PCRE for testing or benchmarking,
# uncomment the next two lines
CCPCRE=-I/usr/local/include -DUSEPCRE
LDPCRE=-L/usr/local/lib -lpcre

CC=g++
CFLAGS=-c -Wall -Wno-sign-compare -O3 -g -I. $(CCPCRE)
AR=ar
ARFLAGS=rsc
NM=nm
NMFLAGS=-p

HFILES=\
util/arena.h\
util/atomicops.h\
util/benchmark.h\
util/hash_map.h\
util/logging.h\
util/mutex.h\
util/pcre.h\
util/random.h\
util/sparse_array.h\
util/test.h\
util/utf.h\
util/util.h\
re2/filtered_re2.h\
re2/prefilter.h\
re2/prefilter_tree.h\
re2/prog.h\
re2/re2.h\
re2/regexp.h\
re2/stringpiece.h\
re2/testing/exhaustive_tester.h\
re2/testing/regexp_generator.h\
re2/testing/string_generator.h\
re2/testing/tester.h\
re2/unicode_casefold.h\
re2/unicode_groups.h\
re2/walker-inl.h\

OFILES=\
obj/util/arena.o\
obj/util/hash.o\
obj/util/rune.o\
obj/util/stringpiece.o\
obj/util/stringprintf.o\
obj/util/strutil.o\
obj/re2/bitstate.o\
obj/re2/compile.o\
obj/re2/dfa.o\
obj/re2/filtered_re2.o\
obj/re2/mimics_pcre.o\
obj/re2/nfa.o\
obj/re2/onepass.o\
obj/re2/parse.o\
obj/re2/perl_groups.o\
obj/re2/prefilter.o\
obj/re2/prefilter_tree.o\
obj/re2/prog.o\
obj/re2/re2.o\
obj/re2/regexp.o\
obj/re2/simplify.o\
obj/re2/tostring.o\
obj/re2/unicode_casefold.o\
obj/re2/unicode_groups.o\

TESTOFILES=\
obj/util/pcre.o\
obj/util/random.o\
obj/util/thread.o\
obj/re2/testing/backtrack.o\
obj/re2/testing/dump.o\
obj/re2/testing/exhaustive_tester.o\
obj/re2/testing/null_walker.o\
obj/re2/testing/regexp_generator.o\
obj/re2/testing/string_generator.o\
obj/re2/testing/tester.o\

TESTS=\
obj/test/charclass_test\
obj/test/compile_test\
obj/test/filtered_re2_test\
obj/test/mimics_pcre_test\
obj/test/parse_test\
obj/test/possible_match_test\
obj/test/re2_test\
obj/test/re2_arg_test\
obj/test/required_prefix_test\
obj/test/search_test\
obj/test/simplify_test\
obj/test/string_generator_test\
obj/test/dfa_test\
obj/test/exhaustive1_test\
obj/test/exhaustive2_test\
obj/test/exhaustive3_test\
obj/test/exhaustive_test\
obj/test/random_test\

obj/%.o: %.cc $(HFILES)
@mkdir -p $$(dirname $@)
$(CC) -o $@ $(CFLAGS) $*.cc 2>&1 | sed 5q

obj/%.o: %.c $(HFILES)
@mkdir -p $$(dirname $@)
$(CC) -o $@ $(CFLAGS) $*.c 2>&1 | sed 5q

obj/libre2.a: $(OFILES)
@mkdir -p obj
$(AR) $(ARFLAGS) obj/libre2.a $(OFILES)

obj/test/%: obj/libre2.a obj/re2/testing/%.o $(TESTOFILES) obj/util/test.o
@mkdir -p obj/test
$(CC) -o $@ obj/re2/testing/$*.o $(TESTOFILES) obj/util/test.o obj/libre2.a -lpthread $(LDPCRE)

obj/test/regexp_benchmark: obj/libre2.a obj/re2/testing/regexp_benchmark.o $(TESTOFILES) obj/util/benchmark.o
@mkdir -p obj/test
$(CC) -o $@ obj/re2/testing/regexp_benchmark.o $(TESTOFILES) obj/util/benchmark.o obj/libre2.a -lpthread $(LDPCRE)

clean:
rm -rf obj

testofiles: $(TESTOFILES)

test: $(TESTS)
@./runtests $(TESTS)

benchmark: obj/test/regexp_benchmark

install: obj/libre2.a
mkdir -p /usr/local/include/re2
install -m 444 re2/re2.h /usr/local/include/re2/re2.h
install -m 444 re2/stringpiece.h /usr/local/include/re2/stringpiece.h
install -m 555 obj/libre2.a /usr/local/lib/libre2.a

testinstall:
@mkdir -p obj
cp testinstall.cc obj
(cd obj && g++ -I/usr/local/include testinstall.cc -lre2 -o testinstall)
obj/testinstall

benchlog: obj/test/regexp_benchmark
(echo '==BENCHMARK==' `hostname` `date`; \
(uname -a; g++ --version; hg identify; file obj/test/regexp_benchmark) | sed 's/^/# /'; \
echo; \
./obj/test/regexp_benchmark 'PCRE|RE2') | tee -a benchlog.$$(hostname | sed 's/\..*//')
14 README
@@ -0,0 +1,14 @@
This is the source code repository for RE2, a regular expression library.

For documentation about how to install and use RE2,
visit http://code.google.com/p/re2/.

The short version is:

make
make test
make install
make testinstall

Unless otherwise noted, the RE2 source files are distributed
under the BSD-style license found in the LICENSE file.

0 comments on commit 0a38cba

Please sign in to comment.
You can’t perform that action at this time.