Skip to content

Commit f29b88d

Browse files
Merge pull request #59 from contour-terminal/fix/mktables-python-raw-str
mktables: Make use of Python raw strings for regex strings
2 parents 8084110 + 8f0986a commit f29b88d

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

src/unicode/mktables.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -313,10 +313,10 @@ def __init__(self, _ucd_dir, _header_file, _impl_file):
313313
self.header = open(_header_file, 'w', encoding='utf-8', newline='\u000A')
314314
self.impl = open(_impl_file, 'w', encoding='utf-8', newline='\u000A')
315315

316-
self.singleValueRE = re.compile('([0-9A-F]+)\s*;\s*(\w+)\s*#\s*(.*)$')
317-
self.rangeValueRE = re.compile('([0-9A-F]+)\.\.([0-9A-F]+)\s*;\s*(\w+)\s*#\s*(.*)$')
318-
self.singleValueMultiRE = re.compile('([0-9A-F]+)\s*;\s*([\w\s]+)#\s*(.*)$')
319-
self.rangeValueMultiRE = re.compile('([0-9A-F]+)\.\.([0-9A-F]+)\s*;\s*([\w\s]+)#\s*(.*)$')
316+
self.singleValueRE = re.compile(r'([0-9A-F]+)\s*;\s*(\w+)\s*#\s*(.*)$')
317+
self.rangeValueRE = re.compile(r'([0-9A-F]+)\.\.([0-9A-F]+)\s*;\s*(\w+)\s*#\s*(.*)$')
318+
self.singleValueMultiRE = re.compile(r'([0-9A-F]+)\s*;\s*([\w\s]+)#\s*(.*)$')
319+
self.rangeValueMultiRE = re.compile(r'([0-9A-F]+)\.\.([0-9A-F]+)\s*;\s*([\w\s]+)#\s*(.*)$')
320320

321321
self.general_category_map = dict()
322322
self.general_category = list()
@@ -393,8 +393,8 @@ def load_property_value_aliases(self): # {{{
393393

394394
with uopen(self.ucd_dir + '/' + PropertyValueAliases_fname) as f:
395395
# gc ; C ; Other # Cc | Cf | Cn | Co | Cs
396-
headerRE = re.compile('^#\s*(\w+) \((\w+)\)$')
397-
lineRE = re.compile('^(\w+)\s*;\s*([a-zA-Z0-9_\.]+)\s*;\s*([a-zA-Z0-9_]+).*$')
396+
headerRE = re.compile(r'^#\s*(\w+) \((\w+)\)$')
397+
lineRE = re.compile(r'^(\w+)\s*;\s*([a-zA-Z0-9_\.]+)\s*;\s*([a-zA-Z0-9_]+).*$')
398398
property_values = dict()
399399

400400
while True:
@@ -514,7 +514,7 @@ def write_properties(self): # {{{
514514

515515
def load_general_category(self): # {{{
516516
with uopen(self.ucd_dir + DerivedGeneralCategory_fname) as f:
517-
headerRE = re.compile('^#\s*General_Category=(\w+)$')
517+
headerRE = re.compile(r'^#\s*General_Category=(\w+)$')
518518
property_values = self.property_values['General_Category']
519519
cat_name = ''
520520
cats_grouped = dict()
@@ -646,7 +646,7 @@ def load_generic_properties(self, filename): # {{{
646646

647647
def load_properties(self, filename: str, prop_key: str): # {{{
648648
with uopen(filename) as f:
649-
headerRE = re.compile('^#\s*{}:\s*(\w+)$'.format(prop_key))
649+
headerRE = re.compile(r'^#\s*{}:\s*(\w+)$'.format(prop_key))
650650

651651
# collect
652652
props_name = ''
@@ -767,7 +767,7 @@ def write_scripts(self): # {{{
767767
def load_blocks(self): # {{{
768768
filename = self.ucd_dir + '/' + Blocks_fname
769769
with uopen(filename) as f:
770-
line_regex = re.compile('^([0-9A-Fa-f]+)\.\.([0-9A-Fa-f]+);\s*(.*)$')
770+
line_regex = re.compile(r'^([0-9A-Fa-f]+)\.\.([0-9A-Fa-f]+);\s*(.*)$')
771771
blocks = list()
772772
while True:
773773
line = f.readline()

src/unicode/scan.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ namespace unicode
3939
namespace
4040
{
4141
#if defined(__SSE2__)
42-
int countTrailingZeroBits(unsigned int value) noexcept
42+
[[maybe_unused]] int countTrailingZeroBits(unsigned int value) noexcept
4343
{
44-
#if defined(_WIN32)
44+
#if defined(_WIN32)
4545
return _tzcnt_u32(value);
46-
#else
46+
#else
4747
return __builtin_ctz(value);
48-
#endif
48+
#endif
4949
}
5050
#endif
5151

@@ -78,7 +78,7 @@ size_t detail::scan_for_text_ascii(string_view text, size_t maxColumnCount) noex
7878
auto input = text.data();
7979
auto const end = text.data() + min(text.size(), maxColumnCount);
8080

81-
#if defined(__SSE2__) // TODO: support __aarch64__
81+
#if defined(__SSE2__) // TODO: support __aarch64__
8282
__m128i const ControlCodeMax = _mm_set1_epi8(0x20); // 0..0x1F
8383
__m128i const Complex = _mm_set1_epi8(static_cast<char>(0x80));
8484

0 commit comments

Comments
 (0)