Enhanced C#
Language of your choice: 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 () |
Runs the MacroProcessor on all input Files. 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 a text file for each. More... | |
Protected Member Functions | |
virtual void | WriteOutput (InputOutput io) |
|
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.
References LeMP.MacroProcessor.PreOpenedNamespaces.
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 a text file for each.
sink | |
fileNames |
Referenced by LeMP.Compiler.ProcessArguments().
|
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(), Loyc.Syntax.ParsingService.GetServiceForFileName(), LeMP.Compiler.OpenSourceFiles(), and Loyc.Collections.BMultiMap< K, V >.TryGetValue().
|
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. 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>). |
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.
References Loyc.Utilities.UG.ProcessCommandLineArguments().
|
inline |
Runs the MacroProcessor on all input Files.
References LeMP.Compiler.CompleteInputOutputOptions(), LeMP.MacroProcessor.ProcessParallel(), and LeMP.MacroProcessor.ProcessSynchronously().
|
static |