Enhanced C#
Loyc library documentation
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
Public Member Functions | List of all members
Loyc.Syntax.ILiteralParser Interface Reference

This interface for parsing text into objects is implemented by LiteralHandlerTable. More...


Source file:
Inheritance diagram for Loyc.Syntax.ILiteralParser:
Loyc.Syntax.LiteralHandlerTable Loyc.Syntax.StandardLiteralHandlers Loyc.Ecs.Parser.EcsLiteralHandlers

Remarks

This interface for parsing text into objects is implemented by LiteralHandlerTable.

Public Member Functions

bool CanParse (Symbol typeMarker)
 Returns true if this object has a parser for the specified type marker. Returns false if typeMarker == null. More...
 
Either< object, ILogMessageTryParse (UString textValue, Symbol typeMarker)
 Attempts to parse a string with a given type marker. More...
 

Member Function Documentation

bool Loyc.Syntax.ILiteralParser.CanParse ( Symbol  typeMarker)

Returns true if this object has a parser for the specified type marker. Returns false if typeMarker == null.

Implemented in Loyc.Syntax.LiteralHandlerTable.

Either<object, ILogMessage> Loyc.Syntax.ILiteralParser.TryParse ( UString  textValue,
Symbol  typeMarker 
)

Attempts to parse a string with a given type marker.

Parameters
textValueA text value that has already been preprocessed to remove escape sequences.
typeMarkerIndicates the type of the value. There is a standard set of type markers; please see the documention of StandardLiteralHandlers. If typeMarker is null, it is treated as an empty string.
Returns
Returns either the parsed value or an error message. Does not throw.

If the problem is that the type marker doesn't have an associated parser, the returned LogMessage should not have a Severity of Error; LiteralHandlerTable uses Severity.Note for this.

Implemented in Loyc.Syntax.LiteralHandlerTable.