This commit is contained in:
Даниил Заикин
2026-06-17 20:44:53 +03:00
parent 9d153773c2
commit b133e7c656
1880 changed files with 244545 additions and 0 deletions
@@ -0,0 +1,33 @@
using System;
namespace QFSW.QC
{
/// <summary>
/// Creates a Parser for a custom grammar construct that is loaded and used by the QuantumParser.
/// Grammar constructs are tested and used before resorting to IQcParsers for object value parsing.
/// </summary>
public interface IQcGrammarConstruct
{
/// <summary>
/// The precedence of this grammar construct.
/// </summary>
int Precedence { get; }
/// <summary>
/// If the incoming data matches this grammar construct.
/// </summary>
/// <param name="value">The incoming string data.</param>
/// <param name="type">The type to test.</param>
/// <returns>If it matches the grammar defined by this construct.</returns>
bool Match(string value, Type type);
/// <summary>
/// Parses the incoming string to the specified type.
/// </summary>
/// <param name="value">The incoming string data.</param>
/// <param name="type">The type to parse the incoming string to.</param>
/// <param name="recursiveParser">Delegate back to the main parser to allow for recursive parsing of sub elements.</param>
/// <returns>The parsed object.</returns>
object Parse(string value, Type type, Func<string, Type, object> recursiveParser);
}
}