Enhanced C#
Language of your choice: library documentation
|
Extension methods for IParsingService. More...
Extension methods for IParsingService.
Nested classes | |
struct | PushedCurrent |
Returned by PushCurrent(IParsingService). More... | |
Public static fields | |
static readonly Symbol | Exprs = GSymbol.Get("Exprs") |
Tells IParsingService.Parse to treat the input as a single expression or expression list (which, in most languages, is comma-separated). More... | |
static readonly Symbol | Stmts = GSymbol.Get("Stmts") |
Tells IParsingService.Parse to treat the input as a list of statements. If the language makes a distinction between executable and declaration contexts, this refers to the executable context. More... | |
static readonly Symbol | File = GSymbol.Get("File") |
Tells IParsingService.Parse to treat the input as a complete source file (this should be the default, i.e. null will do the same thing). More... | |
Properties | |
static IParsingService | Current [get, set] |
Gets or sets the active language service on this thread. If no service has been assigned on this thread, returns LesLanguageService.Value. More... | |
static IReadOnlyDictionary < string, IParsingService > | RegisteredLanguages [get] |
Dictionary of registered parsing services, keyed by file extension (without leading dots). The default dictionary contains one pair: ("les", LesLanguageService.Value) More... | |
Static Public Member Functions | |
static int | Register (IParsingService service, IEnumerable< string > fileExtensions=null) |
Registers a parsing service. More... | |
static int | Unregister (IParsingService service, IEnumerable< string > fileExtensions=null) |
Unregisters a language service. More... | |
static IParsingService | GetServiceForFileName (string filename) |
Finds the language service associated with the longest matching registered file extension. More... | |
static PushedCurrent | PushCurrent (IParsingService newValue) |
Sets the current language service, returning a value suitable for use in a C# using statement, which will restore the old service. More... | |
static string | Print (this IParsingService self, LNode node) |
static ILexer< Token > | Tokenize (this IParsingService parser, UString input, IMessageSink msgs=null) |
static IListSource< LNode > | Parse (this IParsingService parser, UString input, IMessageSink msgs=null, Symbol inputType=null) |
static LNode | ParseSingle (this IParsingService parser, UString expr, IMessageSink msgs=null, Symbol inputType=null) |
static LNode | ParseSingle (this IParsingService parser, ICharSource file, string fileName, IMessageSink msgs=null, Symbol inputType=null) |
static IListSource< LNode > | Parse (this IParsingService parser, Stream stream, string fileName, IMessageSink msgs=null, Symbol inputType=null) |
static ILexer< Token > | Tokenize (this IParsingService parser, Stream stream, string fileName, IMessageSink msgs=null) |
static IListSource< LNode > | ParseFile (this IParsingService parser, string fileName, IMessageSink msgs=null, Symbol inputType=null) |
static ILexer< Token > | TokenizeFile (this IParsingService parser, string fileName, IMessageSink msgs=null) |
static string | PrintMultiple (this LNodePrinter printer, IEnumerable< LNode > nodes, IMessageSink msgs=null, object mode=null, string indentString="\t", string lineSeparator="\n") |
Converts a sequences of LNodes to strings, adding a newline after each. More... | |
static string | Print (this IParsingService service, IEnumerable< LNode > nodes, IMessageSink msgs=null, object mode=null, string indentString="\t", string lineSeparator="\n") |
|
inlinestatic |
Finds the language service associated with the longest matching registered file extension.
Returns null if there is no registered language service for the filename's extension.
|
inlinestatic |
Converts a sequences of LNodes to strings, adding a newline after each.
printer | Printer for a single LNode. |
mode | A language-specific way of modifying printer behavior. The printer ignores the mode object if it does not not understand it. |
indentString | A string to print for each level of indentation, such as a tab or four spaces. |
lineSeparator | Line separator, typically "\n" or "\r\n". |
|
inlinestatic |
Sets the current language service, returning a value suitable for use in a C# using statement, which will restore the old service.
newValue | new value of Current |
LNode code; using (var old = ParsingService.PushCurrent(LesLanguageService.Value)) code = ParsingService.Current.ParseSingle("This `is` LES_code;");
|
inlinestatic |
Registers a parsing service.
service | Service to register. |
fileExtensions | File extensions affected (null to use the service's own list) |
This method does not replace existing registrations.
|
inlinestatic |
Unregisters a language service.
service | Service to unregister |
fileExtensions | File extensions affected (null to use the service's own list) |
The service for a file extension is not removed unless the given service reference is equal to the registered service.
|
static |
Tells IParsingService.Parse to treat the input as a single expression or expression list (which, in most languages, is comma-separated).
Referenced by Loyc.Syntax.Les.LesLanguageService.Parse(), and Loyc.Ecs.EcsLanguageService.Parse().
|
static |
Tells IParsingService.Parse to treat the input as a complete source file (this should be the default, i.e. null will do the same thing).
|
static |
Tells IParsingService.Parse to treat the input as a list of statements. If the language makes a distinction between executable and declaration contexts, this refers to the executable context.
|
staticgetset |
Gets or sets the active language service on this thread. If no service has been assigned on this thread, returns LesLanguageService.Value.
|
staticget |
Dictionary of registered parsing services, keyed by file extension (without leading dots). The default dictionary contains one pair: ("les", LesLanguageService.Value)