Skip to content

Commit

Permalink
Keep all Binary_Property/Alphabetic
Browse files Browse the repository at this point in the history
  • Loading branch information
jablko committed Dec 18, 2020
1 parent ae2c3b3 commit df6c9cb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 25 deletions.
2 changes: 1 addition & 1 deletion _generated_unicode_regex.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 9 additions & 19 deletions script/generate-regex.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,15 @@ const path = require('path')
const regenerate = require('regenerate')

const set = regenerate()
.add(require('unicode-12.1.0/General_Category/Close_Punctuation/code-points.js'))
.add(require('unicode-12.1.0/General_Category/Control/code-points.js'))
.add(require('unicode-12.1.0/General_Category/Currency_Symbol/code-points.js'))
.add(require('unicode-12.1.0/General_Category/Dash_Punctuation/code-points.js'))
.remove('-') // Except Hyphen-Minus
.add(require('unicode-12.1.0/General_Category/Final_Punctuation/code-points.js'))
.add(require('unicode-12.1.0/General_Category/Format/code-points.js'))
.add(require('unicode-12.1.0/General_Category/Initial_Punctuation/code-points.js'))
.add(require('unicode-12.1.0/General_Category/Line_Separator/code-points.js'))
.add(require('unicode-12.1.0/General_Category/Math_Symbol/code-points.js'))
.add(require('unicode-12.1.0/General_Category/Modifier_Symbol/code-points.js'))
.add(require('unicode-12.1.0/General_Category/Open_Punctuation/code-points.js'))
.add(require('unicode-12.1.0/General_Category/Other_Number/code-points.js'))
.add(require('unicode-12.1.0/General_Category/Other_Punctuation/code-points.js'))
.add(require('unicode-12.1.0/General_Category/Other_Symbol/code-points.js'))
.add(require('unicode-12.1.0/General_Category/Paragraph_Separator/code-points.js'))
.add(require('unicode-12.1.0/General_Category/Private_Use/code-points.js'))
.add(require('unicode-12.1.0/General_Category/Surrogate/code-points.js'))
.add(require('unicode-12.1.0/General_Category/Unassigned/code-points.js'))
.addRange(0x0, 0x10ffff) // Everything
.remove(require('unicode-12.1.0/Binary_Property/Alphabetic/code-points.js')) // Overlaps General_Category/Other_Symbol
.remove(require('unicode-12.1.0/General_Category/Connector_Punctuation/code-points.js'))
.remove(require('unicode-12.1.0/General_Category/Decimal_Number/code-points.js'))
.remove(require('unicode-12.1.0/General_Category/Enclosing_Mark/code-points.js'))
.remove(require('unicode-12.1.0/General_Category/Nonspacing_Mark/code-points.js'))
.remove(require('unicode-12.1.0/General_Category/Space_Separator/code-points.js'))
.remove(require('unicode-12.1.0/General_Category/Spacing_Mark/code-points.js'))
.remove('-') // General_Category/Dash_Punctuation exception

console.log(`/${set.toString()}/g`)
// Then you might want to use a template like this to write the result to a file, along with any regex flags you might need:
Expand Down
10 changes: 5 additions & 5 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ var testCases = [
require('./General_Category/Format.json'),
require('./General_Category/Initial_Punctuation.json'),
require('./General_Category/Letter_Number.json'),
//require('./General_Category/Line_Separator.json'),
//require('./General_Category/Line_Separator.json'), // Presumably d/t .trim()? Not worth fixing?
require('./General_Category/Lowercase_Letter.json'),
require('./General_Category/Math_Symbol.json'),
require('./General_Category/Modifier_Letter.json'),
Expand All @@ -227,12 +227,12 @@ var testCases = [
require('./General_Category/Other_Letter.json'),
require('./General_Category/Other_Number.json'),
require('./General_Category/Other_Punctuation.json'),
//require('./General_Category/Other_Symbol.json'),
//require('./General_Category/Paragraph_Separator.json'),
require('./General_Category/Other_Symbol.json'),
//require('./General_Category/Paragraph_Separator.json'), // Presumably d/t .trim()? Not worth fixing?
require('./General_Category/Private_Use.json'),
//require('./General_Category/Space_Separator.json'),
//require('./General_Category/Space_Separator.json'), // Presumably d/t .trim()? Not worth fixing?
require('./General_Category/Spacing_Mark.json'),
//require('./General_Category/Surrogate.json'),
//require('./General_Category/Surrogate.json'), // Not sure why I can't strip U+DFFF?
require('./General_Category/Titlecase_Letter.json'),
require('./General_Category/Unassigned.json'),
require('./General_Category/Uppercase_Letter.json'),
Expand Down

0 comments on commit df6c9cb

Please sign in to comment.