public TypeReference(string fullName, Assembly assembly) { Name = fullName; var bit = BaseIntegerType.Types.Find(p => p.Name == fullName); if (bit != null) { Type = TypeReferenceType.Integer; IntegerType = bit; return; } else if (ArrayType.ArrayTypeRegex.IsMatch(fullName)) { Type = TypeReferenceType.Array; ArrayType = new ArrayType(fullName, assembly); } else if (fullName == StringType.StringTypeKeyword) { Type = TypeReferenceType.Array; ArrayType = new StringType(assembly); } else { Type = TypeReferenceType.Class; } assembly?.RegisterType(this); }
public TypeReference(BaseIntegerType intType, Assembly assembly) { Type = TypeReferenceType.Integer; Name = intType.Name; IntegerType = intType; assembly?.RegisterType(this); }
protected override ParseError Parse(string str, BaseIntegerType type, out Constant constant) { constant = new Constant(type); ulong value = 0; try { value = Convert.ToUInt64(str); } catch (OverflowException) { return(new ParseError(ParseErrorType.Syntax_Constant_TooLong)); } if (CheckMaxValues(value, type)) { return(new ParseError(ParseErrorType.Syntax_Constant_BaseOverflow)); } constant.IntValue = new Integer(value, type); return(null); }
internal Constant(BaseIntegerType type) { Type = TypeReferenceType.Integer; IntValue = new Integer(0, type); }
protected virtual ParseError Parse(string str, BaseIntegerType type, out Constant constant) { constant = null; return(null); }
public bool CheckMaxValues(ulong value, BaseIntegerType type) { return((value > type.MaxValue) || ((long)value < type.MinValue)); }