@@ -296,7 +296,7 @@ void Pattern::init(const char *options, const uint8_t *pred)
296
296
for (DFA::State::Edges::iterator t = state->edges .begin (); t != state->edges .end (); ++t)
297
297
{
298
298
Char c = t->first ;
299
- if (c >= ' a ' && c <= ' z ' )
299
+ if (islowercase (c) )
300
300
{
301
301
state->edges [uppercase (c)] = DFA::State::Edge (uppercase (c), t->second .second );
302
302
++eno_;
@@ -828,7 +828,7 @@ void Pattern::parse(
828
828
c = static_cast <Char>(s - abtnvfr + ' \a ' );
829
829
}
830
830
}
831
- else if (c >= ' A ' && c <= ' Z ' && opt_.i )
831
+ else if (isuppercase (c) && opt_.i )
832
832
{
833
833
c = lowercase (c);
834
834
}
@@ -1736,7 +1736,7 @@ void Pattern::compile(
1736
1736
Char c = t->first ;
1737
1737
DFA::State *target_state = last_state = last_state->next = dfa_.state (t->second .second );
1738
1738
state->edges [c] = DFA::State::Edge (c, target_state);
1739
- if (c >= ' a ' && c <= ' z ' )
1739
+ if (islowercase (c) )
1740
1740
{
1741
1741
state->edges [uppercase (c)] = DFA::State::Edge (uppercase (c), target_state);
1742
1742
++eno_;
@@ -1765,7 +1765,7 @@ void Pattern::compile(
1765
1765
{
1766
1766
Char c = t->first ;
1767
1767
chars.add (c);
1768
- if (c >= ' a ' && c <= ' z ' )
1768
+ if (islowercase (c) )
1769
1769
chars.add (uppercase (c));
1770
1770
}
1771
1771
}
@@ -1791,9 +1791,9 @@ void Pattern::compile(
1791
1791
{
1792
1792
if (common.contains (c))
1793
1793
{
1794
- if (std::isalpha (c))
1794
+ if (isanycase (c))
1795
1795
{
1796
- if (c >= ' a ' && c <= ' z ' )
1796
+ if (islowercase (c) )
1797
1797
{
1798
1798
pos = i->second ;
1799
1799
DFA::State *target_state = last_state = last_state->next = dfa_.state (state->tnode ->edges [c].second , pos);
@@ -1853,7 +1853,7 @@ void Pattern::compile(
1853
1853
if (chars.contains (c))
1854
1854
{
1855
1855
DFA::State *target_state = last_state = last_state->next = dfa_.state (state->tnode ->edges [c].second );
1856
- if (std::isalpha (c))
1856
+ if (isanycase (c))
1857
1857
{
1858
1858
state->edges [lowercase (c)] = DFA::State::Edge (lowercase (c), target_state);
1859
1859
state->edges [uppercase (c)] = DFA::State::Edge (uppercase (c), target_state);
@@ -1893,7 +1893,7 @@ void Pattern::compile(
1893
1893
DFA::State *target_state = last_state = last_state->next = dfa_.state (&t->second );
1894
1894
state->edges [c] = DFA::State::Edge (c, target_state);
1895
1895
++eno_;
1896
- if (opt_.i && c >= ' a ' && c <= ' z ' )
1896
+ if (opt_.i && islowercase (c) )
1897
1897
{
1898
1898
state->edges [uppercase (c)] = DFA::State::Edge (uppercase (c), target_state);
1899
1899
++eno_;
@@ -1911,12 +1911,8 @@ void Pattern::compile(
1911
1911
for (std::map<Char,Tree::Node>::iterator t = state->tnode ->edges .begin (); t != state->tnode ->edges .end (); ++t)
1912
1912
{
1913
1913
Char c = t->first ;
1914
- if (c >= ' a' )
1915
- {
1916
- if (c > ' z' )
1917
- break ;
1914
+ if (islowercase (c))
1918
1915
chars.add (uppercase (c));
1919
- }
1920
1916
}
1921
1917
}
1922
1918
Moves::iterator i = moves.begin ();
@@ -1936,9 +1932,9 @@ void Pattern::compile(
1936
1932
{
1937
1933
if (common.contains (c))
1938
1934
{
1939
- if (std::isalpha (c))
1935
+ if (isanycase (c))
1940
1936
{
1941
- if (c >= ' a ' && c <= ' z ' )
1937
+ if (islowercase (c) )
1942
1938
{
1943
1939
pos = i->second ;
1944
1940
DFA::State *target_state = last_state = last_state->next = dfa_.state (&state->tnode ->edges [c], pos);
@@ -1996,7 +1992,7 @@ void Pattern::compile(
1996
1992
if (chars.contains (c))
1997
1993
{
1998
1994
DFA::State *target_state = last_state = last_state->next = dfa_.state (&state->tnode ->edges [c]);
1999
- if (opt_.i && std::isalpha (c))
1995
+ if (opt_.i && isanycase (c))
2000
1996
{
2001
1997
state->edges [lowercase (c)] = DFA::State::Edge (lowercase (c), target_state);
2002
1998
state->edges [uppercase (c)] = DFA::State::Edge (uppercase (c), target_state);
@@ -2027,7 +2023,7 @@ void Pattern::compile(
2027
2023
{
2028
2024
Char c = (i << 4 ) + j;
2029
2025
DFA::State *target_state = last_state = last_state->next = dfa_.state (p[j]);
2030
- if (opt_.i && std::isalpha (c))
2026
+ if (opt_.i && isanycase (c))
2031
2027
{
2032
2028
state->edges [lowercase (c)] = DFA::State::Edge (lowercase (c), target_state);
2033
2029
state->edges [uppercase (c)] = DFA::State::Edge (uppercase (c), target_state);
@@ -2083,9 +2079,9 @@ void Pattern::compile(
2083
2079
{
2084
2080
if (common.contains (c))
2085
2081
{
2086
- if (std::isalpha (c))
2082
+ if (isanycase (c))
2087
2083
{
2088
- if (c >= ' a ' && c <= ' z ' )
2084
+ if (islowercase (c) )
2089
2085
{
2090
2086
pos = i->second ;
2091
2087
DFA::State *target_state = last_state = last_state->next = dfa_.state (state->tnode ->edge [c >> 4 ][c & 0xf ], pos);
@@ -2143,7 +2139,7 @@ void Pattern::compile(
2143
2139
if (chars.contains (c))
2144
2140
{
2145
2141
DFA::State *target_state = last_state = last_state->next = dfa_.state (state->tnode ->edge [c >> 4 ][c & 0xf ]);
2146
- if (opt_.i && std::isalpha (c))
2142
+ if (opt_.i && isanycase (c))
2147
2143
{
2148
2144
state->edges [lowercase (c)] = DFA::State::Edge (lowercase (c), target_state);
2149
2145
state->edges [uppercase (c)] = DFA::State::Edge (uppercase (c), target_state);
@@ -2456,10 +2452,10 @@ void Pattern::compile_transition(
2456
2452
Chars chars;
2457
2453
if (literal)
2458
2454
{
2459
- if (std::isalpha (c) && is_modified (ModConst::i, modifiers, loc))
2455
+ if (isanycase (c) && is_modified (ModConst::i, modifiers, loc))
2460
2456
{
2461
- chars.add (uppercase (c));
2462
2457
chars.add (lowercase (c));
2458
+ chars.add (uppercase (c));
2463
2459
}
2464
2460
else
2465
2461
{
@@ -2499,10 +2495,10 @@ void Pattern::compile_transition(
2499
2495
switch (escape_at (loc))
2500
2496
{
2501
2497
case ' \0 ' : // no escape at current loc
2502
- if (std::isalpha (c) && is_modified (ModConst::i, modifiers, loc))
2498
+ if (isanycase (c) && is_modified (ModConst::i, modifiers, loc))
2503
2499
{
2504
- chars.add (uppercase (c));
2505
2500
chars.add (lowercase (c));
2501
+ chars.add (uppercase (c));
2506
2502
}
2507
2503
else
2508
2504
{
@@ -2539,10 +2535,10 @@ void Pattern::compile_transition(
2539
2535
break ;
2540
2536
default :
2541
2537
c = parse_esc (loc, &chars);
2542
- if (c <= ' z ' && std::isalpha (c) && is_modified (ModConst::i, modifiers, loc))
2538
+ if (isanycase (c) && is_modified (ModConst::i, modifiers, loc))
2543
2539
{
2544
- chars.add (uppercase (c));
2545
2540
chars.add (lowercase (c));
2541
+ chars.add (uppercase (c));
2546
2542
}
2547
2543
}
2548
2544
}
@@ -2667,7 +2663,7 @@ void Pattern::compile_list(Location loc, Chars& chars, const Mods modifiers) con
2667
2663
{
2668
2664
if (is_modified (ModConst::i, modifiers, loc))
2669
2665
{
2670
- if (lo >= ' a ' && lo <= ' z ' && c >= ' A ' && c <= ' Z ' )
2666
+ if (islowercase (lo) && isuppercase (c) )
2671
2667
c = lowercase (c);
2672
2668
Char a = lo;
2673
2669
Char b = c;
@@ -2691,10 +2687,10 @@ void Pattern::compile_list(Location loc, Chars& chars, const Mods modifiers) con
2691
2687
}
2692
2688
else
2693
2689
{
2694
- if (std::isalpha (c) && is_modified (ModConst::i, modifiers, loc))
2690
+ if (isanycase (c) && is_modified (ModConst::i, modifiers, loc))
2695
2691
{
2696
- chars.add (uppercase (c));
2697
2692
chars.add (lowercase (c));
2693
+ chars.add (uppercase (c));
2698
2694
}
2699
2695
else
2700
2696
{
0 commit comments