-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfig.h
95 lines (80 loc) · 3.17 KB
/
config.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/**
* Copyright (c) 2024 the OpenCML Organization
* Camel is licensed under the MIT license.
* You can use this software according to the terms and conditions of the
* MIT license. You may obtain a copy of the MIT license at:
* [https://opensource.org/license/mit]
*
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY
* KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
* NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
*
* See the the MIT license for more details.
*
* Author: Zhenjie Wei
* Created: Mar. 17, 2024
* Updated: Mar. 16, 2025
* Supported by: National Key Research and Development Program of China
*/
#ifndef CONFIG_H
#define CONFIG_H
#endif
#define VERSION "0.0.13"
#include <string>
enum class Command { RUN, INFO, FORMAT, CHECK, INSPECT, BUILD, SERVE, DEBUG }; // Modes of operation
bool parseArgs(int argc, char *argv[]);
namespace CmdLineArgs {
extern Command selectedCommand;
namespace Run {
extern std::string outputFile;
extern std::string errorFormat;
extern std::vector<std::string> scriptsDirs;
extern std::vector<std::string> targetFiles;
extern bool profile;
extern bool noCache;
extern bool semanticOnly;
extern unsigned int repeat;
extern int maxThreads;
} // namespace Run
namespace Format {
extern std::string quotePrefer; // Quote preference (default to single quotes)
extern std::string configFile; // Configuration file path
extern bool useTabs; // Whether to use tabs for indentation
extern bool inplace; // Whether to modify the input file in place
extern bool ignoreDefiFile; // Whether to ignore the definition file
extern bool formatCode;
extern unsigned int tabSize; // Indentation size in spaces
extern unsigned int maxWidth; // Max line width
}; // namespace Format
namespace Check {
extern bool lexical; // Whether to check lexical errors
extern bool syntaxOnly; // Whether to check syntax only
extern bool ignoreDefiFile; // Whether to ignore the definition file
extern std::string outputFormat; // Output format (default to JSON)
extern std::string configFilePath; // Configuration file path
extern unsigned int maxWaring; // Max warnings
} // namespace Check
namespace Inspect {
extern bool dumpTokens; // Whether to dump tokens
extern bool dumpCST; // Whether to dump CST
extern bool dumpAST; // Whether to dump AST
extern bool dumpGCT; // Whether to dump GCT
extern bool dumpGIR; // Whether to dump GIR
extern int passUntil; // Pass until the given pass
} // namespace Inspect
namespace Build {
extern bool optimize; // Whether to optimize the code
extern bool rollup; // Whether to rollup the code
extern bool verbose; // Whether to show verbose information
extern std::string warningSwitch; // Warning switch (default to on)
extern std::string outputDir; // Output directory
} // namespace Build
namespace Serve {
extern std::string serverHost; // Server host
extern unsigned int serverPort; // Server port
} // namespace Serve
namespace Debug {
extern std::string variable; // Whether to optimize the code
} // namespace Debug
} // namespace CmdLineArgs
namespace CLI = CmdLineArgs;