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 #ifndef ASSEMBLER_PANDASM_H 17 #define ASSEMBLER_PANDASM_H 18 19 #include "utils/pandargs.h" 20 21 namespace panda::pandasm { 22 23 void PrintError(const panda::pandasm::Error &e, const std::string &msg); 24 25 void PrintErrors(const panda::pandasm::ErrorList &warnings, const std::string &msg); 26 27 bool PrepareArgs(panda::PandArgParser &pa_parser, const panda::PandArg<std::string> &input_file, 28 const panda::PandArg<std::string> &output_file, const panda::PandArg<std::string> &log_file, 29 const panda::PandArg<bool> &help, const panda::PandArg<bool> &verbose, std::ifstream &inputfile, 30 int argc, char **argv); 31 32 bool Tokenize(panda::pandasm::Lexer &lexer, std::vector<std::vector<panda::pandasm::Token>> &tokens, 33 std::ifstream &inputfile); 34 35 bool ParseProgram(panda::pandasm::Parser &parser, std::vector<std::vector<panda::pandasm::Token>> &tokens, 36 const panda::PandArg<std::string> &input_file, 37 panda::Expected<panda::pandasm::Program, panda::pandasm::Error> &res); 38 39 bool DumpProgramInJson(panda::pandasm::Program &program, const panda::PandArg<std::string> &scopes_file); 40 41 bool EmitProgramInBinary(panda::pandasm::Program &program, panda::PandArgParser &pa_parser, 42 const panda::PandArg<std::string> &output_file, panda::PandArg<bool> &optimize, 43 panda::PandArg<bool> &size_stat); 44 45 bool BuildFiles(panda::pandasm::Program &program, panda::PandArgParser &pa_parser, 46 const panda::PandArg<std::string> &output_file, panda::PandArg<bool> &optimize, 47 panda::PandArg<bool> &size_stat, panda::PandArg<std::string> &scopes_file); 48 49 } // namespace panda::pandasm 50 51 #endif // ASSEMBLER_PANDASM_H 52