Skip to content

Commit

Permalink
add more detail about code history to ATTRIB file. fixes dlclark#11
Browse files Browse the repository at this point in the history
  • Loading branch information
dlclark committed Mar 31, 2017
1 parent 0c9ae85 commit 902a5ce
Showing 1 changed file with 82 additions and 3 deletions.
85 changes: 82 additions & 3 deletions ATTRIB
Original file line number Diff line number Diff line change
@@ -1,5 +1,47 @@
============
Some of this code is ported from dotnet/corefx, which was released under this license:
These pieces of code were ported from dotnet/corefx:

syntax/charclass.go (from RegexCharClass.cs): ported to use the built-in Go unicode classes. Canonicalize is
a direct port, but most of the other code required large changes because the C# implementation
used a string to represent the CharSet data structure and I cleaned that up in my implementation.

syntax/code.go (from RegexCode.cs): ported literally with various cleanups and layout to make it more Go-ish.

syntax/escape.go (from RegexParser.cs): ported Escape method and added some optimizations. Unescape is inspired by
the C# implementation but couldn't be directly ported because of the lack of do-while syntax in Go.

syntax/parser.go (from RegexpParser.cs and RegexOptions.cs): ported parser struct and associated methods as
literally as possible. Several language differences required changes. E.g. lack pre/post-fix increments as
expressions, lack of do-while loops, lack of overloads, etc.

syntax/prefix.go (from RegexFCD.cs and RegexBoyerMoore.cs): ported as literally as possible and added support
for unicode chars that are longer than the 16-bit char in C# for the 32-bit rune in Go.

syntax/replacerdata.go (from RegexReplacement.cs): conceptually ported and re-organized to handle differences
in charclass implementation, and fix odd code layout between RegexParser.cs, Regex.cs, and RegexReplacement.cs.

syntax/tree.go (from RegexTree.cs and RegexNode.cs): ported literally as possible.

syntax/writer.go (from RegexWriter.cs): ported literally with minor changes to make it more Go-ish.

match.go (from RegexMatch.cs): ported, simplified, and changed to handle Go's lack of inheritence.

regexp.go (from Regex.cs and RegexOptions.cs): conceptually serves the same "starting point", but is simplified
and changed to handle differences in C# strings and Go strings/runes.

replace.go (from RegexReplacement.cs): ported closely and then cleaned up to combine the MatchEvaluator and
simple string replace implementations.

runner.go (from RegexRunner.cs): ported literally as possible.

regexp_test.go (from CaptureTests.cs and GroupNamesAndNumbers.cs): conceptually ported, but the code was
manually structured like Go tests.

replace_test.go (from RegexReplaceStringTest0.cs): conceptually ported

rtl_test.go (from RightToLeft.cs): conceptually ported
---
dotnet/corefx was released under this license:

The MIT License (MIT)

Expand All @@ -22,8 +64,18 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

============
Small pieces of code are copied from the Go framework under this license:
These pieces of code are copied from the Go framework:

- The overall directory structure of regexp2 was inspired by the Go runtime regexp package.
- The optimization in the escape method of syntax/escape.go is from the Go runtime QuoteMeta() func in regexp/regexp.go
- The method signatures in regexp.go are designed to match the Go framework regexp methods closely
- func regexp2.MustCompile and func quote are almost identifical to the regexp package versions
- BenchmarkMatch* and TestProgramTooLong* funcs in regexp_performance_test.go were copied from the framework
regexp/exec_test.go
---
The Go framework was released under this license:

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

Expand Down Expand Up @@ -51,4 +103,31 @@ 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.
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

============
Some test data were gathered from the Mono project.

regexp_mono_test.go: ported from https://github.com/mono/mono/blob/master/mcs/class/System/Test/System.Text.RegularExpressions/PerlTrials.cs
---
Mono tests released under this license:

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

0 comments on commit 902a5ce

Please sign in to comment.