/Token.cs
C# | 103 lines | 88 code | 14 blank | 1 comment | 0 complexity | fe40c7b86f30b241d22afebcdb5aa74c MD5 | raw file
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace Compiler_
- {
- struct NameList
- {
- public NameList(string n, TYPE t, int lo=0, int hi=0, int s=-1, bool arrType=false)
- {
- name = n;
- this.t = t;
- size = s;
- arrayType = arrType;
- this.lo = lo;
- this.hi = hi;
- }
- public string name;
- public TYPE t;
- public int size;
- public bool arrayType;
- public int hi;
- public int lo;
- }
-
- class Token
- {
- private TYPE m_t;
- private TOKEN_TYPES m_tt;
- private object m_tv;
- private string m_curr;
- private int m_line;
- private int m_col;
- private bool m_scanned;
- public Token()
- {
- }
- //Copy Constructor
- public Token(Token tt)
- {
- m_scanned = TOKEN_SCANNED;
- m_t = tt.TYPE;
- m_tt = tt.TOKEN_TYPE;
- m_tv = tt.TOKEN_VALUE;
- m_curr = tt.TOKEN_CURRENT;
- m_line = tt.TOKEN_LINE;
- m_col = tt.TOKEN_COL;
- }
- public TYPE TYPE
- {
- get { return m_t; }
- set { m_t = value; }
- }
- public bool TOKEN_SCANNED
- {
- get { return m_scanned; }
- set { m_scanned = value; }
- }
- public TOKEN_TYPES TOKEN_TYPE
- {
- get { return m_tt; }
- set { m_tt = value; }
- }
- public object TOKEN_VALUE
- {
- get { return m_tv; }
- set { m_tv = value; }
- }
- public string TOKEN_CURRENT
- {
- get { return m_curr; }
- set { m_curr = value; }
- }
- public int TOKEN_LINE
- {
- get { return m_line; }
- set { m_line = value; }
- }
- public int TOKEN_COL
- {
- get { return m_col; }
- set { m_col = value; }
- }
- public string VALUE
- {
- get { return m_tv.ToString(); }
- set { m_tv = value; }
- }
- }
- }