C# Class Loyc.Syntax.ParsingService

Extension methods for IParsingService.
显示文件 Open project: qwertie/ecsharp

Private Properties

Property Type Description
ExtensionMatches bool
InitRegisteredLanguages IParsingService>.Map
Single LNode

Public Methods

Method Description
GetServiceForFileName ( string filename ) : IParsingService

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.

Parse ( this parser, Stream stream, string fileName, ParsingMode inputType = null, IMessageSink msgs = null, bool preserveComments = true ) : IListSource

Parses a Stream.

Parse ( this parser, UString input, IMessageSink msgs = null, ParsingMode inputType = null, bool preserveComments = true ) : IListSource

Parses a string by invoking IParsingService.Parse(ICharSource, string, IMessageSink, ParsingMode, bool) using an empty string as the file name.

ParseFile ( this parser, string fileName, IMessageSink msgs = null, ParsingMode inputType = null, bool preserveComments = true ) : IListSource

Opens the specified file and parses it.

ParseSingle ( this parser, ICharSource text, string fileName, IMessageSink msgs = null, ParsingMode inputType = null, bool preserveComments = true ) : LNode

Parses a string and expects exactly one output.

ParseSingle ( this parser, UString expr, IMessageSink msgs = null, ParsingMode inputType = null, bool preserveComments = true ) : LNode

Parses a string and expects exactly one output.

PushCurrent ( IParsingService newValue ) : PushedCurrent

Sets the current language service, returning a value suitable for use in a C# using statement, which will restore the old service.

Register ( IParsingService service, IEnumerable fileExtensions = null ) : int

Registers a parsing service.

This method does not replace existing registrations.

SetDefault ( IParsingService newValue ) : SavedValue
Tokenize ( this parser, Stream stream, string fileName, IMessageSink msgs = null ) : ILexer

Parses a Stream.

Tokenize ( this parser, UString input, IMessageSink msgs = null ) : ILexer

Parses a string by invoking IParsingService.Tokenize(ICharSource, string, IMessageSink) using an empty string as the file name.

TokenizeFile ( this parser, string fileName, IMessageSink msgs = null ) : ILexer

Opens the specified file and tokenizes it.

Unregister ( IParsingService service, IEnumerable fileExtensions = null ) : int

Unregisters a language service.

The service for a file extension is not removed unless the given service reference is equal to the registered service.

Private Methods

Method Description
ExtensionMatches ( string ext, string fn ) : bool
InitRegisteredLanguages ( ) : IParsingService>.Map
Single ( IListSource e ) : LNode

Method Details

GetServiceForFileName() public static method

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.
public static GetServiceForFileName ( string filename ) : IParsingService
filename string
return IParsingService

Parse() public static method

Parses a Stream.
public static Parse ( this parser, Stream stream, string fileName, ParsingMode inputType = null, IMessageSink msgs = null, bool preserveComments = true ) : IListSource
parser this
stream Stream
fileName string
inputType ParsingMode
msgs IMessageSink
preserveComments bool
return IListSource

Parse() public static method

Parses a string by invoking IParsingService.Parse(ICharSource, string, IMessageSink, ParsingMode, bool) using an empty string as the file name.
public static Parse ( this parser, UString input, IMessageSink msgs = null, ParsingMode inputType = null, bool preserveComments = true ) : IListSource
parser this
input UString
msgs IMessageSink
inputType ParsingMode
preserveComments bool
return IListSource

ParseFile() public static method

Opens the specified file and parses it.
public static ParseFile ( this parser, string fileName, IMessageSink msgs = null, ParsingMode inputType = null, bool preserveComments = true ) : IListSource
parser this
fileName string
msgs IMessageSink
inputType ParsingMode
preserveComments bool
return IListSource

ParseSingle() public static method

Parses a string and expects exactly one output.
The output list was empty or contained multiple nodes.
public static ParseSingle ( this parser, ICharSource text, string fileName, IMessageSink msgs = null, ParsingMode inputType = null, bool preserveComments = true ) : LNode
parser this
text ICharSource
fileName string
msgs IMessageSink
inputType ParsingMode
preserveComments bool
return LNode

ParseSingle() public static method

Parses a string and expects exactly one output.
The output list was empty or contained multiple nodes.
public static ParseSingle ( this parser, UString expr, IMessageSink msgs = null, ParsingMode inputType = null, bool preserveComments = true ) : LNode
parser this
expr UString
msgs IMessageSink
inputType ParsingMode
preserveComments bool
return LNode

PushCurrent() public static method

Sets the current language service, returning a value suitable for use in a C# using statement, which will restore the old service.
public static PushCurrent ( IParsingService newValue ) : PushedCurrent
newValue IParsingService new value of Current
return PushedCurrent

Register() public static method

Registers a parsing service.
This method does not replace existing registrations.
public static Register ( IParsingService service, IEnumerable fileExtensions = null ) : int
service IParsingService Service to register.
fileExtensions IEnumerable File extensions affected (null to use the service's own list)
return int

SetDefault() public static method

public static SetDefault ( IParsingService newValue ) : SavedValue
newValue IParsingService
return SavedValue

Tokenize() public static method

Parses a Stream.
public static Tokenize ( this parser, Stream stream, string fileName, IMessageSink msgs = null ) : ILexer
parser this
stream Stream
fileName string
msgs IMessageSink
return ILexer

Tokenize() public static method

Parses a string by invoking IParsingService.Tokenize(ICharSource, string, IMessageSink) using an empty string as the file name.
public static Tokenize ( this parser, UString input, IMessageSink msgs = null ) : ILexer
parser this
input UString
msgs IMessageSink
return ILexer

TokenizeFile() public static method

Opens the specified file and tokenizes it.
public static TokenizeFile ( this parser, string fileName, IMessageSink msgs = null ) : ILexer
parser this
fileName string
msgs IMessageSink
return ILexer

Unregister() public static method

Unregisters a language service.
The service for a file extension is not removed unless the given service reference is equal to the registered service.
public static Unregister ( IParsingService service, IEnumerable fileExtensions = null ) : int
service IParsingService Service to unregister
fileExtensions IEnumerable File extensions affected (null to use the service's own list)
return int