Skip to content

Commit 902a5ce

Browse files
committed
add more detail about code history to ATTRIB file. fixes #11
1 parent 0c9ae85 commit 902a5ce

File tree

1 file changed

+82
-3
lines changed

1 file changed

+82
-3
lines changed

ATTRIB

+82-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,47 @@
11
============
2-
Some of this code is ported from dotnet/corefx, which was released under this license:
2+
These pieces of code were ported from dotnet/corefx:
3+
4+
syntax/charclass.go (from RegexCharClass.cs): ported to use the built-in Go unicode classes. Canonicalize is
5+
a direct port, but most of the other code required large changes because the C# implementation
6+
used a string to represent the CharSet data structure and I cleaned that up in my implementation.
7+
8+
syntax/code.go (from RegexCode.cs): ported literally with various cleanups and layout to make it more Go-ish.
9+
10+
syntax/escape.go (from RegexParser.cs): ported Escape method and added some optimizations. Unescape is inspired by
11+
the C# implementation but couldn't be directly ported because of the lack of do-while syntax in Go.
12+
13+
syntax/parser.go (from RegexpParser.cs and RegexOptions.cs): ported parser struct and associated methods as
14+
literally as possible. Several language differences required changes. E.g. lack pre/post-fix increments as
15+
expressions, lack of do-while loops, lack of overloads, etc.
16+
17+
syntax/prefix.go (from RegexFCD.cs and RegexBoyerMoore.cs): ported as literally as possible and added support
18+
for unicode chars that are longer than the 16-bit char in C# for the 32-bit rune in Go.
19+
20+
syntax/replacerdata.go (from RegexReplacement.cs): conceptually ported and re-organized to handle differences
21+
in charclass implementation, and fix odd code layout between RegexParser.cs, Regex.cs, and RegexReplacement.cs.
22+
23+
syntax/tree.go (from RegexTree.cs and RegexNode.cs): ported literally as possible.
24+
25+
syntax/writer.go (from RegexWriter.cs): ported literally with minor changes to make it more Go-ish.
26+
27+
match.go (from RegexMatch.cs): ported, simplified, and changed to handle Go's lack of inheritence.
28+
29+
regexp.go (from Regex.cs and RegexOptions.cs): conceptually serves the same "starting point", but is simplified
30+
and changed to handle differences in C# strings and Go strings/runes.
31+
32+
replace.go (from RegexReplacement.cs): ported closely and then cleaned up to combine the MatchEvaluator and
33+
simple string replace implementations.
34+
35+
runner.go (from RegexRunner.cs): ported literally as possible.
36+
37+
regexp_test.go (from CaptureTests.cs and GroupNamesAndNumbers.cs): conceptually ported, but the code was
38+
manually structured like Go tests.
39+
40+
replace_test.go (from RegexReplaceStringTest0.cs): conceptually ported
41+
42+
rtl_test.go (from RightToLeft.cs): conceptually ported
43+
---
44+
dotnet/corefx was released under this license:
345

446
The MIT License (MIT)
547

@@ -22,8 +64,18 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2264
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2365
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2466
SOFTWARE.
67+
2568
============
26-
Small pieces of code are copied from the Go framework under this license:
69+
These pieces of code are copied from the Go framework:
70+
71+
- The overall directory structure of regexp2 was inspired by the Go runtime regexp package.
72+
- The optimization in the escape method of syntax/escape.go is from the Go runtime QuoteMeta() func in regexp/regexp.go
73+
- The method signatures in regexp.go are designed to match the Go framework regexp methods closely
74+
- func regexp2.MustCompile and func quote are almost identifical to the regexp package versions
75+
- BenchmarkMatch* and TestProgramTooLong* funcs in regexp_performance_test.go were copied from the framework
76+
regexp/exec_test.go
77+
---
78+
The Go framework was released under this license:
2779

2880
Copyright (c) 2012 The Go Authors. All rights reserved.
2981

@@ -51,4 +103,31 @@ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
51103
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
52104
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
53105
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
54-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
106+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
107+
108+
============
109+
Some test data were gathered from the Mono project.
110+
111+
regexp_mono_test.go: ported from https://github.com/mono/mono/blob/master/mcs/class/System/Test/System.Text.RegularExpressions/PerlTrials.cs
112+
---
113+
Mono tests released under this license:
114+
115+
Permission is hereby granted, free of charge, to any person obtaining
116+
a copy of this software and associated documentation files (the
117+
"Software"), to deal in the Software without restriction, including
118+
without limitation the rights to use, copy, modify, merge, publish,
119+
distribute, sublicense, and/or sell copies of the Software, and to
120+
permit persons to whom the Software is furnished to do so, subject to
121+
the following conditions:
122+
123+
The above copyright notice and this permission notice shall be
124+
included in all copies or substantial portions of the Software.
125+
126+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
127+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
128+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
129+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
130+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
131+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
132+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
133+

0 commit comments

Comments
 (0)