2020-02-25 23:11:52 +08:00
|
|
|
//===-- lib/Parser/char-set.cpp -------------------------------------------===//
|
2018-05-02 03:50:34 +08:00
|
|
|
//
|
2019-12-21 04:52:07 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2018-05-02 03:50:34 +08:00
|
|
|
//
|
2020-01-11 04:12:03 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2018-05-02 03:50:34 +08:00
|
|
|
|
2020-02-25 23:11:52 +08:00
|
|
|
#include "flang/Parser/char-set.h"
|
2018-04-19 02:26:17 +08:00
|
|
|
|
2018-05-03 04:48:12 +08:00
|
|
|
namespace Fortran::parser {
|
2018-04-19 02:26:17 +08:00
|
|
|
|
2018-04-19 07:28:29 +08:00
|
|
|
std::string SetOfChars::ToString() const {
|
2018-04-19 02:26:17 +08:00
|
|
|
std::string result;
|
2018-04-19 08:05:07 +08:00
|
|
|
SetOfChars set{*this};
|
|
|
|
for (char ch{' '}; !set.empty(); ++ch) {
|
|
|
|
if (set.Has(ch)) {
|
|
|
|
set = set.Difference(ch);
|
2018-04-19 04:24:41 +08:00
|
|
|
result += ch;
|
2018-04-19 02:26:17 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
2020-03-29 12:00:16 +08:00
|
|
|
} // namespace Fortran::parser
|