60 lines
2.0 KiB
C#
60 lines
2.0 KiB
C#
using System;
|
|
using System.Reflection;
|
|
|
|
namespace Cryville.Common.Pdt {
|
|
/// <summary>
|
|
/// Interpreter for fragments in Property Definition Tree (PDT) file format.
|
|
/// </summary>
|
|
public class PdtFragmentInterpreter : PdtInterpreter {
|
|
public PdtFragmentInterpreter() : base(null, new EmptyBinder()) { }
|
|
|
|
/// <summary>
|
|
/// Sets the new source string for the fragment interpreter and resets the position.
|
|
/// </summary>
|
|
/// <param name="value">The new source string.</param>
|
|
public void SetSource(string value) {
|
|
Source = value;
|
|
Position = 0;
|
|
}
|
|
|
|
/// <summary>
|
|
/// The binder.
|
|
/// </summary>
|
|
public Binder Binder {
|
|
get { return _binder; }
|
|
set { _binder = value; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Reads the current character and increments the position.
|
|
/// </summary>
|
|
/// <returns>The current character.</returns>
|
|
/// <exception cref="IndexOutOfRangeException">The end of the source string is reached.</exception>
|
|
public new char GetChar() { return base.GetChar(); }
|
|
/// <summary>
|
|
/// Reads an identifier.
|
|
/// </summary>
|
|
/// <returns>An identifier.</returns>
|
|
/// <exception cref="IndexOutOfRangeException">The end of the source string is reached.</exception>
|
|
public new string GetIdentifier() { return base.GetIdentifier(); }
|
|
/// <summary>
|
|
/// Reads a number.
|
|
/// </summary>
|
|
/// <returns>A number.</returns>
|
|
/// <exception cref="IndexOutOfRangeException">The end of the source string is reached.</exception>
|
|
public new string GetNumber() { return base.GetNumber(); }
|
|
/// <summary>
|
|
/// Reads a string.
|
|
/// </summary>
|
|
/// <returns>A string.</returns>
|
|
/// <exception cref="IndexOutOfRangeException">The end of the source string is reached.</exception>
|
|
public new string GetString() { return base.GetString(); }
|
|
/// <summary>
|
|
/// Reads an expression.
|
|
/// </summary>
|
|
/// <returns>An expression.</returns>
|
|
/// <exception cref="IndexOutOfRangeException">The end of the source string is reached.</exception>
|
|
public new PdtExpression GetExp() { return base.GetExp(); }
|
|
}
|
|
}
|