PageRenderTime 55ms CodeModel.GetById 27ms RepoModel.GetById 1ms app.codeStats 0ms

/Token.cs

https://bitbucket.org/cvillamor/compiler
C# | 103 lines | 88 code | 14 blank | 1 comment | 0 complexity | fe40c7b86f30b241d22afebcdb5aa74c MD5 | raw file
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. namespace Compiler_
  6. {
  7. struct NameList
  8. {
  9. public NameList(string n, TYPE t, int lo=0, int hi=0, int s=-1, bool arrType=false)
  10. {
  11. name = n;
  12. this.t = t;
  13. size = s;
  14. arrayType = arrType;
  15. this.lo = lo;
  16. this.hi = hi;
  17. }
  18. public string name;
  19. public TYPE t;
  20. public int size;
  21. public bool arrayType;
  22. public int hi;
  23. public int lo;
  24. }
  25. class Token
  26. {
  27. private TYPE m_t;
  28. private TOKEN_TYPES m_tt;
  29. private object m_tv;
  30. private string m_curr;
  31. private int m_line;
  32. private int m_col;
  33. private bool m_scanned;
  34. public Token()
  35. {
  36. }
  37. //Copy Constructor
  38. public Token(Token tt)
  39. {
  40. m_scanned = TOKEN_SCANNED;
  41. m_t = tt.TYPE;
  42. m_tt = tt.TOKEN_TYPE;
  43. m_tv = tt.TOKEN_VALUE;
  44. m_curr = tt.TOKEN_CURRENT;
  45. m_line = tt.TOKEN_LINE;
  46. m_col = tt.TOKEN_COL;
  47. }
  48. public TYPE TYPE
  49. {
  50. get { return m_t; }
  51. set { m_t = value; }
  52. }
  53. public bool TOKEN_SCANNED
  54. {
  55. get { return m_scanned; }
  56. set { m_scanned = value; }
  57. }
  58. public TOKEN_TYPES TOKEN_TYPE
  59. {
  60. get { return m_tt; }
  61. set { m_tt = value; }
  62. }
  63. public object TOKEN_VALUE
  64. {
  65. get { return m_tv; }
  66. set { m_tv = value; }
  67. }
  68. public string TOKEN_CURRENT
  69. {
  70. get { return m_curr; }
  71. set { m_curr = value; }
  72. }
  73. public int TOKEN_LINE
  74. {
  75. get { return m_line; }
  76. set { m_line = value; }
  77. }
  78. public int TOKEN_COL
  79. {
  80. get { return m_col; }
  81. set { m_col = value; }
  82. }
  83. public string VALUE
  84. {
  85. get { return m_tv.ToString(); }
  86. set { m_tv = value; }
  87. }
  88. }
  89. }