1 | //===-- lib/Parser/char-set.cpp -------------------------------------------===// |
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | #include "flang/Parser/char-set.h" |
10 | |
11 | namespace Fortran::parser { |
12 | |
13 | std::string SetOfChars::ToString() const { |
14 | std::string result; |
15 | SetOfChars set{*this}; |
16 | for (char ch{' '}; !set.empty(); ++ch) { |
17 | if (set.Has(ch)) { |
18 | set = set.Difference(ch); |
19 | result += ch; |
20 | } |
21 | } |
22 | return result; |
23 | } |
24 | } // namespace Fortran::parser |
25 | |