7
7
8
8
namespace Plang . Compiler
9
9
{
10
+ /// <summary>
11
+ /// Represents the configuration settings for the P language compiler.
12
+ /// This class contains all parameters and options that control the compilation process,
13
+ /// including input/output paths, code generation options, and project settings.
14
+ /// </summary>
10
15
public class CompilerConfiguration : ICompilerConfiguration
11
16
{
17
+ /// <summary>
18
+ /// Initializes a new instance of the <see cref="CompilerConfiguration"/> class with default settings.
19
+ /// </summary>
20
+ /// <remarks>
21
+ /// Default settings include:
22
+ /// - No output directory
23
+ /// - Empty input file lists
24
+ /// - "generatedOutput" as project name
25
+ /// - Current directory as project root
26
+ /// - C# as the default output language
27
+ /// - Default location resolver and error handler
28
+ /// - Debug mode disabled
29
+ /// </remarks>
12
30
public CompilerConfiguration ( )
13
31
{
14
32
OutputDirectory = null ;
@@ -25,6 +43,19 @@ public CompilerConfiguration()
25
43
ProjectDependencies = new List < string > ( ) ;
26
44
Debug = false ;
27
45
}
46
+ /// <summary>
47
+ /// Initializes a new instance of the <see cref="CompilerConfiguration"/> class with specific settings.
48
+ /// </summary>
49
+ /// <param name="output">The compiler output handler.</param>
50
+ /// <param name="outputDir">The directory where compiler output will be generated.</param>
51
+ /// <param name="outputLanguages">The list of target programming languages for code generation.</param>
52
+ /// <param name="inputFiles">The list of input files to compile (P files and foreign files).</param>
53
+ /// <param name="projectName">The name of the project being compiled. If null, derives from first input file.</param>
54
+ /// <param name="projectRoot">The root directory of the project. If null, uses the current directory.</param>
55
+ /// <param name="projectDependencies">The list of project dependencies. If null, initializes as empty list.</param>
56
+ /// <param name="pObservePackageName">The name of the PObserve package. If null, defaults to "{ProjectName}.pobserve".</param>
57
+ /// <param name="debug">Flag indicating whether to include debug information in output.</param>
58
+ /// <exception cref="ArgumentException">Thrown when no input files are provided.</exception>
28
59
public CompilerConfiguration ( ICompilerOutput output , DirectoryInfo outputDir , IList < CompilerOutput > outputLanguages , IList < string > inputFiles ,
29
60
string projectName , DirectoryInfo projectRoot = null , IList < string > projectDependencies = null , string pObservePackageName = null , bool debug = false )
30
61
{
@@ -59,21 +90,79 @@ public CompilerConfiguration(ICompilerOutput output, DirectoryInfo outputDir, IL
59
90
Debug = debug ;
60
91
}
61
92
93
+ /// <summary>
94
+ /// Gets or sets the compiler output handler.
95
+ /// </summary>
62
96
public ICompilerOutput Output { get ; set ; }
97
+
98
+ /// <summary>
99
+ /// Gets or sets the directory where compiler output will be generated.
100
+ /// </summary>
63
101
public DirectoryInfo OutputDirectory { get ; set ; }
102
+
103
+ /// <summary>
104
+ /// Gets or sets the list of target programming languages for code generation.
105
+ /// </summary>
64
106
public IList < CompilerOutput > OutputLanguages { get ; set ; }
107
+
108
+ /// <summary>
109
+ /// Gets or sets the name of the project being compiled.
110
+ /// </summary>
65
111
public string ProjectName { get ; set ; }
112
+
113
+ /// <summary>
114
+ /// Gets or sets the name of the PObserve package.
115
+ /// </summary>
66
116
public string PObservePackageName { get ; set ; }
117
+
118
+ /// <summary>
119
+ /// Gets or sets the root directory of the project.
120
+ /// </summary>
67
121
public DirectoryInfo ProjectRootPath { get ; set ; }
122
+
123
+ /// <summary>
124
+ /// Gets or sets the backend code generator.
125
+ /// </summary>
68
126
public ICodeGenerator Backend { get ; set ; }
127
+
128
+ /// <summary>
129
+ /// Gets or sets the list of P language input files to compile.
130
+ /// </summary>
69
131
public IList < string > InputPFiles { get ; set ; }
132
+
133
+ /// <summary>
134
+ /// Gets or sets the list of foreign (non-P) input files to include.
135
+ /// </summary>
70
136
public IList < string > InputForeignFiles { get ; set ; }
137
+
138
+ /// <summary>
139
+ /// Gets or sets the location resolver for source code positions.
140
+ /// </summary>
71
141
public ILocationResolver LocationResolver { get ; set ; }
142
+
143
+ /// <summary>
144
+ /// Gets or sets the handler for translation errors.
145
+ /// </summary>
72
146
public ITranslationErrorHandler Handler { get ; set ; }
73
147
148
+ /// <summary>
149
+ /// Gets or sets the list of project dependencies.
150
+ /// </summary>
74
151
public IList < string > ProjectDependencies { get ; set ; }
152
+
153
+ /// <summary>
154
+ /// Gets or sets a value indicating whether debug information should be included in output.
155
+ /// </summary>
75
156
public bool Debug { get ; set ; }
76
157
158
+ /// <summary>
159
+ /// Copies all properties from another CompilerConfiguration instance to this instance.
160
+ /// </summary>
161
+ /// <param name="parsedConfig">The source configuration to copy from.</param>
162
+ /// <remarks>
163
+ /// This method performs a shallow copy of all properties from the specified configuration
164
+ /// to the current instance, effectively replacing the current configuration.
165
+ /// </remarks>
77
166
public void Copy ( CompilerConfiguration parsedConfig )
78
167
{
79
168
Backend = parsedConfig . Backend ;
@@ -91,4 +180,4 @@ public void Copy(CompilerConfiguration parsedConfig)
91
180
Debug = parsedConfig . Debug ;
92
181
}
93
182
}
94
- }
183
+ }
0 commit comments