SubWord.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. namespace NTERA.EmuEra.Game.EraEmu.Sub
  2. {
  3. /// <summary>
  4. /// FormattedStringWTの中身用のトークン
  5. /// </summary>
  6. internal abstract class SubWord
  7. {
  8. protected SubWord(WordCollection w) { words = w; }
  9. readonly WordCollection words;
  10. public WordCollection Words => words;
  11. public bool IsMacro;
  12. public virtual void SetIsMacro()
  13. {
  14. IsMacro = true;
  15. if(Words != null)
  16. Words.SetIsMacro();
  17. }
  18. }
  19. internal sealed class TripleSymbolSubWord : SubWord
  20. {
  21. public TripleSymbolSubWord(char c) : base(null) { code = c; }
  22. readonly char code;
  23. public char Code => code;
  24. }
  25. internal sealed class CurlyBraceSubWord : SubWord
  26. {
  27. public CurlyBraceSubWord(WordCollection w) : base(w) { }
  28. }
  29. internal sealed class PercentSubWord : SubWord
  30. {
  31. public PercentSubWord(WordCollection w) : base(w) { }
  32. }
  33. internal sealed class YenAtSubWord : SubWord
  34. {
  35. public YenAtSubWord(WordCollection w, StrFormWord fsLeft, StrFormWord fsRight)
  36. : base(w)
  37. {
  38. left = fsLeft;
  39. right = fsRight;
  40. }
  41. readonly StrFormWord left;
  42. readonly StrFormWord right;
  43. public StrFormWord Left => left;
  44. public StrFormWord Right => right;
  45. public override void SetIsMacro()
  46. {
  47. IsMacro = true;
  48. Words.SetIsMacro();
  49. Left.SetIsMacro();
  50. Right.SetIsMacro();
  51. }
  52. }
  53. }