Skip to content

Commit

Permalink
Merge pull request #16 from artichoke/autogen-comments
Browse files Browse the repository at this point in the history
Add documentation that some sources are autogenerated
  • Loading branch information
lopopolo authored Aug 22, 2020
2 parents 8b4e9db + 6627381 commit 9aa7dc5
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 0 deletions.
26 changes: 26 additions & 0 deletions scripts/gen_case_lookups.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

mappings = File.readlines('CaseFolding.txt')

casefolding_version = mappings[0..2].map { |line| "// #{line.delete_prefix('# ')}" }.join.chomp

char_mappings = Hash.new { |hash, key| hash[key] = {} }

mappings.each do |line|
Expand Down Expand Up @@ -60,6 +62,14 @@
rs = File.open('src/folding/mapping/lookup.rs', 'w')

rs.puts(<<~AUTOGEN)
// This source is autogenerated. Do not modify it directly.
// To make modfications to this code, see `scripts/gen_case_lookups.rb`.
//
// Last generated on #{Time.now.utc}.
//
// Unicode version:
#{casefolding_version}
use super::{Mapping, Mode};
#[must_use]
Expand Down Expand Up @@ -181,6 +191,14 @@
rs = File.open('tests/full_fold_exhaustive.rs', 'w')

rs.puts(<<~AUTOGEN)
// This source is autogenerated. Do not modify it directly.
// To make modfications to this code, see `scripts/gen_case_lookups.rb`.
//
// Last generated on #{Time.now.utc}.
//
// Unicode version:
#{casefolding_version}
use core::char;
use core::cmp::Ordering;
use focaccia::{unicode_full_case_eq, unicode_full_casecmp};
Expand Down Expand Up @@ -258,6 +276,14 @@
rs = File.open('tests/full_turkic_fold_exhaustive.rs', 'w')

rs.puts(<<~AUTOGEN)
// This source is autogenerated. Do not modify it directly.
// To make modfications to this code, see `scripts/gen_case_lookups.rb`.
//
// Last generated on #{Time.now.utc}.
//
// Unicode version:
#{casefolding_version}
use core::char;
use core::cmp::Ordering;
use focaccia::{unicode_full_turkic_case_eq, unicode_full_turkic_casecmp};
Expand Down
10 changes: 10 additions & 0 deletions src/folding/mapping/lookup.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
// This source is autogenerated. Do not modify it directly.
// To make modfications to this code, see `scripts/gen_case_lookups.rb`.
//
// Last generated on 2020-08-22 00:52:59 UTC.
//
// Unicode version:
// CaseFolding-13.0.0.txt
// Date: 2019-09-08, 23:30:59 GMT
// © 2019 Unicode®, Inc.

use super::{Mapping, Mode};

#[must_use]
Expand Down
10 changes: 10 additions & 0 deletions tests/full_fold_exhaustive.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
// This source is autogenerated. Do not modify it directly.
// To make modfications to this code, see `scripts/gen_case_lookups.rb`.
//
// Last generated on 2020-08-22 00:52:59 UTC.
//
// Unicode version:
// CaseFolding-13.0.0.txt
// Date: 2019-09-08, 23:30:59 GMT
// © 2019 Unicode®, Inc.

use core::char;
use core::cmp::Ordering;
use focaccia::{unicode_full_case_eq, unicode_full_casecmp};
Expand Down
10 changes: 10 additions & 0 deletions tests/full_turkic_fold_exhaustive.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
// This source is autogenerated. Do not modify it directly.
// To make modfications to this code, see `scripts/gen_case_lookups.rb`.
//
// Last generated on 2020-08-22 00:52:59 UTC.
//
// Unicode version:
// CaseFolding-13.0.0.txt
// Date: 2019-09-08, 23:30:59 GMT
// © 2019 Unicode®, Inc.

use core::char;
use core::cmp::Ordering;
use focaccia::{unicode_full_turkic_case_eq, unicode_full_turkic_casecmp};
Expand Down

0 comments on commit 9aa7dc5

Please sign in to comment.