PageRenderTime 44ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/Dependencies/boo/lib/antlr-2.7.5/lib/csharp/src/antlr/CommonASTWithHiddenTokens.cs

https://github.com/w4x/boolangstudio
C# | 104 lines | 65 code | 16 blank | 23 comment | 0 complexity | bd139febfd3bce30f95c0c27641d6512 MD5 | raw file
Possible License(s): GPL-2.0
  1. using System;
  2. using AST = antlr.collections.AST;
  3. namespace antlr
  4. {
  5. /*ANTLR Translator Generator
  6. * Project led by Terence Parr at http://www.jGuru.com
  7. * Software rights: http://www.antlr.org/license.html
  8. *
  9. * $Id:$
  10. */
  11. //
  12. // ANTLR C# Code Generator by Micheal Jordan
  13. // Kunle Odutola : kunle UNDERSCORE odutola AT hotmail DOT com
  14. // Anthony Oguntimehin
  15. //
  16. // With many thanks to Eric V. Smith from the ANTLR list.
  17. //
  18. /*A CommonAST whose initialization copies hidden token
  19. * information from the Token used to create a node.
  20. */
  21. public class CommonASTWithHiddenTokens : CommonAST
  22. {
  23. new public static readonly CommonASTWithHiddenTokens.CommonASTWithHiddenTokensCreator Creator = new CommonASTWithHiddenTokensCreator();
  24. protected internal IHiddenStreamToken hiddenBefore, hiddenAfter; // references to hidden tokens
  25. public CommonASTWithHiddenTokens() : base()
  26. {
  27. }
  28. public CommonASTWithHiddenTokens(IToken tok) : base(tok)
  29. {
  30. }
  31. [Obsolete("Deprecated since version 2.7.2. Use ASTFactory.dup() instead.", false)]
  32. protected CommonASTWithHiddenTokens(CommonASTWithHiddenTokens another) : base(another)
  33. {
  34. hiddenBefore = another.hiddenBefore;
  35. hiddenAfter = another.hiddenAfter;
  36. }
  37. public virtual IHiddenStreamToken getHiddenAfter()
  38. {
  39. return hiddenAfter;
  40. }
  41. public virtual IHiddenStreamToken getHiddenBefore()
  42. {
  43. return hiddenBefore;
  44. }
  45. override public void initialize(AST t)
  46. {
  47. hiddenBefore = ((CommonASTWithHiddenTokens) t).getHiddenBefore();
  48. hiddenAfter = ((CommonASTWithHiddenTokens) t).getHiddenAfter();
  49. base.initialize(t);
  50. }
  51. override public void initialize(IToken tok)
  52. {
  53. IHiddenStreamToken t = (IHiddenStreamToken) tok;
  54. base.initialize(t);
  55. hiddenBefore = t.getHiddenBefore();
  56. hiddenAfter = t.getHiddenAfter();
  57. }
  58. #region Implementation of ICloneable
  59. [Obsolete("Deprecated since version 2.7.2. Use ASTFactory.dup() instead.", false)]
  60. override public object Clone()
  61. {
  62. return new CommonASTWithHiddenTokens(this);
  63. }
  64. #endregion
  65. public class CommonASTWithHiddenTokensCreator : ASTNodeCreator
  66. {
  67. public CommonASTWithHiddenTokensCreator() {}
  68. /// <summary>
  69. /// Returns the fully qualified name of the AST type that this
  70. /// class creates.
  71. /// </summary>
  72. public override string ASTNodeTypeName
  73. {
  74. get
  75. {
  76. return typeof(antlr.CommonASTWithHiddenTokens).FullName;;
  77. }
  78. }
  79. /// <summary>
  80. /// Constructs a <see cref="AST"/> instance.
  81. /// </summary>
  82. public override AST Create()
  83. {
  84. return new CommonASTWithHiddenTokens();
  85. }
  86. }
  87. }
  88. }