PageRenderTime 39ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/Dependencies/boo/src/Boo.Lang.Parser/antlr/antlr/Token.cs

https://github.com/w4x/boolangstudio
C# | 99 lines | 68 code | 12 blank | 19 comment | 0 complexity | 12b3ea45256024dedd3bd16085d40c49 MD5 | raw file
Possible License(s): GPL-2.0
  1. using System;
  2. namespace antlr
  3. {
  4. /*ANTLR Translator Generator
  5. * Project led by Terence Parr at http://www.jGuru.com
  6. * Software rights: http://www.antlr.org/license.html
  7. *
  8. * $Id:$
  9. */
  10. //
  11. // ANTLR C# Code Generator by Micheal Jordan
  12. // Kunle Odutola : kunle UNDERSCORE odutola AT hotmail DOT com
  13. // Anthony Oguntimehin
  14. //
  15. // With many thanks to Eric V. Smith from the ANTLR list.
  16. //
  17. /*A token is minimally a token type. Subclasses can add the text matched
  18. * for the token and line info.
  19. */
  20. public class Token : IToken //, ICloneable
  21. {
  22. // constants
  23. public const int MIN_USER_TYPE = 4;
  24. public const int NULL_TREE_LOOKAHEAD = 3;
  25. public const int INVALID_TYPE = 0;
  26. public const int EOF_TYPE = 1;
  27. public static readonly int SKIP = - 1;
  28. // each Token has at least a token type
  29. protected int type_;
  30. // the illegal token object
  31. public static Token badToken = new Token(INVALID_TYPE, "<no text>");
  32. public Token()
  33. {
  34. type_ = INVALID_TYPE;
  35. }
  36. public Token(int t)
  37. {
  38. type_ = t;
  39. }
  40. public Token(int t, string txt)
  41. {
  42. type_ = t;
  43. setText(txt);
  44. }
  45. public virtual int getColumn()
  46. {
  47. return 0;
  48. }
  49. public virtual int getLine()
  50. {
  51. return 0;
  52. }
  53. public virtual string getFilename()
  54. {
  55. return null;
  56. }
  57. public virtual void setFilename(string name)
  58. {
  59. }
  60. public virtual string getText()
  61. {
  62. return "<no text>";
  63. }
  64. public int Type
  65. {
  66. get { return type_; }
  67. set { type_ = value; }
  68. }
  69. public virtual void setType(int newType) { this.Type = newType; }
  70. public virtual void setColumn(int c)
  71. {
  72. ;
  73. }
  74. public virtual void setLine(int l)
  75. {
  76. ;
  77. }
  78. public virtual void setText(string t)
  79. {
  80. ;
  81. }
  82. override public string ToString()
  83. {
  84. return "[\"" + getText() + "\",<" + type_ + ">]";
  85. }
  86. }
  87. }