Example #1
0
 /// <summary>
 /// Preferred constructor call for creating non list values
 /// </summary>
 /// <param name="type">Type of Sexp</param>
 /// <param name="value">Value to be interpreted</param>
 /// <param name="line">The line the Sexp is found at: defaults to -1</param>
 public Sexp(SexpType type, String value, int line)
 {
     Line  = line;
     _type = type;
     if (type == SexpType.INT)
     {
         _int = int.Parse(value);
     }
     else if (type == SexpType.FLOAT)
     {
         _float = float.Parse(value);
     }
     else if (type == SexpType.BOOL)
     {
         if (value == "T")
         {
             _bool = true;
         }
         else
         {
             _bool = false;
         }
     }
     else
     {
         _value = value;
     }
 }
Example #2
0
 public Sexp()
 {
     Line   = -2;                  // default value set elsewhere
     _type  = SexpType.LIST;
     _sexps = new List <Sexp>(10); // reserve 10 pieces of memory
     _value = String.Empty;
 }
Example #3
0
        public Sexp(
	SexpType type, string atom, LinkedList<Sexp> list,
	int line, int column)
        {
            if( type == SexpType.LIST )
            Debug.Assert( list != null );
            _type = type;
            _atom = atom;
            _list = list;
            _line = line;
            _column = column;
        }
 static Sexp terminal(SexpType type, Token t)
 {
     return new Sexp(type, t.Text, null, t.Line, t.Pos);
 }