protected override Completion ExecuteImpl(ExecutionEnvironment enviroment) { if (Raw == null) { return(new Completion(null)); } int intValue; float floatValue; double doubleValue; bool b; if (Raw.StartsWith("\"") && Raw.EndsWith("\"")) { string str = GetStringLateral(Raw.Substring(1, Raw.Length - 2)); return(new Completion(str)); } if (Raw.StartsWith("'") && Raw.EndsWith("'") && Raw.Length == 3) { return(new Completion(Raw[1])); } if (Raw.StartsWith("0x", StringComparison.CurrentCultureIgnoreCase) || Raw.StartsWith("&H", StringComparison.CurrentCultureIgnoreCase)) { string hex = Raw.Substring(2); uint uintValue; if (uint.TryParse(hex, System.Globalization.NumberStyles.HexNumber, CultureInfo.CurrentCulture, out uintValue)) { return(new Completion(uintValue)); } } if (Raw.Equals("true", StringComparison.CurrentCultureIgnoreCase)) { return(new Completion(true)); } if (Raw.Equals("false", StringComparison.CurrentCultureIgnoreCase)) { return(new Completion(false)); } if (Raw.Equals("null", StringComparison.CurrentCultureIgnoreCase)) { return(new Completion(null)); } if (int.TryParse(Raw, out intValue)) { return(new Completion(intValue)); } if (float.TryParse(Raw, out floatValue)) { return(new Completion(floatValue)); } if (double.TryParse(Raw, out doubleValue)) { return(new Completion(doubleValue)); } if (Boolean.TryParse(Raw, out b)) { return(new Completion(b)); } //if (enviroment.HasValue(Raw)) // return new Completion(enviroment.GetValue(Raw)); return(Completion.Exception(string.Format(Properties.Language.InvalidFormat, Raw), this)); }
protected bool Equals(JsTemplateElementValue other) { return(Raw.Equals(other.Raw) && Cooked.Equals(other.Cooked)); }