UnaryTerminalParser.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /// Spart License (zlib/png)
  2. ///
  3. ///
  4. /// Copyright (c) 2003 Jonathan de Halleux
  5. ///
  6. /// This software is provided 'as-is', without any express or implied warranty.
  7. /// In no event will the authors be held liable for any damages arising from
  8. /// the use of this software.
  9. ///
  10. /// Permission is granted to anyone to use this software for any purpose,
  11. /// including commercial applications, and to alter it and redistribute it
  12. /// freely, subject to the following restrictions:
  13. ///
  14. /// 1. The origin of this software must not be misrepresented; you must not
  15. /// claim that you wrote the original software. If you use this software in a
  16. /// product, an acknowledgment in the product documentation would be
  17. /// appreciated but is not required.
  18. ///
  19. /// 2. Altered source versions must be plainly marked as such, and must not be
  20. /// misrepresented as being the original software.
  21. ///
  22. /// 3. This notice may not be removed or altered from any source distribution.
  23. ///
  24. /// Author: Jonathan de Halleuxnamespace Spart.Parsers
  25. namespace Spart.Parsers
  26. {
  27. using System;
  28. public abstract class UnaryTerminalParser : TerminalParser
  29. {
  30. private Parser m_Parser;
  31. public UnaryTerminalParser(Parser parser)
  32. :base()
  33. {
  34. Parser = parser;
  35. }
  36. public Parser Parser
  37. {
  38. get
  39. {
  40. return m_Parser;
  41. }
  42. set
  43. {
  44. if (value == null)
  45. throw new ArgumentNullException("parser is null");
  46. m_Parser = value;
  47. }
  48. }
  49. public override Parser Clone()
  50. {
  51. UnaryTerminalParser clone = base.Clone() as UnaryTerminalParser;
  52. clone.m_Parser = m_Parser.Clone();
  53. return clone;
  54. }
  55. }
  56. }