File tree 3 files changed +9
-4
lines changed
3 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,13 @@ inline constexpr bool IsLegalInIdentifier(char ch) {
58
58
return IsLegalIdentifierStart (ch) || IsDecimalDigit (ch);
59
59
}
60
60
61
+ inline constexpr bool IsPrintable (char ch) { return ch >= ' ' && ch <= ' ~' ; }
62
+
63
+ inline constexpr bool IsWhiteSpace (char ch) {
64
+ return ch == ' ' || ch == ' \t ' || ch == ' \n ' || ch == ' \v ' || ch == ' \f ' ||
65
+ ch == ' \r ' ;
66
+ }
67
+
61
68
inline constexpr char ToLowerCaseLetter (char ch) {
62
69
return IsUpperCaseLetter (ch) ? ch - ' A' + ' a' : ch;
63
70
}
Original file line number Diff line number Diff line change 19
19
#include " flang/Parser/characters.h"
20
20
#include " flang/Parser/instrumented-parser.h"
21
21
#include " flang/Parser/provenance.h"
22
- #include < cctype>
23
22
#include < cstddef>
24
23
#include < cstring>
25
24
#include < functional>
@@ -526,7 +525,7 @@ struct HollerithLiteral {
526
525
int chBytes{UTF_8CharacterBytes (state.GetLocation ())};
527
526
for (int bytes{chBytes}; bytes > 0 ; --bytes) {
528
527
if (std::optional<const char *> at{nextCh.Parse (state)}) {
529
- if (chBytes == 1 && !std::isprint (**at)) {
528
+ if (chBytes == 1 && !IsPrintable (**at)) {
530
529
state.Say (start, " Bad character in Hollerith" _err_en_US);
531
530
return std::nullopt;
532
531
}
Original file line number Diff line number Diff line change 11
11
#include " flang/Common/template.h"
12
12
#include " flang/Parser/parse-tree-visitor.h"
13
13
#include " flang/Semantics/semantics.h"
14
- #include < cctype>
15
14
#include < cstdarg>
16
15
#include < type_traits>
17
16
@@ -926,7 +925,7 @@ parser::CharBlock SkipLabel(const parser::CharBlock &position) {
926
925
std::size_t i{1l };
927
926
for (; (i < maxPosition) && parser::IsDecimalDigit (position[i]); ++i) {
928
927
}
929
- for (; (i < maxPosition) && std::isspace (position[i]); ++i) {
928
+ for (; (i < maxPosition) && parser::IsWhiteSpace (position[i]); ++i) {
930
929
}
931
930
return parser::CharBlock{position.begin () + i, position.end ()};
932
931
}
You can’t perform that action at this time.
0 commit comments