void ReplaceNode(ITree parent, int index, object val, SimpleTypeEnum type) { CommonTree node = null; var token = new CommonToken(-1, val.ToString()); switch (type) { case SimpleTypeEnum.Bool: node = new BoolNode(token); break; case SimpleTypeEnum.Byte: node = new ByteNode(token); break; case SimpleTypeEnum.Char: node = new CharNode(token); break; case SimpleTypeEnum.Int: node = new IntegerNode(token); break; case SimpleTypeEnum.Float: node = new FloatNode(token); break; case SimpleTypeEnum.Double: node = new RealNode(token); break; default: throw new ArgumentOutOfRangeException("type", type, null); } parent.ReplaceChildren(index, index, node); }
public void Convert(SimpleTypeEnum stype) { Code c = Code.CastInt; switch (stype) { case SimpleTypeEnum.Bool: c = Code.CastByte; break; case SimpleTypeEnum.Byte: c = Code.CastByte; break; case SimpleTypeEnum.Char: c = Code.CastChar; break; case SimpleTypeEnum.Int: c = Code.CastInt; break; case SimpleTypeEnum.Float: c = Code.CastFloat; break; case SimpleTypeEnum.Double: c = Code.CastDouble; break; default: throw new ArgumentOutOfRangeException("stype", stype, null); } AddCommand(c, ""); }
public SimpleType(SimpleTypeEnum type) : base(type.ToString().ToLower()) { this.SType = type; }
public ValInfo(object val, SimpleTypeEnum type, bool isConst) { this.val = val; this.type = type; this.isConst = isConst; }