Class QuantumParser
Handles parsing values to use as console inputs.
Namespace: QFSW.QC
Assembly: QFSW.QC.dll
Syntax
public class QuantumParser
Constructors
QuantumParser()
Creates a Quantum Parser with the default injected parsers.
Declaration
public QuantumParser()
QuantumParser(IEnumerable<IQcParser>, IEnumerable<IQcGrammarConstruct>)
Creates a Quantum Parser with a custom set of parsers.
Declaration
public QuantumParser(IEnumerable<IQcParser> parsers, IEnumerable<IQcGrammarConstruct> grammarConstructs)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<IQcParser> | parsers | The IQcParsers to use in this Quantum Parser. |
IEnumerable<IQcGrammarConstruct> | grammarConstructs | The IQcGrammarConstructs to use in this Quantum Parser |
Methods
AddNamespace(String)
Adds a namespace to the table so that it can be used to type resolution.
Declaration
public static void AddNamespace(string namespaceName)
Parameters
Type | Name | Description |
---|---|---|
String | namespaceName |
CanParse(Type)
Declaration
public bool CanParse(Type type)
Parameters
Type | Name | Description |
---|---|---|
Type | type |
Returns
Type | Description |
---|---|
Boolean |
GetAllNamespaces()
Returns a copy of the namespace table.
Declaration
public static IEnumerable<string> GetAllNamespaces()
Returns
Type | Description |
---|---|
IEnumerable<String> |
GetParser(Type)
Declaration
public IQcParser GetParser(Type type)
Parameters
Type | Name | Description |
---|---|---|
Type | type |
Returns
Type | Description |
---|---|
IQcParser |
Parse(String, Type)
Parses a serialized string of data.
Declaration
public object Parse(string value, Type type)
Parameters
Type | Name | Description |
---|---|---|
String | value | The string to parse. |
Type | type | The type of the value to parse. |
Returns
Type | Description |
---|---|
Object | The parsed value. |
Parse<T>(String)
Parses a serialized string of data.
Declaration
public T Parse<T>(string value)
Parameters
Type | Name | Description |
---|---|---|
String | value | The string to parse. |
Returns
Type | Description |
---|---|
T | The parsed value. |
Type Parameters
Name | Description |
---|---|
T | The type of the value to parse. |
ParseType(String)
Parses and infers the type specified by the string.
Declaration
public static Type ParseType(string typeName)
Parameters
Type | Name | Description |
---|---|---|
String | typeName | The type to parse. |
Returns
Type | Description |
---|---|
Type | The parsed type. |
RemoveNamespace(String)
Removes a namespace to the table so that it is no longer used to type resolution.
Declaration
public static void RemoveNamespace(string namespaceName)
Parameters
Type | Name | Description |
---|---|---|
String | namespaceName |
ResetNamespaceTable()
Resets the namespace table to its initial state.
Declaration
public static void ResetNamespaceTable()