1/** 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16// Autogenerated file -- DO NOT EDIT! 17 18#include <lexer/keywordString.h> 19#include <utils/span.h> 20 21namespace panda::es2panda::lexer { 22 23class KeywordsMap { 24public: 25 KeywordsMap() = delete; 26 27 static Span<const KeywordString> Map(char32_t cp) { 28 switch(cp) { 29% keywords.each do |group| 30 case LEX_CHAR_LOWERCASE_<%= group.keys[0][0].upcase %>: { 31 return Span<const KeywordString>(KEYWORDS_<%= group.keys[0][0].upcase %>); 32 } 33% end 34 default: { 35 return Span<const KeywordString>(); 36 } 37 } 38 } 39 40% keywords.each do |group| 41 42 static constexpr std::array<const KeywordString, <%= group.size %>> KEYWORDS_<%= group.keys[0][0].upcase %> = {{ 43% group.each do |key, kw| 44 {"<%= key%>", <%= kw[0] %>, <%= kw[1] %>}, 45% end 46 }}; 47% end 48}; 49 50} // namespace panda::es2panda::lexer 51