|
Enhanced C#
Loyc library documentation
|
A class that helps you invoke MacroProcessor on on a set of source files, given a set of command-line options. More...
A class that helps you invoke MacroProcessor on on a set of source files, given a set of command-line options.
This class helps you process command-line options (see ProcessArguments(IList{string}, bool, bool, IList{string})), complete InputOutput objects based on those options (see CompleteInputOutputOptions), and add macros from Assemblies (AddMacros and AddStdMacros). When everything is set up, call Run().
Public fields | |
| List< InputOutput > | Files |
| bool | Parallel = true |
| MacroProcessor | MacroProcessor |
| IParsingService | InLang |
| bool | PreserveComments = true |
| ParsingMode | ParsingMode = ParsingMode.File |
| ILNodePrinter | OutLang |
| LNodePrinterOptions | OutOptions = new LNodePrinterOptions { IndentString = "\t", NewlineString = "\n" } |
| string | OutExt |
| bool | ForceInLang |
Public static fields | |
| static InvertibleSet< string > | TwoArgOptions = new InvertibleSet<string>(new[] { "macros" }) |
| static Dictionary< char, string > | ShortOptions |
| static MMap< string, Pair < string, string > > | KnownOptions |
Properties | |
| IMessageSink | Sink [get, set] |
| int | MaxExpansions [get, set] |
| TimeSpan | AbortTimeout [get, set] |
| bool | Verbose [get] |
Public Member Functions | |
| Compiler (IMessageSink sink, Type prelude=null, bool registerEcsAndLes=true) | |
| Compiler (IMessageSink sink, Type prelude, IEnumerable< InputOutput > sourceFiles) | |
| BMultiMap< string, string > | ProcessArguments (IList< string > args, bool warnAboutUnknownOptions, bool autoOpenInputFiles, IList< string > inputFiles=null) |
| Processes command-line arguments to build a BMultiMap and sends those options to the other overload of this method. More... | |
| bool | ProcessArguments (BMultiMap< string, string > options, bool warnAboutUnknownOptions, IList< string > inputFiles=null) |
| Processes all standard command-line arguments from KnownOptions, except –help. More... | |
| void | AddStdMacros () |
| Adds standard macros from LeMP.StdMacros.dll, and adds the namespaces LeMP and LeMP.Prelude to the pre-opened namespace list. More... | |
| void | CompleteInputOutputOptions () |
| Fills in all fields of Files that are still null, based on the command-line options. Calling this is optional, since Run() calls it anyway. More... | |
| void | CompleteInputOutputOptions (InputOutput file) |
| int | AddMacros (Assembly assembly) |
| void | Run () |
| Calls CompleteInputOutputOptions, runs the MacroProcessor on all input Files, and writes the output to the output files by calling the protected method WriteOutput. More... | |
Static Public Member Functions | |
| static void | Main (string[] args) |
| static void | WarnAboutUnknownOptions (BMultiMap< string, string > options, IMessageSink sink, IDictionary< string, Pair< string, string >> knownOptions) |
| static bool | MaybeShowHelp (ICollection< KeyValuePair< string, string >> options, ICollection< KeyValuePair< string, Pair< string, string >>> knownOptions, TextWriter @out=null) |
| static void | ShowHelp (IEnumerable< KeyValuePair< string, Pair< string, string >>> knownOptions, TextWriter @out=null, bool includeUsageLine=true) |
| static List< InputOutput > | OpenSourceFiles (IMessageSink sink, IEnumerable< string > fileNames) |
| Opens a set of source files by file name, and creates an InputOutput object for each. More... | |
Protected Member Functions | |
| virtual void | WriteOutput (InputOutput io) |
| Writes results from InputOutput.Output to InputOutput.OutFileName using InputOutput.OutPrinter according to InputOutput.OutOptions. More... | |
|
inline |
Adds standard macros from LeMP.StdMacros.dll, and adds the namespaces LeMP and LeMP.Prelude to the pre-opened namespace list.
Note: prelude macros were already added by the constructor.
Referenced by LeMP.Compiler.ProcessArguments().
|
inline |
Fills in all fields of Files that are still null, based on the command-line options. Calling this is optional, since Run() calls it anyway.
Referenced by LeMP.Compiler.Run().
|
inlinestatic |
Opens a set of source files by file name, and creates an InputOutput object for each.
| sink | Any I/O errors that occur will be logged to this object. |
| fileNames | List of file names |
Referenced by LeMP.Compiler.ProcessArguments().
|
inline |
Processes command-line arguments to build a BMultiMap and sends those options to the other overload of this method.
| args | Arg list from which to extract options. NOTE: discovered options are removed from the list, so this parameter cannot be an array. |
| warnAboutUnknownOptions | Whether this method should call WarnAboutUnknownOptions for you. |
| autoOpenInputFiles | Whether to open input files for you by calling OpenSourceFiles(IMessageSink, IEnumerable{string}) and adding the files to the Files list. |
| inputFiles | A list of input files to open if autoOpenInputFiles is true. If this is null, The input files are assumed to be those command-line arguments left over after the options are removed. |
Note: If you get your command-line arguments as a single string, use G.SplitCommandLineArguments(string) first to split it into an array.
This method doesn't check for –help. To implement –help, call MaybeShowHelp on the return value.
|
inline |
Processes all standard command-line arguments from KnownOptions, except –help.
| options | A set of options, presumably derived from command- line options using UG.ProcessCommandLineArguments |
| warnAboutUnknownOptions | Whether to warn (to Sink) about options not listed in KnownOptions. |
| inputFiles | Files to open with OpenSourceFiles |
This method calls AddStdMacros() unless options includes "nostdmacros".
References LeMP.Compiler.AddStdMacros(), and LeMP.Compiler.OpenSourceFiles().
|
inline |
Calls CompleteInputOutputOptions, runs the MacroProcessor on all input Files, and writes the output to the output files by calling the protected method WriteOutput.
References LeMP.Compiler.CompleteInputOutputOptions(), and LeMP.Compiler.WriteOutput().
|
inlineprotectedvirtual |
Writes results from InputOutput.Output to InputOutput.OutFileName using InputOutput.OutPrinter according to InputOutput.OutOptions.
In case of –eval inputs, output is sent to the Console. Status, warning and error messages are sent to Sink.
Reimplemented in LeMP.TestCompiler.
Referenced by LeMP.Compiler.Run().
|
static |
|
static |
1.8.7