Éanna Ó Catháin | c6ab02a | 2021-04-07 14:35:25 +0100 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2020 Arm Ltd and Contributors. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #include "Decoder.hpp" |
| 7 | |
| 8 | namespace asr { |
| 9 | |
| 10 | Decoder::Decoder(std::map<int, std::string>& labels): |
| 11 | m_labels(labels) |
| 12 | {} |
| 13 | |
| 14 | std::string Decoder::FilterCharacters(std::vector<char>& unfiltered) |
| 15 | { |
| 16 | std::string filtered = ""; |
| 17 | |
| 18 | for(int i = 0; i < unfiltered.size(); ++i) |
| 19 | { |
| 20 | if (unfiltered.at(i) == '$') |
| 21 | { |
| 22 | continue; |
| 23 | } |
| 24 | |
| 25 | else if (i + 1 < unfiltered.size() && unfiltered.at(i) == unfiltered.at(i + 1)) |
| 26 | { |
| 27 | continue; |
| 28 | } |
| 29 | else |
| 30 | { |
| 31 | filtered += unfiltered.at(i); |
| 32 | } |
| 33 | } |
| 34 | return filtered; |
| 35 | } |
| 36 | }// namespace |
| 37 | |