C# 클래스 LeMP.Compiler

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).
파일 보기 프로젝트 열기: qwertie/ecsharp 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
Files List
ForceInLang bool
InLang IParsingService
IndentString string
KnownOptions MMap>
MacroProcessor MacroProcessor
NewlineString string
OutExt string
OutLang ILNodePrinter
OutOptions Loyc.Syntax.LNodePrinterOptions
Parallel bool
ParsingMode Loyc.Syntax.ParsingMode
PreserveComments bool
ShortOptions string>.Dictionary
TwoArgOptions InvertibleSet

공개 메소드들

메소드 설명
AddMacros ( Assembly assembly ) : bool
AddStdMacros ( ) : void

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.

Compiler ( IMessageSink sink, Type prelude, IEnumerable sourceFiles ) : System
Compiler ( IMessageSink sink, Type prelude = null, bool registerEcsAndLes = true ) : System
CompleteInputOutputOptions ( ) : void

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.

CompleteInputOutputOptions ( InputOutput file ) : void
MaybeShowHelp ( string>.ICollection options, string>.ICollection knownOptions, TextWriter @out = null ) : bool
OpenSourceFiles ( IMessageSink sink, IEnumerable fileNames ) : List

Opens a set of source files by file name, and creates a text file for each.

ProcessArguments ( IList args, bool warnAboutUnknownOptions, bool autoOpenInputFiles, IList inputFiles = null ) : string>.BMultiMap

Processes command-line arguments to build a BMultiMap and sends those options to the other overload of this method.

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.

ProcessArguments ( string>.BMultiMap options, bool warnAboutUnknownOptions, IList inputFiles = null ) : bool

Processes all standard command-line arguments from KnownOptions, except --help.

This method calls AddStdMacros() unless options includes "nostdmacros".

Run ( ) : void

Runs the MacroProcessor on all input Files.

ShowHelp ( string>.IEnumerable knownOptions, TextWriter @out = null, bool includeUsageLine = true ) : void
WarnAboutUnknownOptions ( string>.BMultiMap options, IMessageSink sink, string>.IDictionary knownOptions ) : void

보호된 메소드들

메소드 설명
WriteOutput ( InputOutput io ) : void

비공개 메소드들

메소드 설명
ApplyLanguageOption ( IMessageSink sink, string option, string value, IParsingService &lang ) : void
IndexOfExtension ( string fn ) : int
Main ( string args ) : void
ParseBoolOption ( string>.BMultiMap options, string key, IMessageSink sink ) : bool?
ParseNumericOption ( string>.BMultiMap options, string key, IMessageSink sink, double min = null, double max = null ) : double?
SetPropertyHelper ( string exprStr, bool quote ) : bool
TryCatch ( object context, IMessageSink sink, System.Action action ) : bool

메소드 상세

AddMacros() 공개 메소드

public AddMacros ( Assembly assembly ) : bool
assembly System.Reflection.Assembly
리턴 bool

AddStdMacros() 공개 메소드

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.
public AddStdMacros ( ) : void
리턴 void

Compiler() 공개 메소드

public Compiler ( IMessageSink sink, Type prelude, IEnumerable sourceFiles ) : System
sink IMessageSink
prelude System.Type
sourceFiles IEnumerable
리턴 System

Compiler() 공개 메소드

public Compiler ( IMessageSink sink, Type prelude = null, bool registerEcsAndLes = true ) : System
sink IMessageSink
prelude System.Type
registerEcsAndLes bool
리턴 System

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.
public CompleteInputOutputOptions ( ) : void
리턴 void

CompleteInputOutputOptions() 공개 메소드

public CompleteInputOutputOptions ( InputOutput file ) : void
file InputOutput
리턴 void

MaybeShowHelp() 공개 정적인 메소드

public static MaybeShowHelp ( string>.ICollection options, string>.ICollection knownOptions, TextWriter @out = null ) : bool
options string>.ICollection
knownOptions string>.ICollection
@out System.IO.TextWriter
리턴 bool

OpenSourceFiles() 공개 정적인 메소드

Opens a set of source files by file name, and creates a text file for each.
public static OpenSourceFiles ( IMessageSink sink, IEnumerable fileNames ) : List
sink IMessageSink
fileNames IEnumerable
리턴 List

ProcessArguments() 공개 메소드

Processes command-line arguments to build a BMultiMap and sends those options to the other overload of this method.
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.
public ProcessArguments ( IList args, bool warnAboutUnknownOptions, bool autoOpenInputFiles, IList inputFiles = null ) : string>.BMultiMap
args IList Arg list from which to extract options. **NOTE**: /// discovered options are removed from the list. This parameter /// cannot be an array.
warnAboutUnknownOptions bool Whether this method should /// call for you.
autoOpenInputFiles bool Whether to open input files /// for you by calling . ///
inputFiles IList 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.
리턴 string>.BMultiMap

ProcessArguments() 공개 메소드

Processes all standard command-line arguments from KnownOptions, except --help.
This method calls AddStdMacros() unless options includes "nostdmacros".
public ProcessArguments ( string>.BMultiMap options, bool warnAboutUnknownOptions, IList inputFiles = null ) : bool
options string>.BMultiMap A set of options, presumably derived from command- /// line options using
warnAboutUnknownOptions bool Whether to warn (to ) /// about options not listed in .
inputFiles IList Files to open with
리턴 bool

Run() 공개 메소드

Runs the MacroProcessor on all input Files.
public Run ( ) : void
리턴 void

ShowHelp() 공개 정적인 메소드

public static ShowHelp ( string>.IEnumerable knownOptions, TextWriter @out = null, bool includeUsageLine = true ) : void
knownOptions string>.IEnumerable
@out System.IO.TextWriter
includeUsageLine bool
리턴 void

WarnAboutUnknownOptions() 공개 정적인 메소드

public static WarnAboutUnknownOptions ( string>.BMultiMap options, IMessageSink sink, string>.IDictionary knownOptions ) : void
options string>.BMultiMap
sink IMessageSink
knownOptions string>.IDictionary
리턴 void

WriteOutput() 보호된 메소드

protected WriteOutput ( InputOutput io ) : void
io InputOutput
리턴 void

프로퍼티 상세

Files 공개적으로 프로퍼티

public List Files
리턴 List

ForceInLang 공개적으로 프로퍼티

public bool ForceInLang
리턴 bool

InLang 공개적으로 프로퍼티

public IParsingService InLang
리턴 IParsingService

IndentString 공개적으로 프로퍼티

public string IndentString
리턴 string

KnownOptions 공개적으로 정적으로 프로퍼티

public static MMap> KnownOptions
리턴 MMap>

MacroProcessor 공개적으로 프로퍼티

public MacroProcessor,LeMP MacroProcessor
리턴 MacroProcessor

NewlineString 공개적으로 프로퍼티

public string NewlineString
리턴 string

OutExt 공개적으로 프로퍼티

public string OutExt
리턴 string

OutLang 공개적으로 프로퍼티

public ILNodePrinter OutLang
리턴 ILNodePrinter

OutOptions 공개적으로 프로퍼티

public LNodePrinterOptions,Loyc.Syntax OutOptions
리턴 Loyc.Syntax.LNodePrinterOptions

Parallel 공개적으로 프로퍼티

public bool Parallel
리턴 bool

ParsingMode 공개적으로 프로퍼티

public ParsingMode,Loyc.Syntax ParsingMode
리턴 Loyc.Syntax.ParsingMode

PreserveComments 공개적으로 프로퍼티

public bool PreserveComments
리턴 bool

ShortOptions 공개적으로 정적으로 프로퍼티

public static Dictionary ShortOptions
리턴 string>.Dictionary

TwoArgOptions 공개적으로 정적으로 프로퍼티

public static InvertibleSet TwoArgOptions
리턴 InvertibleSet